diff options
Diffstat (limited to 'drivers')
359 files changed, 7884 insertions, 5074 deletions
diff --git a/drivers/acpi/acpica/accommon.h b/drivers/acpi/acpica/accommon.h index 3b20786cbb0d..3e50c74ed4a1 100644 --- a/drivers/acpi/acpica/accommon.h +++ b/drivers/acpi/acpica/accommon.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acconfig.h b/drivers/acpi/acpica/acconfig.h index a4471e3d3853..33181ad350d5 100644 --- a/drivers/acpi/acpica/acconfig.h +++ b/drivers/acpi/acpica/acconfig.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h index a4fb001d96f1..48faf3eba9fb 100644 --- a/drivers/acpi/acpica/acdebug.h +++ b/drivers/acpi/acpica/acdebug.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acdispat.h b/drivers/acpi/acpica/acdispat.h index 6291904be01e..894a0ff2a946 100644 --- a/drivers/acpi/acpica/acdispat.h +++ b/drivers/acpi/acpica/acdispat.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index 4ced54f7a5d9..3e6ba99e4053 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -133,8 +133,7 @@ acpi_status acpi_ev_initialize_op_regions(void); | |||
133 | acpi_status | 133 | acpi_status |
134 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | 134 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, |
135 | u32 function, | 135 | u32 function, |
136 | u32 region_offset, | 136 | u32 region_offset, u32 bit_width, u64 *value); |
137 | u32 bit_width, acpi_integer * value); | ||
138 | 137 | ||
139 | acpi_status | 138 | acpi_status |
140 | acpi_ev_attach_region(union acpi_operand_object *handler_obj, | 139 | acpi_ev_attach_region(union acpi_operand_object *handler_obj, |
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index 29ba66d5a790..f8dd8f250ac4 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h index 36192f142fbb..5900f135dc6d 100644 --- a/drivers/acpi/acpica/achware.h +++ b/drivers/acpi/acpica/achware.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h index 5db9f2916f7c..6df3f8428168 100644 --- a/drivers/acpi/acpica/acinterp.h +++ b/drivers/acpi/acpica/acinterp.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -129,18 +129,17 @@ acpi_ex_common_buffer_setup(union acpi_operand_object *obj_desc, | |||
129 | 129 | ||
130 | acpi_status | 130 | acpi_status |
131 | acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | 131 | acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, |
132 | acpi_integer mask, | 132 | u64 mask, |
133 | acpi_integer field_value, | 133 | u64 field_value, u32 field_datum_byte_offset); |
134 | u32 field_datum_byte_offset); | ||
135 | 134 | ||
136 | void | 135 | void |
137 | acpi_ex_get_buffer_datum(acpi_integer * datum, | 136 | acpi_ex_get_buffer_datum(u64 *datum, |
138 | void *buffer, | 137 | void *buffer, |
139 | u32 buffer_length, | 138 | u32 buffer_length, |
140 | u32 byte_granularity, u32 buffer_offset); | 139 | u32 byte_granularity, u32 buffer_offset); |
141 | 140 | ||
142 | void | 141 | void |
143 | acpi_ex_set_buffer_datum(acpi_integer merged_datum, | 142 | acpi_ex_set_buffer_datum(u64 merged_datum, |
144 | void *buffer, | 143 | void *buffer, |
145 | u32 buffer_length, | 144 | u32 buffer_length, |
146 | u32 byte_granularity, u32 buffer_offset); | 145 | u32 byte_granularity, u32 buffer_offset); |
@@ -168,8 +167,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
168 | 167 | ||
169 | acpi_status | 168 | acpi_status |
170 | acpi_ex_access_region(union acpi_operand_object *obj_desc, | 169 | acpi_ex_access_region(union acpi_operand_object *obj_desc, |
171 | u32 field_datum_byte_offset, | 170 | u32 field_datum_byte_offset, u64 *value, u32 read_write); |
172 | acpi_integer * value, u32 read_write); | ||
173 | 171 | ||
174 | /* | 172 | /* |
175 | * exmisc - misc support routines | 173 | * exmisc - misc support routines |
@@ -193,16 +191,14 @@ acpi_ex_do_concatenate(union acpi_operand_object *obj_desc, | |||
193 | 191 | ||
194 | acpi_status | 192 | acpi_status |
195 | acpi_ex_do_logical_numeric_op(u16 opcode, | 193 | acpi_ex_do_logical_numeric_op(u16 opcode, |
196 | acpi_integer integer0, | 194 | u64 integer0, u64 integer1, u8 *logical_result); |
197 | acpi_integer integer1, u8 * logical_result); | ||
198 | 195 | ||
199 | acpi_status | 196 | acpi_status |
200 | acpi_ex_do_logical_op(u16 opcode, | 197 | acpi_ex_do_logical_op(u16 opcode, |
201 | union acpi_operand_object *operand0, | 198 | union acpi_operand_object *operand0, |
202 | union acpi_operand_object *operand1, u8 * logical_result); | 199 | union acpi_operand_object *operand1, u8 *logical_result); |
203 | 200 | ||
204 | acpi_integer | 201 | u64 acpi_ex_do_math_op(u16 opcode, u64 operand0, u64 operand1); |
205 | acpi_ex_do_math_op(u16 opcode, acpi_integer operand0, acpi_integer operand1); | ||
206 | 202 | ||
207 | acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state); | 203 | acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state); |
208 | 204 | ||
@@ -278,7 +274,7 @@ acpi_status | |||
278 | acpi_ex_system_do_notify_op(union acpi_operand_object *value, | 274 | acpi_ex_system_do_notify_op(union acpi_operand_object *value, |
279 | union acpi_operand_object *obj_desc); | 275 | union acpi_operand_object *obj_desc); |
280 | 276 | ||
281 | acpi_status acpi_ex_system_do_suspend(acpi_integer time); | 277 | acpi_status acpi_ex_system_do_suspend(u64 time); |
282 | 278 | ||
283 | acpi_status acpi_ex_system_do_stall(u32 time); | 279 | acpi_status acpi_ex_system_do_stall(u32 time); |
284 | 280 | ||
@@ -461,9 +457,9 @@ void acpi_ex_acquire_global_lock(u32 rule); | |||
461 | 457 | ||
462 | void acpi_ex_release_global_lock(u32 rule); | 458 | void acpi_ex_release_global_lock(u32 rule); |
463 | 459 | ||
464 | void acpi_ex_eisa_id_to_string(char *dest, acpi_integer compressed_id); | 460 | void acpi_ex_eisa_id_to_string(char *dest, u64 compressed_id); |
465 | 461 | ||
466 | void acpi_ex_integer_to_string(char *dest, acpi_integer value); | 462 | void acpi_ex_integer_to_string(char *dest, u64 value); |
467 | 463 | ||
468 | /* | 464 | /* |
469 | * exregion - default op_region handlers | 465 | * exregion - default op_region handlers |
@@ -472,7 +468,7 @@ acpi_status | |||
472 | acpi_ex_system_memory_space_handler(u32 function, | 468 | acpi_ex_system_memory_space_handler(u32 function, |
473 | acpi_physical_address address, | 469 | acpi_physical_address address, |
474 | u32 bit_width, | 470 | u32 bit_width, |
475 | acpi_integer * value, | 471 | u64 *value, |
476 | void *handler_context, | 472 | void *handler_context, |
477 | void *region_context); | 473 | void *region_context); |
478 | 474 | ||
@@ -480,35 +476,35 @@ acpi_status | |||
480 | acpi_ex_system_io_space_handler(u32 function, | 476 | acpi_ex_system_io_space_handler(u32 function, |
481 | acpi_physical_address address, | 477 | acpi_physical_address address, |
482 | u32 bit_width, | 478 | u32 bit_width, |
483 | acpi_integer * value, | 479 | u64 *value, |
484 | void *handler_context, void *region_context); | 480 | void *handler_context, void *region_context); |
485 | 481 | ||
486 | acpi_status | 482 | acpi_status |
487 | acpi_ex_pci_config_space_handler(u32 function, | 483 | acpi_ex_pci_config_space_handler(u32 function, |
488 | acpi_physical_address address, | 484 | acpi_physical_address address, |
489 | u32 bit_width, | 485 | u32 bit_width, |
490 | acpi_integer * value, | 486 | u64 *value, |
491 | void *handler_context, void *region_context); | 487 | void *handler_context, void *region_context); |
492 | 488 | ||
493 | acpi_status | 489 | acpi_status |
494 | acpi_ex_cmos_space_handler(u32 function, | 490 | acpi_ex_cmos_space_handler(u32 function, |
495 | acpi_physical_address address, | 491 | acpi_physical_address address, |
496 | u32 bit_width, | 492 | u32 bit_width, |
497 | acpi_integer * value, | 493 | u64 *value, |
498 | void *handler_context, void *region_context); | 494 | void *handler_context, void *region_context); |
499 | 495 | ||
500 | acpi_status | 496 | acpi_status |
501 | acpi_ex_pci_bar_space_handler(u32 function, | 497 | acpi_ex_pci_bar_space_handler(u32 function, |
502 | acpi_physical_address address, | 498 | acpi_physical_address address, |
503 | u32 bit_width, | 499 | u32 bit_width, |
504 | acpi_integer * value, | 500 | u64 *value, |
505 | void *handler_context, void *region_context); | 501 | void *handler_context, void *region_context); |
506 | 502 | ||
507 | acpi_status | 503 | acpi_status |
508 | acpi_ex_embedded_controller_space_handler(u32 function, | 504 | acpi_ex_embedded_controller_space_handler(u32 function, |
509 | acpi_physical_address address, | 505 | acpi_physical_address address, |
510 | u32 bit_width, | 506 | u32 bit_width, |
511 | acpi_integer * value, | 507 | u64 *value, |
512 | void *handler_context, | 508 | void *handler_context, |
513 | void *region_context); | 509 | void *region_context); |
514 | 510 | ||
@@ -516,14 +512,14 @@ acpi_status | |||
516 | acpi_ex_sm_bus_space_handler(u32 function, | 512 | acpi_ex_sm_bus_space_handler(u32 function, |
517 | acpi_physical_address address, | 513 | acpi_physical_address address, |
518 | u32 bit_width, | 514 | u32 bit_width, |
519 | acpi_integer * value, | 515 | u64 *value, |
520 | void *handler_context, void *region_context); | 516 | void *handler_context, void *region_context); |
521 | 517 | ||
522 | acpi_status | 518 | acpi_status |
523 | acpi_ex_data_table_space_handler(u32 function, | 519 | acpi_ex_data_table_space_handler(u32 function, |
524 | acpi_physical_address address, | 520 | acpi_physical_address address, |
525 | u32 bit_width, | 521 | u32 bit_width, |
526 | acpi_integer * value, | 522 | u64 *value, |
527 | void *handler_context, void *region_context); | 523 | void *handler_context, void *region_context); |
528 | 524 | ||
529 | #endif /* __INTERP_H__ */ | 525 | #endif /* __INTERP_H__ */ |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 13cb80caacde..24b8faa5c395 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -374,6 +374,7 @@ union acpi_predefined_info { | |||
374 | struct acpi_predefined_data { | 374 | struct acpi_predefined_data { |
375 | char *pathname; | 375 | char *pathname; |
376 | const union acpi_predefined_info *predefined; | 376 | const union acpi_predefined_info *predefined; |
377 | union acpi_operand_object *parent_package; | ||
377 | u32 flags; | 378 | u32 flags; |
378 | u8 node_flags; | 379 | u8 node_flags; |
379 | }; | 380 | }; |
@@ -651,8 +652,7 @@ struct acpi_opcode_info { | |||
651 | }; | 652 | }; |
652 | 653 | ||
653 | union acpi_parse_value { | 654 | union acpi_parse_value { |
654 | acpi_integer integer; /* Integer constant (Up to 64 bits) */ | 655 | u64 integer; /* Integer constant (Up to 64 bits) */ |
655 | struct uint64_struct integer64; /* Structure overlay for 2 32-bit Dwords */ | ||
656 | u32 size; /* bytelist or field size */ | 656 | u32 size; /* bytelist or field size */ |
657 | char *string; /* NULL terminated string */ | 657 | char *string; /* NULL terminated string */ |
658 | u8 *buffer; /* buffer or string */ | 658 | u8 *buffer; /* buffer or string */ |
diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index 7d9ba6e57554..9894929a2abb 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -272,8 +272,8 @@ | |||
272 | * MASK_BITS_ABOVE creates a mask starting AT the position and above | 272 | * MASK_BITS_ABOVE creates a mask starting AT the position and above |
273 | * MASK_BITS_BELOW creates a mask starting one bit BELOW the position | 273 | * MASK_BITS_BELOW creates a mask starting one bit BELOW the position |
274 | */ | 274 | */ |
275 | #define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) | 275 | #define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_UINT64_MAX) << ((u32) (position)))) |
276 | #define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) | 276 | #define ACPI_MASK_BITS_BELOW(position) ((ACPI_UINT64_MAX) << ((u32) (position))) |
277 | 277 | ||
278 | /* Bitfields within ACPI registers */ | 278 | /* Bitfields within ACPI registers */ |
279 | 279 | ||
@@ -414,16 +414,16 @@ | |||
414 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \ | 414 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \ |
415 | return (_s); }) | 415 | return (_s); }) |
416 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ | 416 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ |
417 | register acpi_integer _s = (s); \ | 417 | register u64 _s = (s); \ |
418 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ | 418 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ |
419 | return (_s); }) | 419 | return (_s); }) |
420 | #define return_UINT8(s) ACPI_DO_WHILE0 ({ \ | 420 | #define return_UINT8(s) ACPI_DO_WHILE0 ({ \ |
421 | register u8 _s = (u8) (s); \ | 421 | register u8 _s = (u8) (s); \ |
422 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ | 422 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) _s); \ |
423 | return (_s); }) | 423 | return (_s); }) |
424 | #define return_UINT32(s) ACPI_DO_WHILE0 ({ \ | 424 | #define return_UINT32(s) ACPI_DO_WHILE0 ({ \ |
425 | register u32 _s = (u32) (s); \ | 425 | register u32 _s = (u32) (s); \ |
426 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) _s); \ | 426 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) _s); \ |
427 | return (_s); }) | 427 | return (_s); }) |
428 | #else /* Use original less-safe macros */ | 428 | #else /* Use original less-safe macros */ |
429 | 429 | ||
@@ -434,7 +434,7 @@ | |||
434 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \ | 434 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \ |
435 | return((s)); }) | 435 | return((s)); }) |
436 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ | 436 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ |
437 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) (s)); \ | 437 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (u64) (s)); \ |
438 | return((s)); }) | 438 | return((s)); }) |
439 | #define return_UINT8(s) return_VALUE(s) | 439 | #define return_UINT8(s) return_VALUE(s) |
440 | #define return_UINT32(s) return_VALUE(s) | 440 | #define return_UINT32(s) return_VALUE(s) |
diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h index 61edb156e8d0..258159cfcdfa 100644 --- a/drivers/acpi/acpica/acnamesp.h +++ b/drivers/acpi/acpica/acnamesp.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -286,6 +286,17 @@ acpi_status | |||
286 | acpi_ns_repair_package_list(struct acpi_predefined_data *data, | 286 | acpi_ns_repair_package_list(struct acpi_predefined_data *data, |
287 | union acpi_operand_object **obj_desc_ptr); | 287 | union acpi_operand_object **obj_desc_ptr); |
288 | 288 | ||
289 | acpi_status | ||
290 | acpi_ns_repair_null_element(struct acpi_predefined_data *data, | ||
291 | u32 expected_btypes, | ||
292 | u32 package_index, | ||
293 | union acpi_operand_object **return_object_ptr); | ||
294 | |||
295 | void | ||
296 | acpi_ns_remove_null_elements(struct acpi_predefined_data *data, | ||
297 | u8 package_type, | ||
298 | union acpi_operand_object *obj_desc); | ||
299 | |||
289 | /* | 300 | /* |
290 | * nsrepair2 - Return object repair for specific | 301 | * nsrepair2 - Return object repair for specific |
291 | * predefined methods/objects | 302 | * predefined methods/objects |
@@ -296,11 +307,6 @@ acpi_ns_complex_repairs(struct acpi_predefined_data *data, | |||
296 | acpi_status validate_status, | 307 | acpi_status validate_status, |
297 | union acpi_operand_object **return_object_ptr); | 308 | union acpi_operand_object **return_object_ptr); |
298 | 309 | ||
299 | void | ||
300 | acpi_ns_remove_null_elements(struct acpi_predefined_data *data, | ||
301 | u8 package_type, | ||
302 | union acpi_operand_object *obj_desc); | ||
303 | |||
304 | /* | 310 | /* |
305 | * nssearch - Namespace searching and entry | 311 | * nssearch - Namespace searching and entry |
306 | */ | 312 | */ |
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h index 07f6e2ea2ee5..cde18ea82656 100644 --- a/drivers/acpi/acpica/acobject.h +++ b/drivers/acpi/acpica/acobject.h | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -111,7 +111,7 @@ ACPI_OBJECT_COMMON_HEADER}; | |||
111 | 111 | ||
112 | struct acpi_object_integer { | 112 | struct acpi_object_integer { |
113 | ACPI_OBJECT_COMMON_HEADER u8 fill[3]; /* Prevent warning on some compilers */ | 113 | ACPI_OBJECT_COMMON_HEADER u8 fill[3]; /* Prevent warning on some compilers */ |
114 | acpi_integer value; | 114 | u64 value; |
115 | }; | 115 | }; |
116 | 116 | ||
117 | /* | 117 | /* |
diff --git a/drivers/acpi/acpica/acopcode.h b/drivers/acpi/acpica/acopcode.h index dfdf63327885..8c15ff43f42b 100644 --- a/drivers/acpi/acpica/acopcode.h +++ b/drivers/acpi/acpica/acopcode.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acparser.h b/drivers/acpi/acpica/acparser.h index 22881e8ce229..d0bb0fd3e57a 100644 --- a/drivers/acpi/acpica/acparser.h +++ b/drivers/acpi/acpica/acparser.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h index 57bdaf6ffab1..97116082cb6c 100644 --- a/drivers/acpi/acpica/acpredef.h +++ b/drivers/acpi/acpica/acpredef.h | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acresrc.h b/drivers/acpi/acpica/acresrc.h index eef5bd7a59fa..528bcbaf4ce7 100644 --- a/drivers/acpi/acpica/acresrc.h +++ b/drivers/acpi/acpica/acresrc.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h index 7980a26bad35..161bc0e3d70a 100644 --- a/drivers/acpi/acpica/acstruct.h +++ b/drivers/acpi/acpica/acstruct.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h index 01c76b8ea7ba..8ff3b741df28 100644 --- a/drivers/acpi/acpica/actables.h +++ b/drivers/acpi/acpica/actables.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index 3a451a21a3f9..35df755251ce 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -134,7 +134,7 @@ char *acpi_ut_get_region_name(u8 space_id); | |||
134 | 134 | ||
135 | char *acpi_ut_get_event_name(u32 event_id); | 135 | char *acpi_ut_get_event_name(u32 event_id); |
136 | 136 | ||
137 | char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position); | 137 | char acpi_ut_hex_to_ascii_char(u64 integer, u32 position); |
138 | 138 | ||
139 | u8 acpi_ut_valid_object_type(acpi_object_type type); | 139 | u8 acpi_ut_valid_object_type(acpi_object_type type); |
140 | 140 | ||
@@ -279,8 +279,7 @@ acpi_ut_status_exit(u32 line_number, | |||
279 | void | 279 | void |
280 | acpi_ut_value_exit(u32 line_number, | 280 | acpi_ut_value_exit(u32 line_number, |
281 | const char *function_name, | 281 | const char *function_name, |
282 | const char *module_name, | 282 | const char *module_name, u32 component_id, u64 value); |
283 | u32 component_id, acpi_integer value); | ||
284 | 283 | ||
285 | void | 284 | void |
286 | acpi_ut_ptr_exit(u32 line_number, | 285 | acpi_ut_ptr_exit(u32 line_number, |
@@ -324,7 +323,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
324 | acpi_status | 323 | acpi_status |
325 | acpi_ut_evaluate_numeric_object(char *object_name, | 324 | acpi_ut_evaluate_numeric_object(char *object_name, |
326 | struct acpi_namespace_node *device_node, | 325 | struct acpi_namespace_node *device_node, |
327 | acpi_integer *value); | 326 | u64 *value); |
328 | 327 | ||
329 | acpi_status | 328 | acpi_status |
330 | acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 *status_flags); | 329 | acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 *status_flags); |
@@ -437,14 +436,12 @@ void acpi_ut_delete_generic_state(union acpi_generic_state *state); | |||
437 | * utmath | 436 | * utmath |
438 | */ | 437 | */ |
439 | acpi_status | 438 | acpi_status |
440 | acpi_ut_divide(acpi_integer in_dividend, | 439 | acpi_ut_divide(u64 in_dividend, |
441 | acpi_integer in_divisor, | 440 | u64 in_divisor, u64 *out_quotient, u64 *out_remainder); |
442 | acpi_integer * out_quotient, acpi_integer * out_remainder); | ||
443 | 441 | ||
444 | acpi_status | 442 | acpi_status |
445 | acpi_ut_short_divide(acpi_integer in_dividend, | 443 | acpi_ut_short_divide(u64 in_dividend, |
446 | u32 divisor, | 444 | u32 divisor, u64 *out_quotient, u32 *out_remainder); |
447 | acpi_integer * out_quotient, u32 * out_remainder); | ||
448 | 445 | ||
449 | /* | 446 | /* |
450 | * utmisc | 447 | * utmisc |
@@ -474,8 +471,7 @@ acpi_name acpi_ut_repair_name(char *name); | |||
474 | 471 | ||
475 | u8 acpi_ut_valid_acpi_char(char character, u32 position); | 472 | u8 acpi_ut_valid_acpi_char(char character, u32 position); |
476 | 473 | ||
477 | acpi_status | 474 | acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer); |
478 | acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); | ||
479 | 475 | ||
480 | void ACPI_INTERNAL_VAR_XFACE | 476 | void ACPI_INTERNAL_VAR_XFACE |
481 | acpi_ut_predefined_warning(const char *module_name, | 477 | acpi_ut_predefined_warning(const char *module_name, |
diff --git a/drivers/acpi/acpica/amlcode.h b/drivers/acpi/acpica/amlcode.h index 4940249f2524..1f484ba228fc 100644 --- a/drivers/acpi/acpica/amlcode.h +++ b/drivers/acpi/acpica/amlcode.h | |||
@@ -7,7 +7,7 @@ | |||
7 | *****************************************************************************/ | 7 | *****************************************************************************/ |
8 | 8 | ||
9 | /* | 9 | /* |
10 | * Copyright (C) 2000 - 2008, Intel Corp. | 10 | * Copyright (C) 2000 - 2010, Intel Corp. |
11 | * All rights reserved. | 11 | * All rights reserved. |
12 | * | 12 | * |
13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/amlresrc.h b/drivers/acpi/acpica/amlresrc.h index 7b070e42b7c5..0e5798fcbb19 100644 --- a/drivers/acpi/acpica/amlresrc.h +++ b/drivers/acpi/acpica/amlresrc.h | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c index 54a225e56a64..bb13817e0c31 100644 --- a/drivers/acpi/acpica/dsfield.c +++ b/drivers/acpi/acpica/dsfield.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -220,7 +220,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
220 | union acpi_parse_object *arg) | 220 | union acpi_parse_object *arg) |
221 | { | 221 | { |
222 | acpi_status status; | 222 | acpi_status status; |
223 | acpi_integer position; | 223 | u64 position; |
224 | 224 | ||
225 | ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info); | 225 | ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info); |
226 | 226 | ||
@@ -240,8 +240,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
240 | switch (arg->common.aml_opcode) { | 240 | switch (arg->common.aml_opcode) { |
241 | case AML_INT_RESERVEDFIELD_OP: | 241 | case AML_INT_RESERVEDFIELD_OP: |
242 | 242 | ||
243 | position = (acpi_integer) info->field_bit_position | 243 | position = (u64) info->field_bit_position |
244 | + (acpi_integer) arg->common.value.size; | 244 | + (u64) arg->common.value.size; |
245 | 245 | ||
246 | if (position > ACPI_UINT32_MAX) { | 246 | if (position > ACPI_UINT32_MAX) { |
247 | ACPI_ERROR((AE_INFO, | 247 | ACPI_ERROR((AE_INFO, |
@@ -305,8 +305,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
305 | 305 | ||
306 | /* Keep track of bit position for the next field */ | 306 | /* Keep track of bit position for the next field */ |
307 | 307 | ||
308 | position = (acpi_integer) info->field_bit_position | 308 | position = (u64) info->field_bit_position |
309 | + (acpi_integer) arg->common.value.size; | 309 | + (u64) arg->common.value.size; |
310 | 310 | ||
311 | if (position > ACPI_UINT32_MAX) { | 311 | if (position > ACPI_UINT32_MAX) { |
312 | ACPI_ERROR((AE_INFO, | 312 | ACPI_ERROR((AE_INFO, |
diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c index f23fa0be6fc2..abe140318a74 100644 --- a/drivers/acpi/acpica/dsinit.c +++ b/drivers/acpi/acpica/dsinit.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c index e786f9fd767f..721039233aa7 100644 --- a/drivers/acpi/acpica/dsmethod.c +++ b/drivers/acpi/acpica/dsmethod.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c index 0ba19f84ad82..cc343b959540 100644 --- a/drivers/acpi/acpica/dsmthdat.c +++ b/drivers/acpi/acpica/dsmthdat.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c index 9bc1ba076347..891e08bf560b 100644 --- a/drivers/acpi/acpica/dsobject.c +++ b/drivers/acpi/acpica/dsobject.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -684,7 +684,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
684 | 684 | ||
685 | case AML_ONES_OP: | 685 | case AML_ONES_OP: |
686 | 686 | ||
687 | obj_desc->integer.value = ACPI_INTEGER_MAX; | 687 | obj_desc->integer.value = ACPI_UINT64_MAX; |
688 | 688 | ||
689 | /* Truncate value if we are executing from a 32-bit ACPI table */ | 689 | /* Truncate value if we are executing from a 32-bit ACPI table */ |
690 | 690 | ||
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c index b79978f7bc71..bf980cadb1e8 100644 --- a/drivers/acpi/acpica/dsopcode.c +++ b/drivers/acpi/acpica/dsopcode.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c index dfa104102926..306c62ab2e88 100644 --- a/drivers/acpi/acpica/dsutils.c +++ b/drivers/acpi/acpica/dsutils.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c index f0280856dc0e..6b76c486d784 100644 --- a/drivers/acpi/acpica/dswexec.c +++ b/drivers/acpi/acpica/dswexec.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c index b40513dd6a6a..140a9d002959 100644 --- a/drivers/acpi/acpica/dswload.c +++ b/drivers/acpi/acpica/dswload.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dswscope.c b/drivers/acpi/acpica/dswscope.c index 908645e72f03..d1e701709dac 100644 --- a/drivers/acpi/acpica/dswscope.c +++ b/drivers/acpi/acpica/dswscope.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/dswstate.c b/drivers/acpi/acpica/dswstate.c index e46c821cf572..050df8164165 100644 --- a/drivers/acpi/acpica/dswstate.c +++ b/drivers/acpi/acpica/dswstate.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evevent.c b/drivers/acpi/acpica/evevent.c index cd55c774e882..c1e6f472d435 100644 --- a/drivers/acpi/acpica/evevent.c +++ b/drivers/acpi/acpica/evevent.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index 0b453467a5a0..837de669743a 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c index 3d4c4aca11cd..fef721917eaf 100644 --- a/drivers/acpi/acpica/evgpeblk.c +++ b/drivers/acpi/acpica/evgpeblk.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c index 8f0fac6c4366..9a3cb7045a32 100644 --- a/drivers/acpi/acpica/evmisc.c +++ b/drivers/acpi/acpica/evmisc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c index 5336d911fbf0..98fd210e87b2 100644 --- a/drivers/acpi/acpica/evregion.c +++ b/drivers/acpi/acpica/evregion.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -329,7 +329,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | |||
329 | * region_offset - Where in the region to read or write | 329 | * region_offset - Where in the region to read or write |
330 | * bit_width - Field width in bits (8, 16, 32, or 64) | 330 | * bit_width - Field width in bits (8, 16, 32, or 64) |
331 | * Value - Pointer to in or out value, must be | 331 | * Value - Pointer to in or out value, must be |
332 | * full 64-bit acpi_integer | 332 | * a full 64-bit integer |
333 | * | 333 | * |
334 | * RETURN: Status | 334 | * RETURN: Status |
335 | * | 335 | * |
@@ -341,8 +341,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | |||
341 | acpi_status | 341 | acpi_status |
342 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | 342 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, |
343 | u32 function, | 343 | u32 function, |
344 | u32 region_offset, | 344 | u32 region_offset, u32 bit_width, u64 *value) |
345 | u32 bit_width, acpi_integer * value) | ||
346 | { | 345 | { |
347 | acpi_status status; | 346 | acpi_status status; |
348 | acpi_adr_space_handler handler; | 347 | acpi_adr_space_handler handler; |
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c index ff168052a332..2e3b0334072f 100644 --- a/drivers/acpi/acpica/evrgnini.c +++ b/drivers/acpi/acpica/evrgnini.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -168,7 +168,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
168 | void *handler_context, void **region_context) | 168 | void *handler_context, void **region_context) |
169 | { | 169 | { |
170 | acpi_status status = AE_OK; | 170 | acpi_status status = AE_OK; |
171 | acpi_integer pci_value; | 171 | u64 pci_value; |
172 | struct acpi_pci_id *pci_id = *region_context; | 172 | struct acpi_pci_id *pci_id = *region_context; |
173 | union acpi_operand_object *handler_obj; | 173 | union acpi_operand_object *handler_obj; |
174 | struct acpi_namespace_node *parent_node; | 174 | struct acpi_namespace_node *parent_node; |
diff --git a/drivers/acpi/acpica/evsci.c b/drivers/acpi/acpica/evsci.c index 567b356c85af..8dfbaa96e422 100644 --- a/drivers/acpi/acpica/evsci.c +++ b/drivers/acpi/acpica/evsci.c | |||
@@ -6,7 +6,7 @@ | |||
6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c index 474e2cab603d..b40757955f9b 100644 --- a/drivers/acpi/acpica/evxface.c +++ b/drivers/acpi/acpica/evxface.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c index 124c157215bf..5ff32c78ea2d 100644 --- a/drivers/acpi/acpica/evxfevnt.c +++ b/drivers/acpi/acpica/evxfevnt.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c index c98aa7c2d67c..541cbc1544d5 100644 --- a/drivers/acpi/acpica/evxfregn.c +++ b/drivers/acpi/acpica/evxfregn.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c index 46adfa541cbc..7e8b3bedc376 100644 --- a/drivers/acpi/acpica/exconfig.c +++ b/drivers/acpi/acpica/exconfig.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -284,7 +284,7 @@ static acpi_status | |||
284 | acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer) | 284 | acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer) |
285 | { | 285 | { |
286 | acpi_status status; | 286 | acpi_status status; |
287 | acpi_integer value; | 287 | u64 value; |
288 | u32 region_offset = 0; | 288 | u32 region_offset = 0; |
289 | u32 i; | 289 | u32 i; |
290 | 290 | ||
@@ -490,7 +490,11 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
490 | 490 | ||
491 | status = acpi_tb_add_table(&table_desc, &table_index); | 491 | status = acpi_tb_add_table(&table_desc, &table_index); |
492 | if (ACPI_FAILURE(status)) { | 492 | if (ACPI_FAILURE(status)) { |
493 | goto cleanup; | 493 | |
494 | /* Delete allocated table buffer */ | ||
495 | |||
496 | acpi_tb_delete_table(&table_desc); | ||
497 | return_ACPI_STATUS(status); | ||
494 | } | 498 | } |
495 | 499 | ||
496 | /* | 500 | /* |
@@ -533,13 +537,6 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
533 | acpi_gbl_table_handler_context); | 537 | acpi_gbl_table_handler_context); |
534 | } | 538 | } |
535 | 539 | ||
536 | cleanup: | ||
537 | if (ACPI_FAILURE(status)) { | ||
538 | |||
539 | /* Delete allocated table buffer */ | ||
540 | |||
541 | acpi_tb_delete_table(&table_desc); | ||
542 | } | ||
543 | return_ACPI_STATUS(status); | 540 | return_ACPI_STATUS(status); |
544 | } | 541 | } |
545 | 542 | ||
diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c index 51d5f224f9fa..bda7aed0404b 100644 --- a/drivers/acpi/acpica/exconvrt.c +++ b/drivers/acpi/acpica/exconvrt.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -51,8 +51,7 @@ ACPI_MODULE_NAME("exconvrt") | |||
51 | 51 | ||
52 | /* Local prototypes */ | 52 | /* Local prototypes */ |
53 | static u32 | 53 | static u32 |
54 | acpi_ex_convert_to_ascii(acpi_integer integer, | 54 | acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 max_length); |
55 | u16 base, u8 * string, u8 max_length); | ||
56 | 55 | ||
57 | /******************************************************************************* | 56 | /******************************************************************************* |
58 | * | 57 | * |
@@ -75,7 +74,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, | |||
75 | { | 74 | { |
76 | union acpi_operand_object *return_desc; | 75 | union acpi_operand_object *return_desc; |
77 | u8 *pointer; | 76 | u8 *pointer; |
78 | acpi_integer result; | 77 | u64 result; |
79 | u32 i; | 78 | u32 i; |
80 | u32 count; | 79 | u32 count; |
81 | acpi_status status; | 80 | acpi_status status; |
@@ -155,7 +154,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, | |||
155 | * Little endian is used, meaning that the first byte of the buffer | 154 | * Little endian is used, meaning that the first byte of the buffer |
156 | * is the LSB of the integer | 155 | * is the LSB of the integer |
157 | */ | 156 | */ |
158 | result |= (((acpi_integer) pointer[i]) << (i * 8)); | 157 | result |= (((u64) pointer[i]) << (i * 8)); |
159 | } | 158 | } |
160 | break; | 159 | break; |
161 | 160 | ||
@@ -285,10 +284,9 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc, | |||
285 | ******************************************************************************/ | 284 | ******************************************************************************/ |
286 | 285 | ||
287 | static u32 | 286 | static u32 |
288 | acpi_ex_convert_to_ascii(acpi_integer integer, | 287 | acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 data_width) |
289 | u16 base, u8 * string, u8 data_width) | ||
290 | { | 288 | { |
291 | acpi_integer digit; | 289 | u64 digit; |
292 | u32 i; | 290 | u32 i; |
293 | u32 j; | 291 | u32 j; |
294 | u32 k = 0; | 292 | u32 k = 0; |
@@ -531,10 +529,9 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, | |||
531 | * (separated by commas or spaces) | 529 | * (separated by commas or spaces) |
532 | */ | 530 | */ |
533 | for (i = 0; i < obj_desc->buffer.length; i++) { | 531 | for (i = 0; i < obj_desc->buffer.length; i++) { |
534 | new_buf += acpi_ex_convert_to_ascii((acpi_integer) | 532 | new_buf += acpi_ex_convert_to_ascii((u64) obj_desc-> |
535 | obj_desc->buffer. | 533 | buffer.pointer[i], |
536 | pointer[i], base, | 534 | base, new_buf, 1); |
537 | new_buf, 1); | ||
538 | *new_buf++ = separator; /* each separated by a comma or space */ | 535 | *new_buf++ = separator; /* each separated by a comma or space */ |
539 | } | 536 | } |
540 | 537 | ||
diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c index 02b25d233d99..0aa57d938698 100644 --- a/drivers/acpi/acpica/excreate.c +++ b/drivers/acpi/acpica/excreate.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c index de3446372ddc..d39d438ba1e3 100644 --- a/drivers/acpi/acpica/exdump.c +++ b/drivers/acpi/acpica/exdump.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c index 1588a2d660e7..6c79fecbee42 100644 --- a/drivers/acpi/acpica/exfield.c +++ b/drivers/acpi/acpica/exfield.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -130,7 +130,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
130 | /* Call the region handler for the read */ | 130 | /* Call the region handler for the read */ |
131 | 131 | ||
132 | status = acpi_ex_access_region(obj_desc, 0, | 132 | status = acpi_ex_access_region(obj_desc, 0, |
133 | ACPI_CAST_PTR(acpi_integer, | 133 | ACPI_CAST_PTR(u64, |
134 | buffer_desc-> | 134 | buffer_desc-> |
135 | buffer.pointer), | 135 | buffer.pointer), |
136 | function); | 136 | function); |
@@ -141,7 +141,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
141 | /* | 141 | /* |
142 | * Allocate a buffer for the contents of the field. | 142 | * Allocate a buffer for the contents of the field. |
143 | * | 143 | * |
144 | * If the field is larger than the size of an acpi_integer, create | 144 | * If the field is larger than the current integer width, create |
145 | * a BUFFER to hold it. Otherwise, use an INTEGER. This allows | 145 | * a BUFFER to hold it. Otherwise, use an INTEGER. This allows |
146 | * the use of arithmetic operators on the returned value if the | 146 | * the use of arithmetic operators on the returned value if the |
147 | * field size is equal or smaller than an Integer. | 147 | * field size is equal or smaller than an Integer. |
@@ -306,8 +306,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
306 | * same buffer) | 306 | * same buffer) |
307 | */ | 307 | */ |
308 | status = acpi_ex_access_region(obj_desc, 0, | 308 | status = acpi_ex_access_region(obj_desc, 0, |
309 | (acpi_integer *) buffer, | 309 | (u64 *) buffer, function); |
310 | function); | ||
311 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); | 310 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); |
312 | 311 | ||
313 | *result_desc = buffer_desc; | 312 | *result_desc = buffer_desc; |
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c index d7b3b418fb45..f68a216168be 100644 --- a/drivers/acpi/acpica/exfldio.c +++ b/drivers/acpi/acpica/exfldio.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -55,11 +55,10 @@ ACPI_MODULE_NAME("exfldio") | |||
55 | static acpi_status | 55 | static acpi_status |
56 | acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | 56 | acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, |
57 | u32 field_datum_byte_offset, | 57 | u32 field_datum_byte_offset, |
58 | acpi_integer * value, u32 read_write); | 58 | u64 *value, u32 read_write); |
59 | 59 | ||
60 | static u8 | 60 | static u8 |
61 | acpi_ex_register_overflow(union acpi_operand_object *obj_desc, | 61 | acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value); |
62 | acpi_integer value); | ||
63 | 62 | ||
64 | static acpi_status | 63 | static acpi_status |
65 | acpi_ex_setup_region(union acpi_operand_object *obj_desc, | 64 | acpi_ex_setup_region(union acpi_operand_object *obj_desc, |
@@ -212,7 +211,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
212 | * field_datum_byte_offset - Byte offset of this datum within the | 211 | * field_datum_byte_offset - Byte offset of this datum within the |
213 | * parent field | 212 | * parent field |
214 | * Value - Where to store value (must at least | 213 | * Value - Where to store value (must at least |
215 | * the size of acpi_integer) | 214 | * 64 bits) |
216 | * Function - Read or Write flag plus other region- | 215 | * Function - Read or Write flag plus other region- |
217 | * dependent flags | 216 | * dependent flags |
218 | * | 217 | * |
@@ -224,8 +223,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
224 | 223 | ||
225 | acpi_status | 224 | acpi_status |
226 | acpi_ex_access_region(union acpi_operand_object *obj_desc, | 225 | acpi_ex_access_region(union acpi_operand_object *obj_desc, |
227 | u32 field_datum_byte_offset, | 226 | u32 field_datum_byte_offset, u64 *value, u32 function) |
228 | acpi_integer * value, u32 function) | ||
229 | { | 227 | { |
230 | acpi_status status; | 228 | acpi_status status; |
231 | union acpi_operand_object *rgn_desc; | 229 | union acpi_operand_object *rgn_desc; |
@@ -317,8 +315,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, | |||
317 | ******************************************************************************/ | 315 | ******************************************************************************/ |
318 | 316 | ||
319 | static u8 | 317 | static u8 |
320 | acpi_ex_register_overflow(union acpi_operand_object *obj_desc, | 318 | acpi_ex_register_overflow(union acpi_operand_object *obj_desc, u64 value) |
321 | acpi_integer value) | ||
322 | { | 319 | { |
323 | 320 | ||
324 | if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) { | 321 | if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) { |
@@ -329,7 +326,7 @@ acpi_ex_register_overflow(union acpi_operand_object *obj_desc, | |||
329 | return (FALSE); | 326 | return (FALSE); |
330 | } | 327 | } |
331 | 328 | ||
332 | if (value >= ((acpi_integer) 1 << obj_desc->common_field.bit_length)) { | 329 | if (value >= ((u64) 1 << obj_desc->common_field.bit_length)) { |
333 | /* | 330 | /* |
334 | * The Value is larger than the maximum value that can fit into | 331 | * The Value is larger than the maximum value that can fit into |
335 | * the register. | 332 | * the register. |
@@ -362,11 +359,10 @@ acpi_ex_register_overflow(union acpi_operand_object *obj_desc, | |||
362 | 359 | ||
363 | static acpi_status | 360 | static acpi_status |
364 | acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | 361 | acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, |
365 | u32 field_datum_byte_offset, | 362 | u32 field_datum_byte_offset, u64 *value, u32 read_write) |
366 | acpi_integer * value, u32 read_write) | ||
367 | { | 363 | { |
368 | acpi_status status; | 364 | acpi_status status; |
369 | acpi_integer local_value; | 365 | u64 local_value; |
370 | 366 | ||
371 | ACPI_FUNCTION_TRACE_U32(ex_field_datum_io, field_datum_byte_offset); | 367 | ACPI_FUNCTION_TRACE_U32(ex_field_datum_io, field_datum_byte_offset); |
372 | 368 | ||
@@ -439,8 +435,8 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
439 | * the register | 435 | * the register |
440 | */ | 436 | */ |
441 | if (acpi_ex_register_overflow(obj_desc->bank_field.bank_obj, | 437 | if (acpi_ex_register_overflow(obj_desc->bank_field.bank_obj, |
442 | (acpi_integer) obj_desc-> | 438 | (u64) obj_desc->bank_field. |
443 | bank_field.value)) { | 439 | value)) { |
444 | return_ACPI_STATUS(AE_AML_REGISTER_LIMIT); | 440 | return_ACPI_STATUS(AE_AML_REGISTER_LIMIT); |
445 | } | 441 | } |
446 | 442 | ||
@@ -481,8 +477,8 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
481 | * the register | 477 | * the register |
482 | */ | 478 | */ |
483 | if (acpi_ex_register_overflow(obj_desc->index_field.index_obj, | 479 | if (acpi_ex_register_overflow(obj_desc->index_field.index_obj, |
484 | (acpi_integer) obj_desc-> | 480 | (u64) obj_desc->index_field. |
485 | index_field.value)) { | 481 | value)) { |
486 | return_ACPI_STATUS(AE_AML_REGISTER_LIMIT); | 482 | return_ACPI_STATUS(AE_AML_REGISTER_LIMIT); |
487 | } | 483 | } |
488 | 484 | ||
@@ -512,7 +508,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
512 | status = | 508 | status = |
513 | acpi_ex_extract_from_field(obj_desc->index_field. | 509 | acpi_ex_extract_from_field(obj_desc->index_field. |
514 | data_obj, value, | 510 | data_obj, value, |
515 | sizeof(acpi_integer)); | 511 | sizeof(u64)); |
516 | } else { | 512 | } else { |
517 | /* Write the datum to the data_register */ | 513 | /* Write the datum to the data_register */ |
518 | 514 | ||
@@ -523,7 +519,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
523 | status = | 519 | status = |
524 | acpi_ex_insert_into_field(obj_desc->index_field. | 520 | acpi_ex_insert_into_field(obj_desc->index_field. |
525 | data_obj, value, | 521 | data_obj, value, |
526 | sizeof(acpi_integer)); | 522 | sizeof(u64)); |
527 | } | 523 | } |
528 | break; | 524 | break; |
529 | 525 | ||
@@ -571,13 +567,12 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
571 | 567 | ||
572 | acpi_status | 568 | acpi_status |
573 | acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | 569 | acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, |
574 | acpi_integer mask, | 570 | u64 mask, |
575 | acpi_integer field_value, | 571 | u64 field_value, u32 field_datum_byte_offset) |
576 | u32 field_datum_byte_offset) | ||
577 | { | 572 | { |
578 | acpi_status status = AE_OK; | 573 | acpi_status status = AE_OK; |
579 | acpi_integer merged_value; | 574 | u64 merged_value; |
580 | acpi_integer current_value; | 575 | u64 current_value; |
581 | 576 | ||
582 | ACPI_FUNCTION_TRACE_U32(ex_write_with_update_rule, mask); | 577 | ACPI_FUNCTION_TRACE_U32(ex_write_with_update_rule, mask); |
583 | 578 | ||
@@ -587,7 +582,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | |||
587 | 582 | ||
588 | /* If the mask is all ones, we don't need to worry about the update rule */ | 583 | /* If the mask is all ones, we don't need to worry about the update rule */ |
589 | 584 | ||
590 | if (mask != ACPI_INTEGER_MAX) { | 585 | if (mask != ACPI_UINT64_MAX) { |
591 | 586 | ||
592 | /* Decode the update rule */ | 587 | /* Decode the update rule */ |
593 | 588 | ||
@@ -678,8 +673,8 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | |||
678 | void *buffer, u32 buffer_length) | 673 | void *buffer, u32 buffer_length) |
679 | { | 674 | { |
680 | acpi_status status; | 675 | acpi_status status; |
681 | acpi_integer raw_datum; | 676 | u64 raw_datum; |
682 | acpi_integer merged_datum; | 677 | u64 merged_datum; |
683 | u32 field_offset = 0; | 678 | u32 field_offset = 0; |
684 | u32 buffer_offset = 0; | 679 | u32 buffer_offset = 0; |
685 | u32 buffer_tail_bits; | 680 | u32 buffer_tail_bits; |
@@ -804,10 +799,10 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
804 | void *buffer, u32 buffer_length) | 799 | void *buffer, u32 buffer_length) |
805 | { | 800 | { |
806 | acpi_status status; | 801 | acpi_status status; |
807 | acpi_integer mask; | 802 | u64 mask; |
808 | acpi_integer width_mask; | 803 | u64 width_mask; |
809 | acpi_integer merged_datum; | 804 | u64 merged_datum; |
810 | acpi_integer raw_datum = 0; | 805 | u64 raw_datum = 0; |
811 | u32 field_offset = 0; | 806 | u32 field_offset = 0; |
812 | u32 buffer_offset = 0; | 807 | u32 buffer_offset = 0; |
813 | u32 buffer_tail_bits; | 808 | u32 buffer_tail_bits; |
@@ -855,7 +850,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
855 | * shift operator | 850 | * shift operator |
856 | */ | 851 | */ |
857 | if (obj_desc->common_field.access_bit_width == ACPI_INTEGER_BIT_SIZE) { | 852 | if (obj_desc->common_field.access_bit_width == ACPI_INTEGER_BIT_SIZE) { |
858 | width_mask = ACPI_INTEGER_MAX; | 853 | width_mask = ACPI_UINT64_MAX; |
859 | } else { | 854 | } else { |
860 | width_mask = | 855 | width_mask = |
861 | ACPI_MASK_BITS_ABOVE(obj_desc->common_field. | 856 | ACPI_MASK_BITS_ABOVE(obj_desc->common_field. |
diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c index 998eac329937..c5bb1eeed2df 100644 --- a/drivers/acpi/acpica/exmisc.c +++ b/drivers/acpi/acpica/exmisc.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -409,8 +409,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
409 | * | 409 | * |
410 | ******************************************************************************/ | 410 | ******************************************************************************/ |
411 | 411 | ||
412 | acpi_integer | 412 | u64 acpi_ex_do_math_op(u16 opcode, u64 integer0, u64 integer1) |
413 | acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1) | ||
414 | { | 413 | { |
415 | 414 | ||
416 | ACPI_FUNCTION_ENTRY(); | 415 | ACPI_FUNCTION_ENTRY(); |
@@ -498,8 +497,7 @@ acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1) | |||
498 | 497 | ||
499 | acpi_status | 498 | acpi_status |
500 | acpi_ex_do_logical_numeric_op(u16 opcode, | 499 | acpi_ex_do_logical_numeric_op(u16 opcode, |
501 | acpi_integer integer0, | 500 | u64 integer0, u64 integer1, u8 *logical_result) |
502 | acpi_integer integer1, u8 * logical_result) | ||
503 | { | 501 | { |
504 | acpi_status status = AE_OK; | 502 | acpi_status status = AE_OK; |
505 | u8 local_result = FALSE; | 503 | u8 local_result = FALSE; |
@@ -564,8 +562,8 @@ acpi_ex_do_logical_op(u16 opcode, | |||
564 | union acpi_operand_object *operand1, u8 * logical_result) | 562 | union acpi_operand_object *operand1, u8 * logical_result) |
565 | { | 563 | { |
566 | union acpi_operand_object *local_operand1 = operand1; | 564 | union acpi_operand_object *local_operand1 = operand1; |
567 | acpi_integer integer0; | 565 | u64 integer0; |
568 | acpi_integer integer1; | 566 | u64 integer1; |
569 | u32 length0; | 567 | u32 length0; |
570 | u32 length1; | 568 | u32 length1; |
571 | acpi_status status = AE_OK; | 569 | acpi_status status = AE_OK; |
diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c index 3c456bd575d0..cc8a10268f68 100644 --- a/drivers/acpi/acpica/exmutex.c +++ b/drivers/acpi/acpica/exmutex.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exnames.c b/drivers/acpi/acpica/exnames.c index ffdae122d94a..679f308c5a89 100644 --- a/drivers/acpi/acpica/exnames.c +++ b/drivers/acpi/acpica/exnames.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c index 752fe48b2d20..99adbab5acbf 100644 --- a/drivers/acpi/acpica/exoparg1.c +++ b/drivers/acpi/acpica/exoparg1.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -261,8 +261,8 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
261 | union acpi_operand_object *return_desc2 = NULL; | 261 | union acpi_operand_object *return_desc2 = NULL; |
262 | u32 temp32; | 262 | u32 temp32; |
263 | u32 i; | 263 | u32 i; |
264 | acpi_integer power_of_ten; | 264 | u64 power_of_ten; |
265 | acpi_integer digit; | 265 | u64 digit; |
266 | 266 | ||
267 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_1R, | 267 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_1R, |
268 | acpi_ps_get_opcode_name(walk_state->opcode)); | 268 | acpi_ps_get_opcode_name(walk_state->opcode)); |
@@ -362,7 +362,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
362 | /* Sum the digit into the result with the current power of 10 */ | 362 | /* Sum the digit into the result with the current power of 10 */ |
363 | 363 | ||
364 | return_desc->integer.value += | 364 | return_desc->integer.value += |
365 | (((acpi_integer) temp32) * power_of_ten); | 365 | (((u64) temp32) * power_of_ten); |
366 | 366 | ||
367 | /* Shift to next BCD digit */ | 367 | /* Shift to next BCD digit */ |
368 | 368 | ||
@@ -392,7 +392,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
392 | * remainder from above | 392 | * remainder from above |
393 | */ | 393 | */ |
394 | return_desc->integer.value |= | 394 | return_desc->integer.value |= |
395 | (((acpi_integer) temp32) << ACPI_MUL_4(i)); | 395 | (((u64) temp32) << ACPI_MUL_4(i)); |
396 | } | 396 | } |
397 | 397 | ||
398 | /* Overflow if there is any data left in Digit */ | 398 | /* Overflow if there is any data left in Digit */ |
@@ -439,7 +439,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
439 | 439 | ||
440 | /* The object exists in the namespace, return TRUE */ | 440 | /* The object exists in the namespace, return TRUE */ |
441 | 441 | ||
442 | return_desc->integer.value = ACPI_INTEGER_MAX; | 442 | return_desc->integer.value = ACPI_UINT64_MAX; |
443 | goto cleanup; | 443 | goto cleanup; |
444 | 444 | ||
445 | default: | 445 | default: |
@@ -589,7 +589,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
589 | union acpi_operand_object *return_desc = NULL; | 589 | union acpi_operand_object *return_desc = NULL; |
590 | acpi_status status = AE_OK; | 590 | acpi_status status = AE_OK; |
591 | u32 type; | 591 | u32 type; |
592 | acpi_integer value; | 592 | u64 value; |
593 | 593 | ||
594 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_1R, | 594 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_1R, |
595 | acpi_ps_get_opcode_name(walk_state->opcode)); | 595 | acpi_ps_get_opcode_name(walk_state->opcode)); |
@@ -610,7 +610,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
610 | * return_desc->Integer.Value is initially == 0 (FALSE) from above. | 610 | * return_desc->Integer.Value is initially == 0 (FALSE) from above. |
611 | */ | 611 | */ |
612 | if (!operand[0]->integer.value) { | 612 | if (!operand[0]->integer.value) { |
613 | return_desc->integer.value = ACPI_INTEGER_MAX; | 613 | return_desc->integer.value = ACPI_UINT64_MAX; |
614 | } | 614 | } |
615 | break; | 615 | break; |
616 | 616 | ||
diff --git a/drivers/acpi/acpica/exoparg2.c b/drivers/acpi/acpica/exoparg2.c index 85d95c92dfd3..22841bbbe63c 100644 --- a/drivers/acpi/acpica/exoparg2.c +++ b/drivers/acpi/acpica/exoparg2.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -282,7 +282,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
282 | { | 282 | { |
283 | union acpi_operand_object **operand = &walk_state->operands[0]; | 283 | union acpi_operand_object **operand = &walk_state->operands[0]; |
284 | union acpi_operand_object *return_desc = NULL; | 284 | union acpi_operand_object *return_desc = NULL; |
285 | acpi_integer index; | 285 | u64 index; |
286 | acpi_status status = AE_OK; | 286 | acpi_status status = AE_OK; |
287 | acpi_size length; | 287 | acpi_size length; |
288 | 288 | ||
@@ -584,7 +584,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) | |||
584 | * Default is FALSE (zero) | 584 | * Default is FALSE (zero) |
585 | */ | 585 | */ |
586 | if (logical_result) { | 586 | if (logical_result) { |
587 | return_desc->integer.value = ACPI_INTEGER_MAX; | 587 | return_desc->integer.value = ACPI_UINT64_MAX; |
588 | } | 588 | } |
589 | 589 | ||
590 | cleanup: | 590 | cleanup: |
diff --git a/drivers/acpi/acpica/exoparg3.c b/drivers/acpi/acpica/exoparg3.c index 253f9e122584..8bb1012ef44e 100644 --- a/drivers/acpi/acpica/exoparg3.c +++ b/drivers/acpi/acpica/exoparg3.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -148,7 +148,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
148 | union acpi_operand_object *return_desc = NULL; | 148 | union acpi_operand_object *return_desc = NULL; |
149 | char *buffer = NULL; | 149 | char *buffer = NULL; |
150 | acpi_status status = AE_OK; | 150 | acpi_status status = AE_OK; |
151 | acpi_integer index; | 151 | u64 index; |
152 | acpi_size length; | 152 | acpi_size length; |
153 | 153 | ||
154 | ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_1T_1R, | 154 | ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_1T_1R, |
diff --git a/drivers/acpi/acpica/exoparg6.c b/drivers/acpi/acpica/exoparg6.c index 295542e6bd51..f256b6a25f2e 100644 --- a/drivers/acpi/acpica/exoparg6.c +++ b/drivers/acpi/acpica/exoparg6.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -218,7 +218,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
218 | union acpi_operand_object **operand = &walk_state->operands[0]; | 218 | union acpi_operand_object **operand = &walk_state->operands[0]; |
219 | union acpi_operand_object *return_desc = NULL; | 219 | union acpi_operand_object *return_desc = NULL; |
220 | acpi_status status = AE_OK; | 220 | acpi_status status = AE_OK; |
221 | acpi_integer index; | 221 | u64 index; |
222 | union acpi_operand_object *this_element; | 222 | union acpi_operand_object *this_element; |
223 | 223 | ||
224 | ACPI_FUNCTION_TRACE_STR(ex_opcode_6A_0T_1R, | 224 | ACPI_FUNCTION_TRACE_STR(ex_opcode_6A_0T_1R, |
@@ -253,9 +253,9 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
253 | } | 253 | } |
254 | 254 | ||
255 | /* Create an integer for the return value */ | 255 | /* Create an integer for the return value */ |
256 | /* Default return value is ACPI_INTEGER_MAX if no match found */ | 256 | /* Default return value is ACPI_UINT64_MAX if no match found */ |
257 | 257 | ||
258 | return_desc = acpi_ut_create_integer_object(ACPI_INTEGER_MAX); | 258 | return_desc = acpi_ut_create_integer_object(ACPI_UINT64_MAX); |
259 | if (!return_desc) { | 259 | if (!return_desc) { |
260 | status = AE_NO_MEMORY; | 260 | status = AE_NO_MEMORY; |
261 | goto cleanup; | 261 | goto cleanup; |
@@ -270,7 +270,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
270 | * | 270 | * |
271 | * Upon finding a match, the loop will terminate via "break" at | 271 | * Upon finding a match, the loop will terminate via "break" at |
272 | * the bottom. If it terminates "normally", match_value will be | 272 | * the bottom. If it terminates "normally", match_value will be |
273 | * ACPI_INTEGER_MAX (Ones) (its initial value) indicating that no | 273 | * ACPI_UINT64_MAX (Ones) (its initial value) indicating that no |
274 | * match was found. | 274 | * match was found. |
275 | */ | 275 | */ |
276 | for (; index < operand[0]->package.count; index++) { | 276 | for (; index < operand[0]->package.count; index++) { |
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c index 52fec07064f0..edf62bf5b266 100644 --- a/drivers/acpi/acpica/exprep.c +++ b/drivers/acpi/acpica/exprep.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c index 2bd83ac57c3a..486b2e5661b6 100644 --- a/drivers/acpi/acpica/exregion.c +++ b/drivers/acpi/acpica/exregion.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -70,7 +70,7 @@ acpi_status | |||
70 | acpi_ex_system_memory_space_handler(u32 function, | 70 | acpi_ex_system_memory_space_handler(u32 function, |
71 | acpi_physical_address address, | 71 | acpi_physical_address address, |
72 | u32 bit_width, | 72 | u32 bit_width, |
73 | acpi_integer * value, | 73 | u64 *value, |
74 | void *handler_context, void *region_context) | 74 | void *handler_context, void *region_context) |
75 | { | 75 | { |
76 | acpi_status status = AE_OK; | 76 | acpi_status status = AE_OK; |
@@ -115,8 +115,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
115 | * Hardware does not support non-aligned data transfers, we must verify | 115 | * Hardware does not support non-aligned data transfers, we must verify |
116 | * the request. | 116 | * the request. |
117 | */ | 117 | */ |
118 | (void)acpi_ut_short_divide((acpi_integer) address, length, NULL, | 118 | (void)acpi_ut_short_divide((u64) address, length, NULL, &remainder); |
119 | &remainder); | ||
120 | if (remainder != 0) { | 119 | if (remainder != 0) { |
121 | return_ACPI_STATUS(AE_AML_ALIGNMENT); | 120 | return_ACPI_STATUS(AE_AML_ALIGNMENT); |
122 | } | 121 | } |
@@ -128,10 +127,9 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
128 | * 2) Address beyond the current mapping? | 127 | * 2) Address beyond the current mapping? |
129 | */ | 128 | */ |
130 | if ((address < mem_info->mapped_physical_address) || | 129 | if ((address < mem_info->mapped_physical_address) || |
131 | (((acpi_integer) address + length) > ((acpi_integer) | 130 | (((u64) address + length) > ((u64) |
132 | mem_info-> | 131 | mem_info->mapped_physical_address + |
133 | mapped_physical_address + | 132 | mem_info->mapped_length))) { |
134 | mem_info->mapped_length))) { | ||
135 | /* | 133 | /* |
136 | * The request cannot be resolved by the current memory mapping; | 134 | * The request cannot be resolved by the current memory mapping; |
137 | * Delete the existing mapping and create a new one. | 135 | * Delete the existing mapping and create a new one. |
@@ -193,8 +191,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
193 | * access | 191 | * access |
194 | */ | 192 | */ |
195 | logical_addr_ptr = mem_info->mapped_logical_address + | 193 | logical_addr_ptr = mem_info->mapped_logical_address + |
196 | ((acpi_integer) address - | 194 | ((u64) address - (u64) mem_info->mapped_physical_address); |
197 | (acpi_integer) mem_info->mapped_physical_address); | ||
198 | 195 | ||
199 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 196 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
200 | "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", | 197 | "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", |
@@ -215,19 +212,19 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
215 | *value = 0; | 212 | *value = 0; |
216 | switch (bit_width) { | 213 | switch (bit_width) { |
217 | case 8: | 214 | case 8: |
218 | *value = (acpi_integer) ACPI_GET8(logical_addr_ptr); | 215 | *value = (u64) ACPI_GET8(logical_addr_ptr); |
219 | break; | 216 | break; |
220 | 217 | ||
221 | case 16: | 218 | case 16: |
222 | *value = (acpi_integer) ACPI_GET16(logical_addr_ptr); | 219 | *value = (u64) ACPI_GET16(logical_addr_ptr); |
223 | break; | 220 | break; |
224 | 221 | ||
225 | case 32: | 222 | case 32: |
226 | *value = (acpi_integer) ACPI_GET32(logical_addr_ptr); | 223 | *value = (u64) ACPI_GET32(logical_addr_ptr); |
227 | break; | 224 | break; |
228 | 225 | ||
229 | case 64: | 226 | case 64: |
230 | *value = (acpi_integer) ACPI_GET64(logical_addr_ptr); | 227 | *value = (u64) ACPI_GET64(logical_addr_ptr); |
231 | break; | 228 | break; |
232 | 229 | ||
233 | default: | 230 | default: |
@@ -291,7 +288,7 @@ acpi_status | |||
291 | acpi_ex_system_io_space_handler(u32 function, | 288 | acpi_ex_system_io_space_handler(u32 function, |
292 | acpi_physical_address address, | 289 | acpi_physical_address address, |
293 | u32 bit_width, | 290 | u32 bit_width, |
294 | acpi_integer * value, | 291 | u64 *value, |
295 | void *handler_context, void *region_context) | 292 | void *handler_context, void *region_context) |
296 | { | 293 | { |
297 | acpi_status status = AE_OK; | 294 | acpi_status status = AE_OK; |
@@ -350,7 +347,7 @@ acpi_status | |||
350 | acpi_ex_pci_config_space_handler(u32 function, | 347 | acpi_ex_pci_config_space_handler(u32 function, |
351 | acpi_physical_address address, | 348 | acpi_physical_address address, |
352 | u32 bit_width, | 349 | u32 bit_width, |
353 | acpi_integer * value, | 350 | u64 *value, |
354 | void *handler_context, void *region_context) | 351 | void *handler_context, void *region_context) |
355 | { | 352 | { |
356 | acpi_status status = AE_OK; | 353 | acpi_status status = AE_OK; |
@@ -425,7 +422,7 @@ acpi_status | |||
425 | acpi_ex_cmos_space_handler(u32 function, | 422 | acpi_ex_cmos_space_handler(u32 function, |
426 | acpi_physical_address address, | 423 | acpi_physical_address address, |
427 | u32 bit_width, | 424 | u32 bit_width, |
428 | acpi_integer * value, | 425 | u64 *value, |
429 | void *handler_context, void *region_context) | 426 | void *handler_context, void *region_context) |
430 | { | 427 | { |
431 | acpi_status status = AE_OK; | 428 | acpi_status status = AE_OK; |
@@ -457,7 +454,7 @@ acpi_status | |||
457 | acpi_ex_pci_bar_space_handler(u32 function, | 454 | acpi_ex_pci_bar_space_handler(u32 function, |
458 | acpi_physical_address address, | 455 | acpi_physical_address address, |
459 | u32 bit_width, | 456 | u32 bit_width, |
460 | acpi_integer * value, | 457 | u64 *value, |
461 | void *handler_context, void *region_context) | 458 | void *handler_context, void *region_context) |
462 | { | 459 | { |
463 | acpi_status status = AE_OK; | 460 | acpi_status status = AE_OK; |
@@ -489,7 +486,7 @@ acpi_status | |||
489 | acpi_ex_data_table_space_handler(u32 function, | 486 | acpi_ex_data_table_space_handler(u32 function, |
490 | acpi_physical_address address, | 487 | acpi_physical_address address, |
491 | u32 bit_width, | 488 | u32 bit_width, |
492 | acpi_integer * value, | 489 | u64 *value, |
493 | void *handler_context, void *region_context) | 490 | void *handler_context, void *region_context) |
494 | { | 491 | { |
495 | ACPI_FUNCTION_TRACE(ex_data_table_space_handler); | 492 | ACPI_FUNCTION_TRACE(ex_data_table_space_handler); |
diff --git a/drivers/acpi/acpica/exresnte.c b/drivers/acpi/acpica/exresnte.c index 607958ff467c..fdc1b27999ef 100644 --- a/drivers/acpi/acpica/exresnte.c +++ b/drivers/acpi/acpica/exresnte.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c index c93b54ce7f78..fdd6a7079b97 100644 --- a/drivers/acpi/acpica/exresolv.c +++ b/drivers/acpi/acpica/exresolv.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c index 5c729a9e9131..c5ecd615f145 100644 --- a/drivers/acpi/acpica/exresop.c +++ b/drivers/acpi/acpica/exresop.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c index 6efd07a4f779..702b9ecfd44b 100644 --- a/drivers/acpi/acpica/exstore.c +++ b/drivers/acpi/acpica/exstore.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exstoren.c b/drivers/acpi/acpica/exstoren.c index 608e838d537e..d4af684620ca 100644 --- a/drivers/acpi/acpica/exstoren.c +++ b/drivers/acpi/acpica/exstoren.c | |||
@@ -7,7 +7,7 @@ | |||
7 | *****************************************************************************/ | 7 | *****************************************************************************/ |
8 | 8 | ||
9 | /* | 9 | /* |
10 | * Copyright (C) 2000 - 2008, Intel Corp. | 10 | * Copyright (C) 2000 - 2010, Intel Corp. |
11 | * All rights reserved. | 11 | * All rights reserved. |
12 | * | 12 | * |
13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exstorob.c b/drivers/acpi/acpica/exstorob.c index 257706e7734f..e972b667b09b 100644 --- a/drivers/acpi/acpica/exstorob.c +++ b/drivers/acpi/acpica/exstorob.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/exsystem.c b/drivers/acpi/acpica/exsystem.c index 3d00b9357233..e11b6cb42a57 100644 --- a/drivers/acpi/acpica/exsystem.c +++ b/drivers/acpi/acpica/exsystem.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -193,7 +193,7 @@ acpi_status acpi_ex_system_do_stall(u32 how_long) | |||
193 | * | 193 | * |
194 | ******************************************************************************/ | 194 | ******************************************************************************/ |
195 | 195 | ||
196 | acpi_status acpi_ex_system_do_suspend(acpi_integer how_long) | 196 | acpi_status acpi_ex_system_do_suspend(u64 how_long) |
197 | { | 197 | { |
198 | ACPI_FUNCTION_ENTRY(); | 198 | ACPI_FUNCTION_ENTRY(); |
199 | 199 | ||
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c index 7d41f99f7052..74c24d517f81 100644 --- a/drivers/acpi/acpica/exutils.c +++ b/drivers/acpi/acpica/exutils.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -67,7 +67,7 @@ | |||
67 | ACPI_MODULE_NAME("exutils") | 67 | ACPI_MODULE_NAME("exutils") |
68 | 68 | ||
69 | /* Local prototypes */ | 69 | /* Local prototypes */ |
70 | static u32 acpi_ex_digits_needed(acpi_integer value, u32 base); | 70 | static u32 acpi_ex_digits_needed(u64 value, u32 base); |
71 | 71 | ||
72 | #ifndef ACPI_NO_METHOD_EXECUTION | 72 | #ifndef ACPI_NO_METHOD_EXECUTION |
73 | /******************************************************************************* | 73 | /******************************************************************************* |
@@ -230,7 +230,7 @@ void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) | |||
230 | * We are running a method that exists in a 32-bit ACPI table. | 230 | * We are running a method that exists in a 32-bit ACPI table. |
231 | * Truncate the value to 32 bits by zeroing out the upper 32-bit field | 231 | * Truncate the value to 32 bits by zeroing out the upper 32-bit field |
232 | */ | 232 | */ |
233 | obj_desc->integer.value &= (acpi_integer) ACPI_UINT32_MAX; | 233 | obj_desc->integer.value &= (u64) ACPI_UINT32_MAX; |
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
@@ -327,14 +327,14 @@ void acpi_ex_release_global_lock(u32 field_flags) | |||
327 | * | 327 | * |
328 | ******************************************************************************/ | 328 | ******************************************************************************/ |
329 | 329 | ||
330 | static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) | 330 | static u32 acpi_ex_digits_needed(u64 value, u32 base) |
331 | { | 331 | { |
332 | u32 num_digits; | 332 | u32 num_digits; |
333 | acpi_integer current_value; | 333 | u64 current_value; |
334 | 334 | ||
335 | ACPI_FUNCTION_TRACE(ex_digits_needed); | 335 | ACPI_FUNCTION_TRACE(ex_digits_needed); |
336 | 336 | ||
337 | /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ | 337 | /* u64 is unsigned, so we don't worry about a '-' prefix */ |
338 | 338 | ||
339 | if (value == 0) { | 339 | if (value == 0) { |
340 | return_UINT32(1); | 340 | return_UINT32(1); |
@@ -370,7 +370,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) | |||
370 | * | 370 | * |
371 | ******************************************************************************/ | 371 | ******************************************************************************/ |
372 | 372 | ||
373 | void acpi_ex_eisa_id_to_string(char *out_string, acpi_integer compressed_id) | 373 | void acpi_ex_eisa_id_to_string(char *out_string, u64 compressed_id) |
374 | { | 374 | { |
375 | u32 swapped_id; | 375 | u32 swapped_id; |
376 | 376 | ||
@@ -394,10 +394,10 @@ void acpi_ex_eisa_id_to_string(char *out_string, acpi_integer compressed_id) | |||
394 | (char)(0x40 + (((unsigned long)swapped_id >> 26) & 0x1F)); | 394 | (char)(0x40 + (((unsigned long)swapped_id >> 26) & 0x1F)); |
395 | out_string[1] = (char)(0x40 + ((swapped_id >> 21) & 0x1F)); | 395 | out_string[1] = (char)(0x40 + ((swapped_id >> 21) & 0x1F)); |
396 | out_string[2] = (char)(0x40 + ((swapped_id >> 16) & 0x1F)); | 396 | out_string[2] = (char)(0x40 + ((swapped_id >> 16) & 0x1F)); |
397 | out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 12); | 397 | out_string[3] = acpi_ut_hex_to_ascii_char((u64) swapped_id, 12); |
398 | out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 8); | 398 | out_string[4] = acpi_ut_hex_to_ascii_char((u64) swapped_id, 8); |
399 | out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 4); | 399 | out_string[5] = acpi_ut_hex_to_ascii_char((u64) swapped_id, 4); |
400 | out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 0); | 400 | out_string[6] = acpi_ut_hex_to_ascii_char((u64) swapped_id, 0); |
401 | out_string[7] = 0; | 401 | out_string[7] = 0; |
402 | } | 402 | } |
403 | 403 | ||
@@ -418,7 +418,7 @@ void acpi_ex_eisa_id_to_string(char *out_string, acpi_integer compressed_id) | |||
418 | * | 418 | * |
419 | ******************************************************************************/ | 419 | ******************************************************************************/ |
420 | 420 | ||
421 | void acpi_ex_integer_to_string(char *out_string, acpi_integer value) | 421 | void acpi_ex_integer_to_string(char *out_string, u64 value) |
422 | { | 422 | { |
423 | u32 count; | 423 | u32 count; |
424 | u32 digits_needed; | 424 | u32 digits_needed; |
diff --git a/drivers/acpi/acpica/hwacpi.c b/drivers/acpi/acpica/hwacpi.c index 9af361a191e7..679a112a7d26 100644 --- a/drivers/acpi/acpica/hwacpi.c +++ b/drivers/acpi/acpica/hwacpi.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c index c28c41b3180b..bd72319a38f0 100644 --- a/drivers/acpi/acpica/hwgpe.c +++ b/drivers/acpi/acpica/hwgpe.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -224,7 +224,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
224 | 224 | ||
225 | status = acpi_hw_read(&in_byte, &gpe_register_info->status_address); | 225 | status = acpi_hw_read(&in_byte, &gpe_register_info->status_address); |
226 | if (ACPI_FAILURE(status)) { | 226 | if (ACPI_FAILURE(status)) { |
227 | goto unlock_and_exit; | 227 | return (status); |
228 | } | 228 | } |
229 | 229 | ||
230 | if (register_bit & in_byte) { | 230 | if (register_bit & in_byte) { |
@@ -234,9 +234,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
234 | /* Set return value */ | 234 | /* Set return value */ |
235 | 235 | ||
236 | (*event_status) = local_event_status; | 236 | (*event_status) = local_event_status; |
237 | 237 | return (AE_OK); | |
238 | unlock_and_exit: | ||
239 | return (status); | ||
240 | } | 238 | } |
241 | 239 | ||
242 | /****************************************************************************** | 240 | /****************************************************************************** |
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c index 15c9ed2be853..ec7fc227b33f 100644 --- a/drivers/acpi/acpica/hwregs.c +++ b/drivers/acpi/acpica/hwregs.c | |||
@@ -7,7 +7,7 @@ | |||
7 | ******************************************************************************/ | 7 | ******************************************************************************/ |
8 | 8 | ||
9 | /* | 9 | /* |
10 | * Copyright (C) 2000 - 2008, Intel Corp. | 10 | * Copyright (C) 2000 - 2010, Intel Corp. |
11 | * All rights reserved. | 11 | * All rights reserved. |
12 | * | 12 | * |
13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c index cc22f9a585b0..5e6d4dbb8024 100644 --- a/drivers/acpi/acpica/hwsleep.c +++ b/drivers/acpi/acpica/hwsleep.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwtimer.c b/drivers/acpi/acpica/hwtimer.c index 6b282e85d039..1ef8e0bb250b 100644 --- a/drivers/acpi/acpica/hwtimer.c +++ b/drivers/acpi/acpica/hwtimer.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -140,7 +140,7 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) | |||
140 | { | 140 | { |
141 | acpi_status status; | 141 | acpi_status status; |
142 | u32 delta_ticks; | 142 | u32 delta_ticks; |
143 | acpi_integer quotient; | 143 | u64 quotient; |
144 | 144 | ||
145 | ACPI_FUNCTION_TRACE(acpi_get_timer_duration); | 145 | ACPI_FUNCTION_TRACE(acpi_get_timer_duration); |
146 | 146 | ||
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c index ec33f270c5b7..e26c17d4b716 100644 --- a/drivers/acpi/acpica/hwvalid.c +++ b/drivers/acpi/acpica/hwvalid.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2009, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c index 647c7b6e6756..50cc3be77724 100644 --- a/drivers/acpi/acpica/hwxface.c +++ b/drivers/acpi/acpica/hwxface.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c index d622ba770000..aa2b80132d0a 100644 --- a/drivers/acpi/acpica/nsaccess.c +++ b/drivers/acpi/acpica/nsaccess.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c index 8a58a1b85aa0..982269c1fa48 100644 --- a/drivers/acpi/acpica/nsalloc.c +++ b/drivers/acpi/acpica/nsalloc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c index e37836e27e29..0689d36638d9 100644 --- a/drivers/acpi/acpica/nsdump.c +++ b/drivers/acpi/acpica/nsdump.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsdumpdv.c b/drivers/acpi/acpica/nsdumpdv.c index 36be7f0e97ec..d2a97921e249 100644 --- a/drivers/acpi/acpica/nsdumpdv.c +++ b/drivers/acpi/acpica/nsdumpdv.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c index af9fe9103734..f52829cc294b 100644 --- a/drivers/acpi/acpica/nseval.c +++ b/drivers/acpi/acpica/nseval.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c index 4f8abac231d2..9bd6f050f299 100644 --- a/drivers/acpi/acpica/nsinit.c +++ b/drivers/acpi/acpica/nsinit.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c index a7234e60e985..df18be94fefe 100644 --- a/drivers/acpi/acpica/nsload.c +++ b/drivers/acpi/acpica/nsload.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c index 8f9a4875ce26..959372451635 100644 --- a/drivers/acpi/acpica/nsnames.c +++ b/drivers/acpi/acpica/nsnames.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsobject.c b/drivers/acpi/acpica/nsobject.c index 60f3af08d28c..41a9213dd5af 100644 --- a/drivers/acpi/acpica/nsobject.c +++ b/drivers/acpi/acpica/nsobject.c | |||
@@ -6,7 +6,7 @@ | |||
6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsparse.c b/drivers/acpi/acpica/nsparse.c index 662a4bd5b621..27cda52c76bc 100644 --- a/drivers/acpi/acpica/nsparse.c +++ b/drivers/acpi/acpica/nsparse.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c index d34fa59548f7..7096bcda0c72 100644 --- a/drivers/acpi/acpica/nspredef.c +++ b/drivers/acpi/acpica/nspredef.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -231,6 +231,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node, | |||
231 | * Note: Package may have been newly created by call above. | 231 | * Note: Package may have been newly created by call above. |
232 | */ | 232 | */ |
233 | if ((*return_object_ptr)->common.type == ACPI_TYPE_PACKAGE) { | 233 | if ((*return_object_ptr)->common.type == ACPI_TYPE_PACKAGE) { |
234 | data->parent_package = *return_object_ptr; | ||
234 | status = acpi_ns_check_package(data, return_object_ptr); | 235 | status = acpi_ns_check_package(data, return_object_ptr); |
235 | if (ACPI_FAILURE(status)) { | 236 | if (ACPI_FAILURE(status)) { |
236 | goto exit; | 237 | goto exit; |
@@ -710,6 +711,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, | |||
710 | for (i = 0; i < count; i++) { | 711 | for (i = 0; i < count; i++) { |
711 | sub_package = *elements; | 712 | sub_package = *elements; |
712 | sub_elements = sub_package->package.elements; | 713 | sub_elements = sub_package->package.elements; |
714 | data->parent_package = sub_package; | ||
713 | 715 | ||
714 | /* Each sub-object must be of type Package */ | 716 | /* Each sub-object must be of type Package */ |
715 | 717 | ||
@@ -721,6 +723,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, | |||
721 | 723 | ||
722 | /* Examine the different types of expected sub-packages */ | 724 | /* Examine the different types of expected sub-packages */ |
723 | 725 | ||
726 | data->parent_package = sub_package; | ||
724 | switch (package->ret_info.type) { | 727 | switch (package->ret_info.type) { |
725 | case ACPI_PTYPE2: | 728 | case ACPI_PTYPE2: |
726 | case ACPI_PTYPE2_PKG_COUNT: | 729 | case ACPI_PTYPE2_PKG_COUNT: |
@@ -800,7 +803,7 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, | |||
800 | 803 | ||
801 | /* | 804 | /* |
802 | * First element is the (Integer) count of elements, including | 805 | * First element is the (Integer) count of elements, including |
803 | * the count field. | 806 | * the count field (the ACPI name is num_elements) |
804 | */ | 807 | */ |
805 | status = acpi_ns_check_object_type(data, sub_elements, | 808 | status = acpi_ns_check_object_type(data, sub_elements, |
806 | ACPI_RTYPE_INTEGER, | 809 | ACPI_RTYPE_INTEGER, |
@@ -822,6 +825,16 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data, | |||
822 | expected_count = package->ret_info.count1; | 825 | expected_count = package->ret_info.count1; |
823 | goto package_too_small; | 826 | goto package_too_small; |
824 | } | 827 | } |
828 | if (expected_count == 0) { | ||
829 | /* | ||
830 | * Either the num_entries element was originally zero or it was | ||
831 | * a NULL element and repaired to an Integer of value zero. | ||
832 | * In either case, repair it by setting num_entries to be the | ||
833 | * actual size of the subpackage. | ||
834 | */ | ||
835 | expected_count = sub_package->package.count; | ||
836 | (*sub_elements)->integer.value = expected_count; | ||
837 | } | ||
825 | 838 | ||
826 | /* Check the type of each sub-package element */ | 839 | /* Check the type of each sub-package element */ |
827 | 840 | ||
@@ -945,10 +958,18 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data, | |||
945 | char type_buffer[48]; /* Room for 5 types */ | 958 | char type_buffer[48]; /* Room for 5 types */ |
946 | 959 | ||
947 | /* | 960 | /* |
948 | * If we get a NULL return_object here, it is a NULL package element, | 961 | * If we get a NULL return_object here, it is a NULL package element. |
949 | * and this is always an error. | 962 | * Since all extraneous NULL package elements were removed earlier by a |
963 | * call to acpi_ns_remove_null_elements, this is an unexpected NULL element. | ||
964 | * We will attempt to repair it. | ||
950 | */ | 965 | */ |
951 | if (!return_object) { | 966 | if (!return_object) { |
967 | status = acpi_ns_repair_null_element(data, expected_btypes, | ||
968 | package_index, | ||
969 | return_object_ptr); | ||
970 | if (ACPI_SUCCESS(status)) { | ||
971 | return (AE_OK); /* Repair was successful */ | ||
972 | } | ||
952 | goto type_error_exit; | 973 | goto type_error_exit; |
953 | } | 974 | } |
954 | 975 | ||
@@ -1000,27 +1021,25 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data, | |||
1000 | 1021 | ||
1001 | /* Is the object one of the expected types? */ | 1022 | /* Is the object one of the expected types? */ |
1002 | 1023 | ||
1003 | if (!(return_btype & expected_btypes)) { | 1024 | if (return_btype & expected_btypes) { |
1004 | 1025 | ||
1005 | /* Type mismatch -- attempt repair of the returned object */ | 1026 | /* For reference objects, check that the reference type is correct */ |
1006 | 1027 | ||
1007 | status = acpi_ns_repair_object(data, expected_btypes, | 1028 | if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) { |
1008 | package_index, | 1029 | status = acpi_ns_check_reference(data, return_object); |
1009 | return_object_ptr); | ||
1010 | if (ACPI_SUCCESS(status)) { | ||
1011 | return (AE_OK); /* Repair was successful */ | ||
1012 | } | 1030 | } |
1013 | goto type_error_exit; | 1031 | |
1032 | return (status); | ||
1014 | } | 1033 | } |
1015 | 1034 | ||
1016 | /* For reference objects, check that the reference type is correct */ | 1035 | /* Type mismatch -- attempt repair of the returned object */ |
1017 | 1036 | ||
1018 | if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) { | 1037 | status = acpi_ns_repair_object(data, expected_btypes, |
1019 | status = acpi_ns_check_reference(data, return_object); | 1038 | package_index, return_object_ptr); |
1039 | if (ACPI_SUCCESS(status)) { | ||
1040 | return (AE_OK); /* Repair was successful */ | ||
1020 | } | 1041 | } |
1021 | 1042 | ||
1022 | return (status); | ||
1023 | |||
1024 | type_error_exit: | 1043 | type_error_exit: |
1025 | 1044 | ||
1026 | /* Create a string with all expected types for this predefined object */ | 1045 | /* Create a string with all expected types for this predefined object */ |
diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c index 4fd1bdb056b2..d4be37751be4 100644 --- a/drivers/acpi/acpica/nsrepair.c +++ b/drivers/acpi/acpica/nsrepair.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2009, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -45,6 +45,7 @@ | |||
45 | #include "accommon.h" | 45 | #include "accommon.h" |
46 | #include "acnamesp.h" | 46 | #include "acnamesp.h" |
47 | #include "acinterp.h" | 47 | #include "acinterp.h" |
48 | #include "acpredef.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_NAMESPACE | 50 | #define _COMPONENT ACPI_NAMESPACE |
50 | ACPI_MODULE_NAME("nsrepair") | 51 | ACPI_MODULE_NAME("nsrepair") |
@@ -71,6 +72,12 @@ ACPI_MODULE_NAME("nsrepair") | |||
71 | * Buffer -> Package of Integers | 72 | * Buffer -> Package of Integers |
72 | * Package -> Package of one Package | 73 | * Package -> Package of one Package |
73 | * | 74 | * |
75 | * Additional possible repairs: | ||
76 | * | ||
77 | * Optional/unnecessary NULL package elements removed | ||
78 | * Required package elements that are NULL replaced by Integer/String/Buffer | ||
79 | * Incorrect standalone package wrapped with required outer package | ||
80 | * | ||
74 | ******************************************************************************/ | 81 | ******************************************************************************/ |
75 | /* Local prototypes */ | 82 | /* Local prototypes */ |
76 | static acpi_status | 83 | static acpi_status |
@@ -506,6 +513,172 @@ acpi_ns_convert_to_package(union acpi_operand_object *original_object, | |||
506 | 513 | ||
507 | /******************************************************************************* | 514 | /******************************************************************************* |
508 | * | 515 | * |
516 | * FUNCTION: acpi_ns_repair_null_element | ||
517 | * | ||
518 | * PARAMETERS: Data - Pointer to validation data structure | ||
519 | * expected_btypes - Object types expected | ||
520 | * package_index - Index of object within parent package (if | ||
521 | * applicable - ACPI_NOT_PACKAGE_ELEMENT | ||
522 | * otherwise) | ||
523 | * return_object_ptr - Pointer to the object returned from the | ||
524 | * evaluation of a method or object | ||
525 | * | ||
526 | * RETURN: Status. AE_OK if repair was successful. | ||
527 | * | ||
528 | * DESCRIPTION: Attempt to repair a NULL element of a returned Package object. | ||
529 | * | ||
530 | ******************************************************************************/ | ||
531 | |||
532 | acpi_status | ||
533 | acpi_ns_repair_null_element(struct acpi_predefined_data *data, | ||
534 | u32 expected_btypes, | ||
535 | u32 package_index, | ||
536 | union acpi_operand_object **return_object_ptr) | ||
537 | { | ||
538 | union acpi_operand_object *return_object = *return_object_ptr; | ||
539 | union acpi_operand_object *new_object; | ||
540 | |||
541 | ACPI_FUNCTION_NAME(ns_repair_null_element); | ||
542 | |||
543 | /* No repair needed if return object is non-NULL */ | ||
544 | |||
545 | if (return_object) { | ||
546 | return (AE_OK); | ||
547 | } | ||
548 | |||
549 | /* | ||
550 | * Attempt to repair a NULL element of a Package object. This applies to | ||
551 | * predefined names that return a fixed-length package and each element | ||
552 | * is required. It does not apply to variable-length packages where NULL | ||
553 | * elements are allowed, especially at the end of the package. | ||
554 | */ | ||
555 | if (expected_btypes & ACPI_RTYPE_INTEGER) { | ||
556 | |||
557 | /* Need an Integer - create a zero-value integer */ | ||
558 | |||
559 | new_object = acpi_ut_create_integer_object(0); | ||
560 | } else if (expected_btypes & ACPI_RTYPE_STRING) { | ||
561 | |||
562 | /* Need a String - create a NULL string */ | ||
563 | |||
564 | new_object = acpi_ut_create_string_object(0); | ||
565 | } else if (expected_btypes & ACPI_RTYPE_BUFFER) { | ||
566 | |||
567 | /* Need a Buffer - create a zero-length buffer */ | ||
568 | |||
569 | new_object = acpi_ut_create_buffer_object(0); | ||
570 | } else { | ||
571 | /* Error for all other expected types */ | ||
572 | |||
573 | return (AE_AML_OPERAND_TYPE); | ||
574 | } | ||
575 | |||
576 | if (!new_object) { | ||
577 | return (AE_NO_MEMORY); | ||
578 | } | ||
579 | |||
580 | /* Set the reference count according to the parent Package object */ | ||
581 | |||
582 | new_object->common.reference_count = | ||
583 | data->parent_package->common.reference_count; | ||
584 | |||
585 | ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, | ||
586 | "%s: Converted NULL package element to expected %s at index %u\n", | ||
587 | data->pathname, | ||
588 | acpi_ut_get_object_type_name(new_object), | ||
589 | package_index)); | ||
590 | |||
591 | *return_object_ptr = new_object; | ||
592 | data->flags |= ACPI_OBJECT_REPAIRED; | ||
593 | return (AE_OK); | ||
594 | } | ||
595 | |||
596 | /****************************************************************************** | ||
597 | * | ||
598 | * FUNCTION: acpi_ns_remove_null_elements | ||
599 | * | ||
600 | * PARAMETERS: Data - Pointer to validation data structure | ||
601 | * package_type - An acpi_return_package_types value | ||
602 | * obj_desc - A Package object | ||
603 | * | ||
604 | * RETURN: None. | ||
605 | * | ||
606 | * DESCRIPTION: Remove all NULL package elements from packages that contain | ||
607 | * a variable number of sub-packages. For these types of | ||
608 | * packages, NULL elements can be safely removed. | ||
609 | * | ||
610 | *****************************************************************************/ | ||
611 | |||
612 | void | ||
613 | acpi_ns_remove_null_elements(struct acpi_predefined_data *data, | ||
614 | u8 package_type, | ||
615 | union acpi_operand_object *obj_desc) | ||
616 | { | ||
617 | union acpi_operand_object **source; | ||
618 | union acpi_operand_object **dest; | ||
619 | u32 count; | ||
620 | u32 new_count; | ||
621 | u32 i; | ||
622 | |||
623 | ACPI_FUNCTION_NAME(ns_remove_null_elements); | ||
624 | |||
625 | /* | ||
626 | * PTYPE1 packages contain no subpackages. | ||
627 | * PTYPE2 packages contain a variable number of sub-packages. We can | ||
628 | * safely remove all NULL elements from the PTYPE2 packages. | ||
629 | */ | ||
630 | switch (package_type) { | ||
631 | case ACPI_PTYPE1_FIXED: | ||
632 | case ACPI_PTYPE1_VAR: | ||
633 | case ACPI_PTYPE1_OPTION: | ||
634 | return; | ||
635 | |||
636 | case ACPI_PTYPE2: | ||
637 | case ACPI_PTYPE2_COUNT: | ||
638 | case ACPI_PTYPE2_PKG_COUNT: | ||
639 | case ACPI_PTYPE2_FIXED: | ||
640 | case ACPI_PTYPE2_MIN: | ||
641 | case ACPI_PTYPE2_REV_FIXED: | ||
642 | break; | ||
643 | |||
644 | default: | ||
645 | return; | ||
646 | } | ||
647 | |||
648 | count = obj_desc->package.count; | ||
649 | new_count = count; | ||
650 | |||
651 | source = obj_desc->package.elements; | ||
652 | dest = source; | ||
653 | |||
654 | /* Examine all elements of the package object, remove nulls */ | ||
655 | |||
656 | for (i = 0; i < count; i++) { | ||
657 | if (!*source) { | ||
658 | new_count--; | ||
659 | } else { | ||
660 | *dest = *source; | ||
661 | dest++; | ||
662 | } | ||
663 | source++; | ||
664 | } | ||
665 | |||
666 | /* Update parent package if any null elements were removed */ | ||
667 | |||
668 | if (new_count < count) { | ||
669 | ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, | ||
670 | "%s: Found and removed %u NULL elements\n", | ||
671 | data->pathname, (count - new_count))); | ||
672 | |||
673 | /* NULL terminate list and update the package count */ | ||
674 | |||
675 | *dest = NULL; | ||
676 | obj_desc->package.count = new_count; | ||
677 | } | ||
678 | } | ||
679 | |||
680 | /******************************************************************************* | ||
681 | * | ||
509 | * FUNCTION: acpi_ns_repair_package_list | 682 | * FUNCTION: acpi_ns_repair_package_list |
510 | * | 683 | * |
511 | * PARAMETERS: Data - Pointer to validation data structure | 684 | * PARAMETERS: Data - Pointer to validation data structure |
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c index f13691c1cca5..61bd0f6755d2 100644 --- a/drivers/acpi/acpica/nsrepair2.c +++ b/drivers/acpi/acpica/nsrepair2.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2009, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -45,7 +45,6 @@ | |||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include "accommon.h" | 46 | #include "accommon.h" |
47 | #include "acnamesp.h" | 47 | #include "acnamesp.h" |
48 | #include "acpredef.h" | ||
49 | 48 | ||
50 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME("nsrepair2") | 50 | ACPI_MODULE_NAME("nsrepair2") |
@@ -93,7 +92,7 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data, | |||
93 | u32 sort_index, | 92 | u32 sort_index, |
94 | u8 sort_direction, char *sort_key_name); | 93 | u8 sort_direction, char *sort_key_name); |
95 | 94 | ||
96 | static acpi_status | 95 | static void |
97 | acpi_ns_sort_list(union acpi_operand_object **elements, | 96 | acpi_ns_sort_list(union acpi_operand_object **elements, |
98 | u32 count, u32 index, u8 sort_direction); | 97 | u32 count, u32 index, u8 sort_direction); |
99 | 98 | ||
@@ -443,7 +442,6 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data, | |||
443 | union acpi_operand_object *obj_desc; | 442 | union acpi_operand_object *obj_desc; |
444 | u32 i; | 443 | u32 i; |
445 | u32 previous_value; | 444 | u32 previous_value; |
446 | acpi_status status; | ||
447 | 445 | ||
448 | ACPI_FUNCTION_NAME(ns_check_sorted_list); | 446 | ACPI_FUNCTION_NAME(ns_check_sorted_list); |
449 | 447 | ||
@@ -494,19 +492,15 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data, | |||
494 | 492 | ||
495 | /* | 493 | /* |
496 | * The list must be sorted in the specified order. If we detect a | 494 | * The list must be sorted in the specified order. If we detect a |
497 | * discrepancy, issue a warning and sort the entire list | 495 | * discrepancy, sort the entire list. |
498 | */ | 496 | */ |
499 | if (((sort_direction == ACPI_SORT_ASCENDING) && | 497 | if (((sort_direction == ACPI_SORT_ASCENDING) && |
500 | (obj_desc->integer.value < previous_value)) || | 498 | (obj_desc->integer.value < previous_value)) || |
501 | ((sort_direction == ACPI_SORT_DESCENDING) && | 499 | ((sort_direction == ACPI_SORT_DESCENDING) && |
502 | (obj_desc->integer.value > previous_value))) { | 500 | (obj_desc->integer.value > previous_value))) { |
503 | status = | 501 | acpi_ns_sort_list(return_object->package.elements, |
504 | acpi_ns_sort_list(return_object->package.elements, | 502 | outer_element_count, sort_index, |
505 | outer_element_count, sort_index, | 503 | sort_direction); |
506 | sort_direction); | ||
507 | if (ACPI_FAILURE(status)) { | ||
508 | return (status); | ||
509 | } | ||
510 | 504 | ||
511 | data->flags |= ACPI_OBJECT_REPAIRED; | 505 | data->flags |= ACPI_OBJECT_REPAIRED; |
512 | 506 | ||
@@ -525,89 +519,6 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data, | |||
525 | 519 | ||
526 | /****************************************************************************** | 520 | /****************************************************************************** |
527 | * | 521 | * |
528 | * FUNCTION: acpi_ns_remove_null_elements | ||
529 | * | ||
530 | * PARAMETERS: Data - Pointer to validation data structure | ||
531 | * package_type - An acpi_return_package_types value | ||
532 | * obj_desc - A Package object | ||
533 | * | ||
534 | * RETURN: None. | ||
535 | * | ||
536 | * DESCRIPTION: Remove all NULL package elements from packages that contain | ||
537 | * a variable number of sub-packages. | ||
538 | * | ||
539 | *****************************************************************************/ | ||
540 | |||
541 | void | ||
542 | acpi_ns_remove_null_elements(struct acpi_predefined_data *data, | ||
543 | u8 package_type, | ||
544 | union acpi_operand_object *obj_desc) | ||
545 | { | ||
546 | union acpi_operand_object **source; | ||
547 | union acpi_operand_object **dest; | ||
548 | u32 count; | ||
549 | u32 new_count; | ||
550 | u32 i; | ||
551 | |||
552 | ACPI_FUNCTION_NAME(ns_remove_null_elements); | ||
553 | |||
554 | /* | ||
555 | * PTYPE1 packages contain no subpackages. | ||
556 | * PTYPE2 packages contain a variable number of sub-packages. We can | ||
557 | * safely remove all NULL elements from the PTYPE2 packages. | ||
558 | */ | ||
559 | switch (package_type) { | ||
560 | case ACPI_PTYPE1_FIXED: | ||
561 | case ACPI_PTYPE1_VAR: | ||
562 | case ACPI_PTYPE1_OPTION: | ||
563 | return; | ||
564 | |||
565 | case ACPI_PTYPE2: | ||
566 | case ACPI_PTYPE2_COUNT: | ||
567 | case ACPI_PTYPE2_PKG_COUNT: | ||
568 | case ACPI_PTYPE2_FIXED: | ||
569 | case ACPI_PTYPE2_MIN: | ||
570 | case ACPI_PTYPE2_REV_FIXED: | ||
571 | break; | ||
572 | |||
573 | default: | ||
574 | return; | ||
575 | } | ||
576 | |||
577 | count = obj_desc->package.count; | ||
578 | new_count = count; | ||
579 | |||
580 | source = obj_desc->package.elements; | ||
581 | dest = source; | ||
582 | |||
583 | /* Examine all elements of the package object, remove nulls */ | ||
584 | |||
585 | for (i = 0; i < count; i++) { | ||
586 | if (!*source) { | ||
587 | new_count--; | ||
588 | } else { | ||
589 | *dest = *source; | ||
590 | dest++; | ||
591 | } | ||
592 | source++; | ||
593 | } | ||
594 | |||
595 | /* Update parent package if any null elements were removed */ | ||
596 | |||
597 | if (new_count < count) { | ||
598 | ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, | ||
599 | "%s: Found and removed %u NULL elements\n", | ||
600 | data->pathname, (count - new_count))); | ||
601 | |||
602 | /* NULL terminate list and update the package count */ | ||
603 | |||
604 | *dest = NULL; | ||
605 | obj_desc->package.count = new_count; | ||
606 | } | ||
607 | } | ||
608 | |||
609 | /****************************************************************************** | ||
610 | * | ||
611 | * FUNCTION: acpi_ns_sort_list | 522 | * FUNCTION: acpi_ns_sort_list |
612 | * | 523 | * |
613 | * PARAMETERS: Elements - Package object element list | 524 | * PARAMETERS: Elements - Package object element list |
@@ -615,15 +526,16 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data, | |||
615 | * Index - Sort by which package element | 526 | * Index - Sort by which package element |
616 | * sort_direction - Ascending or Descending sort | 527 | * sort_direction - Ascending or Descending sort |
617 | * | 528 | * |
618 | * RETURN: Status | 529 | * RETURN: None |
619 | * | 530 | * |
620 | * DESCRIPTION: Sort the objects that are in a package element list. | 531 | * DESCRIPTION: Sort the objects that are in a package element list. |
621 | * | 532 | * |
622 | * NOTE: Assumes that all NULL elements have been removed from the package. | 533 | * NOTE: Assumes that all NULL elements have been removed from the package, |
534 | * and that all elements have been verified to be of type Integer. | ||
623 | * | 535 | * |
624 | *****************************************************************************/ | 536 | *****************************************************************************/ |
625 | 537 | ||
626 | static acpi_status | 538 | static void |
627 | acpi_ns_sort_list(union acpi_operand_object **elements, | 539 | acpi_ns_sort_list(union acpi_operand_object **elements, |
628 | u32 count, u32 index, u8 sort_direction) | 540 | u32 count, u32 index, u8 sort_direction) |
629 | { | 541 | { |
@@ -652,6 +564,4 @@ acpi_ns_sort_list(union acpi_operand_object **elements, | |||
652 | } | 564 | } |
653 | } | 565 | } |
654 | } | 566 | } |
655 | |||
656 | return (AE_OK); | ||
657 | } | 567 | } |
diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c index 7e865639a928..08f8b3f5ccaa 100644 --- a/drivers/acpi/acpica/nssearch.c +++ b/drivers/acpi/acpica/nssearch.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c index 47d91e668a1b..24d05a87a2a3 100644 --- a/drivers/acpi/acpica/nsutils.c +++ b/drivers/acpi/acpica/nsutils.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c index d7e6b52b4482..00e79fb26029 100644 --- a/drivers/acpi/acpica/nswalk.c +++ b/drivers/acpi/acpica/nswalk.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c index f0c0892bc7e5..ebef8a7fd707 100644 --- a/drivers/acpi/acpica/nsxfeval.c +++ b/drivers/acpi/acpica/nsxfeval.c | |||
@@ -6,7 +6,7 @@ | |||
6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -562,25 +562,20 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
562 | return (AE_BAD_PARAMETER); | 562 | return (AE_BAD_PARAMETER); |
563 | } | 563 | } |
564 | 564 | ||
565 | /* Run _STA to determine if device is present */ | 565 | /* |
566 | 566 | * First, filter based on the device HID and CID. | |
567 | status = acpi_ut_execute_STA(node, &flags); | 567 | * |
568 | if (ACPI_FAILURE(status)) { | 568 | * 01/2010: For this case where a specific HID is requested, we don't |
569 | return (AE_CTRL_DEPTH); | 569 | * want to run _STA until we have an actual HID match. Thus, we will |
570 | } | 570 | * not unnecessarily execute _STA on devices for which the caller |
571 | 571 | * doesn't care about. Previously, _STA was executed unconditionally | |
572 | if (!(flags & ACPI_STA_DEVICE_PRESENT) && | 572 | * on all devices found here. |
573 | !(flags & ACPI_STA_DEVICE_FUNCTIONING)) { | 573 | * |
574 | /* | 574 | * A side-effect of this change is that now we will continue to search |
575 | * Don't examine the children of the device only when the | 575 | * for a matching HID even under device trees where the parent device |
576 | * device is neither present nor functional. See ACPI spec, | 576 | * would have returned a _STA that indicates it is not present or |
577 | * description of _STA for more information. | 577 | * not functioning (thus aborting the search on that branch). |
578 | */ | 578 | */ |
579 | return (AE_CTRL_DEPTH); | ||
580 | } | ||
581 | |||
582 | /* Filter based on device HID & CID */ | ||
583 | |||
584 | if (info->hid != NULL) { | 579 | if (info->hid != NULL) { |
585 | status = acpi_ut_execute_HID(node, &hid); | 580 | status = acpi_ut_execute_HID(node, &hid); |
586 | if (status == AE_NOT_FOUND) { | 581 | if (status == AE_NOT_FOUND) { |
@@ -620,6 +615,25 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
620 | } | 615 | } |
621 | } | 616 | } |
622 | 617 | ||
618 | /* Run _STA to determine if device is present */ | ||
619 | |||
620 | status = acpi_ut_execute_STA(node, &flags); | ||
621 | if (ACPI_FAILURE(status)) { | ||
622 | return (AE_CTRL_DEPTH); | ||
623 | } | ||
624 | |||
625 | if (!(flags & ACPI_STA_DEVICE_PRESENT) && | ||
626 | !(flags & ACPI_STA_DEVICE_FUNCTIONING)) { | ||
627 | /* | ||
628 | * Don't examine the children of the device only when the | ||
629 | * device is neither present nor functional. See ACPI spec, | ||
630 | * description of _STA for more information. | ||
631 | */ | ||
632 | return (AE_CTRL_DEPTH); | ||
633 | } | ||
634 | |||
635 | /* We have a valid device, invoke the user function */ | ||
636 | |||
623 | status = info->user_function(obj_handle, nesting_level, info->context, | 637 | status = info->user_function(obj_handle, nesting_level, info->context, |
624 | return_value); | 638 | return_value); |
625 | return (status); | 639 | return (status); |
diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c index e611dd961b20..b01e45a415e3 100644 --- a/drivers/acpi/acpica/nsxfname.c +++ b/drivers/acpi/acpica/nsxfname.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c index 0cc6ba01a495..eafef24ea448 100644 --- a/drivers/acpi/acpica/nsxfobj.c +++ b/drivers/acpi/acpica/nsxfobj.c | |||
@@ -6,7 +6,7 @@ | |||
6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c index b161f3544b51..00493e108a01 100644 --- a/drivers/acpi/acpica/psargs.c +++ b/drivers/acpi/acpica/psargs.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -403,7 +403,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, | |||
403 | /* Get 1 byte from the AML stream */ | 403 | /* Get 1 byte from the AML stream */ |
404 | 404 | ||
405 | opcode = AML_BYTE_OP; | 405 | opcode = AML_BYTE_OP; |
406 | arg->common.value.integer = (acpi_integer) * aml; | 406 | arg->common.value.integer = (u64) *aml; |
407 | length = 1; | 407 | length = 1; |
408 | break; | 408 | break; |
409 | 409 | ||
diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c index 0988e4a8901d..59aabaeab1d3 100644 --- a/drivers/acpi/acpica/psloop.c +++ b/drivers/acpi/acpica/psloop.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psopcode.c b/drivers/acpi/acpica/psopcode.c index 3bc3a60194d6..2b0c3be2b1b8 100644 --- a/drivers/acpi/acpica/psopcode.c +++ b/drivers/acpi/acpica/psopcode.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c index 4df8f139026c..8d81542194d4 100644 --- a/drivers/acpi/acpica/psparse.c +++ b/drivers/acpi/acpica/psparse.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psscope.c b/drivers/acpi/acpica/psscope.c index 2feca5ca9581..40e2b279ea12 100644 --- a/drivers/acpi/acpica/psscope.c +++ b/drivers/acpi/acpica/psscope.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/pstree.c b/drivers/acpi/acpica/pstree.c index 4d3389118ec3..d4b970c3630b 100644 --- a/drivers/acpi/acpica/pstree.c +++ b/drivers/acpi/acpica/pstree.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c index e636e078ad3d..fe29eee5adb1 100644 --- a/drivers/acpi/acpica/psutils.c +++ b/drivers/acpi/acpica/psutils.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/pswalk.c b/drivers/acpi/acpica/pswalk.c index 78b8b791f2ae..8abb9629443d 100644 --- a/drivers/acpi/acpica/pswalk.c +++ b/drivers/acpi/acpica/pswalk.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/psxface.c b/drivers/acpi/acpica/psxface.c index d0c1b91eb8ca..6064dd4e94c2 100644 --- a/drivers/acpi/acpica/psxface.c +++ b/drivers/acpi/acpica/psxface.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsaddr.c b/drivers/acpi/acpica/rsaddr.c index 1e437bfd8db5..226c806ae986 100644 --- a/drivers/acpi/acpica/rsaddr.c +++ b/drivers/acpi/acpica/rsaddr.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c index 3c4dcc3d1069..d6ebf7ec622d 100644 --- a/drivers/acpi/acpica/rscalc.c +++ b/drivers/acpi/acpica/rscalc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c index a3c23d686d5f..f2ee3b548609 100644 --- a/drivers/acpi/acpica/rscreate.c +++ b/drivers/acpi/acpica/rscreate.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -182,7 +182,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
182 | 182 | ||
183 | /* | 183 | /* |
184 | * Loop through the ACPI_INTERNAL_OBJECTS - Each object should be a | 184 | * Loop through the ACPI_INTERNAL_OBJECTS - Each object should be a |
185 | * package that in turn contains an acpi_integer Address, a u8 Pin, | 185 | * package that in turn contains an u64 Address, a u8 Pin, |
186 | * a Name, and a u8 source_index. | 186 | * a Name, and a u8 source_index. |
187 | */ | 187 | */ |
188 | top_object_list = package_object->package.elements; | 188 | top_object_list = package_object->package.elements; |
diff --git a/drivers/acpi/acpica/rsdump.c b/drivers/acpi/acpica/rsdump.c index 3f0ca5a12d34..f859b0386fe4 100644 --- a/drivers/acpi/acpica/rsdump.c +++ b/drivers/acpi/acpica/rsdump.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsinfo.c b/drivers/acpi/acpica/rsinfo.c index 77b25fdb459c..1fd868b964fd 100644 --- a/drivers/acpi/acpica/rsinfo.c +++ b/drivers/acpi/acpica/rsinfo.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsio.c b/drivers/acpi/acpica/rsio.c index 35a49aa95609..33bff17c0bbc 100644 --- a/drivers/acpi/acpica/rsio.c +++ b/drivers/acpi/acpica/rsio.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsirq.c b/drivers/acpi/acpica/rsirq.c index 2e0256983aa6..545da40d7fa7 100644 --- a/drivers/acpi/acpica/rsirq.c +++ b/drivers/acpi/acpica/rsirq.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rslist.c b/drivers/acpi/acpica/rslist.c index 1b1dbc69f087..fd057c72d252 100644 --- a/drivers/acpi/acpica/rslist.c +++ b/drivers/acpi/acpica/rslist.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsmemory.c b/drivers/acpi/acpica/rsmemory.c index ddc76cebdc92..887b8ba8c432 100644 --- a/drivers/acpi/acpica/rsmemory.c +++ b/drivers/acpi/acpica/rsmemory.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsmisc.c b/drivers/acpi/acpica/rsmisc.c index 5bc49a553284..07de352fa443 100644 --- a/drivers/acpi/acpica/rsmisc.c +++ b/drivers/acpi/acpica/rsmisc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c index bc03d5966829..22cfcfbd9fff 100644 --- a/drivers/acpi/acpica/rsutils.c +++ b/drivers/acpi/acpica/rsutils.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c index f27feb4772f6..9f6a6e7e1c8e 100644 --- a/drivers/acpi/acpica/rsxface.c +++ b/drivers/acpi/acpica/rsxface.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c index c016335fb759..f43fbe0fc3fc 100644 --- a/drivers/acpi/acpica/tbfadt.c +++ b/drivers/acpi/acpica/tbfadt.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbfind.c b/drivers/acpi/acpica/tbfind.c index 1054dfd49207..e252180ce61c 100644 --- a/drivers/acpi/acpica/tbfind.c +++ b/drivers/acpi/acpica/tbfind.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c index 63e82329a9e8..7ec02b0f69e0 100644 --- a/drivers/acpi/acpica/tbinstal.c +++ b/drivers/acpi/acpica/tbinstal.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index 1f15497f00d1..02723a9fb10c 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c index a88f02bd6c94..5217a6159a31 100644 --- a/drivers/acpi/acpica/tbxface.c +++ b/drivers/acpi/acpica/tbxface.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2008, Intel Corp. | 9 | * Copyright (C) 2000 - 2010, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c index 85ea834199e2..dda6e8c497d3 100644 --- a/drivers/acpi/acpica/tbxfroot.c +++ b/drivers/acpi/acpica/tbxfroot.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utalloc.c b/drivers/acpi/acpica/utalloc.c index 7580f6b3069e..3d706b8fd449 100644 --- a/drivers/acpi/acpica/utalloc.c +++ b/drivers/acpi/acpica/utalloc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c index f857c5efb79f..97ec3621e71d 100644 --- a/drivers/acpi/acpica/utcopy.c +++ b/drivers/acpi/acpica/utcopy.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c index 527d729f6815..983510640059 100644 --- a/drivers/acpi/acpica/utdebug.c +++ b/drivers/acpi/acpica/utdebug.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -460,8 +460,7 @@ ACPI_EXPORT_SYMBOL(acpi_ut_status_exit) | |||
460 | void | 460 | void |
461 | acpi_ut_value_exit(u32 line_number, | 461 | acpi_ut_value_exit(u32 line_number, |
462 | const char *function_name, | 462 | const char *function_name, |
463 | const char *module_name, | 463 | const char *module_name, u32 component_id, u64 value) |
464 | u32 component_id, acpi_integer value) | ||
465 | { | 464 | { |
466 | 465 | ||
467 | acpi_debug_print(ACPI_LV_FUNCTIONS, | 466 | acpi_debug_print(ACPI_LV_FUNCTIONS, |
diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c index 96e26e70c63d..16b51c69606a 100644 --- a/drivers/acpi/acpica/utdelete.c +++ b/drivers/acpi/acpica/utdelete.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c index 5d54e36ab453..7f5e734ce7f7 100644 --- a/drivers/acpi/acpica/uteval.c +++ b/drivers/acpi/acpica/uteval.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -348,7 +348,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
348 | acpi_status | 348 | acpi_status |
349 | acpi_ut_evaluate_numeric_object(char *object_name, | 349 | acpi_ut_evaluate_numeric_object(char *object_name, |
350 | struct acpi_namespace_node *device_node, | 350 | struct acpi_namespace_node *device_node, |
351 | acpi_integer *value) | 351 | u64 *value) |
352 | { | 352 | { |
353 | union acpi_operand_object *obj_desc; | 353 | union acpi_operand_object *obj_desc; |
354 | acpi_status status; | 354 | acpi_status status; |
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c index 3f2c68f4e959..eda3e656c4af 100644 --- a/drivers/acpi/acpica/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -234,7 +234,7 @@ static const char acpi_gbl_hex_to_ascii[] = { | |||
234 | * | 234 | * |
235 | ******************************************************************************/ | 235 | ******************************************************************************/ |
236 | 236 | ||
237 | char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position) | 237 | char acpi_ut_hex_to_ascii_char(u64 integer, u32 position) |
238 | { | 238 | { |
239 | 239 | ||
240 | return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]); | 240 | return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]); |
diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c index 52eaae404554..1397fadd0d4b 100644 --- a/drivers/acpi/acpica/utids.c +++ b/drivers/acpi/acpica/utids.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2009, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c index 9d0919ebf7b0..a39c93dac719 100644 --- a/drivers/acpi/acpica/utinit.c +++ b/drivers/acpi/acpica/utinit.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utlock.c b/drivers/acpi/acpica/utlock.c index 25e03120686d..b081cd46a15f 100644 --- a/drivers/acpi/acpica/utlock.c +++ b/drivers/acpi/acpica/utlock.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2009, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utmath.c b/drivers/acpi/acpica/utmath.c index c9f682d640ef..35059a14eb72 100644 --- a/drivers/acpi/acpica/utmath.c +++ b/drivers/acpi/acpica/utmath.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -70,9 +70,8 @@ ACPI_MODULE_NAME("utmath") | |||
70 | * | 70 | * |
71 | ******************************************************************************/ | 71 | ******************************************************************************/ |
72 | acpi_status | 72 | acpi_status |
73 | acpi_ut_short_divide(acpi_integer dividend, | 73 | acpi_ut_short_divide(u64 dividend, |
74 | u32 divisor, | 74 | u32 divisor, u64 *out_quotient, u32 *out_remainder) |
75 | acpi_integer * out_quotient, u32 * out_remainder) | ||
76 | { | 75 | { |
77 | union uint64_overlay dividend_ovl; | 76 | union uint64_overlay dividend_ovl; |
78 | union uint64_overlay quotient; | 77 | union uint64_overlay quotient; |
@@ -126,9 +125,8 @@ acpi_ut_short_divide(acpi_integer dividend, | |||
126 | ******************************************************************************/ | 125 | ******************************************************************************/ |
127 | 126 | ||
128 | acpi_status | 127 | acpi_status |
129 | acpi_ut_divide(acpi_integer in_dividend, | 128 | acpi_ut_divide(u64 in_dividend, |
130 | acpi_integer in_divisor, | 129 | u64 in_divisor, u64 *out_quotient, u64 *out_remainder) |
131 | acpi_integer * out_quotient, acpi_integer * out_remainder) | ||
132 | { | 130 | { |
133 | union uint64_overlay dividend; | 131 | union uint64_overlay dividend; |
134 | union uint64_overlay divisor; | 132 | union uint64_overlay divisor; |
@@ -199,9 +197,8 @@ acpi_ut_divide(acpi_integer in_dividend, | |||
199 | * The 64-bit remainder must be generated. | 197 | * The 64-bit remainder must be generated. |
200 | */ | 198 | */ |
201 | partial1 = quotient.part.lo * divisor.part.hi; | 199 | partial1 = quotient.part.lo * divisor.part.hi; |
202 | partial2.full = | 200 | partial2.full = (u64) quotient.part.lo * divisor.part.lo; |
203 | (acpi_integer) quotient.part.lo * divisor.part.lo; | 201 | partial3.full = (u64) partial2.part.hi + partial1; |
204 | partial3.full = (acpi_integer) partial2.part.hi + partial1; | ||
205 | 202 | ||
206 | remainder.part.hi = partial3.part.lo; | 203 | remainder.part.hi = partial3.part.lo; |
207 | remainder.part.lo = partial2.part.lo; | 204 | remainder.part.lo = partial2.part.lo; |
@@ -257,9 +254,8 @@ acpi_ut_divide(acpi_integer in_dividend, | |||
257 | * | 254 | * |
258 | ******************************************************************************/ | 255 | ******************************************************************************/ |
259 | acpi_status | 256 | acpi_status |
260 | acpi_ut_short_divide(acpi_integer in_dividend, | 257 | acpi_ut_short_divide(u64 in_dividend, |
261 | u32 divisor, | 258 | u32 divisor, u64 *out_quotient, u32 *out_remainder) |
262 | acpi_integer * out_quotient, u32 * out_remainder) | ||
263 | { | 259 | { |
264 | 260 | ||
265 | ACPI_FUNCTION_TRACE(ut_short_divide); | 261 | ACPI_FUNCTION_TRACE(ut_short_divide); |
@@ -284,9 +280,8 @@ acpi_ut_short_divide(acpi_integer in_dividend, | |||
284 | } | 280 | } |
285 | 281 | ||
286 | acpi_status | 282 | acpi_status |
287 | acpi_ut_divide(acpi_integer in_dividend, | 283 | acpi_ut_divide(u64 in_dividend, |
288 | acpi_integer in_divisor, | 284 | u64 in_divisor, u64 *out_quotient, u64 *out_remainder) |
289 | acpi_integer * out_quotient, acpi_integer * out_remainder) | ||
290 | { | 285 | { |
291 | ACPI_FUNCTION_TRACE(ut_divide); | 286 | ACPI_FUNCTION_TRACE(ut_divide); |
292 | 287 | ||
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c index 6c6a5137b728..32982e2ac384 100644 --- a/drivers/acpi/acpica/utmisc.c +++ b/drivers/acpi/acpica/utmisc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -724,13 +724,12 @@ acpi_name acpi_ut_repair_name(char *name) | |||
724 | * | 724 | * |
725 | ******************************************************************************/ | 725 | ******************************************************************************/ |
726 | 726 | ||
727 | acpi_status | 727 | acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 * ret_integer) |
728 | acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) | ||
729 | { | 728 | { |
730 | u32 this_digit = 0; | 729 | u32 this_digit = 0; |
731 | acpi_integer return_value = 0; | 730 | u64 return_value = 0; |
732 | acpi_integer quotient; | 731 | u64 quotient; |
733 | acpi_integer dividend; | 732 | u64 dividend; |
734 | u32 to_integer_op = (base == ACPI_ANY_BASE); | 733 | u32 to_integer_op = (base == ACPI_ANY_BASE); |
735 | u32 mode32 = (acpi_gbl_integer_byte_width == 4); | 734 | u32 mode32 = (acpi_gbl_integer_byte_width == 4); |
736 | u8 valid_digits = 0; | 735 | u8 valid_digits = 0; |
@@ -844,9 +843,8 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) | |||
844 | 843 | ||
845 | /* Divide the digit into the correct position */ | 844 | /* Divide the digit into the correct position */ |
846 | 845 | ||
847 | (void) | 846 | (void)acpi_ut_short_divide((dividend - (u64) this_digit), |
848 | acpi_ut_short_divide((dividend - (acpi_integer) this_digit), | 847 | base, "ient, NULL); |
849 | base, "ient, NULL); | ||
850 | 848 | ||
851 | if (return_value > quotient) { | 849 | if (return_value > quotient) { |
852 | if (to_integer_op) { | 850 | if (to_integer_op) { |
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c index 80bb65154117..55d014ed6d55 100644 --- a/drivers/acpi/acpica/utmutex.c +++ b/drivers/acpi/acpica/utmutex.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -50,7 +50,7 @@ ACPI_MODULE_NAME("utmutex") | |||
50 | /* Local prototypes */ | 50 | /* Local prototypes */ |
51 | static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id); | 51 | static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id); |
52 | 52 | ||
53 | static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id); | 53 | static void acpi_ut_delete_mutex(acpi_mutex_handle mutex_id); |
54 | 54 | ||
55 | /******************************************************************************* | 55 | /******************************************************************************* |
56 | * | 56 | * |
@@ -114,7 +114,7 @@ void acpi_ut_mutex_terminate(void) | |||
114 | /* Delete each predefined mutex object */ | 114 | /* Delete each predefined mutex object */ |
115 | 115 | ||
116 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { | 116 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { |
117 | (void)acpi_ut_delete_mutex(i); | 117 | acpi_ut_delete_mutex(i); |
118 | } | 118 | } |
119 | 119 | ||
120 | /* Delete the spinlocks */ | 120 | /* Delete the spinlocks */ |
@@ -146,10 +146,6 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id) | |||
146 | 146 | ||
147 | ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id); | 147 | ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id); |
148 | 148 | ||
149 | if (mutex_id > ACPI_MAX_MUTEX) { | ||
150 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
151 | } | ||
152 | |||
153 | if (!acpi_gbl_mutex_info[mutex_id].mutex) { | 149 | if (!acpi_gbl_mutex_info[mutex_id].mutex) { |
154 | status = | 150 | status = |
155 | acpi_os_create_mutex(&acpi_gbl_mutex_info[mutex_id].mutex); | 151 | acpi_os_create_mutex(&acpi_gbl_mutex_info[mutex_id].mutex); |
@@ -173,21 +169,15 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id) | |||
173 | * | 169 | * |
174 | ******************************************************************************/ | 170 | ******************************************************************************/ |
175 | 171 | ||
176 | static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) | 172 | static void acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) |
177 | { | 173 | { |
178 | 174 | ||
179 | ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id); | 175 | ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id); |
180 | 176 | ||
181 | if (mutex_id > ACPI_MAX_MUTEX) { | ||
182 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
183 | } | ||
184 | |||
185 | acpi_os_delete_mutex(acpi_gbl_mutex_info[mutex_id].mutex); | 177 | acpi_os_delete_mutex(acpi_gbl_mutex_info[mutex_id].mutex); |
186 | 178 | ||
187 | acpi_gbl_mutex_info[mutex_id].mutex = NULL; | 179 | acpi_gbl_mutex_info[mutex_id].mutex = NULL; |
188 | acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; | 180 | acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; |
189 | |||
190 | return_ACPI_STATUS(AE_OK); | ||
191 | } | 181 | } |
192 | 182 | ||
193 | /******************************************************************************* | 183 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c index 42e658b543f1..3356f0cb0745 100644 --- a/drivers/acpi/acpica/utobject.c +++ b/drivers/acpi/acpica/utobject.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c index 91b7c00236f4..7965919000b1 100644 --- a/drivers/acpi/acpica/utresrc.c +++ b/drivers/acpi/acpica/utresrc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utstate.c b/drivers/acpi/acpica/utstate.c index 0440c958f5a4..d35d109b8da2 100644 --- a/drivers/acpi/acpica/utstate.c +++ b/drivers/acpi/acpica/utstate.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index b1f5f680bc78..db9d8ca57987 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2008, Intel Corp. | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index cada73ffdfa7..58d2c91ba62b 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -324,8 +324,8 @@ static int extract_package(struct acpi_battery *battery, | |||
324 | strncpy(ptr, element->string.pointer, 32); | 324 | strncpy(ptr, element->string.pointer, 32); |
325 | else if (element->type == ACPI_TYPE_INTEGER) { | 325 | else if (element->type == ACPI_TYPE_INTEGER) { |
326 | strncpy(ptr, (u8 *)&element->integer.value, | 326 | strncpy(ptr, (u8 *)&element->integer.value, |
327 | sizeof(acpi_integer)); | 327 | sizeof(u64)); |
328 | ptr[sizeof(acpi_integer)] = 0; | 328 | ptr[sizeof(u64)] = 0; |
329 | } else | 329 | } else |
330 | *ptr = 0; /* don't have value */ | 330 | *ptr = 0; /* don't have value */ |
331 | } else { | 331 | } else { |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 27e0b92b2e39..d7a6bbbb834c 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -597,7 +597,7 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
597 | 597 | ||
598 | static acpi_status | 598 | static acpi_status |
599 | acpi_ec_space_handler(u32 function, acpi_physical_address address, | 599 | acpi_ec_space_handler(u32 function, acpi_physical_address address, |
600 | u32 bits, acpi_integer *value, | 600 | u32 bits, u64 *value, |
601 | void *handler_context, void *region_context) | 601 | void *handler_context, void *region_context) |
602 | { | 602 | { |
603 | struct acpi_ec *ec = handler_context; | 603 | struct acpi_ec *ec = handler_context; |
@@ -628,7 +628,7 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address, | |||
628 | ++address; | 628 | ++address; |
629 | if (function == ACPI_READ) { | 629 | if (function == ACPI_READ) { |
630 | result = acpi_ec_read(ec, address, &temp); | 630 | result = acpi_ec_read(ec, address, &temp); |
631 | (*value) |= ((acpi_integer)temp) << i; | 631 | (*value) |= ((u64)temp) << i; |
632 | } else { | 632 | } else { |
633 | temp = 0xff & ((*value) >> i); | 633 | temp = 0xff & ((*value) >> i); |
634 | result = acpi_ec_write(ec, address, temp); | 634 | result = acpi_ec_write(ec, address, temp); |
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 4c8fcff662cf..6d5b64b7d526 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -87,7 +87,7 @@ static int acpi_find_bridge_device(struct device *dev, acpi_handle * handle) | |||
87 | /* Get device's handler per its address under its parent */ | 87 | /* Get device's handler per its address under its parent */ |
88 | struct acpi_find_child { | 88 | struct acpi_find_child { |
89 | acpi_handle handle; | 89 | acpi_handle handle; |
90 | acpi_integer address; | 90 | u64 address; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | static acpi_status | 93 | static acpi_status |
@@ -106,7 +106,7 @@ do_acpi_find_child(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
106 | return AE_OK; | 106 | return AE_OK; |
107 | } | 107 | } |
108 | 108 | ||
109 | acpi_handle acpi_get_child(acpi_handle parent, acpi_integer address) | 109 | acpi_handle acpi_get_child(acpi_handle parent, u64 address) |
110 | { | 110 | { |
111 | struct acpi_find_child find = { NULL, address }; | 111 | struct acpi_find_child find = { NULL, address }; |
112 | 112 | ||
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 02e8464e480f..8e6d8665f0ae 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -436,7 +436,7 @@ acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler) | |||
436 | * Running in interpreter thread context, safe to sleep | 436 | * Running in interpreter thread context, safe to sleep |
437 | */ | 437 | */ |
438 | 438 | ||
439 | void acpi_os_sleep(acpi_integer ms) | 439 | void acpi_os_sleep(u64 ms) |
440 | { | 440 | { |
441 | schedule_timeout_interruptible(msecs_to_jiffies(ms)); | 441 | schedule_timeout_interruptible(msecs_to_jiffies(ms)); |
442 | } | 442 | } |
@@ -603,7 +603,7 @@ acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, | |||
603 | 603 | ||
604 | acpi_status | 604 | acpi_status |
605 | acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, | 605 | acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg, |
606 | acpi_integer value, u32 width) | 606 | u64 value, u32 width) |
607 | { | 607 | { |
608 | int result, size; | 608 | int result, size; |
609 | 609 | ||
diff --git a/drivers/acpi/power_meter.c b/drivers/acpi/power_meter.c index dc4ffadf8122..834c5af0de4b 100644 --- a/drivers/acpi/power_meter.c +++ b/drivers/acpi/power_meter.c | |||
@@ -71,17 +71,17 @@ static const struct acpi_device_id power_meter_ids[] = { | |||
71 | MODULE_DEVICE_TABLE(acpi, power_meter_ids); | 71 | MODULE_DEVICE_TABLE(acpi, power_meter_ids); |
72 | 72 | ||
73 | struct acpi_power_meter_capabilities { | 73 | struct acpi_power_meter_capabilities { |
74 | acpi_integer flags; | 74 | u64 flags; |
75 | acpi_integer units; | 75 | u64 units; |
76 | acpi_integer type; | 76 | u64 type; |
77 | acpi_integer accuracy; | 77 | u64 accuracy; |
78 | acpi_integer sampling_time; | 78 | u64 sampling_time; |
79 | acpi_integer min_avg_interval; | 79 | u64 min_avg_interval; |
80 | acpi_integer max_avg_interval; | 80 | u64 max_avg_interval; |
81 | acpi_integer hysteresis; | 81 | u64 hysteresis; |
82 | acpi_integer configurable_cap; | 82 | u64 configurable_cap; |
83 | acpi_integer min_cap; | 83 | u64 min_cap; |
84 | acpi_integer max_cap; | 84 | u64 max_cap; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | struct acpi_power_meter_resource { | 87 | struct acpi_power_meter_resource { |
@@ -93,9 +93,9 @@ struct acpi_power_meter_resource { | |||
93 | acpi_string model_number; | 93 | acpi_string model_number; |
94 | acpi_string serial_number; | 94 | acpi_string serial_number; |
95 | acpi_string oem_info; | 95 | acpi_string oem_info; |
96 | acpi_integer power; | 96 | u64 power; |
97 | acpi_integer cap; | 97 | u64 cap; |
98 | acpi_integer avg_interval; | 98 | u64 avg_interval; |
99 | int sensors_valid; | 99 | int sensors_valid; |
100 | unsigned long sensors_last_updated; | 100 | unsigned long sensors_last_updated; |
101 | struct sensor_device_attribute sensors[NUM_SENSORS]; | 101 | struct sensor_device_attribute sensors[NUM_SENSORS]; |
@@ -402,7 +402,7 @@ static ssize_t show_val(struct device *dev, | |||
402 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); | 402 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
403 | struct acpi_device *acpi_dev = to_acpi_device(dev); | 403 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
404 | struct acpi_power_meter_resource *resource = acpi_dev->driver_data; | 404 | struct acpi_power_meter_resource *resource = acpi_dev->driver_data; |
405 | acpi_integer val = 0; | 405 | u64 val = 0; |
406 | 406 | ||
407 | switch (attr->index) { | 407 | switch (attr->index) { |
408 | case 0: | 408 | case 0: |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index cc978a8c00b7..37dfce749398 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -360,7 +360,7 @@ static int acpi_processor_get_power_info_default(struct acpi_processor *pr) | |||
360 | static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | 360 | static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) |
361 | { | 361 | { |
362 | acpi_status status = 0; | 362 | acpi_status status = 0; |
363 | acpi_integer count; | 363 | u64 count; |
364 | int current_count; | 364 | int current_count; |
365 | int i; | 365 | int i; |
366 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 366 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 1c5d7a8b2fdf..7ded7542fc9d 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -660,7 +660,7 @@ static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr) | |||
660 | 660 | ||
661 | #ifdef CONFIG_X86 | 661 | #ifdef CONFIG_X86 |
662 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, | 662 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, |
663 | acpi_integer * value) | 663 | u64 *value) |
664 | { | 664 | { |
665 | struct cpuinfo_x86 *c; | 665 | struct cpuinfo_x86 *c; |
666 | u64 msr_high, msr_low; | 666 | u64 msr_high, msr_low; |
@@ -681,13 +681,13 @@ static int acpi_throttling_rdmsr(struct acpi_processor *pr, | |||
681 | rdmsr_safe(MSR_IA32_THERM_CONTROL, | 681 | rdmsr_safe(MSR_IA32_THERM_CONTROL, |
682 | (u32 *)&msr_low , (u32 *) &msr_high); | 682 | (u32 *)&msr_low , (u32 *) &msr_high); |
683 | msr = (msr_high << 32) | msr_low; | 683 | msr = (msr_high << 32) | msr_low; |
684 | *value = (acpi_integer) msr; | 684 | *value = (u64) msr; |
685 | ret = 0; | 685 | ret = 0; |
686 | } | 686 | } |
687 | return ret; | 687 | return ret; |
688 | } | 688 | } |
689 | 689 | ||
690 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | 690 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, u64 value) |
691 | { | 691 | { |
692 | struct cpuinfo_x86 *c; | 692 | struct cpuinfo_x86 *c; |
693 | unsigned int cpu; | 693 | unsigned int cpu; |
@@ -711,14 +711,14 @@ static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | |||
711 | } | 711 | } |
712 | #else | 712 | #else |
713 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, | 713 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, |
714 | acpi_integer * value) | 714 | u64 *value) |
715 | { | 715 | { |
716 | printk(KERN_ERR PREFIX | 716 | printk(KERN_ERR PREFIX |
717 | "HARDWARE addr space,NOT supported yet\n"); | 717 | "HARDWARE addr space,NOT supported yet\n"); |
718 | return -1; | 718 | return -1; |
719 | } | 719 | } |
720 | 720 | ||
721 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | 721 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, u64 value) |
722 | { | 722 | { |
723 | printk(KERN_ERR PREFIX | 723 | printk(KERN_ERR PREFIX |
724 | "HARDWARE addr space,NOT supported yet\n"); | 724 | "HARDWARE addr space,NOT supported yet\n"); |
@@ -727,7 +727,7 @@ static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | |||
727 | #endif | 727 | #endif |
728 | 728 | ||
729 | static int acpi_read_throttling_status(struct acpi_processor *pr, | 729 | static int acpi_read_throttling_status(struct acpi_processor *pr, |
730 | acpi_integer *value) | 730 | u64 *value) |
731 | { | 731 | { |
732 | u32 bit_width, bit_offset; | 732 | u32 bit_width, bit_offset; |
733 | u64 ptc_value; | 733 | u64 ptc_value; |
@@ -746,7 +746,7 @@ static int acpi_read_throttling_status(struct acpi_processor *pr, | |||
746 | address, (u32 *) &ptc_value, | 746 | address, (u32 *) &ptc_value, |
747 | (u32) (bit_width + bit_offset)); | 747 | (u32) (bit_width + bit_offset)); |
748 | ptc_mask = (1 << bit_width) - 1; | 748 | ptc_mask = (1 << bit_width) - 1; |
749 | *value = (acpi_integer) ((ptc_value >> bit_offset) & ptc_mask); | 749 | *value = (u64) ((ptc_value >> bit_offset) & ptc_mask); |
750 | ret = 0; | 750 | ret = 0; |
751 | break; | 751 | break; |
752 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | 752 | case ACPI_ADR_SPACE_FIXED_HARDWARE: |
@@ -760,7 +760,7 @@ static int acpi_read_throttling_status(struct acpi_processor *pr, | |||
760 | } | 760 | } |
761 | 761 | ||
762 | static int acpi_write_throttling_state(struct acpi_processor *pr, | 762 | static int acpi_write_throttling_state(struct acpi_processor *pr, |
763 | acpi_integer value) | 763 | u64 value) |
764 | { | 764 | { |
765 | u32 bit_width, bit_offset; | 765 | u32 bit_width, bit_offset; |
766 | u64 ptc_value; | 766 | u64 ptc_value; |
@@ -793,7 +793,7 @@ static int acpi_write_throttling_state(struct acpi_processor *pr, | |||
793 | } | 793 | } |
794 | 794 | ||
795 | static int acpi_get_throttling_state(struct acpi_processor *pr, | 795 | static int acpi_get_throttling_state(struct acpi_processor *pr, |
796 | acpi_integer value) | 796 | u64 value) |
797 | { | 797 | { |
798 | int i; | 798 | int i; |
799 | 799 | ||
@@ -808,7 +808,7 @@ static int acpi_get_throttling_state(struct acpi_processor *pr, | |||
808 | } | 808 | } |
809 | 809 | ||
810 | static int acpi_get_throttling_value(struct acpi_processor *pr, | 810 | static int acpi_get_throttling_value(struct acpi_processor *pr, |
811 | int state, acpi_integer *value) | 811 | int state, u64 *value) |
812 | { | 812 | { |
813 | int ret = -1; | 813 | int ret = -1; |
814 | 814 | ||
@@ -826,7 +826,7 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) | |||
826 | { | 826 | { |
827 | int state = 0; | 827 | int state = 0; |
828 | int ret; | 828 | int ret; |
829 | acpi_integer value; | 829 | u64 value; |
830 | 830 | ||
831 | if (!pr) | 831 | if (!pr) |
832 | return -EINVAL; | 832 | return -EINVAL; |
@@ -993,7 +993,7 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | |||
993 | int state, bool force) | 993 | int state, bool force) |
994 | { | 994 | { |
995 | int ret; | 995 | int ret; |
996 | acpi_integer value; | 996 | u64 value; |
997 | 997 | ||
998 | if (!pr) | 998 | if (!pr) |
999 | return -EINVAL; | 999 | return -EINVAL; |
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 811fec10462b..11882dbe2094 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -107,12 +107,12 @@ acpi_extract_package(union acpi_object *package, | |||
107 | case ACPI_TYPE_INTEGER: | 107 | case ACPI_TYPE_INTEGER: |
108 | switch (format_string[i]) { | 108 | switch (format_string[i]) { |
109 | case 'N': | 109 | case 'N': |
110 | size_required += sizeof(acpi_integer); | 110 | size_required += sizeof(u64); |
111 | tail_offset += sizeof(acpi_integer); | 111 | tail_offset += sizeof(u64); |
112 | break; | 112 | break; |
113 | case 'S': | 113 | case 'S': |
114 | size_required += | 114 | size_required += |
115 | sizeof(char *) + sizeof(acpi_integer) + | 115 | sizeof(char *) + sizeof(u64) + |
116 | sizeof(char); | 116 | sizeof(char); |
117 | tail_offset += sizeof(char *); | 117 | tail_offset += sizeof(char *); |
118 | break; | 118 | break; |
@@ -193,17 +193,17 @@ acpi_extract_package(union acpi_object *package, | |||
193 | case ACPI_TYPE_INTEGER: | 193 | case ACPI_TYPE_INTEGER: |
194 | switch (format_string[i]) { | 194 | switch (format_string[i]) { |
195 | case 'N': | 195 | case 'N': |
196 | *((acpi_integer *) head) = | 196 | *((u64 *) head) = |
197 | element->integer.value; | 197 | element->integer.value; |
198 | head += sizeof(acpi_integer); | 198 | head += sizeof(u64); |
199 | break; | 199 | break; |
200 | case 'S': | 200 | case 'S': |
201 | pointer = (u8 **) head; | 201 | pointer = (u8 **) head; |
202 | *pointer = tail; | 202 | *pointer = tail; |
203 | *((acpi_integer *) tail) = | 203 | *((u64 *) tail) = |
204 | element->integer.value; | 204 | element->integer.value; |
205 | head += sizeof(acpi_integer *); | 205 | head += sizeof(u64 *); |
206 | tail += sizeof(acpi_integer); | 206 | tail += sizeof(u64); |
207 | /* NULL terminate string */ | 207 | /* NULL terminate string */ |
208 | *tail = (char)0; | 208 | *tail = (char)0; |
209 | tail += sizeof(char); | 209 | tail += sizeof(char); |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index b765790b32be..6e9b49149fce 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -759,7 +759,7 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video, | |||
759 | static int | 759 | static int |
760 | acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) | 760 | acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) |
761 | { | 761 | { |
762 | acpi_integer status = 0; | 762 | u64 status = 0; |
763 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; | 763 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; |
764 | struct acpi_object_list args = { 1, &arg0 }; | 764 | struct acpi_object_list args = { 1, &arg0 }; |
765 | 765 | ||
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 56c6374a3989..01c52c415bdc 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -446,9 +446,9 @@ config PATA_JMICRON | |||
446 | 446 | ||
447 | config PATA_LEGACY | 447 | config PATA_LEGACY |
448 | tristate "Legacy ISA PATA support (Experimental)" | 448 | tristate "Legacy ISA PATA support (Experimental)" |
449 | depends on ISA && EXPERIMENTAL | 449 | depends on (ISA || PCI) && EXPERIMENTAL |
450 | help | 450 | help |
451 | This option enables support for ISA/VLB bus legacy PATA | 451 | This option enables support for ISA/VLB/PCI bus legacy PATA |
452 | ports and allows them to be accessed via the new ATA layer. | 452 | ports and allows them to be accessed via the new ATA layer. |
453 | 453 | ||
454 | If unsure, say N. | 454 | If unsure, say N. |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index a6a736a7dbf2..6bd930b93bcc 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -93,6 +93,9 @@ enum { | |||
93 | AHCI_CMD_TBL_AR_SZ = AHCI_CMD_TBL_SZ * AHCI_MAX_CMDS, | 93 | AHCI_CMD_TBL_AR_SZ = AHCI_CMD_TBL_SZ * AHCI_MAX_CMDS, |
94 | AHCI_PORT_PRIV_DMA_SZ = AHCI_CMD_SLOT_SZ + AHCI_CMD_TBL_AR_SZ + | 94 | AHCI_PORT_PRIV_DMA_SZ = AHCI_CMD_SLOT_SZ + AHCI_CMD_TBL_AR_SZ + |
95 | AHCI_RX_FIS_SZ, | 95 | AHCI_RX_FIS_SZ, |
96 | AHCI_PORT_PRIV_FBS_DMA_SZ = AHCI_CMD_SLOT_SZ + | ||
97 | AHCI_CMD_TBL_AR_SZ + | ||
98 | (AHCI_RX_FIS_SZ * 16), | ||
96 | AHCI_IRQ_ON_SG = (1 << 31), | 99 | AHCI_IRQ_ON_SG = (1 << 31), |
97 | AHCI_CMD_ATAPI = (1 << 5), | 100 | AHCI_CMD_ATAPI = (1 << 5), |
98 | AHCI_CMD_WRITE = (1 << 6), | 101 | AHCI_CMD_WRITE = (1 << 6), |
@@ -170,6 +173,7 @@ enum { | |||
170 | PORT_SCR_ERR = 0x30, /* SATA phy register: SError */ | 173 | PORT_SCR_ERR = 0x30, /* SATA phy register: SError */ |
171 | PORT_SCR_ACT = 0x34, /* SATA phy register: SActive */ | 174 | PORT_SCR_ACT = 0x34, /* SATA phy register: SActive */ |
172 | PORT_SCR_NTF = 0x3c, /* SATA phy register: SNotification */ | 175 | PORT_SCR_NTF = 0x3c, /* SATA phy register: SNotification */ |
176 | PORT_FBS = 0x40, /* FIS-based Switching */ | ||
173 | 177 | ||
174 | /* PORT_IRQ_{STAT,MASK} bits */ | 178 | /* PORT_IRQ_{STAT,MASK} bits */ |
175 | PORT_IRQ_COLD_PRES = (1 << 31), /* cold presence detect */ | 179 | PORT_IRQ_COLD_PRES = (1 << 31), /* cold presence detect */ |
@@ -208,6 +212,7 @@ enum { | |||
208 | PORT_CMD_ASP = (1 << 27), /* Aggressive Slumber/Partial */ | 212 | PORT_CMD_ASP = (1 << 27), /* Aggressive Slumber/Partial */ |
209 | PORT_CMD_ALPE = (1 << 26), /* Aggressive Link PM enable */ | 213 | PORT_CMD_ALPE = (1 << 26), /* Aggressive Link PM enable */ |
210 | PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */ | 214 | PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */ |
215 | PORT_CMD_FBSCP = (1 << 22), /* FBS Capable Port */ | ||
211 | PORT_CMD_PMP = (1 << 17), /* PMP attached */ | 216 | PORT_CMD_PMP = (1 << 17), /* PMP attached */ |
212 | PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */ | 217 | PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */ |
213 | PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */ | 218 | PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */ |
@@ -222,6 +227,14 @@ enum { | |||
222 | PORT_CMD_ICC_PARTIAL = (0x2 << 28), /* Put i/f in partial state */ | 227 | PORT_CMD_ICC_PARTIAL = (0x2 << 28), /* Put i/f in partial state */ |
223 | PORT_CMD_ICC_SLUMBER = (0x6 << 28), /* Put i/f in slumber state */ | 228 | PORT_CMD_ICC_SLUMBER = (0x6 << 28), /* Put i/f in slumber state */ |
224 | 229 | ||
230 | PORT_FBS_DWE_OFFSET = 16, /* FBS device with error offset */ | ||
231 | PORT_FBS_ADO_OFFSET = 12, /* FBS active dev optimization offset */ | ||
232 | PORT_FBS_DEV_OFFSET = 8, /* FBS device to issue offset */ | ||
233 | PORT_FBS_DEV_MASK = (0xf << PORT_FBS_DEV_OFFSET), /* FBS.DEV */ | ||
234 | PORT_FBS_SDE = (1 << 2), /* FBS single device error */ | ||
235 | PORT_FBS_DEC = (1 << 1), /* FBS device error clear */ | ||
236 | PORT_FBS_EN = (1 << 0), /* Enable FBS */ | ||
237 | |||
225 | /* hpriv->flags bits */ | 238 | /* hpriv->flags bits */ |
226 | AHCI_HFLAG_NO_NCQ = (1 << 0), | 239 | AHCI_HFLAG_NO_NCQ = (1 << 0), |
227 | AHCI_HFLAG_IGN_IRQ_IF_ERR = (1 << 1), /* ignore IRQ_IF_ERR */ | 240 | AHCI_HFLAG_IGN_IRQ_IF_ERR = (1 << 1), /* ignore IRQ_IF_ERR */ |
@@ -304,6 +317,9 @@ struct ahci_port_priv { | |||
304 | unsigned int ncq_saw_dmas:1; | 317 | unsigned int ncq_saw_dmas:1; |
305 | unsigned int ncq_saw_sdb:1; | 318 | unsigned int ncq_saw_sdb:1; |
306 | u32 intr_mask; /* interrupts to enable */ | 319 | u32 intr_mask; /* interrupts to enable */ |
320 | bool fbs_supported; /* set iff FBS is supported */ | ||
321 | bool fbs_enabled; /* set iff FBS is enabled */ | ||
322 | int fbs_last_dev; /* save FBS.DEV of last FIS */ | ||
307 | /* enclosure management info per PM slot */ | 323 | /* enclosure management info per PM slot */ |
308 | struct ahci_em_priv em_priv[EM_MAX_SLOTS]; | 324 | struct ahci_em_priv em_priv[EM_MAX_SLOTS]; |
309 | }; | 325 | }; |
@@ -315,9 +331,12 @@ static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc); | |||
315 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc); | 331 | static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc); |
316 | static int ahci_port_start(struct ata_port *ap); | 332 | static int ahci_port_start(struct ata_port *ap); |
317 | static void ahci_port_stop(struct ata_port *ap); | 333 | static void ahci_port_stop(struct ata_port *ap); |
334 | static int ahci_pmp_qc_defer(struct ata_queued_cmd *qc); | ||
318 | static void ahci_qc_prep(struct ata_queued_cmd *qc); | 335 | static void ahci_qc_prep(struct ata_queued_cmd *qc); |
319 | static void ahci_freeze(struct ata_port *ap); | 336 | static void ahci_freeze(struct ata_port *ap); |
320 | static void ahci_thaw(struct ata_port *ap); | 337 | static void ahci_thaw(struct ata_port *ap); |
338 | static void ahci_enable_fbs(struct ata_port *ap); | ||
339 | static void ahci_disable_fbs(struct ata_port *ap); | ||
321 | static void ahci_pmp_attach(struct ata_port *ap); | 340 | static void ahci_pmp_attach(struct ata_port *ap); |
322 | static void ahci_pmp_detach(struct ata_port *ap); | 341 | static void ahci_pmp_detach(struct ata_port *ap); |
323 | static int ahci_softreset(struct ata_link *link, unsigned int *class, | 342 | static int ahci_softreset(struct ata_link *link, unsigned int *class, |
@@ -356,10 +375,10 @@ static ssize_t ahci_show_host_version(struct device *dev, | |||
356 | static ssize_t ahci_show_port_cmd(struct device *dev, | 375 | static ssize_t ahci_show_port_cmd(struct device *dev, |
357 | struct device_attribute *attr, char *buf); | 376 | struct device_attribute *attr, char *buf); |
358 | 377 | ||
359 | DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL); | 378 | static DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL); |
360 | DEVICE_ATTR(ahci_host_cap2, S_IRUGO, ahci_show_host_cap2, NULL); | 379 | static DEVICE_ATTR(ahci_host_cap2, S_IRUGO, ahci_show_host_cap2, NULL); |
361 | DEVICE_ATTR(ahci_host_version, S_IRUGO, ahci_show_host_version, NULL); | 380 | static DEVICE_ATTR(ahci_host_version, S_IRUGO, ahci_show_host_version, NULL); |
362 | DEVICE_ATTR(ahci_port_cmd, S_IRUGO, ahci_show_port_cmd, NULL); | 381 | static DEVICE_ATTR(ahci_port_cmd, S_IRUGO, ahci_show_port_cmd, NULL); |
363 | 382 | ||
364 | static struct device_attribute *ahci_shost_attrs[] = { | 383 | static struct device_attribute *ahci_shost_attrs[] = { |
365 | &dev_attr_link_power_management_policy, | 384 | &dev_attr_link_power_management_policy, |
@@ -390,7 +409,7 @@ static struct scsi_host_template ahci_sht = { | |||
390 | static struct ata_port_operations ahci_ops = { | 409 | static struct ata_port_operations ahci_ops = { |
391 | .inherits = &sata_pmp_port_ops, | 410 | .inherits = &sata_pmp_port_ops, |
392 | 411 | ||
393 | .qc_defer = sata_pmp_qc_defer_cmd_switch, | 412 | .qc_defer = ahci_pmp_qc_defer, |
394 | .qc_prep = ahci_qc_prep, | 413 | .qc_prep = ahci_qc_prep, |
395 | .qc_issue = ahci_qc_issue, | 414 | .qc_issue = ahci_qc_issue, |
396 | .qc_fill_rtf = ahci_qc_fill_rtf, | 415 | .qc_fill_rtf = ahci_qc_fill_rtf, |
@@ -570,6 +589,12 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
570 | { PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */ | 589 | { PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */ |
571 | { PCI_VDEVICE(INTEL, 0x3b2c), board_ahci }, /* PCH RAID */ | 590 | { PCI_VDEVICE(INTEL, 0x3b2c), board_ahci }, /* PCH RAID */ |
572 | { PCI_VDEVICE(INTEL, 0x3b2f), board_ahci }, /* PCH AHCI */ | 591 | { PCI_VDEVICE(INTEL, 0x3b2f), board_ahci }, /* PCH AHCI */ |
592 | { PCI_VDEVICE(INTEL, 0x1c02), board_ahci }, /* CPT AHCI */ | ||
593 | { PCI_VDEVICE(INTEL, 0x1c03), board_ahci }, /* CPT AHCI */ | ||
594 | { PCI_VDEVICE(INTEL, 0x1c04), board_ahci }, /* CPT RAID */ | ||
595 | { PCI_VDEVICE(INTEL, 0x1c05), board_ahci }, /* CPT RAID */ | ||
596 | { PCI_VDEVICE(INTEL, 0x1c06), board_ahci }, /* CPT RAID */ | ||
597 | { PCI_VDEVICE(INTEL, 0x1c07), board_ahci }, /* CPT RAID */ | ||
573 | 598 | ||
574 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ | 599 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
575 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 600 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
@@ -2045,6 +2070,17 @@ static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc, void *cmd_tbl) | |||
2045 | return si; | 2070 | return si; |
2046 | } | 2071 | } |
2047 | 2072 | ||
2073 | static int ahci_pmp_qc_defer(struct ata_queued_cmd *qc) | ||
2074 | { | ||
2075 | struct ata_port *ap = qc->ap; | ||
2076 | struct ahci_port_priv *pp = ap->private_data; | ||
2077 | |||
2078 | if (!sata_pmp_attached(ap) || pp->fbs_enabled) | ||
2079 | return ata_std_qc_defer(qc); | ||
2080 | else | ||
2081 | return sata_pmp_qc_defer_cmd_switch(qc); | ||
2082 | } | ||
2083 | |||
2048 | static void ahci_qc_prep(struct ata_queued_cmd *qc) | 2084 | static void ahci_qc_prep(struct ata_queued_cmd *qc) |
2049 | { | 2085 | { |
2050 | struct ata_port *ap = qc->ap; | 2086 | struct ata_port *ap = qc->ap; |
@@ -2083,6 +2119,31 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc) | |||
2083 | ahci_fill_cmd_slot(pp, qc->tag, opts); | 2119 | ahci_fill_cmd_slot(pp, qc->tag, opts); |
2084 | } | 2120 | } |
2085 | 2121 | ||
2122 | static void ahci_fbs_dec_intr(struct ata_port *ap) | ||
2123 | { | ||
2124 | struct ahci_port_priv *pp = ap->private_data; | ||
2125 | void __iomem *port_mmio = ahci_port_base(ap); | ||
2126 | u32 fbs = readl(port_mmio + PORT_FBS); | ||
2127 | int retries = 3; | ||
2128 | |||
2129 | DPRINTK("ENTER\n"); | ||
2130 | BUG_ON(!pp->fbs_enabled); | ||
2131 | |||
2132 | /* time to wait for DEC is not specified by AHCI spec, | ||
2133 | * add a retry loop for safety. | ||
2134 | */ | ||
2135 | writel(fbs | PORT_FBS_DEC, port_mmio + PORT_FBS); | ||
2136 | fbs = readl(port_mmio + PORT_FBS); | ||
2137 | while ((fbs & PORT_FBS_DEC) && retries--) { | ||
2138 | udelay(1); | ||
2139 | fbs = readl(port_mmio + PORT_FBS); | ||
2140 | } | ||
2141 | |||
2142 | if (fbs & PORT_FBS_DEC) | ||
2143 | dev_printk(KERN_ERR, ap->host->dev, | ||
2144 | "failed to clear device error\n"); | ||
2145 | } | ||
2146 | |||
2086 | static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) | 2147 | static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) |
2087 | { | 2148 | { |
2088 | struct ahci_host_priv *hpriv = ap->host->private_data; | 2149 | struct ahci_host_priv *hpriv = ap->host->private_data; |
@@ -2091,12 +2152,26 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) | |||
2091 | struct ata_link *link = NULL; | 2152 | struct ata_link *link = NULL; |
2092 | struct ata_queued_cmd *active_qc; | 2153 | struct ata_queued_cmd *active_qc; |
2093 | struct ata_eh_info *active_ehi; | 2154 | struct ata_eh_info *active_ehi; |
2155 | bool fbs_need_dec = false; | ||
2094 | u32 serror; | 2156 | u32 serror; |
2095 | 2157 | ||
2096 | /* determine active link */ | 2158 | /* determine active link with error */ |
2097 | ata_for_each_link(link, ap, EDGE) | 2159 | if (pp->fbs_enabled) { |
2098 | if (ata_link_active(link)) | 2160 | void __iomem *port_mmio = ahci_port_base(ap); |
2099 | break; | 2161 | u32 fbs = readl(port_mmio + PORT_FBS); |
2162 | int pmp = fbs >> PORT_FBS_DWE_OFFSET; | ||
2163 | |||
2164 | if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links) && | ||
2165 | ata_link_online(&ap->pmp_link[pmp])) { | ||
2166 | link = &ap->pmp_link[pmp]; | ||
2167 | fbs_need_dec = true; | ||
2168 | } | ||
2169 | |||
2170 | } else | ||
2171 | ata_for_each_link(link, ap, EDGE) | ||
2172 | if (ata_link_active(link)) | ||
2173 | break; | ||
2174 | |||
2100 | if (!link) | 2175 | if (!link) |
2101 | link = &ap->link; | 2176 | link = &ap->link; |
2102 | 2177 | ||
@@ -2153,8 +2228,13 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) | |||
2153 | } | 2228 | } |
2154 | 2229 | ||
2155 | if (irq_stat & PORT_IRQ_IF_ERR) { | 2230 | if (irq_stat & PORT_IRQ_IF_ERR) { |
2156 | host_ehi->err_mask |= AC_ERR_ATA_BUS; | 2231 | if (fbs_need_dec) |
2157 | host_ehi->action |= ATA_EH_RESET; | 2232 | active_ehi->err_mask |= AC_ERR_DEV; |
2233 | else { | ||
2234 | host_ehi->err_mask |= AC_ERR_ATA_BUS; | ||
2235 | host_ehi->action |= ATA_EH_RESET; | ||
2236 | } | ||
2237 | |||
2158 | ata_ehi_push_desc(host_ehi, "interface fatal error"); | 2238 | ata_ehi_push_desc(host_ehi, "interface fatal error"); |
2159 | } | 2239 | } |
2160 | 2240 | ||
@@ -2169,7 +2249,10 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) | |||
2169 | 2249 | ||
2170 | if (irq_stat & PORT_IRQ_FREEZE) | 2250 | if (irq_stat & PORT_IRQ_FREEZE) |
2171 | ata_port_freeze(ap); | 2251 | ata_port_freeze(ap); |
2172 | else | 2252 | else if (fbs_need_dec) { |
2253 | ata_link_abort(link); | ||
2254 | ahci_fbs_dec_intr(ap); | ||
2255 | } else | ||
2173 | ata_port_abort(ap); | 2256 | ata_port_abort(ap); |
2174 | } | 2257 | } |
2175 | 2258 | ||
@@ -2222,12 +2305,19 @@ static void ahci_port_intr(struct ata_port *ap) | |||
2222 | /* If the 'N' bit in word 0 of the FIS is set, | 2305 | /* If the 'N' bit in word 0 of the FIS is set, |
2223 | * we just received asynchronous notification. | 2306 | * we just received asynchronous notification. |
2224 | * Tell libata about it. | 2307 | * Tell libata about it. |
2308 | * | ||
2309 | * Lack of SNotification should not appear in | ||
2310 | * ahci 1.2, so the workaround is unnecessary | ||
2311 | * when FBS is enabled. | ||
2225 | */ | 2312 | */ |
2226 | const __le32 *f = pp->rx_fis + RX_FIS_SDB; | 2313 | if (pp->fbs_enabled) |
2227 | u32 f0 = le32_to_cpu(f[0]); | 2314 | WARN_ON_ONCE(1); |
2228 | 2315 | else { | |
2229 | if (f0 & (1 << 15)) | 2316 | const __le32 *f = pp->rx_fis + RX_FIS_SDB; |
2230 | sata_async_notification(ap); | 2317 | u32 f0 = le32_to_cpu(f[0]); |
2318 | if (f0 & (1 << 15)) | ||
2319 | sata_async_notification(ap); | ||
2320 | } | ||
2231 | } | 2321 | } |
2232 | } | 2322 | } |
2233 | 2323 | ||
@@ -2321,6 +2411,15 @@ static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) | |||
2321 | 2411 | ||
2322 | if (qc->tf.protocol == ATA_PROT_NCQ) | 2412 | if (qc->tf.protocol == ATA_PROT_NCQ) |
2323 | writel(1 << qc->tag, port_mmio + PORT_SCR_ACT); | 2413 | writel(1 << qc->tag, port_mmio + PORT_SCR_ACT); |
2414 | |||
2415 | if (pp->fbs_enabled && pp->fbs_last_dev != qc->dev->link->pmp) { | ||
2416 | u32 fbs = readl(port_mmio + PORT_FBS); | ||
2417 | fbs &= ~(PORT_FBS_DEV_MASK | PORT_FBS_DEC); | ||
2418 | fbs |= qc->dev->link->pmp << PORT_FBS_DEV_OFFSET; | ||
2419 | writel(fbs, port_mmio + PORT_FBS); | ||
2420 | pp->fbs_last_dev = qc->dev->link->pmp; | ||
2421 | } | ||
2422 | |||
2324 | writel(1 << qc->tag, port_mmio + PORT_CMD_ISSUE); | 2423 | writel(1 << qc->tag, port_mmio + PORT_CMD_ISSUE); |
2325 | 2424 | ||
2326 | ahci_sw_activity(qc->dev->link); | 2425 | ahci_sw_activity(qc->dev->link); |
@@ -2333,6 +2432,9 @@ static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc) | |||
2333 | struct ahci_port_priv *pp = qc->ap->private_data; | 2432 | struct ahci_port_priv *pp = qc->ap->private_data; |
2334 | u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; | 2433 | u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; |
2335 | 2434 | ||
2435 | if (pp->fbs_enabled) | ||
2436 | d2h_fis += qc->dev->link->pmp * AHCI_RX_FIS_SZ; | ||
2437 | |||
2336 | ata_tf_from_fis(d2h_fis, &qc->result_tf); | 2438 | ata_tf_from_fis(d2h_fis, &qc->result_tf); |
2337 | return true; | 2439 | return true; |
2338 | } | 2440 | } |
@@ -2381,6 +2483,71 @@ static void ahci_post_internal_cmd(struct ata_queued_cmd *qc) | |||
2381 | ahci_kick_engine(ap); | 2483 | ahci_kick_engine(ap); |
2382 | } | 2484 | } |
2383 | 2485 | ||
2486 | static void ahci_enable_fbs(struct ata_port *ap) | ||
2487 | { | ||
2488 | struct ahci_port_priv *pp = ap->private_data; | ||
2489 | void __iomem *port_mmio = ahci_port_base(ap); | ||
2490 | u32 fbs; | ||
2491 | int rc; | ||
2492 | |||
2493 | if (!pp->fbs_supported) | ||
2494 | return; | ||
2495 | |||
2496 | fbs = readl(port_mmio + PORT_FBS); | ||
2497 | if (fbs & PORT_FBS_EN) { | ||
2498 | pp->fbs_enabled = true; | ||
2499 | pp->fbs_last_dev = -1; /* initialization */ | ||
2500 | return; | ||
2501 | } | ||
2502 | |||
2503 | rc = ahci_stop_engine(ap); | ||
2504 | if (rc) | ||
2505 | return; | ||
2506 | |||
2507 | writel(fbs | PORT_FBS_EN, port_mmio + PORT_FBS); | ||
2508 | fbs = readl(port_mmio + PORT_FBS); | ||
2509 | if (fbs & PORT_FBS_EN) { | ||
2510 | dev_printk(KERN_INFO, ap->host->dev, "FBS is enabled.\n"); | ||
2511 | pp->fbs_enabled = true; | ||
2512 | pp->fbs_last_dev = -1; /* initialization */ | ||
2513 | } else | ||
2514 | dev_printk(KERN_ERR, ap->host->dev, "Failed to enable FBS\n"); | ||
2515 | |||
2516 | ahci_start_engine(ap); | ||
2517 | } | ||
2518 | |||
2519 | static void ahci_disable_fbs(struct ata_port *ap) | ||
2520 | { | ||
2521 | struct ahci_port_priv *pp = ap->private_data; | ||
2522 | void __iomem *port_mmio = ahci_port_base(ap); | ||
2523 | u32 fbs; | ||
2524 | int rc; | ||
2525 | |||
2526 | if (!pp->fbs_supported) | ||
2527 | return; | ||
2528 | |||
2529 | fbs = readl(port_mmio + PORT_FBS); | ||
2530 | if ((fbs & PORT_FBS_EN) == 0) { | ||
2531 | pp->fbs_enabled = false; | ||
2532 | return; | ||
2533 | } | ||
2534 | |||
2535 | rc = ahci_stop_engine(ap); | ||
2536 | if (rc) | ||
2537 | return; | ||
2538 | |||
2539 | writel(fbs & ~PORT_FBS_EN, port_mmio + PORT_FBS); | ||
2540 | fbs = readl(port_mmio + PORT_FBS); | ||
2541 | if (fbs & PORT_FBS_EN) | ||
2542 | dev_printk(KERN_ERR, ap->host->dev, "Failed to disable FBS\n"); | ||
2543 | else { | ||
2544 | dev_printk(KERN_INFO, ap->host->dev, "FBS is disabled.\n"); | ||
2545 | pp->fbs_enabled = false; | ||
2546 | } | ||
2547 | |||
2548 | ahci_start_engine(ap); | ||
2549 | } | ||
2550 | |||
2384 | static void ahci_pmp_attach(struct ata_port *ap) | 2551 | static void ahci_pmp_attach(struct ata_port *ap) |
2385 | { | 2552 | { |
2386 | void __iomem *port_mmio = ahci_port_base(ap); | 2553 | void __iomem *port_mmio = ahci_port_base(ap); |
@@ -2391,6 +2558,8 @@ static void ahci_pmp_attach(struct ata_port *ap) | |||
2391 | cmd |= PORT_CMD_PMP; | 2558 | cmd |= PORT_CMD_PMP; |
2392 | writel(cmd, port_mmio + PORT_CMD); | 2559 | writel(cmd, port_mmio + PORT_CMD); |
2393 | 2560 | ||
2561 | ahci_enable_fbs(ap); | ||
2562 | |||
2394 | pp->intr_mask |= PORT_IRQ_BAD_PMP; | 2563 | pp->intr_mask |= PORT_IRQ_BAD_PMP; |
2395 | writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); | 2564 | writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK); |
2396 | } | 2565 | } |
@@ -2401,6 +2570,8 @@ static void ahci_pmp_detach(struct ata_port *ap) | |||
2401 | struct ahci_port_priv *pp = ap->private_data; | 2570 | struct ahci_port_priv *pp = ap->private_data; |
2402 | u32 cmd; | 2571 | u32 cmd; |
2403 | 2572 | ||
2573 | ahci_disable_fbs(ap); | ||
2574 | |||
2404 | cmd = readl(port_mmio + PORT_CMD); | 2575 | cmd = readl(port_mmio + PORT_CMD); |
2405 | cmd &= ~PORT_CMD_PMP; | 2576 | cmd &= ~PORT_CMD_PMP; |
2406 | writel(cmd, port_mmio + PORT_CMD); | 2577 | writel(cmd, port_mmio + PORT_CMD); |
@@ -2492,20 +2663,40 @@ static int ahci_pci_device_resume(struct pci_dev *pdev) | |||
2492 | 2663 | ||
2493 | static int ahci_port_start(struct ata_port *ap) | 2664 | static int ahci_port_start(struct ata_port *ap) |
2494 | { | 2665 | { |
2666 | struct ahci_host_priv *hpriv = ap->host->private_data; | ||
2495 | struct device *dev = ap->host->dev; | 2667 | struct device *dev = ap->host->dev; |
2496 | struct ahci_port_priv *pp; | 2668 | struct ahci_port_priv *pp; |
2497 | void *mem; | 2669 | void *mem; |
2498 | dma_addr_t mem_dma; | 2670 | dma_addr_t mem_dma; |
2671 | size_t dma_sz, rx_fis_sz; | ||
2499 | 2672 | ||
2500 | pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); | 2673 | pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL); |
2501 | if (!pp) | 2674 | if (!pp) |
2502 | return -ENOMEM; | 2675 | return -ENOMEM; |
2503 | 2676 | ||
2504 | mem = dmam_alloc_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, &mem_dma, | 2677 | /* check FBS capability */ |
2505 | GFP_KERNEL); | 2678 | if ((hpriv->cap & HOST_CAP_FBS) && sata_pmp_supported(ap)) { |
2679 | void __iomem *port_mmio = ahci_port_base(ap); | ||
2680 | u32 cmd = readl(port_mmio + PORT_CMD); | ||
2681 | if (cmd & PORT_CMD_FBSCP) | ||
2682 | pp->fbs_supported = true; | ||
2683 | else | ||
2684 | dev_printk(KERN_WARNING, dev, | ||
2685 | "The port is not capable of FBS\n"); | ||
2686 | } | ||
2687 | |||
2688 | if (pp->fbs_supported) { | ||
2689 | dma_sz = AHCI_PORT_PRIV_FBS_DMA_SZ; | ||
2690 | rx_fis_sz = AHCI_RX_FIS_SZ * 16; | ||
2691 | } else { | ||
2692 | dma_sz = AHCI_PORT_PRIV_DMA_SZ; | ||
2693 | rx_fis_sz = AHCI_RX_FIS_SZ; | ||
2694 | } | ||
2695 | |||
2696 | mem = dmam_alloc_coherent(dev, dma_sz, &mem_dma, GFP_KERNEL); | ||
2506 | if (!mem) | 2697 | if (!mem) |
2507 | return -ENOMEM; | 2698 | return -ENOMEM; |
2508 | memset(mem, 0, AHCI_PORT_PRIV_DMA_SZ); | 2699 | memset(mem, 0, dma_sz); |
2509 | 2700 | ||
2510 | /* | 2701 | /* |
2511 | * First item in chunk of DMA memory: 32-slot command table, | 2702 | * First item in chunk of DMA memory: 32-slot command table, |
@@ -2523,8 +2714,8 @@ static int ahci_port_start(struct ata_port *ap) | |||
2523 | pp->rx_fis = mem; | 2714 | pp->rx_fis = mem; |
2524 | pp->rx_fis_dma = mem_dma; | 2715 | pp->rx_fis_dma = mem_dma; |
2525 | 2716 | ||
2526 | mem += AHCI_RX_FIS_SZ; | 2717 | mem += rx_fis_sz; |
2527 | mem_dma += AHCI_RX_FIS_SZ; | 2718 | mem_dma += rx_fis_sz; |
2528 | 2719 | ||
2529 | /* | 2720 | /* |
2530 | * Third item: data area for storing a single command | 2721 | * Third item: data area for storing a single command |
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c index 12e26c3c68e3..33fb614f9784 100644 --- a/drivers/ata/ata_generic.c +++ b/drivers/ata/ata_generic.c | |||
@@ -155,7 +155,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id | |||
155 | return rc; | 155 | return rc; |
156 | pcim_pin_device(dev); | 156 | pcim_pin_device(dev); |
157 | } | 157 | } |
158 | return ata_pci_sff_init_one(dev, ppi, &generic_sht, NULL); | 158 | return ata_pci_sff_init_one(dev, ppi, &generic_sht, NULL, 0); |
159 | } | 159 | } |
160 | 160 | ||
161 | static struct pci_device_id ata_generic[] = { | 161 | static struct pci_device_id ata_generic[] = { |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 6f3f2257d0f0..c33806654e46 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -173,6 +173,7 @@ static int piix_sidpr_scr_read(struct ata_link *link, | |||
173 | unsigned int reg, u32 *val); | 173 | unsigned int reg, u32 *val); |
174 | static int piix_sidpr_scr_write(struct ata_link *link, | 174 | static int piix_sidpr_scr_write(struct ata_link *link, |
175 | unsigned int reg, u32 val); | 175 | unsigned int reg, u32 val); |
176 | static bool piix_irq_check(struct ata_port *ap); | ||
176 | #ifdef CONFIG_PM | 177 | #ifdef CONFIG_PM |
177 | static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); | 178 | static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); |
178 | static int piix_pci_device_resume(struct pci_dev *pdev); | 179 | static int piix_pci_device_resume(struct pci_dev *pdev); |
@@ -291,6 +292,14 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
291 | { 0x8086, 0x3b2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 292 | { 0x8086, 0x3b2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
292 | /* SATA Controller IDE (PCH) */ | 293 | /* SATA Controller IDE (PCH) */ |
293 | { 0x8086, 0x3b2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | 294 | { 0x8086, 0x3b2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, |
295 | /* SATA Controller IDE (CPT) */ | ||
296 | { 0x8086, 0x1c00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | ||
297 | /* SATA Controller IDE (CPT) */ | ||
298 | { 0x8086, 0x1c01, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, | ||
299 | /* SATA Controller IDE (CPT) */ | ||
300 | { 0x8086, 0x1c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | ||
301 | /* SATA Controller IDE (CPT) */ | ||
302 | { 0x8086, 0x1c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | ||
294 | { } /* terminate list */ | 303 | { } /* terminate list */ |
295 | }; | 304 | }; |
296 | 305 | ||
@@ -309,8 +318,13 @@ static struct scsi_host_template piix_sht = { | |||
309 | ATA_BMDMA_SHT(DRV_NAME), | 318 | ATA_BMDMA_SHT(DRV_NAME), |
310 | }; | 319 | }; |
311 | 320 | ||
312 | static struct ata_port_operations piix_pata_ops = { | 321 | static struct ata_port_operations piix_sata_ops = { |
313 | .inherits = &ata_bmdma32_port_ops, | 322 | .inherits = &ata_bmdma32_port_ops, |
323 | .sff_irq_check = piix_irq_check, | ||
324 | }; | ||
325 | |||
326 | static struct ata_port_operations piix_pata_ops = { | ||
327 | .inherits = &piix_sata_ops, | ||
314 | .cable_detect = ata_cable_40wire, | 328 | .cable_detect = ata_cable_40wire, |
315 | .set_piomode = piix_set_piomode, | 329 | .set_piomode = piix_set_piomode, |
316 | .set_dmamode = piix_set_dmamode, | 330 | .set_dmamode = piix_set_dmamode, |
@@ -328,10 +342,6 @@ static struct ata_port_operations ich_pata_ops = { | |||
328 | .set_dmamode = ich_set_dmamode, | 342 | .set_dmamode = ich_set_dmamode, |
329 | }; | 343 | }; |
330 | 344 | ||
331 | static struct ata_port_operations piix_sata_ops = { | ||
332 | .inherits = &ata_bmdma32_port_ops, | ||
333 | }; | ||
334 | |||
335 | static struct ata_port_operations piix_sidpr_sata_ops = { | 345 | static struct ata_port_operations piix_sidpr_sata_ops = { |
336 | .inherits = &piix_sata_ops, | 346 | .inherits = &piix_sata_ops, |
337 | .hardreset = sata_std_hardreset, | 347 | .hardreset = sata_std_hardreset, |
@@ -962,6 +972,14 @@ static int piix_sidpr_scr_write(struct ata_link *link, | |||
962 | return 0; | 972 | return 0; |
963 | } | 973 | } |
964 | 974 | ||
975 | static bool piix_irq_check(struct ata_port *ap) | ||
976 | { | ||
977 | if (unlikely(!ap->ioaddr.bmdma_addr)) | ||
978 | return false; | ||
979 | |||
980 | return ap->ops->bmdma_status(ap) & ATA_DMA_INTR; | ||
981 | } | ||
982 | |||
965 | #ifdef CONFIG_PM | 983 | #ifdef CONFIG_PM |
966 | static int piix_broken_suspend(void) | 984 | static int piix_broken_suspend(void) |
967 | { | 985 | { |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index 1245838ac13d..292fdbc0431a 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -64,7 +64,7 @@ void ata_acpi_associate_sata_port(struct ata_port *ap) | |||
64 | WARN_ON(!(ap->flags & ATA_FLAG_ACPI_SATA)); | 64 | WARN_ON(!(ap->flags & ATA_FLAG_ACPI_SATA)); |
65 | 65 | ||
66 | if (!sata_pmp_attached(ap)) { | 66 | if (!sata_pmp_attached(ap)) { |
67 | acpi_integer adr = SATA_ADR(ap->port_no, NO_PORT_MULT); | 67 | u64 adr = SATA_ADR(ap->port_no, NO_PORT_MULT); |
68 | 68 | ||
69 | ap->link.device->acpi_handle = | 69 | ap->link.device->acpi_handle = |
70 | acpi_get_child(ap->host->acpi_handle, adr); | 70 | acpi_get_child(ap->host->acpi_handle, adr); |
@@ -74,7 +74,7 @@ void ata_acpi_associate_sata_port(struct ata_port *ap) | |||
74 | ap->link.device->acpi_handle = NULL; | 74 | ap->link.device->acpi_handle = NULL; |
75 | 75 | ||
76 | ata_for_each_link(link, ap, EDGE) { | 76 | ata_for_each_link(link, ap, EDGE) { |
77 | acpi_integer adr = SATA_ADR(ap->port_no, link->pmp); | 77 | u64 adr = SATA_ADR(ap->port_no, link->pmp); |
78 | 78 | ||
79 | link->device->acpi_handle = | 79 | link->device->acpi_handle = |
80 | acpi_get_child(ap->host->acpi_handle, adr); | 80 | acpi_get_child(ap->host->acpi_handle, adr); |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 6728328f3bea..9c77b0d1a9d0 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -3211,6 +3211,7 @@ const struct ata_timing *ata_timing_find_mode(u8 xfer_mode) | |||
3211 | int ata_timing_compute(struct ata_device *adev, unsigned short speed, | 3211 | int ata_timing_compute(struct ata_device *adev, unsigned short speed, |
3212 | struct ata_timing *t, int T, int UT) | 3212 | struct ata_timing *t, int T, int UT) |
3213 | { | 3213 | { |
3214 | const u16 *id = adev->id; | ||
3214 | const struct ata_timing *s; | 3215 | const struct ata_timing *s; |
3215 | struct ata_timing p; | 3216 | struct ata_timing p; |
3216 | 3217 | ||
@@ -3228,14 +3229,18 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed, | |||
3228 | * PIO/MW_DMA cycle timing. | 3229 | * PIO/MW_DMA cycle timing. |
3229 | */ | 3230 | */ |
3230 | 3231 | ||
3231 | if (adev->id[ATA_ID_FIELD_VALID] & 2) { /* EIDE drive */ | 3232 | if (id[ATA_ID_FIELD_VALID] & 2) { /* EIDE drive */ |
3232 | memset(&p, 0, sizeof(p)); | 3233 | memset(&p, 0, sizeof(p)); |
3234 | |||
3233 | if (speed >= XFER_PIO_0 && speed <= XFER_SW_DMA_0) { | 3235 | if (speed >= XFER_PIO_0 && speed <= XFER_SW_DMA_0) { |
3234 | if (speed <= XFER_PIO_2) p.cycle = p.cyc8b = adev->id[ATA_ID_EIDE_PIO]; | 3236 | if (speed <= XFER_PIO_2) |
3235 | else p.cycle = p.cyc8b = adev->id[ATA_ID_EIDE_PIO_IORDY]; | 3237 | p.cycle = p.cyc8b = id[ATA_ID_EIDE_PIO]; |
3236 | } else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2) { | 3238 | else if ((speed <= XFER_PIO_4) || |
3237 | p.cycle = adev->id[ATA_ID_EIDE_DMA_MIN]; | 3239 | (speed == XFER_PIO_5 && !ata_id_is_cfa(id))) |
3238 | } | 3240 | p.cycle = p.cyc8b = id[ATA_ID_EIDE_PIO_IORDY]; |
3241 | } else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2) | ||
3242 | p.cycle = id[ATA_ID_EIDE_DMA_MIN]; | ||
3243 | |||
3239 | ata_timing_merge(&p, t, t, ATA_TIMING_CYCLE | ATA_TIMING_CYC8B); | 3244 | ata_timing_merge(&p, t, t, ATA_TIMING_CYCLE | ATA_TIMING_CYC8B); |
3240 | } | 3245 | } |
3241 | 3246 | ||
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index d096fbcbc771..bea003a24d27 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -1097,7 +1097,7 @@ static int ata_scsi_dev_config(struct scsi_device *sdev, | |||
1097 | dev->flags |= ATA_DFLAG_NO_UNLOAD; | 1097 | dev->flags |= ATA_DFLAG_NO_UNLOAD; |
1098 | 1098 | ||
1099 | /* configure max sectors */ | 1099 | /* configure max sectors */ |
1100 | blk_queue_max_sectors(sdev->request_queue, dev->max_sectors); | 1100 | blk_queue_max_hw_sectors(sdev->request_queue, dev->max_sectors); |
1101 | 1101 | ||
1102 | if (dev->class == ATA_DEV_ATAPI) { | 1102 | if (dev->class == ATA_DEV_ATAPI) { |
1103 | struct request_queue *q = sdev->request_queue; | 1103 | struct request_queue *q = sdev->request_queue; |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 730ef3c384ca..02441fd57e9e 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -1763,24 +1763,50 @@ irqreturn_t ata_sff_interrupt(int irq, void *dev_instance) | |||
1763 | { | 1763 | { |
1764 | struct ata_host *host = dev_instance; | 1764 | struct ata_host *host = dev_instance; |
1765 | unsigned int i; | 1765 | unsigned int i; |
1766 | unsigned int handled = 0; | 1766 | unsigned int handled = 0, polling = 0; |
1767 | unsigned long flags; | 1767 | unsigned long flags; |
1768 | 1768 | ||
1769 | /* TODO: make _irqsave conditional on x86 PCI IDE legacy mode */ | 1769 | /* TODO: make _irqsave conditional on x86 PCI IDE legacy mode */ |
1770 | spin_lock_irqsave(&host->lock, flags); | 1770 | spin_lock_irqsave(&host->lock, flags); |
1771 | 1771 | ||
1772 | for (i = 0; i < host->n_ports; i++) { | 1772 | for (i = 0; i < host->n_ports; i++) { |
1773 | struct ata_port *ap; | 1773 | struct ata_port *ap = host->ports[i]; |
1774 | struct ata_queued_cmd *qc; | ||
1774 | 1775 | ||
1775 | ap = host->ports[i]; | 1776 | if (unlikely(ap->flags & ATA_FLAG_DISABLED)) |
1776 | if (ap && | 1777 | continue; |
1777 | !(ap->flags & ATA_FLAG_DISABLED)) { | ||
1778 | struct ata_queued_cmd *qc; | ||
1779 | 1778 | ||
1780 | qc = ata_qc_from_tag(ap, ap->link.active_tag); | 1779 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
1781 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) && | 1780 | if (qc) { |
1782 | (qc->flags & ATA_QCFLAG_ACTIVE)) | 1781 | if (!(qc->tf.flags & ATA_TFLAG_POLLING)) |
1783 | handled |= ata_sff_host_intr(ap, qc); | 1782 | handled |= ata_sff_host_intr(ap, qc); |
1783 | else | ||
1784 | polling |= 1 << i; | ||
1785 | } | ||
1786 | } | ||
1787 | |||
1788 | /* | ||
1789 | * If no port was expecting IRQ but the controller is actually | ||
1790 | * asserting IRQ line, nobody cared will ensue. Check IRQ | ||
1791 | * pending status if available and clear spurious IRQ. | ||
1792 | */ | ||
1793 | if (!handled) { | ||
1794 | for (i = 0; i < host->n_ports; i++) { | ||
1795 | struct ata_port *ap = host->ports[i]; | ||
1796 | |||
1797 | if (polling & (1 << i)) | ||
1798 | continue; | ||
1799 | |||
1800 | if (!ap->ops->sff_irq_check || | ||
1801 | !ap->ops->sff_irq_check(ap)) | ||
1802 | continue; | ||
1803 | |||
1804 | if (printk_ratelimit()) | ||
1805 | ata_port_printk(ap, KERN_INFO, | ||
1806 | "clearing spurious IRQ\n"); | ||
1807 | |||
1808 | ap->ops->sff_check_status(ap); | ||
1809 | ap->ops->sff_irq_clear(ap); | ||
1784 | } | 1810 | } |
1785 | } | 1811 | } |
1786 | 1812 | ||
@@ -3011,6 +3037,7 @@ EXPORT_SYMBOL_GPL(ata_pci_sff_activate_host); | |||
3011 | * @ppi: array of port_info, must be enough for two ports | 3037 | * @ppi: array of port_info, must be enough for two ports |
3012 | * @sht: scsi_host_template to use when registering the host | 3038 | * @sht: scsi_host_template to use when registering the host |
3013 | * @host_priv: host private_data | 3039 | * @host_priv: host private_data |
3040 | * @hflag: host flags | ||
3014 | * | 3041 | * |
3015 | * This is a helper function which can be called from a driver's | 3042 | * This is a helper function which can be called from a driver's |
3016 | * xxx_init_one() probe function if the hardware uses traditional | 3043 | * xxx_init_one() probe function if the hardware uses traditional |
@@ -3031,8 +3058,8 @@ EXPORT_SYMBOL_GPL(ata_pci_sff_activate_host); | |||
3031 | * Zero on success, negative on errno-based value on error. | 3058 | * Zero on success, negative on errno-based value on error. |
3032 | */ | 3059 | */ |
3033 | int ata_pci_sff_init_one(struct pci_dev *pdev, | 3060 | int ata_pci_sff_init_one(struct pci_dev *pdev, |
3034 | const struct ata_port_info * const *ppi, | 3061 | const struct ata_port_info * const *ppi, |
3035 | struct scsi_host_template *sht, void *host_priv) | 3062 | struct scsi_host_template *sht, void *host_priv, int hflag) |
3036 | { | 3063 | { |
3037 | struct device *dev = &pdev->dev; | 3064 | struct device *dev = &pdev->dev; |
3038 | const struct ata_port_info *pi = NULL; | 3065 | const struct ata_port_info *pi = NULL; |
@@ -3067,6 +3094,7 @@ int ata_pci_sff_init_one(struct pci_dev *pdev, | |||
3067 | if (rc) | 3094 | if (rc) |
3068 | goto out; | 3095 | goto out; |
3069 | host->private_data = host_priv; | 3096 | host->private_data = host_priv; |
3097 | host->flags |= hflag; | ||
3070 | 3098 | ||
3071 | pci_set_master(pdev); | 3099 | pci_set_master(pdev); |
3072 | rc = ata_pci_sff_activate_host(host, ata_sff_interrupt, sht); | 3100 | rc = ata_pci_sff_activate_host(host, ata_sff_interrupt, sht); |
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c index d8f35fe44421..294f3020a78a 100644 --- a/drivers/ata/pata_acpi.c +++ b/drivers/ata/pata_acpi.c | |||
@@ -259,7 +259,7 @@ static int pacpi_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
259 | return rc; | 259 | return rc; |
260 | pcim_pin_device(pdev); | 260 | pcim_pin_device(pdev); |
261 | } | 261 | } |
262 | return ata_pci_sff_init_one(pdev, ppi, &pacpi_sht, NULL); | 262 | return ata_pci_sff_init_one(pdev, ppi, &pacpi_sht, NULL, 0); |
263 | } | 263 | } |
264 | 264 | ||
265 | static const struct pci_device_id pacpi_pci_tbl[] = { | 265 | static const struct pci_device_id pacpi_pci_tbl[] = { |
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index 9434114b2ca8..dc61b72f751c 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c | |||
@@ -159,8 +159,7 @@ static void ali_fifo_control(struct ata_port *ap, struct ata_device *adev, int o | |||
159 | * ali_program_modes - load mode registers | 159 | * ali_program_modes - load mode registers |
160 | * @ap: ALi channel to load | 160 | * @ap: ALi channel to load |
161 | * @adev: Device the timing is for | 161 | * @adev: Device the timing is for |
162 | * @cmd: Command timing | 162 | * @t: timing data |
163 | * @data: Data timing | ||
164 | * @ultra: UDMA timing or zero for off | 163 | * @ultra: UDMA timing or zero for off |
165 | * | 164 | * |
166 | * Loads the timing registers for cmd/data and disable UDMA if | 165 | * Loads the timing registers for cmd/data and disable UDMA if |
@@ -202,8 +201,7 @@ static void ali_program_modes(struct ata_port *ap, struct ata_device *adev, stru | |||
202 | * @ap: ATA interface | 201 | * @ap: ATA interface |
203 | * @adev: ATA device | 202 | * @adev: ATA device |
204 | * | 203 | * |
205 | * Program the ALi registers for PIO mode. FIXME: add timings for | 204 | * Program the ALi registers for PIO mode. |
206 | * PIO5. | ||
207 | */ | 205 | */ |
208 | 206 | ||
209 | static void ali_set_piomode(struct ata_port *ap, struct ata_device *adev) | 207 | static void ali_set_piomode(struct ata_port *ap, struct ata_device *adev) |
@@ -237,7 +235,7 @@ static void ali_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
237 | * @ap: ATA interface | 235 | * @ap: ATA interface |
238 | * @adev: ATA device | 236 | * @adev: ATA device |
239 | * | 237 | * |
240 | * FIXME: MWDMA timings | 238 | * Program the ALi registers for DMA mode. |
241 | */ | 239 | */ |
242 | 240 | ||
243 | static void ali_set_dmamode(struct ata_port *ap, struct ata_device *adev) | 241 | static void ali_set_dmamode(struct ata_port *ap, struct ata_device *adev) |
@@ -585,7 +583,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
585 | ppi[0] = &info_20_udma; | 583 | ppi[0] = &info_20_udma; |
586 | } | 584 | } |
587 | 585 | ||
588 | return ata_pci_sff_init_one(pdev, ppi, &ali_sht, NULL); | 586 | return ata_pci_sff_init_one(pdev, ppi, &ali_sht, NULL, 0); |
589 | } | 587 | } |
590 | 588 | ||
591 | #ifdef CONFIG_PM | 589 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c index 567f3f72774e..d95eca9c547e 100644 --- a/drivers/ata/pata_amd.c +++ b/drivers/ata/pata_amd.c | |||
@@ -574,7 +574,7 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
574 | } | 574 | } |
575 | 575 | ||
576 | /* And fire it up */ | 576 | /* And fire it up */ |
577 | return ata_pci_sff_init_one(pdev, ppi, &amd_sht, hpriv); | 577 | return ata_pci_sff_init_one(pdev, ppi, &amd_sht, hpriv, 0); |
578 | } | 578 | } |
579 | 579 | ||
580 | #ifdef CONFIG_PM | 580 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c index d332cfdb0f30..4d066d6c30fa 100644 --- a/drivers/ata/pata_artop.c +++ b/drivers/ata/pata_artop.c | |||
@@ -421,7 +421,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
421 | 421 | ||
422 | BUG_ON(ppi[0] == NULL); | 422 | BUG_ON(ppi[0] == NULL); |
423 | 423 | ||
424 | return ata_pci_sff_init_one(pdev, ppi, &artop_sht, NULL); | 424 | return ata_pci_sff_init_one(pdev, ppi, &artop_sht, NULL, 0); |
425 | } | 425 | } |
426 | 426 | ||
427 | static const struct pci_device_id artop_pci_tbl[] = { | 427 | static const struct pci_device_id artop_pci_tbl[] = { |
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c index 41c94b1ae493..376dd380b43c 100644 --- a/drivers/ata/pata_at91.c +++ b/drivers/ata/pata_at91.c | |||
@@ -153,8 +153,8 @@ static void pata_at91_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
153 | /* Compute ATA timing and set it to SMC */ | 153 | /* Compute ATA timing and set it to SMC */ |
154 | ret = ata_timing_compute(adev, adev->pio_mode, &timing, 1000, 0); | 154 | ret = ata_timing_compute(adev, adev->pio_mode, &timing, 1000, 0); |
155 | if (ret) { | 155 | if (ret) { |
156 | dev_warn(ap->dev, "Failed to compute ATA timing %d, \ | 156 | dev_warn(ap->dev, "Failed to compute ATA timing %d, " |
157 | set PIO_0 timing\n", ret); | 157 | "set PIO_0 timing\n", ret); |
158 | set_smc_timing(ap->dev, info, &initial_timing); | 158 | set_smc_timing(ap->dev, info, &initial_timing); |
159 | } else { | 159 | } else { |
160 | set_smc_timing(ap->dev, info, &timing); | 160 | set_smc_timing(ap->dev, info, &timing); |
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index ae4454d4e955..cbaf2eddac6b 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata_atiixp.c - ATI PATA for new ATA layer | 2 | * pata_atiixp.c - ATI PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * (C) 2009 Bartlomiej Zolnierkiewicz | 4 | * (C) 2009-2010 Bartlomiej Zolnierkiewicz |
5 | * | 5 | * |
6 | * Based on | 6 | * Based on |
7 | * | 7 | * |
@@ -46,6 +46,8 @@ static int atiixp_cable_detect(struct ata_port *ap) | |||
46 | return ATA_CBL_PATA40; | 46 | return ATA_CBL_PATA40; |
47 | } | 47 | } |
48 | 48 | ||
49 | static DEFINE_SPINLOCK(atiixp_lock); | ||
50 | |||
49 | /** | 51 | /** |
50 | * atiixp_set_pio_timing - set initial PIO mode data | 52 | * atiixp_set_pio_timing - set initial PIO mode data |
51 | * @ap: ATA interface | 53 | * @ap: ATA interface |
@@ -88,7 +90,10 @@ static void atiixp_set_pio_timing(struct ata_port *ap, struct ata_device *adev, | |||
88 | 90 | ||
89 | static void atiixp_set_piomode(struct ata_port *ap, struct ata_device *adev) | 91 | static void atiixp_set_piomode(struct ata_port *ap, struct ata_device *adev) |
90 | { | 92 | { |
93 | unsigned long flags; | ||
94 | spin_lock_irqsave(&atiixp_lock, flags); | ||
91 | atiixp_set_pio_timing(ap, adev, adev->pio_mode - XFER_PIO_0); | 95 | atiixp_set_pio_timing(ap, adev, adev->pio_mode - XFER_PIO_0); |
96 | spin_unlock_irqrestore(&atiixp_lock, flags); | ||
92 | } | 97 | } |
93 | 98 | ||
94 | /** | 99 | /** |
@@ -108,6 +113,9 @@ static void atiixp_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
108 | int dma = adev->dma_mode; | 113 | int dma = adev->dma_mode; |
109 | int dn = 2 * ap->port_no + adev->devno; | 114 | int dn = 2 * ap->port_no + adev->devno; |
110 | int wanted_pio; | 115 | int wanted_pio; |
116 | unsigned long flags; | ||
117 | |||
118 | spin_lock_irqsave(&atiixp_lock, flags); | ||
111 | 119 | ||
112 | if (adev->dma_mode >= XFER_UDMA_0) { | 120 | if (adev->dma_mode >= XFER_UDMA_0) { |
113 | u16 udma_mode_data; | 121 | u16 udma_mode_data; |
@@ -145,6 +153,7 @@ static void atiixp_set_dmamode(struct ata_port *ap, struct ata_device *adev) | |||
145 | 153 | ||
146 | if (adev->pio_mode != wanted_pio) | 154 | if (adev->pio_mode != wanted_pio) |
147 | atiixp_set_pio_timing(ap, adev, wanted_pio); | 155 | atiixp_set_pio_timing(ap, adev, wanted_pio); |
156 | spin_unlock_irqrestore(&atiixp_lock, flags); | ||
148 | } | 157 | } |
149 | 158 | ||
150 | /** | 159 | /** |
@@ -237,7 +246,8 @@ static int atiixp_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
237 | if (!pci_test_config_bits(pdev, &atiixp_enable_bits[i])) | 246 | if (!pci_test_config_bits(pdev, &atiixp_enable_bits[i])) |
238 | ppi[i] = &ata_dummy_port_info; | 247 | ppi[i] = &ata_dummy_port_info; |
239 | 248 | ||
240 | return ata_pci_sff_init_one(pdev, ppi, &atiixp_sht, NULL); | 249 | return ata_pci_sff_init_one(pdev, ppi, &atiixp_sht, NULL, |
250 | ATA_HOST_PARALLEL_SCAN); | ||
241 | } | 251 | } |
242 | 252 | ||
243 | static const struct pci_device_id atiixp[] = { | 253 | static const struct pci_device_id atiixp[] = { |
diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c index 5acf9fa9b39f..6cd5d5dd9e3b 100644 --- a/drivers/ata/pata_cmd640.c +++ b/drivers/ata/pata_cmd640.c | |||
@@ -223,7 +223,7 @@ static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
223 | 223 | ||
224 | cmd640_hardware_init(pdev); | 224 | cmd640_hardware_init(pdev); |
225 | 225 | ||
226 | return ata_pci_sff_init_one(pdev, ppi, &cmd640_sht, NULL); | 226 | return ata_pci_sff_init_one(pdev, ppi, &cmd640_sht, NULL, 0); |
227 | } | 227 | } |
228 | 228 | ||
229 | #ifdef CONFIG_PM | 229 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c index 0efb1f58f255..4c81a71b8877 100644 --- a/drivers/ata/pata_cmd64x.c +++ b/drivers/ata/pata_cmd64x.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * pata_cmd64x.c - CMD64x PATA for new ATA layer | 2 | * pata_cmd64x.c - CMD64x PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * Alan Cox <alan@lxorguk.ukuu.org.uk> | 4 | * Alan Cox <alan@lxorguk.ukuu.org.uk> |
5 | * (C) 2009-2010 Bartlomiej Zolnierkiewicz | ||
5 | * | 6 | * |
6 | * Based upon | 7 | * Based upon |
7 | * linux/drivers/ide/pci/cmd64x.c Version 1.30 Sept 10, 2002 | 8 | * linux/drivers/ide/pci/cmd64x.c Version 1.30 Sept 10, 2002 |
@@ -39,11 +40,7 @@ | |||
39 | 40 | ||
40 | enum { | 41 | enum { |
41 | CFR = 0x50, | 42 | CFR = 0x50, |
42 | CFR_INTR_CH0 = 0x02, | 43 | CFR_INTR_CH0 = 0x04, |
43 | CNTRL = 0x51, | ||
44 | CNTRL_DIS_RA0 = 0x40, | ||
45 | CNTRL_DIS_RA1 = 0x80, | ||
46 | CNTRL_ENA_2ND = 0x08, | ||
47 | CMDTIM = 0x52, | 44 | CMDTIM = 0x52, |
48 | ARTTIM0 = 0x53, | 45 | ARTTIM0 = 0x53, |
49 | DRWTIM0 = 0x54, | 46 | DRWTIM0 = 0x54, |
@@ -53,9 +50,6 @@ enum { | |||
53 | ARTTIM23_DIS_RA2 = 0x04, | 50 | ARTTIM23_DIS_RA2 = 0x04, |
54 | ARTTIM23_DIS_RA3 = 0x08, | 51 | ARTTIM23_DIS_RA3 = 0x08, |
55 | ARTTIM23_INTR_CH1 = 0x10, | 52 | ARTTIM23_INTR_CH1 = 0x10, |
56 | ARTTIM2 = 0x57, | ||
57 | ARTTIM3 = 0x57, | ||
58 | DRWTIM23 = 0x58, | ||
59 | DRWTIM2 = 0x58, | 53 | DRWTIM2 = 0x58, |
60 | BRST = 0x59, | 54 | BRST = 0x59, |
61 | DRWTIM3 = 0x5b, | 55 | DRWTIM3 = 0x5b, |
@@ -63,14 +57,11 @@ enum { | |||
63 | MRDMODE = 0x71, | 57 | MRDMODE = 0x71, |
64 | MRDMODE_INTR_CH0 = 0x04, | 58 | MRDMODE_INTR_CH0 = 0x04, |
65 | MRDMODE_INTR_CH1 = 0x08, | 59 | MRDMODE_INTR_CH1 = 0x08, |
66 | MRDMODE_BLK_CH0 = 0x10, | ||
67 | MRDMODE_BLK_CH1 = 0x20, | ||
68 | BMIDESR0 = 0x72, | 60 | BMIDESR0 = 0x72, |
69 | UDIDETCR0 = 0x73, | 61 | UDIDETCR0 = 0x73, |
70 | DTPR0 = 0x74, | 62 | DTPR0 = 0x74, |
71 | BMIDECR1 = 0x78, | 63 | BMIDECR1 = 0x78, |
72 | BMIDECSR = 0x79, | 64 | BMIDECSR = 0x79, |
73 | BMIDESR1 = 0x7A, | ||
74 | UDIDETCR1 = 0x7B, | 65 | UDIDETCR1 = 0x7B, |
75 | DTPR1 = 0x7C | 66 | DTPR1 = 0x7C |
76 | }; | 67 | }; |
@@ -130,8 +121,14 @@ static void cmd64x_set_timing(struct ata_port *ap, struct ata_device *adev, u8 m | |||
130 | 121 | ||
131 | if (pair) { | 122 | if (pair) { |
132 | struct ata_timing tp; | 123 | struct ata_timing tp; |
124 | |||
133 | ata_timing_compute(pair, pair->pio_mode, &tp, T, 0); | 125 | ata_timing_compute(pair, pair->pio_mode, &tp, T, 0); |
134 | ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP); | 126 | ata_timing_merge(&t, &tp, &t, ATA_TIMING_SETUP); |
127 | if (pair->dma_mode) { | ||
128 | ata_timing_compute(pair, pair->dma_mode, | ||
129 | &tp, T, 0); | ||
130 | ata_timing_merge(&tp, &t, &t, ATA_TIMING_SETUP); | ||
131 | } | ||
135 | } | 132 | } |
136 | } | 133 | } |
137 | 134 | ||
@@ -147,7 +144,9 @@ static void cmd64x_set_timing(struct ata_port *ap, struct ata_device *adev, u8 m | |||
147 | /* Now convert the clocks into values we can actually stuff into | 144 | /* Now convert the clocks into values we can actually stuff into |
148 | the chip */ | 145 | the chip */ |
149 | 146 | ||
150 | if (t.recover > 1) | 147 | if (t.recover == 16) |
148 | t.recover = 0; | ||
149 | else if (t.recover > 1) | ||
151 | t.recover--; | 150 | t.recover--; |
152 | else | 151 | else |
153 | t.recover = 15; | 152 | t.recover = 15; |
@@ -245,7 +244,7 @@ static void cmd648_bmdma_stop(struct ata_queued_cmd *qc) | |||
245 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 244 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
246 | u8 dma_intr; | 245 | u8 dma_intr; |
247 | int dma_mask = ap->port_no ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0; | 246 | int dma_mask = ap->port_no ? ARTTIM23_INTR_CH1 : CFR_INTR_CH0; |
248 | int dma_reg = ap->port_no ? ARTTIM2 : CFR; | 247 | int dma_reg = ap->port_no ? ARTTIM23 : CFR; |
249 | 248 | ||
250 | ata_bmdma_stop(qc); | 249 | ata_bmdma_stop(qc); |
251 | 250 | ||
@@ -368,7 +367,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
368 | pci_write_config_byte(pdev, UDIDETCR0, 0xF0); | 367 | pci_write_config_byte(pdev, UDIDETCR0, 0xF0); |
369 | #endif | 368 | #endif |
370 | 369 | ||
371 | return ata_pci_sff_init_one(pdev, ppi, &cmd64x_sht, NULL); | 370 | return ata_pci_sff_init_one(pdev, ppi, &cmd64x_sht, NULL, 0); |
372 | } | 371 | } |
373 | 372 | ||
374 | #ifdef CONFIG_PM | 373 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c index c974b05e4129..738ad2e14a97 100644 --- a/drivers/ata/pata_cs5530.c +++ b/drivers/ata/pata_cs5530.c | |||
@@ -324,7 +324,7 @@ static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
324 | ppi[1] = &info_palmax_secondary; | 324 | ppi[1] = &info_palmax_secondary; |
325 | 325 | ||
326 | /* Now kick off ATA set up */ | 326 | /* Now kick off ATA set up */ |
327 | return ata_pci_sff_init_one(pdev, ppi, &cs5530_sht, NULL); | 327 | return ata_pci_sff_init_one(pdev, ppi, &cs5530_sht, NULL, 0); |
328 | } | 328 | } |
329 | 329 | ||
330 | #ifdef CONFIG_PM | 330 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c index 71cef9a962d4..a02e6459fdcc 100644 --- a/drivers/ata/pata_cs5535.c +++ b/drivers/ata/pata_cs5535.c | |||
@@ -100,7 +100,7 @@ static int cs5535_cable_detect(struct ata_port *ap) | |||
100 | static void cs5535_set_piomode(struct ata_port *ap, struct ata_device *adev) | 100 | static void cs5535_set_piomode(struct ata_port *ap, struct ata_device *adev) |
101 | { | 101 | { |
102 | static const u16 pio_timings[5] = { | 102 | static const u16 pio_timings[5] = { |
103 | 0xF7F4, 0x53F3, 0x13F1, 0x5131, 0x1131 | 103 | 0xF7F4, 0xF173, 0x8141, 0x5131, 0x1131 |
104 | }; | 104 | }; |
105 | static const u16 pio_cmd_timings[5] = { | 105 | static const u16 pio_cmd_timings[5] = { |
106 | 0xF7F4, 0x53F3, 0x13F1, 0x5131, 0x1131 | 106 | 0xF7F4, 0x53F3, 0x13F1, 0x5131, 0x1131 |
@@ -198,7 +198,7 @@ static int cs5535_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
198 | rdmsr(ATAC_CH0D1_PIO, timings, dummy); | 198 | rdmsr(ATAC_CH0D1_PIO, timings, dummy); |
199 | if (CS5535_BAD_PIO(timings)) | 199 | if (CS5535_BAD_PIO(timings)) |
200 | wrmsr(ATAC_CH0D1_PIO, 0xF7F4F7F4UL, 0); | 200 | wrmsr(ATAC_CH0D1_PIO, 0xF7F4F7F4UL, 0); |
201 | return ata_pci_sff_init_one(dev, ppi, &cs5535_sht, NULL); | 201 | return ata_pci_sff_init_one(dev, ppi, &cs5535_sht, NULL, 0); |
202 | } | 202 | } |
203 | 203 | ||
204 | static const struct pci_device_id cs5535[] = { | 204 | static const struct pci_device_id cs5535[] = { |
diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c index ffee3978ec83..914ae3506ff5 100644 --- a/drivers/ata/pata_cs5536.c +++ b/drivers/ata/pata_cs5536.c | |||
@@ -260,7 +260,7 @@ static int cs5536_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
260 | return -ENODEV; | 260 | return -ENODEV; |
261 | } | 261 | } |
262 | 262 | ||
263 | return ata_pci_sff_init_one(dev, ppi, &cs5536_sht, NULL); | 263 | return ata_pci_sff_init_one(dev, ppi, &cs5536_sht, NULL, 0); |
264 | } | 264 | } |
265 | 265 | ||
266 | static const struct pci_device_id cs5536[] = { | 266 | static const struct pci_device_id cs5536[] = { |
diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c index 8fb040bf7361..0fcc096b8dac 100644 --- a/drivers/ata/pata_cypress.c +++ b/drivers/ata/pata_cypress.c | |||
@@ -62,14 +62,16 @@ static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
62 | return; | 62 | return; |
63 | } | 63 | } |
64 | 64 | ||
65 | time_16 = clamp_val(t.recover, 0, 15) | (clamp_val(t.active, 0, 15) << 4); | 65 | time_16 = clamp_val(t.recover - 1, 0, 15) | |
66 | time_8 = clamp_val(t.act8b, 0, 15) | (clamp_val(t.rec8b, 0, 15) << 4); | 66 | (clamp_val(t.active - 1, 0, 15) << 4); |
67 | time_8 = clamp_val(t.act8b - 1, 0, 15) | | ||
68 | (clamp_val(t.rec8b - 1, 0, 15) << 4); | ||
67 | 69 | ||
68 | if (adev->devno == 0) { | 70 | if (adev->devno == 0) { |
69 | pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); | 71 | pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); |
70 | 72 | ||
71 | addr &= ~0x0F; /* Mask bits */ | 73 | addr &= ~0x0F; /* Mask bits */ |
72 | addr |= clamp_val(t.setup, 0, 15); | 74 | addr |= clamp_val(t.setup - 1, 0, 15); |
73 | 75 | ||
74 | pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr); | 76 | pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr); |
75 | pci_write_config_byte(pdev, CY82_IDE_MASTER_IOR, time_16); | 77 | pci_write_config_byte(pdev, CY82_IDE_MASTER_IOR, time_16); |
@@ -79,7 +81,7 @@ static void cy82c693_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
79 | pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); | 81 | pci_read_config_dword(pdev, CY82_IDE_ADDRSETUP, &addr); |
80 | 82 | ||
81 | addr &= ~0xF0; /* Mask bits */ | 83 | addr &= ~0xF0; /* Mask bits */ |
82 | addr |= (clamp_val(t.setup, 0, 15) << 4); | 84 | addr |= (clamp_val(t.setup - 1, 0, 15) << 4); |
83 | 85 | ||
84 | pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr); | 86 | pci_write_config_dword(pdev, CY82_IDE_ADDRSETUP, addr); |
85 | pci_write_config_byte(pdev, CY82_IDE_SLAVE_IOR, time_16); | 87 | pci_write_config_byte(pdev, CY82_IDE_SLAVE_IOR, time_16); |
@@ -136,7 +138,7 @@ static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *i | |||
136 | if (PCI_FUNC(pdev->devfn) != 1) | 138 | if (PCI_FUNC(pdev->devfn) != 1) |
137 | return -ENODEV; | 139 | return -ENODEV; |
138 | 140 | ||
139 | return ata_pci_sff_init_one(pdev, ppi, &cy82c693_sht, NULL); | 141 | return ata_pci_sff_init_one(pdev, ppi, &cy82c693_sht, NULL, 0); |
140 | } | 142 | } |
141 | 143 | ||
142 | static const struct pci_device_id cy82c693[] = { | 144 | static const struct pci_device_id cy82c693[] = { |
diff --git a/drivers/ata/pata_efar.c b/drivers/ata/pata_efar.c index b2e71e6473ed..3bac0e079691 100644 --- a/drivers/ata/pata_efar.c +++ b/drivers/ata/pata_efar.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * pata_efar.c - EFAR PIIX clone controller driver | 2 | * pata_efar.c - EFAR PIIX clone controller driver |
3 | * | 3 | * |
4 | * (C) 2005 Red Hat | 4 | * (C) 2005 Red Hat |
5 | * (C) 2009 Bartlomiej Zolnierkiewicz | 5 | * (C) 2009-2010 Bartlomiej Zolnierkiewicz |
6 | * | 6 | * |
7 | * Some parts based on ata_piix.c by Jeff Garzik and others. | 7 | * Some parts based on ata_piix.c by Jeff Garzik and others. |
8 | * | 8 | * |
@@ -68,6 +68,8 @@ static int efar_cable_detect(struct ata_port *ap) | |||
68 | return ATA_CBL_PATA80; | 68 | return ATA_CBL_PATA80; |
69 | } | 69 | } |
70 | 70 | ||
71 | static DEFINE_SPINLOCK(efar_lock); | ||
72 | |||
71 | /** | 73 | /** |
72 | * efar_set_piomode - Initialize host controller PATA PIO timings | 74 | * efar_set_piomode - Initialize host controller PATA PIO timings |
73 | * @ap: Port whose timings we are configuring | 75 | * @ap: Port whose timings we are configuring |
@@ -84,7 +86,9 @@ static void efar_set_piomode (struct ata_port *ap, struct ata_device *adev) | |||
84 | unsigned int pio = adev->pio_mode - XFER_PIO_0; | 86 | unsigned int pio = adev->pio_mode - XFER_PIO_0; |
85 | struct pci_dev *dev = to_pci_dev(ap->host->dev); | 87 | struct pci_dev *dev = to_pci_dev(ap->host->dev); |
86 | unsigned int idetm_port= ap->port_no ? 0x42 : 0x40; | 88 | unsigned int idetm_port= ap->port_no ? 0x42 : 0x40; |
89 | unsigned long flags; | ||
87 | u16 idetm_data; | 90 | u16 idetm_data; |
91 | u8 udma_enable; | ||
88 | int control = 0; | 92 | int control = 0; |
89 | 93 | ||
90 | /* | 94 | /* |
@@ -107,6 +111,8 @@ static void efar_set_piomode (struct ata_port *ap, struct ata_device *adev) | |||
107 | if (adev->class == ATA_DEV_ATA) | 111 | if (adev->class == ATA_DEV_ATA) |
108 | control |= 4; /* PPE */ | 112 | control |= 4; /* PPE */ |
109 | 113 | ||
114 | spin_lock_irqsave(&efar_lock, flags); | ||
115 | |||
110 | pci_read_config_word(dev, idetm_port, &idetm_data); | 116 | pci_read_config_word(dev, idetm_port, &idetm_data); |
111 | 117 | ||
112 | /* Set PPE, IE, and TIME as appropriate */ | 118 | /* Set PPE, IE, and TIME as appropriate */ |
@@ -131,6 +137,11 @@ static void efar_set_piomode (struct ata_port *ap, struct ata_device *adev) | |||
131 | 137 | ||
132 | idetm_data |= 0x4000; /* Ensure SITRE is set */ | 138 | idetm_data |= 0x4000; /* Ensure SITRE is set */ |
133 | pci_write_config_word(dev, idetm_port, idetm_data); | 139 | pci_write_config_word(dev, idetm_port, idetm_data); |
140 | |||
141 | pci_read_config_byte(dev, 0x48, &udma_enable); | ||
142 | udma_enable &= ~(1 << (2 * ap->port_no + adev->devno)); | ||
143 | pci_write_config_byte(dev, 0x48, udma_enable); | ||
144 | spin_unlock_irqrestore(&efar_lock, flags); | ||
134 | } | 145 | } |
135 | 146 | ||
136 | /** | 147 | /** |
@@ -151,6 +162,7 @@ static void efar_set_dmamode (struct ata_port *ap, struct ata_device *adev) | |||
151 | u16 master_data; | 162 | u16 master_data; |
152 | u8 speed = adev->dma_mode; | 163 | u8 speed = adev->dma_mode; |
153 | int devid = adev->devno + 2 * ap->port_no; | 164 | int devid = adev->devno + 2 * ap->port_no; |
165 | unsigned long flags; | ||
154 | u8 udma_enable; | 166 | u8 udma_enable; |
155 | 167 | ||
156 | static const /* ISP RTC */ | 168 | static const /* ISP RTC */ |
@@ -160,6 +172,8 @@ static void efar_set_dmamode (struct ata_port *ap, struct ata_device *adev) | |||
160 | { 2, 1 }, | 172 | { 2, 1 }, |
161 | { 2, 3 }, }; | 173 | { 2, 3 }, }; |
162 | 174 | ||
175 | spin_lock_irqsave(&efar_lock, flags); | ||
176 | |||
163 | pci_read_config_word(dev, master_port, &master_data); | 177 | pci_read_config_word(dev, master_port, &master_data); |
164 | pci_read_config_byte(dev, 0x48, &udma_enable); | 178 | pci_read_config_byte(dev, 0x48, &udma_enable); |
165 | 179 | ||
@@ -217,6 +231,7 @@ static void efar_set_dmamode (struct ata_port *ap, struct ata_device *adev) | |||
217 | pci_write_config_word(dev, master_port, master_data); | 231 | pci_write_config_word(dev, master_port, master_data); |
218 | } | 232 | } |
219 | pci_write_config_byte(dev, 0x48, udma_enable); | 233 | pci_write_config_byte(dev, 0x48, udma_enable); |
234 | spin_unlock_irqrestore(&efar_lock, flags); | ||
220 | } | 235 | } |
221 | 236 | ||
222 | static struct scsi_host_template efar_sht = { | 237 | static struct scsi_host_template efar_sht = { |
@@ -256,13 +271,14 @@ static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
256 | .udma_mask = ATA_UDMA4, | 271 | .udma_mask = ATA_UDMA4, |
257 | .port_ops = &efar_ops, | 272 | .port_ops = &efar_ops, |
258 | }; | 273 | }; |
259 | const struct ata_port_info *ppi[] = { &info, NULL }; | 274 | const struct ata_port_info *ppi[] = { &info, &info }; |
260 | 275 | ||
261 | if (!printed_version++) | 276 | if (!printed_version++) |
262 | dev_printk(KERN_DEBUG, &pdev->dev, | 277 | dev_printk(KERN_DEBUG, &pdev->dev, |
263 | "version " DRV_VERSION "\n"); | 278 | "version " DRV_VERSION "\n"); |
264 | 279 | ||
265 | return ata_pci_sff_init_one(pdev, ppi, &efar_sht, NULL); | 280 | return ata_pci_sff_init_one(pdev, ppi, &efar_sht, NULL, |
281 | ATA_HOST_PARALLEL_SCAN); | ||
266 | } | 282 | } |
267 | 283 | ||
268 | static const struct pci_device_id efar_pci_tbl[] = { | 284 | static const struct pci_device_id efar_pci_tbl[] = { |
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c index 0bd48e8f21bd..af49bfb57247 100644 --- a/drivers/ata/pata_hpt366.c +++ b/drivers/ata/pata_hpt366.c | |||
@@ -11,9 +11,7 @@ | |||
11 | * | 11 | * |
12 | * | 12 | * |
13 | * TODO | 13 | * TODO |
14 | * Maybe PLL mode | 14 | * Look into engine reset on timeout errors. Should not be required. |
15 | * Look into engine reset on timeout errors. Should not be | ||
16 | * required. | ||
17 | */ | 15 | */ |
18 | 16 | ||
19 | 17 | ||
@@ -27,7 +25,7 @@ | |||
27 | #include <linux/libata.h> | 25 | #include <linux/libata.h> |
28 | 26 | ||
29 | #define DRV_NAME "pata_hpt366" | 27 | #define DRV_NAME "pata_hpt366" |
30 | #define DRV_VERSION "0.6.7" | 28 | #define DRV_VERSION "0.6.8" |
31 | 29 | ||
32 | struct hpt_clock { | 30 | struct hpt_clock { |
33 | u8 xfer_mode; | 31 | u8 xfer_mode; |
@@ -207,17 +205,8 @@ static void hpt366_set_mode(struct ata_port *ap, struct ata_device *adev, | |||
207 | { | 205 | { |
208 | struct hpt_clock *clocks = ap->host->private_data; | 206 | struct hpt_clock *clocks = ap->host->private_data; |
209 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 207 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
210 | u32 addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); | 208 | u32 addr = 0x40 + 4 * adev->devno; |
211 | u32 addr2 = 0x51 + 4 * ap->port_no; | ||
212 | u32 mask, reg; | 209 | u32 mask, reg; |
213 | u8 fast; | ||
214 | |||
215 | /* Fast interrupt prediction disable, hold off interrupt disable */ | ||
216 | pci_read_config_byte(pdev, addr2, &fast); | ||
217 | if (fast & 0x80) { | ||
218 | fast &= ~0x80; | ||
219 | pci_write_config_byte(pdev, addr2, fast); | ||
220 | } | ||
221 | 210 | ||
222 | /* determine timing mask and find matching clock entry */ | 211 | /* determine timing mask and find matching clock entry */ |
223 | if (mode < XFER_MW_DMA_0) | 212 | if (mode < XFER_MW_DMA_0) |
@@ -240,9 +229,9 @@ static void hpt366_set_mode(struct ata_port *ap, struct ata_device *adev, | |||
240 | * on-chip PIO FIFO/buffer (and PIO MST mode as well) to avoid | 229 | * on-chip PIO FIFO/buffer (and PIO MST mode as well) to avoid |
241 | * problems handling I/O errors later. | 230 | * problems handling I/O errors later. |
242 | */ | 231 | */ |
243 | pci_read_config_dword(pdev, addr1, ®); | 232 | pci_read_config_dword(pdev, addr, ®); |
244 | reg = ((reg & ~mask) | (clocks->timing & mask)) & ~0xc0000000; | 233 | reg = ((reg & ~mask) | (clocks->timing & mask)) & ~0xc0000000; |
245 | pci_write_config_dword(pdev, addr1, reg); | 234 | pci_write_config_dword(pdev, addr, reg); |
246 | } | 235 | } |
247 | 236 | ||
248 | /** | 237 | /** |
@@ -372,7 +361,7 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
372 | break; | 361 | break; |
373 | } | 362 | } |
374 | /* Now kick off ATA set up */ | 363 | /* Now kick off ATA set up */ |
375 | return ata_pci_sff_init_one(dev, ppi, &hpt36x_sht, hpriv); | 364 | return ata_pci_sff_init_one(dev, ppi, &hpt36x_sht, hpriv, 0); |
376 | } | 365 | } |
377 | 366 | ||
378 | #ifdef CONFIG_PM | 367 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c index 4224cfccedef..8839307a64cf 100644 --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/libata.h> | 24 | #include <linux/libata.h> |
25 | 25 | ||
26 | #define DRV_NAME "pata_hpt37x" | 26 | #define DRV_NAME "pata_hpt37x" |
27 | #define DRV_VERSION "0.6.14" | 27 | #define DRV_VERSION "0.6.15" |
28 | 28 | ||
29 | struct hpt_clock { | 29 | struct hpt_clock { |
30 | u8 xfer_speed; | 30 | u8 xfer_speed; |
@@ -39,25 +39,24 @@ struct hpt_chip { | |||
39 | 39 | ||
40 | /* key for bus clock timings | 40 | /* key for bus clock timings |
41 | * bit | 41 | * bit |
42 | * 0:3 data_high_time. inactive time of DIOW_/DIOR_ for PIO and MW | 42 | * 0:3 data_high_time. Inactive time of DIOW_/DIOR_ for PIO and MW DMA. |
43 | * DMA. cycles = value + 1 | 43 | * cycles = value + 1 |
44 | * 4:8 data_low_time. active time of DIOW_/DIOR_ for PIO and MW | 44 | * 4:8 data_low_time. Active time of DIOW_/DIOR_ for PIO and MW DMA. |
45 | * DMA. cycles = value + 1 | 45 | * cycles = value + 1 |
46 | * 9:12 cmd_high_time. inactive time of DIOW_/DIOR_ during task file | 46 | * 9:12 cmd_high_time. Inactive time of DIOW_/DIOR_ during task file |
47 | * register access. | 47 | * register access. |
48 | * 13:17 cmd_low_time. active time of DIOW_/DIOR_ during task file | 48 | * 13:17 cmd_low_time. Active time of DIOW_/DIOR_ during task file |
49 | * register access. | 49 | * register access. |
50 | * 18:21 udma_cycle_time. clock freq and clock cycles for UDMA xfer. | 50 | * 18:20 udma_cycle_time. Clock cycles for UDMA xfer. |
51 | * during task file register access. | 51 | * 21 CLK frequency for UDMA: 0=ATA clock, 1=dual ATA clock. |
52 | * 22:24 pre_high_time. time to initialize 1st cycle for PIO and MW DMA | 52 | * 22:24 pre_high_time. Time to initialize 1st cycle for PIO and MW DMA xfer. |
53 | * xfer. | 53 | * 25:27 cmd_pre_high_time. Time to initialize 1st PIO cycle for task file |
54 | * 25:27 cmd_pre_high_time. time to initialize 1st PIO cycle for task | ||
55 | * register access. | 54 | * register access. |
56 | * 28 UDMA enable | 55 | * 28 UDMA enable. |
57 | * 29 DMA enable | 56 | * 29 DMA enable. |
58 | * 30 PIO_MST enable. if set, the chip is in bus master mode during | 57 | * 30 PIO_MST enable. If set, the chip is in bus master mode during |
59 | * PIO. | 58 | * PIO xfer. |
60 | * 31 FIFO enable. | 59 | * 31 FIFO enable. Only for PIO. |
61 | */ | 60 | */ |
62 | 61 | ||
63 | static struct hpt_clock hpt37x_timings_33[] = { | 62 | static struct hpt_clock hpt37x_timings_33[] = { |
@@ -384,20 +383,12 @@ static int hpt37x_pre_reset(struct ata_link *link, unsigned long deadline) | |||
384 | return ata_sff_prereset(link, deadline); | 383 | return ata_sff_prereset(link, deadline); |
385 | } | 384 | } |
386 | 385 | ||
387 | /** | 386 | static void hpt370_set_mode(struct ata_port *ap, struct ata_device *adev, |
388 | * hpt370_set_piomode - PIO setup | 387 | u8 mode) |
389 | * @ap: ATA interface | ||
390 | * @adev: device on the interface | ||
391 | * | ||
392 | * Perform PIO mode setup. | ||
393 | */ | ||
394 | |||
395 | static void hpt370_set_piomode(struct ata_port *ap, struct ata_device *adev) | ||
396 | { | 388 | { |
397 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 389 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
398 | u32 addr1, addr2; | 390 | u32 addr1, addr2; |
399 | u32 reg; | 391 | u32 reg, timing, mask; |
400 | u32 mode; | ||
401 | u8 fast; | 392 | u8 fast; |
402 | 393 | ||
403 | addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); | 394 | addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); |
@@ -409,11 +400,31 @@ static void hpt370_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
409 | fast |= 0x01; | 400 | fast |= 0x01; |
410 | pci_write_config_byte(pdev, addr2, fast); | 401 | pci_write_config_byte(pdev, addr2, fast); |
411 | 402 | ||
403 | /* Determine timing mask and find matching mode entry */ | ||
404 | if (mode < XFER_MW_DMA_0) | ||
405 | mask = 0xcfc3ffff; | ||
406 | else if (mode < XFER_UDMA_0) | ||
407 | mask = 0x31c001ff; | ||
408 | else | ||
409 | mask = 0x303c0000; | ||
410 | |||
411 | timing = hpt37x_find_mode(ap, mode); | ||
412 | |||
412 | pci_read_config_dword(pdev, addr1, ®); | 413 | pci_read_config_dword(pdev, addr1, ®); |
413 | mode = hpt37x_find_mode(ap, adev->pio_mode); | 414 | reg = (reg & ~mask) | (timing & mask); |
414 | mode &= 0xCFC3FFFF; /* Leave DMA bits alone */ | 415 | pci_write_config_dword(pdev, addr1, reg); |
415 | reg &= ~0xCFC3FFFF; /* Strip timing bits */ | 416 | } |
416 | pci_write_config_dword(pdev, addr1, reg | mode); | 417 | /** |
418 | * hpt370_set_piomode - PIO setup | ||
419 | * @ap: ATA interface | ||
420 | * @adev: device on the interface | ||
421 | * | ||
422 | * Perform PIO mode setup. | ||
423 | */ | ||
424 | |||
425 | static void hpt370_set_piomode(struct ata_port *ap, struct ata_device *adev) | ||
426 | { | ||
427 | hpt370_set_mode(ap, adev, adev->pio_mode); | ||
417 | } | 428 | } |
418 | 429 | ||
419 | /** | 430 | /** |
@@ -421,33 +432,12 @@ static void hpt370_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
421 | * @ap: ATA interface | 432 | * @ap: ATA interface |
422 | * @adev: Device being configured | 433 | * @adev: Device being configured |
423 | * | 434 | * |
424 | * Set up the channel for MWDMA or UDMA modes. Much the same as with | 435 | * Set up the channel for MWDMA or UDMA modes. |
425 | * PIO, load the mode number and then set MWDMA or UDMA flag. | ||
426 | */ | 436 | */ |
427 | 437 | ||
428 | static void hpt370_set_dmamode(struct ata_port *ap, struct ata_device *adev) | 438 | static void hpt370_set_dmamode(struct ata_port *ap, struct ata_device *adev) |
429 | { | 439 | { |
430 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 440 | hpt370_set_mode(ap, adev, adev->dma_mode); |
431 | u32 addr1, addr2; | ||
432 | u32 reg, mode, mask; | ||
433 | u8 fast; | ||
434 | |||
435 | addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); | ||
436 | addr2 = 0x51 + 4 * ap->port_no; | ||
437 | |||
438 | /* Fast interrupt prediction disable, hold off interrupt disable */ | ||
439 | pci_read_config_byte(pdev, addr2, &fast); | ||
440 | fast &= ~0x02; | ||
441 | fast |= 0x01; | ||
442 | pci_write_config_byte(pdev, addr2, fast); | ||
443 | |||
444 | mask = adev->dma_mode < XFER_UDMA_0 ? 0x31C001FF : 0x303C0000; | ||
445 | |||
446 | pci_read_config_dword(pdev, addr1, ®); | ||
447 | mode = hpt37x_find_mode(ap, adev->dma_mode); | ||
448 | mode &= mask; | ||
449 | reg &= ~mask; | ||
450 | pci_write_config_dword(pdev, addr1, reg | mode); | ||
451 | } | 441 | } |
452 | 442 | ||
453 | /** | 443 | /** |
@@ -461,24 +451,25 @@ static void hpt370_bmdma_stop(struct ata_queued_cmd *qc) | |||
461 | { | 451 | { |
462 | struct ata_port *ap = qc->ap; | 452 | struct ata_port *ap = qc->ap; |
463 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 453 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
464 | u8 dma_stat = ioread8(ap->ioaddr.bmdma_addr + 2); | ||
465 | u8 dma_cmd; | ||
466 | void __iomem *bmdma = ap->ioaddr.bmdma_addr; | 454 | void __iomem *bmdma = ap->ioaddr.bmdma_addr; |
455 | u8 dma_stat = ioread8(bmdma + ATA_DMA_STATUS); | ||
456 | u8 dma_cmd; | ||
467 | 457 | ||
468 | if (dma_stat & 0x01) { | 458 | if (dma_stat & ATA_DMA_ACTIVE) { |
469 | udelay(20); | 459 | udelay(20); |
470 | dma_stat = ioread8(bmdma + 2); | 460 | dma_stat = ioread8(bmdma + ATA_DMA_STATUS); |
471 | } | 461 | } |
472 | if (dma_stat & 0x01) { | 462 | if (dma_stat & ATA_DMA_ACTIVE) { |
473 | /* Clear the engine */ | 463 | /* Clear the engine */ |
474 | pci_write_config_byte(pdev, 0x50 + 4 * ap->port_no, 0x37); | 464 | pci_write_config_byte(pdev, 0x50 + 4 * ap->port_no, 0x37); |
475 | udelay(10); | 465 | udelay(10); |
476 | /* Stop DMA */ | 466 | /* Stop DMA */ |
477 | dma_cmd = ioread8(bmdma ); | 467 | dma_cmd = ioread8(bmdma + ATA_DMA_CMD); |
478 | iowrite8(dma_cmd & 0xFE, bmdma); | 468 | iowrite8(dma_cmd & ~ATA_DMA_START, bmdma + ATA_DMA_CMD); |
479 | /* Clear Error */ | 469 | /* Clear Error */ |
480 | dma_stat = ioread8(bmdma + 2); | 470 | dma_stat = ioread8(bmdma + ATA_DMA_STATUS); |
481 | iowrite8(dma_stat | 0x06 , bmdma + 2); | 471 | iowrite8(dma_stat | ATA_DMA_INTR | ATA_DMA_ERR, |
472 | bmdma + ATA_DMA_STATUS); | ||
482 | /* Clear the engine */ | 473 | /* Clear the engine */ |
483 | pci_write_config_byte(pdev, 0x50 + 4 * ap->port_no, 0x37); | 474 | pci_write_config_byte(pdev, 0x50 + 4 * ap->port_no, 0x37); |
484 | udelay(10); | 475 | udelay(10); |
@@ -486,20 +477,12 @@ static void hpt370_bmdma_stop(struct ata_queued_cmd *qc) | |||
486 | ata_bmdma_stop(qc); | 477 | ata_bmdma_stop(qc); |
487 | } | 478 | } |
488 | 479 | ||
489 | /** | 480 | static void hpt372_set_mode(struct ata_port *ap, struct ata_device *adev, |
490 | * hpt372_set_piomode - PIO setup | 481 | u8 mode) |
491 | * @ap: ATA interface | ||
492 | * @adev: device on the interface | ||
493 | * | ||
494 | * Perform PIO mode setup. | ||
495 | */ | ||
496 | |||
497 | static void hpt372_set_piomode(struct ata_port *ap, struct ata_device *adev) | ||
498 | { | 482 | { |
499 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 483 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
500 | u32 addr1, addr2; | 484 | u32 addr1, addr2; |
501 | u32 reg; | 485 | u32 reg, timing, mask; |
502 | u32 mode; | ||
503 | u8 fast; | 486 | u8 fast; |
504 | 487 | ||
505 | addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); | 488 | addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); |
@@ -510,13 +493,32 @@ static void hpt372_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
510 | fast &= ~0x07; | 493 | fast &= ~0x07; |
511 | pci_write_config_byte(pdev, addr2, fast); | 494 | pci_write_config_byte(pdev, addr2, fast); |
512 | 495 | ||
496 | /* Determine timing mask and find matching mode entry */ | ||
497 | if (mode < XFER_MW_DMA_0) | ||
498 | mask = 0xcfc3ffff; | ||
499 | else if (mode < XFER_UDMA_0) | ||
500 | mask = 0x31c001ff; | ||
501 | else | ||
502 | mask = 0x303c0000; | ||
503 | |||
504 | timing = hpt37x_find_mode(ap, mode); | ||
505 | |||
513 | pci_read_config_dword(pdev, addr1, ®); | 506 | pci_read_config_dword(pdev, addr1, ®); |
514 | mode = hpt37x_find_mode(ap, adev->pio_mode); | 507 | reg = (reg & ~mask) | (timing & mask); |
508 | pci_write_config_dword(pdev, addr1, reg); | ||
509 | } | ||
510 | |||
511 | /** | ||
512 | * hpt372_set_piomode - PIO setup | ||
513 | * @ap: ATA interface | ||
514 | * @adev: device on the interface | ||
515 | * | ||
516 | * Perform PIO mode setup. | ||
517 | */ | ||
515 | 518 | ||
516 | printk("Find mode for %d reports %X\n", adev->pio_mode, mode); | 519 | static void hpt372_set_piomode(struct ata_port *ap, struct ata_device *adev) |
517 | mode &= 0xCFC3FFFF; /* Leave DMA bits alone */ | 520 | { |
518 | reg &= ~0xCFC3FFFF; /* Strip timing bits */ | 521 | hpt372_set_mode(ap, adev, adev->pio_mode); |
519 | pci_write_config_dword(pdev, addr1, reg | mode); | ||
520 | } | 522 | } |
521 | 523 | ||
522 | /** | 524 | /** |
@@ -524,33 +526,12 @@ static void hpt372_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
524 | * @ap: ATA interface | 526 | * @ap: ATA interface |
525 | * @adev: Device being configured | 527 | * @adev: Device being configured |
526 | * | 528 | * |
527 | * Set up the channel for MWDMA or UDMA modes. Much the same as with | 529 | * Set up the channel for MWDMA or UDMA modes. |
528 | * PIO, load the mode number and then set MWDMA or UDMA flag. | ||
529 | */ | 530 | */ |
530 | 531 | ||
531 | static void hpt372_set_dmamode(struct ata_port *ap, struct ata_device *adev) | 532 | static void hpt372_set_dmamode(struct ata_port *ap, struct ata_device *adev) |
532 | { | 533 | { |
533 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 534 | hpt372_set_mode(ap, adev, adev->dma_mode); |
534 | u32 addr1, addr2; | ||
535 | u32 reg, mode, mask; | ||
536 | u8 fast; | ||
537 | |||
538 | addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); | ||
539 | addr2 = 0x51 + 4 * ap->port_no; | ||
540 | |||
541 | /* Fast interrupt prediction disable, hold off interrupt disable */ | ||
542 | pci_read_config_byte(pdev, addr2, &fast); | ||
543 | fast &= ~0x07; | ||
544 | pci_write_config_byte(pdev, addr2, fast); | ||
545 | |||
546 | mask = adev->dma_mode < XFER_UDMA_0 ? 0x31C001FF : 0x303C0000; | ||
547 | |||
548 | pci_read_config_dword(pdev, addr1, ®); | ||
549 | mode = hpt37x_find_mode(ap, adev->dma_mode); | ||
550 | printk("Find mode for DMA %d reports %X\n", adev->dma_mode, mode); | ||
551 | mode &= mask; | ||
552 | reg &= ~mask; | ||
553 | pci_write_config_dword(pdev, addr1, reg | mode); | ||
554 | } | 535 | } |
555 | 536 | ||
556 | /** | 537 | /** |
@@ -1006,7 +987,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
1006 | } | 987 | } |
1007 | 988 | ||
1008 | /* Now kick off ATA set up */ | 989 | /* Now kick off ATA set up */ |
1009 | return ata_pci_sff_init_one(dev, ppi, &hpt37x_sht, private_data); | 990 | return ata_pci_sff_init_one(dev, ppi, &hpt37x_sht, private_data, 0); |
1010 | } | 991 | } |
1011 | 992 | ||
1012 | static const struct pci_device_id hpt37x[] = { | 993 | static const struct pci_device_id hpt37x[] = { |
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c index dd26bc73bd9a..01457b266f3d 100644 --- a/drivers/ata/pata_hpt3x2n.c +++ b/drivers/ata/pata_hpt3x2n.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/libata.h> | 25 | #include <linux/libata.h> |
26 | 26 | ||
27 | #define DRV_NAME "pata_hpt3x2n" | 27 | #define DRV_NAME "pata_hpt3x2n" |
28 | #define DRV_VERSION "0.3.8" | 28 | #define DRV_VERSION "0.3.10" |
29 | 29 | ||
30 | enum { | 30 | enum { |
31 | HPT_PCI_FAST = (1 << 31), | 31 | HPT_PCI_FAST = (1 << 31), |
@@ -45,25 +45,24 @@ struct hpt_chip { | |||
45 | 45 | ||
46 | /* key for bus clock timings | 46 | /* key for bus clock timings |
47 | * bit | 47 | * bit |
48 | * 0:3 data_high_time. inactive time of DIOW_/DIOR_ for PIO and MW | 48 | * 0:3 data_high_time. Inactive time of DIOW_/DIOR_ for PIO and MW DMA. |
49 | * DMA. cycles = value + 1 | 49 | * cycles = value + 1 |
50 | * 4:8 data_low_time. active time of DIOW_/DIOR_ for PIO and MW | 50 | * 4:8 data_low_time. Active time of DIOW_/DIOR_ for PIO and MW DMA. |
51 | * DMA. cycles = value + 1 | 51 | * cycles = value + 1 |
52 | * 9:12 cmd_high_time. inactive time of DIOW_/DIOR_ during task file | 52 | * 9:12 cmd_high_time. Inactive time of DIOW_/DIOR_ during task file |
53 | * register access. | 53 | * register access. |
54 | * 13:17 cmd_low_time. active time of DIOW_/DIOR_ during task file | 54 | * 13:17 cmd_low_time. Active time of DIOW_/DIOR_ during task file |
55 | * register access. | 55 | * register access. |
56 | * 18:21 udma_cycle_time. clock freq and clock cycles for UDMA xfer. | 56 | * 18:20 udma_cycle_time. Clock cycles for UDMA xfer. |
57 | * during task file register access. | 57 | * 21 CLK frequency for UDMA: 0=ATA clock, 1=dual ATA clock. |
58 | * 22:24 pre_high_time. time to initialize 1st cycle for PIO and MW DMA | 58 | * 22:24 pre_high_time. Time to initialize 1st cycle for PIO and MW DMA xfer. |
59 | * xfer. | 59 | * 25:27 cmd_pre_high_time. Time to initialize 1st PIO cycle for task file |
60 | * 25:27 cmd_pre_high_time. time to initialize 1st PIO cycle for task | ||
61 | * register access. | 60 | * register access. |
62 | * 28 UDMA enable | 61 | * 28 UDMA enable. |
63 | * 29 DMA enable | 62 | * 29 DMA enable. |
64 | * 30 PIO_MST enable. if set, the chip is in bus master mode during | 63 | * 30 PIO_MST enable. If set, the chip is in bus master mode during |
65 | * PIO. | 64 | * PIO xfer. |
66 | * 31 FIFO enable. | 65 | * 31 FIFO enable. Only for PIO. |
67 | */ | 66 | */ |
68 | 67 | ||
69 | /* 66MHz DPLL clocks */ | 68 | /* 66MHz DPLL clocks */ |
@@ -161,20 +160,12 @@ static int hpt3x2n_pre_reset(struct ata_link *link, unsigned long deadline) | |||
161 | return ata_sff_prereset(link, deadline); | 160 | return ata_sff_prereset(link, deadline); |
162 | } | 161 | } |
163 | 162 | ||
164 | /** | 163 | static void hpt3x2n_set_mode(struct ata_port *ap, struct ata_device *adev, |
165 | * hpt3x2n_set_piomode - PIO setup | 164 | u8 mode) |
166 | * @ap: ATA interface | ||
167 | * @adev: device on the interface | ||
168 | * | ||
169 | * Perform PIO mode setup. | ||
170 | */ | ||
171 | |||
172 | static void hpt3x2n_set_piomode(struct ata_port *ap, struct ata_device *adev) | ||
173 | { | 165 | { |
174 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 166 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
175 | u32 addr1, addr2; | 167 | u32 addr1, addr2; |
176 | u32 reg; | 168 | u32 reg, timing, mask; |
177 | u32 mode; | ||
178 | u8 fast; | 169 | u8 fast; |
179 | 170 | ||
180 | addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); | 171 | addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); |
@@ -185,11 +176,32 @@ static void hpt3x2n_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
185 | fast &= ~0x07; | 176 | fast &= ~0x07; |
186 | pci_write_config_byte(pdev, addr2, fast); | 177 | pci_write_config_byte(pdev, addr2, fast); |
187 | 178 | ||
179 | /* Determine timing mask and find matching mode entry */ | ||
180 | if (mode < XFER_MW_DMA_0) | ||
181 | mask = 0xcfc3ffff; | ||
182 | else if (mode < XFER_UDMA_0) | ||
183 | mask = 0x31c001ff; | ||
184 | else | ||
185 | mask = 0x303c0000; | ||
186 | |||
187 | timing = hpt3x2n_find_mode(ap, mode); | ||
188 | |||
188 | pci_read_config_dword(pdev, addr1, ®); | 189 | pci_read_config_dword(pdev, addr1, ®); |
189 | mode = hpt3x2n_find_mode(ap, adev->pio_mode); | 190 | reg = (reg & ~mask) | (timing & mask); |
190 | mode &= 0xCFC3FFFF; /* Leave DMA bits alone */ | 191 | pci_write_config_dword(pdev, addr1, reg); |
191 | reg &= ~0xCFC3FFFF; /* Strip timing bits */ | 192 | } |
192 | pci_write_config_dword(pdev, addr1, reg | mode); | 193 | |
194 | /** | ||
195 | * hpt3x2n_set_piomode - PIO setup | ||
196 | * @ap: ATA interface | ||
197 | * @adev: device on the interface | ||
198 | * | ||
199 | * Perform PIO mode setup. | ||
200 | */ | ||
201 | |||
202 | static void hpt3x2n_set_piomode(struct ata_port *ap, struct ata_device *adev) | ||
203 | { | ||
204 | hpt3x2n_set_mode(ap, adev, adev->pio_mode); | ||
193 | } | 205 | } |
194 | 206 | ||
195 | /** | 207 | /** |
@@ -197,32 +209,12 @@ static void hpt3x2n_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
197 | * @ap: ATA interface | 209 | * @ap: ATA interface |
198 | * @adev: Device being configured | 210 | * @adev: Device being configured |
199 | * | 211 | * |
200 | * Set up the channel for MWDMA or UDMA modes. Much the same as with | 212 | * Set up the channel for MWDMA or UDMA modes. |
201 | * PIO, load the mode number and then set MWDMA or UDMA flag. | ||
202 | */ | 213 | */ |
203 | 214 | ||
204 | static void hpt3x2n_set_dmamode(struct ata_port *ap, struct ata_device *adev) | 215 | static void hpt3x2n_set_dmamode(struct ata_port *ap, struct ata_device *adev) |
205 | { | 216 | { |
206 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 217 | hpt3x2n_set_mode(ap, adev, adev->dma_mode); |
207 | u32 addr1, addr2; | ||
208 | u32 reg, mode, mask; | ||
209 | u8 fast; | ||
210 | |||
211 | addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); | ||
212 | addr2 = 0x51 + 4 * ap->port_no; | ||
213 | |||
214 | /* Fast interrupt prediction disable, hold off interrupt disable */ | ||
215 | pci_read_config_byte(pdev, addr2, &fast); | ||
216 | fast &= ~0x07; | ||
217 | pci_write_config_byte(pdev, addr2, fast); | ||
218 | |||
219 | mask = adev->dma_mode < XFER_UDMA_0 ? 0x31C001FF : 0x303C0000; | ||
220 | |||
221 | pci_read_config_dword(pdev, addr1, ®); | ||
222 | mode = hpt3x2n_find_mode(ap, adev->dma_mode); | ||
223 | mode &= mask; | ||
224 | reg &= ~mask; | ||
225 | pci_write_config_dword(pdev, addr1, reg | mode); | ||
226 | } | 218 | } |
227 | 219 | ||
228 | /** | 220 | /** |
@@ -544,19 +536,19 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
544 | pci_mhz); | 536 | pci_mhz); |
545 | /* Set our private data up. We only need a few flags so we use | 537 | /* Set our private data up. We only need a few flags so we use |
546 | it directly */ | 538 | it directly */ |
547 | if (pci_mhz > 60) { | 539 | if (pci_mhz > 60) |
548 | hpriv = (void *)(PCI66 | USE_DPLL); | 540 | hpriv = (void *)(PCI66 | USE_DPLL); |
549 | /* | 541 | |
550 | * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in | 542 | /* |
551 | * the MISC. register to stretch the UltraDMA Tss timing. | 543 | * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in |
552 | * NOTE: This register is only writeable via I/O space. | 544 | * the MISC. register to stretch the UltraDMA Tss timing. |
553 | */ | 545 | * NOTE: This register is only writeable via I/O space. |
554 | if (dev->device == PCI_DEVICE_ID_TTI_HPT371) | 546 | */ |
555 | outb(inb(iobase + 0x9c) | 0x04, iobase + 0x9c); | 547 | if (dev->device == PCI_DEVICE_ID_TTI_HPT371) |
556 | } | 548 | outb(inb(iobase + 0x9c) | 0x04, iobase + 0x9c); |
557 | 549 | ||
558 | /* Now kick off ATA set up */ | 550 | /* Now kick off ATA set up */ |
559 | return ata_pci_sff_init_one(dev, ppi, &hpt3x2n_sht, hpriv); | 551 | return ata_pci_sff_init_one(dev, ppi, &hpt3x2n_sht, hpriv, 0); |
560 | } | 552 | } |
561 | 553 | ||
562 | static const struct pci_device_id hpt3x2n[] = { | 554 | static const struct pci_device_id hpt3x2n[] = { |
diff --git a/drivers/ata/pata_it8213.c b/drivers/ata/pata_it8213.c index 8f3325adceb3..f971f0de88e6 100644 --- a/drivers/ata/pata_it8213.c +++ b/drivers/ata/pata_it8213.c | |||
@@ -273,7 +273,7 @@ static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *en | |||
273 | dev_printk(KERN_DEBUG, &pdev->dev, | 273 | dev_printk(KERN_DEBUG, &pdev->dev, |
274 | "version " DRV_VERSION "\n"); | 274 | "version " DRV_VERSION "\n"); |
275 | 275 | ||
276 | return ata_pci_sff_init_one(pdev, ppi, &it8213_sht, NULL); | 276 | return ata_pci_sff_init_one(pdev, ppi, &it8213_sht, NULL, 0); |
277 | } | 277 | } |
278 | 278 | ||
279 | static const struct pci_device_id it8213_pci_tbl[] = { | 279 | static const struct pci_device_id it8213_pci_tbl[] = { |
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index edc5c1fed150..9bde1cb5f981 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
@@ -932,7 +932,7 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
932 | else | 932 | else |
933 | ppi[0] = &info_smart; | 933 | ppi[0] = &info_smart; |
934 | } | 934 | } |
935 | return ata_pci_sff_init_one(pdev, ppi, &it821x_sht, NULL); | 935 | return ata_pci_sff_init_one(pdev, ppi, &it821x_sht, NULL, 0); |
936 | } | 936 | } |
937 | 937 | ||
938 | #ifdef CONFIG_PM | 938 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c index 3a1474ac8838..565e01e6ac7c 100644 --- a/drivers/ata/pata_jmicron.c +++ b/drivers/ata/pata_jmicron.c | |||
@@ -144,7 +144,7 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i | |||
144 | }; | 144 | }; |
145 | const struct ata_port_info *ppi[] = { &info, NULL }; | 145 | const struct ata_port_info *ppi[] = { &info, NULL }; |
146 | 146 | ||
147 | return ata_pci_sff_init_one(pdev, ppi, &jmicron_sht, NULL); | 147 | return ata_pci_sff_init_one(pdev, ppi, &jmicron_sht, NULL, 0); |
148 | } | 148 | } |
149 | 149 | ||
150 | static const struct pci_device_id jmicron_pci_tbl[] = { | 150 | static const struct pci_device_id jmicron_pci_tbl[] = { |
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c index 950da39cae3d..e8ca02e5a71d 100644 --- a/drivers/ata/pata_marvell.c +++ b/drivers/ata/pata_marvell.c | |||
@@ -147,13 +147,13 @@ static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *i | |||
147 | if (pdev->device == 0x6101) | 147 | if (pdev->device == 0x6101) |
148 | ppi[1] = &ata_dummy_port_info; | 148 | ppi[1] = &ata_dummy_port_info; |
149 | 149 | ||
150 | #if defined(CONFIG_AHCI) || defined(CONFIG_AHCI_MODULE) | 150 | #if defined(CONFIG_SATA_AHCI) || defined(CONFIG_SATA_AHCI_MODULE) |
151 | if (!marvell_pata_active(pdev)) { | 151 | if (!marvell_pata_active(pdev)) { |
152 | printk(KERN_INFO DRV_NAME ": PATA port not active, deferring to AHCI driver.\n"); | 152 | printk(KERN_INFO DRV_NAME ": PATA port not active, deferring to AHCI driver.\n"); |
153 | return -ENODEV; | 153 | return -ENODEV; |
154 | } | 154 | } |
155 | #endif | 155 | #endif |
156 | return ata_pci_sff_init_one(pdev, ppi, &marvell_sht, NULL); | 156 | return ata_pci_sff_init_one(pdev, ppi, &marvell_sht, NULL, 0); |
157 | } | 157 | } |
158 | 158 | ||
159 | static const struct pci_device_id marvell_pci_tbl[] = { | 159 | static const struct pci_device_id marvell_pci_tbl[] = { |
diff --git a/drivers/ata/pata_netcell.c b/drivers/ata/pata_netcell.c index f0d52f72f5bb..94f979a7f4f7 100644 --- a/drivers/ata/pata_netcell.c +++ b/drivers/ata/pata_netcell.c | |||
@@ -82,7 +82,7 @@ static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
82 | ata_pci_bmdma_clear_simplex(pdev); | 82 | ata_pci_bmdma_clear_simplex(pdev); |
83 | 83 | ||
84 | /* And let the library code do the work */ | 84 | /* And let the library code do the work */ |
85 | return ata_pci_sff_init_one(pdev, port_info, &netcell_sht, NULL); | 85 | return ata_pci_sff_init_one(pdev, port_info, &netcell_sht, NULL, 0); |
86 | } | 86 | } |
87 | 87 | ||
88 | static const struct pci_device_id netcell_pci_tbl[] = { | 88 | static const struct pci_device_id netcell_pci_tbl[] = { |
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c index ca53fac06717..2110863bb3db 100644 --- a/drivers/ata/pata_ns87410.c +++ b/drivers/ata/pata_ns87410.c | |||
@@ -148,7 +148,7 @@ static int ns87410_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
148 | .port_ops = &ns87410_port_ops | 148 | .port_ops = &ns87410_port_ops |
149 | }; | 149 | }; |
150 | const struct ata_port_info *ppi[] = { &info, NULL }; | 150 | const struct ata_port_info *ppi[] = { &info, NULL }; |
151 | return ata_pci_sff_init_one(dev, ppi, &ns87410_sht, NULL); | 151 | return ata_pci_sff_init_one(dev, ppi, &ns87410_sht, NULL, 0); |
152 | } | 152 | } |
153 | 153 | ||
154 | static const struct pci_device_id ns87410[] = { | 154 | static const struct pci_device_id ns87410[] = { |
diff --git a/drivers/ata/pata_ns87415.c b/drivers/ata/pata_ns87415.c index 061aa1c41a48..830431f036a1 100644 --- a/drivers/ata/pata_ns87415.c +++ b/drivers/ata/pata_ns87415.c | |||
@@ -380,7 +380,7 @@ static int ns87415_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
380 | 380 | ||
381 | ns87415_fixup(pdev); | 381 | ns87415_fixup(pdev); |
382 | 382 | ||
383 | return ata_pci_sff_init_one(pdev, ppi, &ns87415_sht, NULL); | 383 | return ata_pci_sff_init_one(pdev, ppi, &ns87415_sht, NULL, 0); |
384 | } | 384 | } |
385 | 385 | ||
386 | static const struct pci_device_id ns87415_pci_tbl[] = { | 386 | static const struct pci_device_id ns87415_pci_tbl[] = { |
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c index 9a8687db6b2d..5f6aba7eb0dd 100644 --- a/drivers/ata/pata_oldpiix.c +++ b/drivers/ata/pata_oldpiix.c | |||
@@ -248,7 +248,7 @@ static int oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
248 | dev_printk(KERN_DEBUG, &pdev->dev, | 248 | dev_printk(KERN_DEBUG, &pdev->dev, |
249 | "version " DRV_VERSION "\n"); | 249 | "version " DRV_VERSION "\n"); |
250 | 250 | ||
251 | return ata_pci_sff_init_one(pdev, ppi, &oldpiix_sht, NULL); | 251 | return ata_pci_sff_init_one(pdev, ppi, &oldpiix_sht, NULL, 0); |
252 | } | 252 | } |
253 | 253 | ||
254 | static const struct pci_device_id oldpiix_pci_tbl[] = { | 254 | static const struct pci_device_id oldpiix_pci_tbl[] = { |
diff --git a/drivers/ata/pata_opti.c b/drivers/ata/pata_opti.c index 99eddda2d2e5..00c5a02a94fc 100644 --- a/drivers/ata/pata_opti.c +++ b/drivers/ata/pata_opti.c | |||
@@ -172,7 +172,7 @@ static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
172 | if (!printed_version++) | 172 | if (!printed_version++) |
173 | dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); | 173 | dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); |
174 | 174 | ||
175 | return ata_pci_sff_init_one(dev, ppi, &opti_sht, NULL); | 175 | return ata_pci_sff_init_one(dev, ppi, &opti_sht, NULL, 0); |
176 | } | 176 | } |
177 | 177 | ||
178 | static const struct pci_device_id opti[] = { | 178 | static const struct pci_device_id opti[] = { |
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c index 86885a445f97..76b7d12b1e8d 100644 --- a/drivers/ata/pata_optidma.c +++ b/drivers/ata/pata_optidma.c | |||
@@ -429,7 +429,7 @@ static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
429 | if (optiplus_with_udma(dev)) | 429 | if (optiplus_with_udma(dev)) |
430 | ppi[0] = &info_82c700_udma; | 430 | ppi[0] = &info_82c700_udma; |
431 | 431 | ||
432 | return ata_pci_sff_init_one(dev, ppi, &optidma_sht, NULL); | 432 | return ata_pci_sff_init_one(dev, ppi, &optidma_sht, NULL, 0); |
433 | } | 433 | } |
434 | 434 | ||
435 | static const struct pci_device_id optidma[] = { | 435 | static const struct pci_device_id optidma[] = { |
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index 1b392c9e8531..36103531feeb 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c | |||
@@ -136,7 +136,7 @@ static unsigned int ata_data_xfer_8bit(struct ata_device *dev, | |||
136 | * | 136 | * |
137 | */ | 137 | */ |
138 | 138 | ||
139 | void pcmcia_8bit_drain_fifo(struct ata_queued_cmd *qc) | 139 | static void pcmcia_8bit_drain_fifo(struct ata_queued_cmd *qc) |
140 | { | 140 | { |
141 | int count; | 141 | int count; |
142 | struct ata_port *ap; | 142 | struct ata_port *ap; |
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c index 2f3c9bed63d9..9ac0897cf8b0 100644 --- a/drivers/ata/pata_pdc202xx_old.c +++ b/drivers/ata/pata_pdc202xx_old.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * pata_pdc202xx_old.c - Promise PDC202xx PATA for new ATA layer | 2 | * pata_pdc202xx_old.c - Promise PDC202xx PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * Alan Cox <alan@lxorguk.ukuu.org.uk> | 4 | * Alan Cox <alan@lxorguk.ukuu.org.uk> |
5 | * (C) 2007,2009 Bartlomiej Zolnierkiewicz | 5 | * (C) 2007,2009,2010 Bartlomiej Zolnierkiewicz |
6 | * | 6 | * |
7 | * Based in part on linux/drivers/ide/pci/pdc202xx_old.c | 7 | * Based in part on linux/drivers/ide/pci/pdc202xx_old.c |
8 | * | 8 | * |
@@ -35,6 +35,15 @@ static int pdc2026x_cable_detect(struct ata_port *ap) | |||
35 | return ATA_CBL_PATA80; | 35 | return ATA_CBL_PATA80; |
36 | } | 36 | } |
37 | 37 | ||
38 | static void pdc202xx_exec_command(struct ata_port *ap, | ||
39 | const struct ata_taskfile *tf) | ||
40 | { | ||
41 | DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command); | ||
42 | |||
43 | iowrite8(tf->command, ap->ioaddr.command_addr); | ||
44 | ndelay(400); | ||
45 | } | ||
46 | |||
38 | /** | 47 | /** |
39 | * pdc202xx_configure_piomode - set chip PIO timing | 48 | * pdc202xx_configure_piomode - set chip PIO timing |
40 | * @ap: ATA interface | 49 | * @ap: ATA interface |
@@ -271,6 +280,8 @@ static struct ata_port_operations pdc2024x_port_ops = { | |||
271 | .cable_detect = ata_cable_40wire, | 280 | .cable_detect = ata_cable_40wire, |
272 | .set_piomode = pdc202xx_set_piomode, | 281 | .set_piomode = pdc202xx_set_piomode, |
273 | .set_dmamode = pdc202xx_set_dmamode, | 282 | .set_dmamode = pdc202xx_set_dmamode, |
283 | |||
284 | .sff_exec_command = pdc202xx_exec_command, | ||
274 | }; | 285 | }; |
275 | 286 | ||
276 | static struct ata_port_operations pdc2026x_port_ops = { | 287 | static struct ata_port_operations pdc2026x_port_ops = { |
@@ -284,6 +295,8 @@ static struct ata_port_operations pdc2026x_port_ops = { | |||
284 | .dev_config = pdc2026x_dev_config, | 295 | .dev_config = pdc2026x_dev_config, |
285 | 296 | ||
286 | .port_start = pdc2026x_port_start, | 297 | .port_start = pdc2026x_port_start, |
298 | |||
299 | .sff_exec_command = pdc202xx_exec_command, | ||
287 | }; | 300 | }; |
288 | 301 | ||
289 | static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 302 | static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
@@ -324,7 +337,7 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id | |||
324 | return -ENODEV; | 337 | return -ENODEV; |
325 | } | 338 | } |
326 | } | 339 | } |
327 | return ata_pci_sff_init_one(dev, ppi, &pdc202xx_sht, NULL); | 340 | return ata_pci_sff_init_one(dev, ppi, &pdc202xx_sht, NULL, 0); |
328 | } | 341 | } |
329 | 342 | ||
330 | static const struct pci_device_id pdc202xx[] = { | 343 | static const struct pci_device_id pdc202xx[] = { |
diff --git a/drivers/ata/pata_piccolo.c b/drivers/ata/pata_piccolo.c index bfe0180f3efa..981615414849 100644 --- a/drivers/ata/pata_piccolo.c +++ b/drivers/ata/pata_piccolo.c | |||
@@ -95,7 +95,7 @@ static int ata_tosh_init_one(struct pci_dev *dev, const struct pci_device_id *id | |||
95 | }; | 95 | }; |
96 | const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; | 96 | const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; |
97 | /* Just one port for the moment */ | 97 | /* Just one port for the moment */ |
98 | return ata_pci_sff_init_one(dev, ppi, &tosh_sht, NULL); | 98 | return ata_pci_sff_init_one(dev, ppi, &tosh_sht, NULL, 0); |
99 | } | 99 | } |
100 | 100 | ||
101 | static struct pci_device_id ata_tosh[] = { | 101 | static struct pci_device_id ata_tosh[] = { |
diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c index 4fd25e737d9a..fc9602229acb 100644 --- a/drivers/ata/pata_radisys.c +++ b/drivers/ata/pata_radisys.c | |||
@@ -227,7 +227,7 @@ static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
227 | dev_printk(KERN_DEBUG, &pdev->dev, | 227 | dev_printk(KERN_DEBUG, &pdev->dev, |
228 | "version " DRV_VERSION "\n"); | 228 | "version " DRV_VERSION "\n"); |
229 | 229 | ||
230 | return ata_pci_sff_init_one(pdev, ppi, &radisys_sht, NULL); | 230 | return ata_pci_sff_init_one(pdev, ppi, &radisys_sht, NULL, 0); |
231 | } | 231 | } |
232 | 232 | ||
233 | static const struct pci_device_id radisys_pci_tbl[] = { | 233 | static const struct pci_device_id radisys_pci_tbl[] = { |
diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c index 2932998fc4c6..4a454a88aa9d 100644 --- a/drivers/ata/pata_rz1000.c +++ b/drivers/ata/pata_rz1000.c | |||
@@ -95,7 +95,7 @@ static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *en | |||
95 | printk_once(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); | 95 | printk_once(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); |
96 | 96 | ||
97 | if (rz1000_fifo_disable(pdev) == 0) | 97 | if (rz1000_fifo_disable(pdev) == 0) |
98 | return ata_pci_sff_init_one(pdev, ppi, &rz1000_sht, NULL); | 98 | return ata_pci_sff_init_one(pdev, ppi, &rz1000_sht, NULL, 0); |
99 | 99 | ||
100 | printk(KERN_ERR DRV_NAME ": failed to disable read-ahead on chipset..\n"); | 100 | printk(KERN_ERR DRV_NAME ": failed to disable read-ahead on chipset..\n"); |
101 | /* Not safe to use so skip */ | 101 | /* Not safe to use so skip */ |
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c index 3bbed8322ecf..dfecc6f964b0 100644 --- a/drivers/ata/pata_sc1200.c +++ b/drivers/ata/pata_sc1200.c | |||
@@ -237,7 +237,7 @@ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
237 | }; | 237 | }; |
238 | const struct ata_port_info *ppi[] = { &info, NULL }; | 238 | const struct ata_port_info *ppi[] = { &info, NULL }; |
239 | 239 | ||
240 | return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL); | 240 | return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL, 0); |
241 | } | 241 | } |
242 | 242 | ||
243 | static const struct pci_device_id sc1200[] = { | 243 | static const struct pci_device_id sc1200[] = { |
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c index beaed12d50e4..9524d54035f7 100644 --- a/drivers/ata/pata_serverworks.c +++ b/drivers/ata/pata_serverworks.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * pata_serverworks.c - Serverworks PATA for new ATA layer | 2 | * pata_serverworks.c - Serverworks PATA for new ATA layer |
3 | * (C) 2005 Red Hat Inc | 3 | * (C) 2005 Red Hat Inc |
4 | * (C) 2010 Bartlomiej Zolnierkiewicz | ||
4 | * | 5 | * |
5 | * based upon | 6 | * based upon |
6 | * | 7 | * |
@@ -253,7 +254,7 @@ static void serverworks_set_piomode(struct ata_port *ap, struct ata_device *adev | |||
253 | if (serverworks_is_csb(pdev)) { | 254 | if (serverworks_is_csb(pdev)) { |
254 | pci_read_config_word(pdev, 0x4A, &csb5_pio); | 255 | pci_read_config_word(pdev, 0x4A, &csb5_pio); |
255 | csb5_pio &= ~(0x0F << devbits); | 256 | csb5_pio &= ~(0x0F << devbits); |
256 | pci_write_config_byte(pdev, 0x4A, csb5_pio | (pio << devbits)); | 257 | pci_write_config_word(pdev, 0x4A, csb5_pio | (pio << devbits)); |
257 | } | 258 | } |
258 | } | 259 | } |
259 | 260 | ||
@@ -327,7 +328,7 @@ static int serverworks_fixup_osb4(struct pci_dev *pdev) | |||
327 | pci_dev_put(isa_dev); | 328 | pci_dev_put(isa_dev); |
328 | return 0; | 329 | return 0; |
329 | } | 330 | } |
330 | printk(KERN_WARNING "ata_serverworks: Unable to find bridge.\n"); | 331 | printk(KERN_WARNING DRV_NAME ": Unable to find bridge.\n"); |
331 | return -ENODEV; | 332 | return -ENODEV; |
332 | } | 333 | } |
333 | 334 | ||
@@ -459,7 +460,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id | |||
459 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) | 460 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) |
460 | ata_pci_bmdma_clear_simplex(pdev); | 461 | ata_pci_bmdma_clear_simplex(pdev); |
461 | 462 | ||
462 | return ata_pci_sff_init_one(pdev, ppi, &serverworks_sht, NULL); | 463 | return ata_pci_sff_init_one(pdev, ppi, &serverworks_sht, NULL, 0); |
463 | } | 464 | } |
464 | 465 | ||
465 | #ifdef CONFIG_PM | 466 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c index a2ace48a4610..c6c589c23ffc 100644 --- a/drivers/ata/pata_sil680.c +++ b/drivers/ata/pata_sil680.c | |||
@@ -356,7 +356,7 @@ static int __devinit sil680_init_one(struct pci_dev *pdev, | |||
356 | IRQF_SHARED, &sil680_sht); | 356 | IRQF_SHARED, &sil680_sht); |
357 | 357 | ||
358 | use_ioports: | 358 | use_ioports: |
359 | return ata_pci_sff_init_one(pdev, ppi, &sil680_sht, NULL); | 359 | return ata_pci_sff_init_one(pdev, ppi, &sil680_sht, NULL, 0); |
360 | } | 360 | } |
361 | 361 | ||
362 | #ifdef CONFIG_PM | 362 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index 5c30d56dec84..b6708032f321 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c | |||
@@ -826,7 +826,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
826 | 826 | ||
827 | sis_fixup(pdev, chipset); | 827 | sis_fixup(pdev, chipset); |
828 | 828 | ||
829 | return ata_pci_sff_init_one(pdev, ppi, &sis_sht, chipset); | 829 | return ata_pci_sff_init_one(pdev, ppi, &sis_sht, chipset, 0); |
830 | } | 830 | } |
831 | 831 | ||
832 | #ifdef CONFIG_PM | 832 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c index 29f733c32066..733b042a7469 100644 --- a/drivers/ata/pata_sl82c105.c +++ b/drivers/ata/pata_sl82c105.c | |||
@@ -316,7 +316,7 @@ static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id | |||
316 | val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; | 316 | val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; |
317 | pci_write_config_dword(dev, 0x40, val); | 317 | pci_write_config_dword(dev, 0x40, val); |
318 | 318 | ||
319 | return ata_pci_sff_init_one(dev, ppi, &sl82c105_sht, NULL); | 319 | return ata_pci_sff_init_one(dev, ppi, &sl82c105_sht, NULL, 0); |
320 | } | 320 | } |
321 | 321 | ||
322 | static const struct pci_device_id sl82c105[] = { | 322 | static const struct pci_device_id sl82c105[] = { |
diff --git a/drivers/ata/pata_triflex.c b/drivers/ata/pata_triflex.c index f1f13ff222fd..48f50600ed2a 100644 --- a/drivers/ata/pata_triflex.c +++ b/drivers/ata/pata_triflex.c | |||
@@ -201,7 +201,7 @@ static int triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
201 | if (!printed_version++) | 201 | if (!printed_version++) |
202 | dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); | 202 | dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); |
203 | 203 | ||
204 | return ata_pci_sff_init_one(dev, ppi, &triflex_sht, NULL); | 204 | return ata_pci_sff_init_one(dev, ppi, &triflex_sht, NULL, 0); |
205 | } | 205 | } |
206 | 206 | ||
207 | static const struct pci_device_id triflex[] = { | 207 | static const struct pci_device_id triflex[] = { |
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 0d97890af681..3059ec017de3 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -22,6 +22,7 @@ | |||
22 | * VIA VT8233c - UDMA100 | 22 | * VIA VT8233c - UDMA100 |
23 | * VIA VT8235 - UDMA133 | 23 | * VIA VT8235 - UDMA133 |
24 | * VIA VT8237 - UDMA133 | 24 | * VIA VT8237 - UDMA133 |
25 | * VIA VT8237A - UDMA133 | ||
25 | * VIA VT8237S - UDMA133 | 26 | * VIA VT8237S - UDMA133 |
26 | * VIA VT8251 - UDMA133 | 27 | * VIA VT8251 - UDMA133 |
27 | * | 28 | * |
@@ -64,26 +65,15 @@ | |||
64 | #define DRV_NAME "pata_via" | 65 | #define DRV_NAME "pata_via" |
65 | #define DRV_VERSION "0.3.4" | 66 | #define DRV_VERSION "0.3.4" |
66 | 67 | ||
67 | /* | ||
68 | * The following comes directly from Vojtech Pavlik's ide/pci/via82cxxx | ||
69 | * driver. | ||
70 | */ | ||
71 | |||
72 | enum { | 68 | enum { |
73 | VIA_UDMA = 0x007, | 69 | VIA_BAD_PREQ = 0x01, /* Crashes if PREQ# till DDACK# set */ |
74 | VIA_UDMA_NONE = 0x000, | 70 | VIA_BAD_CLK66 = 0x02, /* 66 MHz clock doesn't work correctly */ |
75 | VIA_UDMA_33 = 0x001, | 71 | VIA_SET_FIFO = 0x04, /* Needs to have FIFO split set */ |
76 | VIA_UDMA_66 = 0x002, | 72 | VIA_NO_UNMASK = 0x08, /* Doesn't work with IRQ unmasking on */ |
77 | VIA_UDMA_100 = 0x003, | 73 | VIA_BAD_ID = 0x10, /* Has wrong vendor ID (0x1107) */ |
78 | VIA_UDMA_133 = 0x004, | 74 | VIA_BAD_AST = 0x20, /* Don't touch Address Setup Timing */ |
79 | VIA_BAD_PREQ = 0x010, /* Crashes if PREQ# till DDACK# set */ | 75 | VIA_NO_ENABLES = 0x40, /* Has no enablebits */ |
80 | VIA_BAD_CLK66 = 0x020, /* 66 MHz clock doesn't work correctly */ | 76 | VIA_SATA_PATA = 0x80, /* SATA/PATA combined configuration */ |
81 | VIA_SET_FIFO = 0x040, /* Needs to have FIFO split set */ | ||
82 | VIA_NO_UNMASK = 0x080, /* Doesn't work with IRQ unmasking on */ | ||
83 | VIA_BAD_ID = 0x100, /* Has wrong vendor ID (0x1107) */ | ||
84 | VIA_BAD_AST = 0x200, /* Don't touch Address Setup Timing */ | ||
85 | VIA_NO_ENABLES = 0x400, /* Has no enablebits */ | ||
86 | VIA_SATA_PATA = 0x800, /* SATA/PATA combined configuration */ | ||
87 | }; | 77 | }; |
88 | 78 | ||
89 | enum { | 79 | enum { |
@@ -99,40 +89,37 @@ static const struct via_isa_bridge { | |||
99 | u16 id; | 89 | u16 id; |
100 | u8 rev_min; | 90 | u8 rev_min; |
101 | u8 rev_max; | 91 | u8 rev_max; |
102 | u16 flags; | 92 | u8 udma_mask; |
93 | u8 flags; | ||
103 | } via_isa_bridges[] = { | 94 | } via_isa_bridges[] = { |
104 | { "vx855", PCI_DEVICE_ID_VIA_VX855, 0x00, 0x2f, | 95 | { "vx855", PCI_DEVICE_ID_VIA_VX855, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST | VIA_SATA_PATA }, |
105 | VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, | 96 | { "vx800", PCI_DEVICE_ID_VIA_VX800, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST | VIA_SATA_PATA }, |
106 | { "vx800", PCI_DEVICE_ID_VIA_VX800, 0x00, 0x2f, VIA_UDMA_133 | | 97 | { "vt8261", PCI_DEVICE_ID_VIA_8261, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, |
107 | VIA_BAD_AST | VIA_SATA_PATA }, | 98 | { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, |
108 | { "vt8261", PCI_DEVICE_ID_VIA_8261, 0x00, 0x2f, | 99 | { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, |
109 | VIA_UDMA_133 | VIA_BAD_AST }, | 100 | { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST | VIA_SATA_PATA }, |
110 | { "vt8237s", PCI_DEVICE_ID_VIA_8237S, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 101 | { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST | VIA_NO_ENABLES }, |
111 | { "vt8251", PCI_DEVICE_ID_VIA_8251, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 102 | { "vt6415", PCI_DEVICE_ID_VIA_6415, 0x00, 0xff, ATA_UDMA6, VIA_BAD_AST | VIA_NO_ENABLES }, |
112 | { "cx700", PCI_DEVICE_ID_VIA_CX700, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA }, | 103 | { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, |
113 | { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, | 104 | { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, |
114 | { "vt6415", PCI_DEVICE_ID_VIA_6415, 0x00, 0xff, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES }, | 105 | { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, |
115 | { "vt8237a", PCI_DEVICE_ID_VIA_8237A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 106 | { "vt8233a", PCI_DEVICE_ID_VIA_8233A, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, |
116 | { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 107 | { "vt8233c", PCI_DEVICE_ID_VIA_8233C_0, 0x00, 0x2f, ATA_UDMA5, }, |
117 | { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 108 | { "vt8233", PCI_DEVICE_ID_VIA_8233_0, 0x00, 0x2f, ATA_UDMA5, }, |
118 | { "vt8233a", PCI_DEVICE_ID_VIA_8233A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, | 109 | { "vt8231", PCI_DEVICE_ID_VIA_8231, 0x00, 0x2f, ATA_UDMA5, }, |
119 | { "vt8233c", PCI_DEVICE_ID_VIA_8233C_0, 0x00, 0x2f, VIA_UDMA_100 }, | 110 | { "vt82c686b", PCI_DEVICE_ID_VIA_82C686, 0x40, 0x4f, ATA_UDMA5, }, |
120 | { "vt8233", PCI_DEVICE_ID_VIA_8233_0, 0x00, 0x2f, VIA_UDMA_100 }, | 111 | { "vt82c686a", PCI_DEVICE_ID_VIA_82C686, 0x10, 0x2f, ATA_UDMA4, }, |
121 | { "vt8231", PCI_DEVICE_ID_VIA_8231, 0x00, 0x2f, VIA_UDMA_100 }, | 112 | { "vt82c686", PCI_DEVICE_ID_VIA_82C686, 0x00, 0x0f, ATA_UDMA2, VIA_BAD_CLK66 }, |
122 | { "vt82c686b", PCI_DEVICE_ID_VIA_82C686, 0x40, 0x4f, VIA_UDMA_100 }, | 113 | { "vt82c596b", PCI_DEVICE_ID_VIA_82C596, 0x10, 0x2f, ATA_UDMA4, }, |
123 | { "vt82c686a", PCI_DEVICE_ID_VIA_82C686, 0x10, 0x2f, VIA_UDMA_66 }, | 114 | { "vt82c596a", PCI_DEVICE_ID_VIA_82C596, 0x00, 0x0f, ATA_UDMA2, VIA_BAD_CLK66 }, |
124 | { "vt82c686", PCI_DEVICE_ID_VIA_82C686, 0x00, 0x0f, VIA_UDMA_33 | VIA_BAD_CLK66 }, | 115 | { "vt82c586b", PCI_DEVICE_ID_VIA_82C586_0, 0x47, 0x4f, ATA_UDMA2, VIA_SET_FIFO }, |
125 | { "vt82c596b", PCI_DEVICE_ID_VIA_82C596, 0x10, 0x2f, VIA_UDMA_66 }, | 116 | { "vt82c586b", PCI_DEVICE_ID_VIA_82C586_0, 0x40, 0x46, ATA_UDMA2, VIA_SET_FIFO | VIA_BAD_PREQ }, |
126 | { "vt82c596a", PCI_DEVICE_ID_VIA_82C596, 0x00, 0x0f, VIA_UDMA_33 | VIA_BAD_CLK66 }, | 117 | { "vt82c586b", PCI_DEVICE_ID_VIA_82C586_0, 0x30, 0x3f, ATA_UDMA2, VIA_SET_FIFO }, |
127 | { "vt82c586b", PCI_DEVICE_ID_VIA_82C586_0, 0x47, 0x4f, VIA_UDMA_33 | VIA_SET_FIFO }, | 118 | { "vt82c586a", PCI_DEVICE_ID_VIA_82C586_0, 0x20, 0x2f, ATA_UDMA2, VIA_SET_FIFO }, |
128 | { "vt82c586b", PCI_DEVICE_ID_VIA_82C586_0, 0x40, 0x46, VIA_UDMA_33 | VIA_SET_FIFO | VIA_BAD_PREQ }, | 119 | { "vt82c586", PCI_DEVICE_ID_VIA_82C586_0, 0x00, 0x0f, 0x00, VIA_SET_FIFO }, |
129 | { "vt82c586b", PCI_DEVICE_ID_VIA_82C586_0, 0x30, 0x3f, VIA_UDMA_33 | VIA_SET_FIFO }, | 120 | { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, 0x00, VIA_SET_FIFO | VIA_NO_UNMASK }, |
130 | { "vt82c586a", PCI_DEVICE_ID_VIA_82C586_0, 0x20, 0x2f, VIA_UDMA_33 | VIA_SET_FIFO }, | 121 | { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, 0x00, VIA_SET_FIFO | VIA_NO_UNMASK | VIA_BAD_ID }, |
131 | { "vt82c586", PCI_DEVICE_ID_VIA_82C586_0, 0x00, 0x0f, VIA_UDMA_NONE | VIA_SET_FIFO }, | 122 | { "vtxxxx", PCI_DEVICE_ID_VIA_ANON, 0x00, 0x2f, ATA_UDMA6, VIA_BAD_AST }, |
132 | { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, VIA_UDMA_NONE | VIA_SET_FIFO | VIA_NO_UNMASK }, | ||
133 | { "vt82c576", PCI_DEVICE_ID_VIA_82C576, 0x00, 0x2f, VIA_UDMA_NONE | VIA_SET_FIFO | VIA_NO_UNMASK | VIA_BAD_ID }, | ||
134 | { "vtxxxx", PCI_DEVICE_ID_VIA_ANON, 0x00, 0x2f, | ||
135 | VIA_UDMA_133 | VIA_BAD_AST }, | ||
136 | { NULL } | 123 | { NULL } |
137 | }; | 124 | }; |
138 | 125 | ||
@@ -191,10 +178,10 @@ static int via_cable_detect(struct ata_port *ap) { | |||
191 | return ATA_CBL_SATA; | 178 | return ATA_CBL_SATA; |
192 | 179 | ||
193 | /* Early chips are 40 wire */ | 180 | /* Early chips are 40 wire */ |
194 | if ((config->flags & VIA_UDMA) < VIA_UDMA_66) | 181 | if (config->udma_mask < ATA_UDMA4) |
195 | return ATA_CBL_PATA40; | 182 | return ATA_CBL_PATA40; |
196 | /* UDMA 66 chips have only drive side logic */ | 183 | /* UDMA 66 chips have only drive side logic */ |
197 | else if ((config->flags & VIA_UDMA) < VIA_UDMA_100) | 184 | else if (config->udma_mask < ATA_UDMA5) |
198 | return ATA_CBL_PATA_UNK; | 185 | return ATA_CBL_PATA_UNK; |
199 | /* UDMA 100 or later */ | 186 | /* UDMA 100 or later */ |
200 | pci_read_config_dword(pdev, 0x50, &ata66); | 187 | pci_read_config_dword(pdev, 0x50, &ata66); |
@@ -229,11 +216,10 @@ static int via_pre_reset(struct ata_link *link, unsigned long deadline) | |||
229 | 216 | ||
230 | 217 | ||
231 | /** | 218 | /** |
232 | * via_do_set_mode - set initial PIO mode data | 219 | * via_do_set_mode - set transfer mode data |
233 | * @ap: ATA interface | 220 | * @ap: ATA interface |
234 | * @adev: ATA device | 221 | * @adev: ATA device |
235 | * @mode: ATA mode being programmed | 222 | * @mode: ATA mode being programmed |
236 | * @tdiv: Clocks per PCI clock | ||
237 | * @set_ast: Set to program address setup | 223 | * @set_ast: Set to program address setup |
238 | * @udma_type: UDMA mode/format of registers | 224 | * @udma_type: UDMA mode/format of registers |
239 | * | 225 | * |
@@ -244,17 +230,27 @@ static int via_pre_reset(struct ata_link *link, unsigned long deadline) | |||
244 | * on the two channels. | 230 | * on the two channels. |
245 | */ | 231 | */ |
246 | 232 | ||
247 | static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, int mode, int tdiv, int set_ast, int udma_type) | 233 | static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, |
234 | int mode, int set_ast, int udma_type) | ||
248 | { | 235 | { |
249 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 236 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
250 | struct ata_device *peer = ata_dev_pair(adev); | 237 | struct ata_device *peer = ata_dev_pair(adev); |
251 | struct ata_timing t, p; | 238 | struct ata_timing t, p; |
252 | static int via_clock = 33333; /* Bus clock in kHZ - ought to be tunable one day */ | 239 | static int via_clock = 33333; /* Bus clock in kHZ */ |
253 | unsigned long T = 1000000000 / via_clock; | 240 | unsigned long T = 1000000000 / via_clock; |
254 | unsigned long UT = T/tdiv; | 241 | unsigned long UT = T; |
255 | int ut; | 242 | int ut; |
256 | int offset = 3 - (2*ap->port_no) - adev->devno; | 243 | int offset = 3 - (2*ap->port_no) - adev->devno; |
257 | 244 | ||
245 | switch (udma_type) { | ||
246 | case ATA_UDMA4: | ||
247 | UT = T / 2; break; | ||
248 | case ATA_UDMA5: | ||
249 | UT = T / 3; break; | ||
250 | case ATA_UDMA6: | ||
251 | UT = T / 4; break; | ||
252 | } | ||
253 | |||
258 | /* Calculate the timing values we require */ | 254 | /* Calculate the timing values we require */ |
259 | ata_timing_compute(adev, mode, &t, T, UT); | 255 | ata_timing_compute(adev, mode, &t, T, UT); |
260 | 256 | ||
@@ -273,7 +269,7 @@ static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, int mo | |||
273 | 269 | ||
274 | pci_read_config_byte(pdev, 0x4C, &setup); | 270 | pci_read_config_byte(pdev, 0x4C, &setup); |
275 | setup &= ~(3 << shift); | 271 | setup &= ~(3 << shift); |
276 | setup |= clamp_val(t.setup, 1, 4) << shift; /* 1,4 or 1,4 - 1 FIXME */ | 272 | setup |= (clamp_val(t.setup, 1, 4) - 1) << shift; |
277 | pci_write_config_byte(pdev, 0x4C, setup); | 273 | pci_write_config_byte(pdev, 0x4C, setup); |
278 | } | 274 | } |
279 | 275 | ||
@@ -284,22 +280,20 @@ static void via_do_set_mode(struct ata_port *ap, struct ata_device *adev, int mo | |||
284 | ((clamp_val(t.active, 1, 16) - 1) << 4) | (clamp_val(t.recover, 1, 16) - 1)); | 280 | ((clamp_val(t.active, 1, 16) - 1) << 4) | (clamp_val(t.recover, 1, 16) - 1)); |
285 | 281 | ||
286 | /* Load the UDMA bits according to type */ | 282 | /* Load the UDMA bits according to type */ |
287 | switch(udma_type) { | 283 | switch (udma_type) { |
288 | default: | 284 | case ATA_UDMA2: |
289 | /* BUG() ? */ | 285 | default: |
290 | /* fall through */ | 286 | ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 5) - 2)) : 0x03; |
291 | case 33: | 287 | break; |
292 | ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 5) - 2)) : 0x03; | 288 | case ATA_UDMA4: |
293 | break; | 289 | ut = t.udma ? (0xe8 | (clamp_val(t.udma, 2, 9) - 2)) : 0x0f; |
294 | case 66: | 290 | break; |
295 | ut = t.udma ? (0xe8 | (clamp_val(t.udma, 2, 9) - 2)) : 0x0f; | 291 | case ATA_UDMA5: |
296 | break; | 292 | ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07; |
297 | case 100: | 293 | break; |
298 | ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07; | 294 | case ATA_UDMA6: |
299 | break; | 295 | ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07; |
300 | case 133: | 296 | break; |
301 | ut = t.udma ? (0xe0 | (clamp_val(t.udma, 2, 9) - 2)) : 0x07; | ||
302 | break; | ||
303 | } | 297 | } |
304 | 298 | ||
305 | /* Set UDMA unless device is not UDMA capable */ | 299 | /* Set UDMA unless device is not UDMA capable */ |
@@ -325,22 +319,16 @@ static void via_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
325 | { | 319 | { |
326 | const struct via_isa_bridge *config = ap->host->private_data; | 320 | const struct via_isa_bridge *config = ap->host->private_data; |
327 | int set_ast = (config->flags & VIA_BAD_AST) ? 0 : 1; | 321 | int set_ast = (config->flags & VIA_BAD_AST) ? 0 : 1; |
328 | int mode = config->flags & VIA_UDMA; | ||
329 | static u8 tclock[5] = { 1, 1, 2, 3, 4 }; | ||
330 | static u8 udma[5] = { 0, 33, 66, 100, 133 }; | ||
331 | 322 | ||
332 | via_do_set_mode(ap, adev, adev->pio_mode, tclock[mode], set_ast, udma[mode]); | 323 | via_do_set_mode(ap, adev, adev->pio_mode, set_ast, config->udma_mask); |
333 | } | 324 | } |
334 | 325 | ||
335 | static void via_set_dmamode(struct ata_port *ap, struct ata_device *adev) | 326 | static void via_set_dmamode(struct ata_port *ap, struct ata_device *adev) |
336 | { | 327 | { |
337 | const struct via_isa_bridge *config = ap->host->private_data; | 328 | const struct via_isa_bridge *config = ap->host->private_data; |
338 | int set_ast = (config->flags & VIA_BAD_AST) ? 0 : 1; | 329 | int set_ast = (config->flags & VIA_BAD_AST) ? 0 : 1; |
339 | int mode = config->flags & VIA_UDMA; | ||
340 | static u8 tclock[5] = { 1, 1, 2, 3, 4 }; | ||
341 | static u8 udma[5] = { 0, 33, 66, 100, 133 }; | ||
342 | 330 | ||
343 | via_do_set_mode(ap, adev, adev->dma_mode, tclock[mode], set_ast, udma[mode]); | 331 | via_do_set_mode(ap, adev, adev->dma_mode, set_ast, config->udma_mask); |
344 | } | 332 | } |
345 | 333 | ||
346 | /** | 334 | /** |
@@ -604,33 +592,29 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
604 | via_config_fifo(pdev, config->flags); | 592 | via_config_fifo(pdev, config->flags); |
605 | 593 | ||
606 | /* Clock set up */ | 594 | /* Clock set up */ |
607 | switch(config->flags & VIA_UDMA) { | 595 | switch (config->udma_mask) { |
608 | case VIA_UDMA_NONE: | 596 | case 0x00: |
609 | if (config->flags & VIA_NO_UNMASK) | 597 | if (config->flags & VIA_NO_UNMASK) |
610 | ppi[0] = &via_mwdma_info_borked; | 598 | ppi[0] = &via_mwdma_info_borked; |
611 | else | 599 | else |
612 | ppi[0] = &via_mwdma_info; | 600 | ppi[0] = &via_mwdma_info; |
613 | break; | 601 | break; |
614 | case VIA_UDMA_33: | 602 | case ATA_UDMA2: |
615 | ppi[0] = &via_udma33_info; | 603 | ppi[0] = &via_udma33_info; |
616 | break; | 604 | break; |
617 | case VIA_UDMA_66: | 605 | case ATA_UDMA4: |
618 | ppi[0] = &via_udma66_info; | 606 | ppi[0] = &via_udma66_info; |
619 | /* The 66 MHz devices require we enable the clock */ | 607 | break; |
620 | pci_read_config_dword(pdev, 0x50, &timing); | 608 | case ATA_UDMA5: |
621 | timing |= 0x80008; | 609 | ppi[0] = &via_udma100_info; |
622 | pci_write_config_dword(pdev, 0x50, timing); | 610 | break; |
623 | break; | 611 | case ATA_UDMA6: |
624 | case VIA_UDMA_100: | 612 | ppi[0] = &via_udma133_info; |
625 | ppi[0] = &via_udma100_info; | 613 | break; |
626 | break; | 614 | default: |
627 | case VIA_UDMA_133: | 615 | WARN_ON(1); |
628 | ppi[0] = &via_udma133_info; | 616 | return -ENODEV; |
629 | break; | 617 | } |
630 | default: | ||
631 | WARN_ON(1); | ||
632 | return -ENODEV; | ||
633 | } | ||
634 | 618 | ||
635 | if (config->flags & VIA_BAD_CLK66) { | 619 | if (config->flags & VIA_BAD_CLK66) { |
636 | /* Disable the 66MHz clock on problem devices */ | 620 | /* Disable the 66MHz clock on problem devices */ |
@@ -640,7 +624,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
640 | } | 624 | } |
641 | 625 | ||
642 | /* We have established the device type, now fire it up */ | 626 | /* We have established the device type, now fire it up */ |
643 | return ata_pci_sff_init_one(pdev, ppi, &via_sht, (void *)config); | 627 | return ata_pci_sff_init_one(pdev, ppi, &via_sht, (void *)config, 0); |
644 | } | 628 | } |
645 | 629 | ||
646 | #ifdef CONFIG_PM | 630 | #ifdef CONFIG_PM |
@@ -667,7 +651,7 @@ static int via_reinit_one(struct pci_dev *pdev) | |||
667 | 651 | ||
668 | via_config_fifo(pdev, config->flags); | 652 | via_config_fifo(pdev, config->flags); |
669 | 653 | ||
670 | if ((config->flags & VIA_UDMA) == VIA_UDMA_66) { | 654 | if (config->udma_mask == ATA_UDMA4) { |
671 | /* The 66 MHz devices require we enable the clock */ | 655 | /* The 66 MHz devices require we enable the clock */ |
672 | pci_read_config_dword(pdev, 0x50, &timing); | 656 | pci_read_config_dword(pdev, 0x50, &timing); |
673 | timing |= 0x80008; | 657 | timing |= 0x80008; |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index 0c82d335c55d..684fe04dbbb7 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -772,7 +772,7 @@ static int nv_adma_slave_config(struct scsi_device *sdev) | |||
772 | } | 772 | } |
773 | 773 | ||
774 | blk_queue_segment_boundary(sdev->request_queue, segment_boundary); | 774 | blk_queue_segment_boundary(sdev->request_queue, segment_boundary); |
775 | blk_queue_max_hw_segments(sdev->request_queue, sg_tablesize); | 775 | blk_queue_max_segments(sdev->request_queue, sg_tablesize); |
776 | ata_port_printk(ap, KERN_INFO, | 776 | ata_port_printk(ap, KERN_INFO, |
777 | "DMA mask 0x%llX, segment boundary 0x%lX, hw segs %hu\n", | 777 | "DMA mask 0x%llX, segment boundary 0x%lX, hw segs %hu\n", |
778 | (unsigned long long)*ap->host->dev->dma_mask, | 778 | (unsigned long long)*ap->host->dev->dma_mask, |
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index 02efd9a83d26..08f65492cc81 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -40,11 +40,13 @@ | |||
40 | #include <linux/blkdev.h> | 40 | #include <linux/blkdev.h> |
41 | #include <linux/delay.h> | 41 | #include <linux/delay.h> |
42 | #include <linux/device.h> | 42 | #include <linux/device.h> |
43 | #include <scsi/scsi.h> | ||
44 | #include <scsi/scsi_cmnd.h> | ||
43 | #include <scsi/scsi_host.h> | 45 | #include <scsi/scsi_host.h> |
44 | #include <linux/libata.h> | 46 | #include <linux/libata.h> |
45 | 47 | ||
46 | #define DRV_NAME "sata_via" | 48 | #define DRV_NAME "sata_via" |
47 | #define DRV_VERSION "2.4" | 49 | #define DRV_VERSION "2.6" |
48 | 50 | ||
49 | /* | 51 | /* |
50 | * vt8251 is different from other sata controllers of VIA. It has two | 52 | * vt8251 is different from other sata controllers of VIA. It has two |
@@ -80,6 +82,7 @@ static int vt8251_scr_write(struct ata_link *link, unsigned int scr, u32 val); | |||
80 | static void svia_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); | 82 | static void svia_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); |
81 | static void svia_noop_freeze(struct ata_port *ap); | 83 | static void svia_noop_freeze(struct ata_port *ap); |
82 | static int vt6420_prereset(struct ata_link *link, unsigned long deadline); | 84 | static int vt6420_prereset(struct ata_link *link, unsigned long deadline); |
85 | static void vt6420_bmdma_start(struct ata_queued_cmd *qc); | ||
83 | static int vt6421_pata_cable_detect(struct ata_port *ap); | 86 | static int vt6421_pata_cable_detect(struct ata_port *ap); |
84 | static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev); | 87 | static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev); |
85 | static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev); | 88 | static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev); |
@@ -121,6 +124,7 @@ static struct ata_port_operations vt6420_sata_ops = { | |||
121 | .inherits = &svia_base_ops, | 124 | .inherits = &svia_base_ops, |
122 | .freeze = svia_noop_freeze, | 125 | .freeze = svia_noop_freeze, |
123 | .prereset = vt6420_prereset, | 126 | .prereset = vt6420_prereset, |
127 | .bmdma_start = vt6420_bmdma_start, | ||
124 | }; | 128 | }; |
125 | 129 | ||
126 | static struct ata_port_operations vt6421_pata_ops = { | 130 | static struct ata_port_operations vt6421_pata_ops = { |
@@ -377,6 +381,17 @@ static int vt6420_prereset(struct ata_link *link, unsigned long deadline) | |||
377 | return 0; | 381 | return 0; |
378 | } | 382 | } |
379 | 383 | ||
384 | static void vt6420_bmdma_start(struct ata_queued_cmd *qc) | ||
385 | { | ||
386 | struct ata_port *ap = qc->ap; | ||
387 | if ((qc->tf.command == ATA_CMD_PACKET) && | ||
388 | (qc->scsicmd->sc_data_direction == DMA_TO_DEVICE)) { | ||
389 | /* Prevents corruption on some ATAPI burners */ | ||
390 | ata_sff_pause(ap); | ||
391 | } | ||
392 | ata_bmdma_start(qc); | ||
393 | } | ||
394 | |||
380 | static int vt6421_pata_cable_detect(struct ata_port *ap) | 395 | static int vt6421_pata_cable_detect(struct ata_port *ap) |
381 | { | 396 | { |
382 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 397 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
@@ -392,14 +407,16 @@ static void vt6421_set_pio_mode(struct ata_port *ap, struct ata_device *adev) | |||
392 | { | 407 | { |
393 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 408 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
394 | static const u8 pio_bits[] = { 0xA8, 0x65, 0x65, 0x31, 0x20 }; | 409 | static const u8 pio_bits[] = { 0xA8, 0x65, 0x65, 0x31, 0x20 }; |
395 | pci_write_config_byte(pdev, PATA_PIO_TIMING, pio_bits[adev->pio_mode - XFER_PIO_0]); | 410 | pci_write_config_byte(pdev, PATA_PIO_TIMING - adev->devno, |
411 | pio_bits[adev->pio_mode - XFER_PIO_0]); | ||
396 | } | 412 | } |
397 | 413 | ||
398 | static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev) | 414 | static void vt6421_set_dma_mode(struct ata_port *ap, struct ata_device *adev) |
399 | { | 415 | { |
400 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | 416 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); |
401 | static const u8 udma_bits[] = { 0xEE, 0xE8, 0xE6, 0xE4, 0xE2, 0xE1, 0xE0, 0xE0 }; | 417 | static const u8 udma_bits[] = { 0xEE, 0xE8, 0xE6, 0xE4, 0xE2, 0xE1, 0xE0, 0xE0 }; |
402 | pci_write_config_byte(pdev, PATA_UDMA_TIMING, udma_bits[adev->dma_mode - XFER_UDMA_0]); | 418 | pci_write_config_byte(pdev, PATA_UDMA_TIMING - adev->devno, |
419 | udma_bits[adev->dma_mode - XFER_UDMA_0]); | ||
403 | } | 420 | } |
404 | 421 | ||
405 | static const unsigned int svia_bar_sizes[] = { | 422 | static const unsigned int svia_bar_sizes[] = { |
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index ce1fa923c414..459f1bc25a7b 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -2534,8 +2534,8 @@ static bool DAC960_RegisterBlockDevice(DAC960_Controller_T *Controller) | |||
2534 | blk_queue_bounce_limit(RequestQueue, Controller->BounceBufferLimit); | 2534 | blk_queue_bounce_limit(RequestQueue, Controller->BounceBufferLimit); |
2535 | RequestQueue->queuedata = Controller; | 2535 | RequestQueue->queuedata = Controller; |
2536 | blk_queue_max_hw_segments(RequestQueue, Controller->DriverScatterGatherLimit); | 2536 | blk_queue_max_hw_segments(RequestQueue, Controller->DriverScatterGatherLimit); |
2537 | blk_queue_max_phys_segments(RequestQueue, Controller->DriverScatterGatherLimit); | 2537 | blk_queue_max_segments(RequestQueue, Controller->DriverScatterGatherLimit); |
2538 | blk_queue_max_sectors(RequestQueue, Controller->MaxBlocksPerCommand); | 2538 | blk_queue_max_hw_sectors(RequestQueue, Controller->MaxBlocksPerCommand); |
2539 | disk->queue = RequestQueue; | 2539 | disk->queue = RequestQueue; |
2540 | sprintf(disk->disk_name, "rd/c%dd%d", Controller->ControllerNumber, n); | 2540 | sprintf(disk->disk_name, "rd/c%dd%d", Controller->ControllerNumber, n); |
2541 | disk->major = MajorNumber; | 2541 | disk->major = MajorNumber; |
@@ -7134,7 +7134,7 @@ static struct DAC960_privdata DAC960_P_privdata = { | |||
7134 | .MemoryWindowSize = DAC960_PD_RegisterWindowSize, | 7134 | .MemoryWindowSize = DAC960_PD_RegisterWindowSize, |
7135 | }; | 7135 | }; |
7136 | 7136 | ||
7137 | static struct pci_device_id DAC960_id_table[] = { | 7137 | static const struct pci_device_id DAC960_id_table[] = { |
7138 | { | 7138 | { |
7139 | .vendor = PCI_VENDOR_ID_MYLEX, | 7139 | .vendor = PCI_VENDOR_ID_MYLEX, |
7140 | .device = PCI_DEVICE_ID_MYLEX_DAC960_GEM, | 7140 | .device = PCI_DEVICE_ID_MYLEX_DAC960_GEM, |
diff --git a/drivers/block/brd.c b/drivers/block/brd.c index 4f688434daf1..c6ddeacb77fd 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c | |||
@@ -434,7 +434,7 @@ static struct brd_device *brd_alloc(int i) | |||
434 | goto out_free_dev; | 434 | goto out_free_dev; |
435 | blk_queue_make_request(brd->brd_queue, brd_make_request); | 435 | blk_queue_make_request(brd->brd_queue, brd_make_request); |
436 | blk_queue_ordered(brd->brd_queue, QUEUE_ORDERED_TAG, NULL); | 436 | blk_queue_ordered(brd->brd_queue, QUEUE_ORDERED_TAG, NULL); |
437 | blk_queue_max_sectors(brd->brd_queue, 1024); | 437 | blk_queue_max_hw_sectors(brd->brd_queue, 1024); |
438 | blk_queue_bounce_limit(brd->brd_queue, BLK_BOUNCE_ANY); | 438 | blk_queue_bounce_limit(brd->brd_queue, BLK_BOUNCE_ANY); |
439 | 439 | ||
440 | disk = brd->brd_disk = alloc_disk(1 << part_shift); | 440 | disk = brd->brd_disk = alloc_disk(1 << part_shift); |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 9291614ac6b7..9e3af307aae1 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -257,6 +257,79 @@ static inline void removeQ(CommandList_struct *c) | |||
257 | hlist_del_init(&c->list); | 257 | hlist_del_init(&c->list); |
258 | } | 258 | } |
259 | 259 | ||
260 | static void cciss_free_sg_chain_blocks(SGDescriptor_struct **cmd_sg_list, | ||
261 | int nr_cmds) | ||
262 | { | ||
263 | int i; | ||
264 | |||
265 | if (!cmd_sg_list) | ||
266 | return; | ||
267 | for (i = 0; i < nr_cmds; i++) { | ||
268 | kfree(cmd_sg_list[i]); | ||
269 | cmd_sg_list[i] = NULL; | ||
270 | } | ||
271 | kfree(cmd_sg_list); | ||
272 | } | ||
273 | |||
274 | static SGDescriptor_struct **cciss_allocate_sg_chain_blocks( | ||
275 | ctlr_info_t *h, int chainsize, int nr_cmds) | ||
276 | { | ||
277 | int j; | ||
278 | SGDescriptor_struct **cmd_sg_list; | ||
279 | |||
280 | if (chainsize <= 0) | ||
281 | return NULL; | ||
282 | |||
283 | cmd_sg_list = kmalloc(sizeof(*cmd_sg_list) * nr_cmds, GFP_KERNEL); | ||
284 | if (!cmd_sg_list) | ||
285 | return NULL; | ||
286 | |||
287 | /* Build up chain blocks for each command */ | ||
288 | for (j = 0; j < nr_cmds; j++) { | ||
289 | /* Need a block of chainsized s/g elements. */ | ||
290 | cmd_sg_list[j] = kmalloc((chainsize * | ||
291 | sizeof(*cmd_sg_list[j])), GFP_KERNEL); | ||
292 | if (!cmd_sg_list[j]) { | ||
293 | dev_err(&h->pdev->dev, "Cannot get memory " | ||
294 | "for s/g chains.\n"); | ||
295 | goto clean; | ||
296 | } | ||
297 | } | ||
298 | return cmd_sg_list; | ||
299 | clean: | ||
300 | cciss_free_sg_chain_blocks(cmd_sg_list, nr_cmds); | ||
301 | return NULL; | ||
302 | } | ||
303 | |||
304 | static void cciss_unmap_sg_chain_block(ctlr_info_t *h, CommandList_struct *c) | ||
305 | { | ||
306 | SGDescriptor_struct *chain_sg; | ||
307 | u64bit temp64; | ||
308 | |||
309 | if (c->Header.SGTotal <= h->max_cmd_sgentries) | ||
310 | return; | ||
311 | |||
312 | chain_sg = &c->SG[h->max_cmd_sgentries - 1]; | ||
313 | temp64.val32.lower = chain_sg->Addr.lower; | ||
314 | temp64.val32.upper = chain_sg->Addr.upper; | ||
315 | pci_unmap_single(h->pdev, temp64.val, chain_sg->Len, PCI_DMA_TODEVICE); | ||
316 | } | ||
317 | |||
318 | static void cciss_map_sg_chain_block(ctlr_info_t *h, CommandList_struct *c, | ||
319 | SGDescriptor_struct *chain_block, int len) | ||
320 | { | ||
321 | SGDescriptor_struct *chain_sg; | ||
322 | u64bit temp64; | ||
323 | |||
324 | chain_sg = &c->SG[h->max_cmd_sgentries - 1]; | ||
325 | chain_sg->Ext = CCISS_SG_CHAIN; | ||
326 | chain_sg->Len = len; | ||
327 | temp64.val = pci_map_single(h->pdev, chain_block, len, | ||
328 | PCI_DMA_TODEVICE); | ||
329 | chain_sg->Addr.lower = temp64.val32.lower; | ||
330 | chain_sg->Addr.upper = temp64.val32.upper; | ||
331 | } | ||
332 | |||
260 | #include "cciss_scsi.c" /* For SCSI tape support */ | 333 | #include "cciss_scsi.c" /* For SCSI tape support */ |
261 | 334 | ||
262 | static const char *raid_label[] = { "0", "4", "1(1+0)", "5", "5+1", "ADG", | 335 | static const char *raid_label[] = { "0", "4", "1(1+0)", "5", "5+1", "ADG", |
@@ -1344,26 +1417,27 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode, | |||
1344 | kfree(buff); | 1417 | kfree(buff); |
1345 | return -ENOMEM; | 1418 | return -ENOMEM; |
1346 | } | 1419 | } |
1347 | // Fill in the command type | 1420 | /* Fill in the command type */ |
1348 | c->cmd_type = CMD_IOCTL_PEND; | 1421 | c->cmd_type = CMD_IOCTL_PEND; |
1349 | // Fill in Command Header | 1422 | /* Fill in Command Header */ |
1350 | c->Header.ReplyQueue = 0; // unused in simple mode | 1423 | c->Header.ReplyQueue = 0; /* unused in simple mode */ |
1351 | if (iocommand.buf_size > 0) // buffer to fill | 1424 | if (iocommand.buf_size > 0) /* buffer to fill */ |
1352 | { | 1425 | { |
1353 | c->Header.SGList = 1; | 1426 | c->Header.SGList = 1; |
1354 | c->Header.SGTotal = 1; | 1427 | c->Header.SGTotal = 1; |
1355 | } else // no buffers to fill | 1428 | } else /* no buffers to fill */ |
1356 | { | 1429 | { |
1357 | c->Header.SGList = 0; | 1430 | c->Header.SGList = 0; |
1358 | c->Header.SGTotal = 0; | 1431 | c->Header.SGTotal = 0; |
1359 | } | 1432 | } |
1360 | c->Header.LUN = iocommand.LUN_info; | 1433 | c->Header.LUN = iocommand.LUN_info; |
1361 | c->Header.Tag.lower = c->busaddr; // use the kernel address the cmd block for tag | 1434 | /* use the kernel address the cmd block for tag */ |
1435 | c->Header.Tag.lower = c->busaddr; | ||
1362 | 1436 | ||
1363 | // Fill in Request block | 1437 | /* Fill in Request block */ |
1364 | c->Request = iocommand.Request; | 1438 | c->Request = iocommand.Request; |
1365 | 1439 | ||
1366 | // Fill in the scatter gather information | 1440 | /* Fill in the scatter gather information */ |
1367 | if (iocommand.buf_size > 0) { | 1441 | if (iocommand.buf_size > 0) { |
1368 | temp64.val = pci_map_single(host->pdev, buff, | 1442 | temp64.val = pci_map_single(host->pdev, buff, |
1369 | iocommand.buf_size, | 1443 | iocommand.buf_size, |
@@ -1371,7 +1445,7 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode, | |||
1371 | c->SG[0].Addr.lower = temp64.val32.lower; | 1445 | c->SG[0].Addr.lower = temp64.val32.lower; |
1372 | c->SG[0].Addr.upper = temp64.val32.upper; | 1446 | c->SG[0].Addr.upper = temp64.val32.upper; |
1373 | c->SG[0].Len = iocommand.buf_size; | 1447 | c->SG[0].Len = iocommand.buf_size; |
1374 | c->SG[0].Ext = 0; // we are not chaining | 1448 | c->SG[0].Ext = 0; /* we are not chaining */ |
1375 | } | 1449 | } |
1376 | c->waiting = &wait; | 1450 | c->waiting = &wait; |
1377 | 1451 | ||
@@ -1670,14 +1744,9 @@ static void cciss_softirq_done(struct request *rq) | |||
1670 | /* unmap the DMA mapping for all the scatter gather elements */ | 1744 | /* unmap the DMA mapping for all the scatter gather elements */ |
1671 | for (i = 0; i < cmd->Header.SGList; i++) { | 1745 | for (i = 0; i < cmd->Header.SGList; i++) { |
1672 | if (curr_sg[sg_index].Ext == CCISS_SG_CHAIN) { | 1746 | if (curr_sg[sg_index].Ext == CCISS_SG_CHAIN) { |
1673 | temp64.val32.lower = cmd->SG[i].Addr.lower; | 1747 | cciss_unmap_sg_chain_block(h, cmd); |
1674 | temp64.val32.upper = cmd->SG[i].Addr.upper; | ||
1675 | pci_dma_sync_single_for_cpu(h->pdev, temp64.val, | ||
1676 | cmd->SG[i].Len, ddir); | ||
1677 | pci_unmap_single(h->pdev, temp64.val, | ||
1678 | cmd->SG[i].Len, ddir); | ||
1679 | /* Point to the next block */ | 1748 | /* Point to the next block */ |
1680 | curr_sg = h->cmd_sg_list[cmd->cmdindex]->sgchain; | 1749 | curr_sg = h->cmd_sg_list[cmd->cmdindex]; |
1681 | sg_index = 0; | 1750 | sg_index = 0; |
1682 | } | 1751 | } |
1683 | temp64.val32.lower = curr_sg[sg_index].Addr.lower; | 1752 | temp64.val32.lower = curr_sg[sg_index].Addr.lower; |
@@ -1796,12 +1865,9 @@ static int cciss_add_disk(ctlr_info_t *h, struct gendisk *disk, | |||
1796 | blk_queue_bounce_limit(disk->queue, h->pdev->dma_mask); | 1865 | blk_queue_bounce_limit(disk->queue, h->pdev->dma_mask); |
1797 | 1866 | ||
1798 | /* This is a hardware imposed limit. */ | 1867 | /* This is a hardware imposed limit. */ |
1799 | blk_queue_max_hw_segments(disk->queue, h->maxsgentries); | 1868 | blk_queue_max_segments(disk->queue, h->maxsgentries); |
1800 | |||
1801 | /* This is a limit in the driver and could be eliminated. */ | ||
1802 | blk_queue_max_phys_segments(disk->queue, h->maxsgentries); | ||
1803 | 1869 | ||
1804 | blk_queue_max_sectors(disk->queue, h->cciss_max_sectors); | 1870 | blk_queue_max_hw_sectors(disk->queue, h->cciss_max_sectors); |
1805 | 1871 | ||
1806 | blk_queue_softirq_done(disk->queue, cciss_softirq_done); | 1872 | blk_queue_softirq_done(disk->queue, cciss_softirq_done); |
1807 | 1873 | ||
@@ -2425,7 +2491,7 @@ static int fill_cmd(CommandList_struct *c, __u8 cmd, int ctlr, void *buff, | |||
2425 | c->Request.Type.Direction = XFER_READ; | 2491 | c->Request.Type.Direction = XFER_READ; |
2426 | c->Request.Timeout = 0; | 2492 | c->Request.Timeout = 0; |
2427 | c->Request.CDB[0] = cmd; | 2493 | c->Request.CDB[0] = cmd; |
2428 | c->Request.CDB[6] = (size >> 24) & 0xFF; //MSB | 2494 | c->Request.CDB[6] = (size >> 24) & 0xFF; /* MSB */ |
2429 | c->Request.CDB[7] = (size >> 16) & 0xFF; | 2495 | c->Request.CDB[7] = (size >> 16) & 0xFF; |
2430 | c->Request.CDB[8] = (size >> 8) & 0xFF; | 2496 | c->Request.CDB[8] = (size >> 8) & 0xFF; |
2431 | c->Request.CDB[9] = size & 0xFF; | 2497 | c->Request.CDB[9] = size & 0xFF; |
@@ -2694,7 +2760,7 @@ static void cciss_geometry_inquiry(int ctlr, int logvol, | |||
2694 | "cciss: reading geometry failed, volume " | 2760 | "cciss: reading geometry failed, volume " |
2695 | "does not support reading geometry\n"); | 2761 | "does not support reading geometry\n"); |
2696 | drv->heads = 255; | 2762 | drv->heads = 255; |
2697 | drv->sectors = 32; // Sectors per track | 2763 | drv->sectors = 32; /* Sectors per track */ |
2698 | drv->cylinders = total_size + 1; | 2764 | drv->cylinders = total_size + 1; |
2699 | drv->raid_level = RAID_UNKNOWN; | 2765 | drv->raid_level = RAID_UNKNOWN; |
2700 | } else { | 2766 | } else { |
@@ -3082,7 +3148,6 @@ static void do_cciss_request(struct request_queue *q) | |||
3082 | SGDescriptor_struct *curr_sg; | 3148 | SGDescriptor_struct *curr_sg; |
3083 | drive_info_struct *drv; | 3149 | drive_info_struct *drv; |
3084 | int i, dir; | 3150 | int i, dir; |
3085 | int nseg = 0; | ||
3086 | int sg_index = 0; | 3151 | int sg_index = 0; |
3087 | int chained = 0; | 3152 | int chained = 0; |
3088 | 3153 | ||
@@ -3112,19 +3177,19 @@ static void do_cciss_request(struct request_queue *q) | |||
3112 | 3177 | ||
3113 | /* fill in the request */ | 3178 | /* fill in the request */ |
3114 | drv = creq->rq_disk->private_data; | 3179 | drv = creq->rq_disk->private_data; |
3115 | c->Header.ReplyQueue = 0; // unused in simple mode | 3180 | c->Header.ReplyQueue = 0; /* unused in simple mode */ |
3116 | /* got command from pool, so use the command block index instead */ | 3181 | /* got command from pool, so use the command block index instead */ |
3117 | /* for direct lookups. */ | 3182 | /* for direct lookups. */ |
3118 | /* The first 2 bits are reserved for controller error reporting. */ | 3183 | /* The first 2 bits are reserved for controller error reporting. */ |
3119 | c->Header.Tag.lower = (c->cmdindex << 3); | 3184 | c->Header.Tag.lower = (c->cmdindex << 3); |
3120 | c->Header.Tag.lower |= 0x04; /* flag for direct lookup. */ | 3185 | c->Header.Tag.lower |= 0x04; /* flag for direct lookup. */ |
3121 | memcpy(&c->Header.LUN, drv->LunID, sizeof(drv->LunID)); | 3186 | memcpy(&c->Header.LUN, drv->LunID, sizeof(drv->LunID)); |
3122 | c->Request.CDBLen = 10; // 12 byte commands not in FW yet; | 3187 | c->Request.CDBLen = 10; /* 12 byte commands not in FW yet; */ |
3123 | c->Request.Type.Type = TYPE_CMD; // It is a command. | 3188 | c->Request.Type.Type = TYPE_CMD; /* It is a command. */ |
3124 | c->Request.Type.Attribute = ATTR_SIMPLE; | 3189 | c->Request.Type.Attribute = ATTR_SIMPLE; |
3125 | c->Request.Type.Direction = | 3190 | c->Request.Type.Direction = |
3126 | (rq_data_dir(creq) == READ) ? XFER_READ : XFER_WRITE; | 3191 | (rq_data_dir(creq) == READ) ? XFER_READ : XFER_WRITE; |
3127 | c->Request.Timeout = 0; // Don't time out | 3192 | c->Request.Timeout = 0; /* Don't time out */ |
3128 | c->Request.CDB[0] = | 3193 | c->Request.CDB[0] = |
3129 | (rq_data_dir(creq) == READ) ? h->cciss_read : h->cciss_write; | 3194 | (rq_data_dir(creq) == READ) ? h->cciss_read : h->cciss_write; |
3130 | start_blk = blk_rq_pos(creq); | 3195 | start_blk = blk_rq_pos(creq); |
@@ -3149,13 +3214,8 @@ static void do_cciss_request(struct request_queue *q) | |||
3149 | for (i = 0; i < seg; i++) { | 3214 | for (i = 0; i < seg; i++) { |
3150 | if (((sg_index+1) == (h->max_cmd_sgentries)) && | 3215 | if (((sg_index+1) == (h->max_cmd_sgentries)) && |
3151 | !chained && ((seg - i) > 1)) { | 3216 | !chained && ((seg - i) > 1)) { |
3152 | nseg = seg - i; | ||
3153 | curr_sg[sg_index].Len = (nseg) * | ||
3154 | sizeof(SGDescriptor_struct); | ||
3155 | curr_sg[sg_index].Ext = CCISS_SG_CHAIN; | ||
3156 | |||
3157 | /* Point to next chain block. */ | 3217 | /* Point to next chain block. */ |
3158 | curr_sg = h->cmd_sg_list[c->cmdindex]->sgchain; | 3218 | curr_sg = h->cmd_sg_list[c->cmdindex]; |
3159 | sg_index = 0; | 3219 | sg_index = 0; |
3160 | chained = 1; | 3220 | chained = 1; |
3161 | } | 3221 | } |
@@ -3166,31 +3226,12 @@ static void do_cciss_request(struct request_queue *q) | |||
3166 | curr_sg[sg_index].Addr.lower = temp64.val32.lower; | 3226 | curr_sg[sg_index].Addr.lower = temp64.val32.lower; |
3167 | curr_sg[sg_index].Addr.upper = temp64.val32.upper; | 3227 | curr_sg[sg_index].Addr.upper = temp64.val32.upper; |
3168 | curr_sg[sg_index].Ext = 0; /* we are not chaining */ | 3228 | curr_sg[sg_index].Ext = 0; /* we are not chaining */ |
3169 | |||
3170 | ++sg_index; | 3229 | ++sg_index; |
3171 | } | 3230 | } |
3172 | 3231 | if (chained) | |
3173 | if (chained) { | 3232 | cciss_map_sg_chain_block(h, c, h->cmd_sg_list[c->cmdindex], |
3174 | int len; | 3233 | (seg - (h->max_cmd_sgentries - 1)) * |
3175 | curr_sg = c->SG; | 3234 | sizeof(SGDescriptor_struct)); |
3176 | sg_index = h->max_cmd_sgentries - 1; | ||
3177 | len = curr_sg[sg_index].Len; | ||
3178 | /* Setup pointer to next chain block. | ||
3179 | * Fill out last element in current chain | ||
3180 | * block with address of next chain block. | ||
3181 | */ | ||
3182 | temp64.val = pci_map_single(h->pdev, | ||
3183 | h->cmd_sg_list[c->cmdindex]->sgchain, | ||
3184 | len, dir); | ||
3185 | |||
3186 | h->cmd_sg_list[c->cmdindex]->sg_chain_dma = temp64.val; | ||
3187 | curr_sg[sg_index].Addr.lower = temp64.val32.lower; | ||
3188 | curr_sg[sg_index].Addr.upper = temp64.val32.upper; | ||
3189 | |||
3190 | pci_dma_sync_single_for_device(h->pdev, | ||
3191 | h->cmd_sg_list[c->cmdindex]->sg_chain_dma, | ||
3192 | len, dir); | ||
3193 | } | ||
3194 | 3235 | ||
3195 | /* track how many SG entries we are using */ | 3236 | /* track how many SG entries we are using */ |
3196 | if (seg > h->maxSG) | 3237 | if (seg > h->maxSG) |
@@ -3209,11 +3250,11 @@ static void do_cciss_request(struct request_queue *q) | |||
3209 | if (likely(blk_fs_request(creq))) { | 3250 | if (likely(blk_fs_request(creq))) { |
3210 | if(h->cciss_read == CCISS_READ_10) { | 3251 | if(h->cciss_read == CCISS_READ_10) { |
3211 | c->Request.CDB[1] = 0; | 3252 | c->Request.CDB[1] = 0; |
3212 | c->Request.CDB[2] = (start_blk >> 24) & 0xff; //MSB | 3253 | c->Request.CDB[2] = (start_blk >> 24) & 0xff; /* MSB */ |
3213 | c->Request.CDB[3] = (start_blk >> 16) & 0xff; | 3254 | c->Request.CDB[3] = (start_blk >> 16) & 0xff; |
3214 | c->Request.CDB[4] = (start_blk >> 8) & 0xff; | 3255 | c->Request.CDB[4] = (start_blk >> 8) & 0xff; |
3215 | c->Request.CDB[5] = start_blk & 0xff; | 3256 | c->Request.CDB[5] = start_blk & 0xff; |
3216 | c->Request.CDB[6] = 0; // (sect >> 24) & 0xff; MSB | 3257 | c->Request.CDB[6] = 0; /* (sect >> 24) & 0xff; MSB */ |
3217 | c->Request.CDB[7] = (blk_rq_sectors(creq) >> 8) & 0xff; | 3258 | c->Request.CDB[7] = (blk_rq_sectors(creq) >> 8) & 0xff; |
3218 | c->Request.CDB[8] = blk_rq_sectors(creq) & 0xff; | 3259 | c->Request.CDB[8] = blk_rq_sectors(creq) & 0xff; |
3219 | c->Request.CDB[9] = c->Request.CDB[11] = c->Request.CDB[12] = 0; | 3260 | c->Request.CDB[9] = c->Request.CDB[11] = c->Request.CDB[12] = 0; |
@@ -3222,7 +3263,7 @@ static void do_cciss_request(struct request_queue *q) | |||
3222 | 3263 | ||
3223 | c->Request.CDBLen = 16; | 3264 | c->Request.CDBLen = 16; |
3224 | c->Request.CDB[1]= 0; | 3265 | c->Request.CDB[1]= 0; |
3225 | c->Request.CDB[2]= (upper32 >> 24) & 0xff; //MSB | 3266 | c->Request.CDB[2]= (upper32 >> 24) & 0xff; /* MSB */ |
3226 | c->Request.CDB[3]= (upper32 >> 16) & 0xff; | 3267 | c->Request.CDB[3]= (upper32 >> 16) & 0xff; |
3227 | c->Request.CDB[4]= (upper32 >> 8) & 0xff; | 3268 | c->Request.CDB[4]= (upper32 >> 8) & 0xff; |
3228 | c->Request.CDB[5]= upper32 & 0xff; | 3269 | c->Request.CDB[5]= upper32 & 0xff; |
@@ -4240,37 +4281,10 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
4240 | goto clean4; | 4281 | goto clean4; |
4241 | } | 4282 | } |
4242 | } | 4283 | } |
4243 | hba[i]->cmd_sg_list = kmalloc(sizeof(struct Cmd_sg_list *) * | 4284 | hba[i]->cmd_sg_list = cciss_allocate_sg_chain_blocks(hba[i], |
4244 | hba[i]->nr_cmds, | 4285 | hba[i]->chainsize, hba[i]->nr_cmds); |
4245 | GFP_KERNEL); | 4286 | if (!hba[i]->cmd_sg_list && hba[i]->chainsize > 0) |
4246 | if (!hba[i]->cmd_sg_list) { | ||
4247 | printk(KERN_ERR "cciss%d: Cannot get memory for " | ||
4248 | "s/g chaining.\n", i); | ||
4249 | goto clean4; | 4287 | goto clean4; |
4250 | } | ||
4251 | /* Build up chain blocks for each command */ | ||
4252 | if (hba[i]->chainsize > 0) { | ||
4253 | for (j = 0; j < hba[i]->nr_cmds; j++) { | ||
4254 | hba[i]->cmd_sg_list[j] = | ||
4255 | kmalloc(sizeof(struct Cmd_sg_list), | ||
4256 | GFP_KERNEL); | ||
4257 | if (!hba[i]->cmd_sg_list[j]) { | ||
4258 | printk(KERN_ERR "cciss%d: Cannot get memory " | ||
4259 | "for chain block.\n", i); | ||
4260 | goto clean4; | ||
4261 | } | ||
4262 | /* Need a block of chainsized s/g elements. */ | ||
4263 | hba[i]->cmd_sg_list[j]->sgchain = | ||
4264 | kmalloc((hba[i]->chainsize * | ||
4265 | sizeof(SGDescriptor_struct)), | ||
4266 | GFP_KERNEL); | ||
4267 | if (!hba[i]->cmd_sg_list[j]->sgchain) { | ||
4268 | printk(KERN_ERR "cciss%d: Cannot get memory " | ||
4269 | "for s/g chains\n", i); | ||
4270 | goto clean4; | ||
4271 | } | ||
4272 | } | ||
4273 | } | ||
4274 | 4288 | ||
4275 | spin_lock_init(&hba[i]->lock); | 4289 | spin_lock_init(&hba[i]->lock); |
4276 | 4290 | ||
@@ -4329,16 +4343,7 @@ clean4: | |||
4329 | for (k = 0; k < hba[i]->nr_cmds; k++) | 4343 | for (k = 0; k < hba[i]->nr_cmds; k++) |
4330 | kfree(hba[i]->scatter_list[k]); | 4344 | kfree(hba[i]->scatter_list[k]); |
4331 | kfree(hba[i]->scatter_list); | 4345 | kfree(hba[i]->scatter_list); |
4332 | /* Only free up extra s/g lists if controller supports them */ | 4346 | cciss_free_sg_chain_blocks(hba[i]->cmd_sg_list, hba[i]->nr_cmds); |
4333 | if (hba[i]->chainsize > 0) { | ||
4334 | for (j = 0; j < hba[i]->nr_cmds; j++) { | ||
4335 | if (hba[i]->cmd_sg_list[j]) { | ||
4336 | kfree(hba[i]->cmd_sg_list[j]->sgchain); | ||
4337 | kfree(hba[i]->cmd_sg_list[j]); | ||
4338 | } | ||
4339 | } | ||
4340 | kfree(hba[i]->cmd_sg_list); | ||
4341 | } | ||
4342 | if (hba[i]->cmd_pool) | 4347 | if (hba[i]->cmd_pool) |
4343 | pci_free_consistent(hba[i]->pdev, | 4348 | pci_free_consistent(hba[i]->pdev, |
4344 | hba[i]->nr_cmds * sizeof(CommandList_struct), | 4349 | hba[i]->nr_cmds * sizeof(CommandList_struct), |
@@ -4456,16 +4461,7 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev) | |||
4456 | for (j = 0; j < hba[i]->nr_cmds; j++) | 4461 | for (j = 0; j < hba[i]->nr_cmds; j++) |
4457 | kfree(hba[i]->scatter_list[j]); | 4462 | kfree(hba[i]->scatter_list[j]); |
4458 | kfree(hba[i]->scatter_list); | 4463 | kfree(hba[i]->scatter_list); |
4459 | /* Only free up extra s/g lists if controller supports them */ | 4464 | cciss_free_sg_chain_blocks(hba[i]->cmd_sg_list, hba[i]->nr_cmds); |
4460 | if (hba[i]->chainsize > 0) { | ||
4461 | for (j = 0; j < hba[i]->nr_cmds; j++) { | ||
4462 | if (hba[i]->cmd_sg_list[j]) { | ||
4463 | kfree(hba[i]->cmd_sg_list[j]->sgchain); | ||
4464 | kfree(hba[i]->cmd_sg_list[j]); | ||
4465 | } | ||
4466 | } | ||
4467 | kfree(hba[i]->cmd_sg_list); | ||
4468 | } | ||
4469 | /* | 4465 | /* |
4470 | * Deliberately omit pci_disable_device(): it does something nasty to | 4466 | * Deliberately omit pci_disable_device(): it does something nasty to |
4471 | * Smart Array controllers that pci_enable_device does not undo | 4467 | * Smart Array controllers that pci_enable_device does not undo |
@@ -4498,7 +4494,7 @@ static int __init cciss_init(void) | |||
4498 | * boundary. Given that we use pci_alloc_consistent() to allocate an | 4494 | * boundary. Given that we use pci_alloc_consistent() to allocate an |
4499 | * array of them, the size must be a multiple of 8 bytes. | 4495 | * array of them, the size must be a multiple of 8 bytes. |
4500 | */ | 4496 | */ |
4501 | BUILD_BUG_ON(sizeof(CommandList_struct) % 8); | 4497 | BUILD_BUG_ON(sizeof(CommandList_struct) % COMMANDLIST_ALIGNMENT); |
4502 | 4498 | ||
4503 | printk(KERN_INFO DRIVER_NAME "\n"); | 4499 | printk(KERN_INFO DRIVER_NAME "\n"); |
4504 | 4500 | ||
diff --git a/drivers/block/cciss.h b/drivers/block/cciss.h index 1d95db254069..c5d411174db0 100644 --- a/drivers/block/cciss.h +++ b/drivers/block/cciss.h | |||
@@ -55,18 +55,12 @@ typedef struct _drive_info_struct | |||
55 | char device_initialized; /* indicates whether dev is initialized */ | 55 | char device_initialized; /* indicates whether dev is initialized */ |
56 | } drive_info_struct; | 56 | } drive_info_struct; |
57 | 57 | ||
58 | struct Cmd_sg_list { | ||
59 | SGDescriptor_struct *sgchain; | ||
60 | dma_addr_t sg_chain_dma; | ||
61 | int chain_block_size; | ||
62 | }; | ||
63 | |||
64 | struct ctlr_info | 58 | struct ctlr_info |
65 | { | 59 | { |
66 | int ctlr; | 60 | int ctlr; |
67 | char devname[8]; | 61 | char devname[8]; |
68 | char *product_name; | 62 | char *product_name; |
69 | char firm_ver[4]; // Firmware version | 63 | char firm_ver[4]; /* Firmware version */ |
70 | struct pci_dev *pdev; | 64 | struct pci_dev *pdev; |
71 | __u32 board_id; | 65 | __u32 board_id; |
72 | void __iomem *vaddr; | 66 | void __iomem *vaddr; |
@@ -89,7 +83,7 @@ struct ctlr_info | |||
89 | int maxsgentries; | 83 | int maxsgentries; |
90 | int chainsize; | 84 | int chainsize; |
91 | int max_cmd_sgentries; | 85 | int max_cmd_sgentries; |
92 | struct Cmd_sg_list **cmd_sg_list; | 86 | SGDescriptor_struct **cmd_sg_list; |
93 | 87 | ||
94 | # define DOORBELL_INT 0 | 88 | # define DOORBELL_INT 0 |
95 | # define PERF_MODE_INT 1 | 89 | # define PERF_MODE_INT 1 |
@@ -103,7 +97,7 @@ struct ctlr_info | |||
103 | BYTE cciss_write; | 97 | BYTE cciss_write; |
104 | BYTE cciss_read_capacity; | 98 | BYTE cciss_read_capacity; |
105 | 99 | ||
106 | // information about each logical volume | 100 | /* information about each logical volume */ |
107 | drive_info_struct *drv[CISS_MAX_LUN]; | 101 | drive_info_struct *drv[CISS_MAX_LUN]; |
108 | 102 | ||
109 | struct access_method access; | 103 | struct access_method access; |
@@ -116,7 +110,7 @@ struct ctlr_info | |||
116 | unsigned int maxSG; | 110 | unsigned int maxSG; |
117 | spinlock_t lock; | 111 | spinlock_t lock; |
118 | 112 | ||
119 | //* pointers to command and error info pool */ | 113 | /* pointers to command and error info pool */ |
120 | CommandList_struct *cmd_pool; | 114 | CommandList_struct *cmd_pool; |
121 | dma_addr_t cmd_pool_dhandle; | 115 | dma_addr_t cmd_pool_dhandle; |
122 | ErrorInfo_struct *errinfo_pool; | 116 | ErrorInfo_struct *errinfo_pool; |
@@ -134,12 +128,10 @@ struct ctlr_info | |||
134 | */ | 128 | */ |
135 | int next_to_run; | 129 | int next_to_run; |
136 | 130 | ||
137 | // Disk structures we need to pass back | 131 | /* Disk structures we need to pass back */ |
138 | struct gendisk *gendisk[CISS_MAX_LUN]; | 132 | struct gendisk *gendisk[CISS_MAX_LUN]; |
139 | #ifdef CONFIG_CISS_SCSI_TAPE | 133 | #ifdef CONFIG_CISS_SCSI_TAPE |
140 | void *scsi_ctlr; /* ptr to structure containing scsi related stuff */ | 134 | struct cciss_scsi_adapter_data_t *scsi_ctlr; |
141 | /* list of block side commands the scsi error handling sucked up */ | ||
142 | /* and saved for later processing */ | ||
143 | #endif | 135 | #endif |
144 | unsigned char alive; | 136 | unsigned char alive; |
145 | struct list_head scan_list; | 137 | struct list_head scan_list; |
@@ -315,4 +307,3 @@ struct board_type { | |||
315 | #define CCISS_LOCK(i) (&hba[i]->lock) | 307 | #define CCISS_LOCK(i) (&hba[i]->lock) |
316 | 308 | ||
317 | #endif /* CCISS_H */ | 309 | #endif /* CCISS_H */ |
318 | |||
diff --git a/drivers/block/cciss_cmd.h b/drivers/block/cciss_cmd.h index 6afa700890ff..e624ff959cb6 100644 --- a/drivers/block/cciss_cmd.h +++ b/drivers/block/cciss_cmd.h | |||
@@ -1,31 +1,16 @@ | |||
1 | #ifndef CCISS_CMD_H | 1 | #ifndef CCISS_CMD_H |
2 | #define CCISS_CMD_H | 2 | #define CCISS_CMD_H |
3 | //########################################################################### | 3 | |
4 | //DEFINES | 4 | #include <linux/cciss_defs.h> |
5 | //########################################################################### | 5 | |
6 | /* DEFINES */ | ||
6 | #define CISS_VERSION "1.00" | 7 | #define CISS_VERSION "1.00" |
7 | 8 | ||
8 | //general boundary definitions | 9 | /* general boundary definitions */ |
9 | #define SENSEINFOBYTES 32//note that this value may vary between host implementations | ||
10 | #define MAXSGENTRIES 32 | 10 | #define MAXSGENTRIES 32 |
11 | #define CCISS_SG_CHAIN 0x80000000 | 11 | #define CCISS_SG_CHAIN 0x80000000 |
12 | #define MAXREPLYQS 256 | 12 | #define MAXREPLYQS 256 |
13 | 13 | ||
14 | //Command Status value | ||
15 | #define CMD_SUCCESS 0x0000 | ||
16 | #define CMD_TARGET_STATUS 0x0001 | ||
17 | #define CMD_DATA_UNDERRUN 0x0002 | ||
18 | #define CMD_DATA_OVERRUN 0x0003 | ||
19 | #define CMD_INVALID 0x0004 | ||
20 | #define CMD_PROTOCOL_ERR 0x0005 | ||
21 | #define CMD_HARDWARE_ERR 0x0006 | ||
22 | #define CMD_CONNECTION_LOST 0x0007 | ||
23 | #define CMD_ABORTED 0x0008 | ||
24 | #define CMD_ABORT_FAILED 0x0009 | ||
25 | #define CMD_UNSOLICITED_ABORT 0x000A | ||
26 | #define CMD_TIMEOUT 0x000B | ||
27 | #define CMD_UNABORTABLE 0x000C | ||
28 | |||
29 | /* Unit Attentions ASC's as defined for the MSA2012sa */ | 14 | /* Unit Attentions ASC's as defined for the MSA2012sa */ |
30 | #define POWER_OR_RESET 0x29 | 15 | #define POWER_OR_RESET 0x29 |
31 | #define STATE_CHANGED 0x2a | 16 | #define STATE_CHANGED 0x2a |
@@ -49,30 +34,13 @@ | |||
49 | #define ASYM_ACCESS_CHANGED 0x06 | 34 | #define ASYM_ACCESS_CHANGED 0x06 |
50 | #define LUN_CAPACITY_CHANGED 0x09 | 35 | #define LUN_CAPACITY_CHANGED 0x09 |
51 | 36 | ||
52 | //transfer direction | 37 | /* config space register offsets */ |
53 | #define XFER_NONE 0x00 | ||
54 | #define XFER_WRITE 0x01 | ||
55 | #define XFER_READ 0x02 | ||
56 | #define XFER_RSVD 0x03 | ||
57 | |||
58 | //task attribute | ||
59 | #define ATTR_UNTAGGED 0x00 | ||
60 | #define ATTR_SIMPLE 0x04 | ||
61 | #define ATTR_HEADOFQUEUE 0x05 | ||
62 | #define ATTR_ORDERED 0x06 | ||
63 | #define ATTR_ACA 0x07 | ||
64 | |||
65 | //cdb type | ||
66 | #define TYPE_CMD 0x00 | ||
67 | #define TYPE_MSG 0x01 | ||
68 | |||
69 | //config space register offsets | ||
70 | #define CFG_VENDORID 0x00 | 38 | #define CFG_VENDORID 0x00 |
71 | #define CFG_DEVICEID 0x02 | 39 | #define CFG_DEVICEID 0x02 |
72 | #define CFG_I2OBAR 0x10 | 40 | #define CFG_I2OBAR 0x10 |
73 | #define CFG_MEM1BAR 0x14 | 41 | #define CFG_MEM1BAR 0x14 |
74 | 42 | ||
75 | //i2o space register offsets | 43 | /* i2o space register offsets */ |
76 | #define I2O_IBDB_SET 0x20 | 44 | #define I2O_IBDB_SET 0x20 |
77 | #define I2O_IBDB_CLEAR 0x70 | 45 | #define I2O_IBDB_CLEAR 0x70 |
78 | #define I2O_INT_STATUS 0x30 | 46 | #define I2O_INT_STATUS 0x30 |
@@ -81,7 +49,7 @@ | |||
81 | #define I2O_OBPOST_Q 0x44 | 49 | #define I2O_OBPOST_Q 0x44 |
82 | #define I2O_DMA1_CFG 0x214 | 50 | #define I2O_DMA1_CFG 0x214 |
83 | 51 | ||
84 | //Configuration Table | 52 | /* Configuration Table */ |
85 | #define CFGTBL_ChangeReq 0x00000001l | 53 | #define CFGTBL_ChangeReq 0x00000001l |
86 | #define CFGTBL_AccCmds 0x00000001l | 54 | #define CFGTBL_AccCmds 0x00000001l |
87 | 55 | ||
@@ -103,24 +71,17 @@ typedef union _u64bit | |||
103 | __u64 val; | 71 | __u64 val; |
104 | } u64bit; | 72 | } u64bit; |
105 | 73 | ||
106 | // Type defs used in the following structs | 74 | /* Type defs used in the following structs */ |
107 | #define BYTE __u8 | ||
108 | #define WORD __u16 | ||
109 | #define HWORD __u16 | ||
110 | #define DWORD __u32 | ||
111 | #define QWORD vals32 | 75 | #define QWORD vals32 |
112 | 76 | ||
113 | //########################################################################### | 77 | /* STRUCTURES */ |
114 | //STRUCTURES | ||
115 | //########################################################################### | ||
116 | #define CISS_MAX_LUN 1024 | ||
117 | #define CISS_MAX_PHYS_LUN 1024 | 78 | #define CISS_MAX_PHYS_LUN 1024 |
118 | // SCSI-3 Cmmands | 79 | /* SCSI-3 Cmmands */ |
119 | 80 | ||
120 | #pragma pack(1) | 81 | #pragma pack(1) |
121 | 82 | ||
122 | #define CISS_INQUIRY 0x12 | 83 | #define CISS_INQUIRY 0x12 |
123 | //Date returned | 84 | /* Date returned */ |
124 | typedef struct _InquiryData_struct | 85 | typedef struct _InquiryData_struct |
125 | { | 86 | { |
126 | BYTE data_byte[36]; | 87 | BYTE data_byte[36]; |
@@ -128,7 +89,7 @@ typedef struct _InquiryData_struct | |||
128 | 89 | ||
129 | #define CISS_REPORT_LOG 0xc2 /* Report Logical LUNs */ | 90 | #define CISS_REPORT_LOG 0xc2 /* Report Logical LUNs */ |
130 | #define CISS_REPORT_PHYS 0xc3 /* Report Physical LUNs */ | 91 | #define CISS_REPORT_PHYS 0xc3 /* Report Physical LUNs */ |
131 | // Data returned | 92 | /* Data returned */ |
132 | typedef struct _ReportLUNdata_struct | 93 | typedef struct _ReportLUNdata_struct |
133 | { | 94 | { |
134 | BYTE LUNListLength[4]; | 95 | BYTE LUNListLength[4]; |
@@ -139,8 +100,8 @@ typedef struct _ReportLUNdata_struct | |||
139 | #define CCISS_READ_CAPACITY 0x25 /* Read Capacity */ | 100 | #define CCISS_READ_CAPACITY 0x25 /* Read Capacity */ |
140 | typedef struct _ReadCapdata_struct | 101 | typedef struct _ReadCapdata_struct |
141 | { | 102 | { |
142 | BYTE total_size[4]; // Total size in blocks | 103 | BYTE total_size[4]; /* Total size in blocks */ |
143 | BYTE block_size[4]; // Size of blocks in bytes | 104 | BYTE block_size[4]; /* Size of blocks in bytes */ |
144 | } ReadCapdata_struct; | 105 | } ReadCapdata_struct; |
145 | 106 | ||
146 | #define CCISS_READ_CAPACITY_16 0x9e /* Read Capacity 16 */ | 107 | #define CCISS_READ_CAPACITY_16 0x9e /* Read Capacity 16 */ |
@@ -172,52 +133,13 @@ typedef struct _ReadCapdata_struct_16 | |||
172 | #define CDB_LEN10 10 | 133 | #define CDB_LEN10 10 |
173 | #define CDB_LEN16 16 | 134 | #define CDB_LEN16 16 |
174 | 135 | ||
175 | // BMIC commands | 136 | /* BMIC commands */ |
176 | #define BMIC_READ 0x26 | 137 | #define BMIC_READ 0x26 |
177 | #define BMIC_WRITE 0x27 | 138 | #define BMIC_WRITE 0x27 |
178 | #define BMIC_CACHE_FLUSH 0xc2 | 139 | #define BMIC_CACHE_FLUSH 0xc2 |
179 | #define CCISS_CACHE_FLUSH 0x01 //C2 was already being used by CCISS | 140 | #define CCISS_CACHE_FLUSH 0x01 /* C2 was already being used by CCISS */ |
180 | |||
181 | //Command List Structure | ||
182 | typedef union _SCSI3Addr_struct { | ||
183 | struct { | ||
184 | BYTE Dev; | ||
185 | BYTE Bus:6; | ||
186 | BYTE Mode:2; // b00 | ||
187 | } PeripDev; | ||
188 | struct { | ||
189 | BYTE DevLSB; | ||
190 | BYTE DevMSB:6; | ||
191 | BYTE Mode:2; // b01 | ||
192 | } LogDev; | ||
193 | struct { | ||
194 | BYTE Dev:5; | ||
195 | BYTE Bus:3; | ||
196 | BYTE Targ:6; | ||
197 | BYTE Mode:2; // b10 | ||
198 | } LogUnit; | ||
199 | } SCSI3Addr_struct; | ||
200 | |||
201 | typedef struct _PhysDevAddr_struct { | ||
202 | DWORD TargetId:24; | ||
203 | DWORD Bus:6; | ||
204 | DWORD Mode:2; | ||
205 | SCSI3Addr_struct Target[2]; //2 level target device addr | ||
206 | } PhysDevAddr_struct; | ||
207 | |||
208 | typedef struct _LogDevAddr_struct { | ||
209 | DWORD VolId:30; | ||
210 | DWORD Mode:2; | ||
211 | BYTE reserved[4]; | ||
212 | } LogDevAddr_struct; | ||
213 | |||
214 | typedef union _LUNAddr_struct { | ||
215 | BYTE LunAddrBytes[8]; | ||
216 | SCSI3Addr_struct SCSI3Lun[4]; | ||
217 | PhysDevAddr_struct PhysDev; | ||
218 | LogDevAddr_struct LogDev; | ||
219 | } LUNAddr_struct; | ||
220 | 141 | ||
142 | /* Command List Structure */ | ||
221 | #define CTLR_LUNID "\0\0\0\0\0\0\0\0" | 143 | #define CTLR_LUNID "\0\0\0\0\0\0\0\0" |
222 | 144 | ||
223 | typedef struct _CommandListHeader_struct { | 145 | typedef struct _CommandListHeader_struct { |
@@ -227,16 +149,6 @@ typedef struct _CommandListHeader_struct { | |||
227 | QWORD Tag; | 149 | QWORD Tag; |
228 | LUNAddr_struct LUN; | 150 | LUNAddr_struct LUN; |
229 | } CommandListHeader_struct; | 151 | } CommandListHeader_struct; |
230 | typedef struct _RequestBlock_struct { | ||
231 | BYTE CDBLen; | ||
232 | struct { | ||
233 | BYTE Type:3; | ||
234 | BYTE Attribute:3; | ||
235 | BYTE Direction:2; | ||
236 | } Type; | ||
237 | HWORD Timeout; | ||
238 | BYTE CDB[16]; | ||
239 | } RequestBlock_struct; | ||
240 | typedef struct _ErrDescriptor_struct { | 152 | typedef struct _ErrDescriptor_struct { |
241 | QWORD Addr; | 153 | QWORD Addr; |
242 | DWORD Len; | 154 | DWORD Len; |
@@ -247,28 +159,6 @@ typedef struct _SGDescriptor_struct { | |||
247 | DWORD Ext; | 159 | DWORD Ext; |
248 | } SGDescriptor_struct; | 160 | } SGDescriptor_struct; |
249 | 161 | ||
250 | typedef union _MoreErrInfo_struct{ | ||
251 | struct { | ||
252 | BYTE Reserved[3]; | ||
253 | BYTE Type; | ||
254 | DWORD ErrorInfo; | ||
255 | }Common_Info; | ||
256 | struct{ | ||
257 | BYTE Reserved[2]; | ||
258 | BYTE offense_size;//size of offending entry | ||
259 | BYTE offense_num; //byte # of offense 0-base | ||
260 | DWORD offense_value; | ||
261 | }Invalid_Cmd; | ||
262 | }MoreErrInfo_struct; | ||
263 | typedef struct _ErrorInfo_struct { | ||
264 | BYTE ScsiStatus; | ||
265 | BYTE SenseLen; | ||
266 | HWORD CommandStatus; | ||
267 | DWORD ResidualCnt; | ||
268 | MoreErrInfo_struct MoreErrInfo; | ||
269 | BYTE SenseInfo[SENSEINFOBYTES]; | ||
270 | } ErrorInfo_struct; | ||
271 | |||
272 | /* Command types */ | 162 | /* Command types */ |
273 | #define CMD_RWREQ 0x00 | 163 | #define CMD_RWREQ 0x00 |
274 | #define CMD_IOCTL_PEND 0x01 | 164 | #define CMD_IOCTL_PEND 0x01 |
@@ -277,10 +167,18 @@ typedef struct _ErrorInfo_struct { | |||
277 | #define CMD_MSG_TIMEOUT 0x05 | 167 | #define CMD_MSG_TIMEOUT 0x05 |
278 | #define CMD_MSG_STALE 0xff | 168 | #define CMD_MSG_STALE 0xff |
279 | 169 | ||
280 | /* This structure needs to be divisible by 8 for new | 170 | /* This structure needs to be divisible by COMMANDLIST_ALIGNMENT |
281 | * indexing method. | 171 | * because low bits of the address are used to to indicate that |
172 | * whether the tag contains an index or an address. PAD_32 and | ||
173 | * PAD_64 can be adjusted independently as needed for 32-bit | ||
174 | * and 64-bits systems. | ||
282 | */ | 175 | */ |
283 | #define PADSIZE (sizeof(long) - 4) | 176 | #define COMMANDLIST_ALIGNMENT (8) |
177 | #define IS_64_BIT ((sizeof(long) - 4)/4) | ||
178 | #define IS_32_BIT (!IS_64_BIT) | ||
179 | #define PAD_32 (0) | ||
180 | #define PAD_64 (4) | ||
181 | #define PADSIZE (IS_32_BIT * PAD_32 + IS_64_BIT * PAD_64) | ||
284 | typedef struct _CommandList_struct { | 182 | typedef struct _CommandList_struct { |
285 | CommandListHeader_struct Header; | 183 | CommandListHeader_struct Header; |
286 | RequestBlock_struct Request; | 184 | RequestBlock_struct Request; |
@@ -300,7 +198,7 @@ typedef struct _CommandList_struct { | |||
300 | char pad[PADSIZE]; | 198 | char pad[PADSIZE]; |
301 | } CommandList_struct; | 199 | } CommandList_struct; |
302 | 200 | ||
303 | //Configuration Table Structure | 201 | /* Configuration Table Structure */ |
304 | typedef struct _HostWrite_struct { | 202 | typedef struct _HostWrite_struct { |
305 | DWORD TransportRequest; | 203 | DWORD TransportRequest; |
306 | DWORD Reserved; | 204 | DWORD Reserved; |
@@ -326,4 +224,4 @@ typedef struct _CfgTable_struct { | |||
326 | DWORD MaxPhysicalDrivesPerLogicalUnit; | 224 | DWORD MaxPhysicalDrivesPerLogicalUnit; |
327 | } CfgTable_struct; | 225 | } CfgTable_struct; |
328 | #pragma pack() | 226 | #pragma pack() |
329 | #endif // CCISS_CMD_H | 227 | #endif /* CCISS_CMD_H */ |
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index 5d0e46dc3632..e1d0e2cfec72 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c | |||
@@ -84,7 +84,6 @@ static struct scsi_host_template cciss_driver_template = { | |||
84 | .queuecommand = cciss_scsi_queue_command, | 84 | .queuecommand = cciss_scsi_queue_command, |
85 | .can_queue = SCSI_CCISS_CAN_QUEUE, | 85 | .can_queue = SCSI_CCISS_CAN_QUEUE, |
86 | .this_id = 7, | 86 | .this_id = 7, |
87 | .sg_tablesize = MAXSGENTRIES, | ||
88 | .cmd_per_lun = 1, | 87 | .cmd_per_lun = 1, |
89 | .use_clustering = DISABLE_CLUSTERING, | 88 | .use_clustering = DISABLE_CLUSTERING, |
90 | /* Can't have eh_bus_reset_handler or eh_host_reset_handler for cciss */ | 89 | /* Can't have eh_bus_reset_handler or eh_host_reset_handler for cciss */ |
@@ -93,11 +92,16 @@ static struct scsi_host_template cciss_driver_template = { | |||
93 | }; | 92 | }; |
94 | 93 | ||
95 | #pragma pack(1) | 94 | #pragma pack(1) |
95 | |||
96 | #define SCSI_PAD_32 0 | ||
97 | #define SCSI_PAD_64 0 | ||
98 | |||
96 | struct cciss_scsi_cmd_stack_elem_t { | 99 | struct cciss_scsi_cmd_stack_elem_t { |
97 | CommandList_struct cmd; | 100 | CommandList_struct cmd; |
98 | ErrorInfo_struct Err; | 101 | ErrorInfo_struct Err; |
99 | __u32 busaddr; | 102 | __u32 busaddr; |
100 | __u32 pad; | 103 | int cmdindex; |
104 | u8 pad[IS_32_BIT * SCSI_PAD_32 + IS_64_BIT * SCSI_PAD_64]; | ||
101 | }; | 105 | }; |
102 | 106 | ||
103 | #pragma pack() | 107 | #pragma pack() |
@@ -118,16 +122,15 @@ struct cciss_scsi_cmd_stack_t { | |||
118 | struct cciss_scsi_adapter_data_t { | 122 | struct cciss_scsi_adapter_data_t { |
119 | struct Scsi_Host *scsi_host; | 123 | struct Scsi_Host *scsi_host; |
120 | struct cciss_scsi_cmd_stack_t cmd_stack; | 124 | struct cciss_scsi_cmd_stack_t cmd_stack; |
125 | SGDescriptor_struct **cmd_sg_list; | ||
121 | int registered; | 126 | int registered; |
122 | spinlock_t lock; // to protect ccissscsi[ctlr]; | 127 | spinlock_t lock; // to protect ccissscsi[ctlr]; |
123 | }; | 128 | }; |
124 | 129 | ||
125 | #define CPQ_TAPE_LOCK(ctlr, flags) spin_lock_irqsave( \ | 130 | #define CPQ_TAPE_LOCK(ctlr, flags) spin_lock_irqsave( \ |
126 | &(((struct cciss_scsi_adapter_data_t *) \ | 131 | &hba[ctlr]->scsi_ctlr->lock, flags); |
127 | hba[ctlr]->scsi_ctlr)->lock), flags); | ||
128 | #define CPQ_TAPE_UNLOCK(ctlr, flags) spin_unlock_irqrestore( \ | 132 | #define CPQ_TAPE_UNLOCK(ctlr, flags) spin_unlock_irqrestore( \ |
129 | &(((struct cciss_scsi_adapter_data_t *) \ | 133 | &hba[ctlr]->scsi_ctlr->lock, flags); |
130 | hba[ctlr]->scsi_ctlr)->lock), flags); | ||
131 | 134 | ||
132 | static CommandList_struct * | 135 | static CommandList_struct * |
133 | scsi_cmd_alloc(ctlr_info_t *h) | 136 | scsi_cmd_alloc(ctlr_info_t *h) |
@@ -143,7 +146,7 @@ scsi_cmd_alloc(ctlr_info_t *h) | |||
143 | struct cciss_scsi_cmd_stack_t *stk; | 146 | struct cciss_scsi_cmd_stack_t *stk; |
144 | u64bit temp64; | 147 | u64bit temp64; |
145 | 148 | ||
146 | sa = (struct cciss_scsi_adapter_data_t *) h->scsi_ctlr; | 149 | sa = h->scsi_ctlr; |
147 | stk = &sa->cmd_stack; | 150 | stk = &sa->cmd_stack; |
148 | 151 | ||
149 | if (stk->top < 0) | 152 | if (stk->top < 0) |
@@ -154,6 +157,7 @@ scsi_cmd_alloc(ctlr_info_t *h) | |||
154 | memset(&c->Err, 0, sizeof(c->Err)); | 157 | memset(&c->Err, 0, sizeof(c->Err)); |
155 | /* set physical addr of cmd and addr of scsi parameters */ | 158 | /* set physical addr of cmd and addr of scsi parameters */ |
156 | c->cmd.busaddr = c->busaddr; | 159 | c->cmd.busaddr = c->busaddr; |
160 | c->cmd.cmdindex = c->cmdindex; | ||
157 | /* (__u32) (stk->cmd_pool_handle + | 161 | /* (__u32) (stk->cmd_pool_handle + |
158 | (sizeof(struct cciss_scsi_cmd_stack_elem_t)*stk->top)); */ | 162 | (sizeof(struct cciss_scsi_cmd_stack_elem_t)*stk->top)); */ |
159 | 163 | ||
@@ -182,7 +186,7 @@ scsi_cmd_free(ctlr_info_t *h, CommandList_struct *cmd) | |||
182 | struct cciss_scsi_adapter_data_t *sa; | 186 | struct cciss_scsi_adapter_data_t *sa; |
183 | struct cciss_scsi_cmd_stack_t *stk; | 187 | struct cciss_scsi_cmd_stack_t *stk; |
184 | 188 | ||
185 | sa = (struct cciss_scsi_adapter_data_t *) h->scsi_ctlr; | 189 | sa = h->scsi_ctlr; |
186 | stk = &sa->cmd_stack; | 190 | stk = &sa->cmd_stack; |
187 | if (stk->top >= CMD_STACK_SIZE) { | 191 | if (stk->top >= CMD_STACK_SIZE) { |
188 | printk("cciss: scsi_cmd_free called too many times.\n"); | 192 | printk("cciss: scsi_cmd_free called too many times.\n"); |
@@ -199,24 +203,31 @@ scsi_cmd_stack_setup(int ctlr, struct cciss_scsi_adapter_data_t *sa) | |||
199 | struct cciss_scsi_cmd_stack_t *stk; | 203 | struct cciss_scsi_cmd_stack_t *stk; |
200 | size_t size; | 204 | size_t size; |
201 | 205 | ||
206 | sa->cmd_sg_list = cciss_allocate_sg_chain_blocks(hba[ctlr], | ||
207 | hba[ctlr]->chainsize, CMD_STACK_SIZE); | ||
208 | if (!sa->cmd_sg_list && hba[ctlr]->chainsize > 0) | ||
209 | return -ENOMEM; | ||
210 | |||
202 | stk = &sa->cmd_stack; | 211 | stk = &sa->cmd_stack; |
203 | size = sizeof(struct cciss_scsi_cmd_stack_elem_t) * CMD_STACK_SIZE; | 212 | size = sizeof(struct cciss_scsi_cmd_stack_elem_t) * CMD_STACK_SIZE; |
204 | 213 | ||
205 | // pci_alloc_consistent guarantees 32-bit DMA address will | 214 | /* Check alignment, see cciss_cmd.h near CommandList_struct def. */ |
206 | // be used | 215 | BUILD_BUG_ON((sizeof(*stk->pool) % COMMANDLIST_ALIGNMENT) != 0); |
207 | 216 | /* pci_alloc_consistent guarantees 32-bit DMA address will be used */ | |
208 | stk->pool = (struct cciss_scsi_cmd_stack_elem_t *) | 217 | stk->pool = (struct cciss_scsi_cmd_stack_elem_t *) |
209 | pci_alloc_consistent(hba[ctlr]->pdev, size, &stk->cmd_pool_handle); | 218 | pci_alloc_consistent(hba[ctlr]->pdev, size, &stk->cmd_pool_handle); |
210 | 219 | ||
211 | if (stk->pool == NULL) { | 220 | if (stk->pool == NULL) { |
212 | printk("stk->pool is null\n"); | 221 | cciss_free_sg_chain_blocks(sa->cmd_sg_list, CMD_STACK_SIZE); |
213 | return -1; | 222 | sa->cmd_sg_list = NULL; |
223 | return -ENOMEM; | ||
214 | } | 224 | } |
215 | 225 | ||
216 | for (i=0; i<CMD_STACK_SIZE; i++) { | 226 | for (i=0; i<CMD_STACK_SIZE; i++) { |
217 | stk->elem[i] = &stk->pool[i]; | 227 | stk->elem[i] = &stk->pool[i]; |
218 | stk->elem[i]->busaddr = (__u32) (stk->cmd_pool_handle + | 228 | stk->elem[i]->busaddr = (__u32) (stk->cmd_pool_handle + |
219 | (sizeof(struct cciss_scsi_cmd_stack_elem_t) * i)); | 229 | (sizeof(struct cciss_scsi_cmd_stack_elem_t) * i)); |
230 | stk->elem[i]->cmdindex = i; | ||
220 | } | 231 | } |
221 | stk->top = CMD_STACK_SIZE-1; | 232 | stk->top = CMD_STACK_SIZE-1; |
222 | return 0; | 233 | return 0; |
@@ -229,7 +240,7 @@ scsi_cmd_stack_free(int ctlr) | |||
229 | struct cciss_scsi_cmd_stack_t *stk; | 240 | struct cciss_scsi_cmd_stack_t *stk; |
230 | size_t size; | 241 | size_t size; |
231 | 242 | ||
232 | sa = (struct cciss_scsi_adapter_data_t *) hba[ctlr]->scsi_ctlr; | 243 | sa = hba[ctlr]->scsi_ctlr; |
233 | stk = &sa->cmd_stack; | 244 | stk = &sa->cmd_stack; |
234 | if (stk->top != CMD_STACK_SIZE-1) { | 245 | if (stk->top != CMD_STACK_SIZE-1) { |
235 | printk( "cciss: %d scsi commands are still outstanding.\n", | 246 | printk( "cciss: %d scsi commands are still outstanding.\n", |
@@ -241,6 +252,7 @@ scsi_cmd_stack_free(int ctlr) | |||
241 | 252 | ||
242 | pci_free_consistent(hba[ctlr]->pdev, size, stk->pool, stk->cmd_pool_handle); | 253 | pci_free_consistent(hba[ctlr]->pdev, size, stk->pool, stk->cmd_pool_handle); |
243 | stk->pool = NULL; | 254 | stk->pool = NULL; |
255 | cciss_free_sg_chain_blocks(sa->cmd_sg_list, CMD_STACK_SIZE); | ||
244 | } | 256 | } |
245 | 257 | ||
246 | #if 0 | 258 | #if 0 |
@@ -530,8 +542,7 @@ adjust_cciss_scsi_table(int ctlr, int hostno, | |||
530 | CPQ_TAPE_LOCK(ctlr, flags); | 542 | CPQ_TAPE_LOCK(ctlr, flags); |
531 | 543 | ||
532 | if (hostno != -1) /* if it's not the first time... */ | 544 | if (hostno != -1) /* if it's not the first time... */ |
533 | sh = ((struct cciss_scsi_adapter_data_t *) | 545 | sh = hba[ctlr]->scsi_ctlr->scsi_host; |
534 | hba[ctlr]->scsi_ctlr)->scsi_host; | ||
535 | 546 | ||
536 | /* find any devices in ccissscsi[] that are not in | 547 | /* find any devices in ccissscsi[] that are not in |
537 | sd[] and remove them from ccissscsi[] */ | 548 | sd[] and remove them from ccissscsi[] */ |
@@ -702,7 +713,7 @@ cciss_scsi_setup(int cntl_num) | |||
702 | kfree(shba); | 713 | kfree(shba); |
703 | shba = NULL; | 714 | shba = NULL; |
704 | } | 715 | } |
705 | hba[cntl_num]->scsi_ctlr = (void *) shba; | 716 | hba[cntl_num]->scsi_ctlr = shba; |
706 | return; | 717 | return; |
707 | } | 718 | } |
708 | 719 | ||
@@ -725,6 +736,8 @@ complete_scsi_command( CommandList_struct *cp, int timeout, __u32 tag) | |||
725 | ctlr = hba[cp->ctlr]; | 736 | ctlr = hba[cp->ctlr]; |
726 | 737 | ||
727 | scsi_dma_unmap(cmd); | 738 | scsi_dma_unmap(cmd); |
739 | if (cp->Header.SGTotal > ctlr->max_cmd_sgentries) | ||
740 | cciss_unmap_sg_chain_block(ctlr, cp); | ||
728 | 741 | ||
729 | cmd->result = (DID_OK << 16); /* host byte */ | 742 | cmd->result = (DID_OK << 16); /* host byte */ |
730 | cmd->result |= (COMMAND_COMPLETE << 8); /* msg byte */ | 743 | cmd->result |= (COMMAND_COMPLETE << 8); /* msg byte */ |
@@ -847,9 +860,10 @@ cciss_scsi_detect(int ctlr) | |||
847 | sh->io_port = 0; // good enough? FIXME, | 860 | sh->io_port = 0; // good enough? FIXME, |
848 | sh->n_io_port = 0; // I don't think we use these two... | 861 | sh->n_io_port = 0; // I don't think we use these two... |
849 | sh->this_id = SELF_SCSI_ID; | 862 | sh->this_id = SELF_SCSI_ID; |
863 | sh->sg_tablesize = hba[ctlr]->maxsgentries; | ||
850 | 864 | ||
851 | ((struct cciss_scsi_adapter_data_t *) | 865 | ((struct cciss_scsi_adapter_data_t *) |
852 | hba[ctlr]->scsi_ctlr)->scsi_host = (void *) sh; | 866 | hba[ctlr]->scsi_ctlr)->scsi_host = sh; |
853 | sh->hostdata[0] = (unsigned long) hba[ctlr]; | 867 | sh->hostdata[0] = (unsigned long) hba[ctlr]; |
854 | sh->irq = hba[ctlr]->intr[SIMPLE_MODE_INT]; | 868 | sh->irq = hba[ctlr]->intr[SIMPLE_MODE_INT]; |
855 | sh->unique_id = sh->irq; | 869 | sh->unique_id = sh->irq; |
@@ -1364,34 +1378,54 @@ cciss_scsi_proc_info(struct Scsi_Host *sh, | |||
1364 | dma mapping and fills in the scatter gather entries of the | 1378 | dma mapping and fills in the scatter gather entries of the |
1365 | cciss command, cp. */ | 1379 | cciss command, cp. */ |
1366 | 1380 | ||
1367 | static void | 1381 | static void cciss_scatter_gather(ctlr_info_t *h, CommandList_struct *cp, |
1368 | cciss_scatter_gather(struct pci_dev *pdev, | 1382 | struct scsi_cmnd *cmd) |
1369 | CommandList_struct *cp, | ||
1370 | struct scsi_cmnd *cmd) | ||
1371 | { | 1383 | { |
1372 | unsigned int len; | 1384 | unsigned int len; |
1373 | struct scatterlist *sg; | 1385 | struct scatterlist *sg; |
1374 | __u64 addr64; | 1386 | __u64 addr64; |
1375 | int use_sg, i; | 1387 | int request_nsgs, i, chained, sg_index; |
1376 | 1388 | struct cciss_scsi_adapter_data_t *sa = h->scsi_ctlr; | |
1377 | BUG_ON(scsi_sg_count(cmd) > MAXSGENTRIES); | 1389 | SGDescriptor_struct *curr_sg; |
1378 | 1390 | ||
1379 | use_sg = scsi_dma_map(cmd); | 1391 | BUG_ON(scsi_sg_count(cmd) > h->maxsgentries); |
1380 | if (use_sg) { /* not too many addrs? */ | 1392 | |
1381 | scsi_for_each_sg(cmd, sg, use_sg, i) { | 1393 | chained = 0; |
1394 | sg_index = 0; | ||
1395 | curr_sg = cp->SG; | ||
1396 | request_nsgs = scsi_dma_map(cmd); | ||
1397 | if (request_nsgs) { | ||
1398 | scsi_for_each_sg(cmd, sg, request_nsgs, i) { | ||
1399 | if (sg_index + 1 == h->max_cmd_sgentries && | ||
1400 | !chained && request_nsgs - i > 1) { | ||
1401 | chained = 1; | ||
1402 | sg_index = 0; | ||
1403 | curr_sg = sa->cmd_sg_list[cp->cmdindex]; | ||
1404 | } | ||
1382 | addr64 = (__u64) sg_dma_address(sg); | 1405 | addr64 = (__u64) sg_dma_address(sg); |
1383 | len = sg_dma_len(sg); | 1406 | len = sg_dma_len(sg); |
1384 | cp->SG[i].Addr.lower = | 1407 | curr_sg[sg_index].Addr.lower = |
1385 | (__u32) (addr64 & (__u64) 0x00000000FFFFFFFF); | 1408 | (__u32) (addr64 & 0x0FFFFFFFFULL); |
1386 | cp->SG[i].Addr.upper = | 1409 | curr_sg[sg_index].Addr.upper = |
1387 | (__u32) ((addr64 >> 32) & (__u64) 0x00000000FFFFFFFF); | 1410 | (__u32) ((addr64 >> 32) & 0x0FFFFFFFFULL); |
1388 | cp->SG[i].Len = len; | 1411 | curr_sg[sg_index].Len = len; |
1389 | cp->SG[i].Ext = 0; // we are not chaining | 1412 | curr_sg[sg_index].Ext = 0; |
1413 | ++sg_index; | ||
1390 | } | 1414 | } |
1415 | if (chained) | ||
1416 | cciss_map_sg_chain_block(h, cp, | ||
1417 | sa->cmd_sg_list[cp->cmdindex], | ||
1418 | (request_nsgs - (h->max_cmd_sgentries - 1)) * | ||
1419 | sizeof(SGDescriptor_struct)); | ||
1391 | } | 1420 | } |
1392 | 1421 | /* track how many SG entries we are using */ | |
1393 | cp->Header.SGList = (__u8) use_sg; /* no. SGs contig in this cmd */ | 1422 | if (request_nsgs > h->maxSG) |
1394 | cp->Header.SGTotal = (__u16) use_sg; /* total sgs in this cmd list */ | 1423 | h->maxSG = request_nsgs; |
1424 | cp->Header.SGTotal = (__u8) request_nsgs + chained; | ||
1425 | if (request_nsgs > h->max_cmd_sgentries) | ||
1426 | cp->Header.SGList = h->max_cmd_sgentries; | ||
1427 | else | ||
1428 | cp->Header.SGList = cp->Header.SGTotal; | ||
1395 | return; | 1429 | return; |
1396 | } | 1430 | } |
1397 | 1431 | ||
@@ -1399,7 +1433,7 @@ cciss_scatter_gather(struct pci_dev *pdev, | |||
1399 | static int | 1433 | static int |
1400 | cciss_scsi_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) | 1434 | cciss_scsi_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *)) |
1401 | { | 1435 | { |
1402 | ctlr_info_t **c; | 1436 | ctlr_info_t *c; |
1403 | int ctlr, rc; | 1437 | int ctlr, rc; |
1404 | unsigned char scsi3addr[8]; | 1438 | unsigned char scsi3addr[8]; |
1405 | CommandList_struct *cp; | 1439 | CommandList_struct *cp; |
@@ -1407,8 +1441,8 @@ cciss_scsi_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd | |||
1407 | 1441 | ||
1408 | // Get the ptr to our adapter structure (hba[i]) out of cmd->host. | 1442 | // Get the ptr to our adapter structure (hba[i]) out of cmd->host. |
1409 | // We violate cmd->host privacy here. (Is there another way?) | 1443 | // We violate cmd->host privacy here. (Is there another way?) |
1410 | c = (ctlr_info_t **) &cmd->device->host->hostdata[0]; | 1444 | c = (ctlr_info_t *) cmd->device->host->hostdata[0]; |
1411 | ctlr = (*c)->ctlr; | 1445 | ctlr = c->ctlr; |
1412 | 1446 | ||
1413 | rc = lookup_scsi3addr(ctlr, cmd->device->channel, cmd->device->id, | 1447 | rc = lookup_scsi3addr(ctlr, cmd->device->channel, cmd->device->id, |
1414 | cmd->device->lun, scsi3addr); | 1448 | cmd->device->lun, scsi3addr); |
@@ -1431,7 +1465,7 @@ cciss_scsi_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd | |||
1431 | see what the device thinks of it. */ | 1465 | see what the device thinks of it. */ |
1432 | 1466 | ||
1433 | spin_lock_irqsave(CCISS_LOCK(ctlr), flags); | 1467 | spin_lock_irqsave(CCISS_LOCK(ctlr), flags); |
1434 | cp = scsi_cmd_alloc(*c); | 1468 | cp = scsi_cmd_alloc(c); |
1435 | spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags); | 1469 | spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags); |
1436 | if (cp == NULL) { /* trouble... */ | 1470 | if (cp == NULL) { /* trouble... */ |
1437 | printk("scsi_cmd_alloc returned NULL!\n"); | 1471 | printk("scsi_cmd_alloc returned NULL!\n"); |
@@ -1489,15 +1523,14 @@ cciss_scsi_queue_command (struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd | |||
1489 | BUG(); | 1523 | BUG(); |
1490 | break; | 1524 | break; |
1491 | } | 1525 | } |
1492 | 1526 | cciss_scatter_gather(c, cp, cmd); | |
1493 | cciss_scatter_gather((*c)->pdev, cp, cmd); // Fill the SG list | ||
1494 | 1527 | ||
1495 | /* Put the request on the tail of the request queue */ | 1528 | /* Put the request on the tail of the request queue */ |
1496 | 1529 | ||
1497 | spin_lock_irqsave(CCISS_LOCK(ctlr), flags); | 1530 | spin_lock_irqsave(CCISS_LOCK(ctlr), flags); |
1498 | addQ(&(*c)->reqQ, cp); | 1531 | addQ(&c->reqQ, cp); |
1499 | (*c)->Qdepth++; | 1532 | c->Qdepth++; |
1500 | start_io(*c); | 1533 | start_io(c); |
1501 | spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags); | 1534 | spin_unlock_irqrestore(CCISS_LOCK(ctlr), flags); |
1502 | 1535 | ||
1503 | /* the cmd'll come back via intr handler in complete_scsi_command() */ | 1536 | /* the cmd'll come back via intr handler in complete_scsi_command() */ |
@@ -1514,7 +1547,7 @@ cciss_unregister_scsi(int ctlr) | |||
1514 | /* we are being forcibly unloaded, and may not refuse. */ | 1547 | /* we are being forcibly unloaded, and may not refuse. */ |
1515 | 1548 | ||
1516 | spin_lock_irqsave(CCISS_LOCK(ctlr), flags); | 1549 | spin_lock_irqsave(CCISS_LOCK(ctlr), flags); |
1517 | sa = (struct cciss_scsi_adapter_data_t *) hba[ctlr]->scsi_ctlr; | 1550 | sa = hba[ctlr]->scsi_ctlr; |
1518 | stk = &sa->cmd_stack; | 1551 | stk = &sa->cmd_stack; |
1519 | 1552 | ||
1520 | /* if we weren't ever actually registered, don't unregister */ | 1553 | /* if we weren't ever actually registered, don't unregister */ |
@@ -1541,7 +1574,7 @@ cciss_engage_scsi(int ctlr) | |||
1541 | unsigned long flags; | 1574 | unsigned long flags; |
1542 | 1575 | ||
1543 | spin_lock_irqsave(CCISS_LOCK(ctlr), flags); | 1576 | spin_lock_irqsave(CCISS_LOCK(ctlr), flags); |
1544 | sa = (struct cciss_scsi_adapter_data_t *) hba[ctlr]->scsi_ctlr; | 1577 | sa = hba[ctlr]->scsi_ctlr; |
1545 | stk = &sa->cmd_stack; | 1578 | stk = &sa->cmd_stack; |
1546 | 1579 | ||
1547 | if (sa->registered) { | 1580 | if (sa->registered) { |
@@ -1654,14 +1687,14 @@ static int cciss_eh_device_reset_handler(struct scsi_cmnd *scsicmd) | |||
1654 | int rc; | 1687 | int rc; |
1655 | CommandList_struct *cmd_in_trouble; | 1688 | CommandList_struct *cmd_in_trouble; |
1656 | unsigned char lunaddr[8]; | 1689 | unsigned char lunaddr[8]; |
1657 | ctlr_info_t **c; | 1690 | ctlr_info_t *c; |
1658 | int ctlr; | 1691 | int ctlr; |
1659 | 1692 | ||
1660 | /* find the controller to which the command to be aborted was sent */ | 1693 | /* find the controller to which the command to be aborted was sent */ |
1661 | c = (ctlr_info_t **) &scsicmd->device->host->hostdata[0]; | 1694 | c = (ctlr_info_t *) scsicmd->device->host->hostdata[0]; |
1662 | if (c == NULL) /* paranoia */ | 1695 | if (c == NULL) /* paranoia */ |
1663 | return FAILED; | 1696 | return FAILED; |
1664 | ctlr = (*c)->ctlr; | 1697 | ctlr = c->ctlr; |
1665 | printk(KERN_WARNING "cciss%d: resetting tape drive or medium changer.\n", ctlr); | 1698 | printk(KERN_WARNING "cciss%d: resetting tape drive or medium changer.\n", ctlr); |
1666 | /* find the command that's giving us trouble */ | 1699 | /* find the command that's giving us trouble */ |
1667 | cmd_in_trouble = (CommandList_struct *) scsicmd->host_scribble; | 1700 | cmd_in_trouble = (CommandList_struct *) scsicmd->host_scribble; |
@@ -1671,7 +1704,7 @@ static int cciss_eh_device_reset_handler(struct scsi_cmnd *scsicmd) | |||
1671 | /* send a reset to the SCSI LUN which the command was sent to */ | 1704 | /* send a reset to the SCSI LUN which the command was sent to */ |
1672 | rc = sendcmd_withirq(CCISS_RESET_MSG, ctlr, NULL, 0, 0, lunaddr, | 1705 | rc = sendcmd_withirq(CCISS_RESET_MSG, ctlr, NULL, 0, 0, lunaddr, |
1673 | TYPE_MSG); | 1706 | TYPE_MSG); |
1674 | if (rc == 0 && wait_for_device_to_become_ready(*c, lunaddr) == 0) | 1707 | if (rc == 0 && wait_for_device_to_become_ready(c, lunaddr) == 0) |
1675 | return SUCCESS; | 1708 | return SUCCESS; |
1676 | printk(KERN_WARNING "cciss%d: resetting device failed.\n", ctlr); | 1709 | printk(KERN_WARNING "cciss%d: resetting device failed.\n", ctlr); |
1677 | return FAILED; | 1710 | return FAILED; |
@@ -1682,14 +1715,14 @@ static int cciss_eh_abort_handler(struct scsi_cmnd *scsicmd) | |||
1682 | int rc; | 1715 | int rc; |
1683 | CommandList_struct *cmd_to_abort; | 1716 | CommandList_struct *cmd_to_abort; |
1684 | unsigned char lunaddr[8]; | 1717 | unsigned char lunaddr[8]; |
1685 | ctlr_info_t **c; | 1718 | ctlr_info_t *c; |
1686 | int ctlr; | 1719 | int ctlr; |
1687 | 1720 | ||
1688 | /* find the controller to which the command to be aborted was sent */ | 1721 | /* find the controller to which the command to be aborted was sent */ |
1689 | c = (ctlr_info_t **) &scsicmd->device->host->hostdata[0]; | 1722 | c = (ctlr_info_t *) scsicmd->device->host->hostdata[0]; |
1690 | if (c == NULL) /* paranoia */ | 1723 | if (c == NULL) /* paranoia */ |
1691 | return FAILED; | 1724 | return FAILED; |
1692 | ctlr = (*c)->ctlr; | 1725 | ctlr = c->ctlr; |
1693 | printk(KERN_WARNING "cciss%d: aborting tardy SCSI cmd\n", ctlr); | 1726 | printk(KERN_WARNING "cciss%d: aborting tardy SCSI cmd\n", ctlr); |
1694 | 1727 | ||
1695 | /* find the command to be aborted */ | 1728 | /* find the command to be aborted */ |
diff --git a/drivers/block/cciss_scsi.h b/drivers/block/cciss_scsi.h index 7b750245ae76..6d5822fe851a 100644 --- a/drivers/block/cciss_scsi.h +++ b/drivers/block/cciss_scsi.h | |||
@@ -25,16 +25,16 @@ | |||
25 | 25 | ||
26 | #include <scsi/scsicam.h> /* possibly irrelevant, since we don't show disks */ | 26 | #include <scsi/scsicam.h> /* possibly irrelevant, since we don't show disks */ |
27 | 27 | ||
28 | // the scsi id of the adapter... | 28 | /* the scsi id of the adapter... */ |
29 | #define SELF_SCSI_ID 15 | 29 | #define SELF_SCSI_ID 15 |
30 | // 15 is somewhat arbitrary, since the scsi-2 bus | 30 | /* 15 is somewhat arbitrary, since the scsi-2 bus |
31 | // that's presented by the driver to the OS is | 31 | that's presented by the driver to the OS is |
32 | // fabricated. The "real" scsi-3 bus the | 32 | fabricated. The "real" scsi-3 bus the |
33 | // hardware presents is fabricated too. | 33 | hardware presents is fabricated too. |
34 | // The actual, honest-to-goodness physical | 34 | The actual, honest-to-goodness physical |
35 | // bus that the devices are attached to is not | 35 | bus that the devices are attached to is not |
36 | // addressible natively, and may in fact turn | 36 | addressible natively, and may in fact turn |
37 | // out to be not scsi at all. | 37 | out to be not scsi at all. */ |
38 | 38 | ||
39 | #define SCSI_CCISS_CAN_QUEUE 2 | 39 | #define SCSI_CCISS_CAN_QUEUE 2 |
40 | 40 | ||
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index 6422651ec364..91d11631cec9 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c | |||
@@ -448,11 +448,8 @@ static int __init cpqarray_register_ctlr( int i, struct pci_dev *pdev) | |||
448 | blk_queue_bounce_limit(q, hba[i]->pci_dev->dma_mask); | 448 | blk_queue_bounce_limit(q, hba[i]->pci_dev->dma_mask); |
449 | 449 | ||
450 | /* This is a hardware imposed limit. */ | 450 | /* This is a hardware imposed limit. */ |
451 | blk_queue_max_hw_segments(q, SG_MAX); | 451 | blk_queue_max_segments(q, SG_MAX); |
452 | 452 | ||
453 | /* This is a driver limit and could be eliminated. */ | ||
454 | blk_queue_max_phys_segments(q, SG_MAX); | ||
455 | |||
456 | init_timer(&hba[i]->timer); | 453 | init_timer(&hba[i]->timer); |
457 | hba[i]->timer.expires = jiffies + IDA_TIMER; | 454 | hba[i]->timer.expires = jiffies + IDA_TIMER; |
458 | hba[i]->timer.data = (unsigned long)hba[i]; | 455 | hba[i]->timer.data = (unsigned long)hba[i]; |
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 1292e0620663..4df3b40b1057 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
@@ -709,9 +709,8 @@ void drbd_setup_queue_param(struct drbd_conf *mdev, unsigned int max_seg_s) __mu | |||
709 | 709 | ||
710 | max_seg_s = min(queue_max_sectors(b) * queue_logical_block_size(b), max_seg_s); | 710 | max_seg_s = min(queue_max_sectors(b) * queue_logical_block_size(b), max_seg_s); |
711 | 711 | ||
712 | blk_queue_max_sectors(q, max_seg_s >> 9); | 712 | blk_queue_max_hw_sectors(q, max_seg_s >> 9); |
713 | blk_queue_max_phys_segments(q, max_segments ? max_segments : MAX_PHYS_SEGMENTS); | 713 | blk_queue_max_segments(q, max_segments ? max_segments : BLK_MAX_SEGMENTS); |
714 | blk_queue_max_hw_segments(q, max_segments ? max_segments : MAX_HW_SEGMENTS); | ||
715 | blk_queue_max_segment_size(q, max_seg_s); | 714 | blk_queue_max_segment_size(q, max_seg_s); |
716 | blk_queue_logical_block_size(q, 512); | 715 | blk_queue_logical_block_size(q, 512); |
717 | blk_queue_segment_boundary(q, PAGE_SIZE-1); | 716 | blk_queue_segment_boundary(q, PAGE_SIZE-1); |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 3266b4f65daa..b9b117059b62 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -4234,7 +4234,7 @@ static int __init floppy_init(void) | |||
4234 | err = -ENOMEM; | 4234 | err = -ENOMEM; |
4235 | goto out_unreg_driver; | 4235 | goto out_unreg_driver; |
4236 | } | 4236 | } |
4237 | blk_queue_max_sectors(floppy_queue, 64); | 4237 | blk_queue_max_hw_sectors(floppy_queue, 64); |
4238 | 4238 | ||
4239 | blk_register_region(MKDEV(FLOPPY_MAJOR, 0), 256, THIS_MODULE, | 4239 | blk_register_region(MKDEV(FLOPPY_MAJOR, 0), 256, THIS_MODULE, |
4240 | floppy_find, NULL, NULL); | 4240 | floppy_find, NULL, NULL); |
diff --git a/drivers/block/hd.c b/drivers/block/hd.c index d5cdce08ffd2..5116c65c07cb 100644 --- a/drivers/block/hd.c +++ b/drivers/block/hd.c | |||
@@ -719,7 +719,7 @@ static int __init hd_init(void) | |||
719 | return -ENOMEM; | 719 | return -ENOMEM; |
720 | } | 720 | } |
721 | 721 | ||
722 | blk_queue_max_sectors(hd_queue, 255); | 722 | blk_queue_max_hw_sectors(hd_queue, 255); |
723 | init_timer(&device_timer); | 723 | init_timer(&device_timer); |
724 | device_timer.function = hd_times_out; | 724 | device_timer.function = hd_times_out; |
725 | blk_queue_logical_block_size(hd_queue, 512); | 725 | blk_queue_logical_block_size(hd_queue, 512); |
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c index 02b2583df7fc..5416c9a606e4 100644 --- a/drivers/block/mg_disk.c +++ b/drivers/block/mg_disk.c | |||
@@ -980,7 +980,7 @@ static int mg_probe(struct platform_device *plat_dev) | |||
980 | __func__, __LINE__); | 980 | __func__, __LINE__); |
981 | goto probe_err_6; | 981 | goto probe_err_6; |
982 | } | 982 | } |
983 | blk_queue_max_sectors(host->breq, MG_MAX_SECTS); | 983 | blk_queue_max_hw_sectors(host->breq, MG_MAX_SECTS); |
984 | blk_queue_logical_block_size(host->breq, MG_SECTOR_SIZE); | 984 | blk_queue_logical_block_size(host->breq, MG_SECTOR_SIZE); |
985 | 985 | ||
986 | init_timer(&host->timer); | 986 | init_timer(&host->timer); |
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index 569e39e8f114..e712cd51af15 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c | |||
@@ -906,7 +906,7 @@ static int __init pd_init(void) | |||
906 | if (!pd_queue) | 906 | if (!pd_queue) |
907 | goto out1; | 907 | goto out1; |
908 | 908 | ||
909 | blk_queue_max_sectors(pd_queue, cluster); | 909 | blk_queue_max_hw_sectors(pd_queue, cluster); |
910 | 910 | ||
911 | if (register_blkdev(major, name)) | 911 | if (register_blkdev(major, name)) |
912 | goto out2; | 912 | goto out2; |
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index ea54ea393553..ddb4f9abd480 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c | |||
@@ -956,8 +956,7 @@ static int __init pf_init(void) | |||
956 | return -ENOMEM; | 956 | return -ENOMEM; |
957 | } | 957 | } |
958 | 958 | ||
959 | blk_queue_max_phys_segments(pf_queue, cluster); | 959 | blk_queue_max_segments(pf_queue, cluster); |
960 | blk_queue_max_hw_segments(pf_queue, cluster); | ||
961 | 960 | ||
962 | for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) { | 961 | for (pf = units, unit = 0; unit < PF_UNITS; pf++, unit++) { |
963 | struct gendisk *disk = pf->disk; | 962 | struct gendisk *disk = pf->disk; |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 68b5957f107c..b72935b8f203 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -569,6 +569,7 @@ static struct packet_data *pkt_alloc_packet_data(int frames) | |||
569 | } | 569 | } |
570 | 570 | ||
571 | spin_lock_init(&pkt->lock); | 571 | spin_lock_init(&pkt->lock); |
572 | bio_list_init(&pkt->orig_bios); | ||
572 | 573 | ||
573 | for (i = 0; i < frames; i++) { | 574 | for (i = 0; i < frames; i++) { |
574 | struct bio *bio = pkt_bio_alloc(1); | 575 | struct bio *bio = pkt_bio_alloc(1); |
@@ -721,43 +722,6 @@ static void pkt_rbtree_insert(struct pktcdvd_device *pd, struct pkt_rb_node *nod | |||
721 | } | 722 | } |
722 | 723 | ||
723 | /* | 724 | /* |
724 | * Add a bio to a single linked list defined by its head and tail pointers. | ||
725 | */ | ||
726 | static void pkt_add_list_last(struct bio *bio, struct bio **list_head, struct bio **list_tail) | ||
727 | { | ||
728 | bio->bi_next = NULL; | ||
729 | if (*list_tail) { | ||
730 | BUG_ON((*list_head) == NULL); | ||
731 | (*list_tail)->bi_next = bio; | ||
732 | (*list_tail) = bio; | ||
733 | } else { | ||
734 | BUG_ON((*list_head) != NULL); | ||
735 | (*list_head) = bio; | ||
736 | (*list_tail) = bio; | ||
737 | } | ||
738 | } | ||
739 | |||
740 | /* | ||
741 | * Remove and return the first bio from a single linked list defined by its | ||
742 | * head and tail pointers. | ||
743 | */ | ||
744 | static inline struct bio *pkt_get_list_first(struct bio **list_head, struct bio **list_tail) | ||
745 | { | ||
746 | struct bio *bio; | ||
747 | |||
748 | if (*list_head == NULL) | ||
749 | return NULL; | ||
750 | |||
751 | bio = *list_head; | ||
752 | *list_head = bio->bi_next; | ||
753 | if (*list_head == NULL) | ||
754 | *list_tail = NULL; | ||
755 | |||
756 | bio->bi_next = NULL; | ||
757 | return bio; | ||
758 | } | ||
759 | |||
760 | /* | ||
761 | * Send a packet_command to the underlying block device and | 725 | * Send a packet_command to the underlying block device and |
762 | * wait for completion. | 726 | * wait for completion. |
763 | */ | 727 | */ |
@@ -876,13 +840,10 @@ static noinline_for_stack int pkt_set_speed(struct pktcdvd_device *pd, | |||
876 | static void pkt_queue_bio(struct pktcdvd_device *pd, struct bio *bio) | 840 | static void pkt_queue_bio(struct pktcdvd_device *pd, struct bio *bio) |
877 | { | 841 | { |
878 | spin_lock(&pd->iosched.lock); | 842 | spin_lock(&pd->iosched.lock); |
879 | if (bio_data_dir(bio) == READ) { | 843 | if (bio_data_dir(bio) == READ) |
880 | pkt_add_list_last(bio, &pd->iosched.read_queue, | 844 | bio_list_add(&pd->iosched.read_queue, bio); |
881 | &pd->iosched.read_queue_tail); | 845 | else |
882 | } else { | 846 | bio_list_add(&pd->iosched.write_queue, bio); |
883 | pkt_add_list_last(bio, &pd->iosched.write_queue, | ||
884 | &pd->iosched.write_queue_tail); | ||
885 | } | ||
886 | spin_unlock(&pd->iosched.lock); | 847 | spin_unlock(&pd->iosched.lock); |
887 | 848 | ||
888 | atomic_set(&pd->iosched.attention, 1); | 849 | atomic_set(&pd->iosched.attention, 1); |
@@ -917,8 +878,8 @@ static void pkt_iosched_process_queue(struct pktcdvd_device *pd) | |||
917 | int reads_queued, writes_queued; | 878 | int reads_queued, writes_queued; |
918 | 879 | ||
919 | spin_lock(&pd->iosched.lock); | 880 | spin_lock(&pd->iosched.lock); |
920 | reads_queued = (pd->iosched.read_queue != NULL); | 881 | reads_queued = !bio_list_empty(&pd->iosched.read_queue); |
921 | writes_queued = (pd->iosched.write_queue != NULL); | 882 | writes_queued = !bio_list_empty(&pd->iosched.write_queue); |
922 | spin_unlock(&pd->iosched.lock); | 883 | spin_unlock(&pd->iosched.lock); |
923 | 884 | ||
924 | if (!reads_queued && !writes_queued) | 885 | if (!reads_queued && !writes_queued) |
@@ -927,7 +888,7 @@ static void pkt_iosched_process_queue(struct pktcdvd_device *pd) | |||
927 | if (pd->iosched.writing) { | 888 | if (pd->iosched.writing) { |
928 | int need_write_seek = 1; | 889 | int need_write_seek = 1; |
929 | spin_lock(&pd->iosched.lock); | 890 | spin_lock(&pd->iosched.lock); |
930 | bio = pd->iosched.write_queue; | 891 | bio = bio_list_peek(&pd->iosched.write_queue); |
931 | spin_unlock(&pd->iosched.lock); | 892 | spin_unlock(&pd->iosched.lock); |
932 | if (bio && (bio->bi_sector == pd->iosched.last_write)) | 893 | if (bio && (bio->bi_sector == pd->iosched.last_write)) |
933 | need_write_seek = 0; | 894 | need_write_seek = 0; |
@@ -950,13 +911,10 @@ static void pkt_iosched_process_queue(struct pktcdvd_device *pd) | |||
950 | } | 911 | } |
951 | 912 | ||
952 | spin_lock(&pd->iosched.lock); | 913 | spin_lock(&pd->iosched.lock); |
953 | if (pd->iosched.writing) { | 914 | if (pd->iosched.writing) |
954 | bio = pkt_get_list_first(&pd->iosched.write_queue, | 915 | bio = bio_list_pop(&pd->iosched.write_queue); |
955 | &pd->iosched.write_queue_tail); | 916 | else |
956 | } else { | 917 | bio = bio_list_pop(&pd->iosched.read_queue); |
957 | bio = pkt_get_list_first(&pd->iosched.read_queue, | ||
958 | &pd->iosched.read_queue_tail); | ||
959 | } | ||
960 | spin_unlock(&pd->iosched.lock); | 918 | spin_unlock(&pd->iosched.lock); |
961 | 919 | ||
962 | if (!bio) | 920 | if (!bio) |
@@ -992,14 +950,14 @@ static void pkt_iosched_process_queue(struct pktcdvd_device *pd) | |||
992 | static int pkt_set_segment_merging(struct pktcdvd_device *pd, struct request_queue *q) | 950 | static int pkt_set_segment_merging(struct pktcdvd_device *pd, struct request_queue *q) |
993 | { | 951 | { |
994 | if ((pd->settings.size << 9) / CD_FRAMESIZE | 952 | if ((pd->settings.size << 9) / CD_FRAMESIZE |
995 | <= queue_max_phys_segments(q)) { | 953 | <= queue_max_segments(q)) { |
996 | /* | 954 | /* |
997 | * The cdrom device can handle one segment/frame | 955 | * The cdrom device can handle one segment/frame |
998 | */ | 956 | */ |
999 | clear_bit(PACKET_MERGE_SEGS, &pd->flags); | 957 | clear_bit(PACKET_MERGE_SEGS, &pd->flags); |
1000 | return 0; | 958 | return 0; |
1001 | } else if ((pd->settings.size << 9) / PAGE_SIZE | 959 | } else if ((pd->settings.size << 9) / PAGE_SIZE |
1002 | <= queue_max_phys_segments(q)) { | 960 | <= queue_max_segments(q)) { |
1003 | /* | 961 | /* |
1004 | * We can handle this case at the expense of some extra memory | 962 | * We can handle this case at the expense of some extra memory |
1005 | * copies during write operations | 963 | * copies during write operations |
@@ -1114,7 +1072,7 @@ static void pkt_gather_data(struct pktcdvd_device *pd, struct packet_data *pkt) | |||
1114 | int f; | 1072 | int f; |
1115 | char written[PACKET_MAX_SIZE]; | 1073 | char written[PACKET_MAX_SIZE]; |
1116 | 1074 | ||
1117 | BUG_ON(!pkt->orig_bios); | 1075 | BUG_ON(bio_list_empty(&pkt->orig_bios)); |
1118 | 1076 | ||
1119 | atomic_set(&pkt->io_wait, 0); | 1077 | atomic_set(&pkt->io_wait, 0); |
1120 | atomic_set(&pkt->io_errors, 0); | 1078 | atomic_set(&pkt->io_errors, 0); |
@@ -1124,7 +1082,7 @@ static void pkt_gather_data(struct pktcdvd_device *pd, struct packet_data *pkt) | |||
1124 | */ | 1082 | */ |
1125 | memset(written, 0, sizeof(written)); | 1083 | memset(written, 0, sizeof(written)); |
1126 | spin_lock(&pkt->lock); | 1084 | spin_lock(&pkt->lock); |
1127 | for (bio = pkt->orig_bios; bio; bio = bio->bi_next) { | 1085 | bio_list_for_each(bio, &pkt->orig_bios) { |
1128 | int first_frame = (bio->bi_sector - pkt->sector) / (CD_FRAMESIZE >> 9); | 1086 | int first_frame = (bio->bi_sector - pkt->sector) / (CD_FRAMESIZE >> 9); |
1129 | int num_frames = bio->bi_size / CD_FRAMESIZE; | 1087 | int num_frames = bio->bi_size / CD_FRAMESIZE; |
1130 | pd->stats.secs_w += num_frames * (CD_FRAMESIZE >> 9); | 1088 | pd->stats.secs_w += num_frames * (CD_FRAMESIZE >> 9); |
@@ -1363,7 +1321,7 @@ try_next_bio: | |||
1363 | break; | 1321 | break; |
1364 | pkt_rbtree_erase(pd, node); | 1322 | pkt_rbtree_erase(pd, node); |
1365 | spin_lock(&pkt->lock); | 1323 | spin_lock(&pkt->lock); |
1366 | pkt_add_list_last(bio, &pkt->orig_bios, &pkt->orig_bios_tail); | 1324 | bio_list_add(&pkt->orig_bios, bio); |
1367 | pkt->write_size += bio->bi_size / CD_FRAMESIZE; | 1325 | pkt->write_size += bio->bi_size / CD_FRAMESIZE; |
1368 | spin_unlock(&pkt->lock); | 1326 | spin_unlock(&pkt->lock); |
1369 | } | 1327 | } |
@@ -1409,7 +1367,7 @@ static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt) | |||
1409 | */ | 1367 | */ |
1410 | frames_write = 0; | 1368 | frames_write = 0; |
1411 | spin_lock(&pkt->lock); | 1369 | spin_lock(&pkt->lock); |
1412 | for (bio = pkt->orig_bios; bio; bio = bio->bi_next) { | 1370 | bio_list_for_each(bio, &pkt->orig_bios) { |
1413 | int segment = bio->bi_idx; | 1371 | int segment = bio->bi_idx; |
1414 | int src_offs = 0; | 1372 | int src_offs = 0; |
1415 | int first_frame = (bio->bi_sector - pkt->sector) / (CD_FRAMESIZE >> 9); | 1373 | int first_frame = (bio->bi_sector - pkt->sector) / (CD_FRAMESIZE >> 9); |
@@ -1472,20 +1430,14 @@ static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt) | |||
1472 | 1430 | ||
1473 | static void pkt_finish_packet(struct packet_data *pkt, int uptodate) | 1431 | static void pkt_finish_packet(struct packet_data *pkt, int uptodate) |
1474 | { | 1432 | { |
1475 | struct bio *bio, *next; | 1433 | struct bio *bio; |
1476 | 1434 | ||
1477 | if (!uptodate) | 1435 | if (!uptodate) |
1478 | pkt->cache_valid = 0; | 1436 | pkt->cache_valid = 0; |
1479 | 1437 | ||
1480 | /* Finish all bios corresponding to this packet */ | 1438 | /* Finish all bios corresponding to this packet */ |
1481 | bio = pkt->orig_bios; | 1439 | while ((bio = bio_list_pop(&pkt->orig_bios))) |
1482 | while (bio) { | ||
1483 | next = bio->bi_next; | ||
1484 | bio->bi_next = NULL; | ||
1485 | bio_endio(bio, uptodate ? 0 : -EIO); | 1440 | bio_endio(bio, uptodate ? 0 : -EIO); |
1486 | bio = next; | ||
1487 | } | ||
1488 | pkt->orig_bios = pkt->orig_bios_tail = NULL; | ||
1489 | } | 1441 | } |
1490 | 1442 | ||
1491 | static void pkt_run_state_machine(struct pktcdvd_device *pd, struct packet_data *pkt) | 1443 | static void pkt_run_state_machine(struct pktcdvd_device *pd, struct packet_data *pkt) |
@@ -2360,7 +2312,7 @@ static int pkt_open_dev(struct pktcdvd_device *pd, fmode_t write) | |||
2360 | * even if the size is a multiple of the packet size. | 2312 | * even if the size is a multiple of the packet size. |
2361 | */ | 2313 | */ |
2362 | spin_lock_irq(q->queue_lock); | 2314 | spin_lock_irq(q->queue_lock); |
2363 | blk_queue_max_sectors(q, pd->settings.size); | 2315 | blk_queue_max_hw_sectors(q, pd->settings.size); |
2364 | spin_unlock_irq(q->queue_lock); | 2316 | spin_unlock_irq(q->queue_lock); |
2365 | set_bit(PACKET_WRITABLE, &pd->flags); | 2317 | set_bit(PACKET_WRITABLE, &pd->flags); |
2366 | } else { | 2318 | } else { |
@@ -2567,8 +2519,7 @@ static int pkt_make_request(struct request_queue *q, struct bio *bio) | |||
2567 | spin_lock(&pkt->lock); | 2519 | spin_lock(&pkt->lock); |
2568 | if ((pkt->state == PACKET_WAITING_STATE) || | 2520 | if ((pkt->state == PACKET_WAITING_STATE) || |
2569 | (pkt->state == PACKET_READ_WAIT_STATE)) { | 2521 | (pkt->state == PACKET_READ_WAIT_STATE)) { |
2570 | pkt_add_list_last(bio, &pkt->orig_bios, | 2522 | bio_list_add(&pkt->orig_bios, bio); |
2571 | &pkt->orig_bios_tail); | ||
2572 | pkt->write_size += bio->bi_size / CD_FRAMESIZE; | 2523 | pkt->write_size += bio->bi_size / CD_FRAMESIZE; |
2573 | if ((pkt->write_size >= pkt->frames) && | 2524 | if ((pkt->write_size >= pkt->frames) && |
2574 | (pkt->state == PACKET_WAITING_STATE)) { | 2525 | (pkt->state == PACKET_WAITING_STATE)) { |
@@ -2662,7 +2613,7 @@ static void pkt_init_queue(struct pktcdvd_device *pd) | |||
2662 | 2613 | ||
2663 | blk_queue_make_request(q, pkt_make_request); | 2614 | blk_queue_make_request(q, pkt_make_request); |
2664 | blk_queue_logical_block_size(q, CD_FRAMESIZE); | 2615 | blk_queue_logical_block_size(q, CD_FRAMESIZE); |
2665 | blk_queue_max_sectors(q, PACKET_MAX_SECTORS); | 2616 | blk_queue_max_hw_sectors(q, PACKET_MAX_SECTORS); |
2666 | blk_queue_merge_bvec(q, pkt_merge_bvec); | 2617 | blk_queue_merge_bvec(q, pkt_merge_bvec); |
2667 | q->queuedata = pd; | 2618 | q->queuedata = pd; |
2668 | } | 2619 | } |
@@ -2898,6 +2849,8 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev) | |||
2898 | 2849 | ||
2899 | spin_lock_init(&pd->lock); | 2850 | spin_lock_init(&pd->lock); |
2900 | spin_lock_init(&pd->iosched.lock); | 2851 | spin_lock_init(&pd->iosched.lock); |
2852 | bio_list_init(&pd->iosched.read_queue); | ||
2853 | bio_list_init(&pd->iosched.write_queue); | ||
2901 | sprintf(pd->name, DRIVER_NAME"%d", idx); | 2854 | sprintf(pd->name, DRIVER_NAME"%d", idx); |
2902 | init_waitqueue_head(&pd->wqueue); | 2855 | init_waitqueue_head(&pd->wqueue); |
2903 | pd->bio_queue = RB_ROOT; | 2856 | pd->bio_queue = RB_ROOT; |
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c index 03a130dca8ab..bc95469d33c1 100644 --- a/drivers/block/ps3disk.c +++ b/drivers/block/ps3disk.c | |||
@@ -474,7 +474,7 @@ static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev) | |||
474 | 474 | ||
475 | blk_queue_bounce_limit(queue, BLK_BOUNCE_HIGH); | 475 | blk_queue_bounce_limit(queue, BLK_BOUNCE_HIGH); |
476 | 476 | ||
477 | blk_queue_max_sectors(queue, dev->bounce_size >> 9); | 477 | blk_queue_max_hw_sectors(queue, dev->bounce_size >> 9); |
478 | blk_queue_segment_boundary(queue, -1UL); | 478 | blk_queue_segment_boundary(queue, -1UL); |
479 | blk_queue_dma_alignment(queue, dev->blk_size-1); | 479 | blk_queue_dma_alignment(queue, dev->blk_size-1); |
480 | blk_queue_logical_block_size(queue, dev->blk_size); | 480 | blk_queue_logical_block_size(queue, dev->blk_size); |
@@ -482,8 +482,7 @@ static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev) | |||
482 | blk_queue_ordered(queue, QUEUE_ORDERED_DRAIN_FLUSH, | 482 | blk_queue_ordered(queue, QUEUE_ORDERED_DRAIN_FLUSH, |
483 | ps3disk_prepare_flush); | 483 | ps3disk_prepare_flush); |
484 | 484 | ||
485 | blk_queue_max_phys_segments(queue, -1); | 485 | blk_queue_max_segments(queue, -1); |
486 | blk_queue_max_hw_segments(queue, -1); | ||
487 | blk_queue_max_segment_size(queue, dev->bounce_size); | 486 | blk_queue_max_segment_size(queue, dev->bounce_size); |
488 | 487 | ||
489 | gendisk = alloc_disk(PS3DISK_MINORS); | 488 | gendisk = alloc_disk(PS3DISK_MINORS); |
diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c index 1fb6c3135fc8..e44608229972 100644 --- a/drivers/block/ps3vram.c +++ b/drivers/block/ps3vram.c | |||
@@ -751,10 +751,9 @@ static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev) | |||
751 | priv->queue = queue; | 751 | priv->queue = queue; |
752 | queue->queuedata = dev; | 752 | queue->queuedata = dev; |
753 | blk_queue_make_request(queue, ps3vram_make_request); | 753 | blk_queue_make_request(queue, ps3vram_make_request); |
754 | blk_queue_max_phys_segments(queue, MAX_PHYS_SEGMENTS); | 754 | blk_queue_max_segments(queue, BLK_MAX_SEGMENTS); |
755 | blk_queue_max_hw_segments(queue, MAX_HW_SEGMENTS); | 755 | blk_queue_max_segment_size(queue, BLK_MAX_SEGMENT_SIZE); |
756 | blk_queue_max_segment_size(queue, MAX_SEGMENT_SIZE); | 756 | blk_queue_max_hw_sectors(queue, BLK_SAFE_MAX_SECTORS); |
757 | blk_queue_max_sectors(queue, SAFE_MAX_SECTORS); | ||
758 | 757 | ||
759 | gendisk = alloc_disk(1); | 758 | gendisk = alloc_disk(1); |
760 | if (!gendisk) { | 759 | if (!gendisk) { |
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c index 411f064760b4..48e8fee9f2d4 100644 --- a/drivers/block/sunvdc.c +++ b/drivers/block/sunvdc.c | |||
@@ -691,9 +691,8 @@ static int probe_disk(struct vdc_port *port) | |||
691 | 691 | ||
692 | port->disk = g; | 692 | port->disk = g; |
693 | 693 | ||
694 | blk_queue_max_hw_segments(q, port->ring_cookies); | 694 | blk_queue_max_segments(q, port->ring_cookies); |
695 | blk_queue_max_phys_segments(q, port->ring_cookies); | 695 | blk_queue_max_hw_sectors(q, port->max_xfer_size); |
696 | blk_queue_max_sectors(q, port->max_xfer_size); | ||
697 | g->major = vdc_major; | 696 | g->major = vdc_major; |
698 | g->first_minor = port->vio.vdev->dev_no << PARTITION_SHIFT; | 697 | g->first_minor = port->vio.vdev->dev_no << PARTITION_SHIFT; |
699 | strcpy(g->disk_name, port->disk_name); | 698 | strcpy(g->disk_name, port->disk_name); |
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c index a7c4184f4a63..b70f0fca9a42 100644 --- a/drivers/block/sx8.c +++ b/drivers/block/sx8.c | |||
@@ -409,7 +409,7 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
409 | static void carm_remove_one (struct pci_dev *pdev); | 409 | static void carm_remove_one (struct pci_dev *pdev); |
410 | static int carm_bdev_getgeo(struct block_device *bdev, struct hd_geometry *geo); | 410 | static int carm_bdev_getgeo(struct block_device *bdev, struct hd_geometry *geo); |
411 | 411 | ||
412 | static struct pci_device_id carm_pci_tbl[] = { | 412 | static const struct pci_device_id carm_pci_tbl[] = { |
413 | { PCI_VENDOR_ID_PROMISE, 0x8000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, | 413 | { PCI_VENDOR_ID_PROMISE, 0x8000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, |
414 | { PCI_VENDOR_ID_PROMISE, 0x8002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, | 414 | { PCI_VENDOR_ID_PROMISE, 0x8002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, }, |
415 | { } /* terminate list */ | 415 | { } /* terminate list */ |
@@ -1518,8 +1518,7 @@ static int carm_init_disks(struct carm_host *host) | |||
1518 | break; | 1518 | break; |
1519 | } | 1519 | } |
1520 | disk->queue = q; | 1520 | disk->queue = q; |
1521 | blk_queue_max_hw_segments(q, CARM_MAX_REQ_SG); | 1521 | blk_queue_max_segments(q, CARM_MAX_REQ_SG); |
1522 | blk_queue_max_phys_segments(q, CARM_MAX_REQ_SG); | ||
1523 | blk_queue_segment_boundary(q, CARM_SG_BOUNDARY); | 1522 | blk_queue_segment_boundary(q, CARM_SG_BOUNDARY); |
1524 | 1523 | ||
1525 | q->queuedata = port; | 1524 | q->queuedata = port; |
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index c739b203fe91..2e889838e819 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -393,7 +393,7 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum); | |||
393 | #define ub_usb_ids usb_storage_usb_ids | 393 | #define ub_usb_ids usb_storage_usb_ids |
394 | #else | 394 | #else |
395 | 395 | ||
396 | static struct usb_device_id ub_usb_ids[] = { | 396 | static const struct usb_device_id ub_usb_ids[] = { |
397 | { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_SCSI, US_PR_BULK) }, | 397 | { USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_SCSI, US_PR_BULK) }, |
398 | { } | 398 | { } |
399 | }; | 399 | }; |
@@ -2320,10 +2320,9 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum) | |||
2320 | disk->queue = q; | 2320 | disk->queue = q; |
2321 | 2321 | ||
2322 | blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH); | 2322 | blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH); |
2323 | blk_queue_max_hw_segments(q, UB_MAX_REQ_SG); | 2323 | blk_queue_max_segments(q, UB_MAX_REQ_SG); |
2324 | blk_queue_max_phys_segments(q, UB_MAX_REQ_SG); | ||
2325 | blk_queue_segment_boundary(q, 0xffffffff); /* Dubious. */ | 2324 | blk_queue_segment_boundary(q, 0xffffffff); /* Dubious. */ |
2326 | blk_queue_max_sectors(q, UB_MAX_SECTORS); | 2325 | blk_queue_max_hw_sectors(q, UB_MAX_SECTORS); |
2327 | blk_queue_logical_block_size(q, lun->capacity.bsize); | 2326 | blk_queue_logical_block_size(q, lun->capacity.bsize); |
2328 | 2327 | ||
2329 | lun->disk = disk; | 2328 | lun->disk = disk; |
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index 1b3def1e8591..788d93882ab9 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c | |||
@@ -462,9 +462,8 @@ retry: | |||
462 | } | 462 | } |
463 | 463 | ||
464 | d->disk = g; | 464 | d->disk = g; |
465 | blk_queue_max_hw_segments(q, VIOMAXBLOCKDMA); | 465 | blk_queue_max_segments(q, VIOMAXBLOCKDMA); |
466 | blk_queue_max_phys_segments(q, VIOMAXBLOCKDMA); | 466 | blk_queue_max_hw_sectors(q, VIODASD_MAXSECTORS); |
467 | blk_queue_max_sectors(q, VIODASD_MAXSECTORS); | ||
468 | g->major = VIODASD_MAJOR; | 467 | g->major = VIODASD_MAJOR; |
469 | g->first_minor = dev_no << PARTITION_SHIFT; | 468 | g->first_minor = dev_no << PARTITION_SHIFT; |
470 | if (dev_no >= 26) | 469 | if (dev_no >= 26) |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 7eff828b2117..3c64af05fa82 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -435,7 +435,7 @@ static void __devexit virtblk_remove(struct virtio_device *vdev) | |||
435 | kfree(vblk); | 435 | kfree(vblk); |
436 | } | 436 | } |
437 | 437 | ||
438 | static struct virtio_device_id id_table[] = { | 438 | static const struct virtio_device_id id_table[] = { |
439 | { VIRTIO_ID_BLOCK, VIRTIO_DEV_ANY_ID }, | 439 | { VIRTIO_ID_BLOCK, VIRTIO_DEV_ANY_ID }, |
440 | { 0 }, | 440 | { 0 }, |
441 | }; | 441 | }; |
diff --git a/drivers/block/xd.c b/drivers/block/xd.c index d1fd032e7514..1a325fb05c92 100644 --- a/drivers/block/xd.c +++ b/drivers/block/xd.c | |||
@@ -242,7 +242,7 @@ static int __init xd_init(void) | |||
242 | } | 242 | } |
243 | 243 | ||
244 | /* xd_maxsectors depends on controller - so set after detection */ | 244 | /* xd_maxsectors depends on controller - so set after detection */ |
245 | blk_queue_max_sectors(xd_queue, xd_maxsectors); | 245 | blk_queue_max_hw_sectors(xd_queue, xd_maxsectors); |
246 | 246 | ||
247 | for (i = 0; i < xd_drives; i++) | 247 | for (i = 0; i < xd_drives; i++) |
248 | add_disk(xd_gendisk[i]); | 248 | add_disk(xd_gendisk[i]); |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 05a31e55d278..9c09694b2520 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -346,15 +346,14 @@ static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size) | |||
346 | 346 | ||
347 | /* Hard sector size and max sectors impersonate the equiv. hardware. */ | 347 | /* Hard sector size and max sectors impersonate the equiv. hardware. */ |
348 | blk_queue_logical_block_size(rq, sector_size); | 348 | blk_queue_logical_block_size(rq, sector_size); |
349 | blk_queue_max_sectors(rq, 512); | 349 | blk_queue_max_hw_sectors(rq, 512); |
350 | 350 | ||
351 | /* Each segment in a request is up to an aligned page in size. */ | 351 | /* Each segment in a request is up to an aligned page in size. */ |
352 | blk_queue_segment_boundary(rq, PAGE_SIZE - 1); | 352 | blk_queue_segment_boundary(rq, PAGE_SIZE - 1); |
353 | blk_queue_max_segment_size(rq, PAGE_SIZE); | 353 | blk_queue_max_segment_size(rq, PAGE_SIZE); |
354 | 354 | ||
355 | /* Ensure a merged request will fit in a single I/O ring slot. */ | 355 | /* Ensure a merged request will fit in a single I/O ring slot. */ |
356 | blk_queue_max_phys_segments(rq, BLKIF_MAX_SEGMENTS_PER_REQUEST); | 356 | blk_queue_max_segments(rq, BLKIF_MAX_SEGMENTS_PER_REQUEST); |
357 | blk_queue_max_hw_segments(rq, BLKIF_MAX_SEGMENTS_PER_REQUEST); | ||
358 | 357 | ||
359 | /* Make sure buffer addresses are sector-aligned. */ | 358 | /* Make sure buffer addresses are sector-aligned. */ |
360 | blk_queue_dma_alignment(rq, 511); | 359 | blk_queue_dma_alignment(rq, 511); |
@@ -1050,7 +1049,7 @@ static const struct block_device_operations xlvbd_block_fops = | |||
1050 | }; | 1049 | }; |
1051 | 1050 | ||
1052 | 1051 | ||
1053 | static struct xenbus_device_id blkfront_ids[] = { | 1052 | static const struct xenbus_device_id blkfront_ids[] = { |
1054 | { "vbd" }, | 1053 | { "vbd" }, |
1055 | { "" } | 1054 | { "" } |
1056 | }; | 1055 | }; |
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index e5c5415eb45e..e1c95e208a66 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -1227,7 +1227,7 @@ static int __devexit ace_of_remove(struct of_device *op) | |||
1227 | } | 1227 | } |
1228 | 1228 | ||
1229 | /* Match table for of_platform binding */ | 1229 | /* Match table for of_platform binding */ |
1230 | static struct of_device_id ace_of_match[] __devinitdata = { | 1230 | static const struct of_device_id ace_of_match[] __devinitconst = { |
1231 | { .compatible = "xlnx,opb-sysace-1.00.b", }, | 1231 | { .compatible = "xlnx,opb-sysace-1.00.b", }, |
1232 | { .compatible = "xlnx,opb-sysace-1.00.c", }, | 1232 | { .compatible = "xlnx,opb-sysace-1.00.c", }, |
1233 | { .compatible = "xlnx,xps-sysace-1.00.a", }, | 1233 | { .compatible = "xlnx,xps-sysace-1.00.a", }, |
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c index e789e6c9a422..03c71f7698cb 100644 --- a/drivers/cdrom/gdrom.c +++ b/drivers/cdrom/gdrom.c | |||
@@ -741,7 +741,7 @@ static int __devinit probe_gdrom_setupqueue(void) | |||
741 | { | 741 | { |
742 | blk_queue_logical_block_size(gd.gdrom_rq, GDROM_HARD_SECTOR); | 742 | blk_queue_logical_block_size(gd.gdrom_rq, GDROM_HARD_SECTOR); |
743 | /* using DMA so memory will need to be contiguous */ | 743 | /* using DMA so memory will need to be contiguous */ |
744 | blk_queue_max_hw_segments(gd.gdrom_rq, 1); | 744 | blk_queue_max_segments(gd.gdrom_rq, 1); |
745 | /* set a large max size to get most from DMA */ | 745 | /* set a large max size to get most from DMA */ |
746 | blk_queue_max_segment_size(gd.gdrom_rq, 0x40000); | 746 | blk_queue_max_segment_size(gd.gdrom_rq, 0x40000); |
747 | gd.disk->queue = gd.gdrom_rq; | 747 | gd.disk->queue = gd.gdrom_rq; |
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c index 57ca69e0ac55..cc435be0bc13 100644 --- a/drivers/cdrom/viocd.c +++ b/drivers/cdrom/viocd.c | |||
@@ -616,9 +616,8 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
616 | gendisk->first_minor = deviceno; | 616 | gendisk->first_minor = deviceno; |
617 | strncpy(gendisk->disk_name, c->name, | 617 | strncpy(gendisk->disk_name, c->name, |
618 | sizeof(gendisk->disk_name)); | 618 | sizeof(gendisk->disk_name)); |
619 | blk_queue_max_hw_segments(q, 1); | 619 | blk_queue_max_segments(q, 1); |
620 | blk_queue_max_phys_segments(q, 1); | 620 | blk_queue_max_hw_sectors(q, 4096 / 512); |
621 | blk_queue_max_sectors(q, 4096 / 512); | ||
622 | gendisk->queue = q; | 621 | gendisk->queue = q; |
623 | gendisk->fops = &viocd_fops; | 622 | gendisk->fops = &viocd_fops; |
624 | gendisk->flags = GENHD_FL_CD|GENHD_FL_REMOVABLE; | 623 | gendisk->flags = GENHD_FL_CD|GENHD_FL_REMOVABLE; |
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig index 6ea1014697d1..d31483c54883 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig | |||
@@ -114,7 +114,7 @@ config HW_RANDOM_IXP4XX | |||
114 | 114 | ||
115 | config HW_RANDOM_OMAP | 115 | config HW_RANDOM_OMAP |
116 | tristate "OMAP Random Number Generator support" | 116 | tristate "OMAP Random Number Generator support" |
117 | depends on HW_RANDOM && (ARCH_OMAP16XX || ARCH_OMAP24XX) | 117 | depends on HW_RANDOM && (ARCH_OMAP16XX || ARCH_OMAP2) |
118 | default HW_RANDOM | 118 | default HW_RANDOM |
119 | ---help--- | 119 | ---help--- |
120 | This driver provides kernel-side support for the Random Number | 120 | This driver provides kernel-side support for the Random Number |
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index f706b1dffdb3..ada25bb8941e 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c | |||
@@ -1185,11 +1185,6 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw) | |||
1185 | 1185 | ||
1186 | rep = (down == 2); | 1186 | rep = (down == 2); |
1187 | 1187 | ||
1188 | #ifdef CONFIG_MAC_EMUMOUSEBTN | ||
1189 | if (mac_hid_mouse_emulate_buttons(1, keycode, down)) | ||
1190 | return; | ||
1191 | #endif /* CONFIG_MAC_EMUMOUSEBTN */ | ||
1192 | |||
1193 | if ((raw_mode = (kbd->kbdmode == VC_RAW)) && !hw_raw) | 1188 | if ((raw_mode = (kbd->kbdmode == VC_RAW)) && !hw_raw) |
1194 | if (emulate_raw(vc, keycode, !down << 7)) | 1189 | if (emulate_raw(vc, keycode, !down << 7)) |
1195 | if (keycode < BTN_MISC && printk_ratelimit()) | 1190 | if (keycode < BTN_MISC && printk_ratelimit()) |
@@ -1328,6 +1323,21 @@ static void kbd_event(struct input_handle *handle, unsigned int event_type, | |||
1328 | schedule_console_callback(); | 1323 | schedule_console_callback(); |
1329 | } | 1324 | } |
1330 | 1325 | ||
1326 | static bool kbd_match(struct input_handler *handler, struct input_dev *dev) | ||
1327 | { | ||
1328 | int i; | ||
1329 | |||
1330 | if (test_bit(EV_SND, dev->evbit)) | ||
1331 | return true; | ||
1332 | |||
1333 | if (test_bit(EV_KEY, dev->evbit)) | ||
1334 | for (i = KEY_RESERVED; i < BTN_MISC; i++) | ||
1335 | if (test_bit(i, dev->keybit)) | ||
1336 | return true; | ||
1337 | |||
1338 | return false; | ||
1339 | } | ||
1340 | |||
1331 | /* | 1341 | /* |
1332 | * When a keyboard (or other input device) is found, the kbd_connect | 1342 | * When a keyboard (or other input device) is found, the kbd_connect |
1333 | * function is called. The function then looks at the device, and if it | 1343 | * function is called. The function then looks at the device, and if it |
@@ -1339,14 +1349,6 @@ static int kbd_connect(struct input_handler *handler, struct input_dev *dev, | |||
1339 | { | 1349 | { |
1340 | struct input_handle *handle; | 1350 | struct input_handle *handle; |
1341 | int error; | 1351 | int error; |
1342 | int i; | ||
1343 | |||
1344 | for (i = KEY_RESERVED; i < BTN_MISC; i++) | ||
1345 | if (test_bit(i, dev->keybit)) | ||
1346 | break; | ||
1347 | |||
1348 | if (i == BTN_MISC && !test_bit(EV_SND, dev->evbit)) | ||
1349 | return -ENODEV; | ||
1350 | 1352 | ||
1351 | handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL); | 1353 | handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL); |
1352 | if (!handle) | 1354 | if (!handle) |
@@ -1412,6 +1414,7 @@ MODULE_DEVICE_TABLE(input, kbd_ids); | |||
1412 | 1414 | ||
1413 | static struct input_handler kbd_handler = { | 1415 | static struct input_handler kbd_handler = { |
1414 | .event = kbd_event, | 1416 | .event = kbd_event, |
1417 | .match = kbd_match, | ||
1415 | .connect = kbd_connect, | 1418 | .connect = kbd_connect, |
1416 | .disconnect = kbd_disconnect, | 1419 | .disconnect = kbd_disconnect, |
1417 | .start = kbd_start, | 1420 | .start = kbd_start, |
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index fdbcc9fd6d31..5eb83c3ca20d 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c | |||
@@ -336,14 +336,12 @@ static int nvram_ioctl(struct inode *inode, struct file *file, | |||
336 | 336 | ||
337 | static int nvram_open(struct inode *inode, struct file *file) | 337 | static int nvram_open(struct inode *inode, struct file *file) |
338 | { | 338 | { |
339 | lock_kernel(); | ||
340 | spin_lock(&nvram_state_lock); | 339 | spin_lock(&nvram_state_lock); |
341 | 340 | ||
342 | if ((nvram_open_cnt && (file->f_flags & O_EXCL)) || | 341 | if ((nvram_open_cnt && (file->f_flags & O_EXCL)) || |
343 | (nvram_open_mode & NVRAM_EXCL) || | 342 | (nvram_open_mode & NVRAM_EXCL) || |
344 | ((file->f_mode & FMODE_WRITE) && (nvram_open_mode & NVRAM_WRITE))) { | 343 | ((file->f_mode & FMODE_WRITE) && (nvram_open_mode & NVRAM_WRITE))) { |
345 | spin_unlock(&nvram_state_lock); | 344 | spin_unlock(&nvram_state_lock); |
346 | unlock_kernel(); | ||
347 | return -EBUSY; | 345 | return -EBUSY; |
348 | } | 346 | } |
349 | 347 | ||
@@ -354,7 +352,6 @@ static int nvram_open(struct inode *inode, struct file *file) | |||
354 | nvram_open_cnt++; | 352 | nvram_open_cnt++; |
355 | 353 | ||
356 | spin_unlock(&nvram_state_lock); | 354 | spin_unlock(&nvram_state_lock); |
357 | unlock_kernel(); | ||
358 | 355 | ||
359 | return 0; | 356 | return 0; |
360 | } | 357 | } |
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index 6fe4f7701188..578595c4425d 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
@@ -40,7 +40,6 @@ struct sh_cmt_priv { | |||
40 | struct platform_device *pdev; | 40 | struct platform_device *pdev; |
41 | 41 | ||
42 | unsigned long flags; | 42 | unsigned long flags; |
43 | unsigned long flags_suspend; | ||
44 | unsigned long match_value; | 43 | unsigned long match_value; |
45 | unsigned long next_match_value; | 44 | unsigned long next_match_value; |
46 | unsigned long max_match_value; | 45 | unsigned long max_match_value; |
@@ -432,6 +431,11 @@ static void sh_cmt_clocksource_disable(struct clocksource *cs) | |||
432 | sh_cmt_stop(cs_to_sh_cmt(cs), FLAG_CLOCKSOURCE); | 431 | sh_cmt_stop(cs_to_sh_cmt(cs), FLAG_CLOCKSOURCE); |
433 | } | 432 | } |
434 | 433 | ||
434 | static void sh_cmt_clocksource_resume(struct clocksource *cs) | ||
435 | { | ||
436 | sh_cmt_start(cs_to_sh_cmt(cs), FLAG_CLOCKSOURCE); | ||
437 | } | ||
438 | |||
435 | static int sh_cmt_register_clocksource(struct sh_cmt_priv *p, | 439 | static int sh_cmt_register_clocksource(struct sh_cmt_priv *p, |
436 | char *name, unsigned long rating) | 440 | char *name, unsigned long rating) |
437 | { | 441 | { |
@@ -442,6 +446,8 @@ static int sh_cmt_register_clocksource(struct sh_cmt_priv *p, | |||
442 | cs->read = sh_cmt_clocksource_read; | 446 | cs->read = sh_cmt_clocksource_read; |
443 | cs->enable = sh_cmt_clocksource_enable; | 447 | cs->enable = sh_cmt_clocksource_enable; |
444 | cs->disable = sh_cmt_clocksource_disable; | 448 | cs->disable = sh_cmt_clocksource_disable; |
449 | cs->suspend = sh_cmt_clocksource_disable; | ||
450 | cs->resume = sh_cmt_clocksource_resume; | ||
445 | cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8); | 451 | cs->mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8); |
446 | cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; | 452 | cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; |
447 | pr_info("sh_cmt: %s used as clock source\n", cs->name); | 453 | pr_info("sh_cmt: %s used as clock source\n", cs->name); |
@@ -674,38 +680,11 @@ static int __devexit sh_cmt_remove(struct platform_device *pdev) | |||
674 | return -EBUSY; /* cannot unregister clockevent and clocksource */ | 680 | return -EBUSY; /* cannot unregister clockevent and clocksource */ |
675 | } | 681 | } |
676 | 682 | ||
677 | static int sh_cmt_suspend(struct device *dev) | ||
678 | { | ||
679 | struct platform_device *pdev = to_platform_device(dev); | ||
680 | struct sh_cmt_priv *p = platform_get_drvdata(pdev); | ||
681 | |||
682 | /* save flag state and stop CMT channel */ | ||
683 | p->flags_suspend = p->flags; | ||
684 | sh_cmt_stop(p, p->flags); | ||
685 | return 0; | ||
686 | } | ||
687 | |||
688 | static int sh_cmt_resume(struct device *dev) | ||
689 | { | ||
690 | struct platform_device *pdev = to_platform_device(dev); | ||
691 | struct sh_cmt_priv *p = platform_get_drvdata(pdev); | ||
692 | |||
693 | /* start CMT channel from saved state */ | ||
694 | sh_cmt_start(p, p->flags_suspend); | ||
695 | return 0; | ||
696 | } | ||
697 | |||
698 | static struct dev_pm_ops sh_cmt_dev_pm_ops = { | ||
699 | .suspend = sh_cmt_suspend, | ||
700 | .resume = sh_cmt_resume, | ||
701 | }; | ||
702 | |||
703 | static struct platform_driver sh_cmt_device_driver = { | 683 | static struct platform_driver sh_cmt_device_driver = { |
704 | .probe = sh_cmt_probe, | 684 | .probe = sh_cmt_probe, |
705 | .remove = __devexit_p(sh_cmt_remove), | 685 | .remove = __devexit_p(sh_cmt_remove), |
706 | .driver = { | 686 | .driver = { |
707 | .name = "sh_cmt", | 687 | .name = "sh_cmt", |
708 | .pm = &sh_cmt_dev_pm_ops, | ||
709 | } | 688 | } |
710 | }; | 689 | }; |
711 | 690 | ||
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c index d485cdd8cbac..70fef40cd22f 100644 --- a/drivers/firewire/sbp2.c +++ b/drivers/firewire/sbp2.c | |||
@@ -1571,7 +1571,7 @@ static int sbp2_scsi_slave_configure(struct scsi_device *sdev) | |||
1571 | sdev->start_stop_pwr_cond = 1; | 1571 | sdev->start_stop_pwr_cond = 1; |
1572 | 1572 | ||
1573 | if (lu->tgt->workarounds & SBP2_WORKAROUND_128K_MAX_TRANS) | 1573 | if (lu->tgt->workarounds & SBP2_WORKAROUND_128K_MAX_TRANS) |
1574 | blk_queue_max_sectors(sdev->request_queue, 128 * 1024 / 512); | 1574 | blk_queue_max_hw_sectors(sdev->request_queue, 128 * 1024 / 512); |
1575 | 1575 | ||
1576 | blk_queue_max_segment_size(sdev->request_queue, SBP2_MAX_SEG_SIZE); | 1576 | blk_queue_max_segment_size(sdev->request_queue, SBP2_MAX_SEG_SIZE); |
1577 | 1577 | ||
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c index 5d1c2603a130..2b0bd0b042d6 100644 --- a/drivers/i2c/busses/i2c-pnx.c +++ b/drivers/i2c/busses/i2c-pnx.c | |||
@@ -20,15 +20,15 @@ | |||
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/i2c-pnx.h> | 21 | #include <linux/i2c-pnx.h> |
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/err.h> | ||
24 | #include <linux/clk.h> | ||
25 | |||
23 | #include <mach/hardware.h> | 26 | #include <mach/hardware.h> |
24 | #include <mach/i2c.h> | 27 | #include <mach/i2c.h> |
25 | #include <asm/irq.h> | ||
26 | #include <asm/uaccess.h> | ||
27 | 28 | ||
28 | #define I2C_PNX_TIMEOUT 10 /* msec */ | 29 | #define I2C_PNX_TIMEOUT 10 /* msec */ |
29 | #define I2C_PNX_SPEED_KHZ 100 | 30 | #define I2C_PNX_SPEED_KHZ 100 |
30 | #define I2C_PNX_REGION_SIZE 0x100 | 31 | #define I2C_PNX_REGION_SIZE 0x100 |
31 | #define PNX_DEFAULT_FREQ 13 /* MHz */ | ||
32 | 32 | ||
33 | static inline int wait_timeout(long timeout, struct i2c_pnx_algo_data *data) | 33 | static inline int wait_timeout(long timeout, struct i2c_pnx_algo_data *data) |
34 | { | 34 | { |
@@ -50,22 +50,21 @@ static inline int wait_reset(long timeout, struct i2c_pnx_algo_data *data) | |||
50 | return (timeout <= 0); | 50 | return (timeout <= 0); |
51 | } | 51 | } |
52 | 52 | ||
53 | static inline void i2c_pnx_arm_timer(struct i2c_adapter *adap) | 53 | static inline void i2c_pnx_arm_timer(struct i2c_pnx_algo_data *alg_data) |
54 | { | 54 | { |
55 | struct i2c_pnx_algo_data *data = adap->algo_data; | 55 | struct timer_list *timer = &alg_data->mif.timer; |
56 | struct timer_list *timer = &data->mif.timer; | 56 | unsigned long expires = msecs_to_jiffies(I2C_PNX_TIMEOUT); |
57 | int expires = I2C_PNX_TIMEOUT / (1000 / HZ); | ||
58 | 57 | ||
59 | if (expires <= 1) | 58 | if (expires <= 1) |
60 | expires = 2; | 59 | expires = 2; |
61 | 60 | ||
62 | del_timer_sync(timer); | 61 | del_timer_sync(timer); |
63 | 62 | ||
64 | dev_dbg(&adap->dev, "Timer armed at %lu plus %u jiffies.\n", | 63 | dev_dbg(&alg_data->adapter.dev, "Timer armed at %lu plus %lu jiffies.\n", |
65 | jiffies, expires); | 64 | jiffies, expires); |
66 | 65 | ||
67 | timer->expires = jiffies + expires; | 66 | timer->expires = jiffies + expires; |
68 | timer->data = (unsigned long)adap; | 67 | timer->data = (unsigned long)&alg_data; |
69 | 68 | ||
70 | add_timer(timer); | 69 | add_timer(timer); |
71 | } | 70 | } |
@@ -77,34 +76,34 @@ static inline void i2c_pnx_arm_timer(struct i2c_adapter *adap) | |||
77 | * | 76 | * |
78 | * Generate a START signal in the desired mode. | 77 | * Generate a START signal in the desired mode. |
79 | */ | 78 | */ |
80 | static int i2c_pnx_start(unsigned char slave_addr, struct i2c_adapter *adap) | 79 | static int i2c_pnx_start(unsigned char slave_addr, |
80 | struct i2c_pnx_algo_data *alg_data) | ||
81 | { | 81 | { |
82 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | 82 | dev_dbg(&alg_data->adapter.dev, "%s(): addr 0x%x mode %d\n", __func__, |
83 | |||
84 | dev_dbg(&adap->dev, "%s(): addr 0x%x mode %d\n", __func__, | ||
85 | slave_addr, alg_data->mif.mode); | 83 | slave_addr, alg_data->mif.mode); |
86 | 84 | ||
87 | /* Check for 7 bit slave addresses only */ | 85 | /* Check for 7 bit slave addresses only */ |
88 | if (slave_addr & ~0x7f) { | 86 | if (slave_addr & ~0x7f) { |
89 | dev_err(&adap->dev, "%s: Invalid slave address %x. " | 87 | dev_err(&alg_data->adapter.dev, |
90 | "Only 7-bit addresses are supported\n", | 88 | "%s: Invalid slave address %x. Only 7-bit addresses are supported\n", |
91 | adap->name, slave_addr); | 89 | alg_data->adapter.name, slave_addr); |
92 | return -EINVAL; | 90 | return -EINVAL; |
93 | } | 91 | } |
94 | 92 | ||
95 | /* First, make sure bus is idle */ | 93 | /* First, make sure bus is idle */ |
96 | if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) { | 94 | if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) { |
97 | /* Somebody else is monopolizing the bus */ | 95 | /* Somebody else is monopolizing the bus */ |
98 | dev_err(&adap->dev, "%s: Bus busy. Slave addr = %02x, " | 96 | dev_err(&alg_data->adapter.dev, |
99 | "cntrl = %x, stat = %x\n", | 97 | "%s: Bus busy. Slave addr = %02x, cntrl = %x, stat = %x\n", |
100 | adap->name, slave_addr, | 98 | alg_data->adapter.name, slave_addr, |
101 | ioread32(I2C_REG_CTL(alg_data)), | 99 | ioread32(I2C_REG_CTL(alg_data)), |
102 | ioread32(I2C_REG_STS(alg_data))); | 100 | ioread32(I2C_REG_STS(alg_data))); |
103 | return -EBUSY; | 101 | return -EBUSY; |
104 | } else if (ioread32(I2C_REG_STS(alg_data)) & mstatus_afi) { | 102 | } else if (ioread32(I2C_REG_STS(alg_data)) & mstatus_afi) { |
105 | /* Sorry, we lost the bus */ | 103 | /* Sorry, we lost the bus */ |
106 | dev_err(&adap->dev, "%s: Arbitration failure. " | 104 | dev_err(&alg_data->adapter.dev, |
107 | "Slave addr = %02x\n", adap->name, slave_addr); | 105 | "%s: Arbitration failure. Slave addr = %02x\n", |
106 | alg_data->adapter.name, slave_addr); | ||
108 | return -EIO; | 107 | return -EIO; |
109 | } | 108 | } |
110 | 109 | ||
@@ -115,14 +114,14 @@ static int i2c_pnx_start(unsigned char slave_addr, struct i2c_adapter *adap) | |||
115 | iowrite32(ioread32(I2C_REG_STS(alg_data)) | mstatus_tdi | mstatus_afi, | 114 | iowrite32(ioread32(I2C_REG_STS(alg_data)) | mstatus_tdi | mstatus_afi, |
116 | I2C_REG_STS(alg_data)); | 115 | I2C_REG_STS(alg_data)); |
117 | 116 | ||
118 | dev_dbg(&adap->dev, "%s(): sending %#x\n", __func__, | 117 | dev_dbg(&alg_data->adapter.dev, "%s(): sending %#x\n", __func__, |
119 | (slave_addr << 1) | start_bit | alg_data->mif.mode); | 118 | (slave_addr << 1) | start_bit | alg_data->mif.mode); |
120 | 119 | ||
121 | /* Write the slave address, START bit and R/W bit */ | 120 | /* Write the slave address, START bit and R/W bit */ |
122 | iowrite32((slave_addr << 1) | start_bit | alg_data->mif.mode, | 121 | iowrite32((slave_addr << 1) | start_bit | alg_data->mif.mode, |
123 | I2C_REG_TX(alg_data)); | 122 | I2C_REG_TX(alg_data)); |
124 | 123 | ||
125 | dev_dbg(&adap->dev, "%s(): exit\n", __func__); | 124 | dev_dbg(&alg_data->adapter.dev, "%s(): exit\n", __func__); |
126 | 125 | ||
127 | return 0; | 126 | return 0; |
128 | } | 127 | } |
@@ -133,13 +132,12 @@ static int i2c_pnx_start(unsigned char slave_addr, struct i2c_adapter *adap) | |||
133 | * | 132 | * |
134 | * Generate a STOP signal to terminate the master transaction. | 133 | * Generate a STOP signal to terminate the master transaction. |
135 | */ | 134 | */ |
136 | static void i2c_pnx_stop(struct i2c_adapter *adap) | 135 | static void i2c_pnx_stop(struct i2c_pnx_algo_data *alg_data) |
137 | { | 136 | { |
138 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
139 | /* Only 1 msec max timeout due to interrupt context */ | 137 | /* Only 1 msec max timeout due to interrupt context */ |
140 | long timeout = 1000; | 138 | long timeout = 1000; |
141 | 139 | ||
142 | dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n", | 140 | dev_dbg(&alg_data->adapter.dev, "%s(): entering: stat = %04x.\n", |
143 | __func__, ioread32(I2C_REG_STS(alg_data))); | 141 | __func__, ioread32(I2C_REG_STS(alg_data))); |
144 | 142 | ||
145 | /* Write a STOP bit to TX FIFO */ | 143 | /* Write a STOP bit to TX FIFO */ |
@@ -153,7 +151,7 @@ static void i2c_pnx_stop(struct i2c_adapter *adap) | |||
153 | timeout--; | 151 | timeout--; |
154 | } | 152 | } |
155 | 153 | ||
156 | dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n", | 154 | dev_dbg(&alg_data->adapter.dev, "%s(): exiting: stat = %04x.\n", |
157 | __func__, ioread32(I2C_REG_STS(alg_data))); | 155 | __func__, ioread32(I2C_REG_STS(alg_data))); |
158 | } | 156 | } |
159 | 157 | ||
@@ -163,12 +161,11 @@ static void i2c_pnx_stop(struct i2c_adapter *adap) | |||
163 | * | 161 | * |
164 | * Sends one byte of data to the slave | 162 | * Sends one byte of data to the slave |
165 | */ | 163 | */ |
166 | static int i2c_pnx_master_xmit(struct i2c_adapter *adap) | 164 | static int i2c_pnx_master_xmit(struct i2c_pnx_algo_data *alg_data) |
167 | { | 165 | { |
168 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
169 | u32 val; | 166 | u32 val; |
170 | 167 | ||
171 | dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n", | 168 | dev_dbg(&alg_data->adapter.dev, "%s(): entering: stat = %04x.\n", |
172 | __func__, ioread32(I2C_REG_STS(alg_data))); | 169 | __func__, ioread32(I2C_REG_STS(alg_data))); |
173 | 170 | ||
174 | if (alg_data->mif.len > 0) { | 171 | if (alg_data->mif.len > 0) { |
@@ -184,15 +181,15 @@ static int i2c_pnx_master_xmit(struct i2c_adapter *adap) | |||
184 | alg_data->mif.len--; | 181 | alg_data->mif.len--; |
185 | iowrite32(val, I2C_REG_TX(alg_data)); | 182 | iowrite32(val, I2C_REG_TX(alg_data)); |
186 | 183 | ||
187 | dev_dbg(&adap->dev, "%s(): xmit %#x [%d]\n", __func__, | 184 | dev_dbg(&alg_data->adapter.dev, "%s(): xmit %#x [%d]\n", |
188 | val, alg_data->mif.len + 1); | 185 | __func__, val, alg_data->mif.len + 1); |
189 | 186 | ||
190 | if (alg_data->mif.len == 0) { | 187 | if (alg_data->mif.len == 0) { |
191 | if (alg_data->last) { | 188 | if (alg_data->last) { |
192 | /* Wait until the STOP is seen. */ | 189 | /* Wait until the STOP is seen. */ |
193 | if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) | 190 | if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) |
194 | dev_err(&adap->dev, "The bus is still " | 191 | dev_err(&alg_data->adapter.dev, |
195 | "active after timeout\n"); | 192 | "The bus is still active after timeout\n"); |
196 | } | 193 | } |
197 | /* Disable master interrupts */ | 194 | /* Disable master interrupts */ |
198 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) & | 195 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) & |
@@ -201,14 +198,15 @@ static int i2c_pnx_master_xmit(struct i2c_adapter *adap) | |||
201 | 198 | ||
202 | del_timer_sync(&alg_data->mif.timer); | 199 | del_timer_sync(&alg_data->mif.timer); |
203 | 200 | ||
204 | dev_dbg(&adap->dev, "%s(): Waking up xfer routine.\n", | 201 | dev_dbg(&alg_data->adapter.dev, |
202 | "%s(): Waking up xfer routine.\n", | ||
205 | __func__); | 203 | __func__); |
206 | 204 | ||
207 | complete(&alg_data->mif.complete); | 205 | complete(&alg_data->mif.complete); |
208 | } | 206 | } |
209 | } else if (alg_data->mif.len == 0) { | 207 | } else if (alg_data->mif.len == 0) { |
210 | /* zero-sized transfer */ | 208 | /* zero-sized transfer */ |
211 | i2c_pnx_stop(adap); | 209 | i2c_pnx_stop(alg_data); |
212 | 210 | ||
213 | /* Disable master interrupts. */ | 211 | /* Disable master interrupts. */ |
214 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) & | 212 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) & |
@@ -217,13 +215,14 @@ static int i2c_pnx_master_xmit(struct i2c_adapter *adap) | |||
217 | 215 | ||
218 | /* Stop timer. */ | 216 | /* Stop timer. */ |
219 | del_timer_sync(&alg_data->mif.timer); | 217 | del_timer_sync(&alg_data->mif.timer); |
220 | dev_dbg(&adap->dev, "%s(): Waking up xfer routine after " | 218 | dev_dbg(&alg_data->adapter.dev, |
221 | "zero-xfer.\n", __func__); | 219 | "%s(): Waking up xfer routine after zero-xfer.\n", |
220 | __func__); | ||
222 | 221 | ||
223 | complete(&alg_data->mif.complete); | 222 | complete(&alg_data->mif.complete); |
224 | } | 223 | } |
225 | 224 | ||
226 | dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n", | 225 | dev_dbg(&alg_data->adapter.dev, "%s(): exiting: stat = %04x.\n", |
227 | __func__, ioread32(I2C_REG_STS(alg_data))); | 226 | __func__, ioread32(I2C_REG_STS(alg_data))); |
228 | 227 | ||
229 | return 0; | 228 | return 0; |
@@ -235,21 +234,21 @@ static int i2c_pnx_master_xmit(struct i2c_adapter *adap) | |||
235 | * | 234 | * |
236 | * Reads one byte data from the slave | 235 | * Reads one byte data from the slave |
237 | */ | 236 | */ |
238 | static int i2c_pnx_master_rcv(struct i2c_adapter *adap) | 237 | static int i2c_pnx_master_rcv(struct i2c_pnx_algo_data *alg_data) |
239 | { | 238 | { |
240 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
241 | unsigned int val = 0; | 239 | unsigned int val = 0; |
242 | u32 ctl = 0; | 240 | u32 ctl = 0; |
243 | 241 | ||
244 | dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n", | 242 | dev_dbg(&alg_data->adapter.dev, "%s(): entering: stat = %04x.\n", |
245 | __func__, ioread32(I2C_REG_STS(alg_data))); | 243 | __func__, ioread32(I2C_REG_STS(alg_data))); |
246 | 244 | ||
247 | /* Check, whether there is already data, | 245 | /* Check, whether there is already data, |
248 | * or we didn't 'ask' for it yet. | 246 | * or we didn't 'ask' for it yet. |
249 | */ | 247 | */ |
250 | if (ioread32(I2C_REG_STS(alg_data)) & mstatus_rfe) { | 248 | if (ioread32(I2C_REG_STS(alg_data)) & mstatus_rfe) { |
251 | dev_dbg(&adap->dev, "%s(): Write dummy data to fill " | 249 | dev_dbg(&alg_data->adapter.dev, |
252 | "Rx-fifo...\n", __func__); | 250 | "%s(): Write dummy data to fill Rx-fifo...\n", |
251 | __func__); | ||
253 | 252 | ||
254 | if (alg_data->mif.len == 1) { | 253 | if (alg_data->mif.len == 1) { |
255 | /* Last byte, do not acknowledge next rcv. */ | 254 | /* Last byte, do not acknowledge next rcv. */ |
@@ -281,16 +280,16 @@ static int i2c_pnx_master_rcv(struct i2c_adapter *adap) | |||
281 | if (alg_data->mif.len > 0) { | 280 | if (alg_data->mif.len > 0) { |
282 | val = ioread32(I2C_REG_RX(alg_data)); | 281 | val = ioread32(I2C_REG_RX(alg_data)); |
283 | *alg_data->mif.buf++ = (u8) (val & 0xff); | 282 | *alg_data->mif.buf++ = (u8) (val & 0xff); |
284 | dev_dbg(&adap->dev, "%s(): rcv 0x%x [%d]\n", __func__, val, | 283 | dev_dbg(&alg_data->adapter.dev, "%s(): rcv 0x%x [%d]\n", |
285 | alg_data->mif.len); | 284 | __func__, val, alg_data->mif.len); |
286 | 285 | ||
287 | alg_data->mif.len--; | 286 | alg_data->mif.len--; |
288 | if (alg_data->mif.len == 0) { | 287 | if (alg_data->mif.len == 0) { |
289 | if (alg_data->last) | 288 | if (alg_data->last) |
290 | /* Wait until the STOP is seen. */ | 289 | /* Wait until the STOP is seen. */ |
291 | if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) | 290 | if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) |
292 | dev_err(&adap->dev, "The bus is still " | 291 | dev_err(&alg_data->adapter.dev, |
293 | "active after timeout\n"); | 292 | "The bus is still active after timeout\n"); |
294 | 293 | ||
295 | /* Disable master interrupts */ | 294 | /* Disable master interrupts */ |
296 | ctl = ioread32(I2C_REG_CTL(alg_data)); | 295 | ctl = ioread32(I2C_REG_CTL(alg_data)); |
@@ -304,7 +303,7 @@ static int i2c_pnx_master_rcv(struct i2c_adapter *adap) | |||
304 | } | 303 | } |
305 | } | 304 | } |
306 | 305 | ||
307 | dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n", | 306 | dev_dbg(&alg_data->adapter.dev, "%s(): exiting: stat = %04x.\n", |
308 | __func__, ioread32(I2C_REG_STS(alg_data))); | 307 | __func__, ioread32(I2C_REG_STS(alg_data))); |
309 | 308 | ||
310 | return 0; | 309 | return 0; |
@@ -312,11 +311,11 @@ static int i2c_pnx_master_rcv(struct i2c_adapter *adap) | |||
312 | 311 | ||
313 | static irqreturn_t i2c_pnx_interrupt(int irq, void *dev_id) | 312 | static irqreturn_t i2c_pnx_interrupt(int irq, void *dev_id) |
314 | { | 313 | { |
314 | struct i2c_pnx_algo_data *alg_data = dev_id; | ||
315 | u32 stat, ctl; | 315 | u32 stat, ctl; |
316 | struct i2c_adapter *adap = dev_id; | ||
317 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
318 | 316 | ||
319 | dev_dbg(&adap->dev, "%s(): mstat = %x mctrl = %x, mode = %d\n", | 317 | dev_dbg(&alg_data->adapter.dev, |
318 | "%s(): mstat = %x mctrl = %x, mode = %d\n", | ||
320 | __func__, | 319 | __func__, |
321 | ioread32(I2C_REG_STS(alg_data)), | 320 | ioread32(I2C_REG_STS(alg_data)), |
322 | ioread32(I2C_REG_CTL(alg_data)), | 321 | ioread32(I2C_REG_CTL(alg_data)), |
@@ -339,10 +338,10 @@ static irqreturn_t i2c_pnx_interrupt(int irq, void *dev_id) | |||
339 | complete(&alg_data->mif.complete); | 338 | complete(&alg_data->mif.complete); |
340 | } else if (stat & mstatus_nai) { | 339 | } else if (stat & mstatus_nai) { |
341 | /* Slave did not acknowledge, generate a STOP */ | 340 | /* Slave did not acknowledge, generate a STOP */ |
342 | dev_dbg(&adap->dev, "%s(): " | 341 | dev_dbg(&alg_data->adapter.dev, |
343 | "Slave did not acknowledge, generating a STOP.\n", | 342 | "%s(): Slave did not acknowledge, generating a STOP.\n", |
344 | __func__); | 343 | __func__); |
345 | i2c_pnx_stop(adap); | 344 | i2c_pnx_stop(alg_data); |
346 | 345 | ||
347 | /* Disable master interrupts. */ | 346 | /* Disable master interrupts. */ |
348 | ctl = ioread32(I2C_REG_CTL(alg_data)); | 347 | ctl = ioread32(I2C_REG_CTL(alg_data)); |
@@ -368,9 +367,9 @@ static irqreturn_t i2c_pnx_interrupt(int irq, void *dev_id) | |||
368 | */ | 367 | */ |
369 | if ((stat & mstatus_drmi) || !(stat & mstatus_rfe)) { | 368 | if ((stat & mstatus_drmi) || !(stat & mstatus_rfe)) { |
370 | if (alg_data->mif.mode == I2C_SMBUS_WRITE) { | 369 | if (alg_data->mif.mode == I2C_SMBUS_WRITE) { |
371 | i2c_pnx_master_xmit(adap); | 370 | i2c_pnx_master_xmit(alg_data); |
372 | } else if (alg_data->mif.mode == I2C_SMBUS_READ) { | 371 | } else if (alg_data->mif.mode == I2C_SMBUS_READ) { |
373 | i2c_pnx_master_rcv(adap); | 372 | i2c_pnx_master_rcv(alg_data); |
374 | } | 373 | } |
375 | } | 374 | } |
376 | } | 375 | } |
@@ -379,7 +378,8 @@ static irqreturn_t i2c_pnx_interrupt(int irq, void *dev_id) | |||
379 | stat = ioread32(I2C_REG_STS(alg_data)); | 378 | stat = ioread32(I2C_REG_STS(alg_data)); |
380 | iowrite32(stat | mstatus_tdi | mstatus_afi, I2C_REG_STS(alg_data)); | 379 | iowrite32(stat | mstatus_tdi | mstatus_afi, I2C_REG_STS(alg_data)); |
381 | 380 | ||
382 | dev_dbg(&adap->dev, "%s(): exiting, stat = %x ctrl = %x.\n", | 381 | dev_dbg(&alg_data->adapter.dev, |
382 | "%s(): exiting, stat = %x ctrl = %x.\n", | ||
383 | __func__, ioread32(I2C_REG_STS(alg_data)), | 383 | __func__, ioread32(I2C_REG_STS(alg_data)), |
384 | ioread32(I2C_REG_CTL(alg_data))); | 384 | ioread32(I2C_REG_CTL(alg_data))); |
385 | 385 | ||
@@ -388,14 +388,13 @@ static irqreturn_t i2c_pnx_interrupt(int irq, void *dev_id) | |||
388 | 388 | ||
389 | static void i2c_pnx_timeout(unsigned long data) | 389 | static void i2c_pnx_timeout(unsigned long data) |
390 | { | 390 | { |
391 | struct i2c_adapter *adap = (struct i2c_adapter *)data; | 391 | struct i2c_pnx_algo_data *alg_data = (struct i2c_pnx_algo_data *)data; |
392 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
393 | u32 ctl; | 392 | u32 ctl; |
394 | 393 | ||
395 | dev_err(&adap->dev, "Master timed out. stat = %04x, cntrl = %04x. " | 394 | dev_err(&alg_data->adapter.dev, |
396 | "Resetting master...\n", | 395 | "Master timed out. stat = %04x, cntrl = %04x. Resetting master...\n", |
397 | ioread32(I2C_REG_STS(alg_data)), | 396 | ioread32(I2C_REG_STS(alg_data)), |
398 | ioread32(I2C_REG_CTL(alg_data))); | 397 | ioread32(I2C_REG_CTL(alg_data))); |
399 | 398 | ||
400 | /* Reset master and disable interrupts */ | 399 | /* Reset master and disable interrupts */ |
401 | ctl = ioread32(I2C_REG_CTL(alg_data)); | 400 | ctl = ioread32(I2C_REG_CTL(alg_data)); |
@@ -409,15 +408,14 @@ static void i2c_pnx_timeout(unsigned long data) | |||
409 | complete(&alg_data->mif.complete); | 408 | complete(&alg_data->mif.complete); |
410 | } | 409 | } |
411 | 410 | ||
412 | static inline void bus_reset_if_active(struct i2c_adapter *adap) | 411 | static inline void bus_reset_if_active(struct i2c_pnx_algo_data *alg_data) |
413 | { | 412 | { |
414 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | ||
415 | u32 stat; | 413 | u32 stat; |
416 | 414 | ||
417 | if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_active) { | 415 | if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_active) { |
418 | dev_err(&adap->dev, | 416 | dev_err(&alg_data->adapter.dev, |
419 | "%s: Bus is still active after xfer. Reset it...\n", | 417 | "%s: Bus is still active after xfer. Reset it...\n", |
420 | adap->name); | 418 | alg_data->adapter.name); |
421 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset, | 419 | iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset, |
422 | I2C_REG_CTL(alg_data)); | 420 | I2C_REG_CTL(alg_data)); |
423 | wait_reset(I2C_PNX_TIMEOUT, alg_data); | 421 | wait_reset(I2C_PNX_TIMEOUT, alg_data); |
@@ -451,10 +449,11 @@ i2c_pnx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
451 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | 449 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; |
452 | u32 stat = ioread32(I2C_REG_STS(alg_data)); | 450 | u32 stat = ioread32(I2C_REG_STS(alg_data)); |
453 | 451 | ||
454 | dev_dbg(&adap->dev, "%s(): entering: %d messages, stat = %04x.\n", | 452 | dev_dbg(&alg_data->adapter.dev, |
453 | "%s(): entering: %d messages, stat = %04x.\n", | ||
455 | __func__, num, ioread32(I2C_REG_STS(alg_data))); | 454 | __func__, num, ioread32(I2C_REG_STS(alg_data))); |
456 | 455 | ||
457 | bus_reset_if_active(adap); | 456 | bus_reset_if_active(alg_data); |
458 | 457 | ||
459 | /* Process transactions in a loop. */ | 458 | /* Process transactions in a loop. */ |
460 | for (i = 0; rc >= 0 && i < num; i++) { | 459 | for (i = 0; rc >= 0 && i < num; i++) { |
@@ -464,9 +463,9 @@ i2c_pnx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
464 | addr = pmsg->addr; | 463 | addr = pmsg->addr; |
465 | 464 | ||
466 | if (pmsg->flags & I2C_M_TEN) { | 465 | if (pmsg->flags & I2C_M_TEN) { |
467 | dev_err(&adap->dev, | 466 | dev_err(&alg_data->adapter.dev, |
468 | "%s: 10 bits addr not supported!\n", | 467 | "%s: 10 bits addr not supported!\n", |
469 | adap->name); | 468 | alg_data->adapter.name); |
470 | rc = -EINVAL; | 469 | rc = -EINVAL; |
471 | break; | 470 | break; |
472 | } | 471 | } |
@@ -478,11 +477,10 @@ i2c_pnx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
478 | alg_data->mif.ret = 0; | 477 | alg_data->mif.ret = 0; |
479 | alg_data->last = (i == num - 1); | 478 | alg_data->last = (i == num - 1); |
480 | 479 | ||
481 | dev_dbg(&adap->dev, "%s(): mode %d, %d bytes\n", __func__, | 480 | dev_dbg(&alg_data->adapter.dev, "%s(): mode %d, %d bytes\n", |
482 | alg_data->mif.mode, | 481 | __func__, alg_data->mif.mode, alg_data->mif.len); |
483 | alg_data->mif.len); | ||
484 | 482 | ||
485 | i2c_pnx_arm_timer(adap); | 483 | i2c_pnx_arm_timer(alg_data); |
486 | 484 | ||
487 | /* initialize the completion var */ | 485 | /* initialize the completion var */ |
488 | init_completion(&alg_data->mif.complete); | 486 | init_completion(&alg_data->mif.complete); |
@@ -493,7 +491,7 @@ i2c_pnx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
493 | I2C_REG_CTL(alg_data)); | 491 | I2C_REG_CTL(alg_data)); |
494 | 492 | ||
495 | /* Put start-code and slave-address on the bus. */ | 493 | /* Put start-code and slave-address on the bus. */ |
496 | rc = i2c_pnx_start(addr, adap); | 494 | rc = i2c_pnx_start(addr, alg_data); |
497 | if (rc < 0) | 495 | if (rc < 0) |
498 | break; | 496 | break; |
499 | 497 | ||
@@ -502,31 +500,32 @@ i2c_pnx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
502 | 500 | ||
503 | if (!(rc = alg_data->mif.ret)) | 501 | if (!(rc = alg_data->mif.ret)) |
504 | completed++; | 502 | completed++; |
505 | dev_dbg(&adap->dev, "%s(): Complete, return code = %d.\n", | 503 | dev_dbg(&alg_data->adapter.dev, |
504 | "%s(): Complete, return code = %d.\n", | ||
506 | __func__, rc); | 505 | __func__, rc); |
507 | 506 | ||
508 | /* Clear TDI and AFI bits in case they are set. */ | 507 | /* Clear TDI and AFI bits in case they are set. */ |
509 | if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_tdi) { | 508 | if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_tdi) { |
510 | dev_dbg(&adap->dev, | 509 | dev_dbg(&alg_data->adapter.dev, |
511 | "%s: TDI still set... clearing now.\n", | 510 | "%s: TDI still set... clearing now.\n", |
512 | adap->name); | 511 | alg_data->adapter.name); |
513 | iowrite32(stat, I2C_REG_STS(alg_data)); | 512 | iowrite32(stat, I2C_REG_STS(alg_data)); |
514 | } | 513 | } |
515 | if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_afi) { | 514 | if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_afi) { |
516 | dev_dbg(&adap->dev, | 515 | dev_dbg(&alg_data->adapter.dev, |
517 | "%s: AFI still set... clearing now.\n", | 516 | "%s: AFI still set... clearing now.\n", |
518 | adap->name); | 517 | alg_data->adapter.name); |
519 | iowrite32(stat, I2C_REG_STS(alg_data)); | 518 | iowrite32(stat, I2C_REG_STS(alg_data)); |
520 | } | 519 | } |
521 | } | 520 | } |
522 | 521 | ||
523 | bus_reset_if_active(adap); | 522 | bus_reset_if_active(alg_data); |
524 | 523 | ||
525 | /* Cleanup to be sure... */ | 524 | /* Cleanup to be sure... */ |
526 | alg_data->mif.buf = NULL; | 525 | alg_data->mif.buf = NULL; |
527 | alg_data->mif.len = 0; | 526 | alg_data->mif.len = 0; |
528 | 527 | ||
529 | dev_dbg(&adap->dev, "%s(): exiting, stat = %x\n", | 528 | dev_dbg(&alg_data->adapter.dev, "%s(): exiting, stat = %x\n", |
530 | __func__, ioread32(I2C_REG_STS(alg_data))); | 529 | __func__, ioread32(I2C_REG_STS(alg_data))); |
531 | 530 | ||
532 | if (completed != num) | 531 | if (completed != num) |
@@ -545,69 +544,92 @@ static struct i2c_algorithm pnx_algorithm = { | |||
545 | .functionality = i2c_pnx_func, | 544 | .functionality = i2c_pnx_func, |
546 | }; | 545 | }; |
547 | 546 | ||
547 | #ifdef CONFIG_PM | ||
548 | static int i2c_pnx_controller_suspend(struct platform_device *pdev, | 548 | static int i2c_pnx_controller_suspend(struct platform_device *pdev, |
549 | pm_message_t state) | 549 | pm_message_t state) |
550 | { | 550 | { |
551 | struct i2c_pnx_data *i2c_pnx = platform_get_drvdata(pdev); | 551 | struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); |
552 | return i2c_pnx->suspend(pdev, state); | 552 | |
553 | /* FIXME: shouldn't this be clk_disable? */ | ||
554 | clk_enable(alg_data->clk); | ||
555 | |||
556 | return 0; | ||
553 | } | 557 | } |
554 | 558 | ||
555 | static int i2c_pnx_controller_resume(struct platform_device *pdev) | 559 | static int i2c_pnx_controller_resume(struct platform_device *pdev) |
556 | { | 560 | { |
557 | struct i2c_pnx_data *i2c_pnx = platform_get_drvdata(pdev); | 561 | struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); |
558 | return i2c_pnx->resume(pdev); | 562 | |
563 | return clk_enable(alg_data->clk); | ||
559 | } | 564 | } |
565 | #else | ||
566 | #define i2c_pnx_controller_suspend NULL | ||
567 | #define i2c_pnx_controller_resume NULL | ||
568 | #endif | ||
560 | 569 | ||
561 | static int __devinit i2c_pnx_probe(struct platform_device *pdev) | 570 | static int __devinit i2c_pnx_probe(struct platform_device *pdev) |
562 | { | 571 | { |
563 | unsigned long tmp; | 572 | unsigned long tmp; |
564 | int ret = 0; | 573 | int ret = 0; |
565 | struct i2c_pnx_algo_data *alg_data; | 574 | struct i2c_pnx_algo_data *alg_data; |
566 | int freq_mhz; | 575 | unsigned long freq; |
567 | struct i2c_pnx_data *i2c_pnx = pdev->dev.platform_data; | 576 | struct i2c_pnx_data *i2c_pnx = pdev->dev.platform_data; |
568 | 577 | ||
569 | if (!i2c_pnx || !i2c_pnx->adapter) { | 578 | if (!i2c_pnx || !i2c_pnx->name) { |
570 | dev_err(&pdev->dev, "%s: no platform data supplied\n", | 579 | dev_err(&pdev->dev, "%s: no platform data supplied\n", |
571 | __func__); | 580 | __func__); |
572 | ret = -EINVAL; | 581 | ret = -EINVAL; |
573 | goto out; | 582 | goto out; |
574 | } | 583 | } |
575 | 584 | ||
576 | platform_set_drvdata(pdev, i2c_pnx); | 585 | alg_data = kzalloc(sizeof(*alg_data), GFP_KERNEL); |
577 | 586 | if (!alg_data) { | |
578 | if (i2c_pnx->calculate_input_freq) | 587 | ret = -ENOMEM; |
579 | freq_mhz = i2c_pnx->calculate_input_freq(pdev); | 588 | goto err_kzalloc; |
580 | else { | ||
581 | freq_mhz = PNX_DEFAULT_FREQ; | ||
582 | dev_info(&pdev->dev, "Setting bus frequency to default value: " | ||
583 | "%d MHz\n", freq_mhz); | ||
584 | } | 589 | } |
585 | 590 | ||
586 | i2c_pnx->adapter->algo = &pnx_algorithm; | 591 | platform_set_drvdata(pdev, alg_data); |
592 | |||
593 | strlcpy(alg_data->adapter.name, i2c_pnx->name, | ||
594 | sizeof(alg_data->adapter.name)); | ||
595 | alg_data->adapter.dev.parent = &pdev->dev; | ||
596 | alg_data->adapter.algo = &pnx_algorithm; | ||
597 | alg_data->adapter.algo_data = alg_data; | ||
598 | alg_data->adapter.nr = pdev->id; | ||
599 | alg_data->i2c_pnx = i2c_pnx; | ||
600 | |||
601 | alg_data->clk = clk_get(&pdev->dev, NULL); | ||
602 | if (IS_ERR(alg_data->clk)) { | ||
603 | ret = PTR_ERR(alg_data->clk); | ||
604 | goto out_drvdata; | ||
605 | } | ||
587 | 606 | ||
588 | alg_data = i2c_pnx->adapter->algo_data; | ||
589 | init_timer(&alg_data->mif.timer); | 607 | init_timer(&alg_data->mif.timer); |
590 | alg_data->mif.timer.function = i2c_pnx_timeout; | 608 | alg_data->mif.timer.function = i2c_pnx_timeout; |
591 | alg_data->mif.timer.data = (unsigned long)i2c_pnx->adapter; | 609 | alg_data->mif.timer.data = (unsigned long)alg_data; |
592 | 610 | ||
593 | /* Register I/O resource */ | 611 | /* Register I/O resource */ |
594 | if (!request_mem_region(alg_data->base, I2C_PNX_REGION_SIZE, | 612 | if (!request_mem_region(i2c_pnx->base, I2C_PNX_REGION_SIZE, |
595 | pdev->name)) { | 613 | pdev->name)) { |
596 | dev_err(&pdev->dev, | 614 | dev_err(&pdev->dev, |
597 | "I/O region 0x%08x for I2C already in use.\n", | 615 | "I/O region 0x%08x for I2C already in use.\n", |
598 | alg_data->base); | 616 | i2c_pnx->base); |
599 | ret = -ENODEV; | 617 | ret = -ENODEV; |
600 | goto out_drvdata; | 618 | goto out_clkget; |
601 | } | 619 | } |
602 | 620 | ||
603 | if (!(alg_data->ioaddr = | 621 | alg_data->ioaddr = ioremap(i2c_pnx->base, I2C_PNX_REGION_SIZE); |
604 | (u32)ioremap(alg_data->base, I2C_PNX_REGION_SIZE))) { | 622 | if (!alg_data->ioaddr) { |
605 | dev_err(&pdev->dev, "Couldn't ioremap I2C I/O region\n"); | 623 | dev_err(&pdev->dev, "Couldn't ioremap I2C I/O region\n"); |
606 | ret = -ENOMEM; | 624 | ret = -ENOMEM; |
607 | goto out_release; | 625 | goto out_release; |
608 | } | 626 | } |
609 | 627 | ||
610 | i2c_pnx->set_clock_run(pdev); | 628 | ret = clk_enable(alg_data->clk); |
629 | if (ret) | ||
630 | goto out_unmap; | ||
631 | |||
632 | freq = clk_get_rate(alg_data->clk); | ||
611 | 633 | ||
612 | /* | 634 | /* |
613 | * Clock Divisor High This value is the number of system clocks | 635 | * Clock Divisor High This value is the number of system clocks |
@@ -620,45 +642,47 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev) | |||
620 | * the deglitching filter length. | 642 | * the deglitching filter length. |
621 | */ | 643 | */ |
622 | 644 | ||
623 | tmp = ((freq_mhz * 1000) / I2C_PNX_SPEED_KHZ) / 2 - 2; | 645 | tmp = ((freq / 1000) / I2C_PNX_SPEED_KHZ) / 2 - 2; |
624 | iowrite32(tmp, I2C_REG_CKH(alg_data)); | 646 | iowrite32(tmp, I2C_REG_CKH(alg_data)); |
625 | iowrite32(tmp, I2C_REG_CKL(alg_data)); | 647 | iowrite32(tmp, I2C_REG_CKL(alg_data)); |
626 | 648 | ||
627 | iowrite32(mcntrl_reset, I2C_REG_CTL(alg_data)); | 649 | iowrite32(mcntrl_reset, I2C_REG_CTL(alg_data)); |
628 | if (wait_reset(I2C_PNX_TIMEOUT, alg_data)) { | 650 | if (wait_reset(I2C_PNX_TIMEOUT, alg_data)) { |
629 | ret = -ENODEV; | 651 | ret = -ENODEV; |
630 | goto out_unmap; | 652 | goto out_clock; |
631 | } | 653 | } |
632 | init_completion(&alg_data->mif.complete); | 654 | init_completion(&alg_data->mif.complete); |
633 | 655 | ||
634 | ret = request_irq(alg_data->irq, i2c_pnx_interrupt, | 656 | ret = request_irq(i2c_pnx->irq, i2c_pnx_interrupt, |
635 | 0, pdev->name, i2c_pnx->adapter); | 657 | 0, pdev->name, alg_data); |
636 | if (ret) | 658 | if (ret) |
637 | goto out_clock; | 659 | goto out_clock; |
638 | 660 | ||
639 | /* Register this adapter with the I2C subsystem */ | 661 | /* Register this adapter with the I2C subsystem */ |
640 | i2c_pnx->adapter->dev.parent = &pdev->dev; | 662 | ret = i2c_add_numbered_adapter(&alg_data->adapter); |
641 | i2c_pnx->adapter->nr = pdev->id; | ||
642 | ret = i2c_add_numbered_adapter(i2c_pnx->adapter); | ||
643 | if (ret < 0) { | 663 | if (ret < 0) { |
644 | dev_err(&pdev->dev, "I2C: Failed to add bus\n"); | 664 | dev_err(&pdev->dev, "I2C: Failed to add bus\n"); |
645 | goto out_irq; | 665 | goto out_irq; |
646 | } | 666 | } |
647 | 667 | ||
648 | dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n", | 668 | dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n", |
649 | i2c_pnx->adapter->name, alg_data->base, alg_data->irq); | 669 | alg_data->adapter.name, i2c_pnx->base, i2c_pnx->irq); |
650 | 670 | ||
651 | return 0; | 671 | return 0; |
652 | 672 | ||
653 | out_irq: | 673 | out_irq: |
654 | free_irq(alg_data->irq, i2c_pnx->adapter); | 674 | free_irq(i2c_pnx->irq, alg_data); |
655 | out_clock: | 675 | out_clock: |
656 | i2c_pnx->set_clock_stop(pdev); | 676 | clk_disable(alg_data->clk); |
657 | out_unmap: | 677 | out_unmap: |
658 | iounmap((void *)alg_data->ioaddr); | 678 | iounmap(alg_data->ioaddr); |
659 | out_release: | 679 | out_release: |
660 | release_mem_region(alg_data->base, I2C_PNX_REGION_SIZE); | 680 | release_mem_region(i2c_pnx->base, I2C_PNX_REGION_SIZE); |
681 | out_clkget: | ||
682 | clk_put(alg_data->clk); | ||
661 | out_drvdata: | 683 | out_drvdata: |
684 | kfree(alg_data); | ||
685 | err_kzalloc: | ||
662 | platform_set_drvdata(pdev, NULL); | 686 | platform_set_drvdata(pdev, NULL); |
663 | out: | 687 | out: |
664 | return ret; | 688 | return ret; |
@@ -666,15 +690,16 @@ out: | |||
666 | 690 | ||
667 | static int __devexit i2c_pnx_remove(struct platform_device *pdev) | 691 | static int __devexit i2c_pnx_remove(struct platform_device *pdev) |
668 | { | 692 | { |
669 | struct i2c_pnx_data *i2c_pnx = platform_get_drvdata(pdev); | 693 | struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); |
670 | struct i2c_adapter *adap = i2c_pnx->adapter; | 694 | struct i2c_pnx_data *i2c_pnx = alg_data->i2c_pnx; |
671 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | 695 | |
672 | 696 | free_irq(i2c_pnx->irq, alg_data); | |
673 | free_irq(alg_data->irq, i2c_pnx->adapter); | 697 | i2c_del_adapter(&alg_data->adapter); |
674 | i2c_del_adapter(adap); | 698 | clk_disable(alg_data->clk); |
675 | i2c_pnx->set_clock_stop(pdev); | 699 | iounmap(alg_data->ioaddr); |
676 | iounmap((void *)alg_data->ioaddr); | 700 | release_mem_region(i2c_pnx->base, I2C_PNX_REGION_SIZE); |
677 | release_mem_region(alg_data->base, I2C_PNX_REGION_SIZE); | 701 | clk_put(alg_data->clk); |
702 | kfree(alg_data); | ||
678 | platform_set_drvdata(pdev, NULL); | 703 | platform_set_drvdata(pdev, NULL); |
679 | 704 | ||
680 | return 0; | 705 | return 0; |
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index c0cf45a11b93..5cb01e5c323c 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c | |||
@@ -108,11 +108,11 @@ bool ide_port_acpi(ide_hwif_t *hwif) | |||
108 | * Returns 0 on success, <0 on error. | 108 | * Returns 0 on success, <0 on error. |
109 | */ | 109 | */ |
110 | static int ide_get_dev_handle(struct device *dev, acpi_handle *handle, | 110 | static int ide_get_dev_handle(struct device *dev, acpi_handle *handle, |
111 | acpi_integer *pcidevfn) | 111 | u64 *pcidevfn) |
112 | { | 112 | { |
113 | struct pci_dev *pdev = to_pci_dev(dev); | 113 | struct pci_dev *pdev = to_pci_dev(dev); |
114 | unsigned int bus, devnum, func; | 114 | unsigned int bus, devnum, func; |
115 | acpi_integer addr; | 115 | u64 addr; |
116 | acpi_handle dev_handle; | 116 | acpi_handle dev_handle; |
117 | acpi_status status; | 117 | acpi_status status; |
118 | struct acpi_device_info *dinfo = NULL; | 118 | struct acpi_device_info *dinfo = NULL; |
@@ -122,7 +122,7 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle, | |||
122 | devnum = PCI_SLOT(pdev->devfn); | 122 | devnum = PCI_SLOT(pdev->devfn); |
123 | func = PCI_FUNC(pdev->devfn); | 123 | func = PCI_FUNC(pdev->devfn); |
124 | /* ACPI _ADR encoding for PCI bus: */ | 124 | /* ACPI _ADR encoding for PCI bus: */ |
125 | addr = (acpi_integer)(devnum << 16 | func); | 125 | addr = (u64)(devnum << 16 | func); |
126 | 126 | ||
127 | DEBPRINT("ENTER: pci %02x:%02x.%01x\n", bus, devnum, func); | 127 | DEBPRINT("ENTER: pci %02x:%02x.%01x\n", bus, devnum, func); |
128 | 128 | ||
@@ -169,7 +169,7 @@ static acpi_handle ide_acpi_hwif_get_handle(ide_hwif_t *hwif) | |||
169 | { | 169 | { |
170 | struct device *dev = hwif->gendev.parent; | 170 | struct device *dev = hwif->gendev.parent; |
171 | acpi_handle uninitialized_var(dev_handle); | 171 | acpi_handle uninitialized_var(dev_handle); |
172 | acpi_integer pcidevfn; | 172 | u64 pcidevfn; |
173 | acpi_handle chan_handle; | 173 | acpi_handle chan_handle; |
174 | int err; | 174 | int err; |
175 | 175 | ||
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 7f878017b736..3b128dce9c3a 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -679,7 +679,7 @@ static void ide_disk_setup(ide_drive_t *drive) | |||
679 | if (max_s > hwif->rqsize) | 679 | if (max_s > hwif->rqsize) |
680 | max_s = hwif->rqsize; | 680 | max_s = hwif->rqsize; |
681 | 681 | ||
682 | blk_queue_max_sectors(q, max_s); | 682 | blk_queue_max_hw_sectors(q, max_s); |
683 | } | 683 | } |
684 | 684 | ||
685 | printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name, | 685 | printk(KERN_INFO "%s: max request size: %dKiB\n", drive->name, |
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index fefbdfc8db06..efd907623469 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -486,7 +486,7 @@ static void ide_floppy_setup(ide_drive_t *drive) | |||
486 | drive->atapi_flags |= IDE_AFLAG_ZIP_DRIVE; | 486 | drive->atapi_flags |= IDE_AFLAG_ZIP_DRIVE; |
487 | /* This value will be visible in the /proc/ide/hdx/settings */ | 487 | /* This value will be visible in the /proc/ide/hdx/settings */ |
488 | drive->pc_delay = IDEFLOPPY_PC_DELAY; | 488 | drive->pc_delay = IDEFLOPPY_PC_DELAY; |
489 | blk_queue_max_sectors(drive->queue, 64); | 489 | blk_queue_max_hw_sectors(drive->queue, 64); |
490 | } | 490 | } |
491 | 491 | ||
492 | /* | 492 | /* |
@@ -494,7 +494,7 @@ static void ide_floppy_setup(ide_drive_t *drive) | |||
494 | * nasty clicking noises without it, so please don't remove this. | 494 | * nasty clicking noises without it, so please don't remove this. |
495 | */ | 495 | */ |
496 | if (strncmp((char *)&id[ATA_ID_PROD], "IOMEGA Clik!", 11) == 0) { | 496 | if (strncmp((char *)&id[ATA_ID_PROD], "IOMEGA Clik!", 11) == 0) { |
497 | blk_queue_max_sectors(drive->queue, 64); | 497 | blk_queue_max_hw_sectors(drive->queue, 64); |
498 | drive->atapi_flags |= IDE_AFLAG_CLIK_DRIVE; | 498 | drive->atapi_flags |= IDE_AFLAG_CLIK_DRIVE; |
499 | /* IOMEGA Clik! drives do not support lock/unlock commands */ | 499 | /* IOMEGA Clik! drives do not support lock/unlock commands */ |
500 | drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING; | 500 | drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING; |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 4d76ba473097..f8c1ae6ad74c 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -774,7 +774,7 @@ static int ide_init_queue(ide_drive_t *drive) | |||
774 | 774 | ||
775 | if (hwif->rqsize < max_sectors) | 775 | if (hwif->rqsize < max_sectors) |
776 | max_sectors = hwif->rqsize; | 776 | max_sectors = hwif->rqsize; |
777 | blk_queue_max_sectors(q, max_sectors); | 777 | blk_queue_max_hw_sectors(q, max_sectors); |
778 | 778 | ||
779 | #ifdef CONFIG_PCI | 779 | #ifdef CONFIG_PCI |
780 | /* When we have an IOMMU, we may have a problem where pci_map_sg() | 780 | /* When we have an IOMMU, we may have a problem where pci_map_sg() |
@@ -790,8 +790,7 @@ static int ide_init_queue(ide_drive_t *drive) | |||
790 | max_sg_entries >>= 1; | 790 | max_sg_entries >>= 1; |
791 | #endif /* CONFIG_PCI */ | 791 | #endif /* CONFIG_PCI */ |
792 | 792 | ||
793 | blk_queue_max_hw_segments(q, max_sg_entries); | 793 | blk_queue_max_segments(q, max_sg_entries); |
794 | blk_queue_max_phys_segments(q, max_sg_entries); | ||
795 | 794 | ||
796 | /* assign drive queue */ | 795 | /* assign drive queue */ |
797 | drive->queue = q; | 796 | drive->queue = q; |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index f199896c4113..c88696a6cf8a 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -2020,7 +2020,7 @@ static int sbp2scsi_slave_configure(struct scsi_device *sdev) | |||
2020 | if (lu->workarounds & SBP2_WORKAROUND_POWER_CONDITION) | 2020 | if (lu->workarounds & SBP2_WORKAROUND_POWER_CONDITION) |
2021 | sdev->start_stop_pwr_cond = 1; | 2021 | sdev->start_stop_pwr_cond = 1; |
2022 | if (lu->workarounds & SBP2_WORKAROUND_128K_MAX_TRANS) | 2022 | if (lu->workarounds & SBP2_WORKAROUND_128K_MAX_TRANS) |
2023 | blk_queue_max_sectors(sdev->request_queue, 128 * 1024 / 512); | 2023 | blk_queue_max_hw_sectors(sdev->request_queue, 128 * 1024 / 512); |
2024 | 2024 | ||
2025 | blk_queue_max_segment_size(sdev->request_queue, SBP2_MAX_SEG_SIZE); | 2025 | blk_queue_max_segment_size(sdev->request_queue, SBP2_MAX_SEG_SIZE); |
2026 | return 0; | 2026 | return 0; |
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 258c639571b5..9f9816baeb97 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -278,6 +278,8 @@ static int evdev_open(struct inode *inode, struct file *file) | |||
278 | goto err_free_client; | 278 | goto err_free_client; |
279 | 279 | ||
280 | file->private_data = client; | 280 | file->private_data = client; |
281 | nonseekable_open(inode, file); | ||
282 | |||
281 | return 0; | 283 | return 0; |
282 | 284 | ||
283 | err_free_client: | 285 | err_free_client: |
diff --git a/drivers/input/gameport/emu10k1-gp.c b/drivers/input/gameport/emu10k1-gp.c index b04930f7ea7d..7392992da424 100644 --- a/drivers/input/gameport/emu10k1-gp.c +++ b/drivers/input/gameport/emu10k1-gp.c | |||
@@ -46,7 +46,7 @@ struct emu { | |||
46 | int size; | 46 | int size; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | static struct pci_device_id emu_tbl[] = { | 49 | static const struct pci_device_id emu_tbl[] = { |
50 | 50 | ||
51 | { 0x1102, 0x7002, PCI_ANY_ID, PCI_ANY_ID }, /* SB Live gameport */ | 51 | { 0x1102, 0x7002, PCI_ANY_ID, PCI_ANY_ID }, /* SB Live gameport */ |
52 | { 0x1102, 0x7003, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy gameport */ | 52 | { 0x1102, 0x7003, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy gameport */ |
diff --git a/drivers/input/gameport/fm801-gp.c b/drivers/input/gameport/fm801-gp.c index 8a1810f88b9e..14d3f3e208a2 100644 --- a/drivers/input/gameport/fm801-gp.c +++ b/drivers/input/gameport/fm801-gp.c | |||
@@ -140,7 +140,7 @@ static void __devexit fm801_gp_remove(struct pci_dev *pci) | |||
140 | } | 140 | } |
141 | } | 141 | } |
142 | 142 | ||
143 | static struct pci_device_id fm801_gp_id_table[] = { | 143 | static const struct pci_device_id fm801_gp_id_table[] = { |
144 | { PCI_VENDOR_ID_FORTEMEDIA, PCI_DEVICE_ID_FM801_GP, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 144 | { PCI_VENDOR_ID_FORTEMEDIA, PCI_DEVICE_ID_FM801_GP, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
145 | { 0 } | 145 | { 0 } |
146 | }; | 146 | }; |
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index ac11be08585e..7e18bcf05a66 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -11,6 +11,8 @@ | |||
11 | * the Free Software Foundation. | 11 | * the Free Software Foundation. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
15 | |||
14 | #include <linux/stddef.h> | 16 | #include <linux/stddef.h> |
15 | #include <linux/module.h> | 17 | #include <linux/module.h> |
16 | #include <linux/ioport.h> | 18 | #include <linux/ioport.h> |
@@ -190,9 +192,8 @@ static int gameport_bind_driver(struct gameport *gameport, struct gameport_drive | |||
190 | 192 | ||
191 | error = device_bind_driver(&gameport->dev); | 193 | error = device_bind_driver(&gameport->dev); |
192 | if (error) { | 194 | if (error) { |
193 | printk(KERN_WARNING | 195 | dev_warn(&gameport->dev, |
194 | "gameport: device_bind_driver() failed " | 196 | "device_bind_driver() failed for %s (%s) and %s, error: %d\n", |
195 | "for %s (%s) and %s, error: %d\n", | ||
196 | gameport->phys, gameport->name, | 197 | gameport->phys, gameport->name, |
197 | drv->description, error); | 198 | drv->description, error); |
198 | drv->disconnect(gameport); | 199 | drv->disconnect(gameport); |
@@ -209,9 +210,9 @@ static void gameport_find_driver(struct gameport *gameport) | |||
209 | 210 | ||
210 | error = device_attach(&gameport->dev); | 211 | error = device_attach(&gameport->dev); |
211 | if (error < 0) | 212 | if (error < 0) |
212 | printk(KERN_WARNING | 213 | dev_warn(&gameport->dev, |
213 | "gameport: device_attach() failed for %s (%s), error: %d\n", | 214 | "device_attach() failed for %s (%s), error: %d\n", |
214 | gameport->phys, gameport->name, error); | 215 | gameport->phys, gameport->name, error); |
215 | } | 216 | } |
216 | 217 | ||
217 | 218 | ||
@@ -262,17 +263,14 @@ static int gameport_queue_event(void *object, struct module *owner, | |||
262 | 263 | ||
263 | event = kmalloc(sizeof(struct gameport_event), GFP_ATOMIC); | 264 | event = kmalloc(sizeof(struct gameport_event), GFP_ATOMIC); |
264 | if (!event) { | 265 | if (!event) { |
265 | printk(KERN_ERR | 266 | pr_err("Not enough memory to queue event %d\n", event_type); |
266 | "gameport: Not enough memory to queue event %d\n", | ||
267 | event_type); | ||
268 | retval = -ENOMEM; | 267 | retval = -ENOMEM; |
269 | goto out; | 268 | goto out; |
270 | } | 269 | } |
271 | 270 | ||
272 | if (!try_module_get(owner)) { | 271 | if (!try_module_get(owner)) { |
273 | printk(KERN_WARNING | 272 | pr_warning("Can't get module reference, dropping event %d\n", |
274 | "gameport: Can't get module reference, dropping event %d\n", | 273 | event_type); |
275 | event_type); | ||
276 | kfree(event); | 274 | kfree(event); |
277 | retval = -EINVAL; | 275 | retval = -EINVAL; |
278 | goto out; | 276 | goto out; |
@@ -298,14 +296,12 @@ static void gameport_free_event(struct gameport_event *event) | |||
298 | 296 | ||
299 | static void gameport_remove_duplicate_events(struct gameport_event *event) | 297 | static void gameport_remove_duplicate_events(struct gameport_event *event) |
300 | { | 298 | { |
301 | struct list_head *node, *next; | 299 | struct gameport_event *e, *next; |
302 | struct gameport_event *e; | ||
303 | unsigned long flags; | 300 | unsigned long flags; |
304 | 301 | ||
305 | spin_lock_irqsave(&gameport_event_lock, flags); | 302 | spin_lock_irqsave(&gameport_event_lock, flags); |
306 | 303 | ||
307 | list_for_each_safe(node, next, &gameport_event_list) { | 304 | list_for_each_entry_safe(e, next, &gameport_event_list, node) { |
308 | e = list_entry(node, struct gameport_event, node); | ||
309 | if (event->object == e->object) { | 305 | if (event->object == e->object) { |
310 | /* | 306 | /* |
311 | * If this event is of different type we should not | 307 | * If this event is of different type we should not |
@@ -315,7 +311,7 @@ static void gameport_remove_duplicate_events(struct gameport_event *event) | |||
315 | if (event->type != e->type) | 311 | if (event->type != e->type) |
316 | break; | 312 | break; |
317 | 313 | ||
318 | list_del_init(node); | 314 | list_del_init(&e->node); |
319 | gameport_free_event(e); | 315 | gameport_free_event(e); |
320 | } | 316 | } |
321 | } | 317 | } |
@@ -325,23 +321,18 @@ static void gameport_remove_duplicate_events(struct gameport_event *event) | |||
325 | 321 | ||
326 | static struct gameport_event *gameport_get_event(void) | 322 | static struct gameport_event *gameport_get_event(void) |
327 | { | 323 | { |
328 | struct gameport_event *event; | 324 | struct gameport_event *event = NULL; |
329 | struct list_head *node; | ||
330 | unsigned long flags; | 325 | unsigned long flags; |
331 | 326 | ||
332 | spin_lock_irqsave(&gameport_event_lock, flags); | 327 | spin_lock_irqsave(&gameport_event_lock, flags); |
333 | 328 | ||
334 | if (list_empty(&gameport_event_list)) { | 329 | if (!list_empty(&gameport_event_list)) { |
335 | spin_unlock_irqrestore(&gameport_event_lock, flags); | 330 | event = list_first_entry(&gameport_event_list, |
336 | return NULL; | 331 | struct gameport_event, node); |
332 | list_del_init(&event->node); | ||
337 | } | 333 | } |
338 | 334 | ||
339 | node = gameport_event_list.next; | ||
340 | event = list_entry(node, struct gameport_event, node); | ||
341 | list_del_init(node); | ||
342 | |||
343 | spin_unlock_irqrestore(&gameport_event_lock, flags); | 335 | spin_unlock_irqrestore(&gameport_event_lock, flags); |
344 | |||
345 | return event; | 336 | return event; |
346 | } | 337 | } |
347 | 338 | ||
@@ -360,16 +351,14 @@ static void gameport_handle_event(void) | |||
360 | if ((event = gameport_get_event())) { | 351 | if ((event = gameport_get_event())) { |
361 | 352 | ||
362 | switch (event->type) { | 353 | switch (event->type) { |
363 | case GAMEPORT_REGISTER_PORT: | ||
364 | gameport_add_port(event->object); | ||
365 | break; | ||
366 | 354 | ||
367 | case GAMEPORT_ATTACH_DRIVER: | 355 | case GAMEPORT_REGISTER_PORT: |
368 | gameport_attach_driver(event->object); | 356 | gameport_add_port(event->object); |
369 | break; | 357 | break; |
370 | 358 | ||
371 | default: | 359 | case GAMEPORT_ATTACH_DRIVER: |
372 | break; | 360 | gameport_attach_driver(event->object); |
361 | break; | ||
373 | } | 362 | } |
374 | 363 | ||
375 | gameport_remove_duplicate_events(event); | 364 | gameport_remove_duplicate_events(event); |
@@ -385,16 +374,14 @@ static void gameport_handle_event(void) | |||
385 | */ | 374 | */ |
386 | static void gameport_remove_pending_events(void *object) | 375 | static void gameport_remove_pending_events(void *object) |
387 | { | 376 | { |
388 | struct list_head *node, *next; | 377 | struct gameport_event *event, *next; |
389 | struct gameport_event *event; | ||
390 | unsigned long flags; | 378 | unsigned long flags; |
391 | 379 | ||
392 | spin_lock_irqsave(&gameport_event_lock, flags); | 380 | spin_lock_irqsave(&gameport_event_lock, flags); |
393 | 381 | ||
394 | list_for_each_safe(node, next, &gameport_event_list) { | 382 | list_for_each_entry_safe(event, next, &gameport_event_list, node) { |
395 | event = list_entry(node, struct gameport_event, node); | ||
396 | if (event->object == object) { | 383 | if (event->object == object) { |
397 | list_del_init(node); | 384 | list_del_init(&event->node); |
398 | gameport_free_event(event); | 385 | gameport_free_event(event); |
399 | } | 386 | } |
400 | } | 387 | } |
@@ -441,7 +428,6 @@ static int gameport_thread(void *nothing) | |||
441 | kthread_should_stop() || !list_empty(&gameport_event_list)); | 428 | kthread_should_stop() || !list_empty(&gameport_event_list)); |
442 | } while (!kthread_should_stop()); | 429 | } while (!kthread_should_stop()); |
443 | 430 | ||
444 | printk(KERN_DEBUG "gameport: kgameportd exiting\n"); | ||
445 | return 0; | 431 | return 0; |
446 | } | 432 | } |
447 | 433 | ||
@@ -453,6 +439,7 @@ static int gameport_thread(void *nothing) | |||
453 | static ssize_t gameport_show_description(struct device *dev, struct device_attribute *attr, char *buf) | 439 | static ssize_t gameport_show_description(struct device *dev, struct device_attribute *attr, char *buf) |
454 | { | 440 | { |
455 | struct gameport *gameport = to_gameport_port(dev); | 441 | struct gameport *gameport = to_gameport_port(dev); |
442 | |||
456 | return sprintf(buf, "%s\n", gameport->name); | 443 | return sprintf(buf, "%s\n", gameport->name); |
457 | } | 444 | } |
458 | 445 | ||
@@ -521,7 +508,8 @@ static void gameport_init_port(struct gameport *gameport) | |||
521 | 508 | ||
522 | mutex_init(&gameport->drv_mutex); | 509 | mutex_init(&gameport->drv_mutex); |
523 | device_initialize(&gameport->dev); | 510 | device_initialize(&gameport->dev); |
524 | dev_set_name(&gameport->dev, "gameport%lu", (unsigned long)atomic_inc_return(&gameport_no) - 1); | 511 | dev_set_name(&gameport->dev, "gameport%lu", |
512 | (unsigned long)atomic_inc_return(&gameport_no) - 1); | ||
525 | gameport->dev.bus = &gameport_bus; | 513 | gameport->dev.bus = &gameport_bus; |
526 | gameport->dev.release = gameport_release_port; | 514 | gameport->dev.release = gameport_release_port; |
527 | if (gameport->parent) | 515 | if (gameport->parent) |
@@ -550,19 +538,17 @@ static void gameport_add_port(struct gameport *gameport) | |||
550 | list_add_tail(&gameport->node, &gameport_list); | 538 | list_add_tail(&gameport->node, &gameport_list); |
551 | 539 | ||
552 | if (gameport->io) | 540 | if (gameport->io) |
553 | printk(KERN_INFO "gameport: %s is %s, io %#x, speed %dkHz\n", | 541 | dev_info(&gameport->dev, "%s is %s, io %#x, speed %dkHz\n", |
554 | gameport->name, gameport->phys, gameport->io, gameport->speed); | 542 | gameport->name, gameport->phys, gameport->io, gameport->speed); |
555 | else | 543 | else |
556 | printk(KERN_INFO "gameport: %s is %s, speed %dkHz\n", | 544 | dev_info(&gameport->dev, "%s is %s, speed %dkHz\n", |
557 | gameport->name, gameport->phys, gameport->speed); | 545 | gameport->name, gameport->phys, gameport->speed); |
558 | 546 | ||
559 | error = device_add(&gameport->dev); | 547 | error = device_add(&gameport->dev); |
560 | if (error) | 548 | if (error) |
561 | printk(KERN_ERR | 549 | dev_err(&gameport->dev, |
562 | "gameport: device_add() failed for %s (%s), error: %d\n", | 550 | "device_add() failed for %s (%s), error: %d\n", |
563 | gameport->phys, gameport->name, error); | 551 | gameport->phys, gameport->name, error); |
564 | else | ||
565 | gameport->registered = 1; | ||
566 | } | 552 | } |
567 | 553 | ||
568 | /* | 554 | /* |
@@ -584,10 +570,8 @@ static void gameport_destroy_port(struct gameport *gameport) | |||
584 | gameport->parent = NULL; | 570 | gameport->parent = NULL; |
585 | } | 571 | } |
586 | 572 | ||
587 | if (gameport->registered) { | 573 | if (device_is_registered(&gameport->dev)) |
588 | device_del(&gameport->dev); | 574 | device_del(&gameport->dev); |
589 | gameport->registered = 0; | ||
590 | } | ||
591 | 575 | ||
592 | list_del_init(&gameport->node); | 576 | list_del_init(&gameport->node); |
593 | 577 | ||
@@ -705,8 +689,7 @@ static void gameport_attach_driver(struct gameport_driver *drv) | |||
705 | 689 | ||
706 | error = driver_attach(&drv->driver); | 690 | error = driver_attach(&drv->driver); |
707 | if (error) | 691 | if (error) |
708 | printk(KERN_ERR | 692 | pr_err("driver_attach() failed for %s, error: %d\n", |
709 | "gameport: driver_attach() failed for %s, error: %d\n", | ||
710 | drv->driver.name, error); | 693 | drv->driver.name, error); |
711 | } | 694 | } |
712 | 695 | ||
@@ -727,8 +710,7 @@ int __gameport_register_driver(struct gameport_driver *drv, struct module *owner | |||
727 | 710 | ||
728 | error = driver_register(&drv->driver); | 711 | error = driver_register(&drv->driver); |
729 | if (error) { | 712 | if (error) { |
730 | printk(KERN_ERR | 713 | pr_err("driver_register() failed for %s, error: %d\n", |
731 | "gameport: driver_register() failed for %s, error: %d\n", | ||
732 | drv->driver.name, error); | 714 | drv->driver.name, error); |
733 | return error; | 715 | return error; |
734 | } | 716 | } |
@@ -828,7 +810,7 @@ static int __init gameport_init(void) | |||
828 | 810 | ||
829 | error = bus_register(&gameport_bus); | 811 | error = bus_register(&gameport_bus); |
830 | if (error) { | 812 | if (error) { |
831 | printk(KERN_ERR "gameport: failed to register gameport bus, error: %d\n", error); | 813 | pr_err("failed to register gameport bus, error: %d\n", error); |
832 | return error; | 814 | return error; |
833 | } | 815 | } |
834 | 816 | ||
@@ -836,7 +818,7 @@ static int __init gameport_init(void) | |||
836 | if (IS_ERR(gameport_task)) { | 818 | if (IS_ERR(gameport_task)) { |
837 | bus_unregister(&gameport_bus); | 819 | bus_unregister(&gameport_bus); |
838 | error = PTR_ERR(gameport_task); | 820 | error = PTR_ERR(gameport_task); |
839 | printk(KERN_ERR "gameport: Failed to start kgameportd, error: %d\n", error); | 821 | pr_err("Failed to start kgameportd, error: %d\n", error); |
840 | return error; | 822 | return error; |
841 | } | 823 | } |
842 | 824 | ||
diff --git a/drivers/input/gameport/ns558.c b/drivers/input/gameport/ns558.c index db556b71ddda..7c217848613e 100644 --- a/drivers/input/gameport/ns558.c +++ b/drivers/input/gameport/ns558.c | |||
@@ -166,7 +166,7 @@ static int ns558_isa_probe(int io) | |||
166 | 166 | ||
167 | #ifdef CONFIG_PNP | 167 | #ifdef CONFIG_PNP |
168 | 168 | ||
169 | static struct pnp_device_id pnp_devids[] = { | 169 | static const struct pnp_device_id pnp_devids[] = { |
170 | { .id = "@P@0001", .driver_data = 0 }, /* ALS 100 */ | 170 | { .id = "@P@0001", .driver_data = 0 }, /* ALS 100 */ |
171 | { .id = "@P@0020", .driver_data = 0 }, /* ALS 200 */ | 171 | { .id = "@P@0020", .driver_data = 0 }, /* ALS 200 */ |
172 | { .id = "@P@1001", .driver_data = 0 }, /* ALS 100+ */ | 172 | { .id = "@P@1001", .driver_data = 0 }, /* ALS 100+ */ |
diff --git a/drivers/input/input-compat.h b/drivers/input/input-compat.h index 47cd9eaee66a..4d8ea32e8a00 100644 --- a/drivers/input/input-compat.h +++ b/drivers/input/input-compat.h | |||
@@ -21,8 +21,6 @@ | |||
21 | you why the ifdefs are needed? Think about it again. -AK */ | 21 | you why the ifdefs are needed? Think about it again. -AK */ |
22 | #ifdef CONFIG_X86_64 | 22 | #ifdef CONFIG_X86_64 |
23 | # define INPUT_COMPAT_TEST is_compat_task() | 23 | # define INPUT_COMPAT_TEST is_compat_task() |
24 | #elif defined(CONFIG_IA64) | ||
25 | # define INPUT_COMPAT_TEST IS_IA32_PROCESS(task_pt_regs(current)) | ||
26 | #elif defined(CONFIG_S390) | 24 | #elif defined(CONFIG_S390) |
27 | # define INPUT_COMPAT_TEST test_thread_flag(TIF_31BIT) | 25 | # define INPUT_COMPAT_TEST test_thread_flag(TIF_31BIT) |
28 | #elif defined(CONFIG_MIPS) | 26 | #elif defined(CONFIG_MIPS) |
diff --git a/drivers/input/input.c b/drivers/input/input.c index 86cb2d2196ff..41168d5f8c17 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -87,12 +87,14 @@ static int input_defuzz_abs_event(int value, int old_val, int fuzz) | |||
87 | } | 87 | } |
88 | 88 | ||
89 | /* | 89 | /* |
90 | * Pass event through all open handles. This function is called with | 90 | * Pass event first through all filters and then, if event has not been |
91 | * filtered out, through all open handles. This function is called with | ||
91 | * dev->event_lock held and interrupts disabled. | 92 | * dev->event_lock held and interrupts disabled. |
92 | */ | 93 | */ |
93 | static void input_pass_event(struct input_dev *dev, | 94 | static void input_pass_event(struct input_dev *dev, |
94 | unsigned int type, unsigned int code, int value) | 95 | unsigned int type, unsigned int code, int value) |
95 | { | 96 | { |
97 | struct input_handler *handler; | ||
96 | struct input_handle *handle; | 98 | struct input_handle *handle; |
97 | 99 | ||
98 | rcu_read_lock(); | 100 | rcu_read_lock(); |
@@ -100,11 +102,25 @@ static void input_pass_event(struct input_dev *dev, | |||
100 | handle = rcu_dereference(dev->grab); | 102 | handle = rcu_dereference(dev->grab); |
101 | if (handle) | 103 | if (handle) |
102 | handle->handler->event(handle, type, code, value); | 104 | handle->handler->event(handle, type, code, value); |
103 | else | 105 | else { |
104 | list_for_each_entry_rcu(handle, &dev->h_list, d_node) | 106 | bool filtered = false; |
105 | if (handle->open) | 107 | |
106 | handle->handler->event(handle, | 108 | list_for_each_entry_rcu(handle, &dev->h_list, d_node) { |
107 | type, code, value); | 109 | if (!handle->open) |
110 | continue; | ||
111 | |||
112 | handler = handle->handler; | ||
113 | if (!handler->filter) { | ||
114 | if (filtered) | ||
115 | break; | ||
116 | |||
117 | handler->event(handle, type, code, value); | ||
118 | |||
119 | } else if (handler->filter(handle, type, code, value)) | ||
120 | filtered = true; | ||
121 | } | ||
122 | } | ||
123 | |||
108 | rcu_read_unlock(); | 124 | rcu_read_unlock(); |
109 | } | 125 | } |
110 | 126 | ||
@@ -615,12 +631,12 @@ static int input_default_setkeycode(struct input_dev *dev, | |||
615 | } | 631 | } |
616 | } | 632 | } |
617 | 633 | ||
618 | clear_bit(old_keycode, dev->keybit); | 634 | __clear_bit(old_keycode, dev->keybit); |
619 | set_bit(keycode, dev->keybit); | 635 | __set_bit(keycode, dev->keybit); |
620 | 636 | ||
621 | for (i = 0; i < dev->keycodemax; i++) { | 637 | for (i = 0; i < dev->keycodemax; i++) { |
622 | if (input_fetch_keycode(dev, i) == old_keycode) { | 638 | if (input_fetch_keycode(dev, i) == old_keycode) { |
623 | set_bit(old_keycode, dev->keybit); | 639 | __set_bit(old_keycode, dev->keybit); |
624 | break; /* Setting the bit twice is useless, so break */ | 640 | break; /* Setting the bit twice is useless, so break */ |
625 | } | 641 | } |
626 | } | 642 | } |
@@ -678,6 +694,9 @@ int input_set_keycode(struct input_dev *dev, int scancode, int keycode) | |||
678 | if (retval) | 694 | if (retval) |
679 | goto out; | 695 | goto out; |
680 | 696 | ||
697 | /* Make sure KEY_RESERVED did not get enabled. */ | ||
698 | __clear_bit(KEY_RESERVED, dev->keybit); | ||
699 | |||
681 | /* | 700 | /* |
682 | * Simulate keyup event if keycode is not present | 701 | * Simulate keyup event if keycode is not present |
683 | * in the keymap anymore | 702 | * in the keymap anymore |
@@ -705,12 +724,13 @@ EXPORT_SYMBOL(input_set_keycode); | |||
705 | if (i != BITS_TO_LONGS(max)) \ | 724 | if (i != BITS_TO_LONGS(max)) \ |
706 | continue; | 725 | continue; |
707 | 726 | ||
708 | static const struct input_device_id *input_match_device(const struct input_device_id *id, | 727 | static const struct input_device_id *input_match_device(struct input_handler *handler, |
709 | struct input_dev *dev) | 728 | struct input_dev *dev) |
710 | { | 729 | { |
730 | const struct input_device_id *id; | ||
711 | int i; | 731 | int i; |
712 | 732 | ||
713 | for (; id->flags || id->driver_info; id++) { | 733 | for (id = handler->id_table; id->flags || id->driver_info; id++) { |
714 | 734 | ||
715 | if (id->flags & INPUT_DEVICE_ID_MATCH_BUS) | 735 | if (id->flags & INPUT_DEVICE_ID_MATCH_BUS) |
716 | if (id->bustype != dev->id.bustype) | 736 | if (id->bustype != dev->id.bustype) |
@@ -738,7 +758,8 @@ static const struct input_device_id *input_match_device(const struct input_devic | |||
738 | MATCH_BIT(ffbit, FF_MAX); | 758 | MATCH_BIT(ffbit, FF_MAX); |
739 | MATCH_BIT(swbit, SW_MAX); | 759 | MATCH_BIT(swbit, SW_MAX); |
740 | 760 | ||
741 | return id; | 761 | if (!handler->match || handler->match(handler, dev)) |
762 | return id; | ||
742 | } | 763 | } |
743 | 764 | ||
744 | return NULL; | 765 | return NULL; |
@@ -749,10 +770,7 @@ static int input_attach_handler(struct input_dev *dev, struct input_handler *han | |||
749 | const struct input_device_id *id; | 770 | const struct input_device_id *id; |
750 | int error; | 771 | int error; |
751 | 772 | ||
752 | if (handler->blacklist && input_match_device(handler->blacklist, dev)) | 773 | id = input_match_device(handler, dev); |
753 | return -ENODEV; | ||
754 | |||
755 | id = input_match_device(handler->id_table, dev); | ||
756 | if (!id) | 774 | if (!id) |
757 | return -ENODEV; | 775 | return -ENODEV; |
758 | 776 | ||
@@ -988,6 +1006,8 @@ static int input_handlers_seq_show(struct seq_file *seq, void *v) | |||
988 | union input_seq_state *state = (union input_seq_state *)&seq->private; | 1006 | union input_seq_state *state = (union input_seq_state *)&seq->private; |
989 | 1007 | ||
990 | seq_printf(seq, "N: Number=%u Name=%s", state->pos, handler->name); | 1008 | seq_printf(seq, "N: Number=%u Name=%s", state->pos, handler->name); |
1009 | if (handler->filter) | ||
1010 | seq_puts(seq, " (filter)"); | ||
991 | if (handler->fops) | 1011 | if (handler->fops) |
992 | seq_printf(seq, " Minor=%d", handler->minor); | 1012 | seq_printf(seq, " Minor=%d", handler->minor); |
993 | seq_putc(seq, '\n'); | 1013 | seq_putc(seq, '\n'); |
@@ -1551,6 +1571,25 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int | |||
1551 | } | 1571 | } |
1552 | EXPORT_SYMBOL(input_set_capability); | 1572 | EXPORT_SYMBOL(input_set_capability); |
1553 | 1573 | ||
1574 | #define INPUT_CLEANSE_BITMASK(dev, type, bits) \ | ||
1575 | do { \ | ||
1576 | if (!test_bit(EV_##type, dev->evbit)) \ | ||
1577 | memset(dev->bits##bit, 0, \ | ||
1578 | sizeof(dev->bits##bit)); \ | ||
1579 | } while (0) | ||
1580 | |||
1581 | static void input_cleanse_bitmasks(struct input_dev *dev) | ||
1582 | { | ||
1583 | INPUT_CLEANSE_BITMASK(dev, KEY, key); | ||
1584 | INPUT_CLEANSE_BITMASK(dev, REL, rel); | ||
1585 | INPUT_CLEANSE_BITMASK(dev, ABS, abs); | ||
1586 | INPUT_CLEANSE_BITMASK(dev, MSC, msc); | ||
1587 | INPUT_CLEANSE_BITMASK(dev, LED, led); | ||
1588 | INPUT_CLEANSE_BITMASK(dev, SND, snd); | ||
1589 | INPUT_CLEANSE_BITMASK(dev, FF, ff); | ||
1590 | INPUT_CLEANSE_BITMASK(dev, SW, sw); | ||
1591 | } | ||
1592 | |||
1554 | /** | 1593 | /** |
1555 | * input_register_device - register device with input core | 1594 | * input_register_device - register device with input core |
1556 | * @dev: device to be registered | 1595 | * @dev: device to be registered |
@@ -1570,13 +1609,19 @@ int input_register_device(struct input_dev *dev) | |||
1570 | const char *path; | 1609 | const char *path; |
1571 | int error; | 1610 | int error; |
1572 | 1611 | ||
1612 | /* Every input device generates EV_SYN/SYN_REPORT events. */ | ||
1573 | __set_bit(EV_SYN, dev->evbit); | 1613 | __set_bit(EV_SYN, dev->evbit); |
1574 | 1614 | ||
1615 | /* KEY_RESERVED is not supposed to be transmitted to userspace. */ | ||
1616 | __clear_bit(KEY_RESERVED, dev->keybit); | ||
1617 | |||
1618 | /* Make sure that bitmasks not mentioned in dev->evbit are clean. */ | ||
1619 | input_cleanse_bitmasks(dev); | ||
1620 | |||
1575 | /* | 1621 | /* |
1576 | * If delay and period are pre-set by the driver, then autorepeating | 1622 | * If delay and period are pre-set by the driver, then autorepeating |
1577 | * is handled by the driver itself and we don't do it in input.c. | 1623 | * is handled by the driver itself and we don't do it in input.c. |
1578 | */ | 1624 | */ |
1579 | |||
1580 | init_timer(&dev->timer); | 1625 | init_timer(&dev->timer); |
1581 | if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) { | 1626 | if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) { |
1582 | dev->timer.data = (long) dev; | 1627 | dev->timer.data = (long) dev; |
@@ -1776,7 +1821,16 @@ int input_register_handle(struct input_handle *handle) | |||
1776 | error = mutex_lock_interruptible(&dev->mutex); | 1821 | error = mutex_lock_interruptible(&dev->mutex); |
1777 | if (error) | 1822 | if (error) |
1778 | return error; | 1823 | return error; |
1779 | list_add_tail_rcu(&handle->d_node, &dev->h_list); | 1824 | |
1825 | /* | ||
1826 | * Filters go to the head of the list, normal handlers | ||
1827 | * to the tail. | ||
1828 | */ | ||
1829 | if (handler->filter) | ||
1830 | list_add_rcu(&handle->d_node, &dev->h_list); | ||
1831 | else | ||
1832 | list_add_tail_rcu(&handle->d_node, &dev->h_list); | ||
1833 | |||
1780 | mutex_unlock(&dev->mutex); | 1834 | mutex_unlock(&dev->mutex); |
1781 | 1835 | ||
1782 | /* | 1836 | /* |
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index b1bd6dd32286..c52bec4d0530 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
@@ -286,6 +286,8 @@ static int joydev_open(struct inode *inode, struct file *file) | |||
286 | goto err_free_client; | 286 | goto err_free_client; |
287 | 287 | ||
288 | file->private_data = client; | 288 | file->private_data = client; |
289 | nonseekable_open(inode, file); | ||
290 | |||
289 | return 0; | 291 | return 0; |
290 | 292 | ||
291 | err_free_client: | 293 | err_free_client: |
@@ -775,6 +777,20 @@ static void joydev_cleanup(struct joydev *joydev) | |||
775 | input_close_device(handle); | 777 | input_close_device(handle); |
776 | } | 778 | } |
777 | 779 | ||
780 | |||
781 | static bool joydev_match(struct input_handler *handler, struct input_dev *dev) | ||
782 | { | ||
783 | /* Avoid touchpads and touchscreens */ | ||
784 | if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_TOUCH, dev->keybit)) | ||
785 | return false; | ||
786 | |||
787 | /* Avoid tablets, digitisers and similar devices */ | ||
788 | if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_DIGI, dev->keybit)) | ||
789 | return false; | ||
790 | |||
791 | return true; | ||
792 | } | ||
793 | |||
778 | static int joydev_connect(struct input_handler *handler, struct input_dev *dev, | 794 | static int joydev_connect(struct input_handler *handler, struct input_dev *dev, |
779 | const struct input_device_id *id) | 795 | const struct input_device_id *id) |
780 | { | 796 | { |
@@ -894,22 +910,6 @@ static void joydev_disconnect(struct input_handle *handle) | |||
894 | put_device(&joydev->dev); | 910 | put_device(&joydev->dev); |
895 | } | 911 | } |
896 | 912 | ||
897 | static const struct input_device_id joydev_blacklist[] = { | ||
898 | { | ||
899 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | | ||
900 | INPUT_DEVICE_ID_MATCH_KEYBIT, | ||
901 | .evbit = { BIT_MASK(EV_KEY) }, | ||
902 | .keybit = { [BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH) }, | ||
903 | }, /* Avoid itouchpads and touchscreens */ | ||
904 | { | ||
905 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | | ||
906 | INPUT_DEVICE_ID_MATCH_KEYBIT, | ||
907 | .evbit = { BIT_MASK(EV_KEY) }, | ||
908 | .keybit = { [BIT_WORD(BTN_DIGI)] = BIT_MASK(BTN_DIGI) }, | ||
909 | }, /* Avoid tablets, digitisers and similar devices */ | ||
910 | { } /* Terminating entry */ | ||
911 | }; | ||
912 | |||
913 | static const struct input_device_id joydev_ids[] = { | 913 | static const struct input_device_id joydev_ids[] = { |
914 | { | 914 | { |
915 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | | 915 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT | |
@@ -936,13 +936,13 @@ MODULE_DEVICE_TABLE(input, joydev_ids); | |||
936 | 936 | ||
937 | static struct input_handler joydev_handler = { | 937 | static struct input_handler joydev_handler = { |
938 | .event = joydev_event, | 938 | .event = joydev_event, |
939 | .match = joydev_match, | ||
939 | .connect = joydev_connect, | 940 | .connect = joydev_connect, |
940 | .disconnect = joydev_disconnect, | 941 | .disconnect = joydev_disconnect, |
941 | .fops = &joydev_fops, | 942 | .fops = &joydev_fops, |
942 | .minor = JOYDEV_MINOR_BASE, | 943 | .minor = JOYDEV_MINOR_BASE, |
943 | .name = "joydev", | 944 | .name = "joydev", |
944 | .id_table = joydev_ids, | 945 | .id_table = joydev_ids, |
945 | .blacklist = joydev_blacklist, | ||
946 | }; | 946 | }; |
947 | 947 | ||
948 | static int __init joydev_init(void) | 948 | static int __init joydev_init(void) |
diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig index b11419590cfe..5b596165b571 100644 --- a/drivers/input/joystick/Kconfig +++ b/drivers/input/joystick/Kconfig | |||
@@ -221,6 +221,7 @@ config JOYSTICK_DB9 | |||
221 | config JOYSTICK_GAMECON | 221 | config JOYSTICK_GAMECON |
222 | tristate "Multisystem, NES, SNES, N64, PSX joysticks and gamepads" | 222 | tristate "Multisystem, NES, SNES, N64, PSX joysticks and gamepads" |
223 | depends on PARPORT | 223 | depends on PARPORT |
224 | select INPUT_FF_MEMLESS | ||
224 | ---help--- | 225 | ---help--- |
225 | Say Y here if you have a Nintendo Entertainment System gamepad, | 226 | Say Y here if you have a Nintendo Entertainment System gamepad, |
226 | Super Nintendo Entertainment System gamepad, Nintendo 64 gamepad, | 227 | Super Nintendo Entertainment System gamepad, Nintendo 64 gamepad, |
diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c index 07a32aff5a31..ae998d99a5ae 100644 --- a/drivers/input/joystick/gamecon.c +++ b/drivers/input/joystick/gamecon.c | |||
@@ -30,6 +30,8 @@ | |||
30 | * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic | 30 | * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic |
31 | */ | 31 | */ |
32 | 32 | ||
33 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
34 | |||
33 | #include <linux/kernel.h> | 35 | #include <linux/kernel.h> |
34 | #include <linux/delay.h> | 36 | #include <linux/delay.h> |
35 | #include <linux/module.h> | 37 | #include <linux/module.h> |
@@ -61,48 +63,73 @@ MODULE_PARM_DESC(map3, "Describes third set of devices"); | |||
61 | 63 | ||
62 | /* see also gs_psx_delay parameter in PSX support section */ | 64 | /* see also gs_psx_delay parameter in PSX support section */ |
63 | 65 | ||
64 | #define GC_SNES 1 | 66 | enum gc_type { |
65 | #define GC_NES 2 | 67 | GC_NONE = 0, |
66 | #define GC_NES4 3 | 68 | GC_SNES, |
67 | #define GC_MULTI 4 | 69 | GC_NES, |
68 | #define GC_MULTI2 5 | 70 | GC_NES4, |
69 | #define GC_N64 6 | 71 | GC_MULTI, |
70 | #define GC_PSX 7 | 72 | GC_MULTI2, |
71 | #define GC_DDR 8 | 73 | GC_N64, |
72 | #define GC_SNESMOUSE 9 | 74 | GC_PSX, |
73 | 75 | GC_DDR, | |
74 | #define GC_MAX 9 | 76 | GC_SNESMOUSE, |
77 | GC_MAX | ||
78 | }; | ||
75 | 79 | ||
76 | #define GC_REFRESH_TIME HZ/100 | 80 | #define GC_REFRESH_TIME HZ/100 |
77 | 81 | ||
82 | struct gc_pad { | ||
83 | struct input_dev *dev; | ||
84 | enum gc_type type; | ||
85 | char phys[32]; | ||
86 | }; | ||
87 | |||
78 | struct gc { | 88 | struct gc { |
79 | struct pardevice *pd; | 89 | struct pardevice *pd; |
90 | struct gc_pad pads[GC_MAX_DEVICES]; | ||
80 | struct input_dev *dev[GC_MAX_DEVICES]; | 91 | struct input_dev *dev[GC_MAX_DEVICES]; |
81 | struct timer_list timer; | 92 | struct timer_list timer; |
82 | unsigned char pads[GC_MAX + 1]; | 93 | int pad_count[GC_MAX]; |
83 | int used; | 94 | int used; |
84 | struct mutex mutex; | 95 | struct mutex mutex; |
85 | char phys[GC_MAX_DEVICES][32]; | 96 | }; |
97 | |||
98 | struct gc_subdev { | ||
99 | unsigned int idx; | ||
86 | }; | 100 | }; |
87 | 101 | ||
88 | static struct gc *gc_base[3]; | 102 | static struct gc *gc_base[3]; |
89 | 103 | ||
90 | static int gc_status_bit[] = { 0x40, 0x80, 0x20, 0x10, 0x08 }; | 104 | static const int gc_status_bit[] = { 0x40, 0x80, 0x20, 0x10, 0x08 }; |
105 | |||
106 | static const char *gc_names[] = { | ||
107 | NULL, "SNES pad", "NES pad", "NES FourPort", "Multisystem joystick", | ||
108 | "Multisystem 2-button joystick", "N64 controller", "PSX controller", | ||
109 | "PSX DDR controller", "SNES mouse" | ||
110 | }; | ||
91 | 111 | ||
92 | static char *gc_names[] = { NULL, "SNES pad", "NES pad", "NES FourPort", "Multisystem joystick", | ||
93 | "Multisystem 2-button joystick", "N64 controller", "PSX controller", | ||
94 | "PSX DDR controller", "SNES mouse" }; | ||
95 | /* | 112 | /* |
96 | * N64 support. | 113 | * N64 support. |
97 | */ | 114 | */ |
98 | 115 | ||
99 | static unsigned char gc_n64_bytes[] = { 0, 1, 13, 15, 14, 12, 10, 11, 2, 3 }; | 116 | static const unsigned char gc_n64_bytes[] = { 0, 1, 13, 15, 14, 12, 10, 11, 2, 3 }; |
100 | static short gc_n64_btn[] = { BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_TL, BTN_TR, BTN_TRIGGER, BTN_START }; | 117 | static const short gc_n64_btn[] = { |
118 | BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, | ||
119 | BTN_TL, BTN_TR, BTN_TRIGGER, BTN_START | ||
120 | }; | ||
101 | 121 | ||
102 | #define GC_N64_LENGTH 32 /* N64 bit length, not including stop bit */ | 122 | #define GC_N64_LENGTH 32 /* N64 bit length, not including stop bit */ |
103 | #define GC_N64_REQUEST_LENGTH 37 /* transmit request sequence is 9 bits long */ | 123 | #define GC_N64_STOP_LENGTH 5 /* Length of encoded stop bit */ |
124 | #define GC_N64_CMD_00 0x11111111UL | ||
125 | #define GC_N64_CMD_01 0xd1111111UL | ||
126 | #define GC_N64_CMD_03 0xdd111111UL | ||
127 | #define GC_N64_CMD_1b 0xdd1dd111UL | ||
128 | #define GC_N64_CMD_c0 0x111111ddUL | ||
129 | #define GC_N64_CMD_80 0x1111111dUL | ||
130 | #define GC_N64_STOP_BIT 0x1d /* Encoded stop bit */ | ||
131 | #define GC_N64_REQUEST_DATA GC_N64_CMD_01 /* the request data command */ | ||
104 | #define GC_N64_DELAY 133 /* delay between transmit request, and response ready (us) */ | 132 | #define GC_N64_DELAY 133 /* delay between transmit request, and response ready (us) */ |
105 | #define GC_N64_REQUEST 0x1dd1111111ULL /* the request data command (encoded for 000000011) */ | ||
106 | #define GC_N64_DWS 3 /* delay between write segments (required for sound playback because of ISA DMA) */ | 133 | #define GC_N64_DWS 3 /* delay between write segments (required for sound playback because of ISA DMA) */ |
107 | /* GC_N64_DWS > 24 is known to fail */ | 134 | /* GC_N64_DWS > 24 is known to fail */ |
108 | #define GC_N64_POWER_W 0xe2 /* power during write (transmit request) */ | 135 | #define GC_N64_POWER_W 0xe2 /* power during write (transmit request) */ |
@@ -114,8 +141,40 @@ static short gc_n64_btn[] = { BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_TL, | |||
114 | #define GC_N64_CLOCK 0x02 /* clock bits for read */ | 141 | #define GC_N64_CLOCK 0x02 /* clock bits for read */ |
115 | 142 | ||
116 | /* | 143 | /* |
144 | * Used for rumble code. | ||
145 | */ | ||
146 | |||
147 | /* Send encoded command */ | ||
148 | static void gc_n64_send_command(struct gc *gc, unsigned long cmd, | ||
149 | unsigned char target) | ||
150 | { | ||
151 | struct parport *port = gc->pd->port; | ||
152 | int i; | ||
153 | |||
154 | for (i = 0; i < GC_N64_LENGTH; i++) { | ||
155 | unsigned char data = (cmd >> i) & 1 ? target : 0; | ||
156 | parport_write_data(port, GC_N64_POWER_W | data); | ||
157 | udelay(GC_N64_DWS); | ||
158 | } | ||
159 | } | ||
160 | |||
161 | /* Send stop bit */ | ||
162 | static void gc_n64_send_stop_bit(struct gc *gc, unsigned char target) | ||
163 | { | ||
164 | struct parport *port = gc->pd->port; | ||
165 | int i; | ||
166 | |||
167 | for (i = 0; i < GC_N64_STOP_LENGTH; i++) { | ||
168 | unsigned char data = (GC_N64_STOP_BIT >> i) & 1 ? target : 0; | ||
169 | parport_write_data(port, GC_N64_POWER_W | data); | ||
170 | udelay(GC_N64_DWS); | ||
171 | } | ||
172 | } | ||
173 | |||
174 | /* | ||
117 | * gc_n64_read_packet() reads an N64 packet. | 175 | * gc_n64_read_packet() reads an N64 packet. |
118 | * Each pad uses one bit per byte. So all pads connected to this port are read in parallel. | 176 | * Each pad uses one bit per byte. So all pads connected to this port |
177 | * are read in parallel. | ||
119 | */ | 178 | */ |
120 | 179 | ||
121 | static void gc_n64_read_packet(struct gc *gc, unsigned char *data) | 180 | static void gc_n64_read_packet(struct gc *gc, unsigned char *data) |
@@ -128,14 +187,13 @@ static void gc_n64_read_packet(struct gc *gc, unsigned char *data) | |||
128 | */ | 187 | */ |
129 | 188 | ||
130 | local_irq_save(flags); | 189 | local_irq_save(flags); |
131 | for (i = 0; i < GC_N64_REQUEST_LENGTH; i++) { | 190 | gc_n64_send_command(gc, GC_N64_REQUEST_DATA, GC_N64_OUT); |
132 | parport_write_data(gc->pd->port, GC_N64_POWER_W | ((GC_N64_REQUEST >> i) & 1 ? GC_N64_OUT : 0)); | 191 | gc_n64_send_stop_bit(gc, GC_N64_OUT); |
133 | udelay(GC_N64_DWS); | ||
134 | } | ||
135 | local_irq_restore(flags); | 192 | local_irq_restore(flags); |
136 | 193 | ||
137 | /* | 194 | /* |
138 | * Wait for the pad response to be loaded into the 33-bit register of the adapter | 195 | * Wait for the pad response to be loaded into the 33-bit register |
196 | * of the adapter. | ||
139 | */ | 197 | */ |
140 | 198 | ||
141 | udelay(GC_N64_DELAY); | 199 | udelay(GC_N64_DELAY); |
@@ -146,13 +204,15 @@ static void gc_n64_read_packet(struct gc *gc, unsigned char *data) | |||
146 | 204 | ||
147 | for (i = 0; i < GC_N64_LENGTH; i++) { | 205 | for (i = 0; i < GC_N64_LENGTH; i++) { |
148 | parport_write_data(gc->pd->port, GC_N64_POWER_R); | 206 | parport_write_data(gc->pd->port, GC_N64_POWER_R); |
207 | udelay(2); | ||
149 | data[i] = parport_read_status(gc->pd->port); | 208 | data[i] = parport_read_status(gc->pd->port); |
150 | parport_write_data(gc->pd->port, GC_N64_POWER_R | GC_N64_CLOCK); | 209 | parport_write_data(gc->pd->port, GC_N64_POWER_R | GC_N64_CLOCK); |
151 | } | 210 | } |
152 | 211 | ||
153 | /* | 212 | /* |
154 | * We must wait 200 ms here for the controller to reinitialize before the next read request. | 213 | * We must wait 200 ms here for the controller to reinitialize before |
155 | * No worries as long as gc_read is polled less frequently than this. | 214 | * the next read request. No worries as long as gc_read is polled less |
215 | * frequently than this. | ||
156 | */ | 216 | */ |
157 | 217 | ||
158 | } | 218 | } |
@@ -160,45 +220,112 @@ static void gc_n64_read_packet(struct gc *gc, unsigned char *data) | |||
160 | static void gc_n64_process_packet(struct gc *gc) | 220 | static void gc_n64_process_packet(struct gc *gc) |
161 | { | 221 | { |
162 | unsigned char data[GC_N64_LENGTH]; | 222 | unsigned char data[GC_N64_LENGTH]; |
163 | signed char axes[2]; | ||
164 | struct input_dev *dev; | 223 | struct input_dev *dev; |
165 | int i, j, s; | 224 | int i, j, s; |
225 | signed char x, y; | ||
166 | 226 | ||
167 | gc_n64_read_packet(gc, data); | 227 | gc_n64_read_packet(gc, data); |
168 | 228 | ||
169 | for (i = 0; i < GC_MAX_DEVICES; i++) { | 229 | for (i = 0; i < GC_MAX_DEVICES; i++) { |
170 | 230 | ||
171 | dev = gc->dev[i]; | 231 | if (gc->pads[i].type != GC_N64) |
172 | if (!dev) | ||
173 | continue; | 232 | continue; |
174 | 233 | ||
234 | dev = gc->pads[i].dev; | ||
175 | s = gc_status_bit[i]; | 235 | s = gc_status_bit[i]; |
176 | 236 | ||
177 | if (s & gc->pads[GC_N64] & ~(data[8] | data[9])) { | 237 | if (s & ~(data[8] | data[9])) { |
178 | 238 | ||
179 | axes[0] = axes[1] = 0; | 239 | x = y = 0; |
180 | 240 | ||
181 | for (j = 0; j < 8; j++) { | 241 | for (j = 0; j < 8; j++) { |
182 | if (data[23 - j] & s) | 242 | if (data[23 - j] & s) |
183 | axes[0] |= 1 << j; | 243 | x |= 1 << j; |
184 | if (data[31 - j] & s) | 244 | if (data[31 - j] & s) |
185 | axes[1] |= 1 << j; | 245 | y |= 1 << j; |
186 | } | 246 | } |
187 | 247 | ||
188 | input_report_abs(dev, ABS_X, axes[0]); | 248 | input_report_abs(dev, ABS_X, x); |
189 | input_report_abs(dev, ABS_Y, -axes[1]); | 249 | input_report_abs(dev, ABS_Y, -y); |
190 | 250 | ||
191 | input_report_abs(dev, ABS_HAT0X, !(s & data[6]) - !(s & data[7])); | 251 | input_report_abs(dev, ABS_HAT0X, |
192 | input_report_abs(dev, ABS_HAT0Y, !(s & data[4]) - !(s & data[5])); | 252 | !(s & data[6]) - !(s & data[7])); |
253 | input_report_abs(dev, ABS_HAT0Y, | ||
254 | !(s & data[4]) - !(s & data[5])); | ||
193 | 255 | ||
194 | for (j = 0; j < 10; j++) | 256 | for (j = 0; j < 10; j++) |
195 | input_report_key(dev, gc_n64_btn[j], s & data[gc_n64_bytes[j]]); | 257 | input_report_key(dev, gc_n64_btn[j], |
258 | s & data[gc_n64_bytes[j]]); | ||
196 | 259 | ||
197 | input_sync(dev); | 260 | input_sync(dev); |
198 | } | 261 | } |
199 | } | 262 | } |
200 | } | 263 | } |
201 | 264 | ||
265 | static int gc_n64_play_effect(struct input_dev *dev, void *data, | ||
266 | struct ff_effect *effect) | ||
267 | { | ||
268 | int i; | ||
269 | unsigned long flags; | ||
270 | struct gc *gc = input_get_drvdata(dev); | ||
271 | struct gc_subdev *sdev = data; | ||
272 | unsigned char target = 1 << sdev->idx; /* select desired pin */ | ||
273 | |||
274 | if (effect->type == FF_RUMBLE) { | ||
275 | struct ff_rumble_effect *rumble = &effect->u.rumble; | ||
276 | unsigned int cmd = | ||
277 | rumble->strong_magnitude || rumble->weak_magnitude ? | ||
278 | GC_N64_CMD_01 : GC_N64_CMD_00; | ||
279 | |||
280 | local_irq_save(flags); | ||
281 | |||
282 | /* Init Rumble - 0x03, 0x80, 0x01, (34)0x80 */ | ||
283 | gc_n64_send_command(gc, GC_N64_CMD_03, target); | ||
284 | gc_n64_send_command(gc, GC_N64_CMD_80, target); | ||
285 | gc_n64_send_command(gc, GC_N64_CMD_01, target); | ||
286 | for (i = 0; i < 32; i++) | ||
287 | gc_n64_send_command(gc, GC_N64_CMD_80, target); | ||
288 | gc_n64_send_stop_bit(gc, target); | ||
289 | |||
290 | udelay(GC_N64_DELAY); | ||
291 | |||
292 | /* Now start or stop it - 0x03, 0xc0, 0zx1b, (32)0x01/0x00 */ | ||
293 | gc_n64_send_command(gc, GC_N64_CMD_03, target); | ||
294 | gc_n64_send_command(gc, GC_N64_CMD_c0, target); | ||
295 | gc_n64_send_command(gc, GC_N64_CMD_1b, target); | ||
296 | for (i = 0; i < 32; i++) | ||
297 | gc_n64_send_command(gc, cmd, target); | ||
298 | gc_n64_send_stop_bit(gc, target); | ||
299 | |||
300 | local_irq_restore(flags); | ||
301 | |||
302 | } | ||
303 | |||
304 | return 0; | ||
305 | } | ||
306 | |||
307 | static int __init gc_n64_init_ff(struct input_dev *dev, int i) | ||
308 | { | ||
309 | struct gc_subdev *sdev; | ||
310 | int err; | ||
311 | |||
312 | sdev = kmalloc(sizeof(*sdev), GFP_KERNEL); | ||
313 | if (!sdev) | ||
314 | return -ENOMEM; | ||
315 | |||
316 | sdev->idx = i; | ||
317 | |||
318 | input_set_capability(dev, EV_FF, FF_RUMBLE); | ||
319 | |||
320 | err = input_ff_create_memless(dev, sdev, gc_n64_play_effect); | ||
321 | if (err) { | ||
322 | kfree(sdev); | ||
323 | return err; | ||
324 | } | ||
325 | |||
326 | return 0; | ||
327 | } | ||
328 | |||
202 | /* | 329 | /* |
203 | * NES/SNES support. | 330 | * NES/SNES support. |
204 | */ | 331 | */ |
@@ -214,9 +341,11 @@ static void gc_n64_process_packet(struct gc *gc) | |||
214 | #define GC_NES_CLOCK 0x01 | 341 | #define GC_NES_CLOCK 0x01 |
215 | #define GC_NES_LATCH 0x02 | 342 | #define GC_NES_LATCH 0x02 |
216 | 343 | ||
217 | static unsigned char gc_nes_bytes[] = { 0, 1, 2, 3 }; | 344 | static const unsigned char gc_nes_bytes[] = { 0, 1, 2, 3 }; |
218 | static unsigned char gc_snes_bytes[] = { 8, 0, 2, 3, 9, 1, 10, 11 }; | 345 | static const unsigned char gc_snes_bytes[] = { 8, 0, 2, 3, 9, 1, 10, 11 }; |
219 | static short gc_snes_btn[] = { BTN_A, BTN_B, BTN_SELECT, BTN_START, BTN_X, BTN_Y, BTN_TL, BTN_TR }; | 346 | static const short gc_snes_btn[] = { |
347 | BTN_A, BTN_B, BTN_SELECT, BTN_START, BTN_X, BTN_Y, BTN_TL, BTN_TR | ||
348 | }; | ||
220 | 349 | ||
221 | /* | 350 | /* |
222 | * gc_nes_read_packet() reads a NES/SNES packet. | 351 | * gc_nes_read_packet() reads a NES/SNES packet. |
@@ -244,40 +373,51 @@ static void gc_nes_read_packet(struct gc *gc, int length, unsigned char *data) | |||
244 | static void gc_nes_process_packet(struct gc *gc) | 373 | static void gc_nes_process_packet(struct gc *gc) |
245 | { | 374 | { |
246 | unsigned char data[GC_SNESMOUSE_LENGTH]; | 375 | unsigned char data[GC_SNESMOUSE_LENGTH]; |
376 | struct gc_pad *pad; | ||
247 | struct input_dev *dev; | 377 | struct input_dev *dev; |
248 | int i, j, s, len; | 378 | int i, j, s, len; |
249 | char x_rel, y_rel; | 379 | char x_rel, y_rel; |
250 | 380 | ||
251 | len = gc->pads[GC_SNESMOUSE] ? GC_SNESMOUSE_LENGTH : | 381 | len = gc->pad_count[GC_SNESMOUSE] ? GC_SNESMOUSE_LENGTH : |
252 | (gc->pads[GC_SNES] ? GC_SNES_LENGTH : GC_NES_LENGTH); | 382 | (gc->pad_count[GC_SNES] ? GC_SNES_LENGTH : GC_NES_LENGTH); |
253 | 383 | ||
254 | gc_nes_read_packet(gc, len, data); | 384 | gc_nes_read_packet(gc, len, data); |
255 | 385 | ||
256 | for (i = 0; i < GC_MAX_DEVICES; i++) { | 386 | for (i = 0; i < GC_MAX_DEVICES; i++) { |
257 | 387 | ||
388 | pad = &gc->pads[i]; | ||
258 | dev = gc->dev[i]; | 389 | dev = gc->dev[i]; |
259 | if (!dev) | ||
260 | continue; | ||
261 | |||
262 | s = gc_status_bit[i]; | 390 | s = gc_status_bit[i]; |
263 | 391 | ||
264 | if (s & (gc->pads[GC_NES] | gc->pads[GC_SNES])) { | 392 | switch (pad->type) { |
393 | |||
394 | case GC_NES: | ||
395 | |||
265 | input_report_abs(dev, ABS_X, !(s & data[6]) - !(s & data[7])); | 396 | input_report_abs(dev, ABS_X, !(s & data[6]) - !(s & data[7])); |
266 | input_report_abs(dev, ABS_Y, !(s & data[4]) - !(s & data[5])); | 397 | input_report_abs(dev, ABS_Y, !(s & data[4]) - !(s & data[5])); |
267 | } | ||
268 | 398 | ||
269 | if (s & gc->pads[GC_NES]) | ||
270 | for (j = 0; j < 4; j++) | 399 | for (j = 0; j < 4; j++) |
271 | input_report_key(dev, gc_snes_btn[j], s & data[gc_nes_bytes[j]]); | 400 | input_report_key(dev, gc_snes_btn[j], |
401 | s & data[gc_nes_bytes[j]]); | ||
402 | input_sync(dev); | ||
403 | break; | ||
404 | |||
405 | case GC_SNES: | ||
406 | |||
407 | input_report_abs(dev, ABS_X, !(s & data[6]) - !(s & data[7])); | ||
408 | input_report_abs(dev, ABS_Y, !(s & data[4]) - !(s & data[5])); | ||
272 | 409 | ||
273 | if (s & gc->pads[GC_SNES]) | ||
274 | for (j = 0; j < 8; j++) | 410 | for (j = 0; j < 8; j++) |
275 | input_report_key(dev, gc_snes_btn[j], s & data[gc_snes_bytes[j]]); | 411 | input_report_key(dev, gc_snes_btn[j], |
412 | s & data[gc_snes_bytes[j]]); | ||
413 | input_sync(dev); | ||
414 | break; | ||
276 | 415 | ||
277 | if (s & gc->pads[GC_SNESMOUSE]) { | 416 | case GC_SNESMOUSE: |
278 | /* | 417 | /* |
279 | * The 4 unused bits from SNES controllers appear to be ID bits | 418 | * The 4 unused bits from SNES controllers appear |
280 | * so use them to make sure iwe are dealing with a mouse. | 419 | * to be ID bits so use them to make sure we are |
420 | * dealing with a mouse. | ||
281 | * gamepad is connected. This is important since | 421 | * gamepad is connected. This is important since |
282 | * my SNES gamepad sends 1's for bits 16-31, which | 422 | * my SNES gamepad sends 1's for bits 16-31, which |
283 | * cause the mouse pointer to quickly move to the | 423 | * cause the mouse pointer to quickly move to the |
@@ -310,9 +450,14 @@ static void gc_nes_process_packet(struct gc *gc) | |||
310 | y_rel = -y_rel; | 450 | y_rel = -y_rel; |
311 | input_report_rel(dev, REL_Y, y_rel); | 451 | input_report_rel(dev, REL_Y, y_rel); |
312 | } | 452 | } |
453 | |||
454 | input_sync(dev); | ||
313 | } | 455 | } |
456 | break; | ||
457 | |||
458 | default: | ||
459 | break; | ||
314 | } | 460 | } |
315 | input_sync(dev); | ||
316 | } | 461 | } |
317 | } | 462 | } |
318 | 463 | ||
@@ -340,29 +485,35 @@ static void gc_multi_read_packet(struct gc *gc, int length, unsigned char *data) | |||
340 | static void gc_multi_process_packet(struct gc *gc) | 485 | static void gc_multi_process_packet(struct gc *gc) |
341 | { | 486 | { |
342 | unsigned char data[GC_MULTI2_LENGTH]; | 487 | unsigned char data[GC_MULTI2_LENGTH]; |
488 | int data_len = gc->pad_count[GC_MULTI2] ? GC_MULTI2_LENGTH : GC_MULTI_LENGTH; | ||
489 | struct gc_pad *pad; | ||
343 | struct input_dev *dev; | 490 | struct input_dev *dev; |
344 | int i, s; | 491 | int i, s; |
345 | 492 | ||
346 | gc_multi_read_packet(gc, gc->pads[GC_MULTI2] ? GC_MULTI2_LENGTH : GC_MULTI_LENGTH, data); | 493 | gc_multi_read_packet(gc, data_len, data); |
347 | 494 | ||
348 | for (i = 0; i < GC_MAX_DEVICES; i++) { | 495 | for (i = 0; i < GC_MAX_DEVICES; i++) { |
349 | 496 | pad = &gc->pads[i]; | |
350 | dev = gc->dev[i]; | 497 | dev = pad->dev; |
351 | if (!dev) | ||
352 | continue; | ||
353 | |||
354 | s = gc_status_bit[i]; | 498 | s = gc_status_bit[i]; |
355 | 499 | ||
356 | if (s & (gc->pads[GC_MULTI] | gc->pads[GC_MULTI2])) { | 500 | switch (pad->type) { |
357 | input_report_abs(dev, ABS_X, !(s & data[2]) - !(s & data[3])); | 501 | case GC_MULTI2: |
358 | input_report_abs(dev, ABS_Y, !(s & data[0]) - !(s & data[1])); | ||
359 | input_report_key(dev, BTN_TRIGGER, s & data[4]); | ||
360 | } | ||
361 | |||
362 | if (s & gc->pads[GC_MULTI2]) | ||
363 | input_report_key(dev, BTN_THUMB, s & data[5]); | 502 | input_report_key(dev, BTN_THUMB, s & data[5]); |
503 | /* fall through */ | ||
364 | 504 | ||
365 | input_sync(dev); | 505 | case GC_MULTI: |
506 | input_report_abs(dev, ABS_X, | ||
507 | !(s & data[2]) - !(s & data[3])); | ||
508 | input_report_abs(dev, ABS_Y, | ||
509 | !(s & data[0]) - !(s & data[1])); | ||
510 | input_report_key(dev, BTN_TRIGGER, s & data[4]); | ||
511 | input_sync(dev); | ||
512 | break; | ||
513 | |||
514 | default: | ||
515 | break; | ||
516 | } | ||
366 | } | 517 | } |
367 | } | 518 | } |
368 | 519 | ||
@@ -398,30 +549,41 @@ static int gc_psx_delay = GC_PSX_DELAY; | |||
398 | module_param_named(psx_delay, gc_psx_delay, uint, 0); | 549 | module_param_named(psx_delay, gc_psx_delay, uint, 0); |
399 | MODULE_PARM_DESC(psx_delay, "Delay when accessing Sony PSX controller (usecs)"); | 550 | MODULE_PARM_DESC(psx_delay, "Delay when accessing Sony PSX controller (usecs)"); |
400 | 551 | ||
401 | static short gc_psx_abs[] = { ABS_X, ABS_Y, ABS_RX, ABS_RY, ABS_HAT0X, ABS_HAT0Y }; | 552 | static const short gc_psx_abs[] = { |
402 | static short gc_psx_btn[] = { BTN_TL, BTN_TR, BTN_TL2, BTN_TR2, BTN_A, BTN_B, BTN_X, BTN_Y, | 553 | ABS_X, ABS_Y, ABS_RX, ABS_RY, ABS_HAT0X, ABS_HAT0Y |
403 | BTN_START, BTN_SELECT, BTN_THUMBL, BTN_THUMBR }; | 554 | }; |
404 | static short gc_psx_ddr_btn[] = { BTN_0, BTN_1, BTN_2, BTN_3 }; | 555 | static const short gc_psx_btn[] = { |
556 | BTN_TL, BTN_TR, BTN_TL2, BTN_TR2, BTN_A, BTN_B, BTN_X, BTN_Y, | ||
557 | BTN_START, BTN_SELECT, BTN_THUMBL, BTN_THUMBR | ||
558 | }; | ||
559 | static const short gc_psx_ddr_btn[] = { BTN_0, BTN_1, BTN_2, BTN_3 }; | ||
405 | 560 | ||
406 | /* | 561 | /* |
407 | * gc_psx_command() writes 8bit command and reads 8bit data from | 562 | * gc_psx_command() writes 8bit command and reads 8bit data from |
408 | * the psx pad. | 563 | * the psx pad. |
409 | */ | 564 | */ |
410 | 565 | ||
411 | static void gc_psx_command(struct gc *gc, int b, unsigned char data[GC_MAX_DEVICES]) | 566 | static void gc_psx_command(struct gc *gc, int b, unsigned char *data) |
412 | { | 567 | { |
568 | struct parport *port = gc->pd->port; | ||
413 | int i, j, cmd, read; | 569 | int i, j, cmd, read; |
414 | 570 | ||
415 | for (i = 0; i < GC_MAX_DEVICES; i++) | 571 | memset(data, 0, GC_MAX_DEVICES); |
416 | data[i] = 0; | ||
417 | 572 | ||
418 | for (i = 0; i < GC_PSX_LENGTH; i++, b >>= 1) { | 573 | for (i = 0; i < GC_PSX_LENGTH; i++, b >>= 1) { |
419 | cmd = (b & 1) ? GC_PSX_COMMAND : 0; | 574 | cmd = (b & 1) ? GC_PSX_COMMAND : 0; |
420 | parport_write_data(gc->pd->port, cmd | GC_PSX_POWER); | 575 | parport_write_data(port, cmd | GC_PSX_POWER); |
421 | udelay(gc_psx_delay); | 576 | udelay(gc_psx_delay); |
422 | read = parport_read_status(gc->pd->port) ^ 0x80; | 577 | |
423 | for (j = 0; j < GC_MAX_DEVICES; j++) | 578 | read = parport_read_status(port) ^ 0x80; |
424 | data[j] |= (read & gc_status_bit[j] & (gc->pads[GC_PSX] | gc->pads[GC_DDR])) ? (1 << i) : 0; | 579 | |
580 | for (j = 0; j < GC_MAX_DEVICES; j++) { | ||
581 | struct gc_pad *pad = &gc->pads[i]; | ||
582 | |||
583 | if (pad->type == GC_PSX || pad->type == GC_DDR) | ||
584 | data[j] |= (read & gc_status_bit[j]) ? (1 << i) : 0; | ||
585 | } | ||
586 | |||
425 | parport_write_data(gc->pd->port, cmd | GC_PSX_CLOCK | GC_PSX_POWER); | 587 | parport_write_data(gc->pd->port, cmd | GC_PSX_CLOCK | GC_PSX_POWER); |
426 | udelay(gc_psx_delay); | 588 | udelay(gc_psx_delay); |
427 | } | 589 | } |
@@ -432,31 +594,40 @@ static void gc_psx_command(struct gc *gc, int b, unsigned char data[GC_MAX_DEVIC | |||
432 | * device identifier code. | 594 | * device identifier code. |
433 | */ | 595 | */ |
434 | 596 | ||
435 | static void gc_psx_read_packet(struct gc *gc, unsigned char data[GC_MAX_DEVICES][GC_PSX_BYTES], | 597 | static void gc_psx_read_packet(struct gc *gc, |
598 | unsigned char data[GC_MAX_DEVICES][GC_PSX_BYTES], | ||
436 | unsigned char id[GC_MAX_DEVICES]) | 599 | unsigned char id[GC_MAX_DEVICES]) |
437 | { | 600 | { |
438 | int i, j, max_len = 0; | 601 | int i, j, max_len = 0; |
439 | unsigned long flags; | 602 | unsigned long flags; |
440 | unsigned char data2[GC_MAX_DEVICES]; | 603 | unsigned char data2[GC_MAX_DEVICES]; |
441 | 604 | ||
442 | parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_SELECT | GC_PSX_POWER); /* Select pad */ | 605 | /* Select pad */ |
606 | parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_SELECT | GC_PSX_POWER); | ||
443 | udelay(gc_psx_delay); | 607 | udelay(gc_psx_delay); |
444 | parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_POWER); /* Deselect, begin command */ | 608 | /* Deselect, begin command */ |
609 | parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_POWER); | ||
445 | udelay(gc_psx_delay); | 610 | udelay(gc_psx_delay); |
446 | 611 | ||
447 | local_irq_save(flags); | 612 | local_irq_save(flags); |
448 | 613 | ||
449 | gc_psx_command(gc, 0x01, data2); /* Access pad */ | 614 | gc_psx_command(gc, 0x01, data2); /* Access pad */ |
450 | gc_psx_command(gc, 0x42, id); /* Get device ids */ | 615 | gc_psx_command(gc, 0x42, id); /* Get device ids */ |
451 | gc_psx_command(gc, 0, data2); /* Dump status */ | 616 | gc_psx_command(gc, 0, data2); /* Dump status */ |
617 | |||
618 | /* Find the longest pad */ | ||
619 | for (i = 0; i < GC_MAX_DEVICES; i++) { | ||
620 | struct gc_pad *pad = &gc->pads[i]; | ||
452 | 621 | ||
453 | for (i =0; i < GC_MAX_DEVICES; i++) /* Find the longest pad */ | 622 | if ((pad->type == GC_PSX || pad->type == GC_DDR) && |
454 | if((gc_status_bit[i] & (gc->pads[GC_PSX] | gc->pads[GC_DDR])) | 623 | GC_PSX_LEN(id[i]) > max_len && |
455 | && (GC_PSX_LEN(id[i]) > max_len) | 624 | GC_PSX_LEN(id[i]) <= GC_PSX_BYTES) { |
456 | && (GC_PSX_LEN(id[i]) <= GC_PSX_BYTES)) | ||
457 | max_len = GC_PSX_LEN(id[i]); | 625 | max_len = GC_PSX_LEN(id[i]); |
626 | } | ||
627 | } | ||
458 | 628 | ||
459 | for (i = 0; i < max_len; i++) { /* Read in all the data */ | 629 | /* Read in all the data */ |
630 | for (i = 0; i < max_len; i++) { | ||
460 | gc_psx_command(gc, 0, data2); | 631 | gc_psx_command(gc, 0, data2); |
461 | for (j = 0; j < GC_MAX_DEVICES; j++) | 632 | for (j = 0; j < GC_MAX_DEVICES; j++) |
462 | data[j][i] = data2[j]; | 633 | data[j][i] = data2[j]; |
@@ -466,86 +637,104 @@ static void gc_psx_read_packet(struct gc *gc, unsigned char data[GC_MAX_DEVICES] | |||
466 | 637 | ||
467 | parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_SELECT | GC_PSX_POWER); | 638 | parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_SELECT | GC_PSX_POWER); |
468 | 639 | ||
469 | for(i = 0; i < GC_MAX_DEVICES; i++) /* Set id's to the real value */ | 640 | /* Set id's to the real value */ |
641 | for (i = 0; i < GC_MAX_DEVICES; i++) | ||
470 | id[i] = GC_PSX_ID(id[i]); | 642 | id[i] = GC_PSX_ID(id[i]); |
471 | } | 643 | } |
472 | 644 | ||
473 | static void gc_psx_process_packet(struct gc *gc) | 645 | static void gc_psx_report_one(struct gc_pad *pad, unsigned char psx_type, |
646 | unsigned char *data) | ||
474 | { | 647 | { |
475 | unsigned char data[GC_MAX_DEVICES][GC_PSX_BYTES]; | 648 | struct input_dev *dev = pad->dev; |
476 | unsigned char id[GC_MAX_DEVICES]; | 649 | int i; |
477 | struct input_dev *dev; | ||
478 | int i, j; | ||
479 | 650 | ||
480 | gc_psx_read_packet(gc, data, id); | 651 | switch (psx_type) { |
481 | 652 | ||
482 | for (i = 0; i < GC_MAX_DEVICES; i++) { | 653 | case GC_PSX_RUMBLE: |
483 | 654 | ||
484 | dev = gc->dev[i]; | 655 | input_report_key(dev, BTN_THUMBL, ~data[0] & 0x04); |
485 | if (!dev) | 656 | input_report_key(dev, BTN_THUMBR, ~data[0] & 0x02); |
486 | continue; | ||
487 | 657 | ||
488 | switch (id[i]) { | 658 | case GC_PSX_NEGCON: |
659 | case GC_PSX_ANALOG: | ||
489 | 660 | ||
490 | case GC_PSX_RUMBLE: | 661 | if (pad->type == GC_DDR) { |
662 | for (i = 0; i < 4; i++) | ||
663 | input_report_key(dev, gc_psx_ddr_btn[i], | ||
664 | ~data[0] & (0x10 << i)); | ||
665 | } else { | ||
666 | for (i = 0; i < 4; i++) | ||
667 | input_report_abs(dev, gc_psx_abs[i + 2], | ||
668 | data[i + 2]); | ||
491 | 669 | ||
492 | input_report_key(dev, BTN_THUMBL, ~data[i][0] & 0x04); | 670 | input_report_abs(dev, ABS_X, |
493 | input_report_key(dev, BTN_THUMBR, ~data[i][0] & 0x02); | 671 | !!(data[0] & 0x80) * 128 + !(data[0] & 0x20) * 127); |
672 | input_report_abs(dev, ABS_Y, | ||
673 | !!(data[0] & 0x10) * 128 + !(data[0] & 0x40) * 127); | ||
674 | } | ||
494 | 675 | ||
495 | case GC_PSX_NEGCON: | 676 | for (i = 0; i < 8; i++) |
496 | case GC_PSX_ANALOG: | 677 | input_report_key(dev, gc_psx_btn[i], ~data[1] & (1 << i)); |
497 | 678 | ||
498 | if (gc->pads[GC_DDR] & gc_status_bit[i]) { | 679 | input_report_key(dev, BTN_START, ~data[0] & 0x08); |
499 | for(j = 0; j < 4; j++) | 680 | input_report_key(dev, BTN_SELECT, ~data[0] & 0x01); |
500 | input_report_key(dev, gc_psx_ddr_btn[j], ~data[i][0] & (0x10 << j)); | ||
501 | } else { | ||
502 | for (j = 0; j < 4; j++) | ||
503 | input_report_abs(dev, gc_psx_abs[j + 2], data[i][j + 2]); | ||
504 | 681 | ||
505 | input_report_abs(dev, ABS_X, 128 + !(data[i][0] & 0x20) * 127 - !(data[i][0] & 0x80) * 128); | 682 | input_sync(dev); |
506 | input_report_abs(dev, ABS_Y, 128 + !(data[i][0] & 0x40) * 127 - !(data[i][0] & 0x10) * 128); | ||
507 | } | ||
508 | 683 | ||
509 | for (j = 0; j < 8; j++) | 684 | break; |
510 | input_report_key(dev, gc_psx_btn[j], ~data[i][1] & (1 << j)); | ||
511 | 685 | ||
512 | input_report_key(dev, BTN_START, ~data[i][0] & 0x08); | 686 | case GC_PSX_NORMAL: |
513 | input_report_key(dev, BTN_SELECT, ~data[i][0] & 0x01); | ||
514 | 687 | ||
515 | input_sync(dev); | 688 | if (pad->type == GC_DDR) { |
689 | for (i = 0; i < 4; i++) | ||
690 | input_report_key(dev, gc_psx_ddr_btn[i], | ||
691 | ~data[0] & (0x10 << i)); | ||
692 | } else { | ||
693 | input_report_abs(dev, ABS_X, | ||
694 | !!(data[0] & 0x80) * 128 + !(data[0] & 0x20) * 127); | ||
695 | input_report_abs(dev, ABS_Y, | ||
696 | !!(data[0] & 0x10) * 128 + !(data[0] & 0x40) * 127); | ||
516 | 697 | ||
517 | break; | 698 | /* |
518 | 699 | * For some reason if the extra axes are left unset | |
519 | case GC_PSX_NORMAL: | 700 | * they drift. |
520 | if (gc->pads[GC_DDR] & gc_status_bit[i]) { | 701 | * for (i = 0; i < 4; i++) |
521 | for(j = 0; j < 4; j++) | 702 | input_report_abs(dev, gc_psx_abs[i + 2], 128); |
522 | input_report_key(dev, gc_psx_ddr_btn[j], ~data[i][0] & (0x10 << j)); | 703 | * This needs to be debugged properly, |
523 | } else { | 704 | * maybe fuzz processing needs to be done |
524 | input_report_abs(dev, ABS_X, 128 + !(data[i][0] & 0x20) * 127 - !(data[i][0] & 0x80) * 128); | 705 | * in input_sync() |
525 | input_report_abs(dev, ABS_Y, 128 + !(data[i][0] & 0x40) * 127 - !(data[i][0] & 0x10) * 128); | 706 | * --vojtech |
526 | 707 | */ | |
527 | /* for some reason if the extra axes are left unset they drift */ | 708 | } |
528 | /* for (j = 0; j < 4; j++) | ||
529 | input_report_abs(dev, gc_psx_abs[j + 2], 128); | ||
530 | * This needs to be debugged properly, | ||
531 | * maybe fuzz processing needs to be done in input_sync() | ||
532 | * --vojtech | ||
533 | */ | ||
534 | } | ||
535 | 709 | ||
536 | for (j = 0; j < 8; j++) | 710 | for (i = 0; i < 8; i++) |
537 | input_report_key(dev, gc_psx_btn[j], ~data[i][1] & (1 << j)); | 711 | input_report_key(dev, gc_psx_btn[i], ~data[1] & (1 << i)); |
538 | 712 | ||
539 | input_report_key(dev, BTN_START, ~data[i][0] & 0x08); | 713 | input_report_key(dev, BTN_START, ~data[0] & 0x08); |
540 | input_report_key(dev, BTN_SELECT, ~data[i][0] & 0x01); | 714 | input_report_key(dev, BTN_SELECT, ~data[0] & 0x01); |
541 | 715 | ||
542 | input_sync(dev); | 716 | input_sync(dev); |
543 | 717 | ||
544 | break; | 718 | break; |
545 | 719 | ||
546 | case 0: /* not a pad, ignore */ | 720 | default: /* not a pad, ignore */ |
547 | break; | 721 | break; |
548 | } | 722 | } |
723 | } | ||
724 | |||
725 | static void gc_psx_process_packet(struct gc *gc) | ||
726 | { | ||
727 | unsigned char data[GC_MAX_DEVICES][GC_PSX_BYTES]; | ||
728 | unsigned char id[GC_MAX_DEVICES]; | ||
729 | struct gc_pad *pad; | ||
730 | int i; | ||
731 | |||
732 | gc_psx_read_packet(gc, data, id); | ||
733 | |||
734 | for (i = 0; i < GC_MAX_DEVICES; i++) { | ||
735 | pad = &gc->pads[i]; | ||
736 | if (pad->type == GC_PSX || pad->type == GC_DDR) | ||
737 | gc_psx_report_one(pad, id[i], data[i]); | ||
549 | } | 738 | } |
550 | } | 739 | } |
551 | 740 | ||
@@ -561,28 +750,31 @@ static void gc_timer(unsigned long private) | |||
561 | * N64 pads - must be read first, any read confuses them for 200 us | 750 | * N64 pads - must be read first, any read confuses them for 200 us |
562 | */ | 751 | */ |
563 | 752 | ||
564 | if (gc->pads[GC_N64]) | 753 | if (gc->pad_count[GC_N64]) |
565 | gc_n64_process_packet(gc); | 754 | gc_n64_process_packet(gc); |
566 | 755 | ||
567 | /* | 756 | /* |
568 | * NES and SNES pads or mouse | 757 | * NES and SNES pads or mouse |
569 | */ | 758 | */ |
570 | 759 | ||
571 | if (gc->pads[GC_NES] || gc->pads[GC_SNES] || gc->pads[GC_SNESMOUSE]) | 760 | if (gc->pad_count[GC_NES] || |
761 | gc->pad_count[GC_SNES] || | ||
762 | gc->pad_count[GC_SNESMOUSE]) { | ||
572 | gc_nes_process_packet(gc); | 763 | gc_nes_process_packet(gc); |
764 | } | ||
573 | 765 | ||
574 | /* | 766 | /* |
575 | * Multi and Multi2 joysticks | 767 | * Multi and Multi2 joysticks |
576 | */ | 768 | */ |
577 | 769 | ||
578 | if (gc->pads[GC_MULTI] || gc->pads[GC_MULTI2]) | 770 | if (gc->pad_count[GC_MULTI] || gc->pad_count[GC_MULTI2]) |
579 | gc_multi_process_packet(gc); | 771 | gc_multi_process_packet(gc); |
580 | 772 | ||
581 | /* | 773 | /* |
582 | * PSX controllers | 774 | * PSX controllers |
583 | */ | 775 | */ |
584 | 776 | ||
585 | if (gc->pads[GC_PSX] || gc->pads[GC_DDR]) | 777 | if (gc->pad_count[GC_PSX] || gc->pad_count[GC_DDR]) |
586 | gc_psx_process_packet(gc); | 778 | gc_psx_process_packet(gc); |
587 | 779 | ||
588 | mod_timer(&gc->timer, jiffies + GC_REFRESH_TIME); | 780 | mod_timer(&gc->timer, jiffies + GC_REFRESH_TIME); |
@@ -622,25 +814,29 @@ static void gc_close(struct input_dev *dev) | |||
622 | 814 | ||
623 | static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type) | 815 | static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type) |
624 | { | 816 | { |
817 | struct gc_pad *pad = &gc->pads[idx]; | ||
625 | struct input_dev *input_dev; | 818 | struct input_dev *input_dev; |
626 | int i; | 819 | int i; |
627 | 820 | int err; | |
628 | if (!pad_type) | ||
629 | return 0; | ||
630 | 821 | ||
631 | if (pad_type < 1 || pad_type > GC_MAX) { | 822 | if (pad_type < 1 || pad_type > GC_MAX) { |
632 | printk(KERN_WARNING "gamecon.c: Pad type %d unknown\n", pad_type); | 823 | pr_err("Pad type %d unknown\n", pad_type); |
633 | return -EINVAL; | 824 | return -EINVAL; |
634 | } | 825 | } |
635 | 826 | ||
636 | gc->dev[idx] = input_dev = input_allocate_device(); | 827 | pad->dev = input_dev = input_allocate_device(); |
637 | if (!input_dev) { | 828 | if (!input_dev) { |
638 | printk(KERN_ERR "gamecon.c: Not enough memory for input device\n"); | 829 | pr_err("Not enough memory for input device\n"); |
639 | return -ENOMEM; | 830 | return -ENOMEM; |
640 | } | 831 | } |
641 | 832 | ||
833 | pad->type = pad_type; | ||
834 | |||
835 | snprintf(pad->phys, sizeof(pad->phys), | ||
836 | "%s/input%d", gc->pd->port->name, idx); | ||
837 | |||
642 | input_dev->name = gc_names[pad_type]; | 838 | input_dev->name = gc_names[pad_type]; |
643 | input_dev->phys = gc->phys[idx]; | 839 | input_dev->phys = pad->phys; |
644 | input_dev->id.bustype = BUS_PARPORT; | 840 | input_dev->id.bustype = BUS_PARPORT; |
645 | input_dev->id.vendor = 0x0001; | 841 | input_dev->id.vendor = 0x0001; |
646 | input_dev->id.product = pad_type; | 842 | input_dev->id.product = pad_type; |
@@ -659,61 +855,76 @@ static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type) | |||
659 | } else | 855 | } else |
660 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | 856 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); |
661 | 857 | ||
662 | gc->pads[0] |= gc_status_bit[idx]; | 858 | gc->pad_count[pad_type]++; |
663 | gc->pads[pad_type] |= gc_status_bit[idx]; | ||
664 | 859 | ||
665 | switch (pad_type) { | 860 | switch (pad_type) { |
666 | 861 | ||
667 | case GC_N64: | 862 | case GC_N64: |
668 | for (i = 0; i < 10; i++) | 863 | for (i = 0; i < 10; i++) |
669 | set_bit(gc_n64_btn[i], input_dev->keybit); | 864 | __set_bit(gc_n64_btn[i], input_dev->keybit); |
670 | |||
671 | for (i = 0; i < 2; i++) { | ||
672 | input_set_abs_params(input_dev, ABS_X + i, -127, 126, 0, 2); | ||
673 | input_set_abs_params(input_dev, ABS_HAT0X + i, -1, 1, 0, 0); | ||
674 | } | ||
675 | |||
676 | break; | ||
677 | |||
678 | case GC_SNESMOUSE: | ||
679 | set_bit(BTN_LEFT, input_dev->keybit); | ||
680 | set_bit(BTN_RIGHT, input_dev->keybit); | ||
681 | set_bit(REL_X, input_dev->relbit); | ||
682 | set_bit(REL_Y, input_dev->relbit); | ||
683 | break; | ||
684 | |||
685 | case GC_SNES: | ||
686 | for (i = 4; i < 8; i++) | ||
687 | set_bit(gc_snes_btn[i], input_dev->keybit); | ||
688 | case GC_NES: | ||
689 | for (i = 0; i < 4; i++) | ||
690 | set_bit(gc_snes_btn[i], input_dev->keybit); | ||
691 | break; | ||
692 | |||
693 | case GC_MULTI2: | ||
694 | set_bit(BTN_THUMB, input_dev->keybit); | ||
695 | case GC_MULTI: | ||
696 | set_bit(BTN_TRIGGER, input_dev->keybit); | ||
697 | break; | ||
698 | |||
699 | case GC_PSX: | ||
700 | for (i = 0; i < 6; i++) | ||
701 | input_set_abs_params(input_dev, gc_psx_abs[i], 4, 252, 0, 2); | ||
702 | for (i = 0; i < 12; i++) | ||
703 | set_bit(gc_psx_btn[i], input_dev->keybit); | ||
704 | 865 | ||
705 | break; | 866 | for (i = 0; i < 2; i++) { |
867 | input_set_abs_params(input_dev, ABS_X + i, -127, 126, 0, 2); | ||
868 | input_set_abs_params(input_dev, ABS_HAT0X + i, -1, 1, 0, 0); | ||
869 | } | ||
706 | 870 | ||
707 | case GC_DDR: | 871 | err = gc_n64_init_ff(input_dev, idx); |
708 | for (i = 0; i < 4; i++) | 872 | if (err) { |
709 | set_bit(gc_psx_ddr_btn[i], input_dev->keybit); | 873 | pr_warning("Failed to initiate rumble for N64 device %d\n", idx); |
710 | for (i = 0; i < 12; i++) | 874 | goto err_free_dev; |
711 | set_bit(gc_psx_btn[i], input_dev->keybit); | 875 | } |
712 | 876 | ||
713 | break; | 877 | break; |
878 | |||
879 | case GC_SNESMOUSE: | ||
880 | __set_bit(BTN_LEFT, input_dev->keybit); | ||
881 | __set_bit(BTN_RIGHT, input_dev->keybit); | ||
882 | __set_bit(REL_X, input_dev->relbit); | ||
883 | __set_bit(REL_Y, input_dev->relbit); | ||
884 | break; | ||
885 | |||
886 | case GC_SNES: | ||
887 | for (i = 4; i < 8; i++) | ||
888 | __set_bit(gc_snes_btn[i], input_dev->keybit); | ||
889 | case GC_NES: | ||
890 | for (i = 0; i < 4; i++) | ||
891 | __set_bit(gc_snes_btn[i], input_dev->keybit); | ||
892 | break; | ||
893 | |||
894 | case GC_MULTI2: | ||
895 | __set_bit(BTN_THUMB, input_dev->keybit); | ||
896 | case GC_MULTI: | ||
897 | __set_bit(BTN_TRIGGER, input_dev->keybit); | ||
898 | break; | ||
899 | |||
900 | case GC_PSX: | ||
901 | for (i = 0; i < 6; i++) | ||
902 | input_set_abs_params(input_dev, | ||
903 | gc_psx_abs[i], 4, 252, 0, 2); | ||
904 | for (i = 0; i < 12; i++) | ||
905 | __set_bit(gc_psx_btn[i], input_dev->keybit); | ||
906 | |||
907 | break; | ||
908 | |||
909 | case GC_DDR: | ||
910 | for (i = 0; i < 4; i++) | ||
911 | __set_bit(gc_psx_ddr_btn[i], input_dev->keybit); | ||
912 | for (i = 0; i < 12; i++) | ||
913 | __set_bit(gc_psx_btn[i], input_dev->keybit); | ||
914 | |||
915 | break; | ||
714 | } | 916 | } |
715 | 917 | ||
918 | err = input_register_device(pad->dev); | ||
919 | if (err) | ||
920 | goto err_free_dev; | ||
921 | |||
716 | return 0; | 922 | return 0; |
923 | |||
924 | err_free_dev: | ||
925 | input_free_device(pad->dev); | ||
926 | pad->dev = NULL; | ||
927 | return err; | ||
717 | } | 928 | } |
718 | 929 | ||
719 | static struct gc __init *gc_probe(int parport, int *pads, int n_pads) | 930 | static struct gc __init *gc_probe(int parport, int *pads, int n_pads) |
@@ -722,52 +933,47 @@ static struct gc __init *gc_probe(int parport, int *pads, int n_pads) | |||
722 | struct parport *pp; | 933 | struct parport *pp; |
723 | struct pardevice *pd; | 934 | struct pardevice *pd; |
724 | int i; | 935 | int i; |
936 | int count = 0; | ||
725 | int err; | 937 | int err; |
726 | 938 | ||
727 | pp = parport_find_number(parport); | 939 | pp = parport_find_number(parport); |
728 | if (!pp) { | 940 | if (!pp) { |
729 | printk(KERN_ERR "gamecon.c: no such parport\n"); | 941 | pr_err("no such parport %d\n", parport); |
730 | err = -EINVAL; | 942 | err = -EINVAL; |
731 | goto err_out; | 943 | goto err_out; |
732 | } | 944 | } |
733 | 945 | ||
734 | pd = parport_register_device(pp, "gamecon", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL); | 946 | pd = parport_register_device(pp, "gamecon", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL); |
735 | if (!pd) { | 947 | if (!pd) { |
736 | printk(KERN_ERR "gamecon.c: parport busy already - lp.o loaded?\n"); | 948 | pr_err("parport busy already - lp.o loaded?\n"); |
737 | err = -EBUSY; | 949 | err = -EBUSY; |
738 | goto err_put_pp; | 950 | goto err_put_pp; |
739 | } | 951 | } |
740 | 952 | ||
741 | gc = kzalloc(sizeof(struct gc), GFP_KERNEL); | 953 | gc = kzalloc(sizeof(struct gc), GFP_KERNEL); |
742 | if (!gc) { | 954 | if (!gc) { |
743 | printk(KERN_ERR "gamecon.c: Not enough memory\n"); | 955 | pr_err("Not enough memory\n"); |
744 | err = -ENOMEM; | 956 | err = -ENOMEM; |
745 | goto err_unreg_pardev; | 957 | goto err_unreg_pardev; |
746 | } | 958 | } |
747 | 959 | ||
748 | mutex_init(&gc->mutex); | 960 | mutex_init(&gc->mutex); |
749 | gc->pd = pd; | 961 | gc->pd = pd; |
750 | init_timer(&gc->timer); | 962 | setup_timer(&gc->timer, gc_timer, (long) gc); |
751 | gc->timer.data = (long) gc; | ||
752 | gc->timer.function = gc_timer; | ||
753 | 963 | ||
754 | for (i = 0; i < n_pads && i < GC_MAX_DEVICES; i++) { | 964 | for (i = 0; i < n_pads && i < GC_MAX_DEVICES; i++) { |
755 | if (!pads[i]) | 965 | if (!pads[i]) |
756 | continue; | 966 | continue; |
757 | 967 | ||
758 | snprintf(gc->phys[i], sizeof(gc->phys[i]), | ||
759 | "%s/input%d", gc->pd->port->name, i); | ||
760 | err = gc_setup_pad(gc, i, pads[i]); | 968 | err = gc_setup_pad(gc, i, pads[i]); |
761 | if (err) | 969 | if (err) |
762 | goto err_unreg_devs; | 970 | goto err_unreg_devs; |
763 | 971 | ||
764 | err = input_register_device(gc->dev[i]); | 972 | count++; |
765 | if (err) | ||
766 | goto err_free_dev; | ||
767 | } | 973 | } |
768 | 974 | ||
769 | if (!gc->pads[0]) { | 975 | if (count == 0) { |
770 | printk(KERN_ERR "gamecon.c: No valid devices specified\n"); | 976 | pr_err("No valid devices specified\n"); |
771 | err = -EINVAL; | 977 | err = -EINVAL; |
772 | goto err_free_gc; | 978 | goto err_free_gc; |
773 | } | 979 | } |
@@ -775,12 +981,10 @@ static struct gc __init *gc_probe(int parport, int *pads, int n_pads) | |||
775 | parport_put_port(pp); | 981 | parport_put_port(pp); |
776 | return gc; | 982 | return gc; |
777 | 983 | ||
778 | err_free_dev: | ||
779 | input_free_device(gc->dev[i]); | ||
780 | err_unreg_devs: | 984 | err_unreg_devs: |
781 | while (--i >= 0) | 985 | while (--i >= 0) |
782 | if (gc->dev[i]) | 986 | if (gc->pads[i].dev) |
783 | input_unregister_device(gc->dev[i]); | 987 | input_unregister_device(gc->pads[i].dev); |
784 | err_free_gc: | 988 | err_free_gc: |
785 | kfree(gc); | 989 | kfree(gc); |
786 | err_unreg_pardev: | 990 | err_unreg_pardev: |
@@ -796,8 +1000,8 @@ static void gc_remove(struct gc *gc) | |||
796 | int i; | 1000 | int i; |
797 | 1001 | ||
798 | for (i = 0; i < GC_MAX_DEVICES; i++) | 1002 | for (i = 0; i < GC_MAX_DEVICES; i++) |
799 | if (gc->dev[i]) | 1003 | if (gc->pads[i].dev) |
800 | input_unregister_device(gc->dev[i]); | 1004 | input_unregister_device(gc->pads[i].dev); |
801 | parport_unregister_device(gc->pd); | 1005 | parport_unregister_device(gc->pd); |
802 | kfree(gc); | 1006 | kfree(gc); |
803 | } | 1007 | } |
@@ -813,7 +1017,7 @@ static int __init gc_init(void) | |||
813 | continue; | 1017 | continue; |
814 | 1018 | ||
815 | if (gc_cfg[i].nargs < 2) { | 1019 | if (gc_cfg[i].nargs < 2) { |
816 | printk(KERN_ERR "gamecon.c: at least one device must be specified\n"); | 1020 | pr_err("at least one device must be specified\n"); |
817 | err = -EINVAL; | 1021 | err = -EINVAL; |
818 | break; | 1022 | break; |
819 | } | 1023 | } |
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 8a28fb7846dc..9b3353b404da 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c | |||
@@ -86,9 +86,8 @@ | |||
86 | 86 | ||
87 | /* xbox d-pads should map to buttons, as is required for DDR pads | 87 | /* xbox d-pads should map to buttons, as is required for DDR pads |
88 | but we map them to axes when possible to simplify things */ | 88 | but we map them to axes when possible to simplify things */ |
89 | #define MAP_DPAD_TO_BUTTONS 0 | 89 | #define MAP_DPAD_TO_BUTTONS (1 << 0) |
90 | #define MAP_DPAD_TO_AXES 1 | 90 | #define MAP_TRIGGERS_TO_BUTTONS (1 << 1) |
91 | #define MAP_DPAD_UNKNOWN 2 | ||
92 | 91 | ||
93 | #define XTYPE_XBOX 0 | 92 | #define XTYPE_XBOX 0 |
94 | #define XTYPE_XBOX360 1 | 93 | #define XTYPE_XBOX360 1 |
@@ -99,57 +98,61 @@ static int dpad_to_buttons; | |||
99 | module_param(dpad_to_buttons, bool, S_IRUGO); | 98 | module_param(dpad_to_buttons, bool, S_IRUGO); |
100 | MODULE_PARM_DESC(dpad_to_buttons, "Map D-PAD to buttons rather than axes for unknown pads"); | 99 | MODULE_PARM_DESC(dpad_to_buttons, "Map D-PAD to buttons rather than axes for unknown pads"); |
101 | 100 | ||
101 | static int triggers_to_buttons; | ||
102 | module_param(triggers_to_buttons, bool, S_IRUGO); | ||
103 | MODULE_PARM_DESC(triggers_to_buttons, "Map triggers to buttons rather than axes for unknown pads"); | ||
104 | |||
102 | static const struct xpad_device { | 105 | static const struct xpad_device { |
103 | u16 idVendor; | 106 | u16 idVendor; |
104 | u16 idProduct; | 107 | u16 idProduct; |
105 | char *name; | 108 | char *name; |
106 | u8 dpad_mapping; | 109 | u8 mapping; |
107 | u8 xtype; | 110 | u8 xtype; |
108 | } xpad_device[] = { | 111 | } xpad_device[] = { |
109 | { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 112 | { 0x045e, 0x0202, "Microsoft X-Box pad v1 (US)", 0, XTYPE_XBOX }, |
110 | { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 113 | { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", 0, XTYPE_XBOX }, |
111 | { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 114 | { 0x045e, 0x0285, "Microsoft X-Box pad (Japan)", 0, XTYPE_XBOX }, |
112 | { 0x045e, 0x0287, "Microsoft Xbox Controller S", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 115 | { 0x045e, 0x0287, "Microsoft Xbox Controller S", 0, XTYPE_XBOX }, |
113 | { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, | 116 | { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, |
114 | { 0x0c12, 0x8809, "RedOctane Xbox Dance Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, | 117 | { 0x0c12, 0x8809, "RedOctane Xbox Dance Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, |
115 | { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 118 | { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, |
116 | { 0x046d, 0xc242, "Logitech Chillstream Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, | 119 | { 0x046d, 0xc242, "Logitech Chillstream Controller", 0, XTYPE_XBOX360 }, |
117 | { 0x046d, 0xca84, "Logitech Xbox Cordless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 120 | { 0x046d, 0xca84, "Logitech Xbox Cordless Controller", 0, XTYPE_XBOX }, |
118 | { 0x046d, 0xca88, "Logitech Compact Controller for Xbox", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 121 | { 0x046d, 0xca88, "Logitech Compact Controller for Xbox", 0, XTYPE_XBOX }, |
119 | { 0x05fd, 0x1007, "Mad Catz Controller (unverified)", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 122 | { 0x05fd, 0x1007, "Mad Catz Controller (unverified)", 0, XTYPE_XBOX }, |
120 | { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 123 | { 0x05fd, 0x107a, "InterAct 'PowerPad Pro' X-Box pad (Germany)", 0, XTYPE_XBOX }, |
121 | { 0x0738, 0x4516, "Mad Catz Control Pad", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 124 | { 0x0738, 0x4516, "Mad Catz Control Pad", 0, XTYPE_XBOX }, |
122 | { 0x0738, 0x4522, "Mad Catz LumiCON", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 125 | { 0x0738, 0x4522, "Mad Catz LumiCON", 0, XTYPE_XBOX }, |
123 | { 0x0738, 0x4526, "Mad Catz Control Pad Pro", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 126 | { 0x0738, 0x4526, "Mad Catz Control Pad Pro", 0, XTYPE_XBOX }, |
124 | { 0x0738, 0x4536, "Mad Catz MicroCON", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 127 | { 0x0738, 0x4536, "Mad Catz MicroCON", 0, XTYPE_XBOX }, |
125 | { 0x0738, 0x4540, "Mad Catz Beat Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, | 128 | { 0x0738, 0x4540, "Mad Catz Beat Pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, |
126 | { 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 129 | { 0x0738, 0x4556, "Mad Catz Lynx Wireless Controller", 0, XTYPE_XBOX }, |
127 | { 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, | 130 | { 0x0738, 0x4716, "Mad Catz Wired Xbox 360 Controller", 0, XTYPE_XBOX360 }, |
128 | { 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, | 131 | { 0x0738, 0x4738, "Mad Catz Wired Xbox 360 Controller (SFIV)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, |
129 | { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, | 132 | { 0x0738, 0x6040, "Mad Catz Beat Pad Pro", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, |
130 | { 0x0c12, 0x8802, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 133 | { 0x0c12, 0x8802, "Zeroplus Xbox Controller", 0, XTYPE_XBOX }, |
131 | { 0x0c12, 0x880a, "Pelican Eclipse PL-2023", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 134 | { 0x0c12, 0x880a, "Pelican Eclipse PL-2023", 0, XTYPE_XBOX }, |
132 | { 0x0c12, 0x8810, "Zeroplus Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 135 | { 0x0c12, 0x8810, "Zeroplus Xbox Controller", 0, XTYPE_XBOX }, |
133 | { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 136 | { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", 0, XTYPE_XBOX }, |
134 | { 0x0e4c, 0x1097, "Radica Gamester Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 137 | { 0x0e4c, 0x1097, "Radica Gamester Controller", 0, XTYPE_XBOX }, |
135 | { 0x0e4c, 0x2390, "Radica Games Jtech Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 138 | { 0x0e4c, 0x2390, "Radica Games Jtech Controller", 0, XTYPE_XBOX }, |
136 | { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 139 | { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", 0, XTYPE_XBOX }, |
137 | { 0x0e6f, 0x0005, "Eclipse wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 140 | { 0x0e6f, 0x0005, "Eclipse wireless Controller", 0, XTYPE_XBOX }, |
138 | { 0x0e6f, 0x0006, "Edge wireless Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 141 | { 0x0e6f, 0x0006, "Edge wireless Controller", 0, XTYPE_XBOX }, |
139 | { 0x0e6f, 0x0006, "Pelican 'TSZ' Wired Xbox 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, | 142 | { 0x0e6f, 0x0006, "Pelican 'TSZ' Wired Xbox 360 Controller", 0, XTYPE_XBOX360 }, |
140 | { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 143 | { 0x0e8f, 0x0201, "SmartJoy Frag Xpad/PS2 adaptor", 0, XTYPE_XBOX }, |
141 | { 0x0f30, 0x0202, "Joytech Advanced Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 144 | { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX }, |
142 | { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 145 | { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX }, |
143 | { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 146 | { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX }, |
144 | { 0x12ab, 0x8809, "Xbox DDR dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, | 147 | { 0x12ab, 0x8809, "Xbox DDR dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, |
145 | { 0x1430, 0x4748, "RedOctane Guitar Hero X-plorer", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, | 148 | { 0x1430, 0x4748, "RedOctane Guitar Hero X-plorer", 0, XTYPE_XBOX360 }, |
146 | { 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, | 149 | { 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, |
147 | { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, | 150 | { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 }, |
148 | { 0x045e, 0x028e, "Microsoft X-Box 360 pad", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, | 151 | { 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 }, |
149 | { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, | 152 | { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, |
150 | { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_DPAD_TO_AXES, XTYPE_XBOX360 }, | 153 | { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, |
151 | { 0xffff, 0xffff, "Chinese-made Xbox Controller", MAP_DPAD_TO_AXES, XTYPE_XBOX }, | 154 | { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, |
152 | { 0x0000, 0x0000, "Generic X-Box pad", MAP_DPAD_UNKNOWN, XTYPE_UNKNOWN } | 155 | { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } |
153 | }; | 156 | }; |
154 | 157 | ||
155 | /* buttons shared with xbox and xbox360 */ | 158 | /* buttons shared with xbox and xbox360 */ |
@@ -165,13 +168,20 @@ static const signed short xpad_btn[] = { | |||
165 | -1 /* terminating entry */ | 168 | -1 /* terminating entry */ |
166 | }; | 169 | }; |
167 | 170 | ||
168 | /* only used if MAP_DPAD_TO_BUTTONS */ | 171 | /* used when dpad is mapped to nuttons */ |
169 | static const signed short xpad_btn_pad[] = { | 172 | static const signed short xpad_btn_pad[] = { |
170 | BTN_LEFT, BTN_RIGHT, /* d-pad left, right */ | 173 | BTN_LEFT, BTN_RIGHT, /* d-pad left, right */ |
171 | BTN_0, BTN_1, /* d-pad up, down (XXX names??) */ | 174 | BTN_0, BTN_1, /* d-pad up, down (XXX names??) */ |
172 | -1 /* terminating entry */ | 175 | -1 /* terminating entry */ |
173 | }; | 176 | }; |
174 | 177 | ||
178 | /* used when triggers are mapped to buttons */ | ||
179 | static const signed short xpad_btn_triggers[] = { | ||
180 | BTN_TL2, BTN_TR2, /* triggers left/right */ | ||
181 | -1 | ||
182 | }; | ||
183 | |||
184 | |||
175 | static const signed short xpad360_btn[] = { /* buttons for x360 controller */ | 185 | static const signed short xpad360_btn[] = { /* buttons for x360 controller */ |
176 | BTN_TL, BTN_TR, /* Button LB/RB */ | 186 | BTN_TL, BTN_TR, /* Button LB/RB */ |
177 | BTN_MODE, /* The big X button */ | 187 | BTN_MODE, /* The big X button */ |
@@ -181,16 +191,21 @@ static const signed short xpad360_btn[] = { /* buttons for x360 controller */ | |||
181 | static const signed short xpad_abs[] = { | 191 | static const signed short xpad_abs[] = { |
182 | ABS_X, ABS_Y, /* left stick */ | 192 | ABS_X, ABS_Y, /* left stick */ |
183 | ABS_RX, ABS_RY, /* right stick */ | 193 | ABS_RX, ABS_RY, /* right stick */ |
184 | ABS_Z, ABS_RZ, /* triggers left/right */ | ||
185 | -1 /* terminating entry */ | 194 | -1 /* terminating entry */ |
186 | }; | 195 | }; |
187 | 196 | ||
188 | /* only used if MAP_DPAD_TO_AXES */ | 197 | /* used when dpad is mapped to axes */ |
189 | static const signed short xpad_abs_pad[] = { | 198 | static const signed short xpad_abs_pad[] = { |
190 | ABS_HAT0X, ABS_HAT0Y, /* d-pad axes */ | 199 | ABS_HAT0X, ABS_HAT0Y, /* d-pad axes */ |
191 | -1 /* terminating entry */ | 200 | -1 /* terminating entry */ |
192 | }; | 201 | }; |
193 | 202 | ||
203 | /* used when triggers are mapped to axes */ | ||
204 | static const signed short xpad_abs_triggers[] = { | ||
205 | ABS_Z, ABS_RZ, /* triggers left/right */ | ||
206 | -1 | ||
207 | }; | ||
208 | |||
194 | /* Xbox 360 has a vendor-specific class, so we cannot match it with only | 209 | /* Xbox 360 has a vendor-specific class, so we cannot match it with only |
195 | * USB_INTERFACE_INFO (also specifically refused by USB subsystem), so we | 210 | * USB_INTERFACE_INFO (also specifically refused by USB subsystem), so we |
196 | * match against vendor id as well. Wired Xbox 360 devices have protocol 1, | 211 | * match against vendor id as well. Wired Xbox 360 devices have protocol 1, |
@@ -246,7 +261,7 @@ struct usb_xpad { | |||
246 | 261 | ||
247 | char phys[64]; /* physical device path */ | 262 | char phys[64]; /* physical device path */ |
248 | 263 | ||
249 | int dpad_mapping; /* map d-pad to buttons or to axes */ | 264 | int mapping; /* map d-pad to buttons or to axes */ |
250 | int xtype; /* type of xbox device */ | 265 | int xtype; /* type of xbox device */ |
251 | }; | 266 | }; |
252 | 267 | ||
@@ -277,20 +292,25 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d | |||
277 | ~(__s16) le16_to_cpup((__le16 *)(data + 18))); | 292 | ~(__s16) le16_to_cpup((__le16 *)(data + 18))); |
278 | 293 | ||
279 | /* triggers left/right */ | 294 | /* triggers left/right */ |
280 | input_report_abs(dev, ABS_Z, data[10]); | 295 | if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { |
281 | input_report_abs(dev, ABS_RZ, data[11]); | 296 | input_report_key(dev, BTN_TL2, data[10]); |
297 | input_report_key(dev, BTN_TR2, data[11]); | ||
298 | } else { | ||
299 | input_report_abs(dev, ABS_Z, data[10]); | ||
300 | input_report_abs(dev, ABS_RZ, data[11]); | ||
301 | } | ||
282 | 302 | ||
283 | /* digital pad */ | 303 | /* digital pad */ |
284 | if (xpad->dpad_mapping == MAP_DPAD_TO_AXES) { | 304 | if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { |
285 | input_report_abs(dev, ABS_HAT0X, | ||
286 | !!(data[2] & 0x08) - !!(data[2] & 0x04)); | ||
287 | input_report_abs(dev, ABS_HAT0Y, | ||
288 | !!(data[2] & 0x02) - !!(data[2] & 0x01)); | ||
289 | } else /* xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS */ { | ||
290 | input_report_key(dev, BTN_LEFT, data[2] & 0x04); | 305 | input_report_key(dev, BTN_LEFT, data[2] & 0x04); |
291 | input_report_key(dev, BTN_RIGHT, data[2] & 0x08); | 306 | input_report_key(dev, BTN_RIGHT, data[2] & 0x08); |
292 | input_report_key(dev, BTN_0, data[2] & 0x01); /* up */ | 307 | input_report_key(dev, BTN_0, data[2] & 0x01); /* up */ |
293 | input_report_key(dev, BTN_1, data[2] & 0x02); /* down */ | 308 | input_report_key(dev, BTN_1, data[2] & 0x02); /* down */ |
309 | } else { | ||
310 | input_report_abs(dev, ABS_HAT0X, | ||
311 | !!(data[2] & 0x08) - !!(data[2] & 0x04)); | ||
312 | input_report_abs(dev, ABS_HAT0Y, | ||
313 | !!(data[2] & 0x02) - !!(data[2] & 0x01)); | ||
294 | } | 314 | } |
295 | 315 | ||
296 | /* start/back buttons and stick press left/right */ | 316 | /* start/back buttons and stick press left/right */ |
@@ -328,17 +348,17 @@ static void xpad360_process_packet(struct usb_xpad *xpad, | |||
328 | struct input_dev *dev = xpad->dev; | 348 | struct input_dev *dev = xpad->dev; |
329 | 349 | ||
330 | /* digital pad */ | 350 | /* digital pad */ |
331 | if (xpad->dpad_mapping == MAP_DPAD_TO_AXES) { | 351 | if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { |
332 | input_report_abs(dev, ABS_HAT0X, | ||
333 | !!(data[2] & 0x08) - !!(data[2] & 0x04)); | ||
334 | input_report_abs(dev, ABS_HAT0Y, | ||
335 | !!(data[2] & 0x02) - !!(data[2] & 0x01)); | ||
336 | } else if (xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS) { | ||
337 | /* dpad as buttons (right, left, down, up) */ | 352 | /* dpad as buttons (right, left, down, up) */ |
338 | input_report_key(dev, BTN_LEFT, data[2] & 0x04); | 353 | input_report_key(dev, BTN_LEFT, data[2] & 0x04); |
339 | input_report_key(dev, BTN_RIGHT, data[2] & 0x08); | 354 | input_report_key(dev, BTN_RIGHT, data[2] & 0x08); |
340 | input_report_key(dev, BTN_0, data[2] & 0x01); /* up */ | 355 | input_report_key(dev, BTN_0, data[2] & 0x01); /* up */ |
341 | input_report_key(dev, BTN_1, data[2] & 0x02); /* down */ | 356 | input_report_key(dev, BTN_1, data[2] & 0x02); /* down */ |
357 | } else { | ||
358 | input_report_abs(dev, ABS_HAT0X, | ||
359 | !!(data[2] & 0x08) - !!(data[2] & 0x04)); | ||
360 | input_report_abs(dev, ABS_HAT0Y, | ||
361 | !!(data[2] & 0x02) - !!(data[2] & 0x01)); | ||
342 | } | 362 | } |
343 | 363 | ||
344 | /* start/back buttons */ | 364 | /* start/back buttons */ |
@@ -371,8 +391,13 @@ static void xpad360_process_packet(struct usb_xpad *xpad, | |||
371 | ~(__s16) le16_to_cpup((__le16 *)(data + 12))); | 391 | ~(__s16) le16_to_cpup((__le16 *)(data + 12))); |
372 | 392 | ||
373 | /* triggers left/right */ | 393 | /* triggers left/right */ |
374 | input_report_abs(dev, ABS_Z, data[4]); | 394 | if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { |
375 | input_report_abs(dev, ABS_RZ, data[5]); | 395 | input_report_key(dev, BTN_TL2, data[4]); |
396 | input_report_key(dev, BTN_TR2, data[5]); | ||
397 | } else { | ||
398 | input_report_abs(dev, ABS_Z, data[4]); | ||
399 | input_report_abs(dev, ABS_RZ, data[5]); | ||
400 | } | ||
376 | 401 | ||
377 | input_sync(dev); | 402 | input_sync(dev); |
378 | } | 403 | } |
@@ -505,7 +530,7 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) | |||
505 | struct usb_endpoint_descriptor *ep_irq_out; | 530 | struct usb_endpoint_descriptor *ep_irq_out; |
506 | int error = -ENOMEM; | 531 | int error = -ENOMEM; |
507 | 532 | ||
508 | if (xpad->xtype != XTYPE_XBOX360) | 533 | if (xpad->xtype != XTYPE_XBOX360 && xpad->xtype != XTYPE_XBOX) |
509 | return 0; | 534 | return 0; |
510 | 535 | ||
511 | xpad->odata = usb_buffer_alloc(xpad->udev, XPAD_PKT_LEN, | 536 | xpad->odata = usb_buffer_alloc(xpad->udev, XPAD_PKT_LEN, |
@@ -535,13 +560,13 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) | |||
535 | 560 | ||
536 | static void xpad_stop_output(struct usb_xpad *xpad) | 561 | static void xpad_stop_output(struct usb_xpad *xpad) |
537 | { | 562 | { |
538 | if (xpad->xtype == XTYPE_XBOX360) | 563 | if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX) |
539 | usb_kill_urb(xpad->irq_out); | 564 | usb_kill_urb(xpad->irq_out); |
540 | } | 565 | } |
541 | 566 | ||
542 | static void xpad_deinit_output(struct usb_xpad *xpad) | 567 | static void xpad_deinit_output(struct usb_xpad *xpad) |
543 | { | 568 | { |
544 | if (xpad->xtype == XTYPE_XBOX360) { | 569 | if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX) { |
545 | usb_free_urb(xpad->irq_out); | 570 | usb_free_urb(xpad->irq_out); |
546 | usb_buffer_free(xpad->udev, XPAD_PKT_LEN, | 571 | usb_buffer_free(xpad->udev, XPAD_PKT_LEN, |
547 | xpad->odata, xpad->odata_dma); | 572 | xpad->odata, xpad->odata_dma); |
@@ -554,24 +579,45 @@ static void xpad_stop_output(struct usb_xpad *xpad) {} | |||
554 | #endif | 579 | #endif |
555 | 580 | ||
556 | #ifdef CONFIG_JOYSTICK_XPAD_FF | 581 | #ifdef CONFIG_JOYSTICK_XPAD_FF |
557 | static int xpad_play_effect(struct input_dev *dev, void *data, | 582 | static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect *effect) |
558 | struct ff_effect *effect) | ||
559 | { | 583 | { |
560 | struct usb_xpad *xpad = input_get_drvdata(dev); | 584 | struct usb_xpad *xpad = input_get_drvdata(dev); |
561 | 585 | ||
562 | if (effect->type == FF_RUMBLE) { | 586 | if (effect->type == FF_RUMBLE) { |
563 | __u16 strong = effect->u.rumble.strong_magnitude; | 587 | __u16 strong = effect->u.rumble.strong_magnitude; |
564 | __u16 weak = effect->u.rumble.weak_magnitude; | 588 | __u16 weak = effect->u.rumble.weak_magnitude; |
565 | xpad->odata[0] = 0x00; | 589 | |
566 | xpad->odata[1] = 0x08; | 590 | switch (xpad->xtype) { |
567 | xpad->odata[2] = 0x00; | 591 | |
568 | xpad->odata[3] = strong / 256; | 592 | case XTYPE_XBOX: |
569 | xpad->odata[4] = weak / 256; | 593 | xpad->odata[0] = 0x00; |
570 | xpad->odata[5] = 0x00; | 594 | xpad->odata[1] = 0x06; |
571 | xpad->odata[6] = 0x00; | 595 | xpad->odata[2] = 0x00; |
572 | xpad->odata[7] = 0x00; | 596 | xpad->odata[3] = strong / 256; /* left actuator */ |
573 | xpad->irq_out->transfer_buffer_length = 8; | 597 | xpad->odata[4] = 0x00; |
574 | usb_submit_urb(xpad->irq_out, GFP_ATOMIC); | 598 | xpad->odata[5] = weak / 256; /* right actuator */ |
599 | xpad->irq_out->transfer_buffer_length = 6; | ||
600 | |||
601 | return usb_submit_urb(xpad->irq_out, GFP_ATOMIC); | ||
602 | |||
603 | case XTYPE_XBOX360: | ||
604 | xpad->odata[0] = 0x00; | ||
605 | xpad->odata[1] = 0x08; | ||
606 | xpad->odata[2] = 0x00; | ||
607 | xpad->odata[3] = strong / 256; /* left actuator? */ | ||
608 | xpad->odata[4] = weak / 256; /* right actuator? */ | ||
609 | xpad->odata[5] = 0x00; | ||
610 | xpad->odata[6] = 0x00; | ||
611 | xpad->odata[7] = 0x00; | ||
612 | xpad->irq_out->transfer_buffer_length = 8; | ||
613 | |||
614 | return usb_submit_urb(xpad->irq_out, GFP_ATOMIC); | ||
615 | |||
616 | default: | ||
617 | dbg("%s - rumble command sent to unsupported xpad type: %d", | ||
618 | __func__, xpad->xtype); | ||
619 | return -1; | ||
620 | } | ||
575 | } | 621 | } |
576 | 622 | ||
577 | return 0; | 623 | return 0; |
@@ -579,7 +625,7 @@ static int xpad_play_effect(struct input_dev *dev, void *data, | |||
579 | 625 | ||
580 | static int xpad_init_ff(struct usb_xpad *xpad) | 626 | static int xpad_init_ff(struct usb_xpad *xpad) |
581 | { | 627 | { |
582 | if (xpad->xtype != XTYPE_XBOX360) | 628 | if (xpad->xtype != XTYPE_XBOX360 && xpad->xtype != XTYPE_XBOX) |
583 | return 0; | 629 | return 0; |
584 | 630 | ||
585 | input_set_capability(xpad->dev, EV_FF, FF_RUMBLE); | 631 | input_set_capability(xpad->dev, EV_FF, FF_RUMBLE); |
@@ -712,11 +758,11 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) | |||
712 | input_set_abs_params(input_dev, abs, -32768, 32767, 16, 128); | 758 | input_set_abs_params(input_dev, abs, -32768, 32767, 16, 128); |
713 | break; | 759 | break; |
714 | case ABS_Z: | 760 | case ABS_Z: |
715 | case ABS_RZ: /* the triggers */ | 761 | case ABS_RZ: /* the triggers (if mapped to axes) */ |
716 | input_set_abs_params(input_dev, abs, 0, 255, 0, 0); | 762 | input_set_abs_params(input_dev, abs, 0, 255, 0, 0); |
717 | break; | 763 | break; |
718 | case ABS_HAT0X: | 764 | case ABS_HAT0X: |
719 | case ABS_HAT0Y: /* the d-pad (only if MAP_DPAD_TO_AXES) */ | 765 | case ABS_HAT0Y: /* the d-pad (only if dpad is mapped to axes */ |
720 | input_set_abs_params(input_dev, abs, -1, 1, 0, 0); | 766 | input_set_abs_params(input_dev, abs, -1, 1, 0, 0); |
721 | break; | 767 | break; |
722 | } | 768 | } |
@@ -752,10 +798,9 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
752 | goto fail2; | 798 | goto fail2; |
753 | 799 | ||
754 | xpad->udev = udev; | 800 | xpad->udev = udev; |
755 | xpad->dpad_mapping = xpad_device[i].dpad_mapping; | 801 | xpad->mapping = xpad_device[i].mapping; |
756 | xpad->xtype = xpad_device[i].xtype; | 802 | xpad->xtype = xpad_device[i].xtype; |
757 | if (xpad->dpad_mapping == MAP_DPAD_UNKNOWN) | 803 | |
758 | xpad->dpad_mapping = !dpad_to_buttons; | ||
759 | if (xpad->xtype == XTYPE_UNKNOWN) { | 804 | if (xpad->xtype == XTYPE_UNKNOWN) { |
760 | if (intf->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) { | 805 | if (intf->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) { |
761 | if (intf->cur_altsetting->desc.bInterfaceProtocol == 129) | 806 | if (intf->cur_altsetting->desc.bInterfaceProtocol == 129) |
@@ -764,7 +809,13 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
764 | xpad->xtype = XTYPE_XBOX360; | 809 | xpad->xtype = XTYPE_XBOX360; |
765 | } else | 810 | } else |
766 | xpad->xtype = XTYPE_XBOX; | 811 | xpad->xtype = XTYPE_XBOX; |
812 | |||
813 | if (dpad_to_buttons) | ||
814 | xpad->mapping |= MAP_DPAD_TO_BUTTONS; | ||
815 | if (triggers_to_buttons) | ||
816 | xpad->mapping |= MAP_TRIGGERS_TO_BUTTONS; | ||
767 | } | 817 | } |
818 | |||
768 | xpad->dev = input_dev; | 819 | xpad->dev = input_dev; |
769 | usb_make_path(udev, xpad->phys, sizeof(xpad->phys)); | 820 | usb_make_path(udev, xpad->phys, sizeof(xpad->phys)); |
770 | strlcat(xpad->phys, "/input0", sizeof(xpad->phys)); | 821 | strlcat(xpad->phys, "/input0", sizeof(xpad->phys)); |
@@ -781,25 +832,37 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
781 | 832 | ||
782 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 833 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
783 | 834 | ||
784 | /* set up buttons */ | 835 | /* set up standard buttons and axes */ |
785 | for (i = 0; xpad_common_btn[i] >= 0; i++) | 836 | for (i = 0; xpad_common_btn[i] >= 0; i++) |
786 | set_bit(xpad_common_btn[i], input_dev->keybit); | 837 | __set_bit(xpad_common_btn[i], input_dev->keybit); |
787 | if ((xpad->xtype == XTYPE_XBOX360) || (xpad->xtype == XTYPE_XBOX360W)) | ||
788 | for (i = 0; xpad360_btn[i] >= 0; i++) | ||
789 | set_bit(xpad360_btn[i], input_dev->keybit); | ||
790 | else | ||
791 | for (i = 0; xpad_btn[i] >= 0; i++) | ||
792 | set_bit(xpad_btn[i], input_dev->keybit); | ||
793 | if (xpad->dpad_mapping == MAP_DPAD_TO_BUTTONS) | ||
794 | for (i = 0; xpad_btn_pad[i] >= 0; i++) | ||
795 | set_bit(xpad_btn_pad[i], input_dev->keybit); | ||
796 | 838 | ||
797 | /* set up axes */ | ||
798 | for (i = 0; xpad_abs[i] >= 0; i++) | 839 | for (i = 0; xpad_abs[i] >= 0; i++) |
799 | xpad_set_up_abs(input_dev, xpad_abs[i]); | 840 | xpad_set_up_abs(input_dev, xpad_abs[i]); |
800 | if (xpad->dpad_mapping == MAP_DPAD_TO_AXES) | 841 | |
842 | /* Now set up model-specific ones */ | ||
843 | if (xpad->xtype == XTYPE_XBOX360 || xpad->xtype == XTYPE_XBOX360W) { | ||
844 | for (i = 0; xpad360_btn[i] >= 0; i++) | ||
845 | __set_bit(xpad360_btn[i], input_dev->keybit); | ||
846 | } else { | ||
847 | for (i = 0; xpad_btn[i] >= 0; i++) | ||
848 | __set_bit(xpad_btn[i], input_dev->keybit); | ||
849 | } | ||
850 | |||
851 | if (xpad->mapping & MAP_DPAD_TO_BUTTONS) { | ||
852 | for (i = 0; xpad_btn_pad[i] >= 0; i++) | ||
853 | __set_bit(xpad_btn_pad[i], input_dev->keybit); | ||
854 | } else { | ||
801 | for (i = 0; xpad_abs_pad[i] >= 0; i++) | 855 | for (i = 0; xpad_abs_pad[i] >= 0; i++) |
802 | xpad_set_up_abs(input_dev, xpad_abs_pad[i]); | 856 | xpad_set_up_abs(input_dev, xpad_abs_pad[i]); |
857 | } | ||
858 | |||
859 | if (xpad->mapping & MAP_TRIGGERS_TO_BUTTONS) { | ||
860 | for (i = 0; xpad_btn_triggers[i] >= 0; i++) | ||
861 | __set_bit(xpad_btn_triggers[i], input_dev->keybit); | ||
862 | } else { | ||
863 | for (i = 0; xpad_abs_triggers[i] >= 0; i++) | ||
864 | xpad_set_up_abs(input_dev, xpad_abs_triggers[i]); | ||
865 | } | ||
803 | 866 | ||
804 | error = xpad_init_output(intf, xpad); | 867 | error = xpad_init_output(intf, xpad); |
805 | if (error) | 868 | if (error) |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 02c836e11813..64c102355f53 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -35,10 +35,10 @@ config KEYBOARD_ADP5520 | |||
35 | be called adp5520-keys. | 35 | be called adp5520-keys. |
36 | 36 | ||
37 | config KEYBOARD_ADP5588 | 37 | config KEYBOARD_ADP5588 |
38 | tristate "ADP5588 I2C QWERTY Keypad and IO Expander" | 38 | tristate "ADP5588/87 I2C QWERTY Keypad and IO Expander" |
39 | depends on I2C | 39 | depends on I2C |
40 | help | 40 | help |
41 | Say Y here if you want to use a ADP5588 attached to your | 41 | Say Y here if you want to use a ADP5588/87 attached to your |
42 | system I2C bus. | 42 | system I2C bus. |
43 | 43 | ||
44 | To compile this driver as a module, choose M here: the | 44 | To compile this driver as a module, choose M here: the |
@@ -144,13 +144,15 @@ config KEYBOARD_BFIN | |||
144 | module will be called bf54x-keys. | 144 | module will be called bf54x-keys. |
145 | 145 | ||
146 | config KEYBOARD_CORGI | 146 | config KEYBOARD_CORGI |
147 | tristate "Corgi keyboard" | 147 | tristate "Corgi keyboard (deprecated)" |
148 | depends on PXA_SHARPSL | 148 | depends on PXA_SHARPSL |
149 | default y | ||
150 | help | 149 | help |
151 | Say Y here to enable the keyboard on the Sharp Zaurus SL-C7xx | 150 | Say Y here to enable the keyboard on the Sharp Zaurus SL-C7xx |
152 | series of PDAs. | 151 | series of PDAs. |
153 | 152 | ||
153 | This driver is now deprecated, use generic GPIO based matrix | ||
154 | keyboard driver instead. | ||
155 | |||
154 | To compile this driver as a module, choose M here: the | 156 | To compile this driver as a module, choose M here: the |
155 | module will be called corgikbd. | 157 | module will be called corgikbd. |
156 | 158 | ||
@@ -292,6 +294,15 @@ config KEYBOARD_MAX7359 | |||
292 | To compile this driver as a module, choose M here: the | 294 | To compile this driver as a module, choose M here: the |
293 | module will be called max7359_keypad. | 295 | module will be called max7359_keypad. |
294 | 296 | ||
297 | config KEYBOARD_IMX | ||
298 | tristate "IMX keypad support" | ||
299 | depends on ARCH_MXC | ||
300 | help | ||
301 | Enable support for IMX keypad port. | ||
302 | |||
303 | To compile this driver as a module, choose M here: the | ||
304 | module will be called imx_keypad. | ||
305 | |||
295 | config KEYBOARD_NEWTON | 306 | config KEYBOARD_NEWTON |
296 | tristate "Newton keyboard" | 307 | tristate "Newton keyboard" |
297 | select SERIO | 308 | select SERIO |
@@ -329,13 +340,15 @@ config KEYBOARD_PXA930_ROTARY | |||
329 | module will be called pxa930_rotary. | 340 | module will be called pxa930_rotary. |
330 | 341 | ||
331 | config KEYBOARD_SPITZ | 342 | config KEYBOARD_SPITZ |
332 | tristate "Spitz keyboard" | 343 | tristate "Spitz keyboard (deprecated)" |
333 | depends on PXA_SHARPSL | 344 | depends on PXA_SHARPSL |
334 | default y | ||
335 | help | 345 | help |
336 | Say Y here to enable the keyboard on the Sharp Zaurus SL-C1000, | 346 | Say Y here to enable the keyboard on the Sharp Zaurus SL-C1000, |
337 | SL-C3000 and Sl-C3100 series of PDAs. | 347 | SL-C3000 and Sl-C3100 series of PDAs. |
338 | 348 | ||
349 | This driver is now deprecated, use generic GPIO based matrix | ||
350 | keyboard driver instead. | ||
351 | |||
339 | To compile this driver as a module, choose M here: the | 352 | To compile this driver as a module, choose M here: the |
340 | module will be called spitzkbd. | 353 | module will be called spitzkbd. |
341 | 354 | ||
@@ -363,7 +376,7 @@ config KEYBOARD_SUNKBD | |||
363 | 376 | ||
364 | config KEYBOARD_SH_KEYSC | 377 | config KEYBOARD_SH_KEYSC |
365 | tristate "SuperH KEYSC keypad support" | 378 | tristate "SuperH KEYSC keypad support" |
366 | depends on SUPERH | 379 | depends on SUPERH || ARCH_SHMOBILE |
367 | help | 380 | help |
368 | Say Y here if you want to use a keypad attached to the KEYSC block | 381 | Say Y here if you want to use a keypad attached to the KEYSC block |
369 | on SuperH processors such as sh7722 and sh7343. | 382 | on SuperH processors such as sh7722 and sh7343. |
@@ -402,12 +415,14 @@ config KEYBOARD_TWL4030 | |||
402 | module will be called twl4030_keypad. | 415 | module will be called twl4030_keypad. |
403 | 416 | ||
404 | config KEYBOARD_TOSA | 417 | config KEYBOARD_TOSA |
405 | tristate "Tosa keyboard" | 418 | tristate "Tosa keyboard (deprecated)" |
406 | depends on MACH_TOSA | 419 | depends on MACH_TOSA |
407 | default y | ||
408 | help | 420 | help |
409 | Say Y here to enable the keyboard on the Sharp Zaurus SL-6000x (Tosa) | 421 | Say Y here to enable the keyboard on the Sharp Zaurus SL-6000x (Tosa) |
410 | 422 | ||
423 | This driver is now deprecated, use generic GPIO based matrix | ||
424 | keyboard driver instead. | ||
425 | |||
411 | To compile this driver as a module, choose M here: the | 426 | To compile this driver as a module, choose M here: the |
412 | module will be called tosakbd. | 427 | module will be called tosakbd. |
413 | 428 | ||
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 78654ef65206..706c6b5ed5f4 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile | |||
@@ -17,6 +17,7 @@ obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o | |||
17 | obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o | 17 | obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o |
18 | obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o | 18 | obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o |
19 | obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o | 19 | obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o |
20 | obj-$(CONFIG_KEYBOARD_IMX) += imx_keypad.o | ||
20 | obj-$(CONFIG_KEYBOARD_HP6XX) += jornada680_kbd.o | 21 | obj-$(CONFIG_KEYBOARD_HP6XX) += jornada680_kbd.o |
21 | obj-$(CONFIG_KEYBOARD_HP7XX) += jornada720_kbd.o | 22 | obj-$(CONFIG_KEYBOARD_HP7XX) += jornada720_kbd.o |
22 | obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o | 23 | obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o |
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c index 1edb596d927b..b5142d2d5112 100644 --- a/drivers/input/keyboard/adp5588-keys.c +++ b/drivers/input/keyboard/adp5588-keys.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * File: drivers/input/keyboard/adp5588_keys.c | 2 | * File: drivers/input/keyboard/adp5588_keys.c |
3 | * Description: keypad driver for ADP5588 I2C QWERTY Keypad and IO Expander | 3 | * Description: keypad driver for ADP5588 and ADP5587 |
4 | * I2C QWERTY Keypad and IO Expander | ||
4 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ | 5 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ |
5 | * | 6 | * |
6 | * Copyright (C) 2008-2009 Analog Devices Inc. | 7 | * Copyright (C) 2008-2009 Analog Devices Inc. |
@@ -327,6 +328,7 @@ static const struct dev_pm_ops adp5588_dev_pm_ops = { | |||
327 | 328 | ||
328 | static const struct i2c_device_id adp5588_id[] = { | 329 | static const struct i2c_device_id adp5588_id[] = { |
329 | { KBUILD_MODNAME, 0 }, | 330 | { KBUILD_MODNAME, 0 }, |
331 | { "adp5587-keys", 0 }, | ||
330 | { } | 332 | { } |
331 | }; | 333 | }; |
332 | MODULE_DEVICE_TABLE(i2c, adp5588_id); | 334 | MODULE_DEVICE_TABLE(i2c, adp5588_id); |
@@ -357,5 +359,5 @@ module_exit(adp5588_exit); | |||
357 | 359 | ||
358 | MODULE_LICENSE("GPL"); | 360 | MODULE_LICENSE("GPL"); |
359 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); | 361 | MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>"); |
360 | MODULE_DESCRIPTION("ADP5588 Keypad driver"); | 362 | MODULE_DESCRIPTION("ADP5588/87 Keypad driver"); |
361 | MODULE_ALIAS("platform:adp5588-keys"); | 363 | MODULE_ALIAS("platform:adp5588-keys"); |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 7b4056292eaf..d358ef8623f4 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -40,26 +40,26 @@ module_param_named(set, atkbd_set, int, 0); | |||
40 | MODULE_PARM_DESC(set, "Select keyboard code set (2 = default, 3 = PS/2 native)"); | 40 | MODULE_PARM_DESC(set, "Select keyboard code set (2 = default, 3 = PS/2 native)"); |
41 | 41 | ||
42 | #if defined(__i386__) || defined(__x86_64__) || defined(__hppa__) | 42 | #if defined(__i386__) || defined(__x86_64__) || defined(__hppa__) |
43 | static int atkbd_reset; | 43 | static bool atkbd_reset; |
44 | #else | 44 | #else |
45 | static int atkbd_reset = 1; | 45 | static bool atkbd_reset = true; |
46 | #endif | 46 | #endif |
47 | module_param_named(reset, atkbd_reset, bool, 0); | 47 | module_param_named(reset, atkbd_reset, bool, 0); |
48 | MODULE_PARM_DESC(reset, "Reset keyboard during initialization"); | 48 | MODULE_PARM_DESC(reset, "Reset keyboard during initialization"); |
49 | 49 | ||
50 | static int atkbd_softrepeat; | 50 | static bool atkbd_softrepeat; |
51 | module_param_named(softrepeat, atkbd_softrepeat, bool, 0); | 51 | module_param_named(softrepeat, atkbd_softrepeat, bool, 0); |
52 | MODULE_PARM_DESC(softrepeat, "Use software keyboard repeat"); | 52 | MODULE_PARM_DESC(softrepeat, "Use software keyboard repeat"); |
53 | 53 | ||
54 | static int atkbd_softraw = 1; | 54 | static bool atkbd_softraw = true; |
55 | module_param_named(softraw, atkbd_softraw, bool, 0); | 55 | module_param_named(softraw, atkbd_softraw, bool, 0); |
56 | MODULE_PARM_DESC(softraw, "Use software generated rawmode"); | 56 | MODULE_PARM_DESC(softraw, "Use software generated rawmode"); |
57 | 57 | ||
58 | static int atkbd_scroll; | 58 | static bool atkbd_scroll; |
59 | module_param_named(scroll, atkbd_scroll, bool, 0); | 59 | module_param_named(scroll, atkbd_scroll, bool, 0); |
60 | MODULE_PARM_DESC(scroll, "Enable scroll-wheel on MS Office and similar keyboards"); | 60 | MODULE_PARM_DESC(scroll, "Enable scroll-wheel on MS Office and similar keyboards"); |
61 | 61 | ||
62 | static int atkbd_extra; | 62 | static bool atkbd_extra; |
63 | module_param_named(extra, atkbd_extra, bool, 0); | 63 | module_param_named(extra, atkbd_extra, bool, 0); |
64 | MODULE_PARM_DESC(extra, "Enable extra LEDs and keys on IBM RapidAcces, EzKey and similar keyboards"); | 64 | MODULE_PARM_DESC(extra, "Enable extra LEDs and keys on IBM RapidAcces, EzKey and similar keyboards"); |
65 | 65 | ||
@@ -153,16 +153,16 @@ static const unsigned short atkbd_unxlate_table[128] = { | |||
153 | #define ATKBD_RET_HANGEUL 0xf2 | 153 | #define ATKBD_RET_HANGEUL 0xf2 |
154 | #define ATKBD_RET_ERR 0xff | 154 | #define ATKBD_RET_ERR 0xff |
155 | 155 | ||
156 | #define ATKBD_KEY_UNKNOWN 0 | 156 | #define ATKBD_KEY_UNKNOWN 0 |
157 | #define ATKBD_KEY_NULL 255 | 157 | #define ATKBD_KEY_NULL 255 |
158 | 158 | ||
159 | #define ATKBD_SCR_1 254 | 159 | #define ATKBD_SCR_1 0xfffe |
160 | #define ATKBD_SCR_2 253 | 160 | #define ATKBD_SCR_2 0xfffd |
161 | #define ATKBD_SCR_4 252 | 161 | #define ATKBD_SCR_4 0xfffc |
162 | #define ATKBD_SCR_8 251 | 162 | #define ATKBD_SCR_8 0xfffb |
163 | #define ATKBD_SCR_CLICK 250 | 163 | #define ATKBD_SCR_CLICK 0xfffa |
164 | #define ATKBD_SCR_LEFT 249 | 164 | #define ATKBD_SCR_LEFT 0xfff9 |
165 | #define ATKBD_SCR_RIGHT 248 | 165 | #define ATKBD_SCR_RIGHT 0xfff8 |
166 | 166 | ||
167 | #define ATKBD_SPECIAL ATKBD_SCR_RIGHT | 167 | #define ATKBD_SPECIAL ATKBD_SCR_RIGHT |
168 | 168 | ||
@@ -177,7 +177,7 @@ static const unsigned short atkbd_unxlate_table[128] = { | |||
177 | #define ATKBD_XL_HANJA 0x20 | 177 | #define ATKBD_XL_HANJA 0x20 |
178 | 178 | ||
179 | static const struct { | 179 | static const struct { |
180 | unsigned char keycode; | 180 | unsigned short keycode; |
181 | unsigned char set2; | 181 | unsigned char set2; |
182 | } atkbd_scroll_keys[] = { | 182 | } atkbd_scroll_keys[] = { |
183 | { ATKBD_SCR_1, 0xc5 }, | 183 | { ATKBD_SCR_1, 0xc5 }, |
@@ -206,18 +206,18 @@ struct atkbd { | |||
206 | unsigned short keycode[ATKBD_KEYMAP_SIZE]; | 206 | unsigned short keycode[ATKBD_KEYMAP_SIZE]; |
207 | DECLARE_BITMAP(force_release_mask, ATKBD_KEYMAP_SIZE); | 207 | DECLARE_BITMAP(force_release_mask, ATKBD_KEYMAP_SIZE); |
208 | unsigned char set; | 208 | unsigned char set; |
209 | unsigned char translated; | 209 | bool translated; |
210 | unsigned char extra; | 210 | bool extra; |
211 | unsigned char write; | 211 | bool write; |
212 | unsigned char softrepeat; | 212 | bool softrepeat; |
213 | unsigned char softraw; | 213 | bool softraw; |
214 | unsigned char scroll; | 214 | bool scroll; |
215 | unsigned char enabled; | 215 | bool enabled; |
216 | 216 | ||
217 | /* Accessed only from interrupt */ | 217 | /* Accessed only from interrupt */ |
218 | unsigned char emul; | 218 | unsigned char emul; |
219 | unsigned char resend; | 219 | bool resend; |
220 | unsigned char release; | 220 | bool release; |
221 | unsigned long xl_bit; | 221 | unsigned long xl_bit; |
222 | unsigned int last; | 222 | unsigned int last; |
223 | unsigned long time; | 223 | unsigned long time; |
@@ -301,18 +301,18 @@ static const unsigned int xl_table[] = { | |||
301 | * Checks if we should mangle the scancode to extract 'release' bit | 301 | * Checks if we should mangle the scancode to extract 'release' bit |
302 | * in translated mode. | 302 | * in translated mode. |
303 | */ | 303 | */ |
304 | static int atkbd_need_xlate(unsigned long xl_bit, unsigned char code) | 304 | static bool atkbd_need_xlate(unsigned long xl_bit, unsigned char code) |
305 | { | 305 | { |
306 | int i; | 306 | int i; |
307 | 307 | ||
308 | if (code == ATKBD_RET_EMUL0 || code == ATKBD_RET_EMUL1) | 308 | if (code == ATKBD_RET_EMUL0 || code == ATKBD_RET_EMUL1) |
309 | return 0; | 309 | return false; |
310 | 310 | ||
311 | for (i = 0; i < ARRAY_SIZE(xl_table); i++) | 311 | for (i = 0; i < ARRAY_SIZE(xl_table); i++) |
312 | if (code == xl_table[i]) | 312 | if (code == xl_table[i]) |
313 | return test_bit(i, &xl_bit); | 313 | return test_bit(i, &xl_bit); |
314 | 314 | ||
315 | return 1; | 315 | return true; |
316 | } | 316 | } |
317 | 317 | ||
318 | /* | 318 | /* |
@@ -359,7 +359,7 @@ static unsigned int atkbd_compat_scancode(struct atkbd *atkbd, unsigned int code | |||
359 | */ | 359 | */ |
360 | 360 | ||
361 | static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, | 361 | static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, |
362 | unsigned int flags) | 362 | unsigned int flags) |
363 | { | 363 | { |
364 | struct atkbd *atkbd = serio_get_drvdata(serio); | 364 | struct atkbd *atkbd = serio_get_drvdata(serio); |
365 | struct input_dev *dev = atkbd->dev; | 365 | struct input_dev *dev = atkbd->dev; |
@@ -368,20 +368,18 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, | |||
368 | int value; | 368 | int value; |
369 | unsigned short keycode; | 369 | unsigned short keycode; |
370 | 370 | ||
371 | #ifdef ATKBD_DEBUG | 371 | dev_dbg(&serio->dev, "Received %02x flags %02x\n", data, flags); |
372 | printk(KERN_DEBUG "atkbd.c: Received %02x flags %02x\n", data, flags); | ||
373 | #endif | ||
374 | 372 | ||
375 | #if !defined(__i386__) && !defined (__x86_64__) | 373 | #if !defined(__i386__) && !defined (__x86_64__) |
376 | if ((flags & (SERIO_FRAME | SERIO_PARITY)) && (~flags & SERIO_TIMEOUT) && !atkbd->resend && atkbd->write) { | 374 | if ((flags & (SERIO_FRAME | SERIO_PARITY)) && (~flags & SERIO_TIMEOUT) && !atkbd->resend && atkbd->write) { |
377 | printk(KERN_WARNING "atkbd.c: frame/parity error: %02x\n", flags); | 375 | dev_warn(&serio->dev, "Frame/parity error: %02x\n", flags); |
378 | serio_write(serio, ATKBD_CMD_RESEND); | 376 | serio_write(serio, ATKBD_CMD_RESEND); |
379 | atkbd->resend = 1; | 377 | atkbd->resend = true; |
380 | goto out; | 378 | goto out; |
381 | } | 379 | } |
382 | 380 | ||
383 | if (!flags && data == ATKBD_RET_ACK) | 381 | if (!flags && data == ATKBD_RET_ACK) |
384 | atkbd->resend = 0; | 382 | atkbd->resend = false; |
385 | #endif | 383 | #endif |
386 | 384 | ||
387 | if (unlikely(atkbd->ps2dev.flags & PS2_FLAG_ACK)) | 385 | if (unlikely(atkbd->ps2dev.flags & PS2_FLAG_ACK)) |
@@ -412,32 +410,32 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, | |||
412 | } | 410 | } |
413 | 411 | ||
414 | switch (code) { | 412 | switch (code) { |
415 | case ATKBD_RET_BAT: | 413 | case ATKBD_RET_BAT: |
416 | atkbd->enabled = 0; | 414 | atkbd->enabled = false; |
417 | serio_reconnect(atkbd->ps2dev.serio); | 415 | serio_reconnect(atkbd->ps2dev.serio); |
418 | goto out; | 416 | goto out; |
419 | case ATKBD_RET_EMUL0: | 417 | case ATKBD_RET_EMUL0: |
420 | atkbd->emul = 1; | 418 | atkbd->emul = 1; |
421 | goto out; | 419 | goto out; |
422 | case ATKBD_RET_EMUL1: | 420 | case ATKBD_RET_EMUL1: |
423 | atkbd->emul = 2; | 421 | atkbd->emul = 2; |
424 | goto out; | 422 | goto out; |
425 | case ATKBD_RET_RELEASE: | 423 | case ATKBD_RET_RELEASE: |
426 | atkbd->release = 1; | 424 | atkbd->release = true; |
427 | goto out; | 425 | goto out; |
428 | case ATKBD_RET_ACK: | 426 | case ATKBD_RET_ACK: |
429 | case ATKBD_RET_NAK: | 427 | case ATKBD_RET_NAK: |
430 | if (printk_ratelimit()) | 428 | if (printk_ratelimit()) |
431 | printk(KERN_WARNING "atkbd.c: Spurious %s on %s. " | 429 | dev_warn(&serio->dev, |
432 | "Some program might be trying access hardware directly.\n", | 430 | "Spurious %s on %s. " |
433 | data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys); | 431 | "Some program might be trying access hardware directly.\n", |
434 | goto out; | 432 | data == ATKBD_RET_ACK ? "ACK" : "NAK", serio->phys); |
435 | case ATKBD_RET_ERR: | 433 | goto out; |
436 | atkbd->err_count++; | 434 | case ATKBD_RET_ERR: |
437 | #ifdef ATKBD_DEBUG | 435 | atkbd->err_count++; |
438 | printk(KERN_DEBUG "atkbd.c: Keyboard on %s reports too many keys pressed.\n", serio->phys); | 436 | dev_dbg(&serio->dev, "Keyboard on %s reports too many keys pressed.\n", |
439 | #endif | 437 | serio->phys); |
440 | goto out; | 438 | goto out; |
441 | } | 439 | } |
442 | 440 | ||
443 | code = atkbd_compat_scancode(atkbd, code); | 441 | code = atkbd_compat_scancode(atkbd, code); |
@@ -451,71 +449,72 @@ static irqreturn_t atkbd_interrupt(struct serio *serio, unsigned char data, | |||
451 | input_event(dev, EV_MSC, MSC_SCAN, code); | 449 | input_event(dev, EV_MSC, MSC_SCAN, code); |
452 | 450 | ||
453 | switch (keycode) { | 451 | switch (keycode) { |
454 | case ATKBD_KEY_NULL: | 452 | case ATKBD_KEY_NULL: |
455 | break; | 453 | break; |
456 | case ATKBD_KEY_UNKNOWN: | 454 | case ATKBD_KEY_UNKNOWN: |
457 | printk(KERN_WARNING | 455 | dev_warn(&serio->dev, |
458 | "atkbd.c: Unknown key %s (%s set %d, code %#x on %s).\n", | 456 | "Unknown key %s (%s set %d, code %#x on %s).\n", |
459 | atkbd->release ? "released" : "pressed", | 457 | atkbd->release ? "released" : "pressed", |
460 | atkbd->translated ? "translated" : "raw", | 458 | atkbd->translated ? "translated" : "raw", |
461 | atkbd->set, code, serio->phys); | 459 | atkbd->set, code, serio->phys); |
462 | printk(KERN_WARNING | 460 | dev_warn(&serio->dev, |
463 | "atkbd.c: Use 'setkeycodes %s%02x <keycode>' to make it known.\n", | 461 | "Use 'setkeycodes %s%02x <keycode>' to make it known.\n", |
464 | code & 0x80 ? "e0" : "", code & 0x7f); | 462 | code & 0x80 ? "e0" : "", code & 0x7f); |
465 | input_sync(dev); | 463 | input_sync(dev); |
466 | break; | 464 | break; |
467 | case ATKBD_SCR_1: | 465 | case ATKBD_SCR_1: |
468 | scroll = 1 - atkbd->release * 2; | 466 | scroll = 1; |
469 | break; | 467 | break; |
470 | case ATKBD_SCR_2: | 468 | case ATKBD_SCR_2: |
471 | scroll = 2 - atkbd->release * 4; | 469 | scroll = 2; |
472 | break; | 470 | break; |
473 | case ATKBD_SCR_4: | 471 | case ATKBD_SCR_4: |
474 | scroll = 4 - atkbd->release * 8; | 472 | scroll = 4; |
475 | break; | 473 | break; |
476 | case ATKBD_SCR_8: | 474 | case ATKBD_SCR_8: |
477 | scroll = 8 - atkbd->release * 16; | 475 | scroll = 8; |
478 | break; | 476 | break; |
479 | case ATKBD_SCR_CLICK: | 477 | case ATKBD_SCR_CLICK: |
480 | click = !atkbd->release; | 478 | click = !atkbd->release; |
481 | break; | 479 | break; |
482 | case ATKBD_SCR_LEFT: | 480 | case ATKBD_SCR_LEFT: |
483 | hscroll = -1; | 481 | hscroll = -1; |
484 | break; | 482 | break; |
485 | case ATKBD_SCR_RIGHT: | 483 | case ATKBD_SCR_RIGHT: |
486 | hscroll = 1; | 484 | hscroll = 1; |
487 | break; | 485 | break; |
488 | default: | 486 | default: |
489 | if (atkbd->release) { | 487 | if (atkbd->release) { |
490 | value = 0; | 488 | value = 0; |
491 | atkbd->last = 0; | 489 | atkbd->last = 0; |
492 | } else if (!atkbd->softrepeat && test_bit(keycode, dev->key)) { | 490 | } else if (!atkbd->softrepeat && test_bit(keycode, dev->key)) { |
493 | /* Workaround Toshiba laptop multiple keypress */ | 491 | /* Workaround Toshiba laptop multiple keypress */ |
494 | value = time_before(jiffies, atkbd->time) && atkbd->last == code ? 1 : 2; | 492 | value = time_before(jiffies, atkbd->time) && atkbd->last == code ? 1 : 2; |
495 | } else { | 493 | } else { |
496 | value = 1; | 494 | value = 1; |
497 | atkbd->last = code; | 495 | atkbd->last = code; |
498 | atkbd->time = jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]) / 2; | 496 | atkbd->time = jiffies + msecs_to_jiffies(dev->rep[REP_DELAY]) / 2; |
499 | } | 497 | } |
500 | 498 | ||
501 | input_event(dev, EV_KEY, keycode, value); | 499 | input_event(dev, EV_KEY, keycode, value); |
502 | input_sync(dev); | 500 | input_sync(dev); |
503 | 501 | ||
504 | if (value && test_bit(code, atkbd->force_release_mask)) { | 502 | if (value && test_bit(code, atkbd->force_release_mask)) { |
505 | input_report_key(dev, keycode, 0); | 503 | input_report_key(dev, keycode, 0); |
506 | input_sync(dev); | 504 | input_sync(dev); |
507 | } | 505 | } |
508 | } | 506 | } |
509 | 507 | ||
510 | if (atkbd->scroll) { | 508 | if (atkbd->scroll) { |
511 | if (click != -1) | 509 | if (click != -1) |
512 | input_report_key(dev, BTN_MIDDLE, click); | 510 | input_report_key(dev, BTN_MIDDLE, click); |
513 | input_report_rel(dev, REL_WHEEL, scroll); | 511 | input_report_rel(dev, REL_WHEEL, |
512 | atkbd->release ? -scroll : scroll); | ||
514 | input_report_rel(dev, REL_HWHEEL, hscroll); | 513 | input_report_rel(dev, REL_HWHEEL, hscroll); |
515 | input_sync(dev); | 514 | input_sync(dev); |
516 | } | 515 | } |
517 | 516 | ||
518 | atkbd->release = 0; | 517 | atkbd->release = false; |
519 | out: | 518 | out: |
520 | return IRQ_HANDLED; | 519 | return IRQ_HANDLED; |
521 | } | 520 | } |
@@ -634,17 +633,18 @@ static int atkbd_event(struct input_dev *dev, | |||
634 | 633 | ||
635 | switch (type) { | 634 | switch (type) { |
636 | 635 | ||
637 | case EV_LED: | 636 | case EV_LED: |
638 | atkbd_schedule_event_work(atkbd, ATKBD_LED_EVENT_BIT); | 637 | atkbd_schedule_event_work(atkbd, ATKBD_LED_EVENT_BIT); |
639 | return 0; | 638 | return 0; |
640 | 639 | ||
641 | case EV_REP: | 640 | case EV_REP: |
642 | if (!atkbd->softrepeat) | 641 | if (!atkbd->softrepeat) |
643 | atkbd_schedule_event_work(atkbd, ATKBD_REP_EVENT_BIT); | 642 | atkbd_schedule_event_work(atkbd, ATKBD_REP_EVENT_BIT); |
644 | return 0; | 643 | return 0; |
645 | } | ||
646 | 644 | ||
647 | return -1; | 645 | default: |
646 | return -1; | ||
647 | } | ||
648 | } | 648 | } |
649 | 649 | ||
650 | /* | 650 | /* |
@@ -655,7 +655,7 @@ static int atkbd_event(struct input_dev *dev, | |||
655 | static inline void atkbd_enable(struct atkbd *atkbd) | 655 | static inline void atkbd_enable(struct atkbd *atkbd) |
656 | { | 656 | { |
657 | serio_pause_rx(atkbd->ps2dev.serio); | 657 | serio_pause_rx(atkbd->ps2dev.serio); |
658 | atkbd->enabled = 1; | 658 | atkbd->enabled = true; |
659 | serio_continue_rx(atkbd->ps2dev.serio); | 659 | serio_continue_rx(atkbd->ps2dev.serio); |
660 | } | 660 | } |
661 | 661 | ||
@@ -667,7 +667,7 @@ static inline void atkbd_enable(struct atkbd *atkbd) | |||
667 | static inline void atkbd_disable(struct atkbd *atkbd) | 667 | static inline void atkbd_disable(struct atkbd *atkbd) |
668 | { | 668 | { |
669 | serio_pause_rx(atkbd->ps2dev.serio); | 669 | serio_pause_rx(atkbd->ps2dev.serio); |
670 | atkbd->enabled = 0; | 670 | atkbd->enabled = false; |
671 | serio_continue_rx(atkbd->ps2dev.serio); | 671 | serio_continue_rx(atkbd->ps2dev.serio); |
672 | } | 672 | } |
673 | 673 | ||
@@ -688,7 +688,9 @@ static int atkbd_probe(struct atkbd *atkbd) | |||
688 | 688 | ||
689 | if (atkbd_reset) | 689 | if (atkbd_reset) |
690 | if (ps2_command(ps2dev, NULL, ATKBD_CMD_RESET_BAT)) | 690 | if (ps2_command(ps2dev, NULL, ATKBD_CMD_RESET_BAT)) |
691 | printk(KERN_WARNING "atkbd.c: keyboard reset failed on %s\n", ps2dev->serio->phys); | 691 | dev_warn(&ps2dev->serio->dev, |
692 | "keyboard reset failed on %s\n", | ||
693 | ps2dev->serio->phys); | ||
692 | 694 | ||
693 | /* | 695 | /* |
694 | * Then we check the keyboard ID. We should get 0xab83 under normal conditions. | 696 | * Then we check the keyboard ID. We should get 0xab83 under normal conditions. |
@@ -718,8 +720,9 @@ static int atkbd_probe(struct atkbd *atkbd) | |||
718 | atkbd->id = (param[0] << 8) | param[1]; | 720 | atkbd->id = (param[0] << 8) | param[1]; |
719 | 721 | ||
720 | if (atkbd->id == 0xaca1 && atkbd->translated) { | 722 | if (atkbd->id == 0xaca1 && atkbd->translated) { |
721 | printk(KERN_ERR "atkbd.c: NCD terminal keyboards are only supported on non-translating\n"); | 723 | dev_err(&ps2dev->serio->dev, |
722 | printk(KERN_ERR "atkbd.c: controllers. Use i8042.direct=1 to disable translation.\n"); | 724 | "NCD terminal keyboards are only supported on non-translating controlelrs. " |
725 | "Use i8042.direct=1 to disable translation.\n"); | ||
723 | return -1; | 726 | return -1; |
724 | } | 727 | } |
725 | 728 | ||
@@ -737,7 +740,7 @@ static int atkbd_select_set(struct atkbd *atkbd, int target_set, int allow_extra | |||
737 | struct ps2dev *ps2dev = &atkbd->ps2dev; | 740 | struct ps2dev *ps2dev = &atkbd->ps2dev; |
738 | unsigned char param[2]; | 741 | unsigned char param[2]; |
739 | 742 | ||
740 | atkbd->extra = 0; | 743 | atkbd->extra = false; |
741 | /* | 744 | /* |
742 | * For known special keyboards we can go ahead and set the correct set. | 745 | * For known special keyboards we can go ahead and set the correct set. |
743 | * We check for NCD PS/2 Sun, NorthGate OmniKey 101 and | 746 | * We check for NCD PS/2 Sun, NorthGate OmniKey 101 and |
@@ -756,7 +759,7 @@ static int atkbd_select_set(struct atkbd *atkbd, int target_set, int allow_extra | |||
756 | if (allow_extra) { | 759 | if (allow_extra) { |
757 | param[0] = 0x71; | 760 | param[0] = 0x71; |
758 | if (!ps2_command(ps2dev, param, ATKBD_CMD_EX_ENABLE)) { | 761 | if (!ps2_command(ps2dev, param, ATKBD_CMD_EX_ENABLE)) { |
759 | atkbd->extra = 1; | 762 | atkbd->extra = true; |
760 | return 2; | 763 | return 2; |
761 | } | 764 | } |
762 | } | 765 | } |
@@ -821,7 +824,8 @@ static int atkbd_activate(struct atkbd *atkbd) | |||
821 | */ | 824 | */ |
822 | 825 | ||
823 | if (ps2_command(ps2dev, NULL, ATKBD_CMD_ENABLE)) { | 826 | if (ps2_command(ps2dev, NULL, ATKBD_CMD_ENABLE)) { |
824 | printk(KERN_ERR "atkbd.c: Failed to enable keyboard on %s\n", | 827 | dev_err(&ps2dev->serio->dev, |
828 | "Failed to enable keyboard on %s\n", | ||
825 | ps2dev->serio->phys); | 829 | ps2dev->serio->phys); |
826 | return -1; | 830 | return -1; |
827 | } | 831 | } |
@@ -1070,9 +1074,13 @@ static void atkbd_set_device_attrs(struct atkbd *atkbd) | |||
1070 | input_dev->keycodesize = sizeof(unsigned short); | 1074 | input_dev->keycodesize = sizeof(unsigned short); |
1071 | input_dev->keycodemax = ARRAY_SIZE(atkbd_set2_keycode); | 1075 | input_dev->keycodemax = ARRAY_SIZE(atkbd_set2_keycode); |
1072 | 1076 | ||
1073 | for (i = 0; i < ATKBD_KEYMAP_SIZE; i++) | 1077 | for (i = 0; i < ATKBD_KEYMAP_SIZE; i++) { |
1074 | if (atkbd->keycode[i] && atkbd->keycode[i] < ATKBD_SPECIAL) | 1078 | if (atkbd->keycode[i] != KEY_RESERVED && |
1079 | atkbd->keycode[i] != ATKBD_KEY_NULL && | ||
1080 | atkbd->keycode[i] < ATKBD_SPECIAL) { | ||
1075 | __set_bit(atkbd->keycode[i], input_dev->keybit); | 1081 | __set_bit(atkbd->keycode[i], input_dev->keybit); |
1082 | } | ||
1083 | } | ||
1076 | } | 1084 | } |
1077 | 1085 | ||
1078 | /* | 1086 | /* |
@@ -1100,12 +1108,14 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv) | |||
1100 | 1108 | ||
1101 | switch (serio->id.type) { | 1109 | switch (serio->id.type) { |
1102 | 1110 | ||
1103 | case SERIO_8042_XL: | 1111 | case SERIO_8042_XL: |
1104 | atkbd->translated = 1; | 1112 | atkbd->translated = true; |
1105 | case SERIO_8042: | 1113 | /* Fall through */ |
1106 | if (serio->write) | 1114 | |
1107 | atkbd->write = 1; | 1115 | case SERIO_8042: |
1108 | break; | 1116 | if (serio->write) |
1117 | atkbd->write = true; | ||
1118 | break; | ||
1109 | } | 1119 | } |
1110 | 1120 | ||
1111 | atkbd->softraw = atkbd_softraw; | 1121 | atkbd->softraw = atkbd_softraw; |
@@ -1113,7 +1123,7 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv) | |||
1113 | atkbd->scroll = atkbd_scroll; | 1123 | atkbd->scroll = atkbd_scroll; |
1114 | 1124 | ||
1115 | if (atkbd->softrepeat) | 1125 | if (atkbd->softrepeat) |
1116 | atkbd->softraw = 1; | 1126 | atkbd->softraw = true; |
1117 | 1127 | ||
1118 | serio_set_drvdata(serio, atkbd); | 1128 | serio_set_drvdata(serio, atkbd); |
1119 | 1129 | ||
@@ -1172,7 +1182,8 @@ static int atkbd_reconnect(struct serio *serio) | |||
1172 | int retval = -1; | 1182 | int retval = -1; |
1173 | 1183 | ||
1174 | if (!atkbd || !drv) { | 1184 | if (!atkbd || !drv) { |
1175 | printk(KERN_DEBUG "atkbd: reconnect request, but serio is disconnected, ignoring...\n"); | 1185 | dev_dbg(&serio->dev, |
1186 | "reconnect request, but serio is disconnected, ignoring...\n"); | ||
1176 | return -1; | 1187 | return -1; |
1177 | } | 1188 | } |
1178 | 1189 | ||
@@ -1286,7 +1297,8 @@ static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t coun | |||
1286 | struct input_dev *old_dev, *new_dev; | 1297 | struct input_dev *old_dev, *new_dev; |
1287 | unsigned long value; | 1298 | unsigned long value; |
1288 | int err; | 1299 | int err; |
1289 | unsigned char old_extra, old_set; | 1300 | bool old_extra; |
1301 | unsigned char old_set; | ||
1290 | 1302 | ||
1291 | if (!atkbd->write) | 1303 | if (!atkbd->write) |
1292 | return -EIO; | 1304 | return -EIO; |
@@ -1369,7 +1381,7 @@ static ssize_t atkbd_set_scroll(struct atkbd *atkbd, const char *buf, size_t cou | |||
1369 | struct input_dev *old_dev, *new_dev; | 1381 | struct input_dev *old_dev, *new_dev; |
1370 | unsigned long value; | 1382 | unsigned long value; |
1371 | int err; | 1383 | int err; |
1372 | unsigned char old_scroll; | 1384 | bool old_scroll; |
1373 | 1385 | ||
1374 | if (strict_strtoul(buf, 10, &value) || value > 1) | 1386 | if (strict_strtoul(buf, 10, &value) || value > 1) |
1375 | return -EINVAL; | 1387 | return -EINVAL; |
@@ -1413,7 +1425,8 @@ static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count) | |||
1413 | struct input_dev *old_dev, *new_dev; | 1425 | struct input_dev *old_dev, *new_dev; |
1414 | unsigned long value; | 1426 | unsigned long value; |
1415 | int err; | 1427 | int err; |
1416 | unsigned char old_set, old_extra; | 1428 | unsigned char old_set; |
1429 | bool old_extra; | ||
1417 | 1430 | ||
1418 | if (!atkbd->write) | 1431 | if (!atkbd->write) |
1419 | return -EIO; | 1432 | return -EIO; |
@@ -1463,7 +1476,7 @@ static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t | |||
1463 | struct input_dev *old_dev, *new_dev; | 1476 | struct input_dev *old_dev, *new_dev; |
1464 | unsigned long value; | 1477 | unsigned long value; |
1465 | int err; | 1478 | int err; |
1466 | unsigned char old_softrepeat, old_softraw; | 1479 | bool old_softrepeat, old_softraw; |
1467 | 1480 | ||
1468 | if (!atkbd->write) | 1481 | if (!atkbd->write) |
1469 | return -EIO; | 1482 | return -EIO; |
@@ -1483,7 +1496,7 @@ static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t | |||
1483 | atkbd->dev = new_dev; | 1496 | atkbd->dev = new_dev; |
1484 | atkbd->softrepeat = value; | 1497 | atkbd->softrepeat = value; |
1485 | if (atkbd->softrepeat) | 1498 | if (atkbd->softrepeat) |
1486 | atkbd->softraw = 1; | 1499 | atkbd->softraw = true; |
1487 | atkbd_set_device_attrs(atkbd); | 1500 | atkbd_set_device_attrs(atkbd); |
1488 | 1501 | ||
1489 | err = input_register_device(atkbd->dev); | 1502 | err = input_register_device(atkbd->dev); |
@@ -1513,7 +1526,7 @@ static ssize_t atkbd_set_softraw(struct atkbd *atkbd, const char *buf, size_t co | |||
1513 | struct input_dev *old_dev, *new_dev; | 1526 | struct input_dev *old_dev, *new_dev; |
1514 | unsigned long value; | 1527 | unsigned long value; |
1515 | int err; | 1528 | int err; |
1516 | unsigned char old_softraw; | 1529 | bool old_softraw; |
1517 | 1530 | ||
1518 | if (strict_strtoul(buf, 10, &value) || value > 1) | 1531 | if (strict_strtoul(buf, 10, &value) || value > 1) |
1519 | return -EINVAL; | 1532 | return -EINVAL; |
diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c index e45740429f7e..bd25a3af1664 100644 --- a/drivers/input/keyboard/ep93xx_keypad.c +++ b/drivers/input/keyboard/ep93xx_keypad.c | |||
@@ -69,7 +69,7 @@ struct ep93xx_keypad { | |||
69 | 69 | ||
70 | void __iomem *mmio_base; | 70 | void __iomem *mmio_base; |
71 | 71 | ||
72 | unsigned int matrix_keycodes[EP93XX_MATRIX_SIZE]; | 72 | unsigned short keycodes[EP93XX_MATRIX_SIZE]; |
73 | 73 | ||
74 | int key1; | 74 | int key1; |
75 | int key2; | 75 | int key2; |
@@ -79,24 +79,6 @@ struct ep93xx_keypad { | |||
79 | bool enabled; | 79 | bool enabled; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | static void ep93xx_keypad_build_keycode(struct ep93xx_keypad *keypad) | ||
83 | { | ||
84 | struct ep93xx_keypad_platform_data *pdata = keypad->pdata; | ||
85 | struct input_dev *input_dev = keypad->input_dev; | ||
86 | unsigned int *key; | ||
87 | int i; | ||
88 | |||
89 | key = &pdata->matrix_key_map[0]; | ||
90 | for (i = 0; i < pdata->matrix_key_map_size; i++, key++) { | ||
91 | int row = KEY_ROW(*key); | ||
92 | int col = KEY_COL(*key); | ||
93 | int code = KEY_VAL(*key); | ||
94 | |||
95 | keypad->matrix_keycodes[(row << 3) + col] = code; | ||
96 | __set_bit(code, input_dev->keybit); | ||
97 | } | ||
98 | } | ||
99 | |||
100 | static irqreturn_t ep93xx_keypad_irq_handler(int irq, void *dev_id) | 82 | static irqreturn_t ep93xx_keypad_irq_handler(int irq, void *dev_id) |
101 | { | 83 | { |
102 | struct ep93xx_keypad *keypad = dev_id; | 84 | struct ep93xx_keypad *keypad = dev_id; |
@@ -107,10 +89,10 @@ static irqreturn_t ep93xx_keypad_irq_handler(int irq, void *dev_id) | |||
107 | status = __raw_readl(keypad->mmio_base + KEY_REG); | 89 | status = __raw_readl(keypad->mmio_base + KEY_REG); |
108 | 90 | ||
109 | keycode = (status & KEY_REG_KEY1_MASK) >> KEY_REG_KEY1_SHIFT; | 91 | keycode = (status & KEY_REG_KEY1_MASK) >> KEY_REG_KEY1_SHIFT; |
110 | key1 = keypad->matrix_keycodes[keycode]; | 92 | key1 = keypad->keycodes[keycode]; |
111 | 93 | ||
112 | keycode = (status & KEY_REG_KEY2_MASK) >> KEY_REG_KEY2_SHIFT; | 94 | keycode = (status & KEY_REG_KEY2_MASK) >> KEY_REG_KEY2_SHIFT; |
113 | key2 = keypad->matrix_keycodes[keycode]; | 95 | key2 = keypad->keycodes[keycode]; |
114 | 96 | ||
115 | if (status & KEY_REG_2KEYS) { | 97 | if (status & KEY_REG_2KEYS) { |
116 | if (keypad->key1 && key1 != keypad->key1 && key2 != keypad->key1) | 98 | if (keypad->key1 && key1 != keypad->key1 && key2 != keypad->key1) |
@@ -256,6 +238,7 @@ static int ep93xx_keypad_resume(struct platform_device *pdev) | |||
256 | static int __devinit ep93xx_keypad_probe(struct platform_device *pdev) | 238 | static int __devinit ep93xx_keypad_probe(struct platform_device *pdev) |
257 | { | 239 | { |
258 | struct ep93xx_keypad *keypad; | 240 | struct ep93xx_keypad *keypad; |
241 | const struct matrix_keymap_data *keymap_data; | ||
259 | struct input_dev *input_dev; | 242 | struct input_dev *input_dev; |
260 | struct resource *res; | 243 | struct resource *res; |
261 | int err; | 244 | int err; |
@@ -270,6 +253,12 @@ static int __devinit ep93xx_keypad_probe(struct platform_device *pdev) | |||
270 | goto failed_free; | 253 | goto failed_free; |
271 | } | 254 | } |
272 | 255 | ||
256 | keymap_data = keypad->pdata->keymap_data; | ||
257 | if (!keymap_data) { | ||
258 | err = -EINVAL; | ||
259 | goto failed_free; | ||
260 | } | ||
261 | |||
273 | keypad->irq = platform_get_irq(pdev, 0); | 262 | keypad->irq = platform_get_irq(pdev, 0); |
274 | if (!keypad->irq) { | 263 | if (!keypad->irq) { |
275 | err = -ENXIO; | 264 | err = -ENXIO; |
@@ -317,9 +306,9 @@ static int __devinit ep93xx_keypad_probe(struct platform_device *pdev) | |||
317 | input_dev->open = ep93xx_keypad_open; | 306 | input_dev->open = ep93xx_keypad_open; |
318 | input_dev->close = ep93xx_keypad_close; | 307 | input_dev->close = ep93xx_keypad_close; |
319 | input_dev->dev.parent = &pdev->dev; | 308 | input_dev->dev.parent = &pdev->dev; |
320 | input_dev->keycode = keypad->matrix_keycodes; | 309 | input_dev->keycode = keypad->keycodes; |
321 | input_dev->keycodesize = sizeof(keypad->matrix_keycodes[0]); | 310 | input_dev->keycodesize = sizeof(keypad->keycodes[0]); |
322 | input_dev->keycodemax = ARRAY_SIZE(keypad->matrix_keycodes); | 311 | input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes); |
323 | 312 | ||
324 | input_set_drvdata(input_dev, keypad); | 313 | input_set_drvdata(input_dev, keypad); |
325 | 314 | ||
@@ -327,7 +316,8 @@ static int __devinit ep93xx_keypad_probe(struct platform_device *pdev) | |||
327 | if (keypad->pdata->flags & EP93XX_KEYPAD_AUTOREPEAT) | 316 | if (keypad->pdata->flags & EP93XX_KEYPAD_AUTOREPEAT) |
328 | input_dev->evbit[0] |= BIT_MASK(EV_REP); | 317 | input_dev->evbit[0] |= BIT_MASK(EV_REP); |
329 | 318 | ||
330 | ep93xx_keypad_build_keycode(keypad); | 319 | matrix_keypad_build_keymap(keymap_data, 3, |
320 | input_dev->keycode, input_dev->keybit); | ||
331 | platform_set_drvdata(pdev, keypad); | 321 | platform_set_drvdata(pdev, keypad); |
332 | 322 | ||
333 | err = request_irq(keypad->irq, ep93xx_keypad_irq_handler, | 323 | err = request_irq(keypad->irq, ep93xx_keypad_irq_handler, |
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 1aff3b76effd..2b708aa85553 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
@@ -30,13 +30,289 @@ struct gpio_button_data { | |||
30 | struct input_dev *input; | 30 | struct input_dev *input; |
31 | struct timer_list timer; | 31 | struct timer_list timer; |
32 | struct work_struct work; | 32 | struct work_struct work; |
33 | bool disabled; | ||
33 | }; | 34 | }; |
34 | 35 | ||
35 | struct gpio_keys_drvdata { | 36 | struct gpio_keys_drvdata { |
36 | struct input_dev *input; | 37 | struct input_dev *input; |
38 | struct mutex disable_lock; | ||
39 | unsigned int n_buttons; | ||
37 | struct gpio_button_data data[0]; | 40 | struct gpio_button_data data[0]; |
38 | }; | 41 | }; |
39 | 42 | ||
43 | /* | ||
44 | * SYSFS interface for enabling/disabling keys and switches: | ||
45 | * | ||
46 | * There are 4 attributes under /sys/devices/platform/gpio-keys/ | ||
47 | * keys [ro] - bitmap of keys (EV_KEY) which can be | ||
48 | * disabled | ||
49 | * switches [ro] - bitmap of switches (EV_SW) which can be | ||
50 | * disabled | ||
51 | * disabled_keys [rw] - bitmap of keys currently disabled | ||
52 | * disabled_switches [rw] - bitmap of switches currently disabled | ||
53 | * | ||
54 | * Userland can change these values and hence disable event generation | ||
55 | * for each key (or switch). Disabling a key means its interrupt line | ||
56 | * is disabled. | ||
57 | * | ||
58 | * For example, if we have following switches set up as gpio-keys: | ||
59 | * SW_DOCK = 5 | ||
60 | * SW_CAMERA_LENS_COVER = 9 | ||
61 | * SW_KEYPAD_SLIDE = 10 | ||
62 | * SW_FRONT_PROXIMITY = 11 | ||
63 | * This is read from switches: | ||
64 | * 11-9,5 | ||
65 | * Next we want to disable proximity (11) and dock (5), we write: | ||
66 | * 11,5 | ||
67 | * to file disabled_switches. Now proximity and dock IRQs are disabled. | ||
68 | * This can be verified by reading the file disabled_switches: | ||
69 | * 11,5 | ||
70 | * If we now want to enable proximity (11) switch we write: | ||
71 | * 5 | ||
72 | * to disabled_switches. | ||
73 | * | ||
74 | * We can disable only those keys which don't allow sharing the irq. | ||
75 | */ | ||
76 | |||
77 | /** | ||
78 | * get_n_events_by_type() - returns maximum number of events per @type | ||
79 | * @type: type of button (%EV_KEY, %EV_SW) | ||
80 | * | ||
81 | * Return value of this function can be used to allocate bitmap | ||
82 | * large enough to hold all bits for given type. | ||
83 | */ | ||
84 | static inline int get_n_events_by_type(int type) | ||
85 | { | ||
86 | BUG_ON(type != EV_SW && type != EV_KEY); | ||
87 | |||
88 | return (type == EV_KEY) ? KEY_CNT : SW_CNT; | ||
89 | } | ||
90 | |||
91 | /** | ||
92 | * gpio_keys_disable_button() - disables given GPIO button | ||
93 | * @bdata: button data for button to be disabled | ||
94 | * | ||
95 | * Disables button pointed by @bdata. This is done by masking | ||
96 | * IRQ line. After this function is called, button won't generate | ||
97 | * input events anymore. Note that one can only disable buttons | ||
98 | * that don't share IRQs. | ||
99 | * | ||
100 | * Make sure that @bdata->disable_lock is locked when entering | ||
101 | * this function to avoid races when concurrent threads are | ||
102 | * disabling buttons at the same time. | ||
103 | */ | ||
104 | static void gpio_keys_disable_button(struct gpio_button_data *bdata) | ||
105 | { | ||
106 | if (!bdata->disabled) { | ||
107 | /* | ||
108 | * Disable IRQ and possible debouncing timer. | ||
109 | */ | ||
110 | disable_irq(gpio_to_irq(bdata->button->gpio)); | ||
111 | if (bdata->button->debounce_interval) | ||
112 | del_timer_sync(&bdata->timer); | ||
113 | |||
114 | bdata->disabled = true; | ||
115 | } | ||
116 | } | ||
117 | |||
118 | /** | ||
119 | * gpio_keys_enable_button() - enables given GPIO button | ||
120 | * @bdata: button data for button to be disabled | ||
121 | * | ||
122 | * Enables given button pointed by @bdata. | ||
123 | * | ||
124 | * Make sure that @bdata->disable_lock is locked when entering | ||
125 | * this function to avoid races with concurrent threads trying | ||
126 | * to enable the same button at the same time. | ||
127 | */ | ||
128 | static void gpio_keys_enable_button(struct gpio_button_data *bdata) | ||
129 | { | ||
130 | if (bdata->disabled) { | ||
131 | enable_irq(gpio_to_irq(bdata->button->gpio)); | ||
132 | bdata->disabled = false; | ||
133 | } | ||
134 | } | ||
135 | |||
136 | /** | ||
137 | * gpio_keys_attr_show_helper() - fill in stringified bitmap of buttons | ||
138 | * @ddata: pointer to drvdata | ||
139 | * @buf: buffer where stringified bitmap is written | ||
140 | * @type: button type (%EV_KEY, %EV_SW) | ||
141 | * @only_disabled: does caller want only those buttons that are | ||
142 | * currently disabled or all buttons that can be | ||
143 | * disabled | ||
144 | * | ||
145 | * This function writes buttons that can be disabled to @buf. If | ||
146 | * @only_disabled is true, then @buf contains only those buttons | ||
147 | * that are currently disabled. Returns 0 on success or negative | ||
148 | * errno on failure. | ||
149 | */ | ||
150 | static ssize_t gpio_keys_attr_show_helper(struct gpio_keys_drvdata *ddata, | ||
151 | char *buf, unsigned int type, | ||
152 | bool only_disabled) | ||
153 | { | ||
154 | int n_events = get_n_events_by_type(type); | ||
155 | unsigned long *bits; | ||
156 | ssize_t ret; | ||
157 | int i; | ||
158 | |||
159 | bits = kcalloc(BITS_TO_LONGS(n_events), sizeof(*bits), GFP_KERNEL); | ||
160 | if (!bits) | ||
161 | return -ENOMEM; | ||
162 | |||
163 | for (i = 0; i < ddata->n_buttons; i++) { | ||
164 | struct gpio_button_data *bdata = &ddata->data[i]; | ||
165 | |||
166 | if (bdata->button->type != type) | ||
167 | continue; | ||
168 | |||
169 | if (only_disabled && !bdata->disabled) | ||
170 | continue; | ||
171 | |||
172 | __set_bit(bdata->button->code, bits); | ||
173 | } | ||
174 | |||
175 | ret = bitmap_scnlistprintf(buf, PAGE_SIZE - 2, bits, n_events); | ||
176 | buf[ret++] = '\n'; | ||
177 | buf[ret] = '\0'; | ||
178 | |||
179 | kfree(bits); | ||
180 | |||
181 | return ret; | ||
182 | } | ||
183 | |||
184 | /** | ||
185 | * gpio_keys_attr_store_helper() - enable/disable buttons based on given bitmap | ||
186 | * @ddata: pointer to drvdata | ||
187 | * @buf: buffer from userspace that contains stringified bitmap | ||
188 | * @type: button type (%EV_KEY, %EV_SW) | ||
189 | * | ||
190 | * This function parses stringified bitmap from @buf and disables/enables | ||
191 | * GPIO buttons accordinly. Returns 0 on success and negative error | ||
192 | * on failure. | ||
193 | */ | ||
194 | static ssize_t gpio_keys_attr_store_helper(struct gpio_keys_drvdata *ddata, | ||
195 | const char *buf, unsigned int type) | ||
196 | { | ||
197 | int n_events = get_n_events_by_type(type); | ||
198 | unsigned long *bits; | ||
199 | ssize_t error; | ||
200 | int i; | ||
201 | |||
202 | bits = kcalloc(BITS_TO_LONGS(n_events), sizeof(*bits), GFP_KERNEL); | ||
203 | if (!bits) | ||
204 | return -ENOMEM; | ||
205 | |||
206 | error = bitmap_parselist(buf, bits, n_events); | ||
207 | if (error) | ||
208 | goto out; | ||
209 | |||
210 | /* First validate */ | ||
211 | for (i = 0; i < ddata->n_buttons; i++) { | ||
212 | struct gpio_button_data *bdata = &ddata->data[i]; | ||
213 | |||
214 | if (bdata->button->type != type) | ||
215 | continue; | ||
216 | |||
217 | if (test_bit(bdata->button->code, bits) && | ||
218 | !bdata->button->can_disable) { | ||
219 | error = -EINVAL; | ||
220 | goto out; | ||
221 | } | ||
222 | } | ||
223 | |||
224 | mutex_lock(&ddata->disable_lock); | ||
225 | |||
226 | for (i = 0; i < ddata->n_buttons; i++) { | ||
227 | struct gpio_button_data *bdata = &ddata->data[i]; | ||
228 | |||
229 | if (bdata->button->type != type) | ||
230 | continue; | ||
231 | |||
232 | if (test_bit(bdata->button->code, bits)) | ||
233 | gpio_keys_disable_button(bdata); | ||
234 | else | ||
235 | gpio_keys_enable_button(bdata); | ||
236 | } | ||
237 | |||
238 | mutex_unlock(&ddata->disable_lock); | ||
239 | |||
240 | out: | ||
241 | kfree(bits); | ||
242 | return error; | ||
243 | } | ||
244 | |||
245 | #define ATTR_SHOW_FN(name, type, only_disabled) \ | ||
246 | static ssize_t gpio_keys_show_##name(struct device *dev, \ | ||
247 | struct device_attribute *attr, \ | ||
248 | char *buf) \ | ||
249 | { \ | ||
250 | struct platform_device *pdev = to_platform_device(dev); \ | ||
251 | struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev); \ | ||
252 | \ | ||
253 | return gpio_keys_attr_show_helper(ddata, buf, \ | ||
254 | type, only_disabled); \ | ||
255 | } | ||
256 | |||
257 | ATTR_SHOW_FN(keys, EV_KEY, false); | ||
258 | ATTR_SHOW_FN(switches, EV_SW, false); | ||
259 | ATTR_SHOW_FN(disabled_keys, EV_KEY, true); | ||
260 | ATTR_SHOW_FN(disabled_switches, EV_SW, true); | ||
261 | |||
262 | /* | ||
263 | * ATTRIBUTES: | ||
264 | * | ||
265 | * /sys/devices/platform/gpio-keys/keys [ro] | ||
266 | * /sys/devices/platform/gpio-keys/switches [ro] | ||
267 | */ | ||
268 | static DEVICE_ATTR(keys, S_IRUGO, gpio_keys_show_keys, NULL); | ||
269 | static DEVICE_ATTR(switches, S_IRUGO, gpio_keys_show_switches, NULL); | ||
270 | |||
271 | #define ATTR_STORE_FN(name, type) \ | ||
272 | static ssize_t gpio_keys_store_##name(struct device *dev, \ | ||
273 | struct device_attribute *attr, \ | ||
274 | const char *buf, \ | ||
275 | size_t count) \ | ||
276 | { \ | ||
277 | struct platform_device *pdev = to_platform_device(dev); \ | ||
278 | struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev); \ | ||
279 | ssize_t error; \ | ||
280 | \ | ||
281 | error = gpio_keys_attr_store_helper(ddata, buf, type); \ | ||
282 | if (error) \ | ||
283 | return error; \ | ||
284 | \ | ||
285 | return count; \ | ||
286 | } | ||
287 | |||
288 | ATTR_STORE_FN(disabled_keys, EV_KEY); | ||
289 | ATTR_STORE_FN(disabled_switches, EV_SW); | ||
290 | |||
291 | /* | ||
292 | * ATTRIBUTES: | ||
293 | * | ||
294 | * /sys/devices/platform/gpio-keys/disabled_keys [rw] | ||
295 | * /sys/devices/platform/gpio-keys/disables_switches [rw] | ||
296 | */ | ||
297 | static DEVICE_ATTR(disabled_keys, S_IWUSR | S_IRUGO, | ||
298 | gpio_keys_show_disabled_keys, | ||
299 | gpio_keys_store_disabled_keys); | ||
300 | static DEVICE_ATTR(disabled_switches, S_IWUSR | S_IRUGO, | ||
301 | gpio_keys_show_disabled_switches, | ||
302 | gpio_keys_store_disabled_switches); | ||
303 | |||
304 | static struct attribute *gpio_keys_attrs[] = { | ||
305 | &dev_attr_keys.attr, | ||
306 | &dev_attr_switches.attr, | ||
307 | &dev_attr_disabled_keys.attr, | ||
308 | &dev_attr_disabled_switches.attr, | ||
309 | NULL, | ||
310 | }; | ||
311 | |||
312 | static struct attribute_group gpio_keys_attr_group = { | ||
313 | .attrs = gpio_keys_attrs, | ||
314 | }; | ||
315 | |||
40 | static void gpio_keys_report_event(struct gpio_button_data *bdata) | 316 | static void gpio_keys_report_event(struct gpio_button_data *bdata) |
41 | { | 317 | { |
42 | struct gpio_keys_button *button = bdata->button; | 318 | struct gpio_keys_button *button = bdata->button; |
@@ -79,11 +355,13 @@ static irqreturn_t gpio_keys_isr(int irq, void *dev_id) | |||
79 | return IRQ_HANDLED; | 355 | return IRQ_HANDLED; |
80 | } | 356 | } |
81 | 357 | ||
82 | static int __devinit gpio_keys_setup_key(struct device *dev, | 358 | static int __devinit gpio_keys_setup_key(struct platform_device *pdev, |
83 | struct gpio_button_data *bdata, | 359 | struct gpio_button_data *bdata, |
84 | struct gpio_keys_button *button) | 360 | struct gpio_keys_button *button) |
85 | { | 361 | { |
86 | char *desc = button->desc ? button->desc : "gpio_keys"; | 362 | char *desc = button->desc ? button->desc : "gpio_keys"; |
363 | struct device *dev = &pdev->dev; | ||
364 | unsigned long irqflags; | ||
87 | int irq, error; | 365 | int irq, error; |
88 | 366 | ||
89 | setup_timer(&bdata->timer, gpio_keys_timer, (unsigned long)bdata); | 367 | setup_timer(&bdata->timer, gpio_keys_timer, (unsigned long)bdata); |
@@ -112,10 +390,15 @@ static int __devinit gpio_keys_setup_key(struct device *dev, | |||
112 | goto fail3; | 390 | goto fail3; |
113 | } | 391 | } |
114 | 392 | ||
115 | error = request_irq(irq, gpio_keys_isr, | 393 | irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING; |
116 | IRQF_SHARED | | 394 | /* |
117 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 395 | * If platform has specified that the button can be disabled, |
118 | desc, bdata); | 396 | * we don't want it to share the interrupt line. |
397 | */ | ||
398 | if (!button->can_disable) | ||
399 | irqflags |= IRQF_SHARED; | ||
400 | |||
401 | error = request_irq(irq, gpio_keys_isr, irqflags, desc, bdata); | ||
119 | if (error) { | 402 | if (error) { |
120 | dev_err(dev, "Unable to claim irq %d; error %d\n", | 403 | dev_err(dev, "Unable to claim irq %d; error %d\n", |
121 | irq, error); | 404 | irq, error); |
@@ -149,6 +432,10 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
149 | goto fail1; | 432 | goto fail1; |
150 | } | 433 | } |
151 | 434 | ||
435 | ddata->input = input; | ||
436 | ddata->n_buttons = pdata->nbuttons; | ||
437 | mutex_init(&ddata->disable_lock); | ||
438 | |||
152 | platform_set_drvdata(pdev, ddata); | 439 | platform_set_drvdata(pdev, ddata); |
153 | 440 | ||
154 | input->name = pdev->name; | 441 | input->name = pdev->name; |
@@ -164,8 +451,6 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
164 | if (pdata->rep) | 451 | if (pdata->rep) |
165 | __set_bit(EV_REP, input->evbit); | 452 | __set_bit(EV_REP, input->evbit); |
166 | 453 | ||
167 | ddata->input = input; | ||
168 | |||
169 | for (i = 0; i < pdata->nbuttons; i++) { | 454 | for (i = 0; i < pdata->nbuttons; i++) { |
170 | struct gpio_keys_button *button = &pdata->buttons[i]; | 455 | struct gpio_keys_button *button = &pdata->buttons[i]; |
171 | struct gpio_button_data *bdata = &ddata->data[i]; | 456 | struct gpio_button_data *bdata = &ddata->data[i]; |
@@ -174,7 +459,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
174 | bdata->input = input; | 459 | bdata->input = input; |
175 | bdata->button = button; | 460 | bdata->button = button; |
176 | 461 | ||
177 | error = gpio_keys_setup_key(dev, bdata, button); | 462 | error = gpio_keys_setup_key(pdev, bdata, button); |
178 | if (error) | 463 | if (error) |
179 | goto fail2; | 464 | goto fail2; |
180 | 465 | ||
@@ -184,13 +469,20 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
184 | input_set_capability(input, type, button->code); | 469 | input_set_capability(input, type, button->code); |
185 | } | 470 | } |
186 | 471 | ||
187 | error = input_register_device(input); | 472 | error = sysfs_create_group(&pdev->dev.kobj, &gpio_keys_attr_group); |
188 | if (error) { | 473 | if (error) { |
189 | dev_err(dev, "Unable to register input device, " | 474 | dev_err(dev, "Unable to export keys/switches, error: %d\n", |
190 | "error: %d\n", error); | 475 | error); |
191 | goto fail2; | 476 | goto fail2; |
192 | } | 477 | } |
193 | 478 | ||
479 | error = input_register_device(input); | ||
480 | if (error) { | ||
481 | dev_err(dev, "Unable to register input device, error: %d\n", | ||
482 | error); | ||
483 | goto fail3; | ||
484 | } | ||
485 | |||
194 | /* get current state of buttons */ | 486 | /* get current state of buttons */ |
195 | for (i = 0; i < pdata->nbuttons; i++) | 487 | for (i = 0; i < pdata->nbuttons; i++) |
196 | gpio_keys_report_event(&ddata->data[i]); | 488 | gpio_keys_report_event(&ddata->data[i]); |
@@ -200,6 +492,8 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
200 | 492 | ||
201 | return 0; | 493 | return 0; |
202 | 494 | ||
495 | fail3: | ||
496 | sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group); | ||
203 | fail2: | 497 | fail2: |
204 | while (--i >= 0) { | 498 | while (--i >= 0) { |
205 | free_irq(gpio_to_irq(pdata->buttons[i].gpio), &ddata->data[i]); | 499 | free_irq(gpio_to_irq(pdata->buttons[i].gpio), &ddata->data[i]); |
@@ -224,6 +518,8 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev) | |||
224 | struct input_dev *input = ddata->input; | 518 | struct input_dev *input = ddata->input; |
225 | int i; | 519 | int i; |
226 | 520 | ||
521 | sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group); | ||
522 | |||
227 | device_init_wakeup(&pdev->dev, 0); | 523 | device_init_wakeup(&pdev->dev, 0); |
228 | 524 | ||
229 | for (i = 0; i < pdata->nbuttons; i++) { | 525 | for (i = 0; i < pdata->nbuttons; i++) { |
diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c new file mode 100644 index 000000000000..2ee5b798024d --- /dev/null +++ b/drivers/input/keyboard/imx_keypad.c | |||
@@ -0,0 +1,594 @@ | |||
1 | /* | ||
2 | * Driver for the IMX keypad port. | ||
3 | * Copyright (C) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * <<Power management needs to be implemented>>. | ||
10 | */ | ||
11 | |||
12 | #include <linux/clk.h> | ||
13 | #include <linux/delay.h> | ||
14 | #include <linux/device.h> | ||
15 | #include <linux/err.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/input/matrix_keypad.h> | ||
18 | #include <linux/interrupt.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/jiffies.h> | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/module.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | #include <linux/timer.h> | ||
25 | |||
26 | /* | ||
27 | * Keypad Controller registers (halfword) | ||
28 | */ | ||
29 | #define KPCR 0x00 /* Keypad Control Register */ | ||
30 | |||
31 | #define KPSR 0x02 /* Keypad Status Register */ | ||
32 | #define KBD_STAT_KPKD (0x1 << 0) /* Key Press Interrupt Status bit (w1c) */ | ||
33 | #define KBD_STAT_KPKR (0x1 << 1) /* Key Release Interrupt Status bit (w1c) */ | ||
34 | #define KBD_STAT_KDSC (0x1 << 2) /* Key Depress Synch Chain Status bit (w1c)*/ | ||
35 | #define KBD_STAT_KRSS (0x1 << 3) /* Key Release Synch Status bit (w1c)*/ | ||
36 | #define KBD_STAT_KDIE (0x1 << 8) /* Key Depress Interrupt Enable Status bit */ | ||
37 | #define KBD_STAT_KRIE (0x1 << 9) /* Key Release Interrupt Enable */ | ||
38 | #define KBD_STAT_KPPEN (0x1 << 10) /* Keypad Clock Enable */ | ||
39 | |||
40 | #define KDDR 0x04 /* Keypad Data Direction Register */ | ||
41 | #define KPDR 0x06 /* Keypad Data Register */ | ||
42 | |||
43 | #define MAX_MATRIX_KEY_ROWS 8 | ||
44 | #define MAX_MATRIX_KEY_COLS 8 | ||
45 | #define MATRIX_ROW_SHIFT 3 | ||
46 | |||
47 | #define MAX_MATRIX_KEY_NUM (MAX_MATRIX_KEY_ROWS * MAX_MATRIX_KEY_COLS) | ||
48 | |||
49 | struct imx_keypad { | ||
50 | |||
51 | struct clk *clk; | ||
52 | struct input_dev *input_dev; | ||
53 | void __iomem *mmio_base; | ||
54 | |||
55 | int irq; | ||
56 | struct timer_list check_matrix_timer; | ||
57 | |||
58 | /* | ||
59 | * The matrix is stable only if no changes are detected after | ||
60 | * IMX_KEYPAD_SCANS_FOR_STABILITY scans | ||
61 | */ | ||
62 | #define IMX_KEYPAD_SCANS_FOR_STABILITY 3 | ||
63 | int stable_count; | ||
64 | |||
65 | bool enabled; | ||
66 | |||
67 | /* Masks for enabled rows/cols */ | ||
68 | unsigned short rows_en_mask; | ||
69 | unsigned short cols_en_mask; | ||
70 | |||
71 | unsigned short keycodes[MAX_MATRIX_KEY_NUM]; | ||
72 | |||
73 | /* | ||
74 | * Matrix states: | ||
75 | * -stable: achieved after a complete debounce process. | ||
76 | * -unstable: used in the debouncing process. | ||
77 | */ | ||
78 | unsigned short matrix_stable_state[MAX_MATRIX_KEY_COLS]; | ||
79 | unsigned short matrix_unstable_state[MAX_MATRIX_KEY_COLS]; | ||
80 | }; | ||
81 | |||
82 | /* Scan the matrix and return the new state in *matrix_volatile_state. */ | ||
83 | static void imx_keypad_scan_matrix(struct imx_keypad *keypad, | ||
84 | unsigned short *matrix_volatile_state) | ||
85 | { | ||
86 | int col; | ||
87 | unsigned short reg_val; | ||
88 | |||
89 | for (col = 0; col < MAX_MATRIX_KEY_COLS; col++) { | ||
90 | if ((keypad->cols_en_mask & (1 << col)) == 0) | ||
91 | continue; | ||
92 | /* | ||
93 | * Discharge keypad capacitance: | ||
94 | * 2. write 1s on column data. | ||
95 | * 3. configure columns as totem-pole to discharge capacitance. | ||
96 | * 4. configure columns as open-drain. | ||
97 | */ | ||
98 | reg_val = readw(keypad->mmio_base + KPDR); | ||
99 | reg_val |= 0xff00; | ||
100 | writew(reg_val, keypad->mmio_base + KPDR); | ||
101 | |||
102 | reg_val = readw(keypad->mmio_base + KPCR); | ||
103 | reg_val &= ~((keypad->cols_en_mask & 0xff) << 8); | ||
104 | writew(reg_val, keypad->mmio_base + KPCR); | ||
105 | |||
106 | udelay(2); | ||
107 | |||
108 | reg_val = readw(keypad->mmio_base + KPCR); | ||
109 | reg_val |= (keypad->cols_en_mask & 0xff) << 8; | ||
110 | writew(reg_val, keypad->mmio_base + KPCR); | ||
111 | |||
112 | /* | ||
113 | * 5. Write a single column to 0, others to 1. | ||
114 | * 6. Sample row inputs and save data. | ||
115 | * 7. Repeat steps 2 - 6 for remaining columns. | ||
116 | */ | ||
117 | reg_val = readw(keypad->mmio_base + KPDR); | ||
118 | reg_val &= ~(1 << (8 + col)); | ||
119 | writew(reg_val, keypad->mmio_base + KPDR); | ||
120 | |||
121 | /* | ||
122 | * Delay added to avoid propagating the 0 from column to row | ||
123 | * when scanning. | ||
124 | */ | ||
125 | udelay(5); | ||
126 | |||
127 | /* | ||
128 | * 1s in matrix_volatile_state[col] means key pressures | ||
129 | * throw data from non enabled rows. | ||
130 | */ | ||
131 | reg_val = readw(keypad->mmio_base + KPDR); | ||
132 | matrix_volatile_state[col] = (~reg_val) & keypad->rows_en_mask; | ||
133 | } | ||
134 | |||
135 | /* | ||
136 | * Return in standby mode: | ||
137 | * 9. write 0s to columns | ||
138 | */ | ||
139 | reg_val = readw(keypad->mmio_base + KPDR); | ||
140 | reg_val &= 0x00ff; | ||
141 | writew(reg_val, keypad->mmio_base + KPDR); | ||
142 | } | ||
143 | |||
144 | /* | ||
145 | * Compare the new matrix state (volatile) with the stable one stored in | ||
146 | * keypad->matrix_stable_state and fire events if changes are detected. | ||
147 | */ | ||
148 | static void imx_keypad_fire_events(struct imx_keypad *keypad, | ||
149 | unsigned short *matrix_volatile_state) | ||
150 | { | ||
151 | struct input_dev *input_dev = keypad->input_dev; | ||
152 | int row, col; | ||
153 | |||
154 | for (col = 0; col < MAX_MATRIX_KEY_COLS; col++) { | ||
155 | unsigned short bits_changed; | ||
156 | int code; | ||
157 | |||
158 | if ((keypad->cols_en_mask & (1 << col)) == 0) | ||
159 | continue; /* Column is not enabled */ | ||
160 | |||
161 | bits_changed = keypad->matrix_stable_state[col] ^ | ||
162 | matrix_volatile_state[col]; | ||
163 | |||
164 | if (bits_changed == 0) | ||
165 | continue; /* Column does not contain changes */ | ||
166 | |||
167 | for (row = 0; row < MAX_MATRIX_KEY_ROWS; row++) { | ||
168 | if ((keypad->rows_en_mask & (1 << row)) == 0) | ||
169 | continue; /* Row is not enabled */ | ||
170 | if ((bits_changed & (1 << row)) == 0) | ||
171 | continue; /* Row does not contain changes */ | ||
172 | |||
173 | code = MATRIX_SCAN_CODE(row, col, MATRIX_ROW_SHIFT); | ||
174 | input_event(input_dev, EV_MSC, MSC_SCAN, code); | ||
175 | input_report_key(input_dev, keypad->keycodes[code], | ||
176 | matrix_volatile_state[col] & (1 << row)); | ||
177 | dev_dbg(&input_dev->dev, "Event code: %d, val: %d", | ||
178 | keypad->keycodes[code], | ||
179 | matrix_volatile_state[col] & (1 << row)); | ||
180 | } | ||
181 | } | ||
182 | input_sync(input_dev); | ||
183 | } | ||
184 | |||
185 | /* | ||
186 | * imx_keypad_check_for_events is the timer handler. | ||
187 | */ | ||
188 | static void imx_keypad_check_for_events(unsigned long data) | ||
189 | { | ||
190 | struct imx_keypad *keypad = (struct imx_keypad *) data; | ||
191 | unsigned short matrix_volatile_state[MAX_MATRIX_KEY_COLS]; | ||
192 | unsigned short reg_val; | ||
193 | bool state_changed, is_zero_matrix; | ||
194 | int i; | ||
195 | |||
196 | memset(matrix_volatile_state, 0, sizeof(matrix_volatile_state)); | ||
197 | |||
198 | imx_keypad_scan_matrix(keypad, matrix_volatile_state); | ||
199 | |||
200 | state_changed = false; | ||
201 | for (i = 0; i < MAX_MATRIX_KEY_COLS; i++) { | ||
202 | if ((keypad->cols_en_mask & (1 << i)) == 0) | ||
203 | continue; | ||
204 | |||
205 | if (keypad->matrix_unstable_state[i] ^ matrix_volatile_state[i]) { | ||
206 | state_changed = true; | ||
207 | break; | ||
208 | } | ||
209 | } | ||
210 | |||
211 | /* | ||
212 | * If the matrix state is changed from the previous scan | ||
213 | * (Re)Begin the debouncing process, saving the new state in | ||
214 | * keypad->matrix_unstable_state. | ||
215 | * else | ||
216 | * Increase the count of number of scans with a stable state. | ||
217 | */ | ||
218 | if (state_changed) { | ||
219 | memcpy(keypad->matrix_unstable_state, matrix_volatile_state, | ||
220 | sizeof(matrix_volatile_state)); | ||
221 | keypad->stable_count = 0; | ||
222 | } else | ||
223 | keypad->stable_count++; | ||
224 | |||
225 | /* | ||
226 | * If the matrix is not as stable as we want reschedule scan | ||
227 | * in the near future. | ||
228 | */ | ||
229 | if (keypad->stable_count < IMX_KEYPAD_SCANS_FOR_STABILITY) { | ||
230 | mod_timer(&keypad->check_matrix_timer, | ||
231 | jiffies + msecs_to_jiffies(10)); | ||
232 | return; | ||
233 | } | ||
234 | |||
235 | /* | ||
236 | * If the matrix state is stable, fire the events and save the new | ||
237 | * stable state. Note, if the matrix is kept stable for longer | ||
238 | * (keypad->stable_count > IMX_KEYPAD_SCANS_FOR_STABILITY) all | ||
239 | * events have already been generated. | ||
240 | */ | ||
241 | if (keypad->stable_count == IMX_KEYPAD_SCANS_FOR_STABILITY) { | ||
242 | imx_keypad_fire_events(keypad, matrix_volatile_state); | ||
243 | |||
244 | memcpy(keypad->matrix_stable_state, matrix_volatile_state, | ||
245 | sizeof(matrix_volatile_state)); | ||
246 | } | ||
247 | |||
248 | is_zero_matrix = true; | ||
249 | for (i = 0; i < MAX_MATRIX_KEY_COLS; i++) { | ||
250 | if (matrix_volatile_state[i] != 0) { | ||
251 | is_zero_matrix = false; | ||
252 | break; | ||
253 | } | ||
254 | } | ||
255 | |||
256 | |||
257 | if (is_zero_matrix) { | ||
258 | /* | ||
259 | * All keys have been released. Enable only the KDI | ||
260 | * interrupt for future key presses (clear the KDI | ||
261 | * status bit and its sync chain before that). | ||
262 | */ | ||
263 | reg_val = readw(keypad->mmio_base + KPSR); | ||
264 | reg_val |= KBD_STAT_KPKD | KBD_STAT_KDSC; | ||
265 | writew(reg_val, keypad->mmio_base + KPSR); | ||
266 | |||
267 | reg_val = readw(keypad->mmio_base + KPSR); | ||
268 | reg_val |= KBD_STAT_KDIE; | ||
269 | reg_val &= ~KBD_STAT_KRIE; | ||
270 | writew(reg_val, keypad->mmio_base + KPSR); | ||
271 | } else { | ||
272 | /* | ||
273 | * Some keys are still pressed. Schedule a rescan in | ||
274 | * attempt to detect multiple key presses and enable | ||
275 | * the KRI interrupt to react quickly to key release | ||
276 | * event. | ||
277 | */ | ||
278 | mod_timer(&keypad->check_matrix_timer, | ||
279 | jiffies + msecs_to_jiffies(60)); | ||
280 | |||
281 | reg_val = readw(keypad->mmio_base + KPSR); | ||
282 | reg_val |= KBD_STAT_KPKR | KBD_STAT_KRSS; | ||
283 | writew(reg_val, keypad->mmio_base + KPSR); | ||
284 | |||
285 | reg_val = readw(keypad->mmio_base + KPSR); | ||
286 | reg_val |= KBD_STAT_KRIE; | ||
287 | reg_val &= ~KBD_STAT_KDIE; | ||
288 | writew(reg_val, keypad->mmio_base + KPSR); | ||
289 | } | ||
290 | } | ||
291 | |||
292 | static irqreturn_t imx_keypad_irq_handler(int irq, void *dev_id) | ||
293 | { | ||
294 | struct imx_keypad *keypad = dev_id; | ||
295 | unsigned short reg_val; | ||
296 | |||
297 | reg_val = readw(keypad->mmio_base + KPSR); | ||
298 | |||
299 | /* Disable both interrupt types */ | ||
300 | reg_val &= ~(KBD_STAT_KRIE | KBD_STAT_KDIE); | ||
301 | /* Clear interrupts status bits */ | ||
302 | reg_val |= KBD_STAT_KPKR | KBD_STAT_KPKD; | ||
303 | writew(reg_val, keypad->mmio_base + KPSR); | ||
304 | |||
305 | if (keypad->enabled) { | ||
306 | /* The matrix is supposed to be changed */ | ||
307 | keypad->stable_count = 0; | ||
308 | |||
309 | /* Schedule the scanning procedure near in the future */ | ||
310 | mod_timer(&keypad->check_matrix_timer, | ||
311 | jiffies + msecs_to_jiffies(2)); | ||
312 | } | ||
313 | |||
314 | return IRQ_HANDLED; | ||
315 | } | ||
316 | |||
317 | static void imx_keypad_config(struct imx_keypad *keypad) | ||
318 | { | ||
319 | unsigned short reg_val; | ||
320 | |||
321 | /* | ||
322 | * Include enabled rows in interrupt generation (KPCR[7:0]) | ||
323 | * Configure keypad columns as open-drain (KPCR[15:8]) | ||
324 | */ | ||
325 | reg_val = readw(keypad->mmio_base + KPCR); | ||
326 | reg_val |= keypad->rows_en_mask & 0xff; /* rows */ | ||
327 | reg_val |= (keypad->cols_en_mask & 0xff) << 8; /* cols */ | ||
328 | writew(reg_val, keypad->mmio_base + KPCR); | ||
329 | |||
330 | /* Write 0's to KPDR[15:8] (Colums) */ | ||
331 | reg_val = readw(keypad->mmio_base + KPDR); | ||
332 | reg_val &= 0x00ff; | ||
333 | writew(reg_val, keypad->mmio_base + KPDR); | ||
334 | |||
335 | /* Configure columns as output, rows as input (KDDR[15:0]) */ | ||
336 | writew(0xff00, keypad->mmio_base + KDDR); | ||
337 | |||
338 | /* | ||
339 | * Clear Key Depress and Key Release status bit. | ||
340 | * Clear both synchronizer chain. | ||
341 | */ | ||
342 | reg_val = readw(keypad->mmio_base + KPSR); | ||
343 | reg_val |= KBD_STAT_KPKR | KBD_STAT_KPKD | | ||
344 | KBD_STAT_KDSC | KBD_STAT_KRSS; | ||
345 | writew(reg_val, keypad->mmio_base + KPSR); | ||
346 | |||
347 | /* Enable KDI and disable KRI (avoid false release events). */ | ||
348 | reg_val |= KBD_STAT_KDIE; | ||
349 | reg_val &= ~KBD_STAT_KRIE; | ||
350 | writew(reg_val, keypad->mmio_base + KPSR); | ||
351 | } | ||
352 | |||
353 | static void imx_keypad_inhibit(struct imx_keypad *keypad) | ||
354 | { | ||
355 | unsigned short reg_val; | ||
356 | |||
357 | /* Inhibit KDI and KRI interrupts. */ | ||
358 | reg_val = readw(keypad->mmio_base + KPSR); | ||
359 | reg_val &= ~(KBD_STAT_KRIE | KBD_STAT_KDIE); | ||
360 | writew(reg_val, keypad->mmio_base + KPSR); | ||
361 | |||
362 | /* Colums as open drain and disable all rows */ | ||
363 | writew(0xff00, keypad->mmio_base + KPCR); | ||
364 | } | ||
365 | |||
366 | static void imx_keypad_close(struct input_dev *dev) | ||
367 | { | ||
368 | struct imx_keypad *keypad = input_get_drvdata(dev); | ||
369 | |||
370 | dev_dbg(&dev->dev, ">%s\n", __func__); | ||
371 | |||
372 | /* Mark keypad as being inactive */ | ||
373 | keypad->enabled = false; | ||
374 | synchronize_irq(keypad->irq); | ||
375 | del_timer_sync(&keypad->check_matrix_timer); | ||
376 | |||
377 | imx_keypad_inhibit(keypad); | ||
378 | |||
379 | /* Disable clock unit */ | ||
380 | clk_disable(keypad->clk); | ||
381 | } | ||
382 | |||
383 | static int imx_keypad_open(struct input_dev *dev) | ||
384 | { | ||
385 | struct imx_keypad *keypad = input_get_drvdata(dev); | ||
386 | |||
387 | dev_dbg(&dev->dev, ">%s\n", __func__); | ||
388 | |||
389 | /* We became active from now */ | ||
390 | keypad->enabled = true; | ||
391 | |||
392 | /* Enable the kpp clock */ | ||
393 | clk_enable(keypad->clk); | ||
394 | imx_keypad_config(keypad); | ||
395 | |||
396 | /* Sanity control, not all the rows must be actived now. */ | ||
397 | if ((readw(keypad->mmio_base + KPDR) & keypad->rows_en_mask) == 0) { | ||
398 | dev_err(&dev->dev, | ||
399 | "too many keys pressed, control pins initialisation\n"); | ||
400 | goto open_err; | ||
401 | } | ||
402 | |||
403 | return 0; | ||
404 | |||
405 | open_err: | ||
406 | imx_keypad_close(dev); | ||
407 | return -EIO; | ||
408 | } | ||
409 | |||
410 | static int __devinit imx_keypad_probe(struct platform_device *pdev) | ||
411 | { | ||
412 | const struct matrix_keymap_data *keymap_data = pdev->dev.platform_data; | ||
413 | struct imx_keypad *keypad; | ||
414 | struct input_dev *input_dev; | ||
415 | struct resource *res; | ||
416 | int irq, error, i; | ||
417 | |||
418 | if (keymap_data == NULL) { | ||
419 | dev_err(&pdev->dev, "no keymap defined\n"); | ||
420 | return -EINVAL; | ||
421 | } | ||
422 | |||
423 | irq = platform_get_irq(pdev, 0); | ||
424 | if (irq < 0) { | ||
425 | dev_err(&pdev->dev, "no irq defined in platform data\n"); | ||
426 | return -EINVAL; | ||
427 | } | ||
428 | |||
429 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
430 | if (res == NULL) { | ||
431 | dev_err(&pdev->dev, "no I/O memory defined in platform data\n"); | ||
432 | return -EINVAL; | ||
433 | } | ||
434 | |||
435 | res = request_mem_region(res->start, resource_size(res), pdev->name); | ||
436 | if (res == NULL) { | ||
437 | dev_err(&pdev->dev, "failed to request I/O memory\n"); | ||
438 | return -EBUSY; | ||
439 | } | ||
440 | |||
441 | input_dev = input_allocate_device(); | ||
442 | if (!input_dev) { | ||
443 | dev_err(&pdev->dev, "failed to allocate the input device\n"); | ||
444 | error = -ENOMEM; | ||
445 | goto failed_rel_mem; | ||
446 | } | ||
447 | |||
448 | keypad = kzalloc(sizeof(struct imx_keypad), GFP_KERNEL); | ||
449 | if (!keypad) { | ||
450 | dev_err(&pdev->dev, "not enough memory for driver data\n"); | ||
451 | error = -ENOMEM; | ||
452 | goto failed_free_input; | ||
453 | } | ||
454 | |||
455 | keypad->input_dev = input_dev; | ||
456 | keypad->irq = irq; | ||
457 | keypad->stable_count = 0; | ||
458 | |||
459 | setup_timer(&keypad->check_matrix_timer, | ||
460 | imx_keypad_check_for_events, (unsigned long) keypad); | ||
461 | |||
462 | keypad->mmio_base = ioremap(res->start, resource_size(res)); | ||
463 | if (keypad->mmio_base == NULL) { | ||
464 | dev_err(&pdev->dev, "failed to remap I/O memory\n"); | ||
465 | error = -ENOMEM; | ||
466 | goto failed_free_priv; | ||
467 | } | ||
468 | |||
469 | keypad->clk = clk_get(&pdev->dev, "kpp"); | ||
470 | if (IS_ERR(keypad->clk)) { | ||
471 | dev_err(&pdev->dev, "failed to get keypad clock\n"); | ||
472 | error = PTR_ERR(keypad->clk); | ||
473 | goto failed_unmap; | ||
474 | } | ||
475 | |||
476 | /* Search for rows and cols enabled */ | ||
477 | for (i = 0; i < keymap_data->keymap_size; i++) { | ||
478 | keypad->rows_en_mask |= 1 << KEY_ROW(keymap_data->keymap[i]); | ||
479 | keypad->cols_en_mask |= 1 << KEY_COL(keymap_data->keymap[i]); | ||
480 | } | ||
481 | |||
482 | if (keypad->rows_en_mask > ((1 << MAX_MATRIX_KEY_ROWS) - 1) || | ||
483 | keypad->cols_en_mask > ((1 << MAX_MATRIX_KEY_COLS) - 1)) { | ||
484 | dev_err(&pdev->dev, | ||
485 | "invalid key data (too many rows or colums)\n"); | ||
486 | error = -EINVAL; | ||
487 | goto failed_clock_put; | ||
488 | } | ||
489 | dev_dbg(&pdev->dev, "enabled rows mask: %x\n", keypad->rows_en_mask); | ||
490 | dev_dbg(&pdev->dev, "enabled cols mask: %x\n", keypad->cols_en_mask); | ||
491 | |||
492 | /* Init the Input device */ | ||
493 | input_dev->name = pdev->name; | ||
494 | input_dev->id.bustype = BUS_HOST; | ||
495 | input_dev->dev.parent = &pdev->dev; | ||
496 | input_dev->open = imx_keypad_open; | ||
497 | input_dev->close = imx_keypad_close; | ||
498 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); | ||
499 | input_dev->keycode = keypad->keycodes; | ||
500 | input_dev->keycodesize = sizeof(keypad->keycodes[0]); | ||
501 | input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes); | ||
502 | |||
503 | matrix_keypad_build_keymap(keymap_data, MATRIX_ROW_SHIFT, | ||
504 | keypad->keycodes, input_dev->keybit); | ||
505 | |||
506 | input_set_capability(input_dev, EV_MSC, MSC_SCAN); | ||
507 | input_set_drvdata(input_dev, keypad); | ||
508 | |||
509 | /* Ensure that the keypad will stay dormant until opened */ | ||
510 | imx_keypad_inhibit(keypad); | ||
511 | |||
512 | error = request_irq(irq, imx_keypad_irq_handler, IRQF_DISABLED, | ||
513 | pdev->name, keypad); | ||
514 | if (error) { | ||
515 | dev_err(&pdev->dev, "failed to request IRQ\n"); | ||
516 | goto failed_clock_put; | ||
517 | } | ||
518 | |||
519 | /* Register the input device */ | ||
520 | error = input_register_device(input_dev); | ||
521 | if (error) { | ||
522 | dev_err(&pdev->dev, "failed to register input device\n"); | ||
523 | goto failed_free_irq; | ||
524 | } | ||
525 | |||
526 | platform_set_drvdata(pdev, keypad); | ||
527 | device_init_wakeup(&pdev->dev, 1); | ||
528 | |||
529 | return 0; | ||
530 | |||
531 | failed_free_irq: | ||
532 | free_irq(irq, pdev); | ||
533 | failed_clock_put: | ||
534 | clk_put(keypad->clk); | ||
535 | failed_unmap: | ||
536 | iounmap(keypad->mmio_base); | ||
537 | failed_free_priv: | ||
538 | kfree(keypad); | ||
539 | failed_free_input: | ||
540 | input_free_device(input_dev); | ||
541 | failed_rel_mem: | ||
542 | release_mem_region(res->start, resource_size(res)); | ||
543 | return error; | ||
544 | } | ||
545 | |||
546 | static int __devexit imx_keypad_remove(struct platform_device *pdev) | ||
547 | { | ||
548 | struct imx_keypad *keypad = platform_get_drvdata(pdev); | ||
549 | struct resource *res; | ||
550 | |||
551 | dev_dbg(&pdev->dev, ">%s\n", __func__); | ||
552 | |||
553 | platform_set_drvdata(pdev, NULL); | ||
554 | |||
555 | input_unregister_device(keypad->input_dev); | ||
556 | |||
557 | free_irq(keypad->irq, keypad); | ||
558 | clk_put(keypad->clk); | ||
559 | |||
560 | iounmap(keypad->mmio_base); | ||
561 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
562 | release_mem_region(res->start, resource_size(res)); | ||
563 | |||
564 | kfree(keypad); | ||
565 | |||
566 | return 0; | ||
567 | } | ||
568 | |||
569 | static struct platform_driver imx_keypad_driver = { | ||
570 | .driver = { | ||
571 | .name = "imx-keypad", | ||
572 | .owner = THIS_MODULE, | ||
573 | }, | ||
574 | .probe = imx_keypad_probe, | ||
575 | .remove = __devexit_p(imx_keypad_remove), | ||
576 | }; | ||
577 | |||
578 | static int __init imx_keypad_init(void) | ||
579 | { | ||
580 | return platform_driver_register(&imx_keypad_driver); | ||
581 | } | ||
582 | |||
583 | static void __exit imx_keypad_exit(void) | ||
584 | { | ||
585 | platform_driver_unregister(&imx_keypad_driver); | ||
586 | } | ||
587 | |||
588 | module_init(imx_keypad_init); | ||
589 | module_exit(imx_keypad_exit); | ||
590 | |||
591 | MODULE_AUTHOR("Alberto Panizzo <maramaopercheseimorto@gmail.com>"); | ||
592 | MODULE_DESCRIPTION("IMX Keypad Port Driver"); | ||
593 | MODULE_LICENSE("GPL v2"); | ||
594 | MODULE_ALIAS("platform:imx-keypad"); | ||
diff --git a/drivers/input/keyboard/qt2160.c b/drivers/input/keyboard/qt2160.c index 191cc51d6cf8..31f30087b591 100644 --- a/drivers/input/keyboard/qt2160.c +++ b/drivers/input/keyboard/qt2160.c | |||
@@ -362,7 +362,7 @@ static int __devexit qt2160_remove(struct i2c_client *client) | |||
362 | return 0; | 362 | return 0; |
363 | } | 363 | } |
364 | 364 | ||
365 | static struct i2c_device_id qt2160_idtable[] = { | 365 | static const struct i2c_device_id qt2160_idtable[] = { |
366 | { "qt2160", 0, }, | 366 | { "qt2160", 0, }, |
367 | { } | 367 | { } |
368 | }; | 368 | }; |
diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c index 8e9380bfed40..854e2035cd6e 100644 --- a/drivers/input/keyboard/sh_keysc.c +++ b/drivers/input/keyboard/sh_keysc.c | |||
@@ -19,101 +19,141 @@ | |||
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/input.h> | 20 | #include <linux/input.h> |
21 | #include <linux/input/sh_keysc.h> | 21 | #include <linux/input/sh_keysc.h> |
22 | #include <linux/bitmap.h> | ||
22 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
23 | #include <linux/io.h> | 24 | #include <linux/io.h> |
24 | 25 | ||
25 | #define KYCR1_OFFS 0x00 | ||
26 | #define KYCR2_OFFS 0x04 | ||
27 | #define KYINDR_OFFS 0x08 | ||
28 | #define KYOUTDR_OFFS 0x0c | ||
29 | |||
30 | #define KYCR2_IRQ_LEVEL 0x10 | ||
31 | #define KYCR2_IRQ_DISABLED 0x00 | ||
32 | |||
33 | static const struct { | 26 | static const struct { |
34 | unsigned char kymd, keyout, keyin; | 27 | unsigned char kymd, keyout, keyin; |
35 | } sh_keysc_mode[] = { | 28 | } sh_keysc_mode[] = { |
36 | [SH_KEYSC_MODE_1] = { 0, 6, 5 }, | 29 | [SH_KEYSC_MODE_1] = { 0, 6, 5 }, |
37 | [SH_KEYSC_MODE_2] = { 1, 5, 6 }, | 30 | [SH_KEYSC_MODE_2] = { 1, 5, 6 }, |
38 | [SH_KEYSC_MODE_3] = { 2, 4, 7 }, | 31 | [SH_KEYSC_MODE_3] = { 2, 4, 7 }, |
32 | [SH_KEYSC_MODE_4] = { 3, 6, 6 }, | ||
33 | [SH_KEYSC_MODE_5] = { 4, 6, 7 }, | ||
34 | [SH_KEYSC_MODE_6] = { 5, 7, 7 }, | ||
39 | }; | 35 | }; |
40 | 36 | ||
41 | struct sh_keysc_priv { | 37 | struct sh_keysc_priv { |
42 | void __iomem *iomem_base; | 38 | void __iomem *iomem_base; |
43 | struct clk *clk; | 39 | struct clk *clk; |
44 | unsigned long last_keys; | 40 | DECLARE_BITMAP(last_keys, SH_KEYSC_MAXKEYS); |
45 | struct input_dev *input; | 41 | struct input_dev *input; |
46 | struct sh_keysc_info pdata; | 42 | struct sh_keysc_info pdata; |
47 | }; | 43 | }; |
48 | 44 | ||
45 | #define KYCR1 0 | ||
46 | #define KYCR2 1 | ||
47 | #define KYINDR 2 | ||
48 | #define KYOUTDR 3 | ||
49 | |||
50 | #define KYCR2_IRQ_LEVEL 0x10 | ||
51 | #define KYCR2_IRQ_DISABLED 0x00 | ||
52 | |||
53 | static unsigned long sh_keysc_read(struct sh_keysc_priv *p, int reg_nr) | ||
54 | { | ||
55 | return ioread16(p->iomem_base + (reg_nr << 2)); | ||
56 | } | ||
57 | |||
58 | static void sh_keysc_write(struct sh_keysc_priv *p, int reg_nr, | ||
59 | unsigned long value) | ||
60 | { | ||
61 | iowrite16(value, p->iomem_base + (reg_nr << 2)); | ||
62 | } | ||
63 | |||
64 | static void sh_keysc_level_mode(struct sh_keysc_priv *p, | ||
65 | unsigned long keys_set) | ||
66 | { | ||
67 | struct sh_keysc_info *pdata = &p->pdata; | ||
68 | |||
69 | sh_keysc_write(p, KYOUTDR, 0); | ||
70 | sh_keysc_write(p, KYCR2, KYCR2_IRQ_LEVEL | (keys_set << 8)); | ||
71 | |||
72 | if (pdata->kycr2_delay) | ||
73 | udelay(pdata->kycr2_delay); | ||
74 | } | ||
75 | |||
76 | static void sh_keysc_map_dbg(struct device *dev, unsigned long *map, | ||
77 | const char *str) | ||
78 | { | ||
79 | int k; | ||
80 | |||
81 | for (k = 0; k < BITS_TO_LONGS(SH_KEYSC_MAXKEYS); k++) | ||
82 | dev_dbg(dev, "%s[%d] 0x%lx\n", str, k, map[k]); | ||
83 | } | ||
84 | |||
49 | static irqreturn_t sh_keysc_isr(int irq, void *dev_id) | 85 | static irqreturn_t sh_keysc_isr(int irq, void *dev_id) |
50 | { | 86 | { |
51 | struct platform_device *pdev = dev_id; | 87 | struct platform_device *pdev = dev_id; |
52 | struct sh_keysc_priv *priv = platform_get_drvdata(pdev); | 88 | struct sh_keysc_priv *priv = platform_get_drvdata(pdev); |
53 | struct sh_keysc_info *pdata = &priv->pdata; | 89 | struct sh_keysc_info *pdata = &priv->pdata; |
54 | unsigned long keys, keys1, keys0, mask; | 90 | int keyout_nr = sh_keysc_mode[pdata->mode].keyout; |
91 | int keyin_nr = sh_keysc_mode[pdata->mode].keyin; | ||
92 | DECLARE_BITMAP(keys, SH_KEYSC_MAXKEYS); | ||
93 | DECLARE_BITMAP(keys0, SH_KEYSC_MAXKEYS); | ||
94 | DECLARE_BITMAP(keys1, SH_KEYSC_MAXKEYS); | ||
55 | unsigned char keyin_set, tmp; | 95 | unsigned char keyin_set, tmp; |
56 | int i, k; | 96 | int i, k, n; |
57 | 97 | ||
58 | dev_dbg(&pdev->dev, "isr!\n"); | 98 | dev_dbg(&pdev->dev, "isr!\n"); |
59 | 99 | ||
60 | keys1 = ~0; | 100 | bitmap_fill(keys1, SH_KEYSC_MAXKEYS); |
61 | keys0 = 0; | 101 | bitmap_zero(keys0, SH_KEYSC_MAXKEYS); |
62 | 102 | ||
63 | do { | 103 | do { |
64 | keys = 0; | 104 | bitmap_zero(keys, SH_KEYSC_MAXKEYS); |
65 | keyin_set = 0; | 105 | keyin_set = 0; |
66 | 106 | ||
67 | iowrite16(KYCR2_IRQ_DISABLED, priv->iomem_base + KYCR2_OFFS); | 107 | sh_keysc_write(priv, KYCR2, KYCR2_IRQ_DISABLED); |
108 | |||
109 | for (i = 0; i < keyout_nr; i++) { | ||
110 | n = keyin_nr * i; | ||
68 | 111 | ||
69 | for (i = 0; i < sh_keysc_mode[pdata->mode].keyout; i++) { | 112 | /* drive one KEYOUT pin low, read KEYIN pins */ |
70 | iowrite16(0xfff ^ (3 << (i * 2)), | 113 | sh_keysc_write(priv, KYOUTDR, 0xffff ^ (3 << (i * 2))); |
71 | priv->iomem_base + KYOUTDR_OFFS); | ||
72 | udelay(pdata->delay); | 114 | udelay(pdata->delay); |
73 | tmp = ioread16(priv->iomem_base + KYINDR_OFFS); | 115 | tmp = sh_keysc_read(priv, KYINDR); |
74 | keys |= tmp << (sh_keysc_mode[pdata->mode].keyin * i); | ||
75 | tmp ^= (1 << sh_keysc_mode[pdata->mode].keyin) - 1; | ||
76 | keyin_set |= tmp; | ||
77 | } | ||
78 | 116 | ||
79 | iowrite16(0, priv->iomem_base + KYOUTDR_OFFS); | 117 | /* set bit if key press has been detected */ |
80 | iowrite16(KYCR2_IRQ_LEVEL | (keyin_set << 8), | 118 | for (k = 0; k < keyin_nr; k++) { |
81 | priv->iomem_base + KYCR2_OFFS); | 119 | if (tmp & (1 << k)) |
120 | __set_bit(n + k, keys); | ||
121 | } | ||
82 | 122 | ||
83 | if (pdata->kycr2_delay) | 123 | /* keep track of which KEYIN bits that have been set */ |
84 | udelay(pdata->kycr2_delay); | 124 | keyin_set |= tmp ^ ((1 << keyin_nr) - 1); |
125 | } | ||
85 | 126 | ||
86 | keys ^= ~0; | 127 | sh_keysc_level_mode(priv, keyin_set); |
87 | keys &= (1 << (sh_keysc_mode[pdata->mode].keyin * | ||
88 | sh_keysc_mode[pdata->mode].keyout)) - 1; | ||
89 | keys1 &= keys; | ||
90 | keys0 |= keys; | ||
91 | 128 | ||
92 | dev_dbg(&pdev->dev, "keys 0x%08lx\n", keys); | 129 | bitmap_complement(keys, keys, SH_KEYSC_MAXKEYS); |
130 | bitmap_and(keys1, keys1, keys, SH_KEYSC_MAXKEYS); | ||
131 | bitmap_or(keys0, keys0, keys, SH_KEYSC_MAXKEYS); | ||
93 | 132 | ||
94 | } while (ioread16(priv->iomem_base + KYCR2_OFFS) & 0x01); | 133 | sh_keysc_map_dbg(&pdev->dev, keys, "keys"); |
95 | 134 | ||
96 | dev_dbg(&pdev->dev, "last_keys 0x%08lx keys0 0x%08lx keys1 0x%08lx\n", | 135 | } while (sh_keysc_read(priv, KYCR2) & 0x01); |
97 | priv->last_keys, keys0, keys1); | 136 | |
137 | sh_keysc_map_dbg(&pdev->dev, priv->last_keys, "last_keys"); | ||
138 | sh_keysc_map_dbg(&pdev->dev, keys0, "keys0"); | ||
139 | sh_keysc_map_dbg(&pdev->dev, keys1, "keys1"); | ||
98 | 140 | ||
99 | for (i = 0; i < SH_KEYSC_MAXKEYS; i++) { | 141 | for (i = 0; i < SH_KEYSC_MAXKEYS; i++) { |
100 | k = pdata->keycodes[i]; | 142 | k = pdata->keycodes[i]; |
101 | if (!k) | 143 | if (!k) |
102 | continue; | 144 | continue; |
103 | 145 | ||
104 | mask = 1 << i; | 146 | if (test_bit(i, keys0) == test_bit(i, priv->last_keys)) |
105 | |||
106 | if (!((priv->last_keys ^ keys0) & mask)) | ||
107 | continue; | 147 | continue; |
108 | 148 | ||
109 | if ((keys1 | keys0) & mask) { | 149 | if (test_bit(i, keys1) || test_bit(i, keys0)) { |
110 | input_event(priv->input, EV_KEY, k, 1); | 150 | input_event(priv->input, EV_KEY, k, 1); |
111 | priv->last_keys |= mask; | 151 | __set_bit(i, priv->last_keys); |
112 | } | 152 | } |
113 | 153 | ||
114 | if (!(keys1 & mask)) { | 154 | if (!test_bit(i, keys1)) { |
115 | input_event(priv->input, EV_KEY, k, 0); | 155 | input_event(priv->input, EV_KEY, k, 0); |
116 | priv->last_keys &= ~mask; | 156 | __clear_bit(i, priv->last_keys); |
117 | } | 157 | } |
118 | 158 | ||
119 | } | 159 | } |
@@ -122,8 +162,6 @@ static irqreturn_t sh_keysc_isr(int irq, void *dev_id) | |||
122 | return IRQ_HANDLED; | 162 | return IRQ_HANDLED; |
123 | } | 163 | } |
124 | 164 | ||
125 | #define res_size(res) ((res)->end - (res)->start + 1) | ||
126 | |||
127 | static int __devinit sh_keysc_probe(struct platform_device *pdev) | 165 | static int __devinit sh_keysc_probe(struct platform_device *pdev) |
128 | { | 166 | { |
129 | struct sh_keysc_priv *priv; | 167 | struct sh_keysc_priv *priv; |
@@ -164,7 +202,7 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev) | |||
164 | memcpy(&priv->pdata, pdev->dev.platform_data, sizeof(priv->pdata)); | 202 | memcpy(&priv->pdata, pdev->dev.platform_data, sizeof(priv->pdata)); |
165 | pdata = &priv->pdata; | 203 | pdata = &priv->pdata; |
166 | 204 | ||
167 | priv->iomem_base = ioremap_nocache(res->start, res_size(res)); | 205 | priv->iomem_base = ioremap_nocache(res->start, resource_size(res)); |
168 | if (priv->iomem_base == NULL) { | 206 | if (priv->iomem_base == NULL) { |
169 | dev_err(&pdev->dev, "failed to remap I/O memory\n"); | 207 | dev_err(&pdev->dev, "failed to remap I/O memory\n"); |
170 | error = -ENXIO; | 208 | error = -ENXIO; |
@@ -220,10 +258,9 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev) | |||
220 | 258 | ||
221 | clk_enable(priv->clk); | 259 | clk_enable(priv->clk); |
222 | 260 | ||
223 | iowrite16((sh_keysc_mode[pdata->mode].kymd << 8) | | 261 | sh_keysc_write(priv, KYCR1, (sh_keysc_mode[pdata->mode].kymd << 8) | |
224 | pdata->scan_timing, priv->iomem_base + KYCR1_OFFS); | 262 | pdata->scan_timing); |
225 | iowrite16(0, priv->iomem_base + KYOUTDR_OFFS); | 263 | sh_keysc_level_mode(priv, 0); |
226 | iowrite16(KYCR2_IRQ_LEVEL, priv->iomem_base + KYCR2_OFFS); | ||
227 | 264 | ||
228 | device_init_wakeup(&pdev->dev, 1); | 265 | device_init_wakeup(&pdev->dev, 1); |
229 | 266 | ||
@@ -248,7 +285,7 @@ static int __devexit sh_keysc_remove(struct platform_device *pdev) | |||
248 | { | 285 | { |
249 | struct sh_keysc_priv *priv = platform_get_drvdata(pdev); | 286 | struct sh_keysc_priv *priv = platform_get_drvdata(pdev); |
250 | 287 | ||
251 | iowrite16(KYCR2_IRQ_DISABLED, priv->iomem_base + KYCR2_OFFS); | 288 | sh_keysc_write(priv, KYCR2, KYCR2_IRQ_DISABLED); |
252 | 289 | ||
253 | input_unregister_device(priv->input); | 290 | input_unregister_device(priv->input); |
254 | free_irq(platform_get_irq(pdev, 0), pdev); | 291 | free_irq(platform_get_irq(pdev, 0), pdev); |
@@ -270,7 +307,7 @@ static int sh_keysc_suspend(struct device *dev) | |||
270 | int irq = platform_get_irq(pdev, 0); | 307 | int irq = platform_get_irq(pdev, 0); |
271 | unsigned short value; | 308 | unsigned short value; |
272 | 309 | ||
273 | value = ioread16(priv->iomem_base + KYCR1_OFFS); | 310 | value = sh_keysc_read(priv, KYCR1); |
274 | 311 | ||
275 | if (device_may_wakeup(dev)) { | 312 | if (device_may_wakeup(dev)) { |
276 | value |= 0x80; | 313 | value |= 0x80; |
@@ -279,7 +316,7 @@ static int sh_keysc_suspend(struct device *dev) | |||
279 | value &= ~0x80; | 316 | value &= ~0x80; |
280 | } | 317 | } |
281 | 318 | ||
282 | iowrite16(value, priv->iomem_base + KYCR1_OFFS); | 319 | sh_keysc_write(priv, KYCR1, value); |
283 | 320 | ||
284 | return 0; | 321 | return 0; |
285 | } | 322 | } |
diff --git a/drivers/input/misc/apanel.c b/drivers/input/misc/apanel.c index 71b82434264d..a8d2b8db4e35 100644 --- a/drivers/input/misc/apanel.c +++ b/drivers/input/misc/apanel.c | |||
@@ -149,7 +149,7 @@ static void apanel_shutdown(struct i2c_client *client) | |||
149 | apanel_remove(client); | 149 | apanel_remove(client); |
150 | } | 150 | } |
151 | 151 | ||
152 | static struct i2c_device_id apanel_id[] = { | 152 | static const struct i2c_device_id apanel_id[] = { |
153 | { "fujitsu_apanel", 0 }, | 153 | { "fujitsu_apanel", 0 }, |
154 | { } | 154 | { } |
155 | }; | 155 | }; |
diff --git a/drivers/input/misc/atlas_btns.c b/drivers/input/misc/atlas_btns.c index 1b871917340a..dfaa9a045ed8 100644 --- a/drivers/input/misc/atlas_btns.c +++ b/drivers/input/misc/atlas_btns.c | |||
@@ -47,7 +47,7 @@ static acpi_status acpi_atlas_button_setup(acpi_handle region_handle, | |||
47 | 47 | ||
48 | static acpi_status acpi_atlas_button_handler(u32 function, | 48 | static acpi_status acpi_atlas_button_handler(u32 function, |
49 | acpi_physical_address address, | 49 | acpi_physical_address address, |
50 | u32 bit_width, acpi_integer *value, | 50 | u32 bit_width, u64 *value, |
51 | void *handler_context, void *region_context) | 51 | void *handler_context, void *region_context) |
52 | { | 52 | { |
53 | acpi_status status; | 53 | acpi_status status; |
diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c index 3b9f588fc747..4ae07935985e 100644 --- a/drivers/input/misc/rotary_encoder.c +++ b/drivers/input/misc/rotary_encoder.c | |||
@@ -152,6 +152,13 @@ static int __devinit rotary_encoder_probe(struct platform_device *pdev) | |||
152 | goto exit_unregister_input; | 152 | goto exit_unregister_input; |
153 | } | 153 | } |
154 | 154 | ||
155 | err = gpio_direction_input(pdata->gpio_a); | ||
156 | if (err) { | ||
157 | dev_err(&pdev->dev, "unable to set GPIO %d for input\n", | ||
158 | pdata->gpio_a); | ||
159 | goto exit_unregister_input; | ||
160 | } | ||
161 | |||
155 | err = gpio_request(pdata->gpio_b, DRV_NAME); | 162 | err = gpio_request(pdata->gpio_b, DRV_NAME); |
156 | if (err) { | 163 | if (err) { |
157 | dev_err(&pdev->dev, "unable to request GPIO %d\n", | 164 | dev_err(&pdev->dev, "unable to request GPIO %d\n", |
@@ -159,6 +166,13 @@ static int __devinit rotary_encoder_probe(struct platform_device *pdev) | |||
159 | goto exit_free_gpio_a; | 166 | goto exit_free_gpio_a; |
160 | } | 167 | } |
161 | 168 | ||
169 | err = gpio_direction_input(pdata->gpio_b); | ||
170 | if (err) { | ||
171 | dev_err(&pdev->dev, "unable to set GPIO %d for input\n", | ||
172 | pdata->gpio_b); | ||
173 | goto exit_free_gpio_a; | ||
174 | } | ||
175 | |||
162 | /* request the IRQs */ | 176 | /* request the IRQs */ |
163 | err = request_irq(encoder->irq_a, &rotary_encoder_irq, | 177 | err = request_irq(encoder->irq_a, &rotary_encoder_irq, |
164 | IORESOURCE_IRQ_HIGHEDGE | IORESOURCE_IRQ_LOWEDGE, | 178 | IORESOURCE_IRQ_HIGHEDGE | IORESOURCE_IRQ_LOWEDGE, |
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index d3f57245420a..1477466076ad 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/smp_lock.h> | ||
38 | #include <linux/fs.h> | 37 | #include <linux/fs.h> |
39 | #include <linux/miscdevice.h> | 38 | #include <linux/miscdevice.h> |
40 | #include <linux/uinput.h> | 39 | #include <linux/uinput.h> |
@@ -284,7 +283,6 @@ static int uinput_open(struct inode *inode, struct file *file) | |||
284 | if (!newdev) | 283 | if (!newdev) |
285 | return -ENOMEM; | 284 | return -ENOMEM; |
286 | 285 | ||
287 | lock_kernel(); | ||
288 | mutex_init(&newdev->mutex); | 286 | mutex_init(&newdev->mutex); |
289 | spin_lock_init(&newdev->requests_lock); | 287 | spin_lock_init(&newdev->requests_lock); |
290 | init_waitqueue_head(&newdev->requests_waitq); | 288 | init_waitqueue_head(&newdev->requests_waitq); |
@@ -292,7 +290,7 @@ static int uinput_open(struct inode *inode, struct file *file) | |||
292 | newdev->state = UIST_NEW_DEVICE; | 290 | newdev->state = UIST_NEW_DEVICE; |
293 | 291 | ||
294 | file->private_data = newdev; | 292 | file->private_data = newdev; |
295 | unlock_kernel(); | 293 | nonseekable_open(inode, file); |
296 | 294 | ||
297 | return 0; | 295 | return 0; |
298 | } | 296 | } |
diff --git a/drivers/input/misc/winbond-cir.c b/drivers/input/misc/winbond-cir.c index c8f5a9a3fa14..cbec3dfdd42b 100644 --- a/drivers/input/misc/winbond-cir.c +++ b/drivers/input/misc/winbond-cir.c | |||
@@ -538,6 +538,7 @@ wbcir_reset_irdata(struct wbcir_data *data) | |||
538 | data->irdata_count = 0; | 538 | data->irdata_count = 0; |
539 | data->irdata_off = 0; | 539 | data->irdata_off = 0; |
540 | data->irdata_error = 0; | 540 | data->irdata_error = 0; |
541 | data->idle_count = 0; | ||
541 | } | 542 | } |
542 | 543 | ||
543 | /* Adds one bit of irdata */ | 544 | /* Adds one bit of irdata */ |
@@ -1006,7 +1007,6 @@ wbcir_irq_handler(int irqno, void *cookie) | |||
1006 | } | 1007 | } |
1007 | 1008 | ||
1008 | wbcir_reset_irdata(data); | 1009 | wbcir_reset_irdata(data); |
1009 | data->idle_count = 0; | ||
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | out: | 1012 | out: |
@@ -1018,7 +1018,7 @@ out: | |||
1018 | 1018 | ||
1019 | /***************************************************************************** | 1019 | /***************************************************************************** |
1020 | * | 1020 | * |
1021 | * SUSPEND/RESUME FUNCTIONS | 1021 | * SETUP/INIT/SUSPEND/RESUME FUNCTIONS |
1022 | * | 1022 | * |
1023 | *****************************************************************************/ | 1023 | *****************************************************************************/ |
1024 | 1024 | ||
@@ -1197,7 +1197,16 @@ finish: | |||
1197 | } | 1197 | } |
1198 | 1198 | ||
1199 | /* Disable interrupts */ | 1199 | /* Disable interrupts */ |
1200 | wbcir_select_bank(data, WBCIR_BANK_0); | ||
1200 | outb(WBCIR_IRQ_NONE, data->sbase + WBCIR_REG_SP3_IER); | 1201 | outb(WBCIR_IRQ_NONE, data->sbase + WBCIR_REG_SP3_IER); |
1202 | |||
1203 | /* | ||
1204 | * ACPI will set the HW disable bit for SP3 which means that the | ||
1205 | * output signals are left in an undefined state which may cause | ||
1206 | * spurious interrupts which we need to ignore until the hardware | ||
1207 | * is reinitialized. | ||
1208 | */ | ||
1209 | disable_irq(data->irq); | ||
1201 | } | 1210 | } |
1202 | 1211 | ||
1203 | static int | 1212 | static int |
@@ -1207,37 +1216,15 @@ wbcir_suspend(struct pnp_dev *device, pm_message_t state) | |||
1207 | return 0; | 1216 | return 0; |
1208 | } | 1217 | } |
1209 | 1218 | ||
1210 | static int | ||
1211 | wbcir_resume(struct pnp_dev *device) | ||
1212 | { | ||
1213 | struct wbcir_data *data = pnp_get_drvdata(device); | ||
1214 | |||
1215 | /* Clear BUFF_EN, Clear END_EN, Clear MATCH_EN */ | ||
1216 | wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_EV_EN, 0x00, 0x07); | ||
1217 | |||
1218 | /* Clear CEIR_EN */ | ||
1219 | wbcir_set_bits(data->wbase + WBCIR_REG_WCEIR_CTL, 0x00, 0x01); | ||
1220 | |||
1221 | /* Enable interrupts */ | ||
1222 | wbcir_reset_irdata(data); | ||
1223 | outb(WBCIR_IRQ_RX | WBCIR_IRQ_ERR, data->sbase + WBCIR_REG_SP3_IER); | ||
1224 | |||
1225 | return 0; | ||
1226 | } | ||
1227 | |||
1228 | |||
1229 | |||
1230 | /***************************************************************************** | ||
1231 | * | ||
1232 | * SETUP/INIT FUNCTIONS | ||
1233 | * | ||
1234 | *****************************************************************************/ | ||
1235 | |||
1236 | static void | 1219 | static void |
1237 | wbcir_cfg_ceir(struct wbcir_data *data) | 1220 | wbcir_init_hw(struct wbcir_data *data) |
1238 | { | 1221 | { |
1239 | u8 tmp; | 1222 | u8 tmp; |
1240 | 1223 | ||
1224 | /* Disable interrupts */ | ||
1225 | wbcir_select_bank(data, WBCIR_BANK_0); | ||
1226 | outb(WBCIR_IRQ_NONE, data->sbase + WBCIR_REG_SP3_IER); | ||
1227 | |||
1241 | /* Set PROT_SEL, RX_INV, Clear CEIR_EN (needed for the led) */ | 1228 | /* Set PROT_SEL, RX_INV, Clear CEIR_EN (needed for the led) */ |
1242 | tmp = protocol << 4; | 1229 | tmp = protocol << 4; |
1243 | if (invert) | 1230 | if (invert) |
@@ -1264,6 +1251,93 @@ wbcir_cfg_ceir(struct wbcir_data *data) | |||
1264 | * set SP3_IRRX_SW to binary 01, helpfully not documented | 1251 | * set SP3_IRRX_SW to binary 01, helpfully not documented |
1265 | */ | 1252 | */ |
1266 | outb(0x10, data->ebase + WBCIR_REG_ECEIR_CTS); | 1253 | outb(0x10, data->ebase + WBCIR_REG_ECEIR_CTS); |
1254 | |||
1255 | /* Enable extended mode */ | ||
1256 | wbcir_select_bank(data, WBCIR_BANK_2); | ||
1257 | outb(WBCIR_EXT_ENABLE, data->sbase + WBCIR_REG_SP3_EXCR1); | ||
1258 | |||
1259 | /* | ||
1260 | * Configure baud generator, IR data will be sampled at | ||
1261 | * a bitrate of: (24Mhz * prescaler) / (divisor * 16). | ||
1262 | * | ||
1263 | * The ECIR registers include a flag to change the | ||
1264 | * 24Mhz clock freq to 48Mhz. | ||
1265 | * | ||
1266 | * It's not documented in the specs, but fifo levels | ||
1267 | * other than 16 seems to be unsupported. | ||
1268 | */ | ||
1269 | |||
1270 | /* prescaler 1.0, tx/rx fifo lvl 16 */ | ||
1271 | outb(0x30, data->sbase + WBCIR_REG_SP3_EXCR2); | ||
1272 | |||
1273 | /* Set baud divisor to generate one byte per bit/cell */ | ||
1274 | switch (protocol) { | ||
1275 | case IR_PROTOCOL_RC5: | ||
1276 | outb(0xA7, data->sbase + WBCIR_REG_SP3_BGDL); | ||
1277 | break; | ||
1278 | case IR_PROTOCOL_RC6: | ||
1279 | outb(0x53, data->sbase + WBCIR_REG_SP3_BGDL); | ||
1280 | break; | ||
1281 | case IR_PROTOCOL_NEC: | ||
1282 | outb(0x69, data->sbase + WBCIR_REG_SP3_BGDL); | ||
1283 | break; | ||
1284 | } | ||
1285 | outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH); | ||
1286 | |||
1287 | /* Set CEIR mode */ | ||
1288 | wbcir_select_bank(data, WBCIR_BANK_0); | ||
1289 | outb(0xC0, data->sbase + WBCIR_REG_SP3_MCR); | ||
1290 | inb(data->sbase + WBCIR_REG_SP3_LSR); /* Clear LSR */ | ||
1291 | inb(data->sbase + WBCIR_REG_SP3_MSR); /* Clear MSR */ | ||
1292 | |||
1293 | /* Disable RX demod, run-length encoding/decoding, set freq span */ | ||
1294 | wbcir_select_bank(data, WBCIR_BANK_7); | ||
1295 | outb(0x10, data->sbase + WBCIR_REG_SP3_RCCFG); | ||
1296 | |||
1297 | /* Disable timer */ | ||
1298 | wbcir_select_bank(data, WBCIR_BANK_4); | ||
1299 | outb(0x00, data->sbase + WBCIR_REG_SP3_IRCR1); | ||
1300 | |||
1301 | /* Enable MSR interrupt, Clear AUX_IRX */ | ||
1302 | wbcir_select_bank(data, WBCIR_BANK_5); | ||
1303 | outb(0x00, data->sbase + WBCIR_REG_SP3_IRCR2); | ||
1304 | |||
1305 | /* Disable CRC */ | ||
1306 | wbcir_select_bank(data, WBCIR_BANK_6); | ||
1307 | outb(0x20, data->sbase + WBCIR_REG_SP3_IRCR3); | ||
1308 | |||
1309 | /* Set RX/TX (de)modulation freq, not really used */ | ||
1310 | wbcir_select_bank(data, WBCIR_BANK_7); | ||
1311 | outb(0xF2, data->sbase + WBCIR_REG_SP3_IRRXDC); | ||
1312 | outb(0x69, data->sbase + WBCIR_REG_SP3_IRTXMC); | ||
1313 | |||
1314 | /* Set invert and pin direction */ | ||
1315 | if (invert) | ||
1316 | outb(0x10, data->sbase + WBCIR_REG_SP3_IRCFG4); | ||
1317 | else | ||
1318 | outb(0x00, data->sbase + WBCIR_REG_SP3_IRCFG4); | ||
1319 | |||
1320 | /* Set FIFO thresholds (RX = 8, TX = 3), reset RX/TX */ | ||
1321 | wbcir_select_bank(data, WBCIR_BANK_0); | ||
1322 | outb(0x97, data->sbase + WBCIR_REG_SP3_FCR); | ||
1323 | |||
1324 | /* Clear AUX status bits */ | ||
1325 | outb(0xE0, data->sbase + WBCIR_REG_SP3_ASCR); | ||
1326 | |||
1327 | /* Enable interrupts */ | ||
1328 | wbcir_reset_irdata(data); | ||
1329 | outb(WBCIR_IRQ_RX | WBCIR_IRQ_ERR, data->sbase + WBCIR_REG_SP3_IER); | ||
1330 | } | ||
1331 | |||
1332 | static int | ||
1333 | wbcir_resume(struct pnp_dev *device) | ||
1334 | { | ||
1335 | struct wbcir_data *data = pnp_get_drvdata(device); | ||
1336 | |||
1337 | wbcir_init_hw(data); | ||
1338 | enable_irq(data->irq); | ||
1339 | |||
1340 | return 0; | ||
1267 | } | 1341 | } |
1268 | 1342 | ||
1269 | static int __devinit | 1343 | static int __devinit |
@@ -1393,86 +1467,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) | |||
1393 | 1467 | ||
1394 | device_init_wakeup(&device->dev, 1); | 1468 | device_init_wakeup(&device->dev, 1); |
1395 | 1469 | ||
1396 | wbcir_cfg_ceir(data); | 1470 | wbcir_init_hw(data); |
1397 | |||
1398 | /* Disable interrupts */ | ||
1399 | wbcir_select_bank(data, WBCIR_BANK_0); | ||
1400 | outb(WBCIR_IRQ_NONE, data->sbase + WBCIR_REG_SP3_IER); | ||
1401 | |||
1402 | /* Enable extended mode */ | ||
1403 | wbcir_select_bank(data, WBCIR_BANK_2); | ||
1404 | outb(WBCIR_EXT_ENABLE, data->sbase + WBCIR_REG_SP3_EXCR1); | ||
1405 | |||
1406 | /* | ||
1407 | * Configure baud generator, IR data will be sampled at | ||
1408 | * a bitrate of: (24Mhz * prescaler) / (divisor * 16). | ||
1409 | * | ||
1410 | * The ECIR registers include a flag to change the | ||
1411 | * 24Mhz clock freq to 48Mhz. | ||
1412 | * | ||
1413 | * It's not documented in the specs, but fifo levels | ||
1414 | * other than 16 seems to be unsupported. | ||
1415 | */ | ||
1416 | |||
1417 | /* prescaler 1.0, tx/rx fifo lvl 16 */ | ||
1418 | outb(0x30, data->sbase + WBCIR_REG_SP3_EXCR2); | ||
1419 | |||
1420 | /* Set baud divisor to generate one byte per bit/cell */ | ||
1421 | switch (protocol) { | ||
1422 | case IR_PROTOCOL_RC5: | ||
1423 | outb(0xA7, data->sbase + WBCIR_REG_SP3_BGDL); | ||
1424 | break; | ||
1425 | case IR_PROTOCOL_RC6: | ||
1426 | outb(0x53, data->sbase + WBCIR_REG_SP3_BGDL); | ||
1427 | break; | ||
1428 | case IR_PROTOCOL_NEC: | ||
1429 | outb(0x69, data->sbase + WBCIR_REG_SP3_BGDL); | ||
1430 | break; | ||
1431 | } | ||
1432 | outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH); | ||
1433 | |||
1434 | /* Set CEIR mode */ | ||
1435 | wbcir_select_bank(data, WBCIR_BANK_0); | ||
1436 | outb(0xC0, data->sbase + WBCIR_REG_SP3_MCR); | ||
1437 | inb(data->sbase + WBCIR_REG_SP3_LSR); /* Clear LSR */ | ||
1438 | inb(data->sbase + WBCIR_REG_SP3_MSR); /* Clear MSR */ | ||
1439 | |||
1440 | /* Disable RX demod, run-length encoding/decoding, set freq span */ | ||
1441 | wbcir_select_bank(data, WBCIR_BANK_7); | ||
1442 | outb(0x10, data->sbase + WBCIR_REG_SP3_RCCFG); | ||
1443 | |||
1444 | /* Disable timer */ | ||
1445 | wbcir_select_bank(data, WBCIR_BANK_4); | ||
1446 | outb(0x00, data->sbase + WBCIR_REG_SP3_IRCR1); | ||
1447 | |||
1448 | /* Enable MSR interrupt, Clear AUX_IRX */ | ||
1449 | wbcir_select_bank(data, WBCIR_BANK_5); | ||
1450 | outb(0x00, data->sbase + WBCIR_REG_SP3_IRCR2); | ||
1451 | |||
1452 | /* Disable CRC */ | ||
1453 | wbcir_select_bank(data, WBCIR_BANK_6); | ||
1454 | outb(0x20, data->sbase + WBCIR_REG_SP3_IRCR3); | ||
1455 | |||
1456 | /* Set RX/TX (de)modulation freq, not really used */ | ||
1457 | wbcir_select_bank(data, WBCIR_BANK_7); | ||
1458 | outb(0xF2, data->sbase + WBCIR_REG_SP3_IRRXDC); | ||
1459 | outb(0x69, data->sbase + WBCIR_REG_SP3_IRTXMC); | ||
1460 | |||
1461 | /* Set invert and pin direction */ | ||
1462 | if (invert) | ||
1463 | outb(0x10, data->sbase + WBCIR_REG_SP3_IRCFG4); | ||
1464 | else | ||
1465 | outb(0x00, data->sbase + WBCIR_REG_SP3_IRCFG4); | ||
1466 | |||
1467 | /* Set FIFO thresholds (RX = 8, TX = 3), reset RX/TX */ | ||
1468 | wbcir_select_bank(data, WBCIR_BANK_0); | ||
1469 | outb(0x97, data->sbase + WBCIR_REG_SP3_FCR); | ||
1470 | |||
1471 | /* Clear AUX status bits */ | ||
1472 | outb(0xE0, data->sbase + WBCIR_REG_SP3_ASCR); | ||
1473 | |||
1474 | /* Enable interrupts */ | ||
1475 | outb(WBCIR_IRQ_RX | WBCIR_IRQ_ERR, data->sbase + WBCIR_REG_SP3_IER); | ||
1476 | 1471 | ||
1477 | return 0; | 1472 | return 0; |
1478 | 1473 | ||
diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c index 90be30e93556..9169d1591c1f 100644 --- a/drivers/input/mouse/hgpk.c +++ b/drivers/input/mouse/hgpk.c | |||
@@ -68,10 +68,6 @@ module_param(post_interrupt_delay, int, 0644); | |||
68 | MODULE_PARM_DESC(post_interrupt_delay, | 68 | MODULE_PARM_DESC(post_interrupt_delay, |
69 | "delay (ms) before recal after recal interrupt detected"); | 69 | "delay (ms) before recal after recal interrupt detected"); |
70 | 70 | ||
71 | static int autorecal = 1; | ||
72 | module_param(autorecal, int, 0644); | ||
73 | MODULE_PARM_DESC(autorecal, "enable recalibration in the driver"); | ||
74 | |||
75 | /* | 71 | /* |
76 | * When the touchpad gets ultra-sensitive, one can keep their finger 1/2" | 72 | * When the touchpad gets ultra-sensitive, one can keep their finger 1/2" |
77 | * above the pad and still have it send packets. This causes a jump cursor | 73 | * above the pad and still have it send packets. This causes a jump cursor |
diff --git a/drivers/input/serio/pcips2.c b/drivers/input/serio/pcips2.c index 1dacbe0d9348..797314be7af2 100644 --- a/drivers/input/serio/pcips2.c +++ b/drivers/input/serio/pcips2.c | |||
@@ -186,7 +186,7 @@ static void __devexit pcips2_remove(struct pci_dev *dev) | |||
186 | pci_disable_device(dev); | 186 | pci_disable_device(dev); |
187 | } | 187 | } |
188 | 188 | ||
189 | static struct pci_device_id pcips2_ids[] = { | 189 | static const struct pci_device_id pcips2_ids[] = { |
190 | { | 190 | { |
191 | .vendor = 0x14f2, /* MOBILITY */ | 191 | .vendor = 0x14f2, /* MOBILITY */ |
192 | .device = 0x0123, /* Keyboard */ | 192 | .device = 0x0123, /* Keyboard */ |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index e0f30186d513..c3b626e9eae7 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -26,6 +26,8 @@ | |||
26 | * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic | 26 | * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
30 | |||
29 | #include <linux/stddef.h> | 31 | #include <linux/stddef.h> |
30 | #include <linux/module.h> | 32 | #include <linux/module.h> |
31 | #include <linux/serio.h> | 33 | #include <linux/serio.h> |
@@ -119,11 +121,10 @@ static int serio_bind_driver(struct serio *serio, struct serio_driver *drv) | |||
119 | 121 | ||
120 | error = device_bind_driver(&serio->dev); | 122 | error = device_bind_driver(&serio->dev); |
121 | if (error) { | 123 | if (error) { |
122 | printk(KERN_WARNING | 124 | dev_warn(&serio->dev, |
123 | "serio: device_bind_driver() failed " | 125 | "device_bind_driver() failed for %s (%s) and %s, error: %d\n", |
124 | "for %s (%s) and %s, error: %d\n", | 126 | serio->phys, serio->name, |
125 | serio->phys, serio->name, | 127 | drv->description, error); |
126 | drv->description, error); | ||
127 | serio_disconnect_driver(serio); | 128 | serio_disconnect_driver(serio); |
128 | serio->dev.driver = NULL; | 129 | serio->dev.driver = NULL; |
129 | return error; | 130 | return error; |
@@ -138,9 +139,9 @@ static void serio_find_driver(struct serio *serio) | |||
138 | 139 | ||
139 | error = device_attach(&serio->dev); | 140 | error = device_attach(&serio->dev); |
140 | if (error < 0) | 141 | if (error < 0) |
141 | printk(KERN_WARNING | 142 | dev_warn(&serio->dev, |
142 | "serio: device_attach() failed for %s (%s), error: %d\n", | 143 | "device_attach() failed for %s (%s), error: %d\n", |
143 | serio->phys, serio->name, error); | 144 | serio->phys, serio->name, error); |
144 | } | 145 | } |
145 | 146 | ||
146 | 147 | ||
@@ -194,17 +195,14 @@ static int serio_queue_event(void *object, struct module *owner, | |||
194 | 195 | ||
195 | event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC); | 196 | event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC); |
196 | if (!event) { | 197 | if (!event) { |
197 | printk(KERN_ERR | 198 | pr_err("Not enough memory to queue event %d\n", event_type); |
198 | "serio: Not enough memory to queue event %d\n", | ||
199 | event_type); | ||
200 | retval = -ENOMEM; | 199 | retval = -ENOMEM; |
201 | goto out; | 200 | goto out; |
202 | } | 201 | } |
203 | 202 | ||
204 | if (!try_module_get(owner)) { | 203 | if (!try_module_get(owner)) { |
205 | printk(KERN_WARNING | 204 | pr_warning("Can't get module reference, dropping event %d\n", |
206 | "serio: Can't get module reference, dropping event %d\n", | 205 | event_type); |
207 | event_type); | ||
208 | kfree(event); | 206 | kfree(event); |
209 | retval = -EINVAL; | 207 | retval = -EINVAL; |
210 | goto out; | 208 | goto out; |
@@ -230,14 +228,12 @@ static void serio_free_event(struct serio_event *event) | |||
230 | 228 | ||
231 | static void serio_remove_duplicate_events(struct serio_event *event) | 229 | static void serio_remove_duplicate_events(struct serio_event *event) |
232 | { | 230 | { |
233 | struct list_head *node, *next; | 231 | struct serio_event *e, *next; |
234 | struct serio_event *e; | ||
235 | unsigned long flags; | 232 | unsigned long flags; |
236 | 233 | ||
237 | spin_lock_irqsave(&serio_event_lock, flags); | 234 | spin_lock_irqsave(&serio_event_lock, flags); |
238 | 235 | ||
239 | list_for_each_safe(node, next, &serio_event_list) { | 236 | list_for_each_entry_safe(e, next, &serio_event_list, node) { |
240 | e = list_entry(node, struct serio_event, node); | ||
241 | if (event->object == e->object) { | 237 | if (event->object == e->object) { |
242 | /* | 238 | /* |
243 | * If this event is of different type we should not | 239 | * If this event is of different type we should not |
@@ -247,7 +243,7 @@ static void serio_remove_duplicate_events(struct serio_event *event) | |||
247 | if (event->type != e->type) | 243 | if (event->type != e->type) |
248 | break; | 244 | break; |
249 | 245 | ||
250 | list_del_init(node); | 246 | list_del_init(&e->node); |
251 | serio_free_event(e); | 247 | serio_free_event(e); |
252 | } | 248 | } |
253 | } | 249 | } |
@@ -258,23 +254,18 @@ static void serio_remove_duplicate_events(struct serio_event *event) | |||
258 | 254 | ||
259 | static struct serio_event *serio_get_event(void) | 255 | static struct serio_event *serio_get_event(void) |
260 | { | 256 | { |
261 | struct serio_event *event; | 257 | struct serio_event *event = NULL; |
262 | struct list_head *node; | ||
263 | unsigned long flags; | 258 | unsigned long flags; |
264 | 259 | ||
265 | spin_lock_irqsave(&serio_event_lock, flags); | 260 | spin_lock_irqsave(&serio_event_lock, flags); |
266 | 261 | ||
267 | if (list_empty(&serio_event_list)) { | 262 | if (!list_empty(&serio_event_list)) { |
268 | spin_unlock_irqrestore(&serio_event_lock, flags); | 263 | event = list_first_entry(&serio_event_list, |
269 | return NULL; | 264 | struct serio_event, node); |
265 | list_del_init(&event->node); | ||
270 | } | 266 | } |
271 | 267 | ||
272 | node = serio_event_list.next; | ||
273 | event = list_entry(node, struct serio_event, node); | ||
274 | list_del_init(node); | ||
275 | |||
276 | spin_unlock_irqrestore(&serio_event_lock, flags); | 268 | spin_unlock_irqrestore(&serio_event_lock, flags); |
277 | |||
278 | return event; | 269 | return event; |
279 | } | 270 | } |
280 | 271 | ||
@@ -287,29 +278,27 @@ static void serio_handle_event(void) | |||
287 | while ((event = serio_get_event())) { | 278 | while ((event = serio_get_event())) { |
288 | 279 | ||
289 | switch (event->type) { | 280 | switch (event->type) { |
290 | case SERIO_REGISTER_PORT: | ||
291 | serio_add_port(event->object); | ||
292 | break; | ||
293 | 281 | ||
294 | case SERIO_RECONNECT_PORT: | 282 | case SERIO_REGISTER_PORT: |
295 | serio_reconnect_port(event->object); | 283 | serio_add_port(event->object); |
296 | break; | 284 | break; |
297 | 285 | ||
298 | case SERIO_RESCAN_PORT: | 286 | case SERIO_RECONNECT_PORT: |
299 | serio_disconnect_port(event->object); | 287 | serio_reconnect_port(event->object); |
300 | serio_find_driver(event->object); | 288 | break; |
301 | break; | ||
302 | 289 | ||
303 | case SERIO_RECONNECT_CHAIN: | 290 | case SERIO_RESCAN_PORT: |
304 | serio_reconnect_chain(event->object); | 291 | serio_disconnect_port(event->object); |
305 | break; | 292 | serio_find_driver(event->object); |
293 | break; | ||
306 | 294 | ||
307 | case SERIO_ATTACH_DRIVER: | 295 | case SERIO_RECONNECT_CHAIN: |
308 | serio_attach_driver(event->object); | 296 | serio_reconnect_chain(event->object); |
309 | break; | 297 | break; |
310 | 298 | ||
311 | default: | 299 | case SERIO_ATTACH_DRIVER: |
312 | break; | 300 | serio_attach_driver(event->object); |
301 | break; | ||
313 | } | 302 | } |
314 | 303 | ||
315 | serio_remove_duplicate_events(event); | 304 | serio_remove_duplicate_events(event); |
@@ -325,16 +314,14 @@ static void serio_handle_event(void) | |||
325 | */ | 314 | */ |
326 | static void serio_remove_pending_events(void *object) | 315 | static void serio_remove_pending_events(void *object) |
327 | { | 316 | { |
328 | struct list_head *node, *next; | 317 | struct serio_event *event, *next; |
329 | struct serio_event *event; | ||
330 | unsigned long flags; | 318 | unsigned long flags; |
331 | 319 | ||
332 | spin_lock_irqsave(&serio_event_lock, flags); | 320 | spin_lock_irqsave(&serio_event_lock, flags); |
333 | 321 | ||
334 | list_for_each_safe(node, next, &serio_event_list) { | 322 | list_for_each_entry_safe(event, next, &serio_event_list, node) { |
335 | event = list_entry(node, struct serio_event, node); | ||
336 | if (event->object == object) { | 323 | if (event->object == object) { |
337 | list_del_init(node); | 324 | list_del_init(&event->node); |
338 | serio_free_event(event); | 325 | serio_free_event(event); |
339 | } | 326 | } |
340 | } | 327 | } |
@@ -380,7 +367,6 @@ static int serio_thread(void *nothing) | |||
380 | kthread_should_stop() || !list_empty(&serio_event_list)); | 367 | kthread_should_stop() || !list_empty(&serio_event_list)); |
381 | } while (!kthread_should_stop()); | 368 | } while (!kthread_should_stop()); |
382 | 369 | ||
383 | printk(KERN_DEBUG "serio: kseriod exiting\n"); | ||
384 | return 0; | 370 | return 0; |
385 | } | 371 | } |
386 | 372 | ||
@@ -445,6 +431,11 @@ static struct attribute_group serio_id_attr_group = { | |||
445 | .attrs = serio_device_id_attrs, | 431 | .attrs = serio_device_id_attrs, |
446 | }; | 432 | }; |
447 | 433 | ||
434 | static const struct attribute_group *serio_device_attr_groups[] = { | ||
435 | &serio_id_attr_group, | ||
436 | NULL | ||
437 | }; | ||
438 | |||
448 | static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 439 | static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
449 | { | 440 | { |
450 | struct serio *serio = to_serio_port(dev); | 441 | struct serio *serio = to_serio_port(dev); |
@@ -532,6 +523,7 @@ static void serio_init_port(struct serio *serio) | |||
532 | (long)atomic_inc_return(&serio_no) - 1); | 523 | (long)atomic_inc_return(&serio_no) - 1); |
533 | serio->dev.bus = &serio_bus; | 524 | serio->dev.bus = &serio_bus; |
534 | serio->dev.release = serio_release_port; | 525 | serio->dev.release = serio_release_port; |
526 | serio->dev.groups = serio_device_attr_groups; | ||
535 | if (serio->parent) { | 527 | if (serio->parent) { |
536 | serio->dev.parent = &serio->parent->dev; | 528 | serio->dev.parent = &serio->parent->dev; |
537 | serio->depth = serio->parent->depth + 1; | 529 | serio->depth = serio->parent->depth + 1; |
@@ -555,21 +547,15 @@ static void serio_add_port(struct serio *serio) | |||
555 | } | 547 | } |
556 | 548 | ||
557 | list_add_tail(&serio->node, &serio_list); | 549 | list_add_tail(&serio->node, &serio_list); |
550 | |||
558 | if (serio->start) | 551 | if (serio->start) |
559 | serio->start(serio); | 552 | serio->start(serio); |
553 | |||
560 | error = device_add(&serio->dev); | 554 | error = device_add(&serio->dev); |
561 | if (error) | 555 | if (error) |
562 | printk(KERN_ERR | 556 | dev_err(&serio->dev, |
563 | "serio: device_add() failed for %s (%s), error: %d\n", | 557 | "device_add() failed for %s (%s), error: %d\n", |
564 | serio->phys, serio->name, error); | 558 | serio->phys, serio->name, error); |
565 | else { | ||
566 | serio->registered = true; | ||
567 | error = sysfs_create_group(&serio->dev.kobj, &serio_id_attr_group); | ||
568 | if (error) | ||
569 | printk(KERN_ERR | ||
570 | "serio: sysfs_create_group() failed for %s (%s), error: %d\n", | ||
571 | serio->phys, serio->name, error); | ||
572 | } | ||
573 | } | 559 | } |
574 | 560 | ||
575 | /* | 561 | /* |
@@ -596,11 +582,8 @@ static void serio_destroy_port(struct serio *serio) | |||
596 | serio->parent = NULL; | 582 | serio->parent = NULL; |
597 | } | 583 | } |
598 | 584 | ||
599 | if (serio->registered) { | 585 | if (device_is_registered(&serio->dev)) |
600 | sysfs_remove_group(&serio->dev.kobj, &serio_id_attr_group); | ||
601 | device_del(&serio->dev); | 586 | device_del(&serio->dev); |
602 | serio->registered = false; | ||
603 | } | ||
604 | 587 | ||
605 | list_del_init(&serio->node); | 588 | list_del_init(&serio->node); |
606 | serio_remove_pending_events(serio); | 589 | serio_remove_pending_events(serio); |
@@ -798,9 +781,8 @@ static void serio_attach_driver(struct serio_driver *drv) | |||
798 | 781 | ||
799 | error = driver_attach(&drv->driver); | 782 | error = driver_attach(&drv->driver); |
800 | if (error) | 783 | if (error) |
801 | printk(KERN_WARNING | 784 | pr_warning("driver_attach() failed for %s with error %d\n", |
802 | "serio: driver_attach() failed for %s with error %d\n", | 785 | drv->driver.name, error); |
803 | drv->driver.name, error); | ||
804 | } | 786 | } |
805 | 787 | ||
806 | int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name) | 788 | int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name) |
@@ -820,8 +802,7 @@ int __serio_register_driver(struct serio_driver *drv, struct module *owner, cons | |||
820 | 802 | ||
821 | error = driver_register(&drv->driver); | 803 | error = driver_register(&drv->driver); |
822 | if (error) { | 804 | if (error) { |
823 | printk(KERN_ERR | 805 | pr_err("driver_register() failed for %s, error: %d\n", |
824 | "serio: driver_register() failed for %s, error: %d\n", | ||
825 | drv->driver.name, error); | 806 | drv->driver.name, error); |
826 | return error; | 807 | return error; |
827 | } | 808 | } |
@@ -987,7 +968,7 @@ irqreturn_t serio_interrupt(struct serio *serio, | |||
987 | 968 | ||
988 | if (likely(serio->drv)) { | 969 | if (likely(serio->drv)) { |
989 | ret = serio->drv->interrupt(serio, data, dfl); | 970 | ret = serio->drv->interrupt(serio, data, dfl); |
990 | } else if (!dfl && serio->registered) { | 971 | } else if (!dfl && device_is_registered(&serio->dev)) { |
991 | serio_rescan(serio); | 972 | serio_rescan(serio); |
992 | ret = IRQ_HANDLED; | 973 | ret = IRQ_HANDLED; |
993 | } | 974 | } |
@@ -1018,7 +999,7 @@ static int __init serio_init(void) | |||
1018 | 999 | ||
1019 | error = bus_register(&serio_bus); | 1000 | error = bus_register(&serio_bus); |
1020 | if (error) { | 1001 | if (error) { |
1021 | printk(KERN_ERR "serio: failed to register serio bus, error: %d\n", error); | 1002 | pr_err("Failed to register serio bus, error: %d\n", error); |
1022 | return error; | 1003 | return error; |
1023 | } | 1004 | } |
1024 | 1005 | ||
@@ -1026,7 +1007,7 @@ static int __init serio_init(void) | |||
1026 | if (IS_ERR(serio_task)) { | 1007 | if (IS_ERR(serio_task)) { |
1027 | bus_unregister(&serio_bus); | 1008 | bus_unregister(&serio_bus); |
1028 | error = PTR_ERR(serio_task); | 1009 | error = PTR_ERR(serio_task); |
1029 | printk(KERN_ERR "serio: Failed to start kseriod, error: %d\n", error); | 1010 | pr_err("Failed to start kseriod, error: %d\n", error); |
1030 | return error; | 1011 | return error; |
1031 | } | 1012 | } |
1032 | 1013 | ||
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c index ebb22f88c842..8298e1f68234 100644 --- a/drivers/input/serio/xilinx_ps2.c +++ b/drivers/input/serio/xilinx_ps2.c | |||
@@ -270,7 +270,7 @@ static int __devinit xps2_of_probe(struct of_device *ofdev, | |||
270 | drvdata->irq = r_irq.start; | 270 | drvdata->irq = r_irq.start; |
271 | 271 | ||
272 | phys_addr = r_mem.start; | 272 | phys_addr = r_mem.start; |
273 | remap_size = r_mem.end - r_mem.start + 1; | 273 | remap_size = resource_size(&r_mem); |
274 | if (!request_mem_region(phys_addr, remap_size, DRIVER_NAME)) { | 274 | if (!request_mem_region(phys_addr, remap_size, DRIVER_NAME)) { |
275 | dev_err(dev, "Couldn't lock memory region at 0x%08llX\n", | 275 | dev_err(dev, "Couldn't lock memory region at 0x%08llX\n", |
276 | (unsigned long long)phys_addr); | 276 | (unsigned long long)phys_addr); |
@@ -344,7 +344,7 @@ static int __devexit xps2_of_remove(struct of_device *of_dev) | |||
344 | if (of_address_to_resource(of_dev->node, 0, &r_mem)) | 344 | if (of_address_to_resource(of_dev->node, 0, &r_mem)) |
345 | dev_err(dev, "invalid address\n"); | 345 | dev_err(dev, "invalid address\n"); |
346 | else | 346 | else |
347 | release_mem_region(r_mem.start, r_mem.end - r_mem.start + 1); | 347 | release_mem_region(r_mem.start, resource_size(&r_mem)); |
348 | 348 | ||
349 | kfree(drvdata); | 349 | kfree(drvdata); |
350 | 350 | ||
@@ -354,7 +354,7 @@ static int __devexit xps2_of_remove(struct of_device *of_dev) | |||
354 | } | 354 | } |
355 | 355 | ||
356 | /* Match table for of_platform binding */ | 356 | /* Match table for of_platform binding */ |
357 | static struct of_device_id xps2_of_match[] __devinitdata = { | 357 | static const struct of_device_id xps2_of_match[] __devinitconst = { |
358 | { .compatible = "xlnx,xps-ps2-1.00.a", }, | 358 | { .compatible = "xlnx,xps-ps2-1.00.a", }, |
359 | { /* end of list */ }, | 359 | { /* end of list */ }, |
360 | }; | 360 | }; |
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index 3d32d3f4e486..866a9ee1af1a 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c | |||
@@ -92,7 +92,7 @@ Scott Hill shill@gtcocalcomp.com | |||
92 | /* DATA STRUCTURES */ | 92 | /* DATA STRUCTURES */ |
93 | 93 | ||
94 | /* Device table */ | 94 | /* Device table */ |
95 | static struct usb_device_id gtco_usbid_table [] = { | 95 | static const struct usb_device_id gtco_usbid_table[] = { |
96 | { USB_DEVICE(VENDOR_ID_GTCO, PID_400) }, | 96 | { USB_DEVICE(VENDOR_ID_GTCO, PID_400) }, |
97 | { USB_DEVICE(VENDOR_ID_GTCO, PID_401) }, | 97 | { USB_DEVICE(VENDOR_ID_GTCO, PID_401) }, |
98 | { USB_DEVICE(VENDOR_ID_GTCO, PID_1000) }, | 98 | { USB_DEVICE(VENDOR_ID_GTCO, PID_1000) }, |
diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h index 16310f368dab..8fef1b689c69 100644 --- a/drivers/input/tablet/wacom.h +++ b/drivers/input/tablet/wacom.h | |||
@@ -85,6 +85,7 @@ | |||
85 | #include <linux/kernel.h> | 85 | #include <linux/kernel.h> |
86 | #include <linux/slab.h> | 86 | #include <linux/slab.h> |
87 | #include <linux/module.h> | 87 | #include <linux/module.h> |
88 | #include <linux/mod_devicetable.h> | ||
88 | #include <linux/init.h> | 89 | #include <linux/init.h> |
89 | #include <linux/usb/input.h> | 90 | #include <linux/usb/input.h> |
90 | #include <asm/unaligned.h> | 91 | #include <asm/unaligned.h> |
@@ -120,6 +121,8 @@ struct wacom_combo { | |||
120 | struct urb *urb; | 121 | struct urb *urb; |
121 | }; | 122 | }; |
122 | 123 | ||
124 | extern const struct usb_device_id wacom_ids[]; | ||
125 | |||
123 | extern int wacom_wac_irq(struct wacom_wac * wacom_wac, void * wcombo); | 126 | extern int wacom_wac_irq(struct wacom_wac * wacom_wac, void * wcombo); |
124 | extern void wacom_report_abs(void *wcombo, unsigned int abs_type, int abs_data); | 127 | extern void wacom_report_abs(void *wcombo, unsigned int abs_type, int abs_data); |
125 | extern void wacom_report_rel(void *wcombo, unsigned int rel_type, int rel_data); | 128 | extern void wacom_report_rel(void *wcombo, unsigned int rel_type, int rel_data); |
@@ -142,7 +145,5 @@ extern void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wa | |||
142 | extern void input_dev_bee(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | 145 | extern void input_dev_bee(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
143 | extern __u16 wacom_le16_to_cpu(unsigned char *data); | 146 | extern __u16 wacom_le16_to_cpu(unsigned char *data); |
144 | extern __u16 wacom_be16_to_cpu(unsigned char *data); | 147 | extern __u16 wacom_be16_to_cpu(unsigned char *data); |
145 | extern struct wacom_features *get_wacom_feature(const struct usb_device_id *id); | ||
146 | extern const struct usb_device_id *get_device_table(void); | ||
147 | 148 | ||
148 | #endif | 149 | #endif |
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 072f33b3b2b0..a1770e6feeec 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -211,7 +211,8 @@ void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
211 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER) | | 211 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER) | |
212 | BIT_MASK(BTN_TOOL_PEN) | BIT_MASK(BTN_STYLUS) | | 212 | BIT_MASK(BTN_TOOL_PEN) | BIT_MASK(BTN_STYLUS) | |
213 | BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_STYLUS2); | 213 | BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_STYLUS2); |
214 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0); | 214 | input_set_abs_params(input_dev, ABS_DISTANCE, |
215 | 0, wacom_wac->features.distance_max, 0, 0); | ||
215 | } | 216 | } |
216 | 217 | ||
217 | void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 218 | void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
@@ -261,7 +262,8 @@ void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
261 | BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_TOOL_BRUSH) | | 262 | BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_TOOL_BRUSH) | |
262 | BIT_MASK(BTN_TOOL_PENCIL) | BIT_MASK(BTN_TOOL_AIRBRUSH) | | 263 | BIT_MASK(BTN_TOOL_PENCIL) | BIT_MASK(BTN_TOOL_AIRBRUSH) | |
263 | BIT_MASK(BTN_TOOL_LENS) | BIT_MASK(BTN_STYLUS2); | 264 | BIT_MASK(BTN_TOOL_LENS) | BIT_MASK(BTN_STYLUS2); |
264 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0); | 265 | input_set_abs_params(input_dev, ABS_DISTANCE, |
266 | 0, wacom_wac->features.distance_max, 0, 0); | ||
265 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); | 267 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); |
266 | input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0); | 268 | input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0); |
267 | input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0); | 269 | input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0); |
@@ -282,17 +284,19 @@ void input_dev_pt(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
282 | 284 | ||
283 | void input_dev_tpc(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 285 | void input_dev_tpc(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
284 | { | 286 | { |
285 | if (wacom_wac->features->device_type == BTN_TOOL_DOUBLETAP || | 287 | struct wacom_features *features = &wacom_wac->features; |
286 | wacom_wac->features->device_type == BTN_TOOL_TRIPLETAP) { | 288 | |
287 | input_set_abs_params(input_dev, ABS_RX, 0, wacom_wac->features->x_phy, 0, 0); | 289 | if (features->device_type == BTN_TOOL_DOUBLETAP || |
288 | input_set_abs_params(input_dev, ABS_RY, 0, wacom_wac->features->y_phy, 0, 0); | 290 | features->device_type == BTN_TOOL_TRIPLETAP) { |
289 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_DOUBLETAP); | 291 | input_set_abs_params(input_dev, ABS_RX, 0, features->x_phy, 0, 0); |
292 | input_set_abs_params(input_dev, ABS_RY, 0, features->y_phy, 0, 0); | ||
293 | __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); | ||
290 | } | 294 | } |
291 | } | 295 | } |
292 | 296 | ||
293 | void input_dev_tpc2fg(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 297 | void input_dev_tpc2fg(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
294 | { | 298 | { |
295 | if (wacom_wac->features->device_type == BTN_TOOL_TRIPLETAP) { | 299 | if (wacom_wac->features.device_type == BTN_TOOL_TRIPLETAP) { |
296 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_TRIPLETAP); | 300 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_TRIPLETAP); |
297 | input_dev->evbit[0] |= BIT_MASK(EV_MSC); | 301 | input_dev->evbit[0] |= BIT_MASK(EV_MSC); |
298 | input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL); | 302 | input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL); |
@@ -532,21 +536,38 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
532 | struct wacom_wac *wacom_wac; | 536 | struct wacom_wac *wacom_wac; |
533 | struct wacom_features *features; | 537 | struct wacom_features *features; |
534 | struct input_dev *input_dev; | 538 | struct input_dev *input_dev; |
535 | int error = -ENOMEM; | 539 | int error; |
540 | |||
541 | if (!id->driver_info) | ||
542 | return -EINVAL; | ||
536 | 543 | ||
537 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); | 544 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); |
538 | wacom_wac = kzalloc(sizeof(struct wacom_wac), GFP_KERNEL); | 545 | wacom_wac = kzalloc(sizeof(struct wacom_wac), GFP_KERNEL); |
539 | input_dev = input_allocate_device(); | 546 | input_dev = input_allocate_device(); |
540 | if (!wacom || !input_dev || !wacom_wac) | 547 | if (!wacom || !input_dev || !wacom_wac) { |
548 | error = -ENOMEM; | ||
541 | goto fail1; | 549 | goto fail1; |
550 | } | ||
542 | 551 | ||
543 | wacom_wac->data = usb_buffer_alloc(dev, WACOM_PKGLEN_MAX, GFP_KERNEL, &wacom->data_dma); | 552 | wacom_wac->features = *((struct wacom_features *)id->driver_info); |
544 | if (!wacom_wac->data) | 553 | features = &wacom_wac->features; |
554 | if (features->pktlen > WACOM_PKGLEN_MAX) { | ||
555 | error = -EINVAL; | ||
545 | goto fail1; | 556 | goto fail1; |
557 | } | ||
558 | |||
559 | wacom_wac->data = usb_buffer_alloc(dev, WACOM_PKGLEN_MAX, | ||
560 | GFP_KERNEL, &wacom->data_dma); | ||
561 | if (!wacom_wac->data) { | ||
562 | error = -ENOMEM; | ||
563 | goto fail1; | ||
564 | } | ||
546 | 565 | ||
547 | wacom->irq = usb_alloc_urb(0, GFP_KERNEL); | 566 | wacom->irq = usb_alloc_urb(0, GFP_KERNEL); |
548 | if (!wacom->irq) | 567 | if (!wacom->irq) { |
568 | error = -ENOMEM; | ||
549 | goto fail2; | 569 | goto fail2; |
570 | } | ||
550 | 571 | ||
551 | wacom->usbdev = dev; | 572 | wacom->usbdev = dev; |
552 | wacom->dev = input_dev; | 573 | wacom->dev = input_dev; |
@@ -555,11 +576,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
555 | usb_make_path(dev, wacom->phys, sizeof(wacom->phys)); | 576 | usb_make_path(dev, wacom->phys, sizeof(wacom->phys)); |
556 | strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); | 577 | strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); |
557 | 578 | ||
558 | wacom_wac->features = features = get_wacom_feature(id); | ||
559 | BUG_ON(features->pktlen > WACOM_PKGLEN_MAX); | ||
560 | |||
561 | input_dev->name = wacom_wac->features->name; | ||
562 | wacom->wacom_wac = wacom_wac; | ||
563 | usb_to_input_id(dev, &input_dev->id); | 579 | usb_to_input_id(dev, &input_dev->id); |
564 | 580 | ||
565 | input_dev->dev.parent = &intf->dev; | 581 | input_dev->dev.parent = &intf->dev; |
@@ -576,6 +592,19 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
576 | if (error) | 592 | if (error) |
577 | goto fail2; | 593 | goto fail2; |
578 | 594 | ||
595 | strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name)); | ||
596 | |||
597 | if (features->type == TABLETPC || features->type == TABLETPC2FG) { | ||
598 | /* Append the device type to the name */ | ||
599 | strlcat(wacom_wac->name, | ||
600 | features->device_type == BTN_TOOL_PEN ? | ||
601 | " Pen" : " Finger", | ||
602 | sizeof(wacom_wac->name)); | ||
603 | } | ||
604 | |||
605 | input_dev->name = wacom_wac->name; | ||
606 | wacom->wacom_wac = wacom_wac; | ||
607 | |||
579 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 608 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
580 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOUCH); | 609 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOUCH); |
581 | 610 | ||
@@ -640,7 +669,7 @@ static int wacom_suspend(struct usb_interface *intf, pm_message_t message) | |||
640 | static int wacom_resume(struct usb_interface *intf) | 669 | static int wacom_resume(struct usb_interface *intf) |
641 | { | 670 | { |
642 | struct wacom *wacom = usb_get_intfdata(intf); | 671 | struct wacom *wacom = usb_get_intfdata(intf); |
643 | struct wacom_features *features = wacom->wacom_wac->features; | 672 | struct wacom_features *features = &wacom->wacom_wac->features; |
644 | int rv; | 673 | int rv; |
645 | 674 | ||
646 | mutex_lock(&wacom->lock); | 675 | mutex_lock(&wacom->lock); |
@@ -663,6 +692,7 @@ static int wacom_reset_resume(struct usb_interface *intf) | |||
663 | 692 | ||
664 | static struct usb_driver wacom_driver = { | 693 | static struct usb_driver wacom_driver = { |
665 | .name = "wacom", | 694 | .name = "wacom", |
695 | .id_table = wacom_ids, | ||
666 | .probe = wacom_probe, | 696 | .probe = wacom_probe, |
667 | .disconnect = wacom_disconnect, | 697 | .disconnect = wacom_disconnect, |
668 | .suspend = wacom_suspend, | 698 | .suspend = wacom_suspend, |
@@ -674,7 +704,7 @@ static struct usb_driver wacom_driver = { | |||
674 | static int __init wacom_init(void) | 704 | static int __init wacom_init(void) |
675 | { | 705 | { |
676 | int result; | 706 | int result; |
677 | wacom_driver.id_table = get_device_table(); | 707 | |
678 | result = usb_register(&wacom_driver); | 708 | result = usb_register(&wacom_driver); |
679 | if (result == 0) | 709 | if (result == 0) |
680 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" | 710 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 1056f149fe31..3d81443e683a 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -55,6 +55,7 @@ static int wacom_penpartner_irq(struct wacom_wac *wacom, void *wcombo) | |||
55 | 55 | ||
56 | static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo) | 56 | static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo) |
57 | { | 57 | { |
58 | struct wacom_features *features = &wacom->features; | ||
58 | unsigned char *data = wacom->data; | 59 | unsigned char *data = wacom->data; |
59 | int prox, pressure; | 60 | int prox, pressure; |
60 | 61 | ||
@@ -68,9 +69,9 @@ static int wacom_pl_irq(struct wacom_wac *wacom, void *wcombo) | |||
68 | if (prox) { | 69 | if (prox) { |
69 | wacom->id[0] = ERASER_DEVICE_ID; | 70 | wacom->id[0] = ERASER_DEVICE_ID; |
70 | pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); | 71 | pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); |
71 | if (wacom->features->pressure_max > 255) | 72 | if (features->pressure_max > 255) |
72 | pressure = (pressure << 1) | ((data[4] >> 6) & 1); | 73 | pressure = (pressure << 1) | ((data[4] >> 6) & 1); |
73 | pressure += (wacom->features->pressure_max + 1) / 2; | 74 | pressure += (features->pressure_max + 1) / 2; |
74 | 75 | ||
75 | /* | 76 | /* |
76 | * if going from out of proximity into proximity select between the eraser | 77 | * if going from out of proximity into proximity select between the eraser |
@@ -152,6 +153,7 @@ static int wacom_ptu_irq(struct wacom_wac *wacom, void *wcombo) | |||
152 | 153 | ||
153 | static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | 154 | static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) |
154 | { | 155 | { |
156 | struct wacom_features *features = &wacom->features; | ||
155 | unsigned char *data = wacom->data; | 157 | unsigned char *data = wacom->data; |
156 | int x, y, rw; | 158 | int x, y, rw; |
157 | static int penData = 0; | 159 | static int penData = 0; |
@@ -179,8 +181,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
179 | 181 | ||
180 | case 2: /* Mouse with wheel */ | 182 | case 2: /* Mouse with wheel */ |
181 | wacom_report_key(wcombo, BTN_MIDDLE, data[1] & 0x04); | 183 | wacom_report_key(wcombo, BTN_MIDDLE, data[1] & 0x04); |
182 | if (wacom->features->type == WACOM_G4 || | 184 | if (features->type == WACOM_G4 || features->type == WACOM_MO) { |
183 | wacom->features->type == WACOM_MO) { | ||
184 | rw = data[7] & 0x04 ? (data[7] & 0x03)-4 : (data[7] & 0x03); | 185 | rw = data[7] & 0x04 ? (data[7] & 0x03)-4 : (data[7] & 0x03); |
185 | wacom_report_rel(wcombo, REL_WHEEL, -rw); | 186 | wacom_report_rel(wcombo, REL_WHEEL, -rw); |
186 | } else | 187 | } else |
@@ -192,8 +193,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
192 | wacom->id[0] = CURSOR_DEVICE_ID; | 193 | wacom->id[0] = CURSOR_DEVICE_ID; |
193 | wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01); | 194 | wacom_report_key(wcombo, BTN_LEFT, data[1] & 0x01); |
194 | wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02); | 195 | wacom_report_key(wcombo, BTN_RIGHT, data[1] & 0x02); |
195 | if (wacom->features->type == WACOM_G4 || | 196 | if (features->type == WACOM_G4 || features->type == WACOM_MO) |
196 | wacom->features->type == WACOM_MO) | ||
197 | wacom_report_abs(wcombo, ABS_DISTANCE, data[6] & 0x3f); | 197 | wacom_report_abs(wcombo, ABS_DISTANCE, data[6] & 0x3f); |
198 | else | 198 | else |
199 | wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f); | 199 | wacom_report_abs(wcombo, ABS_DISTANCE, data[7] & 0x3f); |
@@ -230,7 +230,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
230 | } | 230 | } |
231 | 231 | ||
232 | /* send pad data */ | 232 | /* send pad data */ |
233 | switch (wacom->features->type) { | 233 | switch (features->type) { |
234 | case WACOM_G4: | 234 | case WACOM_G4: |
235 | if (data[7] & 0xf8) { | 235 | if (data[7] & 0xf8) { |
236 | if (penData) { | 236 | if (penData) { |
@@ -300,11 +300,12 @@ static int wacom_graphire_irq(struct wacom_wac *wacom, void *wcombo) | |||
300 | 300 | ||
301 | static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) | 301 | static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) |
302 | { | 302 | { |
303 | struct wacom_features *features = &wacom->features; | ||
303 | unsigned char *data = wacom->data; | 304 | unsigned char *data = wacom->data; |
304 | int idx = 0; | 305 | int idx = 0; |
305 | 306 | ||
306 | /* tool number */ | 307 | /* tool number */ |
307 | if (wacom->features->type == INTUOS) | 308 | if (features->type == INTUOS) |
308 | idx = data[1] & 0x01; | 309 | idx = data[1] & 0x01; |
309 | 310 | ||
310 | /* Enter report */ | 311 | /* Enter report */ |
@@ -402,7 +403,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) | |||
402 | wacom_report_key(wcombo, BTN_STYLUS2, 0); | 403 | wacom_report_key(wcombo, BTN_STYLUS2, 0); |
403 | wacom_report_key(wcombo, BTN_TOUCH, 0); | 404 | wacom_report_key(wcombo, BTN_TOUCH, 0); |
404 | wacom_report_abs(wcombo, ABS_WHEEL, 0); | 405 | wacom_report_abs(wcombo, ABS_WHEEL, 0); |
405 | if (wacom->features->type >= INTUOS3S) | 406 | if (features->type >= INTUOS3S) |
406 | wacom_report_abs(wcombo, ABS_Z, 0); | 407 | wacom_report_abs(wcombo, ABS_Z, 0); |
407 | } | 408 | } |
408 | wacom_report_key(wcombo, wacom->tool[idx], 0); | 409 | wacom_report_key(wcombo, wacom->tool[idx], 0); |
@@ -416,13 +417,14 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) | |||
416 | 417 | ||
417 | static void wacom_intuos_general(struct wacom_wac *wacom, void *wcombo) | 418 | static void wacom_intuos_general(struct wacom_wac *wacom, void *wcombo) |
418 | { | 419 | { |
420 | struct wacom_features *features = &wacom->features; | ||
419 | unsigned char *data = wacom->data; | 421 | unsigned char *data = wacom->data; |
420 | unsigned int t; | 422 | unsigned int t; |
421 | 423 | ||
422 | /* general pen packet */ | 424 | /* general pen packet */ |
423 | if ((data[1] & 0xb8) == 0xa0) { | 425 | if ((data[1] & 0xb8) == 0xa0) { |
424 | t = (data[6] << 2) | ((data[7] >> 6) & 3); | 426 | t = (data[6] << 2) | ((data[7] >> 6) & 3); |
425 | if (wacom->features->type >= INTUOS4S && wacom->features->type <= INTUOS4L) | 427 | if (features->type >= INTUOS4S && features->type <= INTUOS4L) |
426 | t = (t << 1) | (data[1] & 1); | 428 | t = (t << 1) | (data[1] & 1); |
427 | wacom_report_abs(wcombo, ABS_PRESSURE, t); | 429 | wacom_report_abs(wcombo, ABS_PRESSURE, t); |
428 | wacom_report_abs(wcombo, ABS_TILT_X, | 430 | wacom_report_abs(wcombo, ABS_TILT_X, |
@@ -446,6 +448,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom, void *wcombo) | |||
446 | 448 | ||
447 | static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | 449 | static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) |
448 | { | 450 | { |
451 | struct wacom_features *features = &wacom->features; | ||
449 | unsigned char *data = wacom->data; | 452 | unsigned char *data = wacom->data; |
450 | unsigned int t; | 453 | unsigned int t; |
451 | int idx = 0, result; | 454 | int idx = 0, result; |
@@ -457,7 +460,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
457 | } | 460 | } |
458 | 461 | ||
459 | /* tool number */ | 462 | /* tool number */ |
460 | if (wacom->features->type == INTUOS) | 463 | if (features->type == INTUOS) |
461 | idx = data[1] & 0x01; | 464 | idx = data[1] & 0x01; |
462 | 465 | ||
463 | /* pad packets. Works as a second tool and is always in prox */ | 466 | /* pad packets. Works as a second tool and is always in prox */ |
@@ -466,7 +469,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
466 | if (wacom->tool[1] != BTN_TOOL_FINGER) | 469 | if (wacom->tool[1] != BTN_TOOL_FINGER) |
467 | wacom->tool[1] = BTN_TOOL_FINGER; | 470 | wacom->tool[1] = BTN_TOOL_FINGER; |
468 | 471 | ||
469 | if (wacom->features->type >= INTUOS4S && wacom->features->type <= INTUOS4L) { | 472 | if (features->type >= INTUOS4S && features->type <= INTUOS4L) { |
470 | wacom_report_key(wcombo, BTN_0, (data[2] & 0x01)); | 473 | wacom_report_key(wcombo, BTN_0, (data[2] & 0x01)); |
471 | wacom_report_key(wcombo, BTN_1, (data[3] & 0x01)); | 474 | wacom_report_key(wcombo, BTN_1, (data[3] & 0x01)); |
472 | wacom_report_key(wcombo, BTN_2, (data[3] & 0x02)); | 475 | wacom_report_key(wcombo, BTN_2, (data[3] & 0x02)); |
@@ -480,7 +483,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
480 | /* Out of proximity, clear wheel value. */ | 483 | /* Out of proximity, clear wheel value. */ |
481 | wacom_report_abs(wcombo, ABS_WHEEL, 0); | 484 | wacom_report_abs(wcombo, ABS_WHEEL, 0); |
482 | } | 485 | } |
483 | if (wacom->features->type != INTUOS4S) { | 486 | if (features->type != INTUOS4S) { |
484 | wacom_report_key(wcombo, BTN_7, (data[3] & 0x40)); | 487 | wacom_report_key(wcombo, BTN_7, (data[3] & 0x40)); |
485 | wacom_report_key(wcombo, BTN_8, (data[3] & 0x80)); | 488 | wacom_report_key(wcombo, BTN_8, (data[3] & 0x80)); |
486 | } | 489 | } |
@@ -528,18 +531,20 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
528 | return 0; | 531 | return 0; |
529 | 532 | ||
530 | /* Only large Intuos support Lense Cursor */ | 533 | /* Only large Intuos support Lense Cursor */ |
531 | if ((wacom->tool[idx] == BTN_TOOL_LENS) | 534 | if (wacom->tool[idx] == BTN_TOOL_LENS && |
532 | && ((wacom->features->type == INTUOS3) | 535 | (features->type == INTUOS3 || |
533 | || (wacom->features->type == INTUOS3S) | 536 | features->type == INTUOS3S || |
534 | || (wacom->features->type == INTUOS4) | 537 | features->type == INTUOS4 || |
535 | || (wacom->features->type == INTUOS4S))) | 538 | features->type == INTUOS4S)) { |
539 | |||
536 | return 0; | 540 | return 0; |
541 | } | ||
537 | 542 | ||
538 | /* Cintiq doesn't send data when RDY bit isn't set */ | 543 | /* Cintiq doesn't send data when RDY bit isn't set */ |
539 | if ((wacom->features->type == CINTIQ) && !(data[1] & 0x40)) | 544 | if (features->type == CINTIQ && !(data[1] & 0x40)) |
540 | return 0; | 545 | return 0; |
541 | 546 | ||
542 | if (wacom->features->type >= INTUOS3S) { | 547 | if (features->type >= INTUOS3S) { |
543 | wacom_report_abs(wcombo, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1)); | 548 | wacom_report_abs(wcombo, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1)); |
544 | wacom_report_abs(wcombo, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1)); | 549 | wacom_report_abs(wcombo, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1)); |
545 | wacom_report_abs(wcombo, ABS_DISTANCE, ((data[9] >> 2) & 0x3f)); | 550 | wacom_report_abs(wcombo, ABS_DISTANCE, ((data[9] >> 2) & 0x3f)); |
@@ -557,7 +562,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
557 | 562 | ||
558 | if (data[1] & 0x02) { | 563 | if (data[1] & 0x02) { |
559 | /* Rotation packet */ | 564 | /* Rotation packet */ |
560 | if (wacom->features->type >= INTUOS3S) { | 565 | if (features->type >= INTUOS3S) { |
561 | /* I3 marker pen rotation */ | 566 | /* I3 marker pen rotation */ |
562 | t = (data[6] << 3) | ((data[7] >> 5) & 7); | 567 | t = (data[6] << 3) | ((data[7] >> 5) & 7); |
563 | t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : | 568 | t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : |
@@ -570,7 +575,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
570 | ((t - 1) / 2) : -t / 2); | 575 | ((t - 1) / 2) : -t / 2); |
571 | } | 576 | } |
572 | 577 | ||
573 | } else if (!(data[1] & 0x10) && wacom->features->type < INTUOS3S) { | 578 | } else if (!(data[1] & 0x10) && features->type < INTUOS3S) { |
574 | /* 4D mouse packet */ | 579 | /* 4D mouse packet */ |
575 | wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); | 580 | wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); |
576 | wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02); | 581 | wacom_report_key(wcombo, BTN_MIDDLE, data[8] & 0x02); |
@@ -583,7 +588,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
583 | 588 | ||
584 | } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) { | 589 | } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) { |
585 | /* I4 mouse */ | 590 | /* I4 mouse */ |
586 | if (wacom->features->type >= INTUOS4S && wacom->features->type <= INTUOS4L) { | 591 | if (features->type >= INTUOS4S && features->type <= INTUOS4L) { |
587 | wacom_report_key(wcombo, BTN_LEFT, data[6] & 0x01); | 592 | wacom_report_key(wcombo, BTN_LEFT, data[6] & 0x01); |
588 | wacom_report_key(wcombo, BTN_MIDDLE, data[6] & 0x02); | 593 | wacom_report_key(wcombo, BTN_MIDDLE, data[6] & 0x02); |
589 | wacom_report_key(wcombo, BTN_RIGHT, data[6] & 0x04); | 594 | wacom_report_key(wcombo, BTN_RIGHT, data[6] & 0x04); |
@@ -604,13 +609,13 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo) | |||
604 | - ((data[8] & 0x02) >> 1)); | 609 | - ((data[8] & 0x02) >> 1)); |
605 | 610 | ||
606 | /* I3 2D mouse side buttons */ | 611 | /* I3 2D mouse side buttons */ |
607 | if (wacom->features->type >= INTUOS3S && wacom->features->type <= INTUOS3L) { | 612 | if (features->type >= INTUOS3S && features->type <= INTUOS3L) { |
608 | wacom_report_key(wcombo, BTN_SIDE, data[8] & 0x40); | 613 | wacom_report_key(wcombo, BTN_SIDE, data[8] & 0x40); |
609 | wacom_report_key(wcombo, BTN_EXTRA, data[8] & 0x20); | 614 | wacom_report_key(wcombo, BTN_EXTRA, data[8] & 0x20); |
610 | } | 615 | } |
611 | } | 616 | } |
612 | } else if ((wacom->features->type < INTUOS3S || wacom->features->type == INTUOS3L || | 617 | } else if ((features->type < INTUOS3S || features->type == INTUOS3L || |
613 | wacom->features->type == INTUOS4L) && | 618 | features->type == INTUOS4L) && |
614 | wacom->tool[idx] == BTN_TOOL_LENS) { | 619 | wacom->tool[idx] == BTN_TOOL_LENS) { |
615 | /* Lens cursor packets */ | 620 | /* Lens cursor packets */ |
616 | wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); | 621 | wacom_report_key(wcombo, BTN_LEFT, data[8] & 0x01); |
@@ -718,6 +723,7 @@ static void wacom_tpc_touch_in(struct wacom_wac *wacom, void *wcombo) | |||
718 | 723 | ||
719 | static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo) | 724 | static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo) |
720 | { | 725 | { |
726 | struct wacom_features *features = &wacom->features; | ||
721 | char *data = wacom->data; | 727 | char *data = wacom->data; |
722 | int prox = 0, pressure, idx = -1; | 728 | int prox = 0, pressure, idx = -1; |
723 | static int stylusInProx, touchInProx = 1, touchOut; | 729 | static int stylusInProx, touchInProx = 1, touchOut; |
@@ -791,7 +797,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo) | |||
791 | wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4])); | 797 | wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4])); |
792 | pressure = ((data[7] & 0x01) << 8) | data[6]; | 798 | pressure = ((data[7] & 0x01) << 8) | data[6]; |
793 | if (pressure < 0) | 799 | if (pressure < 0) |
794 | pressure = wacom->features->pressure_max + pressure + 1; | 800 | pressure = features->pressure_max + pressure + 1; |
795 | wacom_report_abs(wcombo, ABS_PRESSURE, pressure); | 801 | wacom_report_abs(wcombo, ABS_PRESSURE, pressure); |
796 | wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x05); | 802 | wacom_report_key(wcombo, BTN_TOUCH, data[1] & 0x05); |
797 | } else { | 803 | } else { |
@@ -815,7 +821,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo) | |||
815 | 821 | ||
816 | int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo) | 822 | int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo) |
817 | { | 823 | { |
818 | switch (wacom_wac->features->type) { | 824 | switch (wacom_wac->features.type) { |
819 | case PENPARTNER: | 825 | case PENPARTNER: |
820 | return wacom_penpartner_irq(wacom_wac, wcombo); | 826 | return wacom_penpartner_irq(wacom_wac, wcombo); |
821 | 827 | ||
@@ -853,7 +859,7 @@ int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo) | |||
853 | 859 | ||
854 | void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 860 | void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
855 | { | 861 | { |
856 | switch (wacom_wac->features->type) { | 862 | switch (wacom_wac->features.type) { |
857 | case WACOM_MO: | 863 | case WACOM_MO: |
858 | input_dev_mo(input_dev, wacom_wac); | 864 | input_dev_mo(input_dev, wacom_wac); |
859 | case WACOM_G4: | 865 | case WACOM_G4: |
@@ -888,7 +894,7 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w | |||
888 | /* fall through */ | 894 | /* fall through */ |
889 | case TABLETPC: | 895 | case TABLETPC: |
890 | input_dev_tpc(input_dev, wacom_wac); | 896 | input_dev_tpc(input_dev, wacom_wac); |
891 | if (wacom_wac->features->device_type != BTN_TOOL_PEN) | 897 | if (wacom_wac->features.device_type != BTN_TOOL_PEN) |
892 | break; /* no need to process stylus stuff */ | 898 | break; /* no need to process stylus stuff */ |
893 | 899 | ||
894 | /* fall through */ | 900 | /* fall through */ |
@@ -903,153 +909,201 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w | |||
903 | return; | 909 | return; |
904 | } | 910 | } |
905 | 911 | ||
906 | static struct wacom_features wacom_features[] = { | 912 | static const struct wacom_features wacom_features_0x00 = |
907 | { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255, 0, PENPARTNER }, | 913 | { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255, 0, PENPARTNER }; |
908 | { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }, | 914 | static const struct wacom_features wacom_features_0x10 = |
909 | { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }, | 915 | { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }; |
910 | { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511, 63, GRAPHIRE }, | 916 | static const struct wacom_features wacom_features_0x11 = |
911 | { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, GRAPHIRE }, | 917 | { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, 63, GRAPHIRE }; |
912 | { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }, | 918 | static const struct wacom_features wacom_features_0x12 = |
913 | { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, WACOM_G4 }, | 919 | { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511, 63, GRAPHIRE }; |
914 | { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, WACOM_G4 }, | 920 | static const struct wacom_features wacom_features_0x13 = |
915 | { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }, | 921 | { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, GRAPHIRE }; |
916 | { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511, 63, WACOM_MO }, | 922 | static const struct wacom_features wacom_features_0x14 = |
917 | { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }, | 923 | { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }; |
918 | { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }, | 924 | static const struct wacom_features wacom_features_0x15 = |
919 | { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255, 63, GRAPHIRE }, | 925 | { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, 63, WACOM_G4 }; |
920 | { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }, | 926 | static const struct wacom_features wacom_features_0x16 = |
921 | { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511, 63, GRAPHIRE }, | 927 | { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, WACOM_G4 }; |
922 | { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511, 63, GRAPHIRE }, | 928 | static const struct wacom_features wacom_features_0x17 = |
923 | { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }, | 929 | { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }; |
924 | { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }, | 930 | static const struct wacom_features wacom_features_0x18 = |
925 | { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS }, | 931 | { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511, 63, WACOM_MO }; |
926 | { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }, | 932 | static const struct wacom_features wacom_features_0x19 = |
927 | { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS }, | 933 | { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, 63, GRAPHIRE }; |
928 | { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS }, | 934 | static const struct wacom_features wacom_features_0x60 = |
929 | { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS }, | 935 | { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; |
930 | { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255, 0, PL }, | 936 | static const struct wacom_features wacom_features_0x61 = |
931 | { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255, 0, PL }, | 937 | { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255, 63, GRAPHIRE }; |
932 | { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255, 0, PL }, | 938 | static const struct wacom_features wacom_features_0x62 = |
933 | { "Wacom PL600SX", WACOM_PKGLEN_GRAPHIRE, 6260, 5016, 255, 0, PL }, | 939 | { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; |
934 | { "Wacom PL550", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 511, 0, PL }, | 940 | static const struct wacom_features wacom_features_0x63 = |
935 | { "Wacom PL800", WACOM_PKGLEN_GRAPHIRE, 7220, 5780, 511, 0, PL }, | 941 | { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511, 63, GRAPHIRE }; |
936 | { "Wacom PL700", WACOM_PKGLEN_GRAPHIRE, 6758, 5406, 511, 0, PL }, | 942 | static const struct wacom_features wacom_features_0x64 = |
937 | { "Wacom PL510", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL }, | 943 | { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511, 63, GRAPHIRE }; |
938 | { "Wacom DTU710", WACOM_PKGLEN_GRAPHIRE, 34080, 27660, 511, 0, PL }, | 944 | static const struct wacom_features wacom_features_0x65 = |
939 | { "Wacom DTF521", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL }, | 945 | { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, 63, WACOM_MO }; |
940 | { "Wacom DTF720", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL }, | 946 | static const struct wacom_features wacom_features_0x69 = |
941 | { "Wacom DTF720a", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL }, | 947 | { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, 63, GRAPHIRE }; |
942 | { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE, 20480, 15360, 511, 0, PTU }, | 948 | static const struct wacom_features wacom_features_0x20 = |
943 | { "Wacom Intuos2 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS }, | 949 | { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS }; |
944 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }, | 950 | static const struct wacom_features wacom_features_0x21 = |
945 | { "Wacom Intuos2 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS }, | 951 | { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; |
946 | { "Wacom Intuos2 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS }, | 952 | static const struct wacom_features wacom_features_0x22 = |
947 | { "Wacom Intuos2 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS }, | 953 | { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS }; |
948 | { "Wacom Intuos3 4x5", WACOM_PKGLEN_INTUOS, 25400, 20320, 1023, 63, INTUOS3S }, | 954 | static const struct wacom_features wacom_features_0x23 = |
949 | { "Wacom Intuos3 6x8", WACOM_PKGLEN_INTUOS, 40640, 30480, 1023, 63, INTUOS3 }, | 955 | { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS }; |
950 | { "Wacom Intuos3 9x12", WACOM_PKGLEN_INTUOS, 60960, 45720, 1023, 63, INTUOS3 }, | 956 | static const struct wacom_features wacom_features_0x24 = |
951 | { "Wacom Intuos3 12x12", WACOM_PKGLEN_INTUOS, 60960, 60960, 1023, 63, INTUOS3L }, | 957 | { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS }; |
952 | { "Wacom Intuos3 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 1023, 63, INTUOS3L }, | 958 | static const struct wacom_features wacom_features_0x30 = |
953 | { "Wacom Intuos3 6x11", WACOM_PKGLEN_INTUOS, 54204, 31750, 1023, 63, INTUOS3 }, | 959 | { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255, 0, PL }; |
954 | { "Wacom Intuos3 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 1023, 63, INTUOS3S }, | 960 | static const struct wacom_features wacom_features_0x31 = |
955 | { "Wacom Intuos4 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, 63, INTUOS4S }, | 961 | { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255, 0, PL }; |
956 | { "Wacom Intuos4 6x9", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, 63, INTUOS4 }, | 962 | static const struct wacom_features wacom_features_0x32 = |
957 | { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, 63, INTUOS4L }, | 963 | { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255, 0, PL }; |
958 | { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, 63, INTUOS4L }, | 964 | static const struct wacom_features wacom_features_0x33 = |
959 | { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, 63, CINTIQ }, | 965 | { "Wacom PL600SX", WACOM_PKGLEN_GRAPHIRE, 6260, 5016, 255, 0, PL }; |
960 | { "Wacom Cintiq 20WSX", WACOM_PKGLEN_INTUOS, 86680, 54180, 1023, 63, WACOM_BEE }, | 966 | static const struct wacom_features wacom_features_0x34 = |
961 | { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023, 63, WACOM_BEE }, | 967 | { "Wacom PL550", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 511, 0, PL }; |
962 | { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511, 0, PL }, | 968 | static const struct wacom_features wacom_features_0x35 = |
963 | { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }, | 969 | { "Wacom PL800", WACOM_PKGLEN_GRAPHIRE, 7220, 5780, 511, 0, PL }; |
964 | { "Wacom ISDv4 93", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }, | 970 | static const struct wacom_features wacom_features_0x37 = |
965 | { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }, | 971 | { "Wacom PL700", WACOM_PKGLEN_GRAPHIRE, 6758, 5406, 511, 0, PL }; |
966 | { "Wacom ISDv4 9F", WACOM_PKGLEN_PENABLED, 26202, 16325, 255, 0, TABLETPC }, | 972 | static const struct wacom_features wacom_features_0x38 = |
967 | { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }, | 973 | { "Wacom PL510", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL }; |
968 | { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }, | 974 | static const struct wacom_features wacom_features_0x39 = |
969 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }, | 975 | { "Wacom DTU710", WACOM_PKGLEN_GRAPHIRE, 34080, 27660, 511, 0, PL }; |
976 | static const struct wacom_features wacom_features_0xC4 = | ||
977 | { "Wacom DTF521", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, 0, PL }; | ||
978 | static const struct wacom_features wacom_features_0xC0 = | ||
979 | { "Wacom DTF720", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL }; | ||
980 | static const struct wacom_features wacom_features_0xC2 = | ||
981 | { "Wacom DTF720a", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, 0, PL }; | ||
982 | static const struct wacom_features wacom_features_0x03 = | ||
983 | { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE, 20480, 15360, 511, 0, PTU }; | ||
984 | static const struct wacom_features wacom_features_0x41 = | ||
985 | { "Wacom Intuos2 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, 31, INTUOS }; | ||
986 | static const struct wacom_features wacom_features_0x42 = | ||
987 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; | ||
988 | static const struct wacom_features wacom_features_0x43 = | ||
989 | { "Wacom Intuos2 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, 31, INTUOS }; | ||
990 | static const struct wacom_features wacom_features_0x44 = | ||
991 | { "Wacom Intuos2 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, 31, INTUOS }; | ||
992 | static const struct wacom_features wacom_features_0x45 = | ||
993 | { "Wacom Intuos2 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, 31, INTUOS }; | ||
994 | static const struct wacom_features wacom_features_0xB0 = | ||
995 | { "Wacom Intuos3 4x5", WACOM_PKGLEN_INTUOS, 25400, 20320, 1023, 63, INTUOS3S }; | ||
996 | static const struct wacom_features wacom_features_0xB1 = | ||
997 | { "Wacom Intuos3 6x8", WACOM_PKGLEN_INTUOS, 40640, 30480, 1023, 63, INTUOS3 }; | ||
998 | static const struct wacom_features wacom_features_0xB2 = | ||
999 | { "Wacom Intuos3 9x12", WACOM_PKGLEN_INTUOS, 60960, 45720, 1023, 63, INTUOS3 }; | ||
1000 | static const struct wacom_features wacom_features_0xB3 = | ||
1001 | { "Wacom Intuos3 12x12", WACOM_PKGLEN_INTUOS, 60960, 60960, 1023, 63, INTUOS3L }; | ||
1002 | static const struct wacom_features wacom_features_0xB4 = | ||
1003 | { "Wacom Intuos3 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 1023, 63, INTUOS3L }; | ||
1004 | static const struct wacom_features wacom_features_0xB5 = | ||
1005 | { "Wacom Intuos3 6x11", WACOM_PKGLEN_INTUOS, 54204, 31750, 1023, 63, INTUOS3 }; | ||
1006 | static const struct wacom_features wacom_features_0xB7 = | ||
1007 | { "Wacom Intuos3 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 1023, 63, INTUOS3S }; | ||
1008 | static const struct wacom_features wacom_features_0xB8 = | ||
1009 | { "Wacom Intuos4 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, 63, INTUOS4S }; | ||
1010 | static const struct wacom_features wacom_features_0xB9 = | ||
1011 | { "Wacom Intuos4 6x9", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, 63, INTUOS4 }; | ||
1012 | static const struct wacom_features wacom_features_0xBA = | ||
1013 | { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, 63, INTUOS4L }; | ||
1014 | static const struct wacom_features wacom_features_0xBB = | ||
1015 | { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, 63, INTUOS4L }; | ||
1016 | static const struct wacom_features wacom_features_0x3F = | ||
1017 | { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, 63, CINTIQ }; | ||
1018 | static const struct wacom_features wacom_features_0xC5 = | ||
1019 | { "Wacom Cintiq 20WSX", WACOM_PKGLEN_INTUOS, 86680, 54180, 1023, 63, WACOM_BEE }; | ||
1020 | static const struct wacom_features wacom_features_0xC6 = | ||
1021 | { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023, 63, WACOM_BEE }; | ||
1022 | static const struct wacom_features wacom_features_0xC7 = | ||
1023 | { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511, 0, PL }; | ||
1024 | static const struct wacom_features wacom_features_0x90 = | ||
1025 | { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; | ||
1026 | static const struct wacom_features wacom_features_0x93 = | ||
1027 | { "Wacom ISDv4 93", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; | ||
1028 | static const struct wacom_features wacom_features_0x9A = | ||
1029 | { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, 0, TABLETPC }; | ||
1030 | static const struct wacom_features wacom_features_0x9F = | ||
1031 | { "Wacom ISDv4 9F", WACOM_PKGLEN_PENABLED, 26202, 16325, 255, 0, TABLETPC }; | ||
1032 | static const struct wacom_features wacom_features_0xE2 = | ||
1033 | { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }; | ||
1034 | static const struct wacom_features wacom_features_0xE3 = | ||
1035 | { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, 0, TABLETPC2FG }; | ||
1036 | static const struct wacom_features wacom_features_0x47 = | ||
1037 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS }; | ||
1038 | |||
1039 | #define USB_DEVICE_WACOM(prod) \ | ||
1040 | USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \ | ||
1041 | .driver_info = (kernel_ulong_t)&wacom_features_##prod | ||
1042 | |||
1043 | const struct usb_device_id wacom_ids[] = { | ||
1044 | { USB_DEVICE_WACOM(0x00) }, | ||
1045 | { USB_DEVICE_WACOM(0x10) }, | ||
1046 | { USB_DEVICE_WACOM(0x11) }, | ||
1047 | { USB_DEVICE_WACOM(0x12) }, | ||
1048 | { USB_DEVICE_WACOM(0x13) }, | ||
1049 | { USB_DEVICE_WACOM(0x14) }, | ||
1050 | { USB_DEVICE_WACOM(0x15) }, | ||
1051 | { USB_DEVICE_WACOM(0x16) }, | ||
1052 | { USB_DEVICE_WACOM(0x17) }, | ||
1053 | { USB_DEVICE_WACOM(0x18) }, | ||
1054 | { USB_DEVICE_WACOM(0x19) }, | ||
1055 | { USB_DEVICE_WACOM(0x60) }, | ||
1056 | { USB_DEVICE_WACOM(0x61) }, | ||
1057 | { USB_DEVICE_WACOM(0x62) }, | ||
1058 | { USB_DEVICE_WACOM(0x63) }, | ||
1059 | { USB_DEVICE_WACOM(0x64) }, | ||
1060 | { USB_DEVICE_WACOM(0x65) }, | ||
1061 | { USB_DEVICE_WACOM(0x69) }, | ||
1062 | { USB_DEVICE_WACOM(0x20) }, | ||
1063 | { USB_DEVICE_WACOM(0x21) }, | ||
1064 | { USB_DEVICE_WACOM(0x22) }, | ||
1065 | { USB_DEVICE_WACOM(0x23) }, | ||
1066 | { USB_DEVICE_WACOM(0x24) }, | ||
1067 | { USB_DEVICE_WACOM(0x30) }, | ||
1068 | { USB_DEVICE_WACOM(0x31) }, | ||
1069 | { USB_DEVICE_WACOM(0x32) }, | ||
1070 | { USB_DEVICE_WACOM(0x33) }, | ||
1071 | { USB_DEVICE_WACOM(0x34) }, | ||
1072 | { USB_DEVICE_WACOM(0x35) }, | ||
1073 | { USB_DEVICE_WACOM(0x37) }, | ||
1074 | { USB_DEVICE_WACOM(0x38) }, | ||
1075 | { USB_DEVICE_WACOM(0x39) }, | ||
1076 | { USB_DEVICE_WACOM(0xC4) }, | ||
1077 | { USB_DEVICE_WACOM(0xC0) }, | ||
1078 | { USB_DEVICE_WACOM(0xC2) }, | ||
1079 | { USB_DEVICE_WACOM(0x03) }, | ||
1080 | { USB_DEVICE_WACOM(0x41) }, | ||
1081 | { USB_DEVICE_WACOM(0x42) }, | ||
1082 | { USB_DEVICE_WACOM(0x43) }, | ||
1083 | { USB_DEVICE_WACOM(0x44) }, | ||
1084 | { USB_DEVICE_WACOM(0x45) }, | ||
1085 | { USB_DEVICE_WACOM(0xB0) }, | ||
1086 | { USB_DEVICE_WACOM(0xB1) }, | ||
1087 | { USB_DEVICE_WACOM(0xB2) }, | ||
1088 | { USB_DEVICE_WACOM(0xB3) }, | ||
1089 | { USB_DEVICE_WACOM(0xB4) }, | ||
1090 | { USB_DEVICE_WACOM(0xB5) }, | ||
1091 | { USB_DEVICE_WACOM(0xB7) }, | ||
1092 | { USB_DEVICE_WACOM(0xB8) }, | ||
1093 | { USB_DEVICE_WACOM(0xB9) }, | ||
1094 | { USB_DEVICE_WACOM(0xBA) }, | ||
1095 | { USB_DEVICE_WACOM(0xBB) }, | ||
1096 | { USB_DEVICE_WACOM(0x3F) }, | ||
1097 | { USB_DEVICE_WACOM(0xC5) }, | ||
1098 | { USB_DEVICE_WACOM(0xC6) }, | ||
1099 | { USB_DEVICE_WACOM(0xC7) }, | ||
1100 | { USB_DEVICE_WACOM(0x90) }, | ||
1101 | { USB_DEVICE_WACOM(0x93) }, | ||
1102 | { USB_DEVICE_WACOM(0x9A) }, | ||
1103 | { USB_DEVICE_WACOM(0x9F) }, | ||
1104 | { USB_DEVICE_WACOM(0xE2) }, | ||
1105 | { USB_DEVICE_WACOM(0xE3) }, | ||
1106 | { USB_DEVICE_WACOM(0x47) }, | ||
970 | { } | 1107 | { } |
971 | }; | 1108 | }; |
972 | |||
973 | static struct usb_device_id wacom_ids[] = { | ||
974 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x00) }, | ||
975 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x10) }, | ||
976 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x11) }, | ||
977 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x12) }, | ||
978 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x13) }, | ||
979 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x14) }, | ||
980 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x15) }, | ||
981 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x16) }, | ||
982 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x17) }, | ||
983 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x18) }, | ||
984 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x19) }, | ||
985 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x60) }, | ||
986 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x61) }, | ||
987 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x62) }, | ||
988 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x63) }, | ||
989 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x64) }, | ||
990 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x65) }, | ||
991 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x69) }, | ||
992 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x20) }, | ||
993 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x21) }, | ||
994 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x22) }, | ||
995 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x23) }, | ||
996 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x24) }, | ||
997 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x30) }, | ||
998 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x31) }, | ||
999 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x32) }, | ||
1000 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x33) }, | ||
1001 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x34) }, | ||
1002 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x35) }, | ||
1003 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x37) }, | ||
1004 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x38) }, | ||
1005 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x39) }, | ||
1006 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC4) }, | ||
1007 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC0) }, | ||
1008 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC2) }, | ||
1009 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) }, | ||
1010 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41) }, | ||
1011 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42) }, | ||
1012 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x43) }, | ||
1013 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x44) }, | ||
1014 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x45) }, | ||
1015 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB0) }, | ||
1016 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB1) }, | ||
1017 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB2) }, | ||
1018 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB3) }, | ||
1019 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB4) }, | ||
1020 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) }, | ||
1021 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB7) }, | ||
1022 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB8) }, | ||
1023 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB9) }, | ||
1024 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xBA) }, | ||
1025 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xBB) }, | ||
1026 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, | ||
1027 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC5) }, | ||
1028 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC6) }, | ||
1029 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC7) }, | ||
1030 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x90) }, | ||
1031 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x93) }, | ||
1032 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x9A) }, | ||
1033 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x9F) }, | ||
1034 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xE2) }, | ||
1035 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xE3) }, | ||
1036 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, | ||
1037 | { } | ||
1038 | }; | ||
1039 | |||
1040 | const struct usb_device_id *get_device_table(void) | ||
1041 | { | ||
1042 | const struct usb_device_id *id_table = wacom_ids; | ||
1043 | |||
1044 | return id_table; | ||
1045 | } | ||
1046 | |||
1047 | struct wacom_features * get_wacom_feature(const struct usb_device_id *id) | ||
1048 | { | ||
1049 | int index = id - wacom_ids; | ||
1050 | struct wacom_features *wf = &wacom_features[index]; | ||
1051 | |||
1052 | return wf; | ||
1053 | } | ||
1054 | |||
1055 | MODULE_DEVICE_TABLE(usb, wacom_ids); | 1109 | MODULE_DEVICE_TABLE(usb, wacom_ids); |
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index ee01e1902785..8590b1e8ec37 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h | |||
@@ -15,11 +15,11 @@ | |||
15 | /* packet length for individual models */ | 15 | /* packet length for individual models */ |
16 | #define WACOM_PKGLEN_PENPRTN 7 | 16 | #define WACOM_PKGLEN_PENPRTN 7 |
17 | #define WACOM_PKGLEN_GRAPHIRE 8 | 17 | #define WACOM_PKGLEN_GRAPHIRE 8 |
18 | #define WACOM_PKGLEN_BBFUN 9 | 18 | #define WACOM_PKGLEN_BBFUN 9 |
19 | #define WACOM_PKGLEN_INTUOS 10 | 19 | #define WACOM_PKGLEN_INTUOS 10 |
20 | #define WACOM_PKGLEN_PENABLED 8 | 20 | #define WACOM_PKGLEN_PENABLED 8 |
21 | #define WACOM_PKGLEN_TPC1FG 5 | 21 | #define WACOM_PKGLEN_TPC1FG 5 |
22 | #define WACOM_PKGLEN_TPC2FG 14 | 22 | #define WACOM_PKGLEN_TPC2FG 14 |
23 | 23 | ||
24 | /* device IDs */ | 24 | /* device IDs */ |
25 | #define STYLUS_DEVICE_ID 0x02 | 25 | #define STYLUS_DEVICE_ID 0x02 |
@@ -58,7 +58,7 @@ enum { | |||
58 | }; | 58 | }; |
59 | 59 | ||
60 | struct wacom_features { | 60 | struct wacom_features { |
61 | char *name; | 61 | const char *name; |
62 | int pktlen; | 62 | int pktlen; |
63 | int x_max; | 63 | int x_max; |
64 | int y_max; | 64 | int y_max; |
@@ -73,11 +73,12 @@ struct wacom_features { | |||
73 | }; | 73 | }; |
74 | 74 | ||
75 | struct wacom_wac { | 75 | struct wacom_wac { |
76 | char name[64]; | ||
76 | unsigned char *data; | 77 | unsigned char *data; |
77 | int tool[2]; | 78 | int tool[2]; |
78 | int id[2]; | 79 | int id[2]; |
79 | __u32 serial[2]; | 80 | __u32 serial[2]; |
80 | struct wacom_features *features; | 81 | struct wacom_features features; |
81 | }; | 82 | }; |
82 | 83 | ||
83 | #endif | 84 | #endif |
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index dfafc76da4fb..6457e060ae49 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
@@ -90,7 +90,6 @@ config TOUCHSCREEN_CORGI | |||
90 | tristate "SharpSL (Corgi and Spitz series) touchscreen driver (DEPRECATED)" | 90 | tristate "SharpSL (Corgi and Spitz series) touchscreen driver (DEPRECATED)" |
91 | depends on PXA_SHARPSL | 91 | depends on PXA_SHARPSL |
92 | select CORGI_SSP_DEPRECATED | 92 | select CORGI_SSP_DEPRECATED |
93 | default y | ||
94 | help | 93 | help |
95 | Say Y here to enable the driver for the touchscreen on the | 94 | Say Y here to enable the driver for the touchscreen on the |
96 | Sharp SL-C7xx and SL-Cxx00 series of PDAs. | 95 | Sharp SL-C7xx and SL-Cxx00 series of PDAs. |
@@ -537,6 +536,11 @@ config TOUCHSCREEN_USB_ETT_TC5UH | |||
537 | bool "ET&T TC5UH touchscreen controler support" if EMBEDDED | 536 | bool "ET&T TC5UH touchscreen controler support" if EMBEDDED |
538 | depends on TOUCHSCREEN_USB_COMPOSITE | 537 | depends on TOUCHSCREEN_USB_COMPOSITE |
539 | 538 | ||
539 | config TOUCHSCREEN_USB_NEXIO | ||
540 | default y | ||
541 | bool "NEXIO/iNexio device support" if EMBEDDED | ||
542 | depends on TOUCHSCREEN_USB_COMPOSITE | ||
543 | |||
540 | config TOUCHSCREEN_TOUCHIT213 | 544 | config TOUCHSCREEN_TOUCHIT213 |
541 | tristate "Sahara TouchIT-213 touchscreen" | 545 | tristate "Sahara TouchIT-213 touchscreen" |
542 | select SERIO | 546 | select SERIO |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 52d2ca147d8f..8b05d8e97543 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/gpio.h> | 27 | #include <linux/gpio.h> |
28 | #include <linux/spi/spi.h> | 28 | #include <linux/spi/spi.h> |
29 | #include <linux/spi/ads7846.h> | 29 | #include <linux/spi/ads7846.h> |
30 | #include <linux/regulator/consumer.h> | ||
30 | #include <asm/irq.h> | 31 | #include <asm/irq.h> |
31 | 32 | ||
32 | /* | 33 | /* |
@@ -85,6 +86,7 @@ struct ads7846 { | |||
85 | char name[32]; | 86 | char name[32]; |
86 | 87 | ||
87 | struct spi_device *spi; | 88 | struct spi_device *spi; |
89 | struct regulator *reg; | ||
88 | 90 | ||
89 | #if defined(CONFIG_HWMON) || defined(CONFIG_HWMON_MODULE) | 91 | #if defined(CONFIG_HWMON) || defined(CONFIG_HWMON_MODULE) |
90 | struct attribute_group *attr_group; | 92 | struct attribute_group *attr_group; |
@@ -788,6 +790,8 @@ static void ads7846_disable(struct ads7846 *ts) | |||
788 | } | 790 | } |
789 | } | 791 | } |
790 | 792 | ||
793 | regulator_disable(ts->reg); | ||
794 | |||
791 | /* we know the chip's in lowpower mode since we always | 795 | /* we know the chip's in lowpower mode since we always |
792 | * leave it that way after every request | 796 | * leave it that way after every request |
793 | */ | 797 | */ |
@@ -799,6 +803,8 @@ static void ads7846_enable(struct ads7846 *ts) | |||
799 | if (!ts->disabled) | 803 | if (!ts->disabled) |
800 | return; | 804 | return; |
801 | 805 | ||
806 | regulator_enable(ts->reg); | ||
807 | |||
802 | ts->disabled = 0; | 808 | ts->disabled = 0; |
803 | ts->irq_disabled = 0; | 809 | ts->irq_disabled = 0; |
804 | enable_irq(ts->spi->irq); | 810 | enable_irq(ts->spi->irq); |
@@ -1139,6 +1145,19 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
1139 | 1145 | ||
1140 | ts->last_msg = m; | 1146 | ts->last_msg = m; |
1141 | 1147 | ||
1148 | ts->reg = regulator_get(&spi->dev, "vcc"); | ||
1149 | if (IS_ERR(ts->reg)) { | ||
1150 | dev_err(&spi->dev, "unable to get regulator: %ld\n", | ||
1151 | PTR_ERR(ts->reg)); | ||
1152 | goto err_free_gpio; | ||
1153 | } | ||
1154 | |||
1155 | err = regulator_enable(ts->reg); | ||
1156 | if (err) { | ||
1157 | dev_err(&spi->dev, "unable to enable regulator: %d\n", err); | ||
1158 | goto err_put_regulator; | ||
1159 | } | ||
1160 | |||
1142 | if (request_irq(spi->irq, ads7846_irq, IRQF_TRIGGER_FALLING, | 1161 | if (request_irq(spi->irq, ads7846_irq, IRQF_TRIGGER_FALLING, |
1143 | spi->dev.driver->name, ts)) { | 1162 | spi->dev.driver->name, ts)) { |
1144 | dev_info(&spi->dev, | 1163 | dev_info(&spi->dev, |
@@ -1148,7 +1167,7 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
1148 | spi->dev.driver->name, ts); | 1167 | spi->dev.driver->name, ts); |
1149 | if (err) { | 1168 | if (err) { |
1150 | dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); | 1169 | dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); |
1151 | goto err_free_gpio; | 1170 | goto err_disable_regulator; |
1152 | } | 1171 | } |
1153 | } | 1172 | } |
1154 | 1173 | ||
@@ -1180,6 +1199,10 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
1180 | ads784x_hwmon_unregister(spi, ts); | 1199 | ads784x_hwmon_unregister(spi, ts); |
1181 | err_free_irq: | 1200 | err_free_irq: |
1182 | free_irq(spi->irq, ts); | 1201 | free_irq(spi->irq, ts); |
1202 | err_disable_regulator: | ||
1203 | regulator_disable(ts->reg); | ||
1204 | err_put_regulator: | ||
1205 | regulator_put(ts->reg); | ||
1183 | err_free_gpio: | 1206 | err_free_gpio: |
1184 | if (ts->gpio_pendown != -1) | 1207 | if (ts->gpio_pendown != -1) |
1185 | gpio_free(ts->gpio_pendown); | 1208 | gpio_free(ts->gpio_pendown); |
@@ -1208,6 +1231,9 @@ static int __devexit ads7846_remove(struct spi_device *spi) | |||
1208 | /* suspend left the IRQ disabled */ | 1231 | /* suspend left the IRQ disabled */ |
1209 | enable_irq(ts->spi->irq); | 1232 | enable_irq(ts->spi->irq); |
1210 | 1233 | ||
1234 | regulator_disable(ts->reg); | ||
1235 | regulator_put(ts->reg); | ||
1236 | |||
1211 | if (ts->gpio_pendown != -1) | 1237 | if (ts->gpio_pendown != -1) |
1212 | gpio_free(ts->gpio_pendown); | 1238 | gpio_free(ts->gpio_pendown); |
1213 | 1239 | ||
diff --git a/drivers/input/touchscreen/elo.c b/drivers/input/touchscreen/elo.c index 8f38c5e55ce6..486d31ba9c09 100644 --- a/drivers/input/touchscreen/elo.c +++ b/drivers/input/touchscreen/elo.c | |||
@@ -72,45 +72,49 @@ static void elo_process_data_10(struct elo *elo, unsigned char data) | |||
72 | struct input_dev *dev = elo->dev; | 72 | struct input_dev *dev = elo->dev; |
73 | 73 | ||
74 | elo->data[elo->idx] = data; | 74 | elo->data[elo->idx] = data; |
75 | switch (elo->idx++) { | ||
76 | case 0: | ||
77 | elo->csum = 0xaa; | ||
78 | if (data != ELO10_LEAD_BYTE) { | ||
79 | pr_debug("elo: unsynchronized data: 0x%02x\n", data); | ||
80 | elo->idx = 0; | ||
81 | } | ||
82 | break; | ||
83 | 75 | ||
84 | case 9: | 76 | switch (elo->idx++) { |
77 | case 0: | ||
78 | elo->csum = 0xaa; | ||
79 | if (data != ELO10_LEAD_BYTE) { | ||
80 | dev_dbg(&elo->serio->dev, | ||
81 | "unsynchronized data: 0x%02x\n", data); | ||
85 | elo->idx = 0; | 82 | elo->idx = 0; |
86 | if (data != elo->csum) { | 83 | } |
87 | pr_debug("elo: bad checksum: 0x%02x, expected 0x%02x\n", | 84 | break; |
88 | data, elo->csum); | 85 | |
89 | break; | 86 | case 9: |
90 | } | 87 | elo->idx = 0; |
91 | if (elo->data[1] != elo->expected_packet) { | 88 | if (data != elo->csum) { |
92 | if (elo->data[1] != ELO10_TOUCH_PACKET) | 89 | dev_dbg(&elo->serio->dev, |
93 | pr_debug("elo: unexpected packet: 0x%02x\n", | 90 | "bad checksum: 0x%02x, expected 0x%02x\n", |
94 | elo->data[1]); | 91 | data, elo->csum); |
95 | break; | 92 | break; |
96 | } | 93 | } |
97 | if (likely(elo->data[1] == ELO10_TOUCH_PACKET)) { | 94 | if (elo->data[1] != elo->expected_packet) { |
98 | input_report_abs(dev, ABS_X, (elo->data[4] << 8) | elo->data[3]); | 95 | if (elo->data[1] != ELO10_TOUCH_PACKET) |
99 | input_report_abs(dev, ABS_Y, (elo->data[6] << 8) | elo->data[5]); | 96 | dev_dbg(&elo->serio->dev, |
100 | if (elo->data[2] & ELO10_PRESSURE) | 97 | "unexpected packet: 0x%02x\n", |
101 | input_report_abs(dev, ABS_PRESSURE, | 98 | elo->data[1]); |
102 | (elo->data[8] << 8) | elo->data[7]); | ||
103 | input_report_key(dev, BTN_TOUCH, elo->data[2] & ELO10_TOUCH); | ||
104 | input_sync(dev); | ||
105 | } else if (elo->data[1] == ELO10_ACK_PACKET) { | ||
106 | if (elo->data[2] == '0') | ||
107 | elo->expected_packet = ELO10_TOUCH_PACKET; | ||
108 | complete(&elo->cmd_done); | ||
109 | } else { | ||
110 | memcpy(elo->response, &elo->data[1], ELO10_PACKET_LEN); | ||
111 | elo->expected_packet = ELO10_ACK_PACKET; | ||
112 | } | ||
113 | break; | 99 | break; |
100 | } | ||
101 | if (likely(elo->data[1] == ELO10_TOUCH_PACKET)) { | ||
102 | input_report_abs(dev, ABS_X, (elo->data[4] << 8) | elo->data[3]); | ||
103 | input_report_abs(dev, ABS_Y, (elo->data[6] << 8) | elo->data[5]); | ||
104 | if (elo->data[2] & ELO10_PRESSURE) | ||
105 | input_report_abs(dev, ABS_PRESSURE, | ||
106 | (elo->data[8] << 8) | elo->data[7]); | ||
107 | input_report_key(dev, BTN_TOUCH, elo->data[2] & ELO10_TOUCH); | ||
108 | input_sync(dev); | ||
109 | } else if (elo->data[1] == ELO10_ACK_PACKET) { | ||
110 | if (elo->data[2] == '0') | ||
111 | elo->expected_packet = ELO10_TOUCH_PACKET; | ||
112 | complete(&elo->cmd_done); | ||
113 | } else { | ||
114 | memcpy(elo->response, &elo->data[1], ELO10_PACKET_LEN); | ||
115 | elo->expected_packet = ELO10_ACK_PACKET; | ||
116 | } | ||
117 | break; | ||
114 | } | 118 | } |
115 | elo->csum += data; | 119 | elo->csum += data; |
116 | } | 120 | } |
@@ -123,42 +127,53 @@ static void elo_process_data_6(struct elo *elo, unsigned char data) | |||
123 | 127 | ||
124 | switch (elo->idx++) { | 128 | switch (elo->idx++) { |
125 | 129 | ||
126 | case 0: if ((data & 0xc0) != 0xc0) elo->idx = 0; break; | 130 | case 0: |
127 | case 1: if ((data & 0xc0) != 0x80) elo->idx = 0; break; | 131 | if ((data & 0xc0) != 0xc0) |
128 | case 2: if ((data & 0xc0) != 0x40) elo->idx = 0; break; | 132 | elo->idx = 0; |
129 | 133 | break; | |
130 | case 3: | ||
131 | if (data & 0xc0) { | ||
132 | elo->idx = 0; | ||
133 | break; | ||
134 | } | ||
135 | 134 | ||
136 | input_report_abs(dev, ABS_X, ((elo->data[0] & 0x3f) << 6) | (elo->data[1] & 0x3f)); | 135 | case 1: |
137 | input_report_abs(dev, ABS_Y, ((elo->data[2] & 0x3f) << 6) | (elo->data[3] & 0x3f)); | 136 | if ((data & 0xc0) != 0x80) |
137 | elo->idx = 0; | ||
138 | break; | ||
138 | 139 | ||
139 | if (elo->id == 2) { | 140 | case 2: |
140 | input_report_key(dev, BTN_TOUCH, 1); | 141 | if ((data & 0xc0) != 0x40) |
141 | input_sync(dev); | 142 | elo->idx = 0; |
142 | elo->idx = 0; | 143 | break; |
143 | } | ||
144 | 144 | ||
145 | case 3: | ||
146 | if (data & 0xc0) { | ||
147 | elo->idx = 0; | ||
145 | break; | 148 | break; |
149 | } | ||
146 | 150 | ||
147 | case 4: | 151 | input_report_abs(dev, ABS_X, ((elo->data[0] & 0x3f) << 6) | (elo->data[1] & 0x3f)); |
148 | if (data) { | 152 | input_report_abs(dev, ABS_Y, ((elo->data[2] & 0x3f) << 6) | (elo->data[3] & 0x3f)); |
149 | input_sync(dev); | ||
150 | elo->idx = 0; | ||
151 | } | ||
152 | break; | ||
153 | 153 | ||
154 | case 5: | 154 | if (elo->id == 2) { |
155 | if ((data & 0xf0) == 0) { | 155 | input_report_key(dev, BTN_TOUCH, 1); |
156 | input_report_abs(dev, ABS_PRESSURE, elo->data[5]); | ||
157 | input_report_key(dev, BTN_TOUCH, !!elo->data[5]); | ||
158 | } | ||
159 | input_sync(dev); | 156 | input_sync(dev); |
160 | elo->idx = 0; | 157 | elo->idx = 0; |
161 | break; | 158 | } |
159 | |||
160 | break; | ||
161 | |||
162 | case 4: | ||
163 | if (data) { | ||
164 | input_sync(dev); | ||
165 | elo->idx = 0; | ||
166 | } | ||
167 | break; | ||
168 | |||
169 | case 5: | ||
170 | if ((data & 0xf0) == 0) { | ||
171 | input_report_abs(dev, ABS_PRESSURE, elo->data[5]); | ||
172 | input_report_key(dev, BTN_TOUCH, !!elo->data[5]); | ||
173 | } | ||
174 | input_sync(dev); | ||
175 | elo->idx = 0; | ||
176 | break; | ||
162 | } | 177 | } |
163 | } | 178 | } |
164 | 179 | ||
@@ -170,17 +185,17 @@ static void elo_process_data_3(struct elo *elo, unsigned char data) | |||
170 | 185 | ||
171 | switch (elo->idx++) { | 186 | switch (elo->idx++) { |
172 | 187 | ||
173 | case 0: | 188 | case 0: |
174 | if ((data & 0x7f) != 0x01) | 189 | if ((data & 0x7f) != 0x01) |
175 | elo->idx = 0; | ||
176 | break; | ||
177 | case 2: | ||
178 | input_report_key(dev, BTN_TOUCH, !(elo->data[1] & 0x80)); | ||
179 | input_report_abs(dev, ABS_X, elo->data[1]); | ||
180 | input_report_abs(dev, ABS_Y, elo->data[2]); | ||
181 | input_sync(dev); | ||
182 | elo->idx = 0; | 190 | elo->idx = 0; |
183 | break; | 191 | break; |
192 | case 2: | ||
193 | input_report_key(dev, BTN_TOUCH, !(elo->data[1] & 0x80)); | ||
194 | input_report_abs(dev, ABS_X, elo->data[1]); | ||
195 | input_report_abs(dev, ABS_Y, elo->data[2]); | ||
196 | input_sync(dev); | ||
197 | elo->idx = 0; | ||
198 | break; | ||
184 | } | 199 | } |
185 | } | 200 | } |
186 | 201 | ||
@@ -189,19 +204,19 @@ static irqreturn_t elo_interrupt(struct serio *serio, | |||
189 | { | 204 | { |
190 | struct elo *elo = serio_get_drvdata(serio); | 205 | struct elo *elo = serio_get_drvdata(serio); |
191 | 206 | ||
192 | switch(elo->id) { | 207 | switch (elo->id) { |
193 | case 0: | 208 | case 0: |
194 | elo_process_data_10(elo, data); | 209 | elo_process_data_10(elo, data); |
195 | break; | 210 | break; |
196 | 211 | ||
197 | case 1: | 212 | case 1: |
198 | case 2: | 213 | case 2: |
199 | elo_process_data_6(elo, data); | 214 | elo_process_data_6(elo, data); |
200 | break; | 215 | break; |
201 | 216 | ||
202 | case 3: | 217 | case 3: |
203 | elo_process_data_3(elo, data); | 218 | elo_process_data_3(elo, data); |
204 | break; | 219 | break; |
205 | } | 220 | } |
206 | 221 | ||
207 | return IRQ_HANDLED; | 222 | return IRQ_HANDLED; |
@@ -261,10 +276,10 @@ static int elo_setup_10(struct elo *elo) | |||
261 | if (packet[3] & ELO10_PRESSURE) | 276 | if (packet[3] & ELO10_PRESSURE) |
262 | input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); | 277 | input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); |
263 | 278 | ||
264 | printk(KERN_INFO "elo: %sTouch touchscreen, fw: %02x.%02x, " | 279 | dev_info(&elo->serio->dev, |
265 | "features: 0x%02x, controller: 0x%02x\n", | 280 | "%sTouch touchscreen, fw: %02x.%02x, features: 0x%02x, controller: 0x%02x\n", |
266 | elo_types[(packet[1] -'0') & 0x03], | 281 | elo_types[(packet[1] -'0') & 0x03], |
267 | packet[5], packet[4], packet[3], packet[7]); | 282 | packet[5], packet[4], packet[3], packet[7]); |
268 | 283 | ||
269 | return 0; | 284 | return 0; |
270 | } | 285 | } |
@@ -330,24 +345,24 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv) | |||
330 | 345 | ||
331 | switch (elo->id) { | 346 | switch (elo->id) { |
332 | 347 | ||
333 | case 0: /* 10-byte protocol */ | 348 | case 0: /* 10-byte protocol */ |
334 | if (elo_setup_10(elo)) | 349 | if (elo_setup_10(elo)) |
335 | goto fail3; | 350 | goto fail3; |
336 | 351 | ||
337 | break; | 352 | break; |
338 | 353 | ||
339 | case 1: /* 6-byte protocol */ | 354 | case 1: /* 6-byte protocol */ |
340 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, 15, 0, 0); | 355 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, 15, 0, 0); |
341 | 356 | ||
342 | case 2: /* 4-byte protocol */ | 357 | case 2: /* 4-byte protocol */ |
343 | input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0); | 358 | input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0); |
344 | input_set_abs_params(input_dev, ABS_Y, 96, 4000, 0, 0); | 359 | input_set_abs_params(input_dev, ABS_Y, 96, 4000, 0, 0); |
345 | break; | 360 | break; |
346 | 361 | ||
347 | case 3: /* 3-byte protocol */ | 362 | case 3: /* 3-byte protocol */ |
348 | input_set_abs_params(input_dev, ABS_X, 0, 255, 0, 0); | 363 | input_set_abs_params(input_dev, ABS_X, 0, 255, 0, 0); |
349 | input_set_abs_params(input_dev, ABS_Y, 0, 255, 0, 0); | 364 | input_set_abs_params(input_dev, ABS_Y, 0, 255, 0, 0); |
350 | break; | 365 | break; |
351 | } | 366 | } |
352 | 367 | ||
353 | err = input_register_device(elo->dev); | 368 | err = input_register_device(elo->dev); |
diff --git a/drivers/input/touchscreen/mainstone-wm97xx.c b/drivers/input/touchscreen/mainstone-wm97xx.c index 6cdcf2a6e036..b6b8b1c7ecea 100644 --- a/drivers/input/touchscreen/mainstone-wm97xx.c +++ b/drivers/input/touchscreen/mainstone-wm97xx.c | |||
@@ -153,6 +153,9 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm) | |||
153 | if (pressure) | 153 | if (pressure) |
154 | p = MODR; | 154 | p = MODR; |
155 | 155 | ||
156 | dev_dbg(wm->dev, "Raw coordinates: x=%x, y=%x, p=%x\n", | ||
157 | x, y, p); | ||
158 | |||
156 | /* are samples valid */ | 159 | /* are samples valid */ |
157 | if ((x & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_X || | 160 | if ((x & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_X || |
158 | (y & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_Y || | 161 | (y & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_Y || |
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c index 6386b441ef85..3755a47d053c 100644 --- a/drivers/input/touchscreen/s3c2410_ts.c +++ b/drivers/input/touchscreen/s3c2410_ts.c | |||
@@ -128,27 +128,29 @@ static void touch_timer_fire(unsigned long data) | |||
128 | 128 | ||
129 | down = get_down(data0, data1); | 129 | down = get_down(data0, data1); |
130 | 130 | ||
131 | if (ts.count == (1 << ts.shift)) { | 131 | if (down) { |
132 | ts.xp >>= ts.shift; | 132 | if (ts.count == (1 << ts.shift)) { |
133 | ts.yp >>= ts.shift; | 133 | ts.xp >>= ts.shift; |
134 | ts.yp >>= ts.shift; | ||
134 | 135 | ||
135 | dev_dbg(ts.dev, "%s: X=%lu, Y=%lu, count=%d\n", | 136 | dev_dbg(ts.dev, "%s: X=%lu, Y=%lu, count=%d\n", |
136 | __func__, ts.xp, ts.yp, ts.count); | 137 | __func__, ts.xp, ts.yp, ts.count); |
137 | 138 | ||
138 | input_report_abs(ts.input, ABS_X, ts.xp); | 139 | input_report_abs(ts.input, ABS_X, ts.xp); |
139 | input_report_abs(ts.input, ABS_Y, ts.yp); | 140 | input_report_abs(ts.input, ABS_Y, ts.yp); |
140 | 141 | ||
141 | input_report_key(ts.input, BTN_TOUCH, 1); | 142 | input_report_key(ts.input, BTN_TOUCH, 1); |
142 | input_sync(ts.input); | 143 | input_sync(ts.input); |
143 | 144 | ||
144 | ts.xp = 0; | 145 | ts.xp = 0; |
145 | ts.yp = 0; | 146 | ts.yp = 0; |
146 | ts.count = 0; | 147 | ts.count = 0; |
147 | } | 148 | } |
148 | 149 | ||
149 | if (down) { | ||
150 | s3c_adc_start(ts.client, 0, 1 << ts.shift); | 150 | s3c_adc_start(ts.client, 0, 1 << ts.shift); |
151 | } else { | 151 | } else { |
152 | ts.xp = 0; | ||
153 | ts.yp = 0; | ||
152 | ts.count = 0; | 154 | ts.count = 0; |
153 | 155 | ||
154 | input_report_key(ts.input, BTN_TOUCH, 0); | 156 | input_report_key(ts.input, BTN_TOUCH, 0); |
@@ -401,6 +403,7 @@ static int s3c2410ts_resume(struct device *dev) | |||
401 | struct s3c2410_ts_mach_info *info = pdev->dev.platform_data; | 403 | struct s3c2410_ts_mach_info *info = pdev->dev.platform_data; |
402 | 404 | ||
403 | clk_enable(ts.clock); | 405 | clk_enable(ts.clock); |
406 | enable_irq(ts.irq_tc); | ||
404 | 407 | ||
405 | /* Initialise registers */ | 408 | /* Initialise registers */ |
406 | if ((info->delay & 0xffff) > 0) | 409 | if ((info->delay & 0xffff) > 0) |
diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c index 7ef0d1420d3c..be23780e8a3e 100644 --- a/drivers/input/touchscreen/tsc2007.c +++ b/drivers/input/touchscreen/tsc2007.c | |||
@@ -358,7 +358,7 @@ static int __devexit tsc2007_remove(struct i2c_client *client) | |||
358 | return 0; | 358 | return 0; |
359 | } | 359 | } |
360 | 360 | ||
361 | static struct i2c_device_id tsc2007_idtable[] = { | 361 | static const struct i2c_device_id tsc2007_idtable[] = { |
362 | { "tsc2007", 0 }, | 362 | { "tsc2007", 0 }, |
363 | { } | 363 | { } |
364 | }; | 364 | }; |
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 5256123a5228..99330bbdbac7 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
@@ -15,6 +15,7 @@ | |||
15 | * - GoTop Super_Q2/GogoPen/PenPower tablets | 15 | * - GoTop Super_Q2/GogoPen/PenPower tablets |
16 | * - JASTEC USB touch controller/DigiTech DTR-02U | 16 | * - JASTEC USB touch controller/DigiTech DTR-02U |
17 | * - Zytronic capacitive touchscreen | 17 | * - Zytronic capacitive touchscreen |
18 | * - NEXIO/iNexio | ||
18 | * | 19 | * |
19 | * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> | 20 | * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> |
20 | * Copyright (C) by Todd E. Johnson (mtouchusb.c) | 21 | * Copyright (C) by Todd E. Johnson (mtouchusb.c) |
@@ -95,6 +96,7 @@ struct usbtouch_device_info { | |||
95 | 96 | ||
96 | int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt); | 97 | int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt); |
97 | int (*init) (struct usbtouch_usb *usbtouch); | 98 | int (*init) (struct usbtouch_usb *usbtouch); |
99 | void (*exit) (struct usbtouch_usb *usbtouch); | ||
98 | }; | 100 | }; |
99 | 101 | ||
100 | /* a usbtouch device */ | 102 | /* a usbtouch device */ |
@@ -104,11 +106,12 @@ struct usbtouch_usb { | |||
104 | unsigned char *buffer; | 106 | unsigned char *buffer; |
105 | int buf_len; | 107 | int buf_len; |
106 | struct urb *irq; | 108 | struct urb *irq; |
107 | struct usb_device *udev; | 109 | struct usb_interface *interface; |
108 | struct input_dev *input; | 110 | struct input_dev *input; |
109 | struct usbtouch_device_info *type; | 111 | struct usbtouch_device_info *type; |
110 | char name[128]; | 112 | char name[128]; |
111 | char phys[64]; | 113 | char phys[64]; |
114 | void *priv; | ||
112 | 115 | ||
113 | int x, y; | 116 | int x, y; |
114 | int touch, press; | 117 | int touch, press; |
@@ -133,6 +136,7 @@ enum { | |||
133 | DEVTYPE_E2I, | 136 | DEVTYPE_E2I, |
134 | DEVTYPE_ZYTRONIC, | 137 | DEVTYPE_ZYTRONIC, |
135 | DEVTYPE_TC5UH, | 138 | DEVTYPE_TC5UH, |
139 | DEVTYPE_NEXIO, | ||
136 | }; | 140 | }; |
137 | 141 | ||
138 | #define USB_DEVICE_HID_CLASS(vend, prod) \ | 142 | #define USB_DEVICE_HID_CLASS(vend, prod) \ |
@@ -144,7 +148,7 @@ enum { | |||
144 | .bInterfaceClass = USB_INTERFACE_CLASS_HID, \ | 148 | .bInterfaceClass = USB_INTERFACE_CLASS_HID, \ |
145 | .bInterfaceProtocol = USB_INTERFACE_PROTOCOL_MOUSE | 149 | .bInterfaceProtocol = USB_INTERFACE_PROTOCOL_MOUSE |
146 | 150 | ||
147 | static struct usb_device_id usbtouch_devices[] = { | 151 | static const struct usb_device_id usbtouch_devices[] = { |
148 | #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX | 152 | #ifdef CONFIG_TOUCHSCREEN_USB_EGALAX |
149 | /* ignore the HID capable devices, handled by usbhid */ | 153 | /* ignore the HID capable devices, handled by usbhid */ |
150 | {USB_DEVICE_HID_CLASS(0x0eef, 0x0001), .driver_info = DEVTYPE_IGNORE}, | 154 | {USB_DEVICE_HID_CLASS(0x0eef, 0x0001), .driver_info = DEVTYPE_IGNORE}, |
@@ -222,6 +226,14 @@ static struct usb_device_id usbtouch_devices[] = { | |||
222 | {USB_DEVICE(0x0664, 0x0309), .driver_info = DEVTYPE_TC5UH}, | 226 | {USB_DEVICE(0x0664, 0x0309), .driver_info = DEVTYPE_TC5UH}, |
223 | #endif | 227 | #endif |
224 | 228 | ||
229 | #ifdef CONFIG_TOUCHSCREEN_USB_NEXIO | ||
230 | /* data interface only */ | ||
231 | {USB_DEVICE_AND_INTERFACE_INFO(0x10f0, 0x2002, 0x0a, 0x00, 0x00), | ||
232 | .driver_info = DEVTYPE_NEXIO}, | ||
233 | {USB_DEVICE_AND_INTERFACE_INFO(0x1870, 0x0001, 0x0a, 0x00, 0x00), | ||
234 | .driver_info = DEVTYPE_NEXIO}, | ||
235 | #endif | ||
236 | |||
225 | {} | 237 | {} |
226 | }; | 238 | }; |
227 | 239 | ||
@@ -234,8 +246,9 @@ static struct usb_device_id usbtouch_devices[] = { | |||
234 | static int e2i_init(struct usbtouch_usb *usbtouch) | 246 | static int e2i_init(struct usbtouch_usb *usbtouch) |
235 | { | 247 | { |
236 | int ret; | 248 | int ret; |
249 | struct usb_device *udev = interface_to_usbdev(usbtouch->interface); | ||
237 | 250 | ||
238 | ret = usb_control_msg(usbtouch->udev, usb_rcvctrlpipe(usbtouch->udev, 0), | 251 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
239 | 0x01, 0x02, 0x0000, 0x0081, | 252 | 0x01, 0x02, 0x0000, 0x0081, |
240 | NULL, 0, USB_CTRL_SET_TIMEOUT); | 253 | NULL, 0, USB_CTRL_SET_TIMEOUT); |
241 | 254 | ||
@@ -344,8 +357,9 @@ static int mtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | |||
344 | static int mtouch_init(struct usbtouch_usb *usbtouch) | 357 | static int mtouch_init(struct usbtouch_usb *usbtouch) |
345 | { | 358 | { |
346 | int ret, i; | 359 | int ret, i; |
360 | struct usb_device *udev = interface_to_usbdev(usbtouch->interface); | ||
347 | 361 | ||
348 | ret = usb_control_msg(usbtouch->udev, usb_rcvctrlpipe(usbtouch->udev, 0), | 362 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
349 | MTOUCHUSB_RESET, | 363 | MTOUCHUSB_RESET, |
350 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 364 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
351 | 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); | 365 | 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); |
@@ -356,7 +370,7 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) | |||
356 | msleep(150); | 370 | msleep(150); |
357 | 371 | ||
358 | for (i = 0; i < 3; i++) { | 372 | for (i = 0; i < 3; i++) { |
359 | ret = usb_control_msg(usbtouch->udev, usb_rcvctrlpipe(usbtouch->udev, 0), | 373 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
360 | MTOUCHUSB_ASYNC_REPORT, | 374 | MTOUCHUSB_ASYNC_REPORT, |
361 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 375 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
362 | 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); | 376 | 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); |
@@ -489,7 +503,7 @@ static int gunze_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | |||
489 | 503 | ||
490 | static int dmc_tsc10_init(struct usbtouch_usb *usbtouch) | 504 | static int dmc_tsc10_init(struct usbtouch_usb *usbtouch) |
491 | { | 505 | { |
492 | struct usb_device *dev = usbtouch->udev; | 506 | struct usb_device *dev = interface_to_usbdev(usbtouch->interface); |
493 | int ret = -ENOMEM; | 507 | int ret = -ENOMEM; |
494 | unsigned char *buf; | 508 | unsigned char *buf; |
495 | 509 | ||
@@ -690,6 +704,229 @@ static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | |||
690 | #endif | 704 | #endif |
691 | 705 | ||
692 | /***************************************************************************** | 706 | /***************************************************************************** |
707 | * NEXIO Part | ||
708 | */ | ||
709 | #ifdef CONFIG_TOUCHSCREEN_USB_NEXIO | ||
710 | |||
711 | #define NEXIO_TIMEOUT 5000 | ||
712 | #define NEXIO_BUFSIZE 1024 | ||
713 | #define NEXIO_THRESHOLD 50 | ||
714 | |||
715 | struct nexio_priv { | ||
716 | struct urb *ack; | ||
717 | unsigned char *ack_buf; | ||
718 | }; | ||
719 | |||
720 | struct nexio_touch_packet { | ||
721 | u8 flags; /* 0xe1 = touch, 0xe1 = release */ | ||
722 | __be16 data_len; /* total bytes of touch data */ | ||
723 | __be16 x_len; /* bytes for X axis */ | ||
724 | __be16 y_len; /* bytes for Y axis */ | ||
725 | u8 data[]; | ||
726 | } __attribute__ ((packed)); | ||
727 | |||
728 | static unsigned char nexio_ack_pkt[2] = { 0xaa, 0x02 }; | ||
729 | static unsigned char nexio_init_pkt[4] = { 0x82, 0x04, 0x0a, 0x0f }; | ||
730 | |||
731 | static void nexio_ack_complete(struct urb *urb) | ||
732 | { | ||
733 | } | ||
734 | |||
735 | static int nexio_init(struct usbtouch_usb *usbtouch) | ||
736 | { | ||
737 | struct usb_device *dev = interface_to_usbdev(usbtouch->interface); | ||
738 | struct usb_host_interface *interface = usbtouch->interface->cur_altsetting; | ||
739 | struct nexio_priv *priv; | ||
740 | int ret = -ENOMEM; | ||
741 | int actual_len, i; | ||
742 | unsigned char *buf; | ||
743 | char *firmware_ver = NULL, *device_name = NULL; | ||
744 | int input_ep = 0, output_ep = 0; | ||
745 | |||
746 | /* find first input and output endpoint */ | ||
747 | for (i = 0; i < interface->desc.bNumEndpoints; i++) { | ||
748 | if (!input_ep && | ||
749 | usb_endpoint_dir_in(&interface->endpoint[i].desc)) | ||
750 | input_ep = interface->endpoint[i].desc.bEndpointAddress; | ||
751 | if (!output_ep && | ||
752 | usb_endpoint_dir_out(&interface->endpoint[i].desc)) | ||
753 | output_ep = interface->endpoint[i].desc.bEndpointAddress; | ||
754 | } | ||
755 | if (!input_ep || !output_ep) | ||
756 | return -ENXIO; | ||
757 | |||
758 | buf = kmalloc(NEXIO_BUFSIZE, GFP_KERNEL); | ||
759 | if (!buf) | ||
760 | goto out_buf; | ||
761 | |||
762 | /* two empty reads */ | ||
763 | for (i = 0; i < 2; i++) { | ||
764 | ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, input_ep), | ||
765 | buf, NEXIO_BUFSIZE, &actual_len, | ||
766 | NEXIO_TIMEOUT); | ||
767 | if (ret < 0) | ||
768 | goto out_buf; | ||
769 | } | ||
770 | |||
771 | /* send init command */ | ||
772 | memcpy(buf, nexio_init_pkt, sizeof(nexio_init_pkt)); | ||
773 | ret = usb_bulk_msg(dev, usb_sndbulkpipe(dev, output_ep), | ||
774 | buf, sizeof(nexio_init_pkt), &actual_len, | ||
775 | NEXIO_TIMEOUT); | ||
776 | if (ret < 0) | ||
777 | goto out_buf; | ||
778 | |||
779 | /* read replies */ | ||
780 | for (i = 0; i < 3; i++) { | ||
781 | memset(buf, 0, NEXIO_BUFSIZE); | ||
782 | ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, input_ep), | ||
783 | buf, NEXIO_BUFSIZE, &actual_len, | ||
784 | NEXIO_TIMEOUT); | ||
785 | if (ret < 0 || actual_len < 1 || buf[1] != actual_len) | ||
786 | continue; | ||
787 | switch (buf[0]) { | ||
788 | case 0x83: /* firmware version */ | ||
789 | if (!firmware_ver) | ||
790 | firmware_ver = kstrdup(&buf[2], GFP_KERNEL); | ||
791 | break; | ||
792 | case 0x84: /* device name */ | ||
793 | if (!device_name) | ||
794 | device_name = kstrdup(&buf[2], GFP_KERNEL); | ||
795 | break; | ||
796 | } | ||
797 | } | ||
798 | |||
799 | printk(KERN_INFO "Nexio device: %s, firmware version: %s\n", | ||
800 | device_name, firmware_ver); | ||
801 | |||
802 | kfree(firmware_ver); | ||
803 | kfree(device_name); | ||
804 | |||
805 | /* prepare ACK URB */ | ||
806 | ret = -ENOMEM; | ||
807 | |||
808 | usbtouch->priv = kmalloc(sizeof(struct nexio_priv), GFP_KERNEL); | ||
809 | if (!usbtouch->priv) | ||
810 | goto out_buf; | ||
811 | |||
812 | priv = usbtouch->priv; | ||
813 | |||
814 | priv->ack_buf = kmalloc(sizeof(nexio_ack_pkt), GFP_KERNEL); | ||
815 | if (!priv->ack_buf) | ||
816 | goto err_priv; | ||
817 | |||
818 | memcpy(priv->ack_buf, nexio_ack_pkt, sizeof(nexio_ack_pkt)); | ||
819 | |||
820 | priv->ack = usb_alloc_urb(0, GFP_KERNEL); | ||
821 | if (!priv->ack) { | ||
822 | dbg("%s - usb_alloc_urb failed: usbtouch->ack", __func__); | ||
823 | goto err_ack_buf; | ||
824 | } | ||
825 | |||
826 | usb_fill_bulk_urb(priv->ack, dev, usb_sndbulkpipe(dev, output_ep), | ||
827 | priv->ack_buf, sizeof(nexio_ack_pkt), | ||
828 | nexio_ack_complete, usbtouch); | ||
829 | ret = 0; | ||
830 | goto out_buf; | ||
831 | |||
832 | err_ack_buf: | ||
833 | kfree(priv->ack_buf); | ||
834 | err_priv: | ||
835 | kfree(priv); | ||
836 | out_buf: | ||
837 | kfree(buf); | ||
838 | return ret; | ||
839 | } | ||
840 | |||
841 | static void nexio_exit(struct usbtouch_usb *usbtouch) | ||
842 | { | ||
843 | struct nexio_priv *priv = usbtouch->priv; | ||
844 | |||
845 | usb_kill_urb(priv->ack); | ||
846 | usb_free_urb(priv->ack); | ||
847 | kfree(priv->ack_buf); | ||
848 | kfree(priv); | ||
849 | } | ||
850 | |||
851 | static int nexio_read_data(struct usbtouch_usb *usbtouch, unsigned char *pkt) | ||
852 | { | ||
853 | int x, y, begin_x, begin_y, end_x, end_y, w, h, ret; | ||
854 | struct nexio_touch_packet *packet = (void *) pkt; | ||
855 | struct nexio_priv *priv = usbtouch->priv; | ||
856 | |||
857 | /* got touch data? */ | ||
858 | if ((pkt[0] & 0xe0) != 0xe0) | ||
859 | return 0; | ||
860 | |||
861 | /* send ACK */ | ||
862 | ret = usb_submit_urb(priv->ack, GFP_ATOMIC); | ||
863 | |||
864 | if (!usbtouch->type->max_xc) { | ||
865 | usbtouch->type->max_xc = 2 * be16_to_cpu(packet->x_len); | ||
866 | input_set_abs_params(usbtouch->input, ABS_X, 0, | ||
867 | 2 * be16_to_cpu(packet->x_len), 0, 0); | ||
868 | usbtouch->type->max_yc = 2 * be16_to_cpu(packet->y_len); | ||
869 | input_set_abs_params(usbtouch->input, ABS_Y, 0, | ||
870 | 2 * be16_to_cpu(packet->y_len), 0, 0); | ||
871 | } | ||
872 | /* | ||
873 | * The device reports state of IR sensors on X and Y axes. | ||
874 | * Each byte represents "darkness" percentage (0-100) of one element. | ||
875 | * 17" touchscreen reports only 64 x 52 bytes so the resolution is low. | ||
876 | * This also means that there's a limited multi-touch capability but | ||
877 | * it's disabled (and untested) here as there's no X driver for that. | ||
878 | */ | ||
879 | begin_x = end_x = begin_y = end_y = -1; | ||
880 | for (x = 0; x < be16_to_cpu(packet->x_len); x++) { | ||
881 | if (begin_x == -1 && packet->data[x] > NEXIO_THRESHOLD) { | ||
882 | begin_x = x; | ||
883 | continue; | ||
884 | } | ||
885 | if (end_x == -1 && begin_x != -1 && packet->data[x] < NEXIO_THRESHOLD) { | ||
886 | end_x = x - 1; | ||
887 | for (y = be16_to_cpu(packet->x_len); | ||
888 | y < be16_to_cpu(packet->data_len); y++) { | ||
889 | if (begin_y == -1 && packet->data[y] > NEXIO_THRESHOLD) { | ||
890 | begin_y = y - be16_to_cpu(packet->x_len); | ||
891 | continue; | ||
892 | } | ||
893 | if (end_y == -1 && | ||
894 | begin_y != -1 && packet->data[y] < NEXIO_THRESHOLD) { | ||
895 | end_y = y - 1 - be16_to_cpu(packet->x_len); | ||
896 | w = end_x - begin_x; | ||
897 | h = end_y - begin_y; | ||
898 | #if 0 | ||
899 | /* multi-touch */ | ||
900 | input_report_abs(usbtouch->input, | ||
901 | ABS_MT_TOUCH_MAJOR, max(w,h)); | ||
902 | input_report_abs(usbtouch->input, | ||
903 | ABS_MT_TOUCH_MINOR, min(x,h)); | ||
904 | input_report_abs(usbtouch->input, | ||
905 | ABS_MT_POSITION_X, 2*begin_x+w); | ||
906 | input_report_abs(usbtouch->input, | ||
907 | ABS_MT_POSITION_Y, 2*begin_y+h); | ||
908 | input_report_abs(usbtouch->input, | ||
909 | ABS_MT_ORIENTATION, w > h); | ||
910 | input_mt_sync(usbtouch->input); | ||
911 | #endif | ||
912 | /* single touch */ | ||
913 | usbtouch->x = 2 * begin_x + w; | ||
914 | usbtouch->y = 2 * begin_y + h; | ||
915 | usbtouch->touch = packet->flags & 0x01; | ||
916 | begin_y = end_y = -1; | ||
917 | return 1; | ||
918 | } | ||
919 | } | ||
920 | begin_x = end_x = -1; | ||
921 | } | ||
922 | |||
923 | } | ||
924 | return 0; | ||
925 | } | ||
926 | #endif | ||
927 | |||
928 | |||
929 | /***************************************************************************** | ||
693 | * the different device descriptors | 930 | * the different device descriptors |
694 | */ | 931 | */ |
695 | #ifdef MULTI_PACKET | 932 | #ifdef MULTI_PACKET |
@@ -873,6 +1110,16 @@ static struct usbtouch_device_info usbtouch_dev_info[] = { | |||
873 | .read_data = tc5uh_read_data, | 1110 | .read_data = tc5uh_read_data, |
874 | }, | 1111 | }, |
875 | #endif | 1112 | #endif |
1113 | |||
1114 | #ifdef CONFIG_TOUCHSCREEN_USB_NEXIO | ||
1115 | [DEVTYPE_NEXIO] = { | ||
1116 | .rept_size = 128, | ||
1117 | .irq_always = true, | ||
1118 | .read_data = nexio_read_data, | ||
1119 | .init = nexio_init, | ||
1120 | .exit = nexio_exit, | ||
1121 | }, | ||
1122 | #endif | ||
876 | }; | 1123 | }; |
877 | 1124 | ||
878 | 1125 | ||
@@ -998,6 +1245,7 @@ static void usbtouch_irq(struct urb *urb) | |||
998 | case -ECONNRESET: | 1245 | case -ECONNRESET: |
999 | case -ENOENT: | 1246 | case -ENOENT: |
1000 | case -ESHUTDOWN: | 1247 | case -ESHUTDOWN: |
1248 | case -EPIPE: | ||
1001 | /* this urb is terminated, clean up */ | 1249 | /* this urb is terminated, clean up */ |
1002 | dbg("%s - urb shutting down with status: %d", | 1250 | dbg("%s - urb shutting down with status: %d", |
1003 | __func__, urb->status); | 1251 | __func__, urb->status); |
@@ -1021,7 +1269,7 @@ static int usbtouch_open(struct input_dev *input) | |||
1021 | { | 1269 | { |
1022 | struct usbtouch_usb *usbtouch = input_get_drvdata(input); | 1270 | struct usbtouch_usb *usbtouch = input_get_drvdata(input); |
1023 | 1271 | ||
1024 | usbtouch->irq->dev = usbtouch->udev; | 1272 | usbtouch->irq->dev = interface_to_usbdev(usbtouch->interface); |
1025 | 1273 | ||
1026 | if (!usbtouch->type->irq_always) { | 1274 | if (!usbtouch->type->irq_always) { |
1027 | if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) | 1275 | if (usb_submit_urb(usbtouch->irq, GFP_KERNEL)) |
@@ -1048,13 +1296,23 @@ static void usbtouch_free_buffers(struct usb_device *udev, | |||
1048 | kfree(usbtouch->buffer); | 1296 | kfree(usbtouch->buffer); |
1049 | } | 1297 | } |
1050 | 1298 | ||
1299 | static struct usb_endpoint_descriptor * | ||
1300 | usbtouch_get_input_endpoint(struct usb_host_interface *interface) | ||
1301 | { | ||
1302 | int i; | ||
1303 | |||
1304 | for (i = 0; i < interface->desc.bNumEndpoints; i++) | ||
1305 | if (usb_endpoint_dir_in(&interface->endpoint[i].desc)) | ||
1306 | return &interface->endpoint[i].desc; | ||
1307 | |||
1308 | return NULL; | ||
1309 | } | ||
1051 | 1310 | ||
1052 | static int usbtouch_probe(struct usb_interface *intf, | 1311 | static int usbtouch_probe(struct usb_interface *intf, |
1053 | const struct usb_device_id *id) | 1312 | const struct usb_device_id *id) |
1054 | { | 1313 | { |
1055 | struct usbtouch_usb *usbtouch; | 1314 | struct usbtouch_usb *usbtouch; |
1056 | struct input_dev *input_dev; | 1315 | struct input_dev *input_dev; |
1057 | struct usb_host_interface *interface; | ||
1058 | struct usb_endpoint_descriptor *endpoint; | 1316 | struct usb_endpoint_descriptor *endpoint; |
1059 | struct usb_device *udev = interface_to_usbdev(intf); | 1317 | struct usb_device *udev = interface_to_usbdev(intf); |
1060 | struct usbtouch_device_info *type; | 1318 | struct usbtouch_device_info *type; |
@@ -1064,8 +1322,9 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
1064 | if (id->driver_info == DEVTYPE_IGNORE) | 1322 | if (id->driver_info == DEVTYPE_IGNORE) |
1065 | return -ENODEV; | 1323 | return -ENODEV; |
1066 | 1324 | ||
1067 | interface = intf->cur_altsetting; | 1325 | endpoint = usbtouch_get_input_endpoint(intf->cur_altsetting); |
1068 | endpoint = &interface->endpoint[0].desc; | 1326 | if (!endpoint) |
1327 | return -ENXIO; | ||
1069 | 1328 | ||
1070 | usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL); | 1329 | usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL); |
1071 | input_dev = input_allocate_device(); | 1330 | input_dev = input_allocate_device(); |
@@ -1094,7 +1353,7 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
1094 | goto out_free_buffers; | 1353 | goto out_free_buffers; |
1095 | } | 1354 | } |
1096 | 1355 | ||
1097 | usbtouch->udev = udev; | 1356 | usbtouch->interface = intf; |
1098 | usbtouch->input = input_dev; | 1357 | usbtouch->input = input_dev; |
1099 | 1358 | ||
1100 | if (udev->manufacturer) | 1359 | if (udev->manufacturer) |
@@ -1133,12 +1392,18 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
1133 | input_set_abs_params(input_dev, ABS_PRESSURE, type->min_press, | 1392 | input_set_abs_params(input_dev, ABS_PRESSURE, type->min_press, |
1134 | type->max_press, 0, 0); | 1393 | type->max_press, 0, 0); |
1135 | 1394 | ||
1136 | usb_fill_int_urb(usbtouch->irq, usbtouch->udev, | 1395 | if (usb_endpoint_type(endpoint) == USB_ENDPOINT_XFER_INT) |
1137 | usb_rcvintpipe(usbtouch->udev, endpoint->bEndpointAddress), | 1396 | usb_fill_int_urb(usbtouch->irq, udev, |
1397 | usb_rcvintpipe(udev, endpoint->bEndpointAddress), | ||
1138 | usbtouch->data, type->rept_size, | 1398 | usbtouch->data, type->rept_size, |
1139 | usbtouch_irq, usbtouch, endpoint->bInterval); | 1399 | usbtouch_irq, usbtouch, endpoint->bInterval); |
1400 | else | ||
1401 | usb_fill_bulk_urb(usbtouch->irq, udev, | ||
1402 | usb_rcvbulkpipe(udev, endpoint->bEndpointAddress), | ||
1403 | usbtouch->data, type->rept_size, | ||
1404 | usbtouch_irq, usbtouch); | ||
1140 | 1405 | ||
1141 | usbtouch->irq->dev = usbtouch->udev; | 1406 | usbtouch->irq->dev = udev; |
1142 | usbtouch->irq->transfer_dma = usbtouch->data_dma; | 1407 | usbtouch->irq->transfer_dma = usbtouch->data_dma; |
1143 | usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 1408 | usbtouch->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
1144 | 1409 | ||
@@ -1147,23 +1412,37 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
1147 | err = type->init(usbtouch); | 1412 | err = type->init(usbtouch); |
1148 | if (err) { | 1413 | if (err) { |
1149 | dbg("%s - type->init() failed, err: %d", __func__, err); | 1414 | dbg("%s - type->init() failed, err: %d", __func__, err); |
1150 | goto out_free_buffers; | 1415 | goto out_free_urb; |
1151 | } | 1416 | } |
1152 | } | 1417 | } |
1153 | 1418 | ||
1154 | err = input_register_device(usbtouch->input); | 1419 | err = input_register_device(usbtouch->input); |
1155 | if (err) { | 1420 | if (err) { |
1156 | dbg("%s - input_register_device failed, err: %d", __func__, err); | 1421 | dbg("%s - input_register_device failed, err: %d", __func__, err); |
1157 | goto out_free_buffers; | 1422 | goto out_do_exit; |
1158 | } | 1423 | } |
1159 | 1424 | ||
1160 | usb_set_intfdata(intf, usbtouch); | 1425 | usb_set_intfdata(intf, usbtouch); |
1161 | 1426 | ||
1162 | if (usbtouch->type->irq_always) | 1427 | if (usbtouch->type->irq_always) { |
1163 | usb_submit_urb(usbtouch->irq, GFP_KERNEL); | 1428 | err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); |
1429 | if (err) { | ||
1430 | err("%s - usb_submit_urb failed with result: %d", | ||
1431 | __func__, err); | ||
1432 | goto out_unregister_input; | ||
1433 | } | ||
1434 | } | ||
1164 | 1435 | ||
1165 | return 0; | 1436 | return 0; |
1166 | 1437 | ||
1438 | out_unregister_input: | ||
1439 | input_unregister_device(input_dev); | ||
1440 | input_dev = NULL; | ||
1441 | out_do_exit: | ||
1442 | if (type->exit) | ||
1443 | type->exit(usbtouch); | ||
1444 | out_free_urb: | ||
1445 | usb_free_urb(usbtouch->irq); | ||
1167 | out_free_buffers: | 1446 | out_free_buffers: |
1168 | usbtouch_free_buffers(udev, usbtouch); | 1447 | usbtouch_free_buffers(udev, usbtouch); |
1169 | out_free: | 1448 | out_free: |
@@ -1186,6 +1465,8 @@ static void usbtouch_disconnect(struct usb_interface *intf) | |||
1186 | /* this will stop IO via close */ | 1465 | /* this will stop IO via close */ |
1187 | input_unregister_device(usbtouch->input); | 1466 | input_unregister_device(usbtouch->input); |
1188 | usb_free_urb(usbtouch->irq); | 1467 | usb_free_urb(usbtouch->irq); |
1468 | if (usbtouch->type->exit) | ||
1469 | usbtouch->type->exit(usbtouch); | ||
1189 | usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch); | 1470 | usbtouch_free_buffers(interface_to_usbdev(intf), usbtouch); |
1190 | kfree(usbtouch); | 1471 | kfree(usbtouch); |
1191 | } | 1472 | } |
diff --git a/drivers/input/touchscreen/zylonite-wm97xx.c b/drivers/input/touchscreen/zylonite-wm97xx.c index eca54dbdf493..048849867643 100644 --- a/drivers/input/touchscreen/zylonite-wm97xx.c +++ b/drivers/input/touchscreen/zylonite-wm97xx.c | |||
@@ -118,6 +118,9 @@ static int wm97xx_acc_pen_down(struct wm97xx *wm) | |||
118 | if (pressure) | 118 | if (pressure) |
119 | p = MODR; | 119 | p = MODR; |
120 | 120 | ||
121 | dev_dbg(wm->dev, "Raw coordinates: x=%x, y=%x, p=%x\n", | ||
122 | x, y, p); | ||
123 | |||
121 | /* are samples valid */ | 124 | /* are samples valid */ |
122 | if ((x & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_X || | 125 | if ((x & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_X || |
123 | (y & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_Y || | 126 | (y & WM97XX_ADCSRC_MASK) != WM97XX_ADCSEL_Y || |
diff --git a/drivers/input/xen-kbdfront.c b/drivers/input/xen-kbdfront.c index c721c0a23eb8..d30436fee476 100644 --- a/drivers/input/xen-kbdfront.c +++ b/drivers/input/xen-kbdfront.c | |||
@@ -321,7 +321,7 @@ InitWait: | |||
321 | } | 321 | } |
322 | } | 322 | } |
323 | 323 | ||
324 | static struct xenbus_device_id xenkbd_ids[] = { | 324 | static const struct xenbus_device_id xenkbd_ids[] = { |
325 | { "vkbd" }, | 325 | { "vkbd" }, |
326 | { "" } | 326 | { "" } |
327 | }; | 327 | }; |
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig index 3d906833948d..fd85bde283a0 100644 --- a/drivers/macintosh/Kconfig +++ b/drivers/macintosh/Kconfig | |||
@@ -171,8 +171,8 @@ config INPUT_ADBHID | |||
171 | If unsure, say Y. | 171 | If unsure, say Y. |
172 | 172 | ||
173 | config MAC_EMUMOUSEBTN | 173 | config MAC_EMUMOUSEBTN |
174 | bool "Support for mouse button 2+3 emulation" | 174 | tristate "Support for mouse button 2+3 emulation" |
175 | select INPUT | 175 | depends on SYSCTL && INPUT |
176 | help | 176 | help |
177 | This provides generic support for emulating the 2nd and 3rd mouse | 177 | This provides generic support for emulating the 2nd and 3rd mouse |
178 | button with keypresses. If you say Y here, the emulation is still | 178 | button with keypresses. If you say Y here, the emulation is still |
@@ -184,6 +184,9 @@ config MAC_EMUMOUSEBTN | |||
184 | 184 | ||
185 | If you have an Apple machine with a 1-button mouse, say Y here. | 185 | If you have an Apple machine with a 1-button mouse, say Y here. |
186 | 186 | ||
187 | To compile this driver as a module, choose M here: the | ||
188 | module will be called mac_hid. | ||
189 | |||
187 | config THERM_WINDTUNNEL | 190 | config THERM_WINDTUNNEL |
188 | tristate "Support for thermal management on Windtunnel G4s" | 191 | tristate "Support for thermal management on Windtunnel G4s" |
189 | depends on I2C && I2C_POWERMAC && PPC_PMAC && !PPC_PMAC64 | 192 | depends on I2C && I2C_POWERMAC && PPC_PMAC && !PPC_PMAC64 |
diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c index 7b4ef5bb556b..e943d2a29253 100644 --- a/drivers/macintosh/mac_hid.c +++ b/drivers/macintosh/mac_hid.c | |||
@@ -13,17 +13,197 @@ | |||
13 | #include <linux/sysctl.h> | 13 | #include <linux/sysctl.h> |
14 | #include <linux/input.h> | 14 | #include <linux/input.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/kbd_kern.h> | ||
17 | 16 | ||
17 | MODULE_LICENSE("GPL"); | ||
18 | 18 | ||
19 | static struct input_dev *emumousebtn; | ||
20 | static int emumousebtn_input_register(void); | ||
21 | static int mouse_emulate_buttons; | 19 | static int mouse_emulate_buttons; |
22 | static int mouse_button2_keycode = KEY_RIGHTCTRL; /* right control key */ | 20 | static int mouse_button2_keycode = KEY_RIGHTCTRL; /* right control key */ |
23 | static int mouse_button3_keycode = KEY_RIGHTALT; /* right option key */ | 21 | static int mouse_button3_keycode = KEY_RIGHTALT; /* right option key */ |
24 | static int mouse_last_keycode; | ||
25 | 22 | ||
26 | #if defined(CONFIG_SYSCTL) | 23 | static struct input_dev *mac_hid_emumouse_dev; |
24 | |||
25 | static int mac_hid_create_emumouse(void) | ||
26 | { | ||
27 | static struct lock_class_key mac_hid_emumouse_dev_event_class; | ||
28 | static struct lock_class_key mac_hid_emumouse_dev_mutex_class; | ||
29 | int err; | ||
30 | |||
31 | mac_hid_emumouse_dev = input_allocate_device(); | ||
32 | if (!mac_hid_emumouse_dev) | ||
33 | return -ENOMEM; | ||
34 | |||
35 | lockdep_set_class(&mac_hid_emumouse_dev->event_lock, | ||
36 | &mac_hid_emumouse_dev_event_class); | ||
37 | lockdep_set_class(&mac_hid_emumouse_dev->mutex, | ||
38 | &mac_hid_emumouse_dev_mutex_class); | ||
39 | |||
40 | mac_hid_emumouse_dev->name = "Macintosh mouse button emulation"; | ||
41 | mac_hid_emumouse_dev->id.bustype = BUS_ADB; | ||
42 | mac_hid_emumouse_dev->id.vendor = 0x0001; | ||
43 | mac_hid_emumouse_dev->id.product = 0x0001; | ||
44 | mac_hid_emumouse_dev->id.version = 0x0100; | ||
45 | |||
46 | mac_hid_emumouse_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | ||
47 | mac_hid_emumouse_dev->keybit[BIT_WORD(BTN_MOUSE)] = | ||
48 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); | ||
49 | mac_hid_emumouse_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); | ||
50 | |||
51 | err = input_register_device(mac_hid_emumouse_dev); | ||
52 | if (err) { | ||
53 | input_free_device(mac_hid_emumouse_dev); | ||
54 | mac_hid_emumouse_dev = NULL; | ||
55 | return err; | ||
56 | } | ||
57 | |||
58 | return 0; | ||
59 | } | ||
60 | |||
61 | static void mac_hid_destroy_emumouse(void) | ||
62 | { | ||
63 | input_unregister_device(mac_hid_emumouse_dev); | ||
64 | mac_hid_emumouse_dev = NULL; | ||
65 | } | ||
66 | |||
67 | static bool mac_hid_emumouse_filter(struct input_handle *handle, | ||
68 | unsigned int type, unsigned int code, | ||
69 | int value) | ||
70 | { | ||
71 | unsigned int btn; | ||
72 | |||
73 | if (type != EV_KEY) | ||
74 | return false; | ||
75 | |||
76 | if (code == mouse_button2_keycode) | ||
77 | btn = BTN_MIDDLE; | ||
78 | else if (code == mouse_button3_keycode) | ||
79 | btn = BTN_RIGHT; | ||
80 | else | ||
81 | return false; | ||
82 | |||
83 | input_report_key(mac_hid_emumouse_dev, btn, value); | ||
84 | input_sync(mac_hid_emumouse_dev); | ||
85 | |||
86 | return true; | ||
87 | } | ||
88 | |||
89 | static int mac_hid_emumouse_connect(struct input_handler *handler, | ||
90 | struct input_dev *dev, | ||
91 | const struct input_device_id *id) | ||
92 | { | ||
93 | struct input_handle *handle; | ||
94 | int error; | ||
95 | |||
96 | /* Don't bind to ourselves */ | ||
97 | if (dev == mac_hid_emumouse_dev) | ||
98 | return -ENODEV; | ||
99 | |||
100 | handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL); | ||
101 | if (!handle) | ||
102 | return -ENOMEM; | ||
103 | |||
104 | handle->dev = dev; | ||
105 | handle->handler = handler; | ||
106 | handle->name = "mac-button-emul"; | ||
107 | |||
108 | error = input_register_handle(handle); | ||
109 | if (error) { | ||
110 | printk(KERN_ERR | ||
111 | "mac_hid: Failed to register button emulation handle, " | ||
112 | "error %d\n", error); | ||
113 | goto err_free; | ||
114 | } | ||
115 | |||
116 | error = input_open_device(handle); | ||
117 | if (error) { | ||
118 | printk(KERN_ERR | ||
119 | "mac_hid: Failed to open input device, error %d\n", | ||
120 | error); | ||
121 | goto err_unregister; | ||
122 | } | ||
123 | |||
124 | return 0; | ||
125 | |||
126 | err_unregister: | ||
127 | input_unregister_handle(handle); | ||
128 | err_free: | ||
129 | kfree(handle); | ||
130 | return error; | ||
131 | } | ||
132 | |||
133 | static void mac_hid_emumouse_disconnect(struct input_handle *handle) | ||
134 | { | ||
135 | input_close_device(handle); | ||
136 | input_unregister_handle(handle); | ||
137 | kfree(handle); | ||
138 | } | ||
139 | |||
140 | static const struct input_device_id mac_hid_emumouse_ids[] = { | ||
141 | { | ||
142 | .flags = INPUT_DEVICE_ID_MATCH_EVBIT, | ||
143 | .evbit = { BIT_MASK(EV_KEY) }, | ||
144 | }, | ||
145 | { }, | ||
146 | }; | ||
147 | |||
148 | MODULE_DEVICE_TABLE(input, mac_hid_emumouse_ids); | ||
149 | |||
150 | static struct input_handler mac_hid_emumouse_handler = { | ||
151 | .filter = mac_hid_emumouse_filter, | ||
152 | .connect = mac_hid_emumouse_connect, | ||
153 | .disconnect = mac_hid_emumouse_disconnect, | ||
154 | .name = "mac-button-emul", | ||
155 | .id_table = mac_hid_emumouse_ids, | ||
156 | }; | ||
157 | |||
158 | static int mac_hid_start_emulation(void) | ||
159 | { | ||
160 | int err; | ||
161 | |||
162 | err = mac_hid_create_emumouse(); | ||
163 | if (err) | ||
164 | return err; | ||
165 | |||
166 | err = input_register_handler(&mac_hid_emumouse_handler); | ||
167 | if (err) { | ||
168 | mac_hid_destroy_emumouse(); | ||
169 | return err; | ||
170 | } | ||
171 | |||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | static void mac_hid_stop_emulation(void) | ||
176 | { | ||
177 | input_unregister_handler(&mac_hid_emumouse_handler); | ||
178 | mac_hid_destroy_emumouse(); | ||
179 | } | ||
180 | |||
181 | static int mac_hid_toggle_emumouse(ctl_table *table, int write, | ||
182 | void __user *buffer, size_t *lenp, | ||
183 | loff_t *ppos) | ||
184 | { | ||
185 | int *valp = table->data; | ||
186 | int old_val = *valp; | ||
187 | int rc; | ||
188 | |||
189 | rc = proc_dointvec(table, write, buffer, lenp, ppos); | ||
190 | |||
191 | if (rc == 0 && write && *valp != old_val) { | ||
192 | if (*valp == 1) | ||
193 | rc = mac_hid_start_emulation(); | ||
194 | else if (*valp == 0) | ||
195 | mac_hid_stop_emulation(); | ||
196 | else | ||
197 | rc = -EINVAL; | ||
198 | } | ||
199 | |||
200 | /* Restore the old value in case of error */ | ||
201 | if (rc) | ||
202 | *valp = old_val; | ||
203 | |||
204 | return rc; | ||
205 | } | ||
206 | |||
27 | /* file(s) in /proc/sys/dev/mac_hid */ | 207 | /* file(s) in /proc/sys/dev/mac_hid */ |
28 | static ctl_table mac_hid_files[] = { | 208 | static ctl_table mac_hid_files[] = { |
29 | { | 209 | { |
@@ -31,7 +211,7 @@ static ctl_table mac_hid_files[] = { | |||
31 | .data = &mouse_emulate_buttons, | 211 | .data = &mouse_emulate_buttons, |
32 | .maxlen = sizeof(int), | 212 | .maxlen = sizeof(int), |
33 | .mode = 0644, | 213 | .mode = 0644, |
34 | .proc_handler = proc_dointvec, | 214 | .proc_handler = mac_hid_toggle_emumouse, |
35 | }, | 215 | }, |
36 | { | 216 | { |
37 | .procname = "mouse_button2_keycode", | 217 | .procname = "mouse_button2_keycode", |
@@ -74,75 +254,21 @@ static ctl_table mac_hid_root_dir[] = { | |||
74 | 254 | ||
75 | static struct ctl_table_header *mac_hid_sysctl_header; | 255 | static struct ctl_table_header *mac_hid_sysctl_header; |
76 | 256 | ||
77 | #endif /* endif CONFIG_SYSCTL */ | 257 | static int __init mac_hid_init(void) |
78 | |||
79 | int mac_hid_mouse_emulate_buttons(int caller, unsigned int keycode, int down) | ||
80 | { | ||
81 | switch (caller) { | ||
82 | case 1: | ||
83 | /* Called from keyboard.c */ | ||
84 | if (mouse_emulate_buttons | ||
85 | && (keycode == mouse_button2_keycode | ||
86 | || keycode == mouse_button3_keycode)) { | ||
87 | if (mouse_emulate_buttons == 1) { | ||
88 | input_report_key(emumousebtn, | ||
89 | keycode == mouse_button2_keycode ? BTN_MIDDLE : BTN_RIGHT, | ||
90 | down); | ||
91 | input_sync(emumousebtn); | ||
92 | return 1; | ||
93 | } | ||
94 | mouse_last_keycode = down ? keycode : 0; | ||
95 | } | ||
96 | break; | ||
97 | } | ||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | static struct lock_class_key emumousebtn_event_class; | ||
102 | static struct lock_class_key emumousebtn_mutex_class; | ||
103 | |||
104 | static int emumousebtn_input_register(void) | ||
105 | { | 258 | { |
106 | int ret; | 259 | mac_hid_sysctl_header = register_sysctl_table(mac_hid_root_dir); |
107 | 260 | if (!mac_hid_sysctl_header) | |
108 | emumousebtn = input_allocate_device(); | ||
109 | if (!emumousebtn) | ||
110 | return -ENOMEM; | 261 | return -ENOMEM; |
111 | 262 | ||
112 | lockdep_set_class(&emumousebtn->event_lock, &emumousebtn_event_class); | 263 | return 0; |
113 | lockdep_set_class(&emumousebtn->mutex, &emumousebtn_mutex_class); | ||
114 | |||
115 | emumousebtn->name = "Macintosh mouse button emulation"; | ||
116 | emumousebtn->id.bustype = BUS_ADB; | ||
117 | emumousebtn->id.vendor = 0x0001; | ||
118 | emumousebtn->id.product = 0x0001; | ||
119 | emumousebtn->id.version = 0x0100; | ||
120 | |||
121 | emumousebtn->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | ||
122 | emumousebtn->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) | | ||
123 | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); | ||
124 | emumousebtn->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); | ||
125 | |||
126 | ret = input_register_device(emumousebtn); | ||
127 | if (ret) | ||
128 | input_free_device(emumousebtn); | ||
129 | |||
130 | return ret; | ||
131 | } | 264 | } |
265 | module_init(mac_hid_init); | ||
132 | 266 | ||
133 | static int __init mac_hid_init(void) | 267 | static void __exit mac_hid_exit(void) |
134 | { | 268 | { |
135 | int err; | 269 | unregister_sysctl_table(mac_hid_sysctl_header); |
136 | |||
137 | err = emumousebtn_input_register(); | ||
138 | if (err) | ||
139 | return err; | ||
140 | |||
141 | #if defined(CONFIG_SYSCTL) | ||
142 | mac_hid_sysctl_header = register_sysctl_table(mac_hid_root_dir); | ||
143 | #endif /* CONFIG_SYSCTL */ | ||
144 | 270 | ||
145 | return 0; | 271 | if (mouse_emulate_buttons) |
272 | mac_hid_stop_emulation(); | ||
146 | } | 273 | } |
147 | 274 | module_exit(mac_hid_exit); | |
148 | device_initcall(mac_hid_init); | ||
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 00435bd20699..af2d39d603c7 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -177,7 +177,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
177 | */ | 177 | */ |
178 | if (rdev->bdev->bd_disk->queue->merge_bvec_fn && | 178 | if (rdev->bdev->bd_disk->queue->merge_bvec_fn && |
179 | queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) | 179 | queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) |
180 | blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); | 180 | blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); |
181 | 181 | ||
182 | conf->array_sectors += rdev->sectors; | 182 | conf->array_sectors += rdev->sectors; |
183 | cnt++; | 183 | cnt++; |
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 32a662fc55c9..4b323f45ad74 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -308,7 +308,7 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
308 | */ | 308 | */ |
309 | if (q->merge_bvec_fn && | 309 | if (q->merge_bvec_fn && |
310 | queue_max_sectors(q) > (PAGE_SIZE>>9)) | 310 | queue_max_sectors(q) > (PAGE_SIZE>>9)) |
311 | blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); | 311 | blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); |
312 | 312 | ||
313 | conf->working_disks++; | 313 | conf->working_disks++; |
314 | mddev->degraded--; | 314 | mddev->degraded--; |
@@ -478,7 +478,7 @@ static int multipath_run (mddev_t *mddev) | |||
478 | * a merge_bvec_fn to be involved in multipath */ | 478 | * a merge_bvec_fn to be involved in multipath */ |
479 | if (rdev->bdev->bd_disk->queue->merge_bvec_fn && | 479 | if (rdev->bdev->bd_disk->queue->merge_bvec_fn && |
480 | queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) | 480 | queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) |
481 | blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); | 481 | blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); |
482 | 482 | ||
483 | if (!test_bit(Faulty, &rdev->flags)) | 483 | if (!test_bit(Faulty, &rdev->flags)) |
484 | conf->working_disks++; | 484 | conf->working_disks++; |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 77605cdceaf1..a1f7147b757f 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -182,7 +182,7 @@ static int create_strip_zones(mddev_t *mddev) | |||
182 | 182 | ||
183 | if (rdev1->bdev->bd_disk->queue->merge_bvec_fn && | 183 | if (rdev1->bdev->bd_disk->queue->merge_bvec_fn && |
184 | queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) | 184 | queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) |
185 | blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); | 185 | blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); |
186 | 186 | ||
187 | if (!smallest || (rdev1->sectors < smallest->sectors)) | 187 | if (!smallest || (rdev1->sectors < smallest->sectors)) |
188 | smallest = rdev1; | 188 | smallest = rdev1; |
@@ -325,7 +325,7 @@ static int raid0_run(mddev_t *mddev) | |||
325 | } | 325 | } |
326 | if (md_check_no_bitmap(mddev)) | 326 | if (md_check_no_bitmap(mddev)) |
327 | return -EINVAL; | 327 | return -EINVAL; |
328 | blk_queue_max_sectors(mddev->queue, mddev->chunk_sectors); | 328 | blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors); |
329 | mddev->queue->queue_lock = &mddev->queue->__queue_lock; | 329 | mddev->queue->queue_lock = &mddev->queue->__queue_lock; |
330 | 330 | ||
331 | ret = create_strip_zones(mddev); | 331 | ret = create_strip_zones(mddev); |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 859bd3ffe435..5a06122abd3b 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1158,7 +1158,7 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1158 | */ | 1158 | */ |
1159 | if (rdev->bdev->bd_disk->queue->merge_bvec_fn && | 1159 | if (rdev->bdev->bd_disk->queue->merge_bvec_fn && |
1160 | queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) | 1160 | queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) |
1161 | blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); | 1161 | blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); |
1162 | 1162 | ||
1163 | p->head_position = 0; | 1163 | p->head_position = 0; |
1164 | rdev->raid_disk = mirror; | 1164 | rdev->raid_disk = mirror; |
@@ -2103,7 +2103,7 @@ static int run(mddev_t *mddev) | |||
2103 | */ | 2103 | */ |
2104 | if (rdev->bdev->bd_disk->queue->merge_bvec_fn && | 2104 | if (rdev->bdev->bd_disk->queue->merge_bvec_fn && |
2105 | queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) | 2105 | queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) |
2106 | blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); | 2106 | blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); |
2107 | } | 2107 | } |
2108 | 2108 | ||
2109 | mddev->degraded = 0; | 2109 | mddev->degraded = 0; |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index d119b7b75e71..7584f9ab9bcf 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1161,7 +1161,7 @@ static int raid10_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1161 | */ | 1161 | */ |
1162 | if (rdev->bdev->bd_disk->queue->merge_bvec_fn && | 1162 | if (rdev->bdev->bd_disk->queue->merge_bvec_fn && |
1163 | queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) | 1163 | queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) |
1164 | blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); | 1164 | blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); |
1165 | 1165 | ||
1166 | p->head_position = 0; | 1166 | p->head_position = 0; |
1167 | rdev->raid_disk = mirror; | 1167 | rdev->raid_disk = mirror; |
@@ -2260,7 +2260,7 @@ static int run(mddev_t *mddev) | |||
2260 | */ | 2260 | */ |
2261 | if (rdev->bdev->bd_disk->queue->merge_bvec_fn && | 2261 | if (rdev->bdev->bd_disk->queue->merge_bvec_fn && |
2262 | queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) | 2262 | queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) |
2263 | blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); | 2263 | blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); |
2264 | 2264 | ||
2265 | disk->head_position = 0; | 2265 | disk->head_position = 0; |
2266 | } | 2266 | } |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index ceb24afdc147..509c8f3dd9a5 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -3739,7 +3739,7 @@ static int bio_fits_rdev(struct bio *bi) | |||
3739 | if ((bi->bi_size>>9) > queue_max_sectors(q)) | 3739 | if ((bi->bi_size>>9) > queue_max_sectors(q)) |
3740 | return 0; | 3740 | return 0; |
3741 | blk_recount_segments(q, bi); | 3741 | blk_recount_segments(q, bi); |
3742 | if (bi->bi_phys_segments > queue_max_phys_segments(q)) | 3742 | if (bi->bi_phys_segments > queue_max_segments(q)) |
3743 | return 0; | 3743 | return 0; |
3744 | 3744 | ||
3745 | if (q->merge_bvec_fn) | 3745 | if (q->merge_bvec_fn) |
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c index bd83fa0a4970..972b87069d55 100644 --- a/drivers/memstick/core/mspro_block.c +++ b/drivers/memstick/core/mspro_block.c | |||
@@ -1226,9 +1226,8 @@ static int mspro_block_init_disk(struct memstick_dev *card) | |||
1226 | blk_queue_prep_rq(msb->queue, mspro_block_prepare_req); | 1226 | blk_queue_prep_rq(msb->queue, mspro_block_prepare_req); |
1227 | 1227 | ||
1228 | blk_queue_bounce_limit(msb->queue, limit); | 1228 | blk_queue_bounce_limit(msb->queue, limit); |
1229 | blk_queue_max_sectors(msb->queue, MSPRO_BLOCK_MAX_PAGES); | 1229 | blk_queue_max_hw_sectors(msb->queue, MSPRO_BLOCK_MAX_PAGES); |
1230 | blk_queue_max_phys_segments(msb->queue, MSPRO_BLOCK_MAX_SEGS); | 1230 | blk_queue_max_segments(msb->queue, MSPRO_BLOCK_MAX_SEGS); |
1231 | blk_queue_max_hw_segments(msb->queue, MSPRO_BLOCK_MAX_SEGS); | ||
1232 | blk_queue_max_segment_size(msb->queue, | 1231 | blk_queue_max_segment_size(msb->queue, |
1233 | MSPRO_BLOCK_MAX_PAGES * msb->page_size); | 1232 | MSPRO_BLOCK_MAX_PAGES * msb->page_size); |
1234 | 1233 | ||
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index e39986a78273..2658b1484a2c 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c | |||
@@ -1065,9 +1065,8 @@ static int i2o_block_probe(struct device *dev) | |||
1065 | queue = gd->queue; | 1065 | queue = gd->queue; |
1066 | queue->queuedata = i2o_blk_dev; | 1066 | queue->queuedata = i2o_blk_dev; |
1067 | 1067 | ||
1068 | blk_queue_max_phys_segments(queue, I2O_MAX_PHYS_SEGMENTS); | 1068 | blk_queue_max_hw_sectors(queue, max_sectors); |
1069 | blk_queue_max_sectors(queue, max_sectors); | 1069 | blk_queue_max_segments(queue, i2o_sg_tablesize(c, body_size)); |
1070 | blk_queue_max_hw_segments(queue, i2o_sg_tablesize(c, body_size)); | ||
1071 | 1070 | ||
1072 | osm_debug("max sectors = %d\n", queue->max_sectors); | 1071 | osm_debug("max sectors = %d\n", queue->max_sectors); |
1073 | osm_debug("phys segments = %d\n", queue->max_phys_segments); | 1072 | osm_debug("phys segments = %d\n", queue->max_phys_segments); |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 413576a2f313..b670d10d5c92 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -94,7 +94,7 @@ config TPS65010 | |||
94 | 94 | ||
95 | config MENELAUS | 95 | config MENELAUS |
96 | bool "Texas Instruments TWL92330/Menelaus PM chip" | 96 | bool "Texas Instruments TWL92330/Menelaus PM chip" |
97 | depends on I2C=y && ARCH_OMAP24XX | 97 | depends on I2C=y && ARCH_OMAP2 |
98 | help | 98 | help |
99 | If you say yes here you get support for the Texas Instruments | 99 | If you say yes here you get support for the Texas Instruments |
100 | TWL92330/Menelaus Power Management chip. This include voltage | 100 | TWL92330/Menelaus Power Management chip. This include voltage |
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 2a7606534196..19a930d06241 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c | |||
@@ -115,7 +115,8 @@ | |||
115 | #define twl_has_watchdog() false | 115 | #define twl_has_watchdog() false |
116 | #endif | 116 | #endif |
117 | 117 | ||
118 | #if defined(CONFIG_TWL4030_CODEC) || defined(CONFIG_TWL4030_CODEC_MODULE) | 118 | #if defined(CONFIG_TWL4030_CODEC) || defined(CONFIG_TWL4030_CODEC_MODULE) ||\ |
119 | defined(CONFIG_SND_SOC_TWL6030) || defined(CONFIG_SND_SOC_TWL6030_MODULE) | ||
119 | #define twl_has_codec() true | 120 | #define twl_has_codec() true |
120 | #else | 121 | #else |
121 | #define twl_has_codec() false | 122 | #define twl_has_codec() false |
@@ -711,8 +712,19 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features) | |||
711 | return PTR_ERR(child); | 712 | return PTR_ERR(child); |
712 | } | 713 | } |
713 | 714 | ||
714 | if (twl_has_codec() && pdata->codec) { | 715 | if (twl_has_codec() && pdata->codec && twl_class_is_4030()) { |
715 | child = add_child(1, "twl4030_codec", | 716 | sub_chip_id = twl_map[TWL_MODULE_AUDIO_VOICE].sid; |
717 | child = add_child(sub_chip_id, "twl4030_codec", | ||
718 | pdata->codec, sizeof(*pdata->codec), | ||
719 | false, 0, 0); | ||
720 | if (IS_ERR(child)) | ||
721 | return PTR_ERR(child); | ||
722 | } | ||
723 | |||
724 | /* Phoenix*/ | ||
725 | if (twl_has_codec() && pdata->codec && twl_class_is_6030()) { | ||
726 | sub_chip_id = twl_map[TWL_MODULE_AUDIO_VOICE].sid; | ||
727 | child = add_child(sub_chip_id, "twl6030_codec", | ||
716 | pdata->codec, sizeof(*pdata->codec), | 728 | pdata->codec, sizeof(*pdata->codec), |
717 | false, 0, 0); | 729 | false, 0, 0); |
718 | if (IS_ERR(child)) | 730 | if (IS_ERR(child)) |
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index c5a7a855f4b1..381fe032caa1 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
@@ -154,9 +154,8 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock | |||
154 | 154 | ||
155 | if (mq->bounce_buf) { | 155 | if (mq->bounce_buf) { |
156 | blk_queue_bounce_limit(mq->queue, BLK_BOUNCE_ANY); | 156 | blk_queue_bounce_limit(mq->queue, BLK_BOUNCE_ANY); |
157 | blk_queue_max_sectors(mq->queue, bouncesz / 512); | 157 | blk_queue_max_hw_sectors(mq->queue, bouncesz / 512); |
158 | blk_queue_max_phys_segments(mq->queue, bouncesz / 512); | 158 | blk_queue_max_segments(mq->queue, bouncesz / 512); |
159 | blk_queue_max_hw_segments(mq->queue, bouncesz / 512); | ||
160 | blk_queue_max_segment_size(mq->queue, bouncesz); | 159 | blk_queue_max_segment_size(mq->queue, bouncesz); |
161 | 160 | ||
162 | mq->sg = kmalloc(sizeof(struct scatterlist), | 161 | mq->sg = kmalloc(sizeof(struct scatterlist), |
@@ -180,10 +179,9 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock | |||
180 | 179 | ||
181 | if (!mq->bounce_buf) { | 180 | if (!mq->bounce_buf) { |
182 | blk_queue_bounce_limit(mq->queue, limit); | 181 | blk_queue_bounce_limit(mq->queue, limit); |
183 | blk_queue_max_sectors(mq->queue, | 182 | blk_queue_max_hw_sectors(mq->queue, |
184 | min(host->max_blk_count, host->max_req_size / 512)); | 183 | min(host->max_blk_count, host->max_req_size / 512)); |
185 | blk_queue_max_phys_segments(mq->queue, host->max_phys_segs); | 184 | blk_queue_max_segments(mq->queue, host->max_hw_segs); |
186 | blk_queue_max_hw_segments(mq->queue, host->max_hw_segs); | ||
187 | blk_queue_max_segment_size(mq->queue, host->max_seg_size); | 185 | blk_queue_max_segment_size(mq->queue, host->max_seg_size); |
188 | 186 | ||
189 | mq->sg = kmalloc(sizeof(struct scatterlist) * | 187 | mq->sg = kmalloc(sizeof(struct scatterlist) * |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 90d168ad03b6..84c103a7ee13 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * linux/drivers/mmc/host/mmci.c - ARM PrimeCell MMCI PL180/1 driver | 2 | * linux/drivers/mmc/host/mmci.c - ARM PrimeCell MMCI PL180/1 driver |
3 | * | 3 | * |
4 | * Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved. | 4 | * Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved. |
5 | * Copyright (C) 2010 ST-Ericsson AB. | ||
5 | * | 6 | * |
6 | * 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 |
7 | * it under the terms of the GNU General Public License version 2 as | 8 | * it under the terms of the GNU General Public License version 2 as |
@@ -34,9 +35,6 @@ | |||
34 | 35 | ||
35 | #define DRIVER_NAME "mmci-pl18x" | 36 | #define DRIVER_NAME "mmci-pl18x" |
36 | 37 | ||
37 | #define DBG(host,fmt,args...) \ | ||
38 | pr_debug("%s: %s: " fmt, mmc_hostname(host->mmc), __func__ , args) | ||
39 | |||
40 | static unsigned int fmax = 515633; | 38 | static unsigned int fmax = 515633; |
41 | 39 | ||
42 | /* | 40 | /* |
@@ -105,8 +103,8 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) | |||
105 | void __iomem *base; | 103 | void __iomem *base; |
106 | int blksz_bits; | 104 | int blksz_bits; |
107 | 105 | ||
108 | DBG(host, "blksz %04x blks %04x flags %08x\n", | 106 | dev_dbg(mmc_dev(host->mmc), "blksz %04x blks %04x flags %08x\n", |
109 | data->blksz, data->blocks, data->flags); | 107 | data->blksz, data->blocks, data->flags); |
110 | 108 | ||
111 | host->data = data; | 109 | host->data = data; |
112 | host->size = data->blksz; | 110 | host->size = data->blksz; |
@@ -155,7 +153,7 @@ mmci_start_command(struct mmci_host *host, struct mmc_command *cmd, u32 c) | |||
155 | { | 153 | { |
156 | void __iomem *base = host->base; | 154 | void __iomem *base = host->base; |
157 | 155 | ||
158 | DBG(host, "op %02x arg %08x flags %08x\n", | 156 | dev_dbg(mmc_dev(host->mmc), "op %02x arg %08x flags %08x\n", |
159 | cmd->opcode, cmd->arg, cmd->flags); | 157 | cmd->opcode, cmd->arg, cmd->flags); |
160 | 158 | ||
161 | if (readl(base + MMCICOMMAND) & MCI_CPSM_ENABLE) { | 159 | if (readl(base + MMCICOMMAND) & MCI_CPSM_ENABLE) { |
@@ -184,8 +182,20 @@ mmci_data_irq(struct mmci_host *host, struct mmc_data *data, | |||
184 | { | 182 | { |
185 | if (status & MCI_DATABLOCKEND) { | 183 | if (status & MCI_DATABLOCKEND) { |
186 | host->data_xfered += data->blksz; | 184 | host->data_xfered += data->blksz; |
185 | #ifdef CONFIG_ARCH_U300 | ||
186 | /* | ||
187 | * On the U300 some signal or other is | ||
188 | * badly routed so that a data write does | ||
189 | * not properly terminate with a MCI_DATAEND | ||
190 | * status flag. This quirk will make writes | ||
191 | * work again. | ||
192 | */ | ||
193 | if (data->flags & MMC_DATA_WRITE) | ||
194 | status |= MCI_DATAEND; | ||
195 | #endif | ||
187 | } | 196 | } |
188 | if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN|MCI_RXOVERRUN)) { | 197 | if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN|MCI_RXOVERRUN)) { |
198 | dev_dbg(mmc_dev(host->mmc), "MCI ERROR IRQ (status %08x)\n", status); | ||
189 | if (status & MCI_DATACRCFAIL) | 199 | if (status & MCI_DATACRCFAIL) |
190 | data->error = -EILSEQ; | 200 | data->error = -EILSEQ; |
191 | else if (status & MCI_DATATIMEOUT) | 201 | else if (status & MCI_DATATIMEOUT) |
@@ -307,7 +317,7 @@ static irqreturn_t mmci_pio_irq(int irq, void *dev_id) | |||
307 | 317 | ||
308 | status = readl(base + MMCISTATUS); | 318 | status = readl(base + MMCISTATUS); |
309 | 319 | ||
310 | DBG(host, "irq1 %08x\n", status); | 320 | dev_dbg(mmc_dev(host->mmc), "irq1 (pio) %08x\n", status); |
311 | 321 | ||
312 | do { | 322 | do { |
313 | unsigned long flags; | 323 | unsigned long flags; |
@@ -401,7 +411,7 @@ static irqreturn_t mmci_irq(int irq, void *dev_id) | |||
401 | status &= readl(host->base + MMCIMASK0); | 411 | status &= readl(host->base + MMCIMASK0); |
402 | writel(status, host->base + MMCICLEAR); | 412 | writel(status, host->base + MMCICLEAR); |
403 | 413 | ||
404 | DBG(host, "irq0 %08x\n", status); | 414 | dev_dbg(mmc_dev(host->mmc), "irq0 (data+cmd) %08x\n", status); |
405 | 415 | ||
406 | data = host->data; | 416 | data = host->data; |
407 | if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN| | 417 | if (status & (MCI_DATACRCFAIL|MCI_DATATIMEOUT|MCI_TXUNDERRUN| |
@@ -428,8 +438,8 @@ static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
428 | WARN_ON(host->mrq != NULL); | 438 | WARN_ON(host->mrq != NULL); |
429 | 439 | ||
430 | if (mrq->data && !is_power_of_2(mrq->data->blksz)) { | 440 | if (mrq->data && !is_power_of_2(mrq->data->blksz)) { |
431 | printk(KERN_ERR "%s: Unsupported block size (%d bytes)\n", | 441 | dev_err(mmc_dev(mmc), "unsupported block size (%d bytes)\n", |
432 | mmc_hostname(mmc), mrq->data->blksz); | 442 | mrq->data->blksz); |
433 | mrq->cmd->error = -EINVAL; | 443 | mrq->cmd->error = -EINVAL; |
434 | mmc_request_done(mmc, mrq); | 444 | mmc_request_done(mmc, mrq); |
435 | return; | 445 | return; |
@@ -582,8 +592,8 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
582 | 592 | ||
583 | host->hw_designer = amba_manf(dev); | 593 | host->hw_designer = amba_manf(dev); |
584 | host->hw_revision = amba_rev(dev); | 594 | host->hw_revision = amba_rev(dev); |
585 | DBG(host, "designer ID = 0x%02x\n", host->hw_designer); | 595 | dev_dbg(mmc_dev(mmc), "designer ID = 0x%02x\n", host->hw_designer); |
586 | DBG(host, "revision = 0x%01x\n", host->hw_revision); | 596 | dev_dbg(mmc_dev(mmc), "revision = 0x%01x\n", host->hw_revision); |
587 | 597 | ||
588 | host->clk = clk_get(&dev->dev, NULL); | 598 | host->clk = clk_get(&dev->dev, NULL); |
589 | if (IS_ERR(host->clk)) { | 599 | if (IS_ERR(host->clk)) { |
@@ -608,7 +618,8 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
608 | if (ret < 0) | 618 | if (ret < 0) |
609 | goto clk_disable; | 619 | goto clk_disable; |
610 | host->mclk = clk_get_rate(host->clk); | 620 | host->mclk = clk_get_rate(host->clk); |
611 | DBG(host, "eventual mclk rate: %u Hz\n", host->mclk); | 621 | dev_dbg(mmc_dev(mmc), "eventual mclk rate: %u Hz\n", |
622 | host->mclk); | ||
612 | } | 623 | } |
613 | host->base = ioremap(dev->res.start, resource_size(&dev->res)); | 624 | host->base = ioremap(dev->res.start, resource_size(&dev->res)); |
614 | if (!host->base) { | 625 | if (!host->base) { |
@@ -619,6 +630,8 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
619 | mmc->ops = &mmci_ops; | 630 | mmc->ops = &mmci_ops; |
620 | mmc->f_min = (host->mclk + 511) / 512; | 631 | mmc->f_min = (host->mclk + 511) / 512; |
621 | mmc->f_max = min(host->mclk, fmax); | 632 | mmc->f_max = min(host->mclk, fmax); |
633 | dev_dbg(mmc_dev(mmc), "clocking block at %u Hz\n", mmc->f_max); | ||
634 | |||
622 | #ifdef CONFIG_REGULATOR | 635 | #ifdef CONFIG_REGULATOR |
623 | /* If we're using the regulator framework, try to fetch a regulator */ | 636 | /* If we're using the regulator framework, try to fetch a regulator */ |
624 | host->vcc = regulator_get(&dev->dev, "vmmc"); | 637 | host->vcc = regulator_get(&dev->dev, "vmmc"); |
@@ -712,7 +725,7 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
712 | 725 | ||
713 | mmc_add_host(mmc); | 726 | mmc_add_host(mmc); |
714 | 727 | ||
715 | printk(KERN_INFO "%s: MMCI rev %x cfg %02x at 0x%016llx irq %d,%d\n", | 728 | dev_info(&dev->dev, "%s: MMCI rev %x cfg %02x at 0x%016llx irq %d,%d\n", |
716 | mmc_hostname(mmc), amba_rev(dev), amba_config(dev), | 729 | mmc_hostname(mmc), amba_rev(dev), amba_config(dev), |
717 | (unsigned long long)dev->res.start, dev->irq[0], dev->irq[1]); | 730 | (unsigned long long)dev->res.start, dev->irq[0], dev->irq[1]); |
718 | 731 | ||
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 4b2322518909..83f0affadcae 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -30,6 +30,8 @@ | |||
30 | #include <linux/mmc/core.h> | 30 | #include <linux/mmc/core.h> |
31 | #include <linux/io.h> | 31 | #include <linux/io.h> |
32 | #include <linux/semaphore.h> | 32 | #include <linux/semaphore.h> |
33 | #include <linux/gpio.h> | ||
34 | #include <linux/regulator/consumer.h> | ||
33 | #include <plat/dma.h> | 35 | #include <plat/dma.h> |
34 | #include <mach/hardware.h> | 36 | #include <mach/hardware.h> |
35 | #include <plat/board.h> | 37 | #include <plat/board.h> |
@@ -146,6 +148,15 @@ struct omap_hsmmc_host { | |||
146 | struct clk *fclk; | 148 | struct clk *fclk; |
147 | struct clk *iclk; | 149 | struct clk *iclk; |
148 | struct clk *dbclk; | 150 | struct clk *dbclk; |
151 | /* | ||
152 | * vcc == configured supply | ||
153 | * vcc_aux == optional | ||
154 | * - MMC1, supply for DAT4..DAT7 | ||
155 | * - MMC2/MMC2, external level shifter voltage supply, for | ||
156 | * chip (SDIO, eMMC, etc) or transceiver (MMC2 only) | ||
157 | */ | ||
158 | struct regulator *vcc; | ||
159 | struct regulator *vcc_aux; | ||
149 | struct semaphore sem; | 160 | struct semaphore sem; |
150 | struct work_struct mmc_carddetect_work; | 161 | struct work_struct mmc_carddetect_work; |
151 | void __iomem *base; | 162 | void __iomem *base; |
@@ -171,10 +182,337 @@ struct omap_hsmmc_host { | |||
171 | int vdd; | 182 | int vdd; |
172 | int protect_card; | 183 | int protect_card; |
173 | int reqs_blocked; | 184 | int reqs_blocked; |
185 | int use_reg; | ||
174 | 186 | ||
175 | struct omap_mmc_platform_data *pdata; | 187 | struct omap_mmc_platform_data *pdata; |
176 | }; | 188 | }; |
177 | 189 | ||
190 | static int omap_hsmmc_card_detect(struct device *dev, int slot) | ||
191 | { | ||
192 | struct omap_mmc_platform_data *mmc = dev->platform_data; | ||
193 | |||
194 | /* NOTE: assumes card detect signal is active-low */ | ||
195 | return !gpio_get_value_cansleep(mmc->slots[0].switch_pin); | ||
196 | } | ||
197 | |||
198 | static int omap_hsmmc_get_wp(struct device *dev, int slot) | ||
199 | { | ||
200 | struct omap_mmc_platform_data *mmc = dev->platform_data; | ||
201 | |||
202 | /* NOTE: assumes write protect signal is active-high */ | ||
203 | return gpio_get_value_cansleep(mmc->slots[0].gpio_wp); | ||
204 | } | ||
205 | |||
206 | static int omap_hsmmc_get_cover_state(struct device *dev, int slot) | ||
207 | { | ||
208 | struct omap_mmc_platform_data *mmc = dev->platform_data; | ||
209 | |||
210 | /* NOTE: assumes card detect signal is active-low */ | ||
211 | return !gpio_get_value_cansleep(mmc->slots[0].switch_pin); | ||
212 | } | ||
213 | |||
214 | #ifdef CONFIG_PM | ||
215 | |||
216 | static int omap_hsmmc_suspend_cdirq(struct device *dev, int slot) | ||
217 | { | ||
218 | struct omap_mmc_platform_data *mmc = dev->platform_data; | ||
219 | |||
220 | disable_irq(mmc->slots[0].card_detect_irq); | ||
221 | return 0; | ||
222 | } | ||
223 | |||
224 | static int omap_hsmmc_resume_cdirq(struct device *dev, int slot) | ||
225 | { | ||
226 | struct omap_mmc_platform_data *mmc = dev->platform_data; | ||
227 | |||
228 | enable_irq(mmc->slots[0].card_detect_irq); | ||
229 | return 0; | ||
230 | } | ||
231 | |||
232 | #else | ||
233 | |||
234 | #define omap_hsmmc_suspend_cdirq NULL | ||
235 | #define omap_hsmmc_resume_cdirq NULL | ||
236 | |||
237 | #endif | ||
238 | |||
239 | #ifdef CONFIG_REGULATOR | ||
240 | |||
241 | static int omap_hsmmc_1_set_power(struct device *dev, int slot, int power_on, | ||
242 | int vdd) | ||
243 | { | ||
244 | struct omap_hsmmc_host *host = | ||
245 | platform_get_drvdata(to_platform_device(dev)); | ||
246 | int ret; | ||
247 | |||
248 | if (mmc_slot(host).before_set_reg) | ||
249 | mmc_slot(host).before_set_reg(dev, slot, power_on, vdd); | ||
250 | |||
251 | if (power_on) | ||
252 | ret = mmc_regulator_set_ocr(host->vcc, vdd); | ||
253 | else | ||
254 | ret = mmc_regulator_set_ocr(host->vcc, 0); | ||
255 | |||
256 | if (mmc_slot(host).after_set_reg) | ||
257 | mmc_slot(host).after_set_reg(dev, slot, power_on, vdd); | ||
258 | |||
259 | return ret; | ||
260 | } | ||
261 | |||
262 | static int omap_hsmmc_23_set_power(struct device *dev, int slot, int power_on, | ||
263 | int vdd) | ||
264 | { | ||
265 | struct omap_hsmmc_host *host = | ||
266 | platform_get_drvdata(to_platform_device(dev)); | ||
267 | int ret = 0; | ||
268 | |||
269 | /* | ||
270 | * If we don't see a Vcc regulator, assume it's a fixed | ||
271 | * voltage always-on regulator. | ||
272 | */ | ||
273 | if (!host->vcc) | ||
274 | return 0; | ||
275 | |||
276 | if (mmc_slot(host).before_set_reg) | ||
277 | mmc_slot(host).before_set_reg(dev, slot, power_on, vdd); | ||
278 | |||
279 | /* | ||
280 | * Assume Vcc regulator is used only to power the card ... OMAP | ||
281 | * VDDS is used to power the pins, optionally with a transceiver to | ||
282 | * support cards using voltages other than VDDS (1.8V nominal). When a | ||
283 | * transceiver is used, DAT3..7 are muxed as transceiver control pins. | ||
284 | * | ||
285 | * In some cases this regulator won't support enable/disable; | ||
286 | * e.g. it's a fixed rail for a WLAN chip. | ||
287 | * | ||
288 | * In other cases vcc_aux switches interface power. Example, for | ||
289 | * eMMC cards it represents VccQ. Sometimes transceivers or SDIO | ||
290 | * chips/cards need an interface voltage rail too. | ||
291 | */ | ||
292 | if (power_on) { | ||
293 | ret = mmc_regulator_set_ocr(host->vcc, vdd); | ||
294 | /* Enable interface voltage rail, if needed */ | ||
295 | if (ret == 0 && host->vcc_aux) { | ||
296 | ret = regulator_enable(host->vcc_aux); | ||
297 | if (ret < 0) | ||
298 | ret = mmc_regulator_set_ocr(host->vcc, 0); | ||
299 | } | ||
300 | } else { | ||
301 | if (host->vcc_aux) | ||
302 | ret = regulator_disable(host->vcc_aux); | ||
303 | if (ret == 0) | ||
304 | ret = mmc_regulator_set_ocr(host->vcc, 0); | ||
305 | } | ||
306 | |||
307 | if (mmc_slot(host).after_set_reg) | ||
308 | mmc_slot(host).after_set_reg(dev, slot, power_on, vdd); | ||
309 | |||
310 | return ret; | ||
311 | } | ||
312 | |||
313 | static int omap_hsmmc_1_set_sleep(struct device *dev, int slot, int sleep, | ||
314 | int vdd, int cardsleep) | ||
315 | { | ||
316 | struct omap_hsmmc_host *host = | ||
317 | platform_get_drvdata(to_platform_device(dev)); | ||
318 | int mode = sleep ? REGULATOR_MODE_STANDBY : REGULATOR_MODE_NORMAL; | ||
319 | |||
320 | return regulator_set_mode(host->vcc, mode); | ||
321 | } | ||
322 | |||
323 | static int omap_hsmmc_23_set_sleep(struct device *dev, int slot, int sleep, | ||
324 | int vdd, int cardsleep) | ||
325 | { | ||
326 | struct omap_hsmmc_host *host = | ||
327 | platform_get_drvdata(to_platform_device(dev)); | ||
328 | int err, mode; | ||
329 | |||
330 | /* | ||
331 | * If we don't see a Vcc regulator, assume it's a fixed | ||
332 | * voltage always-on regulator. | ||
333 | */ | ||
334 | if (!host->vcc) | ||
335 | return 0; | ||
336 | |||
337 | mode = sleep ? REGULATOR_MODE_STANDBY : REGULATOR_MODE_NORMAL; | ||
338 | |||
339 | if (!host->vcc_aux) | ||
340 | return regulator_set_mode(host->vcc, mode); | ||
341 | |||
342 | if (cardsleep) { | ||
343 | /* VCC can be turned off if card is asleep */ | ||
344 | if (sleep) | ||
345 | err = mmc_regulator_set_ocr(host->vcc, 0); | ||
346 | else | ||
347 | err = mmc_regulator_set_ocr(host->vcc, vdd); | ||
348 | } else | ||
349 | err = regulator_set_mode(host->vcc, mode); | ||
350 | if (err) | ||
351 | return err; | ||
352 | |||
353 | if (!mmc_slot(host).vcc_aux_disable_is_sleep) | ||
354 | return regulator_set_mode(host->vcc_aux, mode); | ||
355 | |||
356 | if (sleep) | ||
357 | return regulator_disable(host->vcc_aux); | ||
358 | else | ||
359 | return regulator_enable(host->vcc_aux); | ||
360 | } | ||
361 | |||
362 | static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) | ||
363 | { | ||
364 | struct regulator *reg; | ||
365 | int ret = 0; | ||
366 | |||
367 | switch (host->id) { | ||
368 | case OMAP_MMC1_DEVID: | ||
369 | /* On-chip level shifting via PBIAS0/PBIAS1 */ | ||
370 | mmc_slot(host).set_power = omap_hsmmc_1_set_power; | ||
371 | mmc_slot(host).set_sleep = omap_hsmmc_1_set_sleep; | ||
372 | break; | ||
373 | case OMAP_MMC2_DEVID: | ||
374 | case OMAP_MMC3_DEVID: | ||
375 | /* Off-chip level shifting, or none */ | ||
376 | mmc_slot(host).set_power = omap_hsmmc_23_set_power; | ||
377 | mmc_slot(host).set_sleep = omap_hsmmc_23_set_sleep; | ||
378 | break; | ||
379 | default: | ||
380 | pr_err("MMC%d configuration not supported!\n", host->id); | ||
381 | return -EINVAL; | ||
382 | } | ||
383 | |||
384 | reg = regulator_get(host->dev, "vmmc"); | ||
385 | if (IS_ERR(reg)) { | ||
386 | dev_dbg(host->dev, "vmmc regulator missing\n"); | ||
387 | /* | ||
388 | * HACK: until fixed.c regulator is usable, | ||
389 | * we don't require a main regulator | ||
390 | * for MMC2 or MMC3 | ||
391 | */ | ||
392 | if (host->id == OMAP_MMC1_DEVID) { | ||
393 | ret = PTR_ERR(reg); | ||
394 | goto err; | ||
395 | } | ||
396 | } else { | ||
397 | host->vcc = reg; | ||
398 | mmc_slot(host).ocr_mask = mmc_regulator_get_ocrmask(reg); | ||
399 | |||
400 | /* Allow an aux regulator */ | ||
401 | reg = regulator_get(host->dev, "vmmc_aux"); | ||
402 | host->vcc_aux = IS_ERR(reg) ? NULL : reg; | ||
403 | |||
404 | /* | ||
405 | * UGLY HACK: workaround regulator framework bugs. | ||
406 | * When the bootloader leaves a supply active, it's | ||
407 | * initialized with zero usecount ... and we can't | ||
408 | * disable it without first enabling it. Until the | ||
409 | * framework is fixed, we need a workaround like this | ||
410 | * (which is safe for MMC, but not in general). | ||
411 | */ | ||
412 | if (regulator_is_enabled(host->vcc) > 0) { | ||
413 | regulator_enable(host->vcc); | ||
414 | regulator_disable(host->vcc); | ||
415 | } | ||
416 | if (host->vcc_aux) { | ||
417 | if (regulator_is_enabled(reg) > 0) { | ||
418 | regulator_enable(reg); | ||
419 | regulator_disable(reg); | ||
420 | } | ||
421 | } | ||
422 | } | ||
423 | |||
424 | return 0; | ||
425 | |||
426 | err: | ||
427 | mmc_slot(host).set_power = NULL; | ||
428 | mmc_slot(host).set_sleep = NULL; | ||
429 | return ret; | ||
430 | } | ||
431 | |||
432 | static void omap_hsmmc_reg_put(struct omap_hsmmc_host *host) | ||
433 | { | ||
434 | regulator_put(host->vcc); | ||
435 | regulator_put(host->vcc_aux); | ||
436 | mmc_slot(host).set_power = NULL; | ||
437 | mmc_slot(host).set_sleep = NULL; | ||
438 | } | ||
439 | |||
440 | static inline int omap_hsmmc_have_reg(void) | ||
441 | { | ||
442 | return 1; | ||
443 | } | ||
444 | |||
445 | #else | ||
446 | |||
447 | static inline int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) | ||
448 | { | ||
449 | return -EINVAL; | ||
450 | } | ||
451 | |||
452 | static inline void omap_hsmmc_reg_put(struct omap_hsmmc_host *host) | ||
453 | { | ||
454 | } | ||
455 | |||
456 | static inline int omap_hsmmc_have_reg(void) | ||
457 | { | ||
458 | return 0; | ||
459 | } | ||
460 | |||
461 | #endif | ||
462 | |||
463 | static int omap_hsmmc_gpio_init(struct omap_mmc_platform_data *pdata) | ||
464 | { | ||
465 | int ret; | ||
466 | |||
467 | if (gpio_is_valid(pdata->slots[0].switch_pin)) { | ||
468 | pdata->suspend = omap_hsmmc_suspend_cdirq; | ||
469 | pdata->resume = omap_hsmmc_resume_cdirq; | ||
470 | if (pdata->slots[0].cover) | ||
471 | pdata->slots[0].get_cover_state = | ||
472 | omap_hsmmc_get_cover_state; | ||
473 | else | ||
474 | pdata->slots[0].card_detect = omap_hsmmc_card_detect; | ||
475 | pdata->slots[0].card_detect_irq = | ||
476 | gpio_to_irq(pdata->slots[0].switch_pin); | ||
477 | ret = gpio_request(pdata->slots[0].switch_pin, "mmc_cd"); | ||
478 | if (ret) | ||
479 | return ret; | ||
480 | ret = gpio_direction_input(pdata->slots[0].switch_pin); | ||
481 | if (ret) | ||
482 | goto err_free_sp; | ||
483 | } else | ||
484 | pdata->slots[0].switch_pin = -EINVAL; | ||
485 | |||
486 | if (gpio_is_valid(pdata->slots[0].gpio_wp)) { | ||
487 | pdata->slots[0].get_ro = omap_hsmmc_get_wp; | ||
488 | ret = gpio_request(pdata->slots[0].gpio_wp, "mmc_wp"); | ||
489 | if (ret) | ||
490 | goto err_free_cd; | ||
491 | ret = gpio_direction_input(pdata->slots[0].gpio_wp); | ||
492 | if (ret) | ||
493 | goto err_free_wp; | ||
494 | } else | ||
495 | pdata->slots[0].gpio_wp = -EINVAL; | ||
496 | |||
497 | return 0; | ||
498 | |||
499 | err_free_wp: | ||
500 | gpio_free(pdata->slots[0].gpio_wp); | ||
501 | err_free_cd: | ||
502 | if (gpio_is_valid(pdata->slots[0].switch_pin)) | ||
503 | err_free_sp: | ||
504 | gpio_free(pdata->slots[0].switch_pin); | ||
505 | return ret; | ||
506 | } | ||
507 | |||
508 | static void omap_hsmmc_gpio_free(struct omap_mmc_platform_data *pdata) | ||
509 | { | ||
510 | if (gpio_is_valid(pdata->slots[0].gpio_wp)) | ||
511 | gpio_free(pdata->slots[0].gpio_wp); | ||
512 | if (gpio_is_valid(pdata->slots[0].switch_pin)) | ||
513 | gpio_free(pdata->slots[0].switch_pin); | ||
514 | } | ||
515 | |||
178 | /* | 516 | /* |
179 | * Stop clock to the card | 517 | * Stop clock to the card |
180 | */ | 518 | */ |
@@ -835,7 +1173,7 @@ static void omap_hsmmc_detect(struct work_struct *work) | |||
835 | sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch"); | 1173 | sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch"); |
836 | 1174 | ||
837 | if (slot->card_detect) | 1175 | if (slot->card_detect) |
838 | carddetect = slot->card_detect(slot->card_detect_irq); | 1176 | carddetect = slot->card_detect(host->dev, host->slot_id); |
839 | else { | 1177 | else { |
840 | omap_hsmmc_protect_card(host); | 1178 | omap_hsmmc_protect_card(host); |
841 | carddetect = -ENOSYS; | 1179 | carddetect = -ENOSYS; |
@@ -1242,7 +1580,7 @@ static int omap_hsmmc_get_cd(struct mmc_host *mmc) | |||
1242 | 1580 | ||
1243 | if (!mmc_slot(host).card_detect) | 1581 | if (!mmc_slot(host).card_detect) |
1244 | return -ENOSYS; | 1582 | return -ENOSYS; |
1245 | return mmc_slot(host).card_detect(mmc_slot(host).card_detect_irq); | 1583 | return mmc_slot(host).card_detect(host->dev, host->slot_id); |
1246 | } | 1584 | } |
1247 | 1585 | ||
1248 | static int omap_hsmmc_get_ro(struct mmc_host *mmc) | 1586 | static int omap_hsmmc_get_ro(struct mmc_host *mmc) |
@@ -1311,7 +1649,7 @@ static int omap_hsmmc_enabled_to_disabled(struct omap_hsmmc_host *host) | |||
1311 | if (host->power_mode == MMC_POWER_OFF) | 1649 | if (host->power_mode == MMC_POWER_OFF) |
1312 | return 0; | 1650 | return 0; |
1313 | 1651 | ||
1314 | return msecs_to_jiffies(OMAP_MMC_SLEEP_TIMEOUT); | 1652 | return OMAP_MMC_SLEEP_TIMEOUT; |
1315 | } | 1653 | } |
1316 | 1654 | ||
1317 | /* Handler for [DISABLED -> REGSLEEP / CARDSLEEP] transition */ | 1655 | /* Handler for [DISABLED -> REGSLEEP / CARDSLEEP] transition */ |
@@ -1347,11 +1685,14 @@ static int omap_hsmmc_disabled_to_sleep(struct omap_hsmmc_host *host) | |||
1347 | dev_dbg(mmc_dev(host->mmc), "DISABLED -> %s\n", | 1685 | dev_dbg(mmc_dev(host->mmc), "DISABLED -> %s\n", |
1348 | host->dpm_state == CARDSLEEP ? "CARDSLEEP" : "REGSLEEP"); | 1686 | host->dpm_state == CARDSLEEP ? "CARDSLEEP" : "REGSLEEP"); |
1349 | 1687 | ||
1688 | if (mmc_slot(host).no_off) | ||
1689 | return 0; | ||
1690 | |||
1350 | if ((host->mmc->caps & MMC_CAP_NONREMOVABLE) || | 1691 | if ((host->mmc->caps & MMC_CAP_NONREMOVABLE) || |
1351 | mmc_slot(host).card_detect || | 1692 | mmc_slot(host).card_detect || |
1352 | (mmc_slot(host).get_cover_state && | 1693 | (mmc_slot(host).get_cover_state && |
1353 | mmc_slot(host).get_cover_state(host->dev, host->slot_id))) | 1694 | mmc_slot(host).get_cover_state(host->dev, host->slot_id))) |
1354 | return msecs_to_jiffies(OMAP_MMC_OFF_TIMEOUT); | 1695 | return OMAP_MMC_OFF_TIMEOUT; |
1355 | 1696 | ||
1356 | return 0; | 1697 | return 0; |
1357 | } | 1698 | } |
@@ -1362,6 +1703,9 @@ static int omap_hsmmc_sleep_to_off(struct omap_hsmmc_host *host) | |||
1362 | if (!mmc_try_claim_host(host->mmc)) | 1703 | if (!mmc_try_claim_host(host->mmc)) |
1363 | return 0; | 1704 | return 0; |
1364 | 1705 | ||
1706 | if (mmc_slot(host).no_off) | ||
1707 | return 0; | ||
1708 | |||
1365 | if (!((host->mmc->caps & MMC_CAP_NONREMOVABLE) || | 1709 | if (!((host->mmc->caps & MMC_CAP_NONREMOVABLE) || |
1366 | mmc_slot(host).card_detect || | 1710 | mmc_slot(host).card_detect || |
1367 | (mmc_slot(host).get_cover_state && | 1711 | (mmc_slot(host).get_cover_state && |
@@ -1616,7 +1960,7 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) | |||
1616 | struct mmc_host *mmc; | 1960 | struct mmc_host *mmc; |
1617 | struct omap_hsmmc_host *host = NULL; | 1961 | struct omap_hsmmc_host *host = NULL; |
1618 | struct resource *res; | 1962 | struct resource *res; |
1619 | int ret = 0, irq; | 1963 | int ret, irq; |
1620 | 1964 | ||
1621 | if (pdata == NULL) { | 1965 | if (pdata == NULL) { |
1622 | dev_err(&pdev->dev, "Platform Data is missing\n"); | 1966 | dev_err(&pdev->dev, "Platform Data is missing\n"); |
@@ -1638,10 +1982,14 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) | |||
1638 | if (res == NULL) | 1982 | if (res == NULL) |
1639 | return -EBUSY; | 1983 | return -EBUSY; |
1640 | 1984 | ||
1985 | ret = omap_hsmmc_gpio_init(pdata); | ||
1986 | if (ret) | ||
1987 | goto err; | ||
1988 | |||
1641 | mmc = mmc_alloc_host(sizeof(struct omap_hsmmc_host), &pdev->dev); | 1989 | mmc = mmc_alloc_host(sizeof(struct omap_hsmmc_host), &pdev->dev); |
1642 | if (!mmc) { | 1990 | if (!mmc) { |
1643 | ret = -ENOMEM; | 1991 | ret = -ENOMEM; |
1644 | goto err; | 1992 | goto err_alloc; |
1645 | } | 1993 | } |
1646 | 1994 | ||
1647 | host = mmc_priv(mmc); | 1995 | host = mmc_priv(mmc); |
@@ -1656,7 +2004,7 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) | |||
1656 | host->slot_id = 0; | 2004 | host->slot_id = 0; |
1657 | host->mapbase = res->start; | 2005 | host->mapbase = res->start; |
1658 | host->base = ioremap(host->mapbase, SZ_4K); | 2006 | host->base = ioremap(host->mapbase, SZ_4K); |
1659 | host->power_mode = -1; | 2007 | host->power_mode = MMC_POWER_OFF; |
1660 | 2008 | ||
1661 | platform_set_drvdata(pdev, host); | 2009 | platform_set_drvdata(pdev, host); |
1662 | INIT_WORK(&host->mmc_carddetect_work, omap_hsmmc_detect); | 2010 | INIT_WORK(&host->mmc_carddetect_work, omap_hsmmc_detect); |
@@ -1666,6 +2014,13 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) | |||
1666 | else | 2014 | else |
1667 | mmc->ops = &omap_hsmmc_ops; | 2015 | mmc->ops = &omap_hsmmc_ops; |
1668 | 2016 | ||
2017 | /* | ||
2018 | * If regulator_disable can only put vcc_aux to sleep then there is | ||
2019 | * no off state. | ||
2020 | */ | ||
2021 | if (mmc_slot(host).vcc_aux_disable_is_sleep) | ||
2022 | mmc_slot(host).no_off = 1; | ||
2023 | |||
1669 | mmc->f_min = 400000; | 2024 | mmc->f_min = 400000; |
1670 | mmc->f_max = 52000000; | 2025 | mmc->f_max = 52000000; |
1671 | 2026 | ||
@@ -1781,7 +2136,6 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) | |||
1781 | goto err_irq; | 2136 | goto err_irq; |
1782 | } | 2137 | } |
1783 | 2138 | ||
1784 | /* initialize power supplies, gpios, etc */ | ||
1785 | if (pdata->init != NULL) { | 2139 | if (pdata->init != NULL) { |
1786 | if (pdata->init(&pdev->dev) != 0) { | 2140 | if (pdata->init(&pdev->dev) != 0) { |
1787 | dev_dbg(mmc_dev(host->mmc), | 2141 | dev_dbg(mmc_dev(host->mmc), |
@@ -1789,6 +2143,14 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) | |||
1789 | goto err_irq_cd_init; | 2143 | goto err_irq_cd_init; |
1790 | } | 2144 | } |
1791 | } | 2145 | } |
2146 | |||
2147 | if (omap_hsmmc_have_reg() && !mmc_slot(host).set_power) { | ||
2148 | ret = omap_hsmmc_reg_get(host); | ||
2149 | if (ret) | ||
2150 | goto err_reg; | ||
2151 | host->use_reg = 1; | ||
2152 | } | ||
2153 | |||
1792 | mmc->ocr_avail = mmc_slot(host).ocr_mask; | 2154 | mmc->ocr_avail = mmc_slot(host).ocr_mask; |
1793 | 2155 | ||
1794 | /* Request IRQ for card detect */ | 2156 | /* Request IRQ for card detect */ |
@@ -1823,19 +2185,22 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) | |||
1823 | ret = device_create_file(&mmc->class_dev, | 2185 | ret = device_create_file(&mmc->class_dev, |
1824 | &dev_attr_cover_switch); | 2186 | &dev_attr_cover_switch); |
1825 | if (ret < 0) | 2187 | if (ret < 0) |
1826 | goto err_cover_switch; | 2188 | goto err_slot_name; |
1827 | } | 2189 | } |
1828 | 2190 | ||
1829 | omap_hsmmc_debugfs(mmc); | 2191 | omap_hsmmc_debugfs(mmc); |
1830 | 2192 | ||
1831 | return 0; | 2193 | return 0; |
1832 | 2194 | ||
1833 | err_cover_switch: | ||
1834 | device_remove_file(&mmc->class_dev, &dev_attr_cover_switch); | ||
1835 | err_slot_name: | 2195 | err_slot_name: |
1836 | mmc_remove_host(mmc); | 2196 | mmc_remove_host(mmc); |
1837 | err_irq_cd: | ||
1838 | free_irq(mmc_slot(host).card_detect_irq, host); | 2197 | free_irq(mmc_slot(host).card_detect_irq, host); |
2198 | err_irq_cd: | ||
2199 | if (host->use_reg) | ||
2200 | omap_hsmmc_reg_put(host); | ||
2201 | err_reg: | ||
2202 | if (host->pdata->cleanup) | ||
2203 | host->pdata->cleanup(&pdev->dev); | ||
1839 | err_irq_cd_init: | 2204 | err_irq_cd_init: |
1840 | free_irq(host->irq, host); | 2205 | free_irq(host->irq, host); |
1841 | err_irq: | 2206 | err_irq: |
@@ -1847,14 +2212,14 @@ err_irq: | |||
1847 | clk_disable(host->dbclk); | 2212 | clk_disable(host->dbclk); |
1848 | clk_put(host->dbclk); | 2213 | clk_put(host->dbclk); |
1849 | } | 2214 | } |
1850 | |||
1851 | err1: | 2215 | err1: |
1852 | iounmap(host->base); | 2216 | iounmap(host->base); |
2217 | platform_set_drvdata(pdev, NULL); | ||
2218 | mmc_free_host(mmc); | ||
2219 | err_alloc: | ||
2220 | omap_hsmmc_gpio_free(pdata); | ||
1853 | err: | 2221 | err: |
1854 | dev_dbg(mmc_dev(host->mmc), "Probe Failed\n"); | ||
1855 | release_mem_region(res->start, res->end - res->start + 1); | 2222 | release_mem_region(res->start, res->end - res->start + 1); |
1856 | if (host) | ||
1857 | mmc_free_host(mmc); | ||
1858 | return ret; | 2223 | return ret; |
1859 | } | 2224 | } |
1860 | 2225 | ||
@@ -1866,6 +2231,8 @@ static int omap_hsmmc_remove(struct platform_device *pdev) | |||
1866 | if (host) { | 2231 | if (host) { |
1867 | mmc_host_enable(host->mmc); | 2232 | mmc_host_enable(host->mmc); |
1868 | mmc_remove_host(host->mmc); | 2233 | mmc_remove_host(host->mmc); |
2234 | if (host->use_reg) | ||
2235 | omap_hsmmc_reg_put(host); | ||
1869 | if (host->pdata->cleanup) | 2236 | if (host->pdata->cleanup) |
1870 | host->pdata->cleanup(&pdev->dev); | 2237 | host->pdata->cleanup(&pdev->dev); |
1871 | free_irq(host->irq, host); | 2238 | free_irq(host->irq, host); |
@@ -1884,6 +2251,7 @@ static int omap_hsmmc_remove(struct platform_device *pdev) | |||
1884 | 2251 | ||
1885 | mmc_free_host(host->mmc); | 2252 | mmc_free_host(host->mmc); |
1886 | iounmap(host->base); | 2253 | iounmap(host->base); |
2254 | omap_hsmmc_gpio_free(pdev->dev.platform_data); | ||
1887 | } | 2255 | } |
1888 | 2256 | ||
1889 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2257 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index 2bb03a8b9ef1..aa2807d0ce72 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig | |||
@@ -422,15 +422,6 @@ config MTD_H720X | |||
422 | This enables access to the flash chips on the Hynix evaluation boards. | 422 | This enables access to the flash chips on the Hynix evaluation boards. |
423 | If you have such a board, say 'Y'. | 423 | If you have such a board, say 'Y'. |
424 | 424 | ||
425 | config MTD_OMAP_NOR | ||
426 | tristate "TI OMAP board mappings" | ||
427 | depends on MTD_CFI && ARCH_OMAP | ||
428 | help | ||
429 | This enables access to the NOR flash chips on TI OMAP-based | ||
430 | boards defining flash platform devices and flash platform data. | ||
431 | These boards include the Innovator, H2, H3, OSK, Perseus2, and | ||
432 | more. If you have such a board, say 'Y'. | ||
433 | |||
434 | # This needs CFI or JEDEC, depending on the cards found. | 425 | # This needs CFI or JEDEC, depending on the cards found. |
435 | config MTD_PCI | 426 | config MTD_PCI |
436 | tristate "PCI MTD driver" | 427 | tristate "PCI MTD driver" |
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile index a44919f3f3d2..bb035cd54c72 100644 --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile | |||
@@ -54,7 +54,6 @@ obj-$(CONFIG_MTD_IXP2000) += ixp2000.o | |||
54 | obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o | 54 | obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o |
55 | obj-$(CONFIG_MTD_DMV182) += dmv182.o | 55 | obj-$(CONFIG_MTD_DMV182) += dmv182.o |
56 | obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o | 56 | obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o |
57 | obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o | ||
58 | obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o | 57 | obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o |
59 | obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-async-flash.o | 58 | obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-async-flash.o |
60 | obj-$(CONFIG_MTD_RBTX4939) += rbtx4939-flash.o | 59 | obj-$(CONFIG_MTD_RBTX4939) += rbtx4939-flash.o |
diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c index ead0b2fab670..e69de29bb2d1 100644 --- a/drivers/mtd/maps/omap_nor.c +++ b/drivers/mtd/maps/omap_nor.c | |||
@@ -1,188 +0,0 @@ | |||
1 | /* | ||
2 | * Flash memory support for various TI OMAP boards | ||
3 | * | ||
4 | * Copyright (C) 2001-2002 MontaVista Software Inc. | ||
5 | * Copyright (C) 2003-2004 Texas Instruments | ||
6 | * Copyright (C) 2004 Nokia Corporation | ||
7 | * | ||
8 | * Assembled using driver code copyright the companies above | ||
9 | * and written by David Brownell, Jian Zhang <jzhang@ti.com>, | ||
10 | * Tony Lindgren <tony@atomide.com> and others. | ||
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 as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
20 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
23 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
24 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
27 | * | ||
28 | * You should have received a copy of the GNU General Public License along | ||
29 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
30 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
31 | */ | ||
32 | |||
33 | #include <linux/platform_device.h> | ||
34 | #include <linux/module.h> | ||
35 | #include <linux/types.h> | ||
36 | #include <linux/kernel.h> | ||
37 | #include <linux/init.h> | ||
38 | #include <linux/ioport.h> | ||
39 | #include <linux/slab.h> | ||
40 | |||
41 | #include <linux/mtd/mtd.h> | ||
42 | #include <linux/mtd/map.h> | ||
43 | #include <linux/mtd/partitions.h> | ||
44 | |||
45 | #include <asm/io.h> | ||
46 | #include <mach/hardware.h> | ||
47 | #include <asm/mach/flash.h> | ||
48 | #include <plat/tc.h> | ||
49 | |||
50 | #ifdef CONFIG_MTD_PARTITIONS | ||
51 | static const char *part_probes[] = { /* "RedBoot", */ "cmdlinepart", NULL }; | ||
52 | #endif | ||
53 | |||
54 | struct omapflash_info { | ||
55 | struct mtd_partition *parts; | ||
56 | struct mtd_info *mtd; | ||
57 | struct map_info map; | ||
58 | }; | ||
59 | |||
60 | static void omap_set_vpp(struct map_info *map, int enable) | ||
61 | { | ||
62 | static int count; | ||
63 | u32 l; | ||
64 | |||
65 | if (cpu_class_is_omap1()) { | ||
66 | if (enable) { | ||
67 | if (count++ == 0) { | ||
68 | l = omap_readl(EMIFS_CONFIG); | ||
69 | l |= OMAP_EMIFS_CONFIG_WP; | ||
70 | omap_writel(l, EMIFS_CONFIG); | ||
71 | } | ||
72 | } else { | ||
73 | if (count && (--count == 0)) { | ||
74 | l = omap_readl(EMIFS_CONFIG); | ||
75 | l &= ~OMAP_EMIFS_CONFIG_WP; | ||
76 | omap_writel(l, EMIFS_CONFIG); | ||
77 | } | ||
78 | } | ||
79 | } | ||
80 | } | ||
81 | |||
82 | static int __init omapflash_probe(struct platform_device *pdev) | ||
83 | { | ||
84 | int err; | ||
85 | struct omapflash_info *info; | ||
86 | struct flash_platform_data *pdata = pdev->dev.platform_data; | ||
87 | struct resource *res = pdev->resource; | ||
88 | unsigned long size = res->end - res->start + 1; | ||
89 | |||
90 | info = kzalloc(sizeof(struct omapflash_info), GFP_KERNEL); | ||
91 | if (!info) | ||
92 | return -ENOMEM; | ||
93 | |||
94 | if (!request_mem_region(res->start, size, "flash")) { | ||
95 | err = -EBUSY; | ||
96 | goto out_free_info; | ||
97 | } | ||
98 | |||
99 | info->map.virt = ioremap(res->start, size); | ||
100 | if (!info->map.virt) { | ||
101 | err = -ENOMEM; | ||
102 | goto out_release_mem_region; | ||
103 | } | ||
104 | info->map.name = dev_name(&pdev->dev); | ||
105 | info->map.phys = res->start; | ||
106 | info->map.size = size; | ||
107 | info->map.bankwidth = pdata->width; | ||
108 | info->map.set_vpp = omap_set_vpp; | ||
109 | |||
110 | simple_map_init(&info->map); | ||
111 | info->mtd = do_map_probe(pdata->map_name, &info->map); | ||
112 | if (!info->mtd) { | ||
113 | err = -EIO; | ||
114 | goto out_iounmap; | ||
115 | } | ||
116 | info->mtd->owner = THIS_MODULE; | ||
117 | |||
118 | info->mtd->dev.parent = &pdev->dev; | ||
119 | |||
120 | #ifdef CONFIG_MTD_PARTITIONS | ||
121 | err = parse_mtd_partitions(info->mtd, part_probes, &info->parts, 0); | ||
122 | if (err > 0) | ||
123 | add_mtd_partitions(info->mtd, info->parts, err); | ||
124 | else if (err <= 0 && pdata->parts) | ||
125 | add_mtd_partitions(info->mtd, pdata->parts, pdata->nr_parts); | ||
126 | else | ||
127 | #endif | ||
128 | add_mtd_device(info->mtd); | ||
129 | |||
130 | platform_set_drvdata(pdev, info); | ||
131 | |||
132 | return 0; | ||
133 | |||
134 | out_iounmap: | ||
135 | iounmap(info->map.virt); | ||
136 | out_release_mem_region: | ||
137 | release_mem_region(res->start, size); | ||
138 | out_free_info: | ||
139 | kfree(info); | ||
140 | |||
141 | return err; | ||
142 | } | ||
143 | |||
144 | static int __exit omapflash_remove(struct platform_device *pdev) | ||
145 | { | ||
146 | struct omapflash_info *info = platform_get_drvdata(pdev); | ||
147 | |||
148 | platform_set_drvdata(pdev, NULL); | ||
149 | |||
150 | if (info) { | ||
151 | if (info->parts) { | ||
152 | del_mtd_partitions(info->mtd); | ||
153 | kfree(info->parts); | ||
154 | } else | ||
155 | del_mtd_device(info->mtd); | ||
156 | map_destroy(info->mtd); | ||
157 | release_mem_region(info->map.phys, info->map.size); | ||
158 | iounmap((void __iomem *) info->map.virt); | ||
159 | kfree(info); | ||
160 | } | ||
161 | |||
162 | return 0; | ||
163 | } | ||
164 | |||
165 | static struct platform_driver omapflash_driver = { | ||
166 | .remove = __exit_p(omapflash_remove), | ||
167 | .driver = { | ||
168 | .name = "omapflash", | ||
169 | .owner = THIS_MODULE, | ||
170 | }, | ||
171 | }; | ||
172 | |||
173 | static int __init omapflash_init(void) | ||
174 | { | ||
175 | return platform_driver_probe(&omapflash_driver, omapflash_probe); | ||
176 | } | ||
177 | |||
178 | static void __exit omapflash_exit(void) | ||
179 | { | ||
180 | platform_driver_unregister(&omapflash_driver); | ||
181 | } | ||
182 | |||
183 | module_init(omapflash_init); | ||
184 | module_exit(omapflash_exit); | ||
185 | |||
186 | MODULE_LICENSE("GPL"); | ||
187 | MODULE_DESCRIPTION("MTD NOR map driver for TI OMAP boards"); | ||
188 | MODULE_ALIAS("platform:omapflash"); | ||
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 1bb799f0125c..26aec0080184 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c | |||
@@ -30,12 +30,8 @@ | |||
30 | 30 | ||
31 | #define DRIVER_NAME "omap2-nand" | 31 | #define DRIVER_NAME "omap2-nand" |
32 | 32 | ||
33 | /* size (4 KiB) for IO mapping */ | ||
34 | #define NAND_IO_SIZE SZ_4K | ||
35 | |||
36 | #define NAND_WP_OFF 0 | 33 | #define NAND_WP_OFF 0 |
37 | #define NAND_WP_BIT 0x00000010 | 34 | #define NAND_WP_BIT 0x00000010 |
38 | #define WR_RD_PIN_MONITORING 0x00600000 | ||
39 | 35 | ||
40 | #define GPMC_BUF_FULL 0x00000001 | 36 | #define GPMC_BUF_FULL 0x00000001 |
41 | #define GPMC_BUF_EMPTY 0x00000000 | 37 | #define GPMC_BUF_EMPTY 0x00000000 |
@@ -882,8 +878,6 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) | |||
882 | struct omap_nand_info *info; | 878 | struct omap_nand_info *info; |
883 | struct omap_nand_platform_data *pdata; | 879 | struct omap_nand_platform_data *pdata; |
884 | int err; | 880 | int err; |
885 | unsigned long val; | ||
886 | |||
887 | 881 | ||
888 | pdata = pdev->dev.platform_data; | 882 | pdata = pdev->dev.platform_data; |
889 | if (pdata == NULL) { | 883 | if (pdata == NULL) { |
@@ -905,28 +899,14 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) | |||
905 | info->gpmc_cs = pdata->cs; | 899 | info->gpmc_cs = pdata->cs; |
906 | info->gpmc_baseaddr = pdata->gpmc_baseaddr; | 900 | info->gpmc_baseaddr = pdata->gpmc_baseaddr; |
907 | info->gpmc_cs_baseaddr = pdata->gpmc_cs_baseaddr; | 901 | info->gpmc_cs_baseaddr = pdata->gpmc_cs_baseaddr; |
902 | info->phys_base = pdata->phys_base; | ||
908 | 903 | ||
909 | info->mtd.priv = &info->nand; | 904 | info->mtd.priv = &info->nand; |
910 | info->mtd.name = dev_name(&pdev->dev); | 905 | info->mtd.name = dev_name(&pdev->dev); |
911 | info->mtd.owner = THIS_MODULE; | 906 | info->mtd.owner = THIS_MODULE; |
912 | 907 | ||
913 | err = gpmc_cs_request(info->gpmc_cs, NAND_IO_SIZE, &info->phys_base); | 908 | info->nand.options |= pdata->devsize ? NAND_BUSWIDTH_16 : 0; |
914 | if (err < 0) { | 909 | info->nand.options |= NAND_SKIP_BBTSCAN; |
915 | dev_err(&pdev->dev, "Cannot request GPMC CS\n"); | ||
916 | goto out_free_info; | ||
917 | } | ||
918 | |||
919 | /* Enable RD PIN Monitoring Reg */ | ||
920 | if (pdata->dev_ready) { | ||
921 | val = gpmc_cs_read_reg(info->gpmc_cs, GPMC_CS_CONFIG1); | ||
922 | val |= WR_RD_PIN_MONITORING; | ||
923 | gpmc_cs_write_reg(info->gpmc_cs, GPMC_CS_CONFIG1, val); | ||
924 | } | ||
925 | |||
926 | val = gpmc_cs_read_reg(info->gpmc_cs, GPMC_CS_CONFIG7); | ||
927 | val &= ~(0xf << 8); | ||
928 | val |= (0xc & 0xf) << 8; | ||
929 | gpmc_cs_write_reg(info->gpmc_cs, GPMC_CS_CONFIG7, val); | ||
930 | 910 | ||
931 | /* NAND write protect off */ | 911 | /* NAND write protect off */ |
932 | omap_nand_wp(&info->mtd, NAND_WP_OFF); | 912 | omap_nand_wp(&info->mtd, NAND_WP_OFF); |
@@ -934,7 +914,7 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) | |||
934 | if (!request_mem_region(info->phys_base, NAND_IO_SIZE, | 914 | if (!request_mem_region(info->phys_base, NAND_IO_SIZE, |
935 | pdev->dev.driver->name)) { | 915 | pdev->dev.driver->name)) { |
936 | err = -EBUSY; | 916 | err = -EBUSY; |
937 | goto out_free_cs; | 917 | goto out_free_info; |
938 | } | 918 | } |
939 | 919 | ||
940 | info->nand.IO_ADDR_R = ioremap(info->phys_base, NAND_IO_SIZE); | 920 | info->nand.IO_ADDR_R = ioremap(info->phys_base, NAND_IO_SIZE); |
@@ -963,11 +943,6 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) | |||
963 | info->nand.chip_delay = 50; | 943 | info->nand.chip_delay = 50; |
964 | } | 944 | } |
965 | 945 | ||
966 | info->nand.options |= NAND_SKIP_BBTSCAN; | ||
967 | if ((gpmc_cs_read_reg(info->gpmc_cs, GPMC_CS_CONFIG1) & 0x3000) | ||
968 | == 0x1000) | ||
969 | info->nand.options |= NAND_BUSWIDTH_16; | ||
970 | |||
971 | if (use_prefetch) { | 946 | if (use_prefetch) { |
972 | /* copy the virtual address of nand base for fifo access */ | 947 | /* copy the virtual address of nand base for fifo access */ |
973 | info->nand_pref_fifo_add = info->nand.IO_ADDR_R; | 948 | info->nand_pref_fifo_add = info->nand.IO_ADDR_R; |
@@ -1043,8 +1018,6 @@ static int __devinit omap_nand_probe(struct platform_device *pdev) | |||
1043 | 1018 | ||
1044 | out_release_mem_region: | 1019 | out_release_mem_region: |
1045 | release_mem_region(info->phys_base, NAND_IO_SIZE); | 1020 | release_mem_region(info->phys_base, NAND_IO_SIZE); |
1046 | out_free_cs: | ||
1047 | gpmc_cs_free(info->gpmc_cs); | ||
1048 | out_free_info: | 1021 | out_free_info: |
1049 | kfree(info); | 1022 | kfree(info); |
1050 | 1023 | ||
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 46af867af85f..7029cd50c458 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -932,7 +932,7 @@ config NET_NETX | |||
932 | 932 | ||
933 | config TI_DAVINCI_EMAC | 933 | config TI_DAVINCI_EMAC |
934 | tristate "TI DaVinci EMAC Support" | 934 | tristate "TI DaVinci EMAC Support" |
935 | depends on ARM && ARCH_DAVINCI | 935 | depends on ARM && ( ARCH_DAVINCI || ARCH_OMAP3 ) |
936 | select PHYLIB | 936 | select PHYLIB |
937 | help | 937 | help |
938 | This driver supports TI's DaVinci Ethernet . | 938 | This driver supports TI's DaVinci Ethernet . |
diff --git a/drivers/net/benet/be_hw.h b/drivers/net/benet/be_hw.h index 5ffb149181ad..2d4a4b827637 100644 --- a/drivers/net/benet/be_hw.h +++ b/drivers/net/benet/be_hw.h | |||
@@ -114,8 +114,7 @@ | |||
114 | #define IMG_TYPE_ISCSI_BACKUP 9 | 114 | #define IMG_TYPE_ISCSI_BACKUP 9 |
115 | #define IMG_TYPE_FCOE_FW_ACTIVE 10 | 115 | #define IMG_TYPE_FCOE_FW_ACTIVE 10 |
116 | #define IMG_TYPE_FCOE_FW_BACKUP 11 | 116 | #define IMG_TYPE_FCOE_FW_BACKUP 11 |
117 | #define IMG_TYPE_NCSI_BITFILE 13 | 117 | #define IMG_TYPE_NCSI_FW 13 |
118 | #define IMG_TYPE_NCSI_8051 14 | ||
119 | 118 | ||
120 | #define FLASHROM_OPER_FLASH 1 | 119 | #define FLASHROM_OPER_FLASH 1 |
121 | #define FLASHROM_OPER_SAVE 2 | 120 | #define FLASHROM_OPER_SAVE 2 |
@@ -127,6 +126,7 @@ | |||
127 | #define FLASH_IMAGE_MAX_SIZE_g3 (2097152) /* Max fw image size */ | 126 | #define FLASH_IMAGE_MAX_SIZE_g3 (2097152) /* Max fw image size */ |
128 | #define FLASH_BIOS_IMAGE_MAX_SIZE_g3 (524288) /* Max OPTION ROM img sz */ | 127 | #define FLASH_BIOS_IMAGE_MAX_SIZE_g3 (524288) /* Max OPTION ROM img sz */ |
129 | #define FLASH_REDBOOT_IMAGE_MAX_SIZE_g3 (1048576) /* Max Redboot image sz */ | 128 | #define FLASH_REDBOOT_IMAGE_MAX_SIZE_g3 (1048576) /* Max Redboot image sz */ |
129 | #define FLASH_NCSI_IMAGE_MAX_SIZE_g3 (262144) /* Max NSCI image sz */ | ||
130 | 130 | ||
131 | #define FLASH_NCSI_MAGIC (0x16032009) | 131 | #define FLASH_NCSI_MAGIC (0x16032009) |
132 | #define FLASH_NCSI_DISABLED (0) | 132 | #define FLASH_NCSI_DISABLED (0) |
@@ -144,6 +144,7 @@ | |||
144 | #define FLASH_FCoE_BIOS_START_g2 (524288) | 144 | #define FLASH_FCoE_BIOS_START_g2 (524288) |
145 | #define FLASH_REDBOOT_START_g2 (0) | 145 | #define FLASH_REDBOOT_START_g2 (0) |
146 | 146 | ||
147 | #define FLASH_NCSI_START_g3 (15990784) | ||
147 | #define FLASH_iSCSI_PRIMARY_IMAGE_START_g3 (2097152) | 148 | #define FLASH_iSCSI_PRIMARY_IMAGE_START_g3 (2097152) |
148 | #define FLASH_iSCSI_BACKUP_IMAGE_START_g3 (4194304) | 149 | #define FLASH_iSCSI_BACKUP_IMAGE_START_g3 (4194304) |
149 | #define FLASH_FCoE_PRIMARY_IMAGE_START_g3 (6291456) | 150 | #define FLASH_FCoE_PRIMARY_IMAGE_START_g3 (6291456) |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index a703ed8e24fe..22f787f2a30b 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -1880,8 +1880,9 @@ static int be_flash_data(struct be_adapter *adapter, | |||
1880 | const u8 *p = fw->data; | 1880 | const u8 *p = fw->data; |
1881 | struct be_cmd_write_flashrom *req = flash_cmd->va; | 1881 | struct be_cmd_write_flashrom *req = flash_cmd->va; |
1882 | struct flash_comp *pflashcomp; | 1882 | struct flash_comp *pflashcomp; |
1883 | int num_comp; | ||
1883 | 1884 | ||
1884 | struct flash_comp gen3_flash_types[8] = { | 1885 | struct flash_comp gen3_flash_types[9] = { |
1885 | { FLASH_iSCSI_PRIMARY_IMAGE_START_g3, IMG_TYPE_ISCSI_ACTIVE, | 1886 | { FLASH_iSCSI_PRIMARY_IMAGE_START_g3, IMG_TYPE_ISCSI_ACTIVE, |
1886 | FLASH_IMAGE_MAX_SIZE_g3}, | 1887 | FLASH_IMAGE_MAX_SIZE_g3}, |
1887 | { FLASH_REDBOOT_START_g3, IMG_TYPE_REDBOOT, | 1888 | { FLASH_REDBOOT_START_g3, IMG_TYPE_REDBOOT, |
@@ -1897,7 +1898,9 @@ static int be_flash_data(struct be_adapter *adapter, | |||
1897 | { FLASH_FCoE_PRIMARY_IMAGE_START_g3, IMG_TYPE_FCOE_FW_ACTIVE, | 1898 | { FLASH_FCoE_PRIMARY_IMAGE_START_g3, IMG_TYPE_FCOE_FW_ACTIVE, |
1898 | FLASH_IMAGE_MAX_SIZE_g3}, | 1899 | FLASH_IMAGE_MAX_SIZE_g3}, |
1899 | { FLASH_FCoE_BACKUP_IMAGE_START_g3, IMG_TYPE_FCOE_FW_BACKUP, | 1900 | { FLASH_FCoE_BACKUP_IMAGE_START_g3, IMG_TYPE_FCOE_FW_BACKUP, |
1900 | FLASH_IMAGE_MAX_SIZE_g3} | 1901 | FLASH_IMAGE_MAX_SIZE_g3}, |
1902 | { FLASH_NCSI_START_g3, IMG_TYPE_NCSI_FW, | ||
1903 | FLASH_NCSI_IMAGE_MAX_SIZE_g3} | ||
1901 | }; | 1904 | }; |
1902 | struct flash_comp gen2_flash_types[8] = { | 1905 | struct flash_comp gen2_flash_types[8] = { |
1903 | { FLASH_iSCSI_PRIMARY_IMAGE_START_g2, IMG_TYPE_ISCSI_ACTIVE, | 1906 | { FLASH_iSCSI_PRIMARY_IMAGE_START_g2, IMG_TYPE_ISCSI_ACTIVE, |
@@ -1921,11 +1924,16 @@ static int be_flash_data(struct be_adapter *adapter, | |||
1921 | if (adapter->generation == BE_GEN3) { | 1924 | if (adapter->generation == BE_GEN3) { |
1922 | pflashcomp = gen3_flash_types; | 1925 | pflashcomp = gen3_flash_types; |
1923 | filehdr_size = sizeof(struct flash_file_hdr_g3); | 1926 | filehdr_size = sizeof(struct flash_file_hdr_g3); |
1927 | num_comp = 9; | ||
1924 | } else { | 1928 | } else { |
1925 | pflashcomp = gen2_flash_types; | 1929 | pflashcomp = gen2_flash_types; |
1926 | filehdr_size = sizeof(struct flash_file_hdr_g2); | 1930 | filehdr_size = sizeof(struct flash_file_hdr_g2); |
1931 | num_comp = 8; | ||
1927 | } | 1932 | } |
1928 | for (i = 0; i < 8; i++) { | 1933 | for (i = 0; i < num_comp; i++) { |
1934 | if ((pflashcomp[i].optype == IMG_TYPE_NCSI_FW) && | ||
1935 | memcmp(adapter->fw_ver, "3.102.148.0", 11) < 0) | ||
1936 | continue; | ||
1929 | if ((pflashcomp[i].optype == IMG_TYPE_REDBOOT) && | 1937 | if ((pflashcomp[i].optype == IMG_TYPE_REDBOOT) && |
1930 | (!be_flash_redboot(adapter, fw->data, | 1938 | (!be_flash_redboot(adapter, fw->data, |
1931 | pflashcomp[i].offset, pflashcomp[i].size, | 1939 | pflashcomp[i].offset, pflashcomp[i].size, |
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 7cbcfb0ade1c..9bd155e4111c 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
@@ -5072,7 +5072,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev, | |||
5072 | INIT_WORK(&cp->reset_task, cas_reset_task); | 5072 | INIT_WORK(&cp->reset_task, cas_reset_task); |
5073 | 5073 | ||
5074 | /* Default link parameters */ | 5074 | /* Default link parameters */ |
5075 | if (link_mode >= 0 && link_mode <= 6) | 5075 | if (link_mode >= 0 && link_mode < 6) |
5076 | cp->link_cntl = link_modes[link_mode]; | 5076 | cp->link_cntl = link_modes[link_mode]; |
5077 | else | 5077 | else |
5078 | cp->link_cntl = BMCR_ANENABLE; | 5078 | cp->link_cntl = BMCR_ANENABLE; |
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index b85c81f60d10..9d489421535e 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c | |||
@@ -1290,8 +1290,8 @@ void __devexit cpmac_exit(void) | |||
1290 | { | 1290 | { |
1291 | platform_driver_unregister(&cpmac_driver); | 1291 | platform_driver_unregister(&cpmac_driver); |
1292 | mdiobus_unregister(cpmac_mii); | 1292 | mdiobus_unregister(cpmac_mii); |
1293 | mdiobus_free(cpmac_mii); | ||
1294 | iounmap(cpmac_mii->priv); | 1293 | iounmap(cpmac_mii->priv); |
1294 | mdiobus_free(cpmac_mii); | ||
1295 | } | 1295 | } |
1296 | 1296 | ||
1297 | module_init(cpmac_init); | 1297 | module_init(cpmac_init); |
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 3f5db83c7cbb..32960b9b02ae 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
@@ -62,12 +62,11 @@ | |||
62 | #include <linux/bitops.h> | 62 | #include <linux/bitops.h> |
63 | #include <linux/io.h> | 63 | #include <linux/io.h> |
64 | #include <linux/uaccess.h> | 64 | #include <linux/uaccess.h> |
65 | #include <linux/davinci_emac.h> | ||
65 | 66 | ||
66 | #include <asm/irq.h> | 67 | #include <asm/irq.h> |
67 | #include <asm/page.h> | 68 | #include <asm/page.h> |
68 | 69 | ||
69 | #include <mach/emac.h> | ||
70 | |||
71 | static int debug_level; | 70 | static int debug_level; |
72 | module_param(debug_level, int, 0); | 71 | module_param(debug_level, int, 0); |
73 | MODULE_PARM_DESC(debug_level, "DaVinci EMAC debug level (NETIF_MSG bits)"); | 72 | MODULE_PARM_DESC(debug_level, "DaVinci EMAC debug level (NETIF_MSG bits)"); |
@@ -465,6 +464,7 @@ struct emac_priv { | |||
465 | void __iomem *ctrl_base; | 464 | void __iomem *ctrl_base; |
466 | void __iomem *emac_ctrl_ram; | 465 | void __iomem *emac_ctrl_ram; |
467 | u32 ctrl_ram_size; | 466 | u32 ctrl_ram_size; |
467 | u32 hw_ram_addr; | ||
468 | struct emac_txch *txch[EMAC_DEF_MAX_TX_CH]; | 468 | struct emac_txch *txch[EMAC_DEF_MAX_TX_CH]; |
469 | struct emac_rxch *rxch[EMAC_DEF_MAX_RX_CH]; | 469 | struct emac_rxch *rxch[EMAC_DEF_MAX_RX_CH]; |
470 | u32 link; /* 1=link on, 0=link off */ | 470 | u32 link; /* 1=link on, 0=link off */ |
@@ -488,6 +488,9 @@ struct emac_priv { | |||
488 | struct mii_bus *mii_bus; | 488 | struct mii_bus *mii_bus; |
489 | struct phy_device *phydev; | 489 | struct phy_device *phydev; |
490 | spinlock_t lock; | 490 | spinlock_t lock; |
491 | /*platform specific members*/ | ||
492 | void (*int_enable) (void); | ||
493 | void (*int_disable) (void); | ||
491 | }; | 494 | }; |
492 | 495 | ||
493 | /* clock frequency for EMAC */ | 496 | /* clock frequency for EMAC */ |
@@ -495,11 +498,9 @@ static struct clk *emac_clk; | |||
495 | static unsigned long emac_bus_frequency; | 498 | static unsigned long emac_bus_frequency; |
496 | static unsigned long mdio_max_freq; | 499 | static unsigned long mdio_max_freq; |
497 | 500 | ||
498 | /* EMAC internal utility function */ | 501 | #define emac_virt_to_phys(addr, priv) \ |
499 | static inline u32 emac_virt_to_phys(void __iomem *addr) | 502 | (((u32 __force)(addr) - (u32 __force)(priv->emac_ctrl_ram)) \ |
500 | { | 503 | + priv->hw_ram_addr) |
501 | return (u32 __force) io_v2p(addr); | ||
502 | } | ||
503 | 504 | ||
504 | /* Cache macros - Packet buffers would be from skb pool which is cached */ | 505 | /* Cache macros - Packet buffers would be from skb pool which is cached */ |
505 | #define EMAC_VIRT_NOCACHE(addr) (addr) | 506 | #define EMAC_VIRT_NOCACHE(addr) (addr) |
@@ -1001,6 +1002,8 @@ static void emac_int_disable(struct emac_priv *priv) | |||
1001 | emac_ctrl_write(EMAC_DM646X_CMRXINTEN, 0x0); | 1002 | emac_ctrl_write(EMAC_DM646X_CMRXINTEN, 0x0); |
1002 | emac_ctrl_write(EMAC_DM646X_CMTXINTEN, 0x0); | 1003 | emac_ctrl_write(EMAC_DM646X_CMTXINTEN, 0x0); |
1003 | /* NOTE: Rx Threshold and Misc interrupts are not disabled */ | 1004 | /* NOTE: Rx Threshold and Misc interrupts are not disabled */ |
1005 | if (priv->int_disable) | ||
1006 | priv->int_disable(); | ||
1004 | 1007 | ||
1005 | local_irq_restore(flags); | 1008 | local_irq_restore(flags); |
1006 | 1009 | ||
@@ -1020,6 +1023,9 @@ static void emac_int_disable(struct emac_priv *priv) | |||
1020 | static void emac_int_enable(struct emac_priv *priv) | 1023 | static void emac_int_enable(struct emac_priv *priv) |
1021 | { | 1024 | { |
1022 | if (priv->version == EMAC_VERSION_2) { | 1025 | if (priv->version == EMAC_VERSION_2) { |
1026 | if (priv->int_enable) | ||
1027 | priv->int_enable(); | ||
1028 | |||
1023 | emac_ctrl_write(EMAC_DM646X_CMRXINTEN, 0xff); | 1029 | emac_ctrl_write(EMAC_DM646X_CMRXINTEN, 0xff); |
1024 | emac_ctrl_write(EMAC_DM646X_CMTXINTEN, 0xff); | 1030 | emac_ctrl_write(EMAC_DM646X_CMTXINTEN, 0xff); |
1025 | 1031 | ||
@@ -1301,7 +1307,7 @@ static int emac_tx_bdproc(struct emac_priv *priv, u32 ch, u32 budget) | |||
1301 | curr_bd = txch->active_queue_head; | 1307 | curr_bd = txch->active_queue_head; |
1302 | if (NULL == curr_bd) { | 1308 | if (NULL == curr_bd) { |
1303 | emac_write(EMAC_TXCP(ch), | 1309 | emac_write(EMAC_TXCP(ch), |
1304 | emac_virt_to_phys(txch->last_hw_bdprocessed)); | 1310 | emac_virt_to_phys(txch->last_hw_bdprocessed, priv)); |
1305 | txch->no_active_pkts++; | 1311 | txch->no_active_pkts++; |
1306 | spin_unlock_irqrestore(&priv->tx_lock, flags); | 1312 | spin_unlock_irqrestore(&priv->tx_lock, flags); |
1307 | return 0; | 1313 | return 0; |
@@ -1311,7 +1317,7 @@ static int emac_tx_bdproc(struct emac_priv *priv, u32 ch, u32 budget) | |||
1311 | while ((curr_bd) && | 1317 | while ((curr_bd) && |
1312 | ((frame_status & EMAC_CPPI_OWNERSHIP_BIT) == 0) && | 1318 | ((frame_status & EMAC_CPPI_OWNERSHIP_BIT) == 0) && |
1313 | (pkts_processed < budget)) { | 1319 | (pkts_processed < budget)) { |
1314 | emac_write(EMAC_TXCP(ch), emac_virt_to_phys(curr_bd)); | 1320 | emac_write(EMAC_TXCP(ch), emac_virt_to_phys(curr_bd, priv)); |
1315 | txch->active_queue_head = curr_bd->next; | 1321 | txch->active_queue_head = curr_bd->next; |
1316 | if (frame_status & EMAC_CPPI_EOQ_BIT) { | 1322 | if (frame_status & EMAC_CPPI_EOQ_BIT) { |
1317 | if (curr_bd->next) { /* misqueued packet */ | 1323 | if (curr_bd->next) { /* misqueued packet */ |
@@ -1398,7 +1404,7 @@ static int emac_send(struct emac_priv *priv, struct emac_netpktobj *pkt, u32 ch) | |||
1398 | txch->active_queue_tail = curr_bd; | 1404 | txch->active_queue_tail = curr_bd; |
1399 | if (1 != txch->queue_active) { | 1405 | if (1 != txch->queue_active) { |
1400 | emac_write(EMAC_TXHDP(ch), | 1406 | emac_write(EMAC_TXHDP(ch), |
1401 | emac_virt_to_phys(curr_bd)); | 1407 | emac_virt_to_phys(curr_bd, priv)); |
1402 | txch->queue_active = 1; | 1408 | txch->queue_active = 1; |
1403 | } | 1409 | } |
1404 | ++txch->queue_reinit; | 1410 | ++txch->queue_reinit; |
@@ -1410,10 +1416,11 @@ static int emac_send(struct emac_priv *priv, struct emac_netpktobj *pkt, u32 ch) | |||
1410 | tail_bd->next = curr_bd; | 1416 | tail_bd->next = curr_bd; |
1411 | txch->active_queue_tail = curr_bd; | 1417 | txch->active_queue_tail = curr_bd; |
1412 | tail_bd = EMAC_VIRT_NOCACHE(tail_bd); | 1418 | tail_bd = EMAC_VIRT_NOCACHE(tail_bd); |
1413 | tail_bd->h_next = (int)emac_virt_to_phys(curr_bd); | 1419 | tail_bd->h_next = (int)emac_virt_to_phys(curr_bd, priv); |
1414 | frame_status = tail_bd->mode; | 1420 | frame_status = tail_bd->mode; |
1415 | if (frame_status & EMAC_CPPI_EOQ_BIT) { | 1421 | if (frame_status & EMAC_CPPI_EOQ_BIT) { |
1416 | emac_write(EMAC_TXHDP(ch), emac_virt_to_phys(curr_bd)); | 1422 | emac_write(EMAC_TXHDP(ch), |
1423 | emac_virt_to_phys(curr_bd, priv)); | ||
1417 | frame_status &= ~(EMAC_CPPI_EOQ_BIT); | 1424 | frame_status &= ~(EMAC_CPPI_EOQ_BIT); |
1418 | tail_bd->mode = frame_status; | 1425 | tail_bd->mode = frame_status; |
1419 | ++txch->end_of_queue_add; | 1426 | ++txch->end_of_queue_add; |
@@ -1603,7 +1610,8 @@ static int emac_init_rxch(struct emac_priv *priv, u32 ch, char *param) | |||
1603 | } | 1610 | } |
1604 | 1611 | ||
1605 | /* populate the hardware descriptor */ | 1612 | /* populate the hardware descriptor */ |
1606 | curr_bd->h_next = emac_virt_to_phys(rxch->active_queue_head); | 1613 | curr_bd->h_next = emac_virt_to_phys(rxch->active_queue_head, |
1614 | priv); | ||
1607 | /* FIXME buff_ptr = dma_map_single(... data_ptr ...) */ | 1615 | /* FIXME buff_ptr = dma_map_single(... data_ptr ...) */ |
1608 | curr_bd->buff_ptr = virt_to_phys(curr_bd->data_ptr); | 1616 | curr_bd->buff_ptr = virt_to_phys(curr_bd->data_ptr); |
1609 | curr_bd->off_b_len = rxch->buf_size; | 1617 | curr_bd->off_b_len = rxch->buf_size; |
@@ -1878,7 +1886,7 @@ static void emac_addbd_to_rx_queue(struct emac_priv *priv, u32 ch, | |||
1878 | rxch->active_queue_tail = curr_bd; | 1886 | rxch->active_queue_tail = curr_bd; |
1879 | if (0 != rxch->queue_active) { | 1887 | if (0 != rxch->queue_active) { |
1880 | emac_write(EMAC_RXHDP(ch), | 1888 | emac_write(EMAC_RXHDP(ch), |
1881 | emac_virt_to_phys(rxch->active_queue_head)); | 1889 | emac_virt_to_phys(rxch->active_queue_head, priv)); |
1882 | rxch->queue_active = 1; | 1890 | rxch->queue_active = 1; |
1883 | } | 1891 | } |
1884 | } else { | 1892 | } else { |
@@ -1889,11 +1897,11 @@ static void emac_addbd_to_rx_queue(struct emac_priv *priv, u32 ch, | |||
1889 | rxch->active_queue_tail = curr_bd; | 1897 | rxch->active_queue_tail = curr_bd; |
1890 | tail_bd->next = curr_bd; | 1898 | tail_bd->next = curr_bd; |
1891 | tail_bd = EMAC_VIRT_NOCACHE(tail_bd); | 1899 | tail_bd = EMAC_VIRT_NOCACHE(tail_bd); |
1892 | tail_bd->h_next = emac_virt_to_phys(curr_bd); | 1900 | tail_bd->h_next = emac_virt_to_phys(curr_bd, priv); |
1893 | frame_status = tail_bd->mode; | 1901 | frame_status = tail_bd->mode; |
1894 | if (frame_status & EMAC_CPPI_EOQ_BIT) { | 1902 | if (frame_status & EMAC_CPPI_EOQ_BIT) { |
1895 | emac_write(EMAC_RXHDP(ch), | 1903 | emac_write(EMAC_RXHDP(ch), |
1896 | emac_virt_to_phys(curr_bd)); | 1904 | emac_virt_to_phys(curr_bd, priv)); |
1897 | frame_status &= ~(EMAC_CPPI_EOQ_BIT); | 1905 | frame_status &= ~(EMAC_CPPI_EOQ_BIT); |
1898 | tail_bd->mode = frame_status; | 1906 | tail_bd->mode = frame_status; |
1899 | ++rxch->end_of_queue_add; | 1907 | ++rxch->end_of_queue_add; |
@@ -1986,7 +1994,7 @@ static int emac_rx_bdproc(struct emac_priv *priv, u32 ch, u32 budget) | |||
1986 | curr_pkt->num_bufs = 1; | 1994 | curr_pkt->num_bufs = 1; |
1987 | curr_pkt->pkt_length = | 1995 | curr_pkt->pkt_length = |
1988 | (frame_status & EMAC_RX_BD_PKT_LENGTH_MASK); | 1996 | (frame_status & EMAC_RX_BD_PKT_LENGTH_MASK); |
1989 | emac_write(EMAC_RXCP(ch), emac_virt_to_phys(curr_bd)); | 1997 | emac_write(EMAC_RXCP(ch), emac_virt_to_phys(curr_bd, priv)); |
1990 | ++rxch->processed_bd; | 1998 | ++rxch->processed_bd; |
1991 | last_bd = curr_bd; | 1999 | last_bd = curr_bd; |
1992 | curr_bd = last_bd->next; | 2000 | curr_bd = last_bd->next; |
@@ -1997,7 +2005,7 @@ static int emac_rx_bdproc(struct emac_priv *priv, u32 ch, u32 budget) | |||
1997 | if (curr_bd) { | 2005 | if (curr_bd) { |
1998 | ++rxch->mis_queued_packets; | 2006 | ++rxch->mis_queued_packets; |
1999 | emac_write(EMAC_RXHDP(ch), | 2007 | emac_write(EMAC_RXHDP(ch), |
2000 | emac_virt_to_phys(curr_bd)); | 2008 | emac_virt_to_phys(curr_bd, priv)); |
2001 | } else { | 2009 | } else { |
2002 | ++rxch->end_of_queue; | 2010 | ++rxch->end_of_queue; |
2003 | rxch->queue_active = 0; | 2011 | rxch->queue_active = 0; |
@@ -2098,7 +2106,7 @@ static int emac_hw_enable(struct emac_priv *priv) | |||
2098 | emac_write(EMAC_RXINTMASKSET, BIT(ch)); | 2106 | emac_write(EMAC_RXINTMASKSET, BIT(ch)); |
2099 | rxch->queue_active = 1; | 2107 | rxch->queue_active = 1; |
2100 | emac_write(EMAC_RXHDP(ch), | 2108 | emac_write(EMAC_RXHDP(ch), |
2101 | emac_virt_to_phys(rxch->active_queue_head)); | 2109 | emac_virt_to_phys(rxch->active_queue_head, priv)); |
2102 | } | 2110 | } |
2103 | 2111 | ||
2104 | /* Enable MII */ | 2112 | /* Enable MII */ |
@@ -2377,7 +2385,7 @@ static int emac_dev_open(struct net_device *ndev) | |||
2377 | struct emac_priv *priv = netdev_priv(ndev); | 2385 | struct emac_priv *priv = netdev_priv(ndev); |
2378 | 2386 | ||
2379 | netif_carrier_off(ndev); | 2387 | netif_carrier_off(ndev); |
2380 | for (cnt = 0; cnt <= ETH_ALEN; cnt++) | 2388 | for (cnt = 0; cnt < ETH_ALEN; cnt++) |
2381 | ndev->dev_addr[cnt] = priv->mac_addr[cnt]; | 2389 | ndev->dev_addr[cnt] = priv->mac_addr[cnt]; |
2382 | 2390 | ||
2383 | /* Configuration items */ | 2391 | /* Configuration items */ |
@@ -2659,6 +2667,9 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) | |||
2659 | priv->phy_mask = pdata->phy_mask; | 2667 | priv->phy_mask = pdata->phy_mask; |
2660 | priv->rmii_en = pdata->rmii_en; | 2668 | priv->rmii_en = pdata->rmii_en; |
2661 | priv->version = pdata->version; | 2669 | priv->version = pdata->version; |
2670 | priv->int_enable = pdata->interrupt_enable; | ||
2671 | priv->int_disable = pdata->interrupt_disable; | ||
2672 | |||
2662 | emac_dev = &ndev->dev; | 2673 | emac_dev = &ndev->dev; |
2663 | /* Get EMAC platform data */ | 2674 | /* Get EMAC platform data */ |
2664 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2675 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -2690,6 +2701,12 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) | |||
2690 | priv->ctrl_ram_size = pdata->ctrl_ram_size; | 2701 | priv->ctrl_ram_size = pdata->ctrl_ram_size; |
2691 | priv->emac_ctrl_ram = priv->remap_addr + pdata->ctrl_ram_offset; | 2702 | priv->emac_ctrl_ram = priv->remap_addr + pdata->ctrl_ram_offset; |
2692 | 2703 | ||
2704 | if (pdata->hw_ram_addr) | ||
2705 | priv->hw_ram_addr = pdata->hw_ram_addr; | ||
2706 | else | ||
2707 | priv->hw_ram_addr = (u32 __force)res->start + | ||
2708 | pdata->ctrl_ram_offset; | ||
2709 | |||
2693 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 2710 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
2694 | if (!res) { | 2711 | if (!res) { |
2695 | dev_err(emac_dev, "DaVinci EMAC: Error getting irq res\n"); | 2712 | dev_err(emac_dev, "DaVinci EMAC: Error getting irq res\n"); |
diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h index 05adb6a666cf..3269292efecc 100644 --- a/drivers/net/smc911x.h +++ b/drivers/net/smc911x.h | |||
@@ -42,12 +42,12 @@ | |||
42 | #define SMC_USE_16BIT 0 | 42 | #define SMC_USE_16BIT 0 |
43 | #define SMC_USE_32BIT 1 | 43 | #define SMC_USE_32BIT 1 |
44 | #define SMC_IRQ_SENSE IRQF_TRIGGER_LOW | 44 | #define SMC_IRQ_SENSE IRQF_TRIGGER_LOW |
45 | #elif defined(CONFIG_ARCH_OMAP34XX) | 45 | #elif defined(CONFIG_ARCH_OMAP3) |
46 | #define SMC_USE_16BIT 0 | 46 | #define SMC_USE_16BIT 0 |
47 | #define SMC_USE_32BIT 1 | 47 | #define SMC_USE_32BIT 1 |
48 | #define SMC_IRQ_SENSE IRQF_TRIGGER_LOW | 48 | #define SMC_IRQ_SENSE IRQF_TRIGGER_LOW |
49 | #define SMC_MEM_RESERVED 1 | 49 | #define SMC_MEM_RESERVED 1 |
50 | #elif defined(CONFIG_ARCH_OMAP24XX) | 50 | #elif defined(CONFIG_ARCH_OMAP2) |
51 | #define SMC_USE_16BIT 0 | 51 | #define SMC_USE_16BIT 0 |
52 | #define SMC_USE_32BIT 1 | 52 | #define SMC_USE_32BIT 1 |
53 | #define SMC_IRQ_SENSE IRQF_TRIGGER_LOW | 53 | #define SMC_IRQ_SENSE IRQF_TRIGGER_LOW |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index c0c73913833d..2e7a3bf13824 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -354,7 +354,7 @@ static struct pci_platform_pm_ops acpi_pci_platform_pm = { | |||
354 | static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) | 354 | static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) |
355 | { | 355 | { |
356 | struct pci_dev * pci_dev; | 356 | struct pci_dev * pci_dev; |
357 | acpi_integer addr; | 357 | u64 addr; |
358 | 358 | ||
359 | pci_dev = to_pci_dev(dev); | 359 | pci_dev = to_pci_dev(dev); |
360 | /* Please ref to ACPI spec for the syntax of _ADR */ | 360 | /* Please ref to ACPI spec for the syntax of _ADR */ |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index bf32f07c4efb..4fe36d2e1049 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -101,9 +101,17 @@ static void __assign_resources_sorted(struct resource_list *head, | |||
101 | for (list = head->next; list;) { | 101 | for (list = head->next; list;) { |
102 | res = list->res; | 102 | res = list->res; |
103 | idx = res - &list->dev->resource[0]; | 103 | idx = res - &list->dev->resource[0]; |
104 | |||
104 | if (pci_assign_resource(list->dev, idx)) { | 105 | if (pci_assign_resource(list->dev, idx)) { |
105 | if (fail_head && !pci_is_root_bus(list->dev->bus)) | 106 | if (fail_head && !pci_is_root_bus(list->dev->bus)) { |
106 | add_to_failed_list(fail_head, list->dev, res); | 107 | /* |
108 | * if the failed res is for ROM BAR, and it will | ||
109 | * be enabled later, don't add it to the list | ||
110 | */ | ||
111 | if (!((idx == PCI_ROM_RESOURCE) && | ||
112 | (!(res->flags & IORESOURCE_ROM_ENABLE)))) | ||
113 | add_to_failed_list(fail_head, list->dev, res); | ||
114 | } | ||
107 | res->start = 0; | 115 | res->start = 0; |
108 | res->end = 0; | 116 | res->end = 0; |
109 | res->flags = 0; | 117 | res->flags = 0; |
diff --git a/drivers/platform/x86/toshiba_bluetooth.c b/drivers/platform/x86/toshiba_bluetooth.c index a350418e87ea..944068611919 100644 --- a/drivers/platform/x86/toshiba_bluetooth.c +++ b/drivers/platform/x86/toshiba_bluetooth.c | |||
@@ -57,7 +57,7 @@ static struct acpi_driver toshiba_bt_rfkill_driver = { | |||
57 | static int toshiba_bluetooth_enable(acpi_handle handle) | 57 | static int toshiba_bluetooth_enable(acpi_handle handle) |
58 | { | 58 | { |
59 | acpi_status res1, res2; | 59 | acpi_status res1, res2; |
60 | acpi_integer result; | 60 | u64 result; |
61 | 61 | ||
62 | /* | 62 | /* |
63 | * Query ACPI to verify RFKill switch is set to 'on'. | 63 | * Query ACPI to verify RFKill switch is set to 'on'. |
@@ -95,7 +95,7 @@ static int toshiba_bt_resume(struct acpi_device *device) | |||
95 | static int toshiba_bt_rfkill_add(struct acpi_device *device) | 95 | static int toshiba_bt_rfkill_add(struct acpi_device *device) |
96 | { | 96 | { |
97 | acpi_status status; | 97 | acpi_status status; |
98 | acpi_integer bt_present; | 98 | u64 bt_present; |
99 | int result = -ENODEV; | 99 | int result = -ENODEV; |
100 | 100 | ||
101 | /* | 101 | /* |
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index b104302fea0a..09e9918c69c1 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c | |||
@@ -796,7 +796,7 @@ static __init acpi_status parse_wdg(acpi_handle handle) | |||
796 | */ | 796 | */ |
797 | static acpi_status | 797 | static acpi_status |
798 | acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address, | 798 | acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address, |
799 | u32 bits, acpi_integer * value, | 799 | u32 bits, u64 *value, |
800 | void *handler_context, void *region_context) | 800 | void *handler_context, void *region_context) |
801 | { | 801 | { |
802 | int result = 0, i = 0; | 802 | int result = 0, i = 0; |
@@ -813,7 +813,7 @@ acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address, | |||
813 | 813 | ||
814 | if (function == ACPI_READ) { | 814 | if (function == ACPI_READ) { |
815 | result = ec_read(address, &temp); | 815 | result = ec_read(address, &temp); |
816 | (*value) |= ((acpi_integer)temp) << i; | 816 | (*value) |= ((u64)temp) << i; |
817 | } else { | 817 | } else { |
818 | temp = 0xff & ((*value) >> i); | 818 | temp = 0xff & ((*value) >> i); |
819 | result = ec_write(address, temp); | 819 | result = ec_write(address, temp); |
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index 0264b117893b..c256aacfa954 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c | |||
@@ -7,6 +7,9 @@ | |||
7 | * | 7 | * |
8 | * Copyright 2006 (c) MontaVista Software, Inc. | 8 | * Copyright 2006 (c) MontaVista Software, Inc. |
9 | * | 9 | * |
10 | * Author: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com> | ||
11 | * Copyright 2010 (c) ST-Ericsson AB | ||
12 | * | ||
10 | * This program is free software; you can redistribute it and/or | 13 | * This program is free software; you can redistribute it and/or |
11 | * modify it under the terms of the GNU General Public License | 14 | * modify it under the terms of the GNU General Public License |
12 | * as published by the Free Software Foundation; either version | 15 | * as published by the Free Software Foundation; either version |
@@ -18,6 +21,9 @@ | |||
18 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
19 | #include <linux/amba/bus.h> | 22 | #include <linux/amba/bus.h> |
20 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/bcd.h> | ||
25 | #include <linux/delay.h> | ||
26 | #include <linux/version.h> | ||
21 | 27 | ||
22 | /* | 28 | /* |
23 | * Register definitions | 29 | * Register definitions |
@@ -30,35 +36,207 @@ | |||
30 | #define RTC_RIS 0x14 /* Raw interrupt status register */ | 36 | #define RTC_RIS 0x14 /* Raw interrupt status register */ |
31 | #define RTC_MIS 0x18 /* Masked interrupt status register */ | 37 | #define RTC_MIS 0x18 /* Masked interrupt status register */ |
32 | #define RTC_ICR 0x1c /* Interrupt clear register */ | 38 | #define RTC_ICR 0x1c /* Interrupt clear register */ |
39 | /* ST variants have additional timer functionality */ | ||
40 | #define RTC_TDR 0x20 /* Timer data read register */ | ||
41 | #define RTC_TLR 0x24 /* Timer data load register */ | ||
42 | #define RTC_TCR 0x28 /* Timer control register */ | ||
43 | #define RTC_YDR 0x30 /* Year data read register */ | ||
44 | #define RTC_YMR 0x34 /* Year match register */ | ||
45 | #define RTC_YLR 0x38 /* Year data load register */ | ||
46 | |||
47 | #define RTC_CR_CWEN (1 << 26) /* Clockwatch enable bit */ | ||
48 | |||
49 | #define RTC_TCR_EN (1 << 1) /* Periodic timer enable bit */ | ||
50 | |||
51 | /* Common bit definitions for Interrupt status and control registers */ | ||
52 | #define RTC_BIT_AI (1 << 0) /* Alarm interrupt bit */ | ||
53 | #define RTC_BIT_PI (1 << 1) /* Periodic interrupt bit. ST variants only. */ | ||
54 | |||
55 | /* Common bit definations for ST v2 for reading/writing time */ | ||
56 | #define RTC_SEC_SHIFT 0 | ||
57 | #define RTC_SEC_MASK (0x3F << RTC_SEC_SHIFT) /* Second [0-59] */ | ||
58 | #define RTC_MIN_SHIFT 6 | ||
59 | #define RTC_MIN_MASK (0x3F << RTC_MIN_SHIFT) /* Minute [0-59] */ | ||
60 | #define RTC_HOUR_SHIFT 12 | ||
61 | #define RTC_HOUR_MASK (0x1F << RTC_HOUR_SHIFT) /* Hour [0-23] */ | ||
62 | #define RTC_WDAY_SHIFT 17 | ||
63 | #define RTC_WDAY_MASK (0x7 << RTC_WDAY_SHIFT) /* Day of Week [1-7] 1=Sunday */ | ||
64 | #define RTC_MDAY_SHIFT 20 | ||
65 | #define RTC_MDAY_MASK (0x1F << RTC_MDAY_SHIFT) /* Day of Month [1-31] */ | ||
66 | #define RTC_MON_SHIFT 25 | ||
67 | #define RTC_MON_MASK (0xF << RTC_MON_SHIFT) /* Month [1-12] 1=January */ | ||
68 | |||
69 | #define RTC_TIMER_FREQ 32768 | ||
33 | 70 | ||
34 | struct pl031_local { | 71 | struct pl031_local { |
35 | struct rtc_device *rtc; | 72 | struct rtc_device *rtc; |
36 | void __iomem *base; | 73 | void __iomem *base; |
74 | u8 hw_designer; | ||
75 | u8 hw_revision:4; | ||
37 | }; | 76 | }; |
38 | 77 | ||
39 | static irqreturn_t pl031_interrupt(int irq, void *dev_id) | 78 | static int pl031_alarm_irq_enable(struct device *dev, |
79 | unsigned int enabled) | ||
80 | { | ||
81 | struct pl031_local *ldata = dev_get_drvdata(dev); | ||
82 | unsigned long imsc; | ||
83 | |||
84 | /* Clear any pending alarm interrupts. */ | ||
85 | writel(RTC_BIT_AI, ldata->base + RTC_ICR); | ||
86 | |||
87 | imsc = readl(ldata->base + RTC_IMSC); | ||
88 | |||
89 | if (enabled == 1) | ||
90 | writel(imsc | RTC_BIT_AI, ldata->base + RTC_IMSC); | ||
91 | else | ||
92 | writel(imsc & ~RTC_BIT_AI, ldata->base + RTC_IMSC); | ||
93 | |||
94 | return 0; | ||
95 | } | ||
96 | |||
97 | /* | ||
98 | * Convert Gregorian date to ST v2 RTC format. | ||
99 | */ | ||
100 | static int pl031_stv2_tm_to_time(struct device *dev, | ||
101 | struct rtc_time *tm, unsigned long *st_time, | ||
102 | unsigned long *bcd_year) | ||
103 | { | ||
104 | int year = tm->tm_year + 1900; | ||
105 | int wday = tm->tm_wday; | ||
106 | |||
107 | /* wday masking is not working in hardware so wday must be valid */ | ||
108 | if (wday < -1 || wday > 6) { | ||
109 | dev_err(dev, "invalid wday value %d\n", tm->tm_wday); | ||
110 | return -EINVAL; | ||
111 | } else if (wday == -1) { | ||
112 | /* wday is not provided, calculate it here */ | ||
113 | unsigned long time; | ||
114 | struct rtc_time calc_tm; | ||
115 | |||
116 | rtc_tm_to_time(tm, &time); | ||
117 | rtc_time_to_tm(time, &calc_tm); | ||
118 | wday = calc_tm.tm_wday; | ||
119 | } | ||
120 | |||
121 | *bcd_year = (bin2bcd(year % 100) | bin2bcd(year / 100) << 8); | ||
122 | |||
123 | *st_time = ((tm->tm_mon + 1) << RTC_MON_SHIFT) | ||
124 | | (tm->tm_mday << RTC_MDAY_SHIFT) | ||
125 | | ((wday + 1) << RTC_WDAY_SHIFT) | ||
126 | | (tm->tm_hour << RTC_HOUR_SHIFT) | ||
127 | | (tm->tm_min << RTC_MIN_SHIFT) | ||
128 | | (tm->tm_sec << RTC_SEC_SHIFT); | ||
129 | |||
130 | return 0; | ||
131 | } | ||
132 | |||
133 | /* | ||
134 | * Convert ST v2 RTC format to Gregorian date. | ||
135 | */ | ||
136 | static int pl031_stv2_time_to_tm(unsigned long st_time, unsigned long bcd_year, | ||
137 | struct rtc_time *tm) | ||
138 | { | ||
139 | tm->tm_year = bcd2bin(bcd_year) + (bcd2bin(bcd_year >> 8) * 100); | ||
140 | tm->tm_mon = ((st_time & RTC_MON_MASK) >> RTC_MON_SHIFT) - 1; | ||
141 | tm->tm_mday = ((st_time & RTC_MDAY_MASK) >> RTC_MDAY_SHIFT); | ||
142 | tm->tm_wday = ((st_time & RTC_WDAY_MASK) >> RTC_WDAY_SHIFT) - 1; | ||
143 | tm->tm_hour = ((st_time & RTC_HOUR_MASK) >> RTC_HOUR_SHIFT); | ||
144 | tm->tm_min = ((st_time & RTC_MIN_MASK) >> RTC_MIN_SHIFT); | ||
145 | tm->tm_sec = ((st_time & RTC_SEC_MASK) >> RTC_SEC_SHIFT); | ||
146 | |||
147 | tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); | ||
148 | tm->tm_year -= 1900; | ||
149 | |||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | static int pl031_stv2_read_time(struct device *dev, struct rtc_time *tm) | ||
154 | { | ||
155 | struct pl031_local *ldata = dev_get_drvdata(dev); | ||
156 | |||
157 | pl031_stv2_time_to_tm(readl(ldata->base + RTC_DR), | ||
158 | readl(ldata->base + RTC_YDR), tm); | ||
159 | |||
160 | return 0; | ||
161 | } | ||
162 | |||
163 | static int pl031_stv2_set_time(struct device *dev, struct rtc_time *tm) | ||
164 | { | ||
165 | unsigned long time; | ||
166 | unsigned long bcd_year; | ||
167 | struct pl031_local *ldata = dev_get_drvdata(dev); | ||
168 | int ret; | ||
169 | |||
170 | ret = pl031_stv2_tm_to_time(dev, tm, &time, &bcd_year); | ||
171 | if (ret == 0) { | ||
172 | writel(bcd_year, ldata->base + RTC_YLR); | ||
173 | writel(time, ldata->base + RTC_LR); | ||
174 | } | ||
175 | |||
176 | return ret; | ||
177 | } | ||
178 | |||
179 | static int pl031_stv2_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) | ||
40 | { | 180 | { |
41 | struct rtc_device *rtc = dev_id; | 181 | struct pl031_local *ldata = dev_get_drvdata(dev); |
182 | int ret; | ||
42 | 183 | ||
43 | rtc_update_irq(rtc, 1, RTC_AF); | 184 | ret = pl031_stv2_time_to_tm(readl(ldata->base + RTC_MR), |
185 | readl(ldata->base + RTC_YMR), &alarm->time); | ||
44 | 186 | ||
45 | return IRQ_HANDLED; | 187 | alarm->pending = readl(ldata->base + RTC_RIS) & RTC_BIT_AI; |
188 | alarm->enabled = readl(ldata->base + RTC_IMSC) & RTC_BIT_AI; | ||
189 | |||
190 | return ret; | ||
46 | } | 191 | } |
47 | 192 | ||
48 | static int pl031_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | 193 | static int pl031_stv2_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) |
49 | { | 194 | { |
50 | struct pl031_local *ldata = dev_get_drvdata(dev); | 195 | struct pl031_local *ldata = dev_get_drvdata(dev); |
196 | unsigned long time; | ||
197 | unsigned long bcd_year; | ||
198 | int ret; | ||
199 | |||
200 | /* At the moment, we can only deal with non-wildcarded alarm times. */ | ||
201 | ret = rtc_valid_tm(&alarm->time); | ||
202 | if (ret == 0) { | ||
203 | ret = pl031_stv2_tm_to_time(dev, &alarm->time, | ||
204 | &time, &bcd_year); | ||
205 | if (ret == 0) { | ||
206 | writel(bcd_year, ldata->base + RTC_YMR); | ||
207 | writel(time, ldata->base + RTC_MR); | ||
208 | |||
209 | pl031_alarm_irq_enable(dev, alarm->enabled); | ||
210 | } | ||
211 | } | ||
212 | |||
213 | return ret; | ||
214 | } | ||
215 | |||
216 | static irqreturn_t pl031_interrupt(int irq, void *dev_id) | ||
217 | { | ||
218 | struct pl031_local *ldata = dev_id; | ||
219 | unsigned long rtcmis; | ||
220 | unsigned long events = 0; | ||
221 | |||
222 | rtcmis = readl(ldata->base + RTC_MIS); | ||
223 | if (rtcmis) { | ||
224 | writel(rtcmis, ldata->base + RTC_ICR); | ||
225 | |||
226 | if (rtcmis & RTC_BIT_AI) | ||
227 | events |= (RTC_AF | RTC_IRQF); | ||
228 | |||
229 | /* Timer interrupt is only available in ST variants */ | ||
230 | if ((rtcmis & RTC_BIT_PI) && | ||
231 | (ldata->hw_designer == AMBA_VENDOR_ST)) | ||
232 | events |= (RTC_PF | RTC_IRQF); | ||
233 | |||
234 | rtc_update_irq(ldata->rtc, 1, events); | ||
51 | 235 | ||
52 | switch (cmd) { | 236 | return IRQ_HANDLED; |
53 | case RTC_AIE_OFF: | ||
54 | writel(1, ldata->base + RTC_MIS); | ||
55 | return 0; | ||
56 | case RTC_AIE_ON: | ||
57 | writel(0, ldata->base + RTC_MIS); | ||
58 | return 0; | ||
59 | } | 237 | } |
60 | 238 | ||
61 | return -ENOIOCTLCMD; | 239 | return IRQ_NONE; |
62 | } | 240 | } |
63 | 241 | ||
64 | static int pl031_read_time(struct device *dev, struct rtc_time *tm) | 242 | static int pl031_read_time(struct device *dev, struct rtc_time *tm) |
@@ -74,11 +252,14 @@ static int pl031_set_time(struct device *dev, struct rtc_time *tm) | |||
74 | { | 252 | { |
75 | unsigned long time; | 253 | unsigned long time; |
76 | struct pl031_local *ldata = dev_get_drvdata(dev); | 254 | struct pl031_local *ldata = dev_get_drvdata(dev); |
255 | int ret; | ||
77 | 256 | ||
78 | rtc_tm_to_time(tm, &time); | 257 | ret = rtc_tm_to_time(tm, &time); |
79 | writel(time, ldata->base + RTC_LR); | ||
80 | 258 | ||
81 | return 0; | 259 | if (ret == 0) |
260 | writel(time, ldata->base + RTC_LR); | ||
261 | |||
262 | return ret; | ||
82 | } | 263 | } |
83 | 264 | ||
84 | static int pl031_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) | 265 | static int pl031_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) |
@@ -86,8 +267,9 @@ static int pl031_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
86 | struct pl031_local *ldata = dev_get_drvdata(dev); | 267 | struct pl031_local *ldata = dev_get_drvdata(dev); |
87 | 268 | ||
88 | rtc_time_to_tm(readl(ldata->base + RTC_MR), &alarm->time); | 269 | rtc_time_to_tm(readl(ldata->base + RTC_MR), &alarm->time); |
89 | alarm->pending = readl(ldata->base + RTC_RIS); | 270 | |
90 | alarm->enabled = readl(ldata->base + RTC_IMSC); | 271 | alarm->pending = readl(ldata->base + RTC_RIS) & RTC_BIT_AI; |
272 | alarm->enabled = readl(ldata->base + RTC_IMSC) & RTC_BIT_AI; | ||
91 | 273 | ||
92 | return 0; | 274 | return 0; |
93 | } | 275 | } |
@@ -96,22 +278,71 @@ static int pl031_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
96 | { | 278 | { |
97 | struct pl031_local *ldata = dev_get_drvdata(dev); | 279 | struct pl031_local *ldata = dev_get_drvdata(dev); |
98 | unsigned long time; | 280 | unsigned long time; |
281 | int ret; | ||
282 | |||
283 | /* At the moment, we can only deal with non-wildcarded alarm times. */ | ||
284 | ret = rtc_valid_tm(&alarm->time); | ||
285 | if (ret == 0) { | ||
286 | ret = rtc_tm_to_time(&alarm->time, &time); | ||
287 | if (ret == 0) { | ||
288 | writel(time, ldata->base + RTC_MR); | ||
289 | pl031_alarm_irq_enable(dev, alarm->enabled); | ||
290 | } | ||
291 | } | ||
292 | |||
293 | return ret; | ||
294 | } | ||
295 | |||
296 | /* Periodic interrupt is only available in ST variants. */ | ||
297 | static int pl031_irq_set_state(struct device *dev, int enabled) | ||
298 | { | ||
299 | struct pl031_local *ldata = dev_get_drvdata(dev); | ||
300 | |||
301 | if (enabled == 1) { | ||
302 | /* Clear any pending timer interrupt. */ | ||
303 | writel(RTC_BIT_PI, ldata->base + RTC_ICR); | ||
304 | |||
305 | writel(readl(ldata->base + RTC_IMSC) | RTC_BIT_PI, | ||
306 | ldata->base + RTC_IMSC); | ||
99 | 307 | ||
100 | rtc_tm_to_time(&alarm->time, &time); | 308 | /* Now start the timer */ |
309 | writel(readl(ldata->base + RTC_TCR) | RTC_TCR_EN, | ||
310 | ldata->base + RTC_TCR); | ||
101 | 311 | ||
102 | writel(time, ldata->base + RTC_MR); | 312 | } else { |
103 | writel(!alarm->enabled, ldata->base + RTC_MIS); | 313 | writel(readl(ldata->base + RTC_IMSC) & (~RTC_BIT_PI), |
314 | ldata->base + RTC_IMSC); | ||
315 | |||
316 | /* Also stop the timer */ | ||
317 | writel(readl(ldata->base + RTC_TCR) & (~RTC_TCR_EN), | ||
318 | ldata->base + RTC_TCR); | ||
319 | } | ||
320 | /* Wait at least 1 RTC32 clock cycle to ensure next access | ||
321 | * to RTC_TCR will succeed. | ||
322 | */ | ||
323 | udelay(40); | ||
104 | 324 | ||
105 | return 0; | 325 | return 0; |
106 | } | 326 | } |
107 | 327 | ||
108 | static const struct rtc_class_ops pl031_ops = { | 328 | static int pl031_irq_set_freq(struct device *dev, int freq) |
109 | .ioctl = pl031_ioctl, | 329 | { |
110 | .read_time = pl031_read_time, | 330 | struct pl031_local *ldata = dev_get_drvdata(dev); |
111 | .set_time = pl031_set_time, | 331 | |
112 | .read_alarm = pl031_read_alarm, | 332 | /* Cant set timer if it is already enabled */ |
113 | .set_alarm = pl031_set_alarm, | 333 | if (readl(ldata->base + RTC_TCR) & RTC_TCR_EN) { |
114 | }; | 334 | dev_err(dev, "can't change frequency while timer enabled\n"); |
335 | return -EINVAL; | ||
336 | } | ||
337 | |||
338 | /* If self start bit in RTC_TCR is set timer will start here, | ||
339 | * but we never set that bit. Instead we start the timer when | ||
340 | * set_state is called with enabled == 1. | ||
341 | */ | ||
342 | writel(RTC_TIMER_FREQ / freq, ldata->base + RTC_TLR); | ||
343 | |||
344 | return 0; | ||
345 | } | ||
115 | 346 | ||
116 | static int pl031_remove(struct amba_device *adev) | 347 | static int pl031_remove(struct amba_device *adev) |
117 | { | 348 | { |
@@ -131,18 +362,20 @@ static int pl031_probe(struct amba_device *adev, struct amba_id *id) | |||
131 | { | 362 | { |
132 | int ret; | 363 | int ret; |
133 | struct pl031_local *ldata; | 364 | struct pl031_local *ldata; |
365 | struct rtc_class_ops *ops = id->data; | ||
134 | 366 | ||
135 | ret = amba_request_regions(adev, NULL); | 367 | ret = amba_request_regions(adev, NULL); |
136 | if (ret) | 368 | if (ret) |
137 | goto err_req; | 369 | goto err_req; |
138 | 370 | ||
139 | ldata = kmalloc(sizeof(struct pl031_local), GFP_KERNEL); | 371 | ldata = kzalloc(sizeof(struct pl031_local), GFP_KERNEL); |
140 | if (!ldata) { | 372 | if (!ldata) { |
141 | ret = -ENOMEM; | 373 | ret = -ENOMEM; |
142 | goto out; | 374 | goto out; |
143 | } | 375 | } |
144 | 376 | ||
145 | ldata->base = ioremap(adev->res.start, resource_size(&adev->res)); | 377 | ldata->base = ioremap(adev->res.start, resource_size(&adev->res)); |
378 | |||
146 | if (!ldata->base) { | 379 | if (!ldata->base) { |
147 | ret = -ENOMEM; | 380 | ret = -ENOMEM; |
148 | goto out_no_remap; | 381 | goto out_no_remap; |
@@ -150,24 +383,36 @@ static int pl031_probe(struct amba_device *adev, struct amba_id *id) | |||
150 | 383 | ||
151 | amba_set_drvdata(adev, ldata); | 384 | amba_set_drvdata(adev, ldata); |
152 | 385 | ||
153 | if (request_irq(adev->irq[0], pl031_interrupt, IRQF_DISABLED, | 386 | ldata->hw_designer = amba_manf(adev); |
154 | "rtc-pl031", ldata->rtc)) { | 387 | ldata->hw_revision = amba_rev(adev); |
155 | ret = -EIO; | 388 | |
156 | goto out_no_irq; | 389 | dev_dbg(&adev->dev, "designer ID = 0x%02x\n", ldata->hw_designer); |
157 | } | 390 | dev_dbg(&adev->dev, "revision = 0x%01x\n", ldata->hw_revision); |
158 | 391 | ||
159 | ldata->rtc = rtc_device_register("pl031", &adev->dev, &pl031_ops, | 392 | /* Enable the clockwatch on ST Variants */ |
160 | THIS_MODULE); | 393 | if ((ldata->hw_designer == AMBA_VENDOR_ST) && |
394 | (ldata->hw_revision > 1)) | ||
395 | writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN, | ||
396 | ldata->base + RTC_CR); | ||
397 | |||
398 | ldata->rtc = rtc_device_register("pl031", &adev->dev, ops, | ||
399 | THIS_MODULE); | ||
161 | if (IS_ERR(ldata->rtc)) { | 400 | if (IS_ERR(ldata->rtc)) { |
162 | ret = PTR_ERR(ldata->rtc); | 401 | ret = PTR_ERR(ldata->rtc); |
163 | goto out_no_rtc; | 402 | goto out_no_rtc; |
164 | } | 403 | } |
165 | 404 | ||
405 | if (request_irq(adev->irq[0], pl031_interrupt, | ||
406 | IRQF_DISABLED | IRQF_SHARED, "rtc-pl031", ldata)) { | ||
407 | ret = -EIO; | ||
408 | goto out_no_irq; | ||
409 | } | ||
410 | |||
166 | return 0; | 411 | return 0; |
167 | 412 | ||
168 | out_no_rtc: | ||
169 | free_irq(adev->irq[0], ldata->rtc); | ||
170 | out_no_irq: | 413 | out_no_irq: |
414 | rtc_device_unregister(ldata->rtc); | ||
415 | out_no_rtc: | ||
171 | iounmap(ldata->base); | 416 | iounmap(ldata->base); |
172 | amba_set_drvdata(adev, NULL); | 417 | amba_set_drvdata(adev, NULL); |
173 | out_no_remap: | 418 | out_no_remap: |
@@ -175,13 +420,57 @@ out_no_remap: | |||
175 | out: | 420 | out: |
176 | amba_release_regions(adev); | 421 | amba_release_regions(adev); |
177 | err_req: | 422 | err_req: |
423 | |||
178 | return ret; | 424 | return ret; |
179 | } | 425 | } |
180 | 426 | ||
427 | /* Operations for the original ARM version */ | ||
428 | static struct rtc_class_ops arm_pl031_ops = { | ||
429 | .read_time = pl031_read_time, | ||
430 | .set_time = pl031_set_time, | ||
431 | .read_alarm = pl031_read_alarm, | ||
432 | .set_alarm = pl031_set_alarm, | ||
433 | .alarm_irq_enable = pl031_alarm_irq_enable, | ||
434 | }; | ||
435 | |||
436 | /* The First ST derivative */ | ||
437 | static struct rtc_class_ops stv1_pl031_ops = { | ||
438 | .read_time = pl031_read_time, | ||
439 | .set_time = pl031_set_time, | ||
440 | .read_alarm = pl031_read_alarm, | ||
441 | .set_alarm = pl031_set_alarm, | ||
442 | .alarm_irq_enable = pl031_alarm_irq_enable, | ||
443 | .irq_set_state = pl031_irq_set_state, | ||
444 | .irq_set_freq = pl031_irq_set_freq, | ||
445 | }; | ||
446 | |||
447 | /* And the second ST derivative */ | ||
448 | static struct rtc_class_ops stv2_pl031_ops = { | ||
449 | .read_time = pl031_stv2_read_time, | ||
450 | .set_time = pl031_stv2_set_time, | ||
451 | .read_alarm = pl031_stv2_read_alarm, | ||
452 | .set_alarm = pl031_stv2_set_alarm, | ||
453 | .alarm_irq_enable = pl031_alarm_irq_enable, | ||
454 | .irq_set_state = pl031_irq_set_state, | ||
455 | .irq_set_freq = pl031_irq_set_freq, | ||
456 | }; | ||
457 | |||
181 | static struct amba_id pl031_ids[] __initdata = { | 458 | static struct amba_id pl031_ids[] __initdata = { |
182 | { | 459 | { |
183 | .id = 0x00041031, | 460 | .id = 0x00041031, |
184 | .mask = 0x000fffff, | 461 | .mask = 0x000fffff, |
462 | .data = &arm_pl031_ops, | ||
463 | }, | ||
464 | /* ST Micro variants */ | ||
465 | { | ||
466 | .id = 0x00180031, | ||
467 | .mask = 0x00ffffff, | ||
468 | .data = &stv1_pl031_ops, | ||
469 | }, | ||
470 | { | ||
471 | .id = 0x00280031, | ||
472 | .mask = 0x00ffffff, | ||
473 | .data = &stv2_pl031_ops, | ||
185 | }, | 474 | }, |
186 | {0, 0}, | 475 | {0, 0}, |
187 | }; | 476 | }; |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 9ab1ae40565f..4951aa82e9f5 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -2139,9 +2139,8 @@ static void dasd_setup_queue(struct dasd_block *block) | |||
2139 | 2139 | ||
2140 | blk_queue_logical_block_size(block->request_queue, block->bp_block); | 2140 | blk_queue_logical_block_size(block->request_queue, block->bp_block); |
2141 | max = block->base->discipline->max_blocks << block->s2b_shift; | 2141 | max = block->base->discipline->max_blocks << block->s2b_shift; |
2142 | blk_queue_max_sectors(block->request_queue, max); | 2142 | blk_queue_max_hw_sectors(block->request_queue, max); |
2143 | blk_queue_max_phys_segments(block->request_queue, -1L); | 2143 | blk_queue_max_segments(block->request_queue, -1L); |
2144 | blk_queue_max_hw_segments(block->request_queue, -1L); | ||
2145 | /* with page sized segments we can translate each segement into | 2144 | /* with page sized segments we can translate each segement into |
2146 | * one idaw/tidaw | 2145 | * one idaw/tidaw |
2147 | */ | 2146 | */ |
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c index 8d3d720737da..097da8ce6be6 100644 --- a/drivers/s390/char/tape_block.c +++ b/drivers/s390/char/tape_block.c | |||
@@ -222,9 +222,8 @@ tapeblock_setup_device(struct tape_device * device) | |||
222 | goto cleanup_queue; | 222 | goto cleanup_queue; |
223 | 223 | ||
224 | blk_queue_logical_block_size(blkdat->request_queue, TAPEBLOCK_HSEC_SIZE); | 224 | blk_queue_logical_block_size(blkdat->request_queue, TAPEBLOCK_HSEC_SIZE); |
225 | blk_queue_max_sectors(blkdat->request_queue, TAPEBLOCK_MAX_SEC); | 225 | blk_queue_max_hw_sectors(blkdat->request_queue, TAPEBLOCK_MAX_SEC); |
226 | blk_queue_max_phys_segments(blkdat->request_queue, -1L); | 226 | blk_queue_max_segments(blkdat->request_queue, -1L); |
227 | blk_queue_max_hw_segments(blkdat->request_queue, -1L); | ||
228 | blk_queue_max_segment_size(blkdat->request_queue, -1L); | 227 | blk_queue_max_segment_size(blkdat->request_queue, -1L); |
229 | blk_queue_segment_boundary(blkdat->request_queue, -1L); | 228 | blk_queue_segment_boundary(blkdat->request_queue, -1L); |
230 | 229 | ||
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 87b536a97cb4..732f6d35b4a8 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c | |||
@@ -4195,7 +4195,7 @@ static void ibmvfc_tgt_add_rport(struct ibmvfc_target *tgt) | |||
4195 | if (tgt->service_parms.class3_parms[0] & 0x80000000) | 4195 | if (tgt->service_parms.class3_parms[0] & 0x80000000) |
4196 | rport->supported_classes |= FC_COS_CLASS3; | 4196 | rport->supported_classes |= FC_COS_CLASS3; |
4197 | if (rport->rqst_q) | 4197 | if (rport->rqst_q) |
4198 | blk_queue_max_hw_segments(rport->rqst_q, 1); | 4198 | blk_queue_max_segments(rport->rqst_q, 1); |
4199 | } else | 4199 | } else |
4200 | tgt_dbg(tgt, "rport add failed\n"); | 4200 | tgt_dbg(tgt, "rport add failed\n"); |
4201 | spin_unlock_irqrestore(vhost->host->host_lock, flags); | 4201 | spin_unlock_irqrestore(vhost->host->host_lock, flags); |
@@ -4669,7 +4669,7 @@ static int ibmvfc_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
4669 | } | 4669 | } |
4670 | 4670 | ||
4671 | if (shost_to_fc_host(shost)->rqst_q) | 4671 | if (shost_to_fc_host(shost)->rqst_q) |
4672 | blk_queue_max_hw_segments(shost_to_fc_host(shost)->rqst_q, 1); | 4672 | blk_queue_max_segments(shost_to_fc_host(shost)->rqst_q, 1); |
4673 | dev_set_drvdata(dev, vhost); | 4673 | dev_set_drvdata(dev, vhost); |
4674 | spin_lock(&ibmvfc_driver_lock); | 4674 | spin_lock(&ibmvfc_driver_lock); |
4675 | list_add_tail(&vhost->queue, &ibmvfc_head); | 4675 | list_add_tail(&vhost->queue, &ibmvfc_head); |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 9e52d16c7c39..032f0d0e6cb4 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -3674,7 +3674,7 @@ static int ipr_slave_configure(struct scsi_device *sdev) | |||
3674 | if (ipr_is_vset_device(res)) { | 3674 | if (ipr_is_vset_device(res)) { |
3675 | blk_queue_rq_timeout(sdev->request_queue, | 3675 | blk_queue_rq_timeout(sdev->request_queue, |
3676 | IPR_VSET_RW_TIMEOUT); | 3676 | IPR_VSET_RW_TIMEOUT); |
3677 | blk_queue_max_sectors(sdev->request_queue, IPR_VSET_MAX_SECTORS); | 3677 | blk_queue_max_hw_sectors(sdev->request_queue, IPR_VSET_MAX_SECTORS); |
3678 | } | 3678 | } |
3679 | if (ipr_is_vset_device(res) || ipr_is_scsi_disk(res)) | 3679 | if (ipr_is_vset_device(res) || ipr_is_scsi_disk(res)) |
3680 | sdev->allow_restart = 1; | 3680 | sdev->allow_restart = 1; |
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index b6f1ef954af1..9b1c1433c26b 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c | |||
@@ -235,7 +235,7 @@ static int pmcraid_slave_configure(struct scsi_device *scsi_dev) | |||
235 | scsi_dev->allow_restart = 1; | 235 | scsi_dev->allow_restart = 1; |
236 | blk_queue_rq_timeout(scsi_dev->request_queue, | 236 | blk_queue_rq_timeout(scsi_dev->request_queue, |
237 | PMCRAID_VSET_IO_TIMEOUT); | 237 | PMCRAID_VSET_IO_TIMEOUT); |
238 | blk_queue_max_sectors(scsi_dev->request_queue, | 238 | blk_queue_max_hw_sectors(scsi_dev->request_queue, |
239 | PMCRAID_VSET_MAX_SECTORS); | 239 | PMCRAID_VSET_MAX_SECTORS); |
240 | } | 240 | } |
241 | 241 | ||
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 513661f45e5f..1c08f6164658 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -1018,6 +1018,8 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer, | |||
1018 | * scsi_get_vpd_page - Get Vital Product Data from a SCSI device | 1018 | * scsi_get_vpd_page - Get Vital Product Data from a SCSI device |
1019 | * @sdev: The device to ask | 1019 | * @sdev: The device to ask |
1020 | * @page: Which Vital Product Data to return | 1020 | * @page: Which Vital Product Data to return |
1021 | * @buf: where to store the VPD | ||
1022 | * @buf_len: number of bytes in the VPD buffer area | ||
1021 | * | 1023 | * |
1022 | * SCSI devices may optionally supply Vital Product Data. Each 'page' | 1024 | * SCSI devices may optionally supply Vital Product Data. Each 'page' |
1023 | * of VPD is defined in the appropriate SCSI document (eg SPC, SBC). | 1025 | * of VPD is defined in the appropriate SCSI document (eg SPC, SBC). |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 56977097de9f..1646fe7cbd4b 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1630,10 +1630,10 @@ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost, | |||
1630 | /* | 1630 | /* |
1631 | * this limit is imposed by hardware restrictions | 1631 | * this limit is imposed by hardware restrictions |
1632 | */ | 1632 | */ |
1633 | blk_queue_max_hw_segments(q, shost->sg_tablesize); | 1633 | blk_queue_max_segments(q, min_t(unsigned short, shost->sg_tablesize, |
1634 | blk_queue_max_phys_segments(q, SCSI_MAX_SG_CHAIN_SEGMENTS); | 1634 | SCSI_MAX_SG_CHAIN_SEGMENTS)); |
1635 | 1635 | ||
1636 | blk_queue_max_sectors(q, shost->max_sectors); | 1636 | blk_queue_max_hw_sectors(q, shost->max_sectors); |
1637 | blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost)); | 1637 | blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost)); |
1638 | blk_queue_segment_boundary(q, shost->dma_boundary); | 1638 | blk_queue_segment_boundary(q, shost->dma_boundary); |
1639 | dma_set_seg_boundary(dev, shost->dma_boundary); | 1639 | dma_set_seg_boundary(dev, shost->dma_boundary); |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index f697229ae5a9..4bc8b77a2ef3 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -879,7 +879,7 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result, | |||
879 | * broken RA4x00 Compaq Disk Array | 879 | * broken RA4x00 Compaq Disk Array |
880 | */ | 880 | */ |
881 | if (*bflags & BLIST_MAX_512) | 881 | if (*bflags & BLIST_MAX_512) |
882 | blk_queue_max_sectors(sdev->request_queue, 512); | 882 | blk_queue_max_hw_sectors(sdev->request_queue, 512); |
883 | 883 | ||
884 | /* | 884 | /* |
885 | * Some devices may not want to have a start command automatically | 885 | * Some devices may not want to have a start command automatically |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 040f751809ea..c996d98636f3 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -287,8 +287,7 @@ sg_open(struct inode *inode, struct file *filp) | |||
287 | if (list_empty(&sdp->sfds)) { /* no existing opens on this device */ | 287 | if (list_empty(&sdp->sfds)) { /* no existing opens on this device */ |
288 | sdp->sgdebug = 0; | 288 | sdp->sgdebug = 0; |
289 | q = sdp->device->request_queue; | 289 | q = sdp->device->request_queue; |
290 | sdp->sg_tablesize = min(queue_max_hw_segments(q), | 290 | sdp->sg_tablesize = queue_max_segments(q); |
291 | queue_max_phys_segments(q)); | ||
292 | } | 291 | } |
293 | if ((sfp = sg_add_sfp(sdp, dev))) | 292 | if ((sfp = sg_add_sfp(sdp, dev))) |
294 | filp->private_data = sfp; | 293 | filp->private_data = sfp; |
@@ -1376,8 +1375,7 @@ static Sg_device *sg_alloc(struct gendisk *disk, struct scsi_device *scsidp) | |||
1376 | sdp->device = scsidp; | 1375 | sdp->device = scsidp; |
1377 | INIT_LIST_HEAD(&sdp->sfds); | 1376 | INIT_LIST_HEAD(&sdp->sfds); |
1378 | init_waitqueue_head(&sdp->o_excl_wait); | 1377 | init_waitqueue_head(&sdp->o_excl_wait); |
1379 | sdp->sg_tablesize = min(queue_max_hw_segments(q), | 1378 | sdp->sg_tablesize = queue_max_segments(q); |
1380 | queue_max_phys_segments(q)); | ||
1381 | sdp->index = k; | 1379 | sdp->index = k; |
1382 | kref_init(&sdp->d_ref); | 1380 | kref_init(&sdp->d_ref); |
1383 | 1381 | ||
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index d04ea9a6f673..f67d1a159aad 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -3983,8 +3983,7 @@ static int st_probe(struct device *dev) | |||
3983 | return -ENODEV; | 3983 | return -ENODEV; |
3984 | } | 3984 | } |
3985 | 3985 | ||
3986 | i = min(queue_max_hw_segments(SDp->request_queue), | 3986 | i = queue_max_segments(SDp->request_queue); |
3987 | queue_max_phys_segments(SDp->request_queue)); | ||
3988 | if (st_max_sg_segs < i) | 3987 | if (st_max_sg_segs < i) |
3989 | i = st_max_sg_segs; | 3988 | i = st_max_sg_segs; |
3990 | buffer = new_tape_buffer((SDp->host)->unchecked_isa_dma, i); | 3989 | buffer = new_tape_buffer((SDp->host)->unchecked_isa_dma, i); |
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index ef7adc8135dd..ce6c35333ff7 100644 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c | |||
@@ -71,6 +71,7 @@ struct uart_amba_port { | |||
71 | unsigned int im; /* interrupt mask */ | 71 | unsigned int im; /* interrupt mask */ |
72 | unsigned int old_status; | 72 | unsigned int old_status; |
73 | unsigned int ifls; /* vendor-specific */ | 73 | unsigned int ifls; /* vendor-specific */ |
74 | bool autorts; | ||
74 | }; | 75 | }; |
75 | 76 | ||
76 | /* There is by now at least one vendor with differing details, so handle it */ | 77 | /* There is by now at least one vendor with differing details, so handle it */ |
@@ -308,6 +309,11 @@ static void pl011_set_mctrl(struct uart_port *port, unsigned int mctrl) | |||
308 | TIOCMBIT(TIOCM_OUT1, UART011_CR_OUT1); | 309 | TIOCMBIT(TIOCM_OUT1, UART011_CR_OUT1); |
309 | TIOCMBIT(TIOCM_OUT2, UART011_CR_OUT2); | 310 | TIOCMBIT(TIOCM_OUT2, UART011_CR_OUT2); |
310 | TIOCMBIT(TIOCM_LOOP, UART011_CR_LBE); | 311 | TIOCMBIT(TIOCM_LOOP, UART011_CR_LBE); |
312 | |||
313 | if (uap->autorts) { | ||
314 | /* We need to disable auto-RTS if we want to turn RTS off */ | ||
315 | TIOCMBIT(TIOCM_RTS, UART011_CR_RTSEN); | ||
316 | } | ||
311 | #undef TIOCMBIT | 317 | #undef TIOCMBIT |
312 | 318 | ||
313 | writew(cr, uap->port.membase + UART011_CR); | 319 | writew(cr, uap->port.membase + UART011_CR); |
@@ -437,6 +443,7 @@ static void pl011_shutdown(struct uart_port *port) | |||
437 | /* | 443 | /* |
438 | * disable the port | 444 | * disable the port |
439 | */ | 445 | */ |
446 | uap->autorts = false; | ||
440 | writew(UART01x_CR_UARTEN | UART011_CR_TXE, uap->port.membase + UART011_CR); | 447 | writew(UART01x_CR_UARTEN | UART011_CR_TXE, uap->port.membase + UART011_CR); |
441 | 448 | ||
442 | /* | 449 | /* |
@@ -456,6 +463,7 @@ static void | |||
456 | pl011_set_termios(struct uart_port *port, struct ktermios *termios, | 463 | pl011_set_termios(struct uart_port *port, struct ktermios *termios, |
457 | struct ktermios *old) | 464 | struct ktermios *old) |
458 | { | 465 | { |
466 | struct uart_amba_port *uap = (struct uart_amba_port *)port; | ||
459 | unsigned int lcr_h, old_cr; | 467 | unsigned int lcr_h, old_cr; |
460 | unsigned long flags; | 468 | unsigned long flags; |
461 | unsigned int baud, quot; | 469 | unsigned int baud, quot; |
@@ -532,6 +540,17 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios, | |||
532 | old_cr = readw(port->membase + UART011_CR); | 540 | old_cr = readw(port->membase + UART011_CR); |
533 | writew(0, port->membase + UART011_CR); | 541 | writew(0, port->membase + UART011_CR); |
534 | 542 | ||
543 | if (termios->c_cflag & CRTSCTS) { | ||
544 | if (old_cr & UART011_CR_RTS) | ||
545 | old_cr |= UART011_CR_RTSEN; | ||
546 | |||
547 | old_cr |= UART011_CR_CTSEN; | ||
548 | uap->autorts = true; | ||
549 | } else { | ||
550 | old_cr &= ~(UART011_CR_CTSEN | UART011_CR_RTSEN); | ||
551 | uap->autorts = false; | ||
552 | } | ||
553 | |||
535 | /* Set baud rate */ | 554 | /* Set baud rate */ |
536 | writew(quot & 0x3f, port->membase + UART011_FBRD); | 555 | writew(quot & 0x3f, port->membase + UART011_FBRD); |
537 | writew(quot >> 6, port->membase + UART011_IBRD); | 556 | writew(quot >> 6, port->membase + UART011_IBRD); |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 0fee95cd9a49..a191fa2be7c5 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -181,7 +181,7 @@ config SPI_OMAP_UWIRE | |||
181 | 181 | ||
182 | config SPI_OMAP24XX | 182 | config SPI_OMAP24XX |
183 | tristate "McSPI driver for OMAP24xx/OMAP34xx" | 183 | tristate "McSPI driver for OMAP24xx/OMAP34xx" |
184 | depends on ARCH_OMAP24XX || ARCH_OMAP34XX | 184 | depends on ARCH_OMAP2 || ARCH_OMAP3 |
185 | help | 185 | help |
186 | SPI master controller for OMAP24xx/OMAP34xx Multichannel SPI | 186 | SPI master controller for OMAP24xx/OMAP34xx Multichannel SPI |
187 | (McSPI) modules. | 187 | (McSPI) modules. |
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c index ff5bbb9c43c9..9aeb68113100 100644 --- a/drivers/spi/amba-pl022.c +++ b/drivers/spi/amba-pl022.c | |||
@@ -363,6 +363,7 @@ struct pl022 { | |||
363 | void *rx_end; | 363 | void *rx_end; |
364 | enum ssp_reading read; | 364 | enum ssp_reading read; |
365 | enum ssp_writing write; | 365 | enum ssp_writing write; |
366 | u32 exp_fifo_level; | ||
366 | }; | 367 | }; |
367 | 368 | ||
368 | /** | 369 | /** |
@@ -501,6 +502,9 @@ static int flush(struct pl022 *pl022) | |||
501 | while (readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_RNE) | 502 | while (readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_RNE) |
502 | readw(SSP_DR(pl022->virtbase)); | 503 | readw(SSP_DR(pl022->virtbase)); |
503 | } while ((readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_BSY) && limit--); | 504 | } while ((readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_BSY) && limit--); |
505 | |||
506 | pl022->exp_fifo_level = 0; | ||
507 | |||
504 | return limit; | 508 | return limit; |
505 | } | 509 | } |
506 | 510 | ||
@@ -583,10 +587,9 @@ static void readwriter(struct pl022 *pl022) | |||
583 | * errons in 8bit wide transfers on ARM variants (just 8 words | 587 | * errons in 8bit wide transfers on ARM variants (just 8 words |
584 | * FIFO, means only 8x8 = 64 bits in FIFO) at least. | 588 | * FIFO, means only 8x8 = 64 bits in FIFO) at least. |
585 | * | 589 | * |
586 | * FIXME: currently we have no logic to account for this. | 590 | * To prevent this issue, the TX FIFO is only filled to the |
587 | * perhaps there is even something broken in HW regarding | 591 | * unused RX FIFO fill length, regardless of what the TX |
588 | * 8bit transfers (it doesn't fail on 16bit) so this needs | 592 | * FIFO status flag indicates. |
589 | * more investigation... | ||
590 | */ | 593 | */ |
591 | dev_dbg(&pl022->adev->dev, | 594 | dev_dbg(&pl022->adev->dev, |
592 | "%s, rx: %p, rxend: %p, tx: %p, txend: %p\n", | 595 | "%s, rx: %p, rxend: %p, tx: %p, txend: %p\n", |
@@ -613,11 +616,12 @@ static void readwriter(struct pl022 *pl022) | |||
613 | break; | 616 | break; |
614 | } | 617 | } |
615 | pl022->rx += (pl022->cur_chip->n_bytes); | 618 | pl022->rx += (pl022->cur_chip->n_bytes); |
619 | pl022->exp_fifo_level--; | ||
616 | } | 620 | } |
617 | /* | 621 | /* |
618 | * Write as much as you can, while keeping an eye on the RX FIFO! | 622 | * Write as much as possible up to the RX FIFO size |
619 | */ | 623 | */ |
620 | while ((readw(SSP_SR(pl022->virtbase)) & SSP_SR_MASK_TNF) | 624 | while ((pl022->exp_fifo_level < pl022->vendor->fifodepth) |
621 | && (pl022->tx < pl022->tx_end)) { | 625 | && (pl022->tx < pl022->tx_end)) { |
622 | switch (pl022->write) { | 626 | switch (pl022->write) { |
623 | case WRITING_NULL: | 627 | case WRITING_NULL: |
@@ -634,6 +638,7 @@ static void readwriter(struct pl022 *pl022) | |||
634 | break; | 638 | break; |
635 | } | 639 | } |
636 | pl022->tx += (pl022->cur_chip->n_bytes); | 640 | pl022->tx += (pl022->cur_chip->n_bytes); |
641 | pl022->exp_fifo_level++; | ||
637 | /* | 642 | /* |
638 | * This inner reader takes care of things appearing in the RX | 643 | * This inner reader takes care of things appearing in the RX |
639 | * FIFO as we're transmitting. This will happen a lot since the | 644 | * FIFO as we're transmitting. This will happen a lot since the |
@@ -660,6 +665,7 @@ static void readwriter(struct pl022 *pl022) | |||
660 | break; | 665 | break; |
661 | } | 666 | } |
662 | pl022->rx += (pl022->cur_chip->n_bytes); | 667 | pl022->rx += (pl022->cur_chip->n_bytes); |
668 | pl022->exp_fifo_level--; | ||
663 | } | 669 | } |
664 | } | 670 | } |
665 | /* | 671 | /* |
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c index bf5f95a19413..715c518b1b68 100644 --- a/drivers/spi/omap2_mcspi.c +++ b/drivers/spi/omap2_mcspi.c | |||
@@ -1014,7 +1014,7 @@ static u8 __initdata spi2_txdma_id[] = { | |||
1014 | OMAP24XX_DMA_SPI2_TX1, | 1014 | OMAP24XX_DMA_SPI2_TX1, |
1015 | }; | 1015 | }; |
1016 | 1016 | ||
1017 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX) \ | 1017 | #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) \ |
1018 | || defined(CONFIG_ARCH_OMAP4) | 1018 | || defined(CONFIG_ARCH_OMAP4) |
1019 | static u8 __initdata spi3_rxdma_id[] = { | 1019 | static u8 __initdata spi3_rxdma_id[] = { |
1020 | OMAP24XX_DMA_SPI3_RX0, | 1020 | OMAP24XX_DMA_SPI3_RX0, |
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c index 62b282844a53..45d908114d11 100644 --- a/drivers/staging/hv/blkvsc_drv.c +++ b/drivers/staging/hv/blkvsc_drv.c | |||
@@ -363,10 +363,7 @@ static int blkvsc_probe(struct device *device) | |||
363 | blkdev->gd->queue = blk_init_queue(blkvsc_request, &blkdev->lock); | 363 | blkdev->gd->queue = blk_init_queue(blkvsc_request, &blkdev->lock); |
364 | 364 | ||
365 | blk_queue_max_segment_size(blkdev->gd->queue, PAGE_SIZE); | 365 | blk_queue_max_segment_size(blkdev->gd->queue, PAGE_SIZE); |
366 | blk_queue_max_phys_segments(blkdev->gd->queue, | 366 | blk_queue_max_segments(blkdev->gd->queue, MAX_MULTIPAGE_BUFFER_COUNT); |
367 | MAX_MULTIPAGE_BUFFER_COUNT); | ||
368 | blk_queue_max_hw_segments(blkdev->gd->queue, | ||
369 | MAX_MULTIPAGE_BUFFER_COUNT); | ||
370 | blk_queue_segment_boundary(blkdev->gd->queue, PAGE_SIZE-1); | 367 | blk_queue_segment_boundary(blkdev->gd->queue, PAGE_SIZE-1); |
371 | blk_queue_bounce_limit(blkdev->gd->queue, BLK_BOUNCE_ANY); | 368 | blk_queue_bounce_limit(blkdev->gd->queue, BLK_BOUNCE_ANY); |
372 | blk_queue_dma_alignment(blkdev->gd->queue, 511); | 369 | blk_queue_dma_alignment(blkdev->gd->queue, 511); |
diff --git a/drivers/staging/phison/phison.c b/drivers/staging/phison/phison.c index 3817d7497049..fcba78d21636 100644 --- a/drivers/staging/phison/phison.c +++ b/drivers/staging/phison/phison.c | |||
@@ -62,7 +62,7 @@ static int phison_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
62 | }; | 62 | }; |
63 | const struct ata_port_info *ppi[] = { &info, NULL }; | 63 | const struct ata_port_info *ppi[] = { &info, NULL }; |
64 | 64 | ||
65 | ret = ata_pci_sff_init_one(pdev, ppi, &phison_sht, NULL); | 65 | ret = ata_pci_sff_init_one(pdev, ppi, &phison_sht, NULL, 0); |
66 | 66 | ||
67 | dev_dbg(&pdev->dev, "phison_init_one(), ret = %x\n", ret); | 67 | dev_dbg(&pdev->dev, "phison_init_one(), ret = %x\n", ret); |
68 | 68 | ||
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 81aac7f4ca59..4f5bb5698f5d 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
@@ -61,7 +61,7 @@ config USB_ARCH_HAS_EHCI | |||
61 | default y if ARCH_W90X900 | 61 | default y if ARCH_W90X900 |
62 | default y if ARCH_AT91SAM9G45 | 62 | default y if ARCH_AT91SAM9G45 |
63 | default y if ARCH_MXC | 63 | default y if ARCH_MXC |
64 | default y if ARCH_OMAP34XX | 64 | default y if ARCH_OMAP3 |
65 | default PCI | 65 | default PCI |
66 | 66 | ||
67 | # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface. | 67 | # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface. |
diff --git a/drivers/usb/gadget/f_audio.c b/drivers/usb/gadget/f_audio.c index df77f6131c73..f1e3aad76c37 100644 --- a/drivers/usb/gadget/f_audio.c +++ b/drivers/usb/gadget/f_audio.c | |||
@@ -60,7 +60,7 @@ DECLARE_UAC_AC_HEADER_DESCRIPTOR(2); | |||
60 | #define UAC_DT_TOTAL_LENGTH (UAC_DT_AC_HEADER_LENGTH + UAC_DT_INPUT_TERMINAL_SIZE \ | 60 | #define UAC_DT_TOTAL_LENGTH (UAC_DT_AC_HEADER_LENGTH + UAC_DT_INPUT_TERMINAL_SIZE \ |
61 | + UAC_DT_OUTPUT_TERMINAL_SIZE + UAC_DT_FEATURE_UNIT_SIZE(0)) | 61 | + UAC_DT_OUTPUT_TERMINAL_SIZE + UAC_DT_FEATURE_UNIT_SIZE(0)) |
62 | /* B.3.2 Class-Specific AC Interface Descriptor */ | 62 | /* B.3.2 Class-Specific AC Interface Descriptor */ |
63 | static struct uac_ac_header_descriptor_2 ac_header_desc = { | 63 | static struct uac_ac_header_descriptor_v1_2 ac_header_desc = { |
64 | .bLength = UAC_DT_AC_HEADER_LENGTH, | 64 | .bLength = UAC_DT_AC_HEADER_LENGTH, |
65 | .bDescriptorType = USB_DT_CS_INTERFACE, | 65 | .bDescriptorType = USB_DT_CS_INTERFACE, |
66 | .bDescriptorSubtype = UAC_HEADER, | 66 | .bDescriptorSubtype = UAC_HEADER, |
@@ -124,7 +124,7 @@ static struct usb_audio_control_selector feature_unit = { | |||
124 | }; | 124 | }; |
125 | 125 | ||
126 | #define OUTPUT_TERMINAL_ID 3 | 126 | #define OUTPUT_TERMINAL_ID 3 |
127 | static struct uac_output_terminal_descriptor output_terminal_desc = { | 127 | static struct uac_output_terminal_descriptor_v1 output_terminal_desc = { |
128 | .bLength = UAC_DT_OUTPUT_TERMINAL_SIZE, | 128 | .bLength = UAC_DT_OUTPUT_TERMINAL_SIZE, |
129 | .bDescriptorType = USB_DT_CS_INTERFACE, | 129 | .bDescriptorType = USB_DT_CS_INTERFACE, |
130 | .bDescriptorSubtype = UAC_OUTPUT_TERMINAL, | 130 | .bDescriptorSubtype = UAC_OUTPUT_TERMINAL, |
@@ -154,7 +154,7 @@ static struct usb_interface_descriptor as_interface_alt_1_desc = { | |||
154 | }; | 154 | }; |
155 | 155 | ||
156 | /* B.4.2 Class-Specific AS Interface Descriptor */ | 156 | /* B.4.2 Class-Specific AS Interface Descriptor */ |
157 | static struct uac_as_header_descriptor as_header_desc = { | 157 | static struct uac_as_header_descriptor_v1 as_header_desc = { |
158 | .bLength = UAC_DT_AS_HEADER_SIZE, | 158 | .bLength = UAC_DT_AS_HEADER_SIZE, |
159 | .bDescriptorType = USB_DT_CS_INTERFACE, | 159 | .bDescriptorType = USB_DT_CS_INTERFACE, |
160 | .bDescriptorSubtype = UAC_AS_GENERAL, | 160 | .bDescriptorSubtype = UAC_AS_GENERAL, |
diff --git a/drivers/usb/gadget/gmidi.c b/drivers/usb/gadget/gmidi.c index d0b1e836f0e0..5f6a2e0a9357 100644 --- a/drivers/usb/gadget/gmidi.c +++ b/drivers/usb/gadget/gmidi.c | |||
@@ -237,7 +237,7 @@ static const struct usb_interface_descriptor ac_interface_desc = { | |||
237 | }; | 237 | }; |
238 | 238 | ||
239 | /* B.3.2 Class-Specific AC Interface Descriptor */ | 239 | /* B.3.2 Class-Specific AC Interface Descriptor */ |
240 | static const struct uac_ac_header_descriptor_1 ac_header_desc = { | 240 | static const struct uac_ac_header_descriptor_v1_1 ac_header_desc = { |
241 | .bLength = UAC_DT_AC_HEADER_SIZE(1), | 241 | .bLength = UAC_DT_AC_HEADER_SIZE(1), |
242 | .bDescriptorType = USB_DT_CS_INTERFACE, | 242 | .bDescriptorType = USB_DT_CS_INTERFACE, |
243 | .bDescriptorSubtype = USB_MS_HEADER, | 243 | .bDescriptorSubtype = USB_MS_HEADER, |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 1ec3857f22e6..d8d6d3461d32 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -1118,7 +1118,7 @@ MODULE_LICENSE ("GPL"); | |||
1118 | #define PLATFORM_DRIVER ehci_hcd_au1xxx_driver | 1118 | #define PLATFORM_DRIVER ehci_hcd_au1xxx_driver |
1119 | #endif | 1119 | #endif |
1120 | 1120 | ||
1121 | #ifdef CONFIG_ARCH_OMAP34XX | 1121 | #ifdef CONFIG_ARCH_OMAP3 |
1122 | #include "ehci-omap.c" | 1122 | #include "ehci-omap.c" |
1123 | #define PLATFORM_DRIVER ehci_hcd_omap_driver | 1123 | #define PLATFORM_DRIVER ehci_hcd_omap_driver |
1124 | #endif | 1124 | #endif |
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index d9db86498022..b4c783c284ba 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
@@ -37,7 +37,7 @@ config USB_MUSB_SOC | |||
37 | depends on USB_MUSB_HDRC | 37 | depends on USB_MUSB_HDRC |
38 | default y if ARCH_DAVINCI | 38 | default y if ARCH_DAVINCI |
39 | default y if ARCH_OMAP2430 | 39 | default y if ARCH_OMAP2430 |
40 | default y if ARCH_OMAP34XX | 40 | default y if ARCH_OMAP3 |
41 | default y if (BF54x && !BF544) | 41 | default y if (BF54x && !BF544) |
42 | default y if (BF52x && !BF522 && !BF523) | 42 | default y if (BF52x && !BF522 && !BF523) |
43 | 43 | ||
@@ -48,7 +48,7 @@ comment "OMAP 243x high speed USB support" | |||
48 | depends on USB_MUSB_HDRC && ARCH_OMAP2430 | 48 | depends on USB_MUSB_HDRC && ARCH_OMAP2430 |
49 | 49 | ||
50 | comment "OMAP 343x high speed USB support" | 50 | comment "OMAP 343x high speed USB support" |
51 | depends on USB_MUSB_HDRC && ARCH_OMAP34XX | 51 | depends on USB_MUSB_HDRC && ARCH_OMAP3 |
52 | 52 | ||
53 | comment "Blackfin high speed USB Support" | 53 | comment "Blackfin high speed USB Support" |
54 | depends on USB_MUSB_HDRC && ((BF54x && !BF544) || (BF52x && !BF522 && !BF523)) | 54 | depends on USB_MUSB_HDRC && ((BF54x && !BF544) || (BF52x && !BF522 && !BF523)) |
@@ -153,7 +153,7 @@ config MUSB_PIO_ONLY | |||
153 | config USB_INVENTRA_DMA | 153 | config USB_INVENTRA_DMA |
154 | bool | 154 | bool |
155 | depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY | 155 | depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY |
156 | default ARCH_OMAP2430 || ARCH_OMAP34XX || BLACKFIN | 156 | default ARCH_OMAP2430 || ARCH_OMAP3 || BLACKFIN |
157 | help | 157 | help |
158 | Enable DMA transfers using Mentor's engine. | 158 | Enable DMA transfers using Mentor's engine. |
159 | 159 | ||
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 5eb9318cff77..738efd8063b5 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1000,7 +1000,7 @@ static void musb_shutdown(struct platform_device *pdev) | |||
1000 | * more than selecting one of a bunch of predefined configurations. | 1000 | * more than selecting one of a bunch of predefined configurations. |
1001 | */ | 1001 | */ |
1002 | #if defined(CONFIG_USB_TUSB6010) || \ | 1002 | #if defined(CONFIG_USB_TUSB6010) || \ |
1003 | defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX) | 1003 | defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) |
1004 | static ushort __initdata fifo_mode = 4; | 1004 | static ushort __initdata fifo_mode = 4; |
1005 | #else | 1005 | #else |
1006 | static ushort __initdata fifo_mode = 2; | 1006 | static ushort __initdata fifo_mode = 2; |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 03d50909b078..5514c7ee85bd 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -562,7 +562,7 @@ extern void musb_hnp_stop(struct musb *musb); | |||
562 | extern int musb_platform_set_mode(struct musb *musb, u8 musb_mode); | 562 | extern int musb_platform_set_mode(struct musb *musb, u8 musb_mode); |
563 | 563 | ||
564 | #if defined(CONFIG_USB_TUSB6010) || defined(CONFIG_BLACKFIN) || \ | 564 | #if defined(CONFIG_USB_TUSB6010) || defined(CONFIG_BLACKFIN) || \ |
565 | defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP34XX) | 565 | defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) |
566 | extern void musb_platform_try_idle(struct musb *musb, unsigned long timeout); | 566 | extern void musb_platform_try_idle(struct musb *musb, unsigned long timeout); |
567 | #else | 567 | #else |
568 | #define musb_platform_try_idle(x, y) do {} while (0) | 568 | #define musb_platform_try_idle(x, y) do {} while (0) |
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index e5e6df39e737..aadc16b5eed7 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -134,14 +134,14 @@ static int slave_configure(struct scsi_device *sdev) | |||
134 | if (us->fflags & US_FL_MAX_SECTORS_MIN) | 134 | if (us->fflags & US_FL_MAX_SECTORS_MIN) |
135 | max_sectors = PAGE_CACHE_SIZE >> 9; | 135 | max_sectors = PAGE_CACHE_SIZE >> 9; |
136 | if (queue_max_sectors(sdev->request_queue) > max_sectors) | 136 | if (queue_max_sectors(sdev->request_queue) > max_sectors) |
137 | blk_queue_max_sectors(sdev->request_queue, | 137 | blk_queue_max_hw_sectors(sdev->request_queue, |
138 | max_sectors); | 138 | max_sectors); |
139 | } else if (sdev->type == TYPE_TAPE) { | 139 | } else if (sdev->type == TYPE_TAPE) { |
140 | /* Tapes need much higher max_sector limits, so just | 140 | /* Tapes need much higher max_sector limits, so just |
141 | * raise it to the maximum possible (4 GB / 512) and | 141 | * raise it to the maximum possible (4 GB / 512) and |
142 | * let the queue segment size sort out the real limit. | 142 | * let the queue segment size sort out the real limit. |
143 | */ | 143 | */ |
144 | blk_queue_max_sectors(sdev->request_queue, 0x7FFFFF); | 144 | blk_queue_max_hw_sectors(sdev->request_queue, 0x7FFFFF); |
145 | } | 145 | } |
146 | 146 | ||
147 | /* Some USB host controllers can't do DMA; they have to use PIO. | 147 | /* Some USB host controllers can't do DMA; they have to use PIO. |
@@ -495,7 +495,7 @@ static ssize_t store_max_sectors(struct device *dev, struct device_attribute *at | |||
495 | unsigned short ms; | 495 | unsigned short ms; |
496 | 496 | ||
497 | if (sscanf(buf, "%hu", &ms) > 0 && ms <= SCSI_DEFAULT_MAX_SECTORS) { | 497 | if (sscanf(buf, "%hu", &ms) > 0 && ms <= SCSI_DEFAULT_MAX_SECTORS) { |
498 | blk_queue_max_sectors(sdev->request_queue, ms); | 498 | blk_queue_max_hw_sectors(sdev->request_queue, ms); |
499 | return strlen(buf); | 499 | return strlen(buf); |
500 | } | 500 | } |
501 | return -EINVAL; | 501 | return -EINVAL; |
diff --git a/drivers/video/omap/lcd_ams_delta.c b/drivers/video/omap/lcd_ams_delta.c index 567db6ac32c8..6978ae4ef83a 100644 --- a/drivers/video/omap/lcd_ams_delta.c +++ b/drivers/video/omap/lcd_ams_delta.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/lcd.h> | ||
27 | 28 | ||
28 | #include <plat/board-ams-delta.h> | 29 | #include <plat/board-ams-delta.h> |
29 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
@@ -32,6 +33,71 @@ | |||
32 | 33 | ||
33 | #define AMS_DELTA_DEFAULT_CONTRAST 112 | 34 | #define AMS_DELTA_DEFAULT_CONTRAST 112 |
34 | 35 | ||
36 | #define AMS_DELTA_MAX_CONTRAST 0x00FF | ||
37 | #define AMS_DELTA_LCD_POWER 0x0100 | ||
38 | |||
39 | |||
40 | /* LCD class device section */ | ||
41 | |||
42 | static int ams_delta_lcd; | ||
43 | |||
44 | static int ams_delta_lcd_set_power(struct lcd_device *dev, int power) | ||
45 | { | ||
46 | if (power == FB_BLANK_UNBLANK) { | ||
47 | if (!(ams_delta_lcd & AMS_DELTA_LCD_POWER)) { | ||
48 | omap_writeb(ams_delta_lcd & AMS_DELTA_MAX_CONTRAST, | ||
49 | OMAP_PWL_ENABLE); | ||
50 | omap_writeb(1, OMAP_PWL_CLK_ENABLE); | ||
51 | ams_delta_lcd |= AMS_DELTA_LCD_POWER; | ||
52 | } | ||
53 | } else { | ||
54 | if (ams_delta_lcd & AMS_DELTA_LCD_POWER) { | ||
55 | omap_writeb(0, OMAP_PWL_ENABLE); | ||
56 | omap_writeb(0, OMAP_PWL_CLK_ENABLE); | ||
57 | ams_delta_lcd &= ~AMS_DELTA_LCD_POWER; | ||
58 | } | ||
59 | } | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | static int ams_delta_lcd_set_contrast(struct lcd_device *dev, int value) | ||
64 | { | ||
65 | if ((value >= 0) && (value <= AMS_DELTA_MAX_CONTRAST)) { | ||
66 | omap_writeb(value, OMAP_PWL_ENABLE); | ||
67 | ams_delta_lcd &= ~AMS_DELTA_MAX_CONTRAST; | ||
68 | ams_delta_lcd |= value; | ||
69 | } | ||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | #ifdef CONFIG_LCD_CLASS_DEVICE | ||
74 | static int ams_delta_lcd_get_power(struct lcd_device *dev) | ||
75 | { | ||
76 | if (ams_delta_lcd & AMS_DELTA_LCD_POWER) | ||
77 | return FB_BLANK_UNBLANK; | ||
78 | else | ||
79 | return FB_BLANK_POWERDOWN; | ||
80 | } | ||
81 | |||
82 | static int ams_delta_lcd_get_contrast(struct lcd_device *dev) | ||
83 | { | ||
84 | if (!(ams_delta_lcd & AMS_DELTA_LCD_POWER)) | ||
85 | return 0; | ||
86 | |||
87 | return ams_delta_lcd & AMS_DELTA_MAX_CONTRAST; | ||
88 | } | ||
89 | |||
90 | static struct lcd_ops ams_delta_lcd_ops = { | ||
91 | .get_power = ams_delta_lcd_get_power, | ||
92 | .set_power = ams_delta_lcd_set_power, | ||
93 | .get_contrast = ams_delta_lcd_get_contrast, | ||
94 | .set_contrast = ams_delta_lcd_set_contrast, | ||
95 | }; | ||
96 | #endif | ||
97 | |||
98 | |||
99 | /* omapfb panel section */ | ||
100 | |||
35 | static int ams_delta_panel_init(struct lcd_panel *panel, | 101 | static int ams_delta_panel_init(struct lcd_panel *panel, |
36 | struct omapfb_device *fbdev) | 102 | struct omapfb_device *fbdev) |
37 | { | 103 | { |
@@ -48,10 +114,6 @@ static int ams_delta_panel_enable(struct lcd_panel *panel) | |||
48 | AMS_DELTA_LATCH2_LCD_NDISP); | 114 | AMS_DELTA_LATCH2_LCD_NDISP); |
49 | ams_delta_latch2_write(AMS_DELTA_LATCH2_LCD_VBLEN, | 115 | ams_delta_latch2_write(AMS_DELTA_LATCH2_LCD_VBLEN, |
50 | AMS_DELTA_LATCH2_LCD_VBLEN); | 116 | AMS_DELTA_LATCH2_LCD_VBLEN); |
51 | |||
52 | omap_writeb(1, OMAP_PWL_CLK_ENABLE); | ||
53 | omap_writeb(AMS_DELTA_DEFAULT_CONTRAST, OMAP_PWL_ENABLE); | ||
54 | |||
55 | return 0; | 117 | return 0; |
56 | } | 118 | } |
57 | 119 | ||
@@ -91,8 +153,31 @@ static struct lcd_panel ams_delta_panel = { | |||
91 | .get_caps = ams_delta_panel_get_caps, | 153 | .get_caps = ams_delta_panel_get_caps, |
92 | }; | 154 | }; |
93 | 155 | ||
156 | |||
157 | /* platform driver section */ | ||
158 | |||
94 | static int ams_delta_panel_probe(struct platform_device *pdev) | 159 | static int ams_delta_panel_probe(struct platform_device *pdev) |
95 | { | 160 | { |
161 | struct lcd_device *lcd_device = NULL; | ||
162 | #ifdef CONFIG_LCD_CLASS_DEVICE | ||
163 | int ret; | ||
164 | |||
165 | lcd_device = lcd_device_register("omapfb", &pdev->dev, NULL, | ||
166 | &ams_delta_lcd_ops); | ||
167 | |||
168 | if (IS_ERR(lcd_device)) { | ||
169 | ret = PTR_ERR(lcd_device); | ||
170 | dev_err(&pdev->dev, "failed to register device\n"); | ||
171 | return ret; | ||
172 | } | ||
173 | |||
174 | platform_set_drvdata(pdev, lcd_device); | ||
175 | lcd_device->props.max_contrast = AMS_DELTA_MAX_CONTRAST; | ||
176 | #endif | ||
177 | |||
178 | ams_delta_lcd_set_contrast(lcd_device, AMS_DELTA_DEFAULT_CONTRAST); | ||
179 | ams_delta_lcd_set_power(lcd_device, FB_BLANK_UNBLANK); | ||
180 | |||
96 | omapfb_register_panel(&ams_delta_panel); | 181 | omapfb_register_panel(&ams_delta_panel); |
97 | return 0; | 182 | return 0; |
98 | } | 183 | } |
diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c index 2c4f470fa086..8ce60e1b220a 100644 --- a/drivers/video/omap/omapfb_main.c +++ b/drivers/video/omap/omapfb_main.c | |||
@@ -486,10 +486,11 @@ static int set_color_mode(struct omapfb_plane_struct *plane, | |||
486 | return 0; | 486 | return 0; |
487 | case 12: | 487 | case 12: |
488 | var->bits_per_pixel = 16; | 488 | var->bits_per_pixel = 16; |
489 | plane->color_mode = OMAPFB_COLOR_RGB444; | ||
490 | return 0; | ||
491 | case 16: | 489 | case 16: |
492 | plane->color_mode = OMAPFB_COLOR_RGB565; | 490 | if (plane->fbdev->panel->bpp == 12) |
491 | plane->color_mode = OMAPFB_COLOR_RGB444; | ||
492 | else | ||
493 | plane->color_mode = OMAPFB_COLOR_RGB565; | ||
493 | return 0; | 494 | return 0; |
494 | default: | 495 | default: |
495 | return -EINVAL; | 496 | return -EINVAL; |
diff --git a/drivers/video/omap2/displays/Kconfig b/drivers/video/omap2/displays/Kconfig index b12a59c9c50a..dfb57ee50861 100644 --- a/drivers/video/omap2/displays/Kconfig +++ b/drivers/video/omap2/displays/Kconfig | |||
@@ -13,10 +13,28 @@ config PANEL_SHARP_LS037V7DW01 | |||
13 | help | 13 | help |
14 | LCD Panel used in TI's SDP3430 and EVM boards | 14 | LCD Panel used in TI's SDP3430 and EVM boards |
15 | 15 | ||
16 | config PANEL_SHARP_LQ043T1DG01 | ||
17 | tristate "Sharp LQ043T1DG01 LCD Panel" | ||
18 | depends on OMAP2_DSS | ||
19 | help | ||
20 | LCD Panel used in TI's OMAP3517 EVM boards | ||
21 | |||
16 | config PANEL_TAAL | 22 | config PANEL_TAAL |
17 | tristate "Taal DSI Panel" | 23 | tristate "Taal DSI Panel" |
18 | depends on OMAP2_DSS_DSI | 24 | depends on OMAP2_DSS_DSI |
19 | help | 25 | help |
20 | Taal DSI command mode panel from TPO. | 26 | Taal DSI command mode panel from TPO. |
21 | 27 | ||
28 | config PANEL_TOPPOLY_TDO35S | ||
29 | tristate "Toppoly TDO35S LCD Panel support" | ||
30 | depends on OMAP2_DSS | ||
31 | help | ||
32 | LCD Panel used in CM-T35 | ||
33 | |||
34 | config PANEL_TPO_TD043MTEA1 | ||
35 | tristate "TPO TD043MTEA1 LCD Panel" | ||
36 | depends on OMAP2_DSS && I2C | ||
37 | help | ||
38 | LCD Panel used in OMAP3 Pandora | ||
39 | |||
22 | endmenu | 40 | endmenu |
diff --git a/drivers/video/omap2/displays/Makefile b/drivers/video/omap2/displays/Makefile index 955646440b3a..e2bb32168dee 100644 --- a/drivers/video/omap2/displays/Makefile +++ b/drivers/video/omap2/displays/Makefile | |||
@@ -1,4 +1,7 @@ | |||
1 | obj-$(CONFIG_PANEL_GENERIC) += panel-generic.o | 1 | obj-$(CONFIG_PANEL_GENERIC) += panel-generic.o |
2 | obj-$(CONFIG_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o | 2 | obj-$(CONFIG_PANEL_SHARP_LS037V7DW01) += panel-sharp-ls037v7dw01.o |
3 | obj-$(CONFIG_PANEL_SHARP_LQ043T1DG01) += panel-sharp-lq043t1dg01.o | ||
3 | 4 | ||
4 | obj-$(CONFIG_PANEL_TAAL) += panel-taal.o | 5 | obj-$(CONFIG_PANEL_TAAL) += panel-taal.o |
6 | obj-$(CONFIG_PANEL_TOPPOLY_TDO35S) += panel-toppoly-tdo35s.o | ||
7 | obj-$(CONFIG_PANEL_TPO_TD043MTEA1) += panel-tpo-td043mtea1.o | ||
diff --git a/drivers/video/omap2/displays/panel-generic.c b/drivers/video/omap2/displays/panel-generic.c index eb48d1afd800..c59e4baed8b2 100644 --- a/drivers/video/omap2/displays/panel-generic.c +++ b/drivers/video/omap2/displays/panel-generic.c | |||
@@ -35,6 +35,35 @@ static struct omap_video_timings generic_panel_timings = { | |||
35 | .vbp = 7, | 35 | .vbp = 7, |
36 | }; | 36 | }; |
37 | 37 | ||
38 | static int generic_panel_power_on(struct omap_dss_device *dssdev) | ||
39 | { | ||
40 | int r; | ||
41 | |||
42 | r = omapdss_dpi_display_enable(dssdev); | ||
43 | if (r) | ||
44 | goto err0; | ||
45 | |||
46 | if (dssdev->platform_enable) { | ||
47 | r = dssdev->platform_enable(dssdev); | ||
48 | if (r) | ||
49 | goto err1; | ||
50 | } | ||
51 | |||
52 | return 0; | ||
53 | err1: | ||
54 | omapdss_dpi_display_disable(dssdev); | ||
55 | err0: | ||
56 | return r; | ||
57 | } | ||
58 | |||
59 | static void generic_panel_power_off(struct omap_dss_device *dssdev) | ||
60 | { | ||
61 | if (dssdev->platform_disable) | ||
62 | dssdev->platform_disable(dssdev); | ||
63 | |||
64 | omapdss_dpi_display_disable(dssdev); | ||
65 | } | ||
66 | |||
38 | static int generic_panel_probe(struct omap_dss_device *dssdev) | 67 | static int generic_panel_probe(struct omap_dss_device *dssdev) |
39 | { | 68 | { |
40 | dssdev->panel.config = OMAP_DSS_LCD_TFT; | 69 | dssdev->panel.config = OMAP_DSS_LCD_TFT; |
@@ -51,27 +80,40 @@ static int generic_panel_enable(struct omap_dss_device *dssdev) | |||
51 | { | 80 | { |
52 | int r = 0; | 81 | int r = 0; |
53 | 82 | ||
54 | if (dssdev->platform_enable) | 83 | r = generic_panel_power_on(dssdev); |
55 | r = dssdev->platform_enable(dssdev); | 84 | if (r) |
85 | return r; | ||
56 | 86 | ||
57 | return r; | 87 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; |
88 | |||
89 | return 0; | ||
58 | } | 90 | } |
59 | 91 | ||
60 | static void generic_panel_disable(struct omap_dss_device *dssdev) | 92 | static void generic_panel_disable(struct omap_dss_device *dssdev) |
61 | { | 93 | { |
62 | if (dssdev->platform_disable) | 94 | generic_panel_power_off(dssdev); |
63 | dssdev->platform_disable(dssdev); | 95 | |
96 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
64 | } | 97 | } |
65 | 98 | ||
66 | static int generic_panel_suspend(struct omap_dss_device *dssdev) | 99 | static int generic_panel_suspend(struct omap_dss_device *dssdev) |
67 | { | 100 | { |
68 | generic_panel_disable(dssdev); | 101 | generic_panel_power_off(dssdev); |
102 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
69 | return 0; | 103 | return 0; |
70 | } | 104 | } |
71 | 105 | ||
72 | static int generic_panel_resume(struct omap_dss_device *dssdev) | 106 | static int generic_panel_resume(struct omap_dss_device *dssdev) |
73 | { | 107 | { |
74 | return generic_panel_enable(dssdev); | 108 | int r = 0; |
109 | |||
110 | r = generic_panel_power_on(dssdev); | ||
111 | if (r) | ||
112 | return r; | ||
113 | |||
114 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
115 | |||
116 | return 0; | ||
75 | } | 117 | } |
76 | 118 | ||
77 | static struct omap_dss_driver generic_driver = { | 119 | static struct omap_dss_driver generic_driver = { |
diff --git a/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c b/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c new file mode 100644 index 000000000000..10267461991c --- /dev/null +++ b/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c | |||
@@ -0,0 +1,159 @@ | |||
1 | /* | ||
2 | * LCD panel driver for Sharp LQ043T1DG01 | ||
3 | * | ||
4 | * Copyright (C) 2009 Texas Instruments Inc | ||
5 | * Author: Vaibhav Hiremath <hvaibhav@ti.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published by | ||
9 | * the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
14 | * more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along with | ||
17 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
18 | */ | ||
19 | |||
20 | #include <linux/module.h> | ||
21 | #include <linux/delay.h> | ||
22 | #include <linux/device.h> | ||
23 | #include <linux/err.h> | ||
24 | |||
25 | #include <plat/display.h> | ||
26 | |||
27 | static struct omap_video_timings sharp_lq_timings = { | ||
28 | .x_res = 480, | ||
29 | .y_res = 272, | ||
30 | |||
31 | .pixel_clock = 9000, | ||
32 | |||
33 | .hsw = 42, | ||
34 | .hfp = 3, | ||
35 | .hbp = 2, | ||
36 | |||
37 | .vsw = 11, | ||
38 | .vfp = 3, | ||
39 | .vbp = 2, | ||
40 | }; | ||
41 | |||
42 | static int sharp_lq_panel_power_on(struct omap_dss_device *dssdev) | ||
43 | { | ||
44 | int r; | ||
45 | |||
46 | r = omapdss_dpi_display_enable(dssdev); | ||
47 | if (r) | ||
48 | goto err0; | ||
49 | |||
50 | /* wait couple of vsyncs until enabling the LCD */ | ||
51 | msleep(50); | ||
52 | |||
53 | if (dssdev->platform_enable) { | ||
54 | r = dssdev->platform_enable(dssdev); | ||
55 | if (r) | ||
56 | goto err1; | ||
57 | } | ||
58 | |||
59 | return 0; | ||
60 | err1: | ||
61 | omapdss_dpi_display_disable(dssdev); | ||
62 | err0: | ||
63 | return r; | ||
64 | } | ||
65 | |||
66 | static void sharp_lq_panel_power_off(struct omap_dss_device *dssdev) | ||
67 | { | ||
68 | if (dssdev->platform_disable) | ||
69 | dssdev->platform_disable(dssdev); | ||
70 | |||
71 | /* wait at least 5 vsyncs after disabling the LCD */ | ||
72 | msleep(100); | ||
73 | |||
74 | omapdss_dpi_display_disable(dssdev); | ||
75 | } | ||
76 | |||
77 | static int sharp_lq_panel_probe(struct omap_dss_device *dssdev) | ||
78 | { | ||
79 | |||
80 | dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | | ||
81 | OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IEO; | ||
82 | dssdev->panel.acb = 0x0; | ||
83 | dssdev->panel.timings = sharp_lq_timings; | ||
84 | |||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | static void sharp_lq_panel_remove(struct omap_dss_device *dssdev) | ||
89 | { | ||
90 | } | ||
91 | |||
92 | static int sharp_lq_panel_enable(struct omap_dss_device *dssdev) | ||
93 | { | ||
94 | int r = 0; | ||
95 | |||
96 | r = sharp_lq_panel_power_on(dssdev); | ||
97 | if (r) | ||
98 | return r; | ||
99 | |||
100 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
101 | |||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | static void sharp_lq_panel_disable(struct omap_dss_device *dssdev) | ||
106 | { | ||
107 | sharp_lq_panel_power_off(dssdev); | ||
108 | |||
109 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
110 | } | ||
111 | |||
112 | static int sharp_lq_panel_suspend(struct omap_dss_device *dssdev) | ||
113 | { | ||
114 | sharp_lq_panel_power_off(dssdev); | ||
115 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | static int sharp_lq_panel_resume(struct omap_dss_device *dssdev) | ||
120 | { | ||
121 | int r = 0; | ||
122 | |||
123 | r = sharp_lq_panel_power_on(dssdev); | ||
124 | if (r) | ||
125 | return r; | ||
126 | |||
127 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
128 | |||
129 | return 0; | ||
130 | } | ||
131 | |||
132 | static struct omap_dss_driver sharp_lq_driver = { | ||
133 | .probe = sharp_lq_panel_probe, | ||
134 | .remove = sharp_lq_panel_remove, | ||
135 | |||
136 | .enable = sharp_lq_panel_enable, | ||
137 | .disable = sharp_lq_panel_disable, | ||
138 | .suspend = sharp_lq_panel_suspend, | ||
139 | .resume = sharp_lq_panel_resume, | ||
140 | |||
141 | .driver = { | ||
142 | .name = "sharp_lq_panel", | ||
143 | .owner = THIS_MODULE, | ||
144 | }, | ||
145 | }; | ||
146 | |||
147 | static int __init sharp_lq_panel_drv_init(void) | ||
148 | { | ||
149 | return omap_dss_register_driver(&sharp_lq_driver); | ||
150 | } | ||
151 | |||
152 | static void __exit sharp_lq_panel_drv_exit(void) | ||
153 | { | ||
154 | omap_dss_unregister_driver(&sharp_lq_driver); | ||
155 | } | ||
156 | |||
157 | module_init(sharp_lq_panel_drv_init); | ||
158 | module_exit(sharp_lq_panel_drv_exit); | ||
159 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c index bbe880bbe795..8d51a5e6341c 100644 --- a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c +++ b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c | |||
@@ -20,19 +20,10 @@ | |||
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
22 | #include <linux/device.h> | 22 | #include <linux/device.h> |
23 | #include <linux/regulator/consumer.h> | ||
24 | #include <linux/err.h> | 23 | #include <linux/err.h> |
25 | 24 | ||
26 | #include <plat/display.h> | 25 | #include <plat/display.h> |
27 | 26 | ||
28 | struct sharp_data { | ||
29 | /* XXX This regulator should actually be in SDP board file, not here, | ||
30 | * as it doesn't actually power the LCD, but something else that | ||
31 | * affects the output to LCD (I think. Somebody clarify). It doesn't do | ||
32 | * harm here, as SDP is the only board using this currently */ | ||
33 | struct regulator *vdvi_reg; | ||
34 | }; | ||
35 | |||
36 | static struct omap_video_timings sharp_ls_timings = { | 27 | static struct omap_video_timings sharp_ls_timings = { |
37 | .x_res = 480, | 28 | .x_res = 480, |
38 | .y_res = 640, | 29 | .y_res = 640, |
@@ -50,77 +41,81 @@ static struct omap_video_timings sharp_ls_timings = { | |||
50 | 41 | ||
51 | static int sharp_ls_panel_probe(struct omap_dss_device *dssdev) | 42 | static int sharp_ls_panel_probe(struct omap_dss_device *dssdev) |
52 | { | 43 | { |
53 | struct sharp_data *sd; | ||
54 | |||
55 | dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | | 44 | dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | |
56 | OMAP_DSS_LCD_IHS; | 45 | OMAP_DSS_LCD_IHS; |
57 | dssdev->panel.acb = 0x28; | 46 | dssdev->panel.acb = 0x28; |
58 | dssdev->panel.timings = sharp_ls_timings; | 47 | dssdev->panel.timings = sharp_ls_timings; |
59 | 48 | ||
60 | sd = kzalloc(sizeof(*sd), GFP_KERNEL); | ||
61 | if (!sd) | ||
62 | return -ENOMEM; | ||
63 | |||
64 | dev_set_drvdata(&dssdev->dev, sd); | ||
65 | |||
66 | sd->vdvi_reg = regulator_get(&dssdev->dev, "vdvi"); | ||
67 | if (IS_ERR(sd->vdvi_reg)) { | ||
68 | kfree(sd); | ||
69 | pr_err("failed to get VDVI regulator\n"); | ||
70 | return PTR_ERR(sd->vdvi_reg); | ||
71 | } | ||
72 | |||
73 | return 0; | 49 | return 0; |
74 | } | 50 | } |
75 | 51 | ||
76 | static void sharp_ls_panel_remove(struct omap_dss_device *dssdev) | 52 | static void sharp_ls_panel_remove(struct omap_dss_device *dssdev) |
77 | { | 53 | { |
78 | struct sharp_data *sd = dev_get_drvdata(&dssdev->dev); | ||
79 | |||
80 | regulator_put(sd->vdvi_reg); | ||
81 | |||
82 | kfree(sd); | ||
83 | } | 54 | } |
84 | 55 | ||
85 | static int sharp_ls_panel_enable(struct omap_dss_device *dssdev) | 56 | static int sharp_ls_power_on(struct omap_dss_device *dssdev) |
86 | { | 57 | { |
87 | struct sharp_data *sd = dev_get_drvdata(&dssdev->dev); | ||
88 | int r = 0; | 58 | int r = 0; |
89 | 59 | ||
60 | r = omapdss_dpi_display_enable(dssdev); | ||
61 | if (r) | ||
62 | goto err0; | ||
63 | |||
90 | /* wait couple of vsyncs until enabling the LCD */ | 64 | /* wait couple of vsyncs until enabling the LCD */ |
91 | msleep(50); | 65 | msleep(50); |
92 | 66 | ||
93 | regulator_enable(sd->vdvi_reg); | 67 | if (dssdev->platform_enable) { |
94 | |||
95 | if (dssdev->platform_enable) | ||
96 | r = dssdev->platform_enable(dssdev); | 68 | r = dssdev->platform_enable(dssdev); |
69 | if (r) | ||
70 | goto err1; | ||
71 | } | ||
97 | 72 | ||
73 | return 0; | ||
74 | err1: | ||
75 | omapdss_dpi_display_disable(dssdev); | ||
76 | err0: | ||
98 | return r; | 77 | return r; |
99 | } | 78 | } |
100 | 79 | ||
101 | static void sharp_ls_panel_disable(struct omap_dss_device *dssdev) | 80 | static void sharp_ls_power_off(struct omap_dss_device *dssdev) |
102 | { | 81 | { |
103 | struct sharp_data *sd = dev_get_drvdata(&dssdev->dev); | ||
104 | |||
105 | if (dssdev->platform_disable) | 82 | if (dssdev->platform_disable) |
106 | dssdev->platform_disable(dssdev); | 83 | dssdev->platform_disable(dssdev); |
107 | 84 | ||
108 | regulator_disable(sd->vdvi_reg); | ||
109 | |||
110 | /* wait at least 5 vsyncs after disabling the LCD */ | 85 | /* wait at least 5 vsyncs after disabling the LCD */ |
111 | 86 | ||
112 | msleep(100); | 87 | msleep(100); |
88 | |||
89 | omapdss_dpi_display_disable(dssdev); | ||
90 | } | ||
91 | |||
92 | static int sharp_ls_panel_enable(struct omap_dss_device *dssdev) | ||
93 | { | ||
94 | int r; | ||
95 | r = sharp_ls_power_on(dssdev); | ||
96 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
97 | return r; | ||
98 | } | ||
99 | |||
100 | static void sharp_ls_panel_disable(struct omap_dss_device *dssdev) | ||
101 | { | ||
102 | sharp_ls_power_off(dssdev); | ||
103 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
113 | } | 104 | } |
114 | 105 | ||
115 | static int sharp_ls_panel_suspend(struct omap_dss_device *dssdev) | 106 | static int sharp_ls_panel_suspend(struct omap_dss_device *dssdev) |
116 | { | 107 | { |
117 | sharp_ls_panel_disable(dssdev); | 108 | sharp_ls_power_off(dssdev); |
109 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
118 | return 0; | 110 | return 0; |
119 | } | 111 | } |
120 | 112 | ||
121 | static int sharp_ls_panel_resume(struct omap_dss_device *dssdev) | 113 | static int sharp_ls_panel_resume(struct omap_dss_device *dssdev) |
122 | { | 114 | { |
123 | return sharp_ls_panel_enable(dssdev); | 115 | int r; |
116 | r = sharp_ls_power_on(dssdev); | ||
117 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
118 | return r; | ||
124 | } | 119 | } |
125 | 120 | ||
126 | static struct omap_dss_driver sharp_ls_driver = { | 121 | static struct omap_dss_driver sharp_ls_driver = { |
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c index 1f01dfc5e52e..fcd6a61a91eb 100644 --- a/drivers/video/omap2/displays/panel-taal.c +++ b/drivers/video/omap2/displays/panel-taal.c | |||
@@ -63,6 +63,8 @@ | |||
63 | /* #define TAAL_USE_ESD_CHECK */ | 63 | /* #define TAAL_USE_ESD_CHECK */ |
64 | #define TAAL_ESD_CHECK_PERIOD msecs_to_jiffies(5000) | 64 | #define TAAL_ESD_CHECK_PERIOD msecs_to_jiffies(5000) |
65 | 65 | ||
66 | static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable); | ||
67 | |||
66 | struct taal_data { | 68 | struct taal_data { |
67 | struct backlight_device *bldev; | 69 | struct backlight_device *bldev; |
68 | 70 | ||
@@ -510,15 +512,12 @@ static int taal_probe(struct omap_dss_device *dssdev) | |||
510 | if (td->esd_wq == NULL) { | 512 | if (td->esd_wq == NULL) { |
511 | dev_err(&dssdev->dev, "can't create ESD workqueue\n"); | 513 | dev_err(&dssdev->dev, "can't create ESD workqueue\n"); |
512 | r = -ENOMEM; | 514 | r = -ENOMEM; |
513 | goto err2; | 515 | goto err1; |
514 | } | 516 | } |
515 | INIT_DELAYED_WORK_DEFERRABLE(&td->esd_work, taal_esd_work); | 517 | INIT_DELAYED_WORK_DEFERRABLE(&td->esd_work, taal_esd_work); |
516 | 518 | ||
517 | dev_set_drvdata(&dssdev->dev, td); | 519 | dev_set_drvdata(&dssdev->dev, td); |
518 | 520 | ||
519 | dssdev->get_timings = taal_get_timings; | ||
520 | dssdev->get_resolution = taal_get_resolution; | ||
521 | |||
522 | /* if no platform set_backlight() defined, presume DSI backlight | 521 | /* if no platform set_backlight() defined, presume DSI backlight |
523 | * control */ | 522 | * control */ |
524 | if (!dssdev->set_backlight) | 523 | if (!dssdev->set_backlight) |
@@ -528,7 +527,7 @@ static int taal_probe(struct omap_dss_device *dssdev) | |||
528 | &taal_bl_ops); | 527 | &taal_bl_ops); |
529 | if (IS_ERR(bldev)) { | 528 | if (IS_ERR(bldev)) { |
530 | r = PTR_ERR(bldev); | 529 | r = PTR_ERR(bldev); |
531 | goto err1; | 530 | goto err2; |
532 | } | 531 | } |
533 | 532 | ||
534 | td->bldev = bldev; | 533 | td->bldev = bldev; |
@@ -621,14 +620,12 @@ static void taal_remove(struct omap_dss_device *dssdev) | |||
621 | kfree(td); | 620 | kfree(td); |
622 | } | 621 | } |
623 | 622 | ||
624 | static int taal_enable(struct omap_dss_device *dssdev) | 623 | static int taal_power_on(struct omap_dss_device *dssdev) |
625 | { | 624 | { |
626 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | 625 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); |
627 | u8 id1, id2, id3; | 626 | u8 id1, id2, id3; |
628 | int r; | 627 | int r; |
629 | 628 | ||
630 | dev_dbg(&dssdev->dev, "enable\n"); | ||
631 | |||
632 | if (dssdev->platform_enable) { | 629 | if (dssdev->platform_enable) { |
633 | r = dssdev->platform_enable(dssdev); | 630 | r = dssdev->platform_enable(dssdev); |
634 | if (r) | 631 | if (r) |
@@ -638,6 +635,16 @@ static int taal_enable(struct omap_dss_device *dssdev) | |||
638 | /* it seems we have to wait a bit until taal is ready */ | 635 | /* it seems we have to wait a bit until taal is ready */ |
639 | msleep(5); | 636 | msleep(5); |
640 | 637 | ||
638 | dsi_bus_lock(); | ||
639 | |||
640 | r = omapdss_dsi_display_enable(dssdev); | ||
641 | if (r) { | ||
642 | dev_err(&dssdev->dev, "failed to enable DSI\n"); | ||
643 | goto err0; | ||
644 | } | ||
645 | |||
646 | omapdss_dsi_vc_enable_hs(TCH, false); | ||
647 | |||
641 | r = taal_sleep_out(td); | 648 | r = taal_sleep_out(td); |
642 | if (r) | 649 | if (r) |
643 | goto err; | 650 | goto err; |
@@ -661,6 +668,10 @@ static int taal_enable(struct omap_dss_device *dssdev) | |||
661 | 668 | ||
662 | taal_dcs_write_0(DCS_DISPLAY_ON); | 669 | taal_dcs_write_0(DCS_DISPLAY_ON); |
663 | 670 | ||
671 | r = _taal_enable_te(dssdev, td->te_enabled); | ||
672 | if (r) | ||
673 | goto err; | ||
674 | |||
664 | #ifdef TAAL_USE_ESD_CHECK | 675 | #ifdef TAAL_USE_ESD_CHECK |
665 | queue_delayed_work(td->esd_wq, &td->esd_work, TAAL_ESD_CHECK_PERIOD); | 676 | queue_delayed_work(td->esd_wq, &td->esd_work, TAAL_ESD_CHECK_PERIOD); |
666 | #endif | 677 | #endif |
@@ -676,19 +687,27 @@ static int taal_enable(struct omap_dss_device *dssdev) | |||
676 | td->intro_printed = true; | 687 | td->intro_printed = true; |
677 | } | 688 | } |
678 | 689 | ||
690 | omapdss_dsi_vc_enable_hs(TCH, true); | ||
691 | |||
692 | dsi_bus_unlock(); | ||
693 | |||
679 | return 0; | 694 | return 0; |
680 | err: | 695 | err: |
696 | dsi_bus_unlock(); | ||
697 | |||
698 | omapdss_dsi_display_disable(dssdev); | ||
699 | err0: | ||
681 | if (dssdev->platform_disable) | 700 | if (dssdev->platform_disable) |
682 | dssdev->platform_disable(dssdev); | 701 | dssdev->platform_disable(dssdev); |
683 | 702 | ||
684 | return r; | 703 | return r; |
685 | } | 704 | } |
686 | 705 | ||
687 | static void taal_disable(struct omap_dss_device *dssdev) | 706 | static void taal_power_off(struct omap_dss_device *dssdev) |
688 | { | 707 | { |
689 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | 708 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); |
690 | 709 | ||
691 | dev_dbg(&dssdev->dev, "disable\n"); | 710 | dsi_bus_lock(); |
692 | 711 | ||
693 | cancel_delayed_work(&td->esd_work); | 712 | cancel_delayed_work(&td->esd_work); |
694 | 713 | ||
@@ -698,41 +717,124 @@ static void taal_disable(struct omap_dss_device *dssdev) | |||
698 | /* wait a bit so that the message goes through */ | 717 | /* wait a bit so that the message goes through */ |
699 | msleep(10); | 718 | msleep(10); |
700 | 719 | ||
720 | omapdss_dsi_display_disable(dssdev); | ||
721 | |||
701 | if (dssdev->platform_disable) | 722 | if (dssdev->platform_disable) |
702 | dssdev->platform_disable(dssdev); | 723 | dssdev->platform_disable(dssdev); |
703 | 724 | ||
704 | td->enabled = 0; | 725 | td->enabled = 0; |
726 | |||
727 | dsi_bus_unlock(); | ||
728 | } | ||
729 | |||
730 | static int taal_enable(struct omap_dss_device *dssdev) | ||
731 | { | ||
732 | int r; | ||
733 | dev_dbg(&dssdev->dev, "enable\n"); | ||
734 | |||
735 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) | ||
736 | return -EINVAL; | ||
737 | |||
738 | r = taal_power_on(dssdev); | ||
739 | if (r) | ||
740 | return r; | ||
741 | |||
742 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
743 | |||
744 | return r; | ||
745 | } | ||
746 | |||
747 | static void taal_disable(struct omap_dss_device *dssdev) | ||
748 | { | ||
749 | dev_dbg(&dssdev->dev, "disable\n"); | ||
750 | |||
751 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) | ||
752 | taal_power_off(dssdev); | ||
753 | |||
754 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
705 | } | 755 | } |
706 | 756 | ||
707 | static int taal_suspend(struct omap_dss_device *dssdev) | 757 | static int taal_suspend(struct omap_dss_device *dssdev) |
708 | { | 758 | { |
709 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | 759 | dev_dbg(&dssdev->dev, "suspend\n"); |
710 | struct backlight_device *bldev = td->bldev; | ||
711 | 760 | ||
712 | bldev->props.power = FB_BLANK_POWERDOWN; | 761 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) |
713 | taal_bl_update_status(bldev); | 762 | return -EINVAL; |
763 | |||
764 | taal_power_off(dssdev); | ||
765 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
714 | 766 | ||
715 | return 0; | 767 | return 0; |
716 | } | 768 | } |
717 | 769 | ||
718 | static int taal_resume(struct omap_dss_device *dssdev) | 770 | static int taal_resume(struct omap_dss_device *dssdev) |
719 | { | 771 | { |
772 | int r; | ||
773 | dev_dbg(&dssdev->dev, "resume\n"); | ||
774 | |||
775 | if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) | ||
776 | return -EINVAL; | ||
777 | |||
778 | r = taal_power_on(dssdev); | ||
779 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
780 | return r; | ||
781 | } | ||
782 | |||
783 | static void taal_framedone_cb(int err, void *data) | ||
784 | { | ||
785 | struct omap_dss_device *dssdev = data; | ||
786 | dev_dbg(&dssdev->dev, "framedone, err %d\n", err); | ||
787 | dsi_bus_unlock(); | ||
788 | } | ||
789 | |||
790 | static int taal_update(struct omap_dss_device *dssdev, | ||
791 | u16 x, u16 y, u16 w, u16 h) | ||
792 | { | ||
720 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | 793 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); |
721 | struct backlight_device *bldev = td->bldev; | 794 | int r; |
722 | 795 | ||
723 | bldev->props.power = FB_BLANK_UNBLANK; | 796 | dev_dbg(&dssdev->dev, "update %d, %d, %d x %d\n", x, y, w, h); |
724 | taal_bl_update_status(bldev); | 797 | |
798 | dsi_bus_lock(); | ||
799 | |||
800 | if (!td->enabled) { | ||
801 | r = 0; | ||
802 | goto err; | ||
803 | } | ||
804 | |||
805 | r = omap_dsi_prepare_update(dssdev, &x, &y, &w, &h); | ||
806 | if (r) | ||
807 | goto err; | ||
808 | |||
809 | r = taal_set_update_window(x, y, w, h); | ||
810 | if (r) | ||
811 | goto err; | ||
812 | |||
813 | r = omap_dsi_update(dssdev, TCH, x, y, w, h, | ||
814 | taal_framedone_cb, dssdev); | ||
815 | if (r) | ||
816 | goto err; | ||
725 | 817 | ||
818 | /* note: no bus_unlock here. unlock is in framedone_cb */ | ||
726 | return 0; | 819 | return 0; |
820 | err: | ||
821 | dsi_bus_unlock(); | ||
822 | return r; | ||
727 | } | 823 | } |
728 | 824 | ||
729 | static void taal_setup_update(struct omap_dss_device *dssdev, | 825 | static int taal_sync(struct omap_dss_device *dssdev) |
730 | u16 x, u16 y, u16 w, u16 h) | ||
731 | { | 826 | { |
732 | taal_set_update_window(x, y, w, h); | 827 | dev_dbg(&dssdev->dev, "sync\n"); |
828 | |||
829 | dsi_bus_lock(); | ||
830 | dsi_bus_unlock(); | ||
831 | |||
832 | dev_dbg(&dssdev->dev, "sync done\n"); | ||
833 | |||
834 | return 0; | ||
733 | } | 835 | } |
734 | 836 | ||
735 | static int taal_enable_te(struct omap_dss_device *dssdev, bool enable) | 837 | static int _taal_enable_te(struct omap_dss_device *dssdev, bool enable) |
736 | { | 838 | { |
737 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | 839 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); |
738 | int r; | 840 | int r; |
@@ -744,25 +846,32 @@ static int taal_enable_te(struct omap_dss_device *dssdev, bool enable) | |||
744 | else | 846 | else |
745 | r = taal_dcs_write_0(DCS_TEAR_OFF); | 847 | r = taal_dcs_write_0(DCS_TEAR_OFF); |
746 | 848 | ||
849 | omapdss_dsi_enable_te(dssdev, enable); | ||
850 | |||
851 | /* XXX for some reason, DSI TE breaks if we don't wait here. | ||
852 | * Panel bug? Needs more studying */ | ||
853 | msleep(100); | ||
854 | |||
747 | return r; | 855 | return r; |
748 | } | 856 | } |
749 | 857 | ||
750 | static int taal_wait_te(struct omap_dss_device *dssdev) | 858 | static int taal_enable_te(struct omap_dss_device *dssdev, bool enable) |
751 | { | 859 | { |
752 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | 860 | int r; |
753 | long wait = msecs_to_jiffies(500); | ||
754 | 861 | ||
755 | if (!td->use_ext_te || !td->te_enabled) | 862 | dsi_bus_lock(); |
756 | return 0; | ||
757 | 863 | ||
758 | INIT_COMPLETION(td->te_completion); | 864 | r = _taal_enable_te(dssdev, enable); |
759 | wait = wait_for_completion_timeout(&td->te_completion, wait); | ||
760 | if (wait == 0) { | ||
761 | dev_err(&dssdev->dev, "timeout waiting TE\n"); | ||
762 | return -ETIME; | ||
763 | } | ||
764 | 865 | ||
765 | return 0; | 866 | dsi_bus_unlock(); |
867 | |||
868 | return r; | ||
869 | } | ||
870 | |||
871 | static int taal_get_te(struct omap_dss_device *dssdev) | ||
872 | { | ||
873 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | ||
874 | return td->te_enabled; | ||
766 | } | 875 | } |
767 | 876 | ||
768 | static int taal_rotate(struct omap_dss_device *dssdev, u8 rotate) | 877 | static int taal_rotate(struct omap_dss_device *dssdev, u8 rotate) |
@@ -772,16 +881,21 @@ static int taal_rotate(struct omap_dss_device *dssdev, u8 rotate) | |||
772 | 881 | ||
773 | dev_dbg(&dssdev->dev, "rotate %d\n", rotate); | 882 | dev_dbg(&dssdev->dev, "rotate %d\n", rotate); |
774 | 883 | ||
884 | dsi_bus_lock(); | ||
885 | |||
775 | if (td->enabled) { | 886 | if (td->enabled) { |
776 | r = taal_set_addr_mode(rotate, td->mirror); | 887 | r = taal_set_addr_mode(rotate, td->mirror); |
777 | |||
778 | if (r) | 888 | if (r) |
779 | return r; | 889 | goto err; |
780 | } | 890 | } |
781 | 891 | ||
782 | td->rotate = rotate; | 892 | td->rotate = rotate; |
783 | 893 | ||
894 | dsi_bus_unlock(); | ||
784 | return 0; | 895 | return 0; |
896 | err: | ||
897 | dsi_bus_unlock(); | ||
898 | return r; | ||
785 | } | 899 | } |
786 | 900 | ||
787 | static u8 taal_get_rotate(struct omap_dss_device *dssdev) | 901 | static u8 taal_get_rotate(struct omap_dss_device *dssdev) |
@@ -797,16 +911,20 @@ static int taal_mirror(struct omap_dss_device *dssdev, bool enable) | |||
797 | 911 | ||
798 | dev_dbg(&dssdev->dev, "mirror %d\n", enable); | 912 | dev_dbg(&dssdev->dev, "mirror %d\n", enable); |
799 | 913 | ||
914 | dsi_bus_lock(); | ||
800 | if (td->enabled) { | 915 | if (td->enabled) { |
801 | r = taal_set_addr_mode(td->rotate, enable); | 916 | r = taal_set_addr_mode(td->rotate, enable); |
802 | |||
803 | if (r) | 917 | if (r) |
804 | return r; | 918 | goto err; |
805 | } | 919 | } |
806 | 920 | ||
807 | td->mirror = enable; | 921 | td->mirror = enable; |
808 | 922 | ||
923 | dsi_bus_unlock(); | ||
809 | return 0; | 924 | return 0; |
925 | err: | ||
926 | dsi_bus_unlock(); | ||
927 | return r; | ||
810 | } | 928 | } |
811 | 929 | ||
812 | static bool taal_get_mirror(struct omap_dss_device *dssdev) | 930 | static bool taal_get_mirror(struct omap_dss_device *dssdev) |
@@ -820,17 +938,23 @@ static int taal_run_test(struct omap_dss_device *dssdev, int test_num) | |||
820 | u8 id1, id2, id3; | 938 | u8 id1, id2, id3; |
821 | int r; | 939 | int r; |
822 | 940 | ||
941 | dsi_bus_lock(); | ||
942 | |||
823 | r = taal_dcs_read_1(DCS_GET_ID1, &id1); | 943 | r = taal_dcs_read_1(DCS_GET_ID1, &id1); |
824 | if (r) | 944 | if (r) |
825 | return r; | 945 | goto err; |
826 | r = taal_dcs_read_1(DCS_GET_ID2, &id2); | 946 | r = taal_dcs_read_1(DCS_GET_ID2, &id2); |
827 | if (r) | 947 | if (r) |
828 | return r; | 948 | goto err; |
829 | r = taal_dcs_read_1(DCS_GET_ID3, &id3); | 949 | r = taal_dcs_read_1(DCS_GET_ID3, &id3); |
830 | if (r) | 950 | if (r) |
831 | return r; | 951 | goto err; |
832 | 952 | ||
953 | dsi_bus_unlock(); | ||
833 | return 0; | 954 | return 0; |
955 | err: | ||
956 | dsi_bus_unlock(); | ||
957 | return r; | ||
834 | } | 958 | } |
835 | 959 | ||
836 | static int taal_memory_read(struct omap_dss_device *dssdev, | 960 | static int taal_memory_read(struct omap_dss_device *dssdev, |
@@ -841,6 +965,10 @@ static int taal_memory_read(struct omap_dss_device *dssdev, | |||
841 | int first = 1; | 965 | int first = 1; |
842 | int plen; | 966 | int plen; |
843 | unsigned buf_used = 0; | 967 | unsigned buf_used = 0; |
968 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | ||
969 | |||
970 | if (!td->enabled) | ||
971 | return -ENODEV; | ||
844 | 972 | ||
845 | if (size < w * h * 3) | 973 | if (size < w * h * 3) |
846 | return -ENOMEM; | 974 | return -ENOMEM; |
@@ -849,6 +977,8 @@ static int taal_memory_read(struct omap_dss_device *dssdev, | |||
849 | dssdev->panel.timings.x_res * | 977 | dssdev->panel.timings.x_res * |
850 | dssdev->panel.timings.y_res * 3); | 978 | dssdev->panel.timings.y_res * 3); |
851 | 979 | ||
980 | dsi_bus_lock(); | ||
981 | |||
852 | /* plen 1 or 2 goes into short packet. until checksum error is fixed, | 982 | /* plen 1 or 2 goes into short packet. until checksum error is fixed, |
853 | * use short packets. plen 32 works, but bigger packets seem to cause | 983 | * use short packets. plen 32 works, but bigger packets seem to cause |
854 | * an error. */ | 984 | * an error. */ |
@@ -857,11 +987,11 @@ static int taal_memory_read(struct omap_dss_device *dssdev, | |||
857 | else | 987 | else |
858 | plen = 2; | 988 | plen = 2; |
859 | 989 | ||
860 | taal_setup_update(dssdev, x, y, w, h); | 990 | taal_set_update_window(x, y, w, h); |
861 | 991 | ||
862 | r = dsi_vc_set_max_rx_packet_size(TCH, plen); | 992 | r = dsi_vc_set_max_rx_packet_size(TCH, plen); |
863 | if (r) | 993 | if (r) |
864 | return r; | 994 | goto err0; |
865 | 995 | ||
866 | while (buf_used < size) { | 996 | while (buf_used < size) { |
867 | u8 dcs_cmd = first ? 0x2e : 0x3e; | 997 | u8 dcs_cmd = first ? 0x2e : 0x3e; |
@@ -894,7 +1024,8 @@ static int taal_memory_read(struct omap_dss_device *dssdev, | |||
894 | 1024 | ||
895 | err: | 1025 | err: |
896 | dsi_vc_set_max_rx_packet_size(TCH, 1); | 1026 | dsi_vc_set_max_rx_packet_size(TCH, 1); |
897 | 1027 | err0: | |
1028 | dsi_bus_unlock(); | ||
898 | return r; | 1029 | return r; |
899 | } | 1030 | } |
900 | 1031 | ||
@@ -939,8 +1070,11 @@ static void taal_esd_work(struct work_struct *work) | |||
939 | } | 1070 | } |
940 | /* Self-diagnostics result is also shown on TE GPIO line. We need | 1071 | /* Self-diagnostics result is also shown on TE GPIO line. We need |
941 | * to re-enable TE after self diagnostics */ | 1072 | * to re-enable TE after self diagnostics */ |
942 | if (td->use_ext_te && td->te_enabled) | 1073 | if (td->use_ext_te && td->te_enabled) { |
943 | taal_enable_te(dssdev, true); | 1074 | r = taal_dcs_write_1(DCS_TEAR_ON, 0); |
1075 | if (r) | ||
1076 | goto err; | ||
1077 | } | ||
944 | 1078 | ||
945 | dsi_bus_unlock(); | 1079 | dsi_bus_unlock(); |
946 | 1080 | ||
@@ -958,6 +1092,20 @@ err: | |||
958 | queue_delayed_work(td->esd_wq, &td->esd_work, TAAL_ESD_CHECK_PERIOD); | 1092 | queue_delayed_work(td->esd_wq, &td->esd_work, TAAL_ESD_CHECK_PERIOD); |
959 | } | 1093 | } |
960 | 1094 | ||
1095 | static int taal_set_update_mode(struct omap_dss_device *dssdev, | ||
1096 | enum omap_dss_update_mode mode) | ||
1097 | { | ||
1098 | if (mode != OMAP_DSS_UPDATE_MANUAL) | ||
1099 | return -EINVAL; | ||
1100 | return 0; | ||
1101 | } | ||
1102 | |||
1103 | static enum omap_dss_update_mode taal_get_update_mode( | ||
1104 | struct omap_dss_device *dssdev) | ||
1105 | { | ||
1106 | return OMAP_DSS_UPDATE_MANUAL; | ||
1107 | } | ||
1108 | |||
961 | static struct omap_dss_driver taal_driver = { | 1109 | static struct omap_dss_driver taal_driver = { |
962 | .probe = taal_probe, | 1110 | .probe = taal_probe, |
963 | .remove = taal_remove, | 1111 | .remove = taal_remove, |
@@ -967,9 +1115,18 @@ static struct omap_dss_driver taal_driver = { | |||
967 | .suspend = taal_suspend, | 1115 | .suspend = taal_suspend, |
968 | .resume = taal_resume, | 1116 | .resume = taal_resume, |
969 | 1117 | ||
970 | .setup_update = taal_setup_update, | 1118 | .set_update_mode = taal_set_update_mode, |
1119 | .get_update_mode = taal_get_update_mode, | ||
1120 | |||
1121 | .update = taal_update, | ||
1122 | .sync = taal_sync, | ||
1123 | |||
1124 | .get_resolution = taal_get_resolution, | ||
1125 | .get_recommended_bpp = omapdss_default_get_recommended_bpp, | ||
1126 | |||
971 | .enable_te = taal_enable_te, | 1127 | .enable_te = taal_enable_te, |
972 | .wait_for_te = taal_wait_te, | 1128 | .get_te = taal_get_te, |
1129 | |||
973 | .set_rotate = taal_rotate, | 1130 | .set_rotate = taal_rotate, |
974 | .get_rotate = taal_get_rotate, | 1131 | .get_rotate = taal_get_rotate, |
975 | .set_mirror = taal_mirror, | 1132 | .set_mirror = taal_mirror, |
@@ -977,6 +1134,8 @@ static struct omap_dss_driver taal_driver = { | |||
977 | .run_test = taal_run_test, | 1134 | .run_test = taal_run_test, |
978 | .memory_read = taal_memory_read, | 1135 | .memory_read = taal_memory_read, |
979 | 1136 | ||
1137 | .get_timings = taal_get_timings, | ||
1138 | |||
980 | .driver = { | 1139 | .driver = { |
981 | .name = "taal", | 1140 | .name = "taal", |
982 | .owner = THIS_MODULE, | 1141 | .owner = THIS_MODULE, |
diff --git a/drivers/video/omap2/displays/panel-toppoly-tdo35s.c b/drivers/video/omap2/displays/panel-toppoly-tdo35s.c new file mode 100644 index 000000000000..fa434ca6e4b7 --- /dev/null +++ b/drivers/video/omap2/displays/panel-toppoly-tdo35s.c | |||
@@ -0,0 +1,154 @@ | |||
1 | /* | ||
2 | * LCD panel driver for Toppoly TDO35S | ||
3 | * | ||
4 | * Copyright (C) 2009 CompuLab, Ltd. | ||
5 | * Author: Mike Rapoport <mike@compulab.co.il> | ||
6 | * | ||
7 | * Based on generic panel support | ||
8 | * Copyright (C) 2008 Nokia Corporation | ||
9 | * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify it | ||
12 | * under the terms of the GNU General Public License version 2 as published by | ||
13 | * the Free Software Foundation. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
18 | * more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License along with | ||
21 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
22 | */ | ||
23 | |||
24 | #include <linux/module.h> | ||
25 | #include <linux/delay.h> | ||
26 | |||
27 | #include <plat/display.h> | ||
28 | |||
29 | static struct omap_video_timings toppoly_tdo_panel_timings = { | ||
30 | /* 640 x 480 @ 60 Hz Reduced blanking VESA CVT 0.31M3-R */ | ||
31 | .x_res = 480, | ||
32 | .y_res = 640, | ||
33 | |||
34 | .pixel_clock = 26000, | ||
35 | |||
36 | .hfp = 104, | ||
37 | .hsw = 8, | ||
38 | .hbp = 8, | ||
39 | |||
40 | .vfp = 4, | ||
41 | .vsw = 2, | ||
42 | .vbp = 2, | ||
43 | }; | ||
44 | |||
45 | static int toppoly_tdo_panel_power_on(struct omap_dss_device *dssdev) | ||
46 | { | ||
47 | int r; | ||
48 | |||
49 | r = omapdss_dpi_display_enable(dssdev); | ||
50 | if (r) | ||
51 | goto err0; | ||
52 | |||
53 | if (dssdev->platform_enable) { | ||
54 | r = dssdev->platform_enable(dssdev); | ||
55 | if (r) | ||
56 | goto err1; | ||
57 | } | ||
58 | |||
59 | return 0; | ||
60 | err1: | ||
61 | omapdss_dpi_display_disable(dssdev); | ||
62 | err0: | ||
63 | return r; | ||
64 | } | ||
65 | |||
66 | static void toppoly_tdo_panel_power_off(struct omap_dss_device *dssdev) | ||
67 | { | ||
68 | if (dssdev->platform_disable) | ||
69 | dssdev->platform_disable(dssdev); | ||
70 | |||
71 | omapdss_dpi_display_disable(dssdev); | ||
72 | } | ||
73 | |||
74 | static int toppoly_tdo_panel_probe(struct omap_dss_device *dssdev) | ||
75 | { | ||
76 | dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | | ||
77 | OMAP_DSS_LCD_IHS; | ||
78 | dssdev->panel.timings = toppoly_tdo_panel_timings; | ||
79 | |||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | static void toppoly_tdo_panel_remove(struct omap_dss_device *dssdev) | ||
84 | { | ||
85 | } | ||
86 | |||
87 | static int toppoly_tdo_panel_enable(struct omap_dss_device *dssdev) | ||
88 | { | ||
89 | int r = 0; | ||
90 | |||
91 | r = toppoly_tdo_panel_power_on(dssdev); | ||
92 | if (r) | ||
93 | return r; | ||
94 | |||
95 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
96 | |||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | static void toppoly_tdo_panel_disable(struct omap_dss_device *dssdev) | ||
101 | { | ||
102 | toppoly_tdo_panel_power_off(dssdev); | ||
103 | |||
104 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
105 | } | ||
106 | |||
107 | static int toppoly_tdo_panel_suspend(struct omap_dss_device *dssdev) | ||
108 | { | ||
109 | toppoly_tdo_panel_power_off(dssdev); | ||
110 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | static int toppoly_tdo_panel_resume(struct omap_dss_device *dssdev) | ||
115 | { | ||
116 | int r = 0; | ||
117 | |||
118 | r = toppoly_tdo_panel_power_on(dssdev); | ||
119 | if (r) | ||
120 | return r; | ||
121 | |||
122 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
123 | |||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | static struct omap_dss_driver generic_driver = { | ||
128 | .probe = toppoly_tdo_panel_probe, | ||
129 | .remove = toppoly_tdo_panel_remove, | ||
130 | |||
131 | .enable = toppoly_tdo_panel_enable, | ||
132 | .disable = toppoly_tdo_panel_disable, | ||
133 | .suspend = toppoly_tdo_panel_suspend, | ||
134 | .resume = toppoly_tdo_panel_resume, | ||
135 | |||
136 | .driver = { | ||
137 | .name = "toppoly_tdo35s_panel", | ||
138 | .owner = THIS_MODULE, | ||
139 | }, | ||
140 | }; | ||
141 | |||
142 | static int __init toppoly_tdo_panel_drv_init(void) | ||
143 | { | ||
144 | return omap_dss_register_driver(&generic_driver); | ||
145 | } | ||
146 | |||
147 | static void __exit toppoly_tdo_panel_drv_exit(void) | ||
148 | { | ||
149 | omap_dss_unregister_driver(&generic_driver); | ||
150 | } | ||
151 | |||
152 | module_init(toppoly_tdo_panel_drv_init); | ||
153 | module_exit(toppoly_tdo_panel_drv_exit); | ||
154 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c new file mode 100644 index 000000000000..d578feee3550 --- /dev/null +++ b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c | |||
@@ -0,0 +1,528 @@ | |||
1 | /* | ||
2 | * LCD panel driver for TPO TD043MTEA1 | ||
3 | * | ||
4 | * Author: Gražvydas Ignotas <notasas@gmail.com> | ||
5 | * | ||
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 | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/delay.h> | ||
14 | #include <linux/spi/spi.h> | ||
15 | #include <linux/regulator/consumer.h> | ||
16 | #include <linux/gpio.h> | ||
17 | #include <linux/err.h> | ||
18 | |||
19 | #include <plat/display.h> | ||
20 | |||
21 | #define TPO_R02_MODE(x) ((x) & 7) | ||
22 | #define TPO_R02_MODE_800x480 7 | ||
23 | #define TPO_R02_NCLK_RISING BIT(3) | ||
24 | #define TPO_R02_HSYNC_HIGH BIT(4) | ||
25 | #define TPO_R02_VSYNC_HIGH BIT(5) | ||
26 | |||
27 | #define TPO_R03_NSTANDBY BIT(0) | ||
28 | #define TPO_R03_EN_CP_CLK BIT(1) | ||
29 | #define TPO_R03_EN_VGL_PUMP BIT(2) | ||
30 | #define TPO_R03_EN_PWM BIT(3) | ||
31 | #define TPO_R03_DRIVING_CAP_100 BIT(4) | ||
32 | #define TPO_R03_EN_PRE_CHARGE BIT(6) | ||
33 | #define TPO_R03_SOFTWARE_CTL BIT(7) | ||
34 | |||
35 | #define TPO_R04_NFLIP_H BIT(0) | ||
36 | #define TPO_R04_NFLIP_V BIT(1) | ||
37 | #define TPO_R04_CP_CLK_FREQ_1H BIT(2) | ||
38 | #define TPO_R04_VGL_FREQ_1H BIT(4) | ||
39 | |||
40 | #define TPO_R03_VAL_NORMAL (TPO_R03_NSTANDBY | TPO_R03_EN_CP_CLK | \ | ||
41 | TPO_R03_EN_VGL_PUMP | TPO_R03_EN_PWM | \ | ||
42 | TPO_R03_DRIVING_CAP_100 | TPO_R03_EN_PRE_CHARGE | \ | ||
43 | TPO_R03_SOFTWARE_CTL) | ||
44 | |||
45 | #define TPO_R03_VAL_STANDBY (TPO_R03_DRIVING_CAP_100 | \ | ||
46 | TPO_R03_EN_PRE_CHARGE | TPO_R03_SOFTWARE_CTL) | ||
47 | |||
48 | static const u16 tpo_td043_def_gamma[12] = { | ||
49 | 106, 200, 289, 375, 460, 543, 625, 705, 785, 864, 942, 1020 | ||
50 | }; | ||
51 | |||
52 | struct tpo_td043_device { | ||
53 | struct spi_device *spi; | ||
54 | struct regulator *vcc_reg; | ||
55 | u16 gamma[12]; | ||
56 | u32 mode; | ||
57 | u32 hmirror:1; | ||
58 | u32 vmirror:1; | ||
59 | }; | ||
60 | |||
61 | static int tpo_td043_write(struct spi_device *spi, u8 addr, u8 data) | ||
62 | { | ||
63 | struct spi_message m; | ||
64 | struct spi_transfer xfer; | ||
65 | u16 w; | ||
66 | int r; | ||
67 | |||
68 | spi_message_init(&m); | ||
69 | |||
70 | memset(&xfer, 0, sizeof(xfer)); | ||
71 | |||
72 | w = ((u16)addr << 10) | (1 << 8) | data; | ||
73 | xfer.tx_buf = &w; | ||
74 | xfer.bits_per_word = 16; | ||
75 | xfer.len = 2; | ||
76 | spi_message_add_tail(&xfer, &m); | ||
77 | |||
78 | r = spi_sync(spi, &m); | ||
79 | if (r < 0) | ||
80 | dev_warn(&spi->dev, "failed to write to LCD reg (%d)\n", r); | ||
81 | return r; | ||
82 | } | ||
83 | |||
84 | static void tpo_td043_write_gamma(struct spi_device *spi, u16 gamma[12]) | ||
85 | { | ||
86 | u8 i, val; | ||
87 | |||
88 | /* gamma bits [9:8] */ | ||
89 | for (val = i = 0; i < 4; i++) | ||
90 | val |= (gamma[i] & 0x300) >> ((i + 1) * 2); | ||
91 | tpo_td043_write(spi, 0x11, val); | ||
92 | |||
93 | for (val = i = 0; i < 4; i++) | ||
94 | val |= (gamma[i+4] & 0x300) >> ((i + 1) * 2); | ||
95 | tpo_td043_write(spi, 0x12, val); | ||
96 | |||
97 | for (val = i = 0; i < 4; i++) | ||
98 | val |= (gamma[i+8] & 0x300) >> ((i + 1) * 2); | ||
99 | tpo_td043_write(spi, 0x13, val); | ||
100 | |||
101 | /* gamma bits [7:0] */ | ||
102 | for (val = i = 0; i < 12; i++) | ||
103 | tpo_td043_write(spi, 0x14 + i, gamma[i] & 0xff); | ||
104 | } | ||
105 | |||
106 | static int tpo_td043_write_mirror(struct spi_device *spi, bool h, bool v) | ||
107 | { | ||
108 | u8 reg4 = TPO_R04_NFLIP_H | TPO_R04_NFLIP_V | \ | ||
109 | TPO_R04_CP_CLK_FREQ_1H | TPO_R04_VGL_FREQ_1H; | ||
110 | if (h) | ||
111 | reg4 &= ~TPO_R04_NFLIP_H; | ||
112 | if (v) | ||
113 | reg4 &= ~TPO_R04_NFLIP_V; | ||
114 | |||
115 | return tpo_td043_write(spi, 4, reg4); | ||
116 | } | ||
117 | |||
118 | static int tpo_td043_set_hmirror(struct omap_dss_device *dssdev, bool enable) | ||
119 | { | ||
120 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev); | ||
121 | |||
122 | tpo_td043->hmirror = enable; | ||
123 | return tpo_td043_write_mirror(tpo_td043->spi, tpo_td043->hmirror, | ||
124 | tpo_td043->vmirror); | ||
125 | } | ||
126 | |||
127 | static bool tpo_td043_get_hmirror(struct omap_dss_device *dssdev) | ||
128 | { | ||
129 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev); | ||
130 | |||
131 | return tpo_td043->hmirror; | ||
132 | } | ||
133 | |||
134 | static ssize_t tpo_td043_vmirror_show(struct device *dev, | ||
135 | struct device_attribute *attr, char *buf) | ||
136 | { | ||
137 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev); | ||
138 | |||
139 | return snprintf(buf, PAGE_SIZE, "%d\n", tpo_td043->vmirror); | ||
140 | } | ||
141 | |||
142 | static ssize_t tpo_td043_vmirror_store(struct device *dev, | ||
143 | struct device_attribute *attr, const char *buf, size_t count) | ||
144 | { | ||
145 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev); | ||
146 | long val; | ||
147 | int ret; | ||
148 | |||
149 | ret = strict_strtol(buf, 0, &val); | ||
150 | if (ret < 0) | ||
151 | return ret; | ||
152 | |||
153 | ret = tpo_td043_write_mirror(tpo_td043->spi, tpo_td043->hmirror, val); | ||
154 | if (ret < 0) | ||
155 | return ret; | ||
156 | |||
157 | tpo_td043->vmirror = val; | ||
158 | |||
159 | return count; | ||
160 | } | ||
161 | |||
162 | static ssize_t tpo_td043_mode_show(struct device *dev, | ||
163 | struct device_attribute *attr, char *buf) | ||
164 | { | ||
165 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev); | ||
166 | |||
167 | return snprintf(buf, PAGE_SIZE, "%d\n", tpo_td043->mode); | ||
168 | } | ||
169 | |||
170 | static ssize_t tpo_td043_mode_store(struct device *dev, | ||
171 | struct device_attribute *attr, const char *buf, size_t count) | ||
172 | { | ||
173 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev); | ||
174 | long val; | ||
175 | int ret; | ||
176 | |||
177 | ret = strict_strtol(buf, 0, &val); | ||
178 | if (ret != 0 || val & ~7) | ||
179 | return -EINVAL; | ||
180 | |||
181 | tpo_td043->mode = val; | ||
182 | |||
183 | val |= TPO_R02_NCLK_RISING; | ||
184 | tpo_td043_write(tpo_td043->spi, 2, val); | ||
185 | |||
186 | return count; | ||
187 | } | ||
188 | |||
189 | static ssize_t tpo_td043_gamma_show(struct device *dev, | ||
190 | struct device_attribute *attr, char *buf) | ||
191 | { | ||
192 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev); | ||
193 | ssize_t len = 0; | ||
194 | int ret; | ||
195 | int i; | ||
196 | |||
197 | for (i = 0; i < ARRAY_SIZE(tpo_td043->gamma); i++) { | ||
198 | ret = snprintf(buf + len, PAGE_SIZE - len, "%u ", | ||
199 | tpo_td043->gamma[i]); | ||
200 | if (ret < 0) | ||
201 | return ret; | ||
202 | len += ret; | ||
203 | } | ||
204 | buf[len - 1] = '\n'; | ||
205 | |||
206 | return len; | ||
207 | } | ||
208 | |||
209 | static ssize_t tpo_td043_gamma_store(struct device *dev, | ||
210 | struct device_attribute *attr, const char *buf, size_t count) | ||
211 | { | ||
212 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(dev); | ||
213 | unsigned int g[12]; | ||
214 | int ret; | ||
215 | int i; | ||
216 | |||
217 | ret = sscanf(buf, "%u %u %u %u %u %u %u %u %u %u %u %u", | ||
218 | &g[0], &g[1], &g[2], &g[3], &g[4], &g[5], | ||
219 | &g[6], &g[7], &g[8], &g[9], &g[10], &g[11]); | ||
220 | |||
221 | if (ret != 12) | ||
222 | return -EINVAL; | ||
223 | |||
224 | for (i = 0; i < 12; i++) | ||
225 | tpo_td043->gamma[i] = g[i]; | ||
226 | |||
227 | tpo_td043_write_gamma(tpo_td043->spi, tpo_td043->gamma); | ||
228 | |||
229 | return count; | ||
230 | } | ||
231 | |||
232 | static DEVICE_ATTR(vmirror, S_IRUGO | S_IWUSR, | ||
233 | tpo_td043_vmirror_show, tpo_td043_vmirror_store); | ||
234 | static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, | ||
235 | tpo_td043_mode_show, tpo_td043_mode_store); | ||
236 | static DEVICE_ATTR(gamma, S_IRUGO | S_IWUSR, | ||
237 | tpo_td043_gamma_show, tpo_td043_gamma_store); | ||
238 | |||
239 | static struct attribute *tpo_td043_attrs[] = { | ||
240 | &dev_attr_vmirror.attr, | ||
241 | &dev_attr_mode.attr, | ||
242 | &dev_attr_gamma.attr, | ||
243 | NULL, | ||
244 | }; | ||
245 | |||
246 | static struct attribute_group tpo_td043_attr_group = { | ||
247 | .attrs = tpo_td043_attrs, | ||
248 | }; | ||
249 | |||
250 | static const struct omap_video_timings tpo_td043_timings = { | ||
251 | .x_res = 800, | ||
252 | .y_res = 480, | ||
253 | |||
254 | .pixel_clock = 36000, | ||
255 | |||
256 | .hsw = 1, | ||
257 | .hfp = 68, | ||
258 | .hbp = 214, | ||
259 | |||
260 | .vsw = 1, | ||
261 | .vfp = 39, | ||
262 | .vbp = 34, | ||
263 | }; | ||
264 | |||
265 | static int tpo_td043_power_on(struct omap_dss_device *dssdev) | ||
266 | { | ||
267 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev); | ||
268 | int nreset_gpio = dssdev->reset_gpio; | ||
269 | int r; | ||
270 | |||
271 | r = omapdss_dpi_display_enable(dssdev); | ||
272 | if (r) | ||
273 | goto err0; | ||
274 | |||
275 | if (dssdev->platform_enable) { | ||
276 | r = dssdev->platform_enable(dssdev); | ||
277 | if (r) | ||
278 | goto err1; | ||
279 | } | ||
280 | |||
281 | regulator_enable(tpo_td043->vcc_reg); | ||
282 | |||
283 | /* wait for power up */ | ||
284 | msleep(160); | ||
285 | |||
286 | if (gpio_is_valid(nreset_gpio)) | ||
287 | gpio_set_value(nreset_gpio, 1); | ||
288 | |||
289 | tpo_td043_write(tpo_td043->spi, 2, | ||
290 | TPO_R02_MODE(tpo_td043->mode) | TPO_R02_NCLK_RISING); | ||
291 | tpo_td043_write(tpo_td043->spi, 3, TPO_R03_VAL_NORMAL); | ||
292 | tpo_td043_write(tpo_td043->spi, 0x20, 0xf0); | ||
293 | tpo_td043_write(tpo_td043->spi, 0x21, 0xf0); | ||
294 | tpo_td043_write_mirror(tpo_td043->spi, tpo_td043->hmirror, | ||
295 | tpo_td043->vmirror); | ||
296 | tpo_td043_write_gamma(tpo_td043->spi, tpo_td043->gamma); | ||
297 | |||
298 | return 0; | ||
299 | err1: | ||
300 | omapdss_dpi_display_disable(dssdev); | ||
301 | err0: | ||
302 | return r; | ||
303 | } | ||
304 | |||
305 | static void tpo_td043_power_off(struct omap_dss_device *dssdev) | ||
306 | { | ||
307 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev); | ||
308 | int nreset_gpio = dssdev->reset_gpio; | ||
309 | |||
310 | tpo_td043_write(tpo_td043->spi, 3, | ||
311 | TPO_R03_VAL_STANDBY | TPO_R03_EN_PWM); | ||
312 | |||
313 | if (gpio_is_valid(nreset_gpio)) | ||
314 | gpio_set_value(nreset_gpio, 0); | ||
315 | |||
316 | /* wait for at least 2 vsyncs before cutting off power */ | ||
317 | msleep(50); | ||
318 | |||
319 | tpo_td043_write(tpo_td043->spi, 3, TPO_R03_VAL_STANDBY); | ||
320 | |||
321 | regulator_disable(tpo_td043->vcc_reg); | ||
322 | |||
323 | if (dssdev->platform_disable) | ||
324 | dssdev->platform_disable(dssdev); | ||
325 | |||
326 | omapdss_dpi_display_disable(dssdev); | ||
327 | } | ||
328 | |||
329 | static int tpo_td043_enable(struct omap_dss_device *dssdev) | ||
330 | { | ||
331 | int ret; | ||
332 | |||
333 | dev_dbg(&dssdev->dev, "enable\n"); | ||
334 | |||
335 | ret = tpo_td043_power_on(dssdev); | ||
336 | if (ret) | ||
337 | return ret; | ||
338 | |||
339 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
340 | |||
341 | return 0; | ||
342 | } | ||
343 | |||
344 | static void tpo_td043_disable(struct omap_dss_device *dssdev) | ||
345 | { | ||
346 | dev_dbg(&dssdev->dev, "disable\n"); | ||
347 | |||
348 | tpo_td043_power_off(dssdev); | ||
349 | |||
350 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
351 | } | ||
352 | |||
353 | static int tpo_td043_suspend(struct omap_dss_device *dssdev) | ||
354 | { | ||
355 | tpo_td043_power_off(dssdev); | ||
356 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
357 | return 0; | ||
358 | } | ||
359 | |||
360 | static int tpo_td043_resume(struct omap_dss_device *dssdev) | ||
361 | { | ||
362 | int r = 0; | ||
363 | |||
364 | r = tpo_td043_power_on(dssdev); | ||
365 | if (r) | ||
366 | return r; | ||
367 | |||
368 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
369 | |||
370 | return 0; | ||
371 | } | ||
372 | |||
373 | static int tpo_td043_probe(struct omap_dss_device *dssdev) | ||
374 | { | ||
375 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev); | ||
376 | int nreset_gpio = dssdev->reset_gpio; | ||
377 | int ret = 0; | ||
378 | |||
379 | dev_dbg(&dssdev->dev, "probe\n"); | ||
380 | |||
381 | if (tpo_td043 == NULL) { | ||
382 | dev_err(&dssdev->dev, "missing tpo_td043_device\n"); | ||
383 | return -ENODEV; | ||
384 | } | ||
385 | |||
386 | dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IHS | | ||
387 | OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IPC; | ||
388 | dssdev->panel.timings = tpo_td043_timings; | ||
389 | dssdev->ctrl.pixel_size = 24; | ||
390 | |||
391 | tpo_td043->mode = TPO_R02_MODE_800x480; | ||
392 | memcpy(tpo_td043->gamma, tpo_td043_def_gamma, sizeof(tpo_td043->gamma)); | ||
393 | |||
394 | tpo_td043->vcc_reg = regulator_get(&dssdev->dev, "vcc"); | ||
395 | if (IS_ERR(tpo_td043->vcc_reg)) { | ||
396 | dev_err(&dssdev->dev, "failed to get LCD VCC regulator\n"); | ||
397 | ret = PTR_ERR(tpo_td043->vcc_reg); | ||
398 | goto fail_regulator; | ||
399 | } | ||
400 | |||
401 | if (gpio_is_valid(nreset_gpio)) { | ||
402 | ret = gpio_request(nreset_gpio, "lcd reset"); | ||
403 | if (ret < 0) { | ||
404 | dev_err(&dssdev->dev, "couldn't request reset GPIO\n"); | ||
405 | goto fail_gpio_req; | ||
406 | } | ||
407 | |||
408 | ret = gpio_direction_output(nreset_gpio, 0); | ||
409 | if (ret < 0) { | ||
410 | dev_err(&dssdev->dev, "couldn't set GPIO direction\n"); | ||
411 | goto fail_gpio_direction; | ||
412 | } | ||
413 | } | ||
414 | |||
415 | ret = sysfs_create_group(&dssdev->dev.kobj, &tpo_td043_attr_group); | ||
416 | if (ret) | ||
417 | dev_warn(&dssdev->dev, "failed to create sysfs files\n"); | ||
418 | |||
419 | return 0; | ||
420 | |||
421 | fail_gpio_direction: | ||
422 | gpio_free(nreset_gpio); | ||
423 | fail_gpio_req: | ||
424 | regulator_put(tpo_td043->vcc_reg); | ||
425 | fail_regulator: | ||
426 | kfree(tpo_td043); | ||
427 | return ret; | ||
428 | } | ||
429 | |||
430 | static void tpo_td043_remove(struct omap_dss_device *dssdev) | ||
431 | { | ||
432 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&dssdev->dev); | ||
433 | int nreset_gpio = dssdev->reset_gpio; | ||
434 | |||
435 | dev_dbg(&dssdev->dev, "remove\n"); | ||
436 | |||
437 | sysfs_remove_group(&dssdev->dev.kobj, &tpo_td043_attr_group); | ||
438 | regulator_put(tpo_td043->vcc_reg); | ||
439 | if (gpio_is_valid(nreset_gpio)) | ||
440 | gpio_free(nreset_gpio); | ||
441 | } | ||
442 | |||
443 | static struct omap_dss_driver tpo_td043_driver = { | ||
444 | .probe = tpo_td043_probe, | ||
445 | .remove = tpo_td043_remove, | ||
446 | |||
447 | .enable = tpo_td043_enable, | ||
448 | .disable = tpo_td043_disable, | ||
449 | .suspend = tpo_td043_suspend, | ||
450 | .resume = tpo_td043_resume, | ||
451 | .set_mirror = tpo_td043_set_hmirror, | ||
452 | .get_mirror = tpo_td043_get_hmirror, | ||
453 | |||
454 | .driver = { | ||
455 | .name = "tpo_td043mtea1_panel", | ||
456 | .owner = THIS_MODULE, | ||
457 | }, | ||
458 | }; | ||
459 | |||
460 | static int tpo_td043_spi_probe(struct spi_device *spi) | ||
461 | { | ||
462 | struct omap_dss_device *dssdev = spi->dev.platform_data; | ||
463 | struct tpo_td043_device *tpo_td043; | ||
464 | int ret; | ||
465 | |||
466 | if (dssdev == NULL) { | ||
467 | dev_err(&spi->dev, "missing dssdev\n"); | ||
468 | return -ENODEV; | ||
469 | } | ||
470 | |||
471 | spi->bits_per_word = 16; | ||
472 | spi->mode = SPI_MODE_0; | ||
473 | |||
474 | ret = spi_setup(spi); | ||
475 | if (ret < 0) { | ||
476 | dev_err(&spi->dev, "spi_setup failed: %d\n", ret); | ||
477 | return ret; | ||
478 | } | ||
479 | |||
480 | tpo_td043 = kzalloc(sizeof(*tpo_td043), GFP_KERNEL); | ||
481 | if (tpo_td043 == NULL) | ||
482 | return -ENOMEM; | ||
483 | |||
484 | tpo_td043->spi = spi; | ||
485 | dev_set_drvdata(&spi->dev, tpo_td043); | ||
486 | dev_set_drvdata(&dssdev->dev, tpo_td043); | ||
487 | |||
488 | omap_dss_register_driver(&tpo_td043_driver); | ||
489 | |||
490 | return 0; | ||
491 | } | ||
492 | |||
493 | static int __devexit tpo_td043_spi_remove(struct spi_device *spi) | ||
494 | { | ||
495 | struct tpo_td043_device *tpo_td043 = dev_get_drvdata(&spi->dev); | ||
496 | |||
497 | omap_dss_unregister_driver(&tpo_td043_driver); | ||
498 | kfree(tpo_td043); | ||
499 | |||
500 | return 0; | ||
501 | } | ||
502 | |||
503 | static struct spi_driver tpo_td043_spi_driver = { | ||
504 | .driver = { | ||
505 | .name = "tpo_td043mtea1_panel_spi", | ||
506 | .bus = &spi_bus_type, | ||
507 | .owner = THIS_MODULE, | ||
508 | }, | ||
509 | .probe = tpo_td043_spi_probe, | ||
510 | .remove = __devexit_p(tpo_td043_spi_remove), | ||
511 | }; | ||
512 | |||
513 | static int __init tpo_td043_init(void) | ||
514 | { | ||
515 | return spi_register_driver(&tpo_td043_spi_driver); | ||
516 | } | ||
517 | |||
518 | static void __exit tpo_td043_exit(void) | ||
519 | { | ||
520 | spi_unregister_driver(&tpo_td043_spi_driver); | ||
521 | } | ||
522 | |||
523 | module_init(tpo_td043_init); | ||
524 | module_exit(tpo_td043_exit); | ||
525 | |||
526 | MODULE_AUTHOR("Gražvydas Ignotas <notasas@gmail.com>"); | ||
527 | MODULE_DESCRIPTION("TPO TD043MTEA1 LCD Driver"); | ||
528 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/video/omap2/dss/Kconfig b/drivers/video/omap2/dss/Kconfig index c63ce767b277..87afb81b2c44 100644 --- a/drivers/video/omap2/dss/Kconfig +++ b/drivers/video/omap2/dss/Kconfig | |||
@@ -30,19 +30,29 @@ config OMAP2_DSS_COLLECT_IRQ_STATS | |||
30 | depends on OMAP2_DSS_DEBUG_SUPPORT | 30 | depends on OMAP2_DSS_DEBUG_SUPPORT |
31 | default n | 31 | default n |
32 | help | 32 | help |
33 | Collect DSS IRQ statistics, printable via debugfs | 33 | Collect DSS IRQ statistics, printable via debugfs. |
34 | |||
35 | The statistics can be found from | ||
36 | <debugfs>/omapdss/dispc_irq for DISPC interrupts, and | ||
37 | <debugfs>/omapdss/dsi_irq for DSI interrupts. | ||
34 | 38 | ||
35 | config OMAP2_DSS_RFBI | 39 | config OMAP2_DSS_RFBI |
36 | bool "RFBI support" | 40 | bool "RFBI support" |
37 | default n | 41 | default n |
38 | help | 42 | help |
39 | MIPI DBI, or RFBI (Remote Framebuffer Interface), support. | 43 | MIPI DBI support (RFBI, Remote Framebuffer Interface, in Texas |
44 | Instrument's terminology). | ||
45 | |||
46 | DBI is a bus between the host processor and a peripheral, | ||
47 | such as a display or a framebuffer chip. | ||
48 | |||
49 | See http://www.mipi.org/ for DBI spesifications. | ||
40 | 50 | ||
41 | config OMAP2_DSS_VENC | 51 | config OMAP2_DSS_VENC |
42 | bool "VENC support" | 52 | bool "VENC support" |
43 | default y | 53 | default y |
44 | help | 54 | help |
45 | OMAP Video Encoder support. | 55 | OMAP Video Encoder support for S-Video and composite TV-out. |
46 | 56 | ||
47 | config OMAP2_DSS_SDI | 57 | config OMAP2_DSS_SDI |
48 | bool "SDI support" | 58 | bool "SDI support" |
@@ -51,12 +61,20 @@ config OMAP2_DSS_SDI | |||
51 | help | 61 | help |
52 | SDI (Serial Display Interface) support. | 62 | SDI (Serial Display Interface) support. |
53 | 63 | ||
64 | SDI is a high speed one-way display serial bus between the host | ||
65 | processor and a display. | ||
66 | |||
54 | config OMAP2_DSS_DSI | 67 | config OMAP2_DSS_DSI |
55 | bool "DSI support" | 68 | bool "DSI support" |
56 | depends on ARCH_OMAP3 | 69 | depends on ARCH_OMAP3 |
57 | default n | 70 | default n |
58 | help | 71 | help |
59 | MIPI DSI support. | 72 | MIPI DSI (Display Serial Interface) support. |
73 | |||
74 | DSI is a high speed half-duplex serial interface between the host | ||
75 | processor and a peripheral, such as a display or a framebuffer chip. | ||
76 | |||
77 | See http://www.mipi.org/ for DSI spesifications. | ||
60 | 78 | ||
61 | config OMAP2_DSS_USE_DSI_PLL | 79 | config OMAP2_DSS_USE_DSI_PLL |
62 | bool "Use DSI PLL for PCLK (EXPERIMENTAL)" | 80 | bool "Use DSI PLL for PCLK (EXPERIMENTAL)" |
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index 82918eec6d2e..7ebe50b335ed 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/debugfs.h> | 31 | #include <linux/debugfs.h> |
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | #include <linux/device.h> | 33 | #include <linux/device.h> |
34 | #include <linux/regulator/consumer.h> | ||
34 | 35 | ||
35 | #include <plat/display.h> | 36 | #include <plat/display.h> |
36 | #include <plat/clock.h> | 37 | #include <plat/clock.h> |
@@ -47,6 +48,10 @@ static struct { | |||
47 | struct clk *dss_54m_fck; | 48 | struct clk *dss_54m_fck; |
48 | struct clk *dss_96m_fck; | 49 | struct clk *dss_96m_fck; |
49 | unsigned num_clks_enabled; | 50 | unsigned num_clks_enabled; |
51 | |||
52 | struct regulator *vdds_dsi_reg; | ||
53 | struct regulator *vdds_sdi_reg; | ||
54 | struct regulator *vdda_dac_reg; | ||
50 | } core; | 55 | } core; |
51 | 56 | ||
52 | static void dss_clk_enable_all_no_ctx(void); | 57 | static void dss_clk_enable_all_no_ctx(void); |
@@ -284,9 +289,11 @@ static void dss_clk_enable_no_ctx(enum dss_clock clks) | |||
284 | 289 | ||
285 | void dss_clk_enable(enum dss_clock clks) | 290 | void dss_clk_enable(enum dss_clock clks) |
286 | { | 291 | { |
292 | bool check_ctx = core.num_clks_enabled == 0; | ||
293 | |||
287 | dss_clk_enable_no_ctx(clks); | 294 | dss_clk_enable_no_ctx(clks); |
288 | 295 | ||
289 | if (cpu_is_omap34xx() && dss_need_ctx_restore()) | 296 | if (check_ctx && cpu_is_omap34xx() && dss_need_ctx_restore()) |
290 | restore_all_ctx(); | 297 | restore_all_ctx(); |
291 | } | 298 | } |
292 | 299 | ||
@@ -352,6 +359,50 @@ static void dss_clk_disable_all(void) | |||
352 | dss_clk_disable(clks); | 359 | dss_clk_disable(clks); |
353 | } | 360 | } |
354 | 361 | ||
362 | /* REGULATORS */ | ||
363 | |||
364 | struct regulator *dss_get_vdds_dsi(void) | ||
365 | { | ||
366 | struct regulator *reg; | ||
367 | |||
368 | if (core.vdds_dsi_reg != NULL) | ||
369 | return core.vdds_dsi_reg; | ||
370 | |||
371 | reg = regulator_get(&core.pdev->dev, "vdds_dsi"); | ||
372 | if (!IS_ERR(reg)) | ||
373 | core.vdds_dsi_reg = reg; | ||
374 | |||
375 | return reg; | ||
376 | } | ||
377 | |||
378 | struct regulator *dss_get_vdds_sdi(void) | ||
379 | { | ||
380 | struct regulator *reg; | ||
381 | |||
382 | if (core.vdds_sdi_reg != NULL) | ||
383 | return core.vdds_sdi_reg; | ||
384 | |||
385 | reg = regulator_get(&core.pdev->dev, "vdds_sdi"); | ||
386 | if (!IS_ERR(reg)) | ||
387 | core.vdds_sdi_reg = reg; | ||
388 | |||
389 | return reg; | ||
390 | } | ||
391 | |||
392 | struct regulator *dss_get_vdda_dac(void) | ||
393 | { | ||
394 | struct regulator *reg; | ||
395 | |||
396 | if (core.vdda_dac_reg != NULL) | ||
397 | return core.vdda_dac_reg; | ||
398 | |||
399 | reg = regulator_get(&core.pdev->dev, "vdda_dac"); | ||
400 | if (!IS_ERR(reg)) | ||
401 | core.vdda_dac_reg = reg; | ||
402 | |||
403 | return reg; | ||
404 | } | ||
405 | |||
355 | /* DEBUGFS */ | 406 | /* DEBUGFS */ |
356 | #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT) | 407 | #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT) |
357 | static void dss_debug_dump_clocks(struct seq_file *s) | 408 | static void dss_debug_dump_clocks(struct seq_file *s) |
@@ -397,10 +448,12 @@ static int dss_initialize_debugfs(void) | |||
397 | debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir, | 448 | debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir, |
398 | &dss_debug_dump_clocks, &dss_debug_fops); | 449 | &dss_debug_dump_clocks, &dss_debug_fops); |
399 | 450 | ||
451 | #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS | ||
400 | debugfs_create_file("dispc_irq", S_IRUGO, dss_debugfs_dir, | 452 | debugfs_create_file("dispc_irq", S_IRUGO, dss_debugfs_dir, |
401 | &dispc_dump_irqs, &dss_debug_fops); | 453 | &dispc_dump_irqs, &dss_debug_fops); |
454 | #endif | ||
402 | 455 | ||
403 | #ifdef CONFIG_OMAP2_DSS_DSI | 456 | #if defined(CONFIG_OMAP2_DSS_DSI) && defined(CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS) |
404 | debugfs_create_file("dsi_irq", S_IRUGO, dss_debugfs_dir, | 457 | debugfs_create_file("dsi_irq", S_IRUGO, dss_debugfs_dir, |
405 | &dsi_dump_irqs, &dss_debug_fops); | 458 | &dsi_dump_irqs, &dss_debug_fops); |
406 | #endif | 459 | #endif |
@@ -473,7 +526,7 @@ static int omap_dss_probe(struct platform_device *pdev) | |||
473 | } | 526 | } |
474 | #endif | 527 | #endif |
475 | 528 | ||
476 | r = dpi_init(); | 529 | r = dpi_init(pdev); |
477 | if (r) { | 530 | if (r) { |
478 | DSSERR("Failed to initialize dpi\n"); | 531 | DSSERR("Failed to initialize dpi\n"); |
479 | goto fail0; | 532 | goto fail0; |
@@ -718,16 +771,14 @@ static int dss_driver_probe(struct device *dev) | |||
718 | 771 | ||
719 | dss_init_device(core.pdev, dssdev); | 772 | dss_init_device(core.pdev, dssdev); |
720 | 773 | ||
721 | /* skip this if the device is behind a ctrl */ | 774 | force = pdata->default_device == dssdev; |
722 | if (!dssdev->panel.ctrl) { | 775 | dss_recheck_connections(dssdev, force); |
723 | force = pdata->default_device == dssdev; | ||
724 | dss_recheck_connections(dssdev, force); | ||
725 | } | ||
726 | 776 | ||
727 | r = dssdrv->probe(dssdev); | 777 | r = dssdrv->probe(dssdev); |
728 | 778 | ||
729 | if (r) { | 779 | if (r) { |
730 | DSSERR("driver probe failed: %d\n", r); | 780 | DSSERR("driver probe failed: %d\n", r); |
781 | dss_uninit_device(core.pdev, dssdev); | ||
731 | return r; | 782 | return r; |
732 | } | 783 | } |
733 | 784 | ||
@@ -760,6 +811,13 @@ int omap_dss_register_driver(struct omap_dss_driver *dssdriver) | |||
760 | dssdriver->driver.bus = &dss_bus_type; | 811 | dssdriver->driver.bus = &dss_bus_type; |
761 | dssdriver->driver.probe = dss_driver_probe; | 812 | dssdriver->driver.probe = dss_driver_probe; |
762 | dssdriver->driver.remove = dss_driver_remove; | 813 | dssdriver->driver.remove = dss_driver_remove; |
814 | |||
815 | if (dssdriver->get_resolution == NULL) | ||
816 | dssdriver->get_resolution = omapdss_default_get_resolution; | ||
817 | if (dssdriver->get_recommended_bpp == NULL) | ||
818 | dssdriver->get_recommended_bpp = | ||
819 | omapdss_default_get_recommended_bpp; | ||
820 | |||
763 | return driver_register(&dssdriver->driver); | 821 | return driver_register(&dssdriver->driver); |
764 | } | 822 | } |
765 | EXPORT_SYMBOL(omap_dss_register_driver); | 823 | EXPORT_SYMBOL(omap_dss_register_driver); |
@@ -808,8 +866,6 @@ static void omap_dss_dev_release(struct device *dev) | |||
808 | int omap_dss_register_device(struct omap_dss_device *dssdev) | 866 | int omap_dss_register_device(struct omap_dss_device *dssdev) |
809 | { | 867 | { |
810 | static int dev_num; | 868 | static int dev_num; |
811 | static int panel_num; | ||
812 | int r; | ||
813 | 869 | ||
814 | WARN_ON(!dssdev->driver_name); | 870 | WARN_ON(!dssdev->driver_name); |
815 | 871 | ||
@@ -818,36 +874,12 @@ int omap_dss_register_device(struct omap_dss_device *dssdev) | |||
818 | dssdev->dev.parent = &dss_bus; | 874 | dssdev->dev.parent = &dss_bus; |
819 | dssdev->dev.release = omap_dss_dev_release; | 875 | dssdev->dev.release = omap_dss_dev_release; |
820 | dev_set_name(&dssdev->dev, "display%d", dev_num++); | 876 | dev_set_name(&dssdev->dev, "display%d", dev_num++); |
821 | r = device_register(&dssdev->dev); | 877 | return device_register(&dssdev->dev); |
822 | if (r) | ||
823 | return r; | ||
824 | |||
825 | if (dssdev->ctrl.panel) { | ||
826 | struct omap_dss_device *panel = dssdev->ctrl.panel; | ||
827 | |||
828 | panel->panel.ctrl = dssdev; | ||
829 | |||
830 | reset_device(&panel->dev, 1); | ||
831 | panel->dev.bus = &dss_bus_type; | ||
832 | panel->dev.parent = &dssdev->dev; | ||
833 | panel->dev.release = omap_dss_dev_release; | ||
834 | dev_set_name(&panel->dev, "panel%d", panel_num++); | ||
835 | r = device_register(&panel->dev); | ||
836 | if (r) | ||
837 | return r; | ||
838 | } | ||
839 | |||
840 | return 0; | ||
841 | } | 878 | } |
842 | 879 | ||
843 | void omap_dss_unregister_device(struct omap_dss_device *dssdev) | 880 | void omap_dss_unregister_device(struct omap_dss_device *dssdev) |
844 | { | 881 | { |
845 | device_unregister(&dssdev->dev); | 882 | device_unregister(&dssdev->dev); |
846 | |||
847 | if (dssdev->ctrl.panel) { | ||
848 | struct omap_dss_device *panel = dssdev->ctrl.panel; | ||
849 | device_unregister(&panel->dev); | ||
850 | } | ||
851 | } | 883 | } |
852 | 884 | ||
853 | /* BUS */ | 885 | /* BUS */ |
@@ -901,6 +933,21 @@ static int __init omap_dss_init(void) | |||
901 | 933 | ||
902 | static void __exit omap_dss_exit(void) | 934 | static void __exit omap_dss_exit(void) |
903 | { | 935 | { |
936 | if (core.vdds_dsi_reg != NULL) { | ||
937 | regulator_put(core.vdds_dsi_reg); | ||
938 | core.vdds_dsi_reg = NULL; | ||
939 | } | ||
940 | |||
941 | if (core.vdds_sdi_reg != NULL) { | ||
942 | regulator_put(core.vdds_sdi_reg); | ||
943 | core.vdds_sdi_reg = NULL; | ||
944 | } | ||
945 | |||
946 | if (core.vdda_dac_reg != NULL) { | ||
947 | regulator_put(core.vdda_dac_reg); | ||
948 | core.vdda_dac_reg = NULL; | ||
949 | } | ||
950 | |||
904 | platform_driver_unregister(&omap_dss_driver); | 951 | platform_driver_unregister(&omap_dss_driver); |
905 | 952 | ||
906 | omap_dss_bus_unregister(); | 953 | omap_dss_bus_unregister(); |
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index de8bfbac9e26..e777e352dbcd 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
@@ -1725,7 +1725,7 @@ static void _enable_lcd_out(bool enable) | |||
1725 | REG_FLD_MOD(DISPC_CONTROL, enable ? 1 : 0, 0, 0); | 1725 | REG_FLD_MOD(DISPC_CONTROL, enable ? 1 : 0, 0, 0); |
1726 | } | 1726 | } |
1727 | 1727 | ||
1728 | void dispc_enable_lcd_out(bool enable) | 1728 | static void dispc_enable_lcd_out(bool enable) |
1729 | { | 1729 | { |
1730 | struct completion frame_done_completion; | 1730 | struct completion frame_done_completion; |
1731 | bool is_on; | 1731 | bool is_on; |
@@ -1772,7 +1772,7 @@ static void _enable_digit_out(bool enable) | |||
1772 | REG_FLD_MOD(DISPC_CONTROL, enable ? 1 : 0, 1, 1); | 1772 | REG_FLD_MOD(DISPC_CONTROL, enable ? 1 : 0, 1, 1); |
1773 | } | 1773 | } |
1774 | 1774 | ||
1775 | void dispc_enable_digit_out(bool enable) | 1775 | static void dispc_enable_digit_out(bool enable) |
1776 | { | 1776 | { |
1777 | struct completion frame_done_completion; | 1777 | struct completion frame_done_completion; |
1778 | int r; | 1778 | int r; |
@@ -1836,6 +1836,26 @@ void dispc_enable_digit_out(bool enable) | |||
1836 | enable_clocks(0); | 1836 | enable_clocks(0); |
1837 | } | 1837 | } |
1838 | 1838 | ||
1839 | bool dispc_is_channel_enabled(enum omap_channel channel) | ||
1840 | { | ||
1841 | if (channel == OMAP_DSS_CHANNEL_LCD) | ||
1842 | return !!REG_GET(DISPC_CONTROL, 0, 0); | ||
1843 | else if (channel == OMAP_DSS_CHANNEL_DIGIT) | ||
1844 | return !!REG_GET(DISPC_CONTROL, 1, 1); | ||
1845 | else | ||
1846 | BUG(); | ||
1847 | } | ||
1848 | |||
1849 | void dispc_enable_channel(enum omap_channel channel, bool enable) | ||
1850 | { | ||
1851 | if (channel == OMAP_DSS_CHANNEL_LCD) | ||
1852 | dispc_enable_lcd_out(enable); | ||
1853 | else if (channel == OMAP_DSS_CHANNEL_DIGIT) | ||
1854 | dispc_enable_digit_out(enable); | ||
1855 | else | ||
1856 | BUG(); | ||
1857 | } | ||
1858 | |||
1839 | void dispc_lcd_enable_signal_polarity(bool act_high) | 1859 | void dispc_lcd_enable_signal_polarity(bool act_high) |
1840 | { | 1860 | { |
1841 | enable_clocks(1); | 1861 | enable_clocks(1); |
@@ -2198,7 +2218,7 @@ unsigned long dispc_fclk_rate(void) | |||
2198 | { | 2218 | { |
2199 | unsigned long r = 0; | 2219 | unsigned long r = 0; |
2200 | 2220 | ||
2201 | if (dss_get_dispc_clk_source() == 0) | 2221 | if (dss_get_dispc_clk_source() == DSS_SRC_DSS1_ALWON_FCLK) |
2202 | r = dss_clk_get_rate(DSS_CLK_FCK1); | 2222 | r = dss_clk_get_rate(DSS_CLK_FCK1); |
2203 | else | 2223 | else |
2204 | #ifdef CONFIG_OMAP2_DSS_DSI | 2224 | #ifdef CONFIG_OMAP2_DSS_DSI |
@@ -2251,7 +2271,7 @@ void dispc_dump_clocks(struct seq_file *s) | |||
2251 | seq_printf(s, "- DISPC -\n"); | 2271 | seq_printf(s, "- DISPC -\n"); |
2252 | 2272 | ||
2253 | seq_printf(s, "dispc fclk source = %s\n", | 2273 | seq_printf(s, "dispc fclk source = %s\n", |
2254 | dss_get_dispc_clk_source() == 0 ? | 2274 | dss_get_dispc_clk_source() == DSS_SRC_DSS1_ALWON_FCLK ? |
2255 | "dss1_alwon_fclk" : "dsi1_pll_fclk"); | 2275 | "dss1_alwon_fclk" : "dsi1_pll_fclk"); |
2256 | 2276 | ||
2257 | seq_printf(s, "fck\t\t%-16lu\n", dispc_fclk_rate()); | 2277 | seq_printf(s, "fck\t\t%-16lu\n", dispc_fclk_rate()); |
@@ -2301,8 +2321,6 @@ void dispc_dump_irqs(struct seq_file *s) | |||
2301 | PIS(WAKEUP); | 2321 | PIS(WAKEUP); |
2302 | #undef PIS | 2322 | #undef PIS |
2303 | } | 2323 | } |
2304 | #else | ||
2305 | void dispc_dump_irqs(struct seq_file *s) { } | ||
2306 | #endif | 2324 | #endif |
2307 | 2325 | ||
2308 | void dispc_dump_regs(struct seq_file *s) | 2326 | void dispc_dump_regs(struct seq_file *s) |
@@ -2854,12 +2872,13 @@ static void dispc_error_worker(struct work_struct *work) | |||
2854 | manager = mgr; | 2872 | manager = mgr; |
2855 | enable = mgr->device->state == | 2873 | enable = mgr->device->state == |
2856 | OMAP_DSS_DISPLAY_ACTIVE; | 2874 | OMAP_DSS_DISPLAY_ACTIVE; |
2857 | mgr->device->disable(mgr->device); | 2875 | mgr->device->driver->disable(mgr->device); |
2858 | break; | 2876 | break; |
2859 | } | 2877 | } |
2860 | } | 2878 | } |
2861 | 2879 | ||
2862 | if (manager) { | 2880 | if (manager) { |
2881 | struct omap_dss_device *dssdev = manager->device; | ||
2863 | for (i = 0; i < omap_dss_get_num_overlays(); ++i) { | 2882 | for (i = 0; i < omap_dss_get_num_overlays(); ++i) { |
2864 | struct omap_overlay *ovl; | 2883 | struct omap_overlay *ovl; |
2865 | ovl = omap_dss_get_overlay(i); | 2884 | ovl = omap_dss_get_overlay(i); |
@@ -2874,7 +2893,7 @@ static void dispc_error_worker(struct work_struct *work) | |||
2874 | dispc_go(manager->id); | 2893 | dispc_go(manager->id); |
2875 | mdelay(50); | 2894 | mdelay(50); |
2876 | if (enable) | 2895 | if (enable) |
2877 | manager->device->enable(manager->device); | 2896 | dssdev->driver->enable(dssdev); |
2878 | } | 2897 | } |
2879 | } | 2898 | } |
2880 | 2899 | ||
@@ -2892,12 +2911,13 @@ static void dispc_error_worker(struct work_struct *work) | |||
2892 | manager = mgr; | 2911 | manager = mgr; |
2893 | enable = mgr->device->state == | 2912 | enable = mgr->device->state == |
2894 | OMAP_DSS_DISPLAY_ACTIVE; | 2913 | OMAP_DSS_DISPLAY_ACTIVE; |
2895 | mgr->device->disable(mgr->device); | 2914 | mgr->device->driver->disable(mgr->device); |
2896 | break; | 2915 | break; |
2897 | } | 2916 | } |
2898 | } | 2917 | } |
2899 | 2918 | ||
2900 | if (manager) { | 2919 | if (manager) { |
2920 | struct omap_dss_device *dssdev = manager->device; | ||
2901 | for (i = 0; i < omap_dss_get_num_overlays(); ++i) { | 2921 | for (i = 0; i < omap_dss_get_num_overlays(); ++i) { |
2902 | struct omap_overlay *ovl; | 2922 | struct omap_overlay *ovl; |
2903 | ovl = omap_dss_get_overlay(i); | 2923 | ovl = omap_dss_get_overlay(i); |
@@ -2912,7 +2932,7 @@ static void dispc_error_worker(struct work_struct *work) | |||
2912 | dispc_go(manager->id); | 2932 | dispc_go(manager->id); |
2913 | mdelay(50); | 2933 | mdelay(50); |
2914 | if (enable) | 2934 | if (enable) |
2915 | manager->device->enable(manager->device); | 2935 | dssdev->driver->enable(dssdev); |
2916 | } | 2936 | } |
2917 | } | 2937 | } |
2918 | 2938 | ||
@@ -2923,7 +2943,7 @@ static void dispc_error_worker(struct work_struct *work) | |||
2923 | mgr = omap_dss_get_overlay_manager(i); | 2943 | mgr = omap_dss_get_overlay_manager(i); |
2924 | 2944 | ||
2925 | if (mgr->caps & OMAP_DSS_OVL_CAP_DISPC) | 2945 | if (mgr->caps & OMAP_DSS_OVL_CAP_DISPC) |
2926 | mgr->device->disable(mgr->device); | 2946 | mgr->device->driver->disable(mgr->device); |
2927 | } | 2947 | } |
2928 | } | 2948 | } |
2929 | 2949 | ||
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c index 3b92b84b9560..6a74ea116d29 100644 --- a/drivers/video/omap2/dss/display.c +++ b/drivers/video/omap2/dss/display.c | |||
@@ -53,11 +53,11 @@ static ssize_t display_enabled_store(struct device *dev, | |||
53 | 53 | ||
54 | if (enabled != (dssdev->state != OMAP_DSS_DISPLAY_DISABLED)) { | 54 | if (enabled != (dssdev->state != OMAP_DSS_DISPLAY_DISABLED)) { |
55 | if (enabled) { | 55 | if (enabled) { |
56 | r = dssdev->enable(dssdev); | 56 | r = dssdev->driver->enable(dssdev); |
57 | if (r) | 57 | if (r) |
58 | return r; | 58 | return r; |
59 | } else { | 59 | } else { |
60 | dssdev->disable(dssdev); | 60 | dssdev->driver->disable(dssdev); |
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
@@ -69,8 +69,8 @@ static ssize_t display_upd_mode_show(struct device *dev, | |||
69 | { | 69 | { |
70 | struct omap_dss_device *dssdev = to_dss_device(dev); | 70 | struct omap_dss_device *dssdev = to_dss_device(dev); |
71 | enum omap_dss_update_mode mode = OMAP_DSS_UPDATE_AUTO; | 71 | enum omap_dss_update_mode mode = OMAP_DSS_UPDATE_AUTO; |
72 | if (dssdev->get_update_mode) | 72 | if (dssdev->driver->get_update_mode) |
73 | mode = dssdev->get_update_mode(dssdev); | 73 | mode = dssdev->driver->get_update_mode(dssdev); |
74 | return snprintf(buf, PAGE_SIZE, "%d\n", mode); | 74 | return snprintf(buf, PAGE_SIZE, "%d\n", mode); |
75 | } | 75 | } |
76 | 76 | ||
@@ -94,7 +94,7 @@ static ssize_t display_upd_mode_store(struct device *dev, | |||
94 | return -EINVAL; | 94 | return -EINVAL; |
95 | } | 95 | } |
96 | 96 | ||
97 | r = dssdev->set_update_mode(dssdev, mode); | 97 | r = dssdev->driver->set_update_mode(dssdev, mode); |
98 | if (r) | 98 | if (r) |
99 | return r; | 99 | return r; |
100 | 100 | ||
@@ -106,7 +106,8 @@ static ssize_t display_tear_show(struct device *dev, | |||
106 | { | 106 | { |
107 | struct omap_dss_device *dssdev = to_dss_device(dev); | 107 | struct omap_dss_device *dssdev = to_dss_device(dev); |
108 | return snprintf(buf, PAGE_SIZE, "%d\n", | 108 | return snprintf(buf, PAGE_SIZE, "%d\n", |
109 | dssdev->get_te ? dssdev->get_te(dssdev) : 0); | 109 | dssdev->driver->get_te ? |
110 | dssdev->driver->get_te(dssdev) : 0); | ||
110 | } | 111 | } |
111 | 112 | ||
112 | static ssize_t display_tear_store(struct device *dev, | 113 | static ssize_t display_tear_store(struct device *dev, |
@@ -116,12 +117,12 @@ static ssize_t display_tear_store(struct device *dev, | |||
116 | unsigned long te; | 117 | unsigned long te; |
117 | int r; | 118 | int r; |
118 | 119 | ||
119 | if (!dssdev->enable_te || !dssdev->get_te) | 120 | if (!dssdev->driver->enable_te || !dssdev->driver->get_te) |
120 | return -ENOENT; | 121 | return -ENOENT; |
121 | 122 | ||
122 | te = simple_strtoul(buf, NULL, 0); | 123 | te = simple_strtoul(buf, NULL, 0); |
123 | 124 | ||
124 | r = dssdev->enable_te(dssdev, te); | 125 | r = dssdev->driver->enable_te(dssdev, te); |
125 | if (r) | 126 | if (r) |
126 | return r; | 127 | return r; |
127 | 128 | ||
@@ -134,10 +135,10 @@ static ssize_t display_timings_show(struct device *dev, | |||
134 | struct omap_dss_device *dssdev = to_dss_device(dev); | 135 | struct omap_dss_device *dssdev = to_dss_device(dev); |
135 | struct omap_video_timings t; | 136 | struct omap_video_timings t; |
136 | 137 | ||
137 | if (!dssdev->get_timings) | 138 | if (!dssdev->driver->get_timings) |
138 | return -ENOENT; | 139 | return -ENOENT; |
139 | 140 | ||
140 | dssdev->get_timings(dssdev, &t); | 141 | dssdev->driver->get_timings(dssdev, &t); |
141 | 142 | ||
142 | return snprintf(buf, PAGE_SIZE, "%u,%u/%u/%u/%u,%u/%u/%u/%u\n", | 143 | return snprintf(buf, PAGE_SIZE, "%u,%u/%u/%u/%u,%u/%u/%u/%u\n", |
143 | t.pixel_clock, | 144 | t.pixel_clock, |
@@ -152,7 +153,7 @@ static ssize_t display_timings_store(struct device *dev, | |||
152 | struct omap_video_timings t; | 153 | struct omap_video_timings t; |
153 | int r, found; | 154 | int r, found; |
154 | 155 | ||
155 | if (!dssdev->set_timings || !dssdev->check_timings) | 156 | if (!dssdev->driver->set_timings || !dssdev->driver->check_timings) |
156 | return -ENOENT; | 157 | return -ENOENT; |
157 | 158 | ||
158 | found = 0; | 159 | found = 0; |
@@ -171,11 +172,11 @@ static ssize_t display_timings_store(struct device *dev, | |||
171 | &t.y_res, &t.vfp, &t.vbp, &t.vsw) != 9) | 172 | &t.y_res, &t.vfp, &t.vbp, &t.vsw) != 9) |
172 | return -EINVAL; | 173 | return -EINVAL; |
173 | 174 | ||
174 | r = dssdev->check_timings(dssdev, &t); | 175 | r = dssdev->driver->check_timings(dssdev, &t); |
175 | if (r) | 176 | if (r) |
176 | return r; | 177 | return r; |
177 | 178 | ||
178 | dssdev->set_timings(dssdev, &t); | 179 | dssdev->driver->set_timings(dssdev, &t); |
179 | 180 | ||
180 | return size; | 181 | return size; |
181 | } | 182 | } |
@@ -185,9 +186,9 @@ static ssize_t display_rotate_show(struct device *dev, | |||
185 | { | 186 | { |
186 | struct omap_dss_device *dssdev = to_dss_device(dev); | 187 | struct omap_dss_device *dssdev = to_dss_device(dev); |
187 | int rotate; | 188 | int rotate; |
188 | if (!dssdev->get_rotate) | 189 | if (!dssdev->driver->get_rotate) |
189 | return -ENOENT; | 190 | return -ENOENT; |
190 | rotate = dssdev->get_rotate(dssdev); | 191 | rotate = dssdev->driver->get_rotate(dssdev); |
191 | return snprintf(buf, PAGE_SIZE, "%u\n", rotate); | 192 | return snprintf(buf, PAGE_SIZE, "%u\n", rotate); |
192 | } | 193 | } |
193 | 194 | ||
@@ -198,12 +199,12 @@ static ssize_t display_rotate_store(struct device *dev, | |||
198 | unsigned long rot; | 199 | unsigned long rot; |
199 | int r; | 200 | int r; |
200 | 201 | ||
201 | if (!dssdev->set_rotate || !dssdev->get_rotate) | 202 | if (!dssdev->driver->set_rotate || !dssdev->driver->get_rotate) |
202 | return -ENOENT; | 203 | return -ENOENT; |
203 | 204 | ||
204 | rot = simple_strtoul(buf, NULL, 0); | 205 | rot = simple_strtoul(buf, NULL, 0); |
205 | 206 | ||
206 | r = dssdev->set_rotate(dssdev, rot); | 207 | r = dssdev->driver->set_rotate(dssdev, rot); |
207 | if (r) | 208 | if (r) |
208 | return r; | 209 | return r; |
209 | 210 | ||
@@ -215,9 +216,9 @@ static ssize_t display_mirror_show(struct device *dev, | |||
215 | { | 216 | { |
216 | struct omap_dss_device *dssdev = to_dss_device(dev); | 217 | struct omap_dss_device *dssdev = to_dss_device(dev); |
217 | int mirror; | 218 | int mirror; |
218 | if (!dssdev->get_mirror) | 219 | if (!dssdev->driver->get_mirror) |
219 | return -ENOENT; | 220 | return -ENOENT; |
220 | mirror = dssdev->get_mirror(dssdev); | 221 | mirror = dssdev->driver->get_mirror(dssdev); |
221 | return snprintf(buf, PAGE_SIZE, "%u\n", mirror); | 222 | return snprintf(buf, PAGE_SIZE, "%u\n", mirror); |
222 | } | 223 | } |
223 | 224 | ||
@@ -228,12 +229,12 @@ static ssize_t display_mirror_store(struct device *dev, | |||
228 | unsigned long mirror; | 229 | unsigned long mirror; |
229 | int r; | 230 | int r; |
230 | 231 | ||
231 | if (!dssdev->set_mirror || !dssdev->get_mirror) | 232 | if (!dssdev->driver->set_mirror || !dssdev->driver->get_mirror) |
232 | return -ENOENT; | 233 | return -ENOENT; |
233 | 234 | ||
234 | mirror = simple_strtoul(buf, NULL, 0); | 235 | mirror = simple_strtoul(buf, NULL, 0); |
235 | 236 | ||
236 | r = dssdev->set_mirror(dssdev, mirror); | 237 | r = dssdev->driver->set_mirror(dssdev, mirror); |
237 | if (r) | 238 | if (r) |
238 | return r; | 239 | return r; |
239 | 240 | ||
@@ -246,10 +247,10 @@ static ssize_t display_wss_show(struct device *dev, | |||
246 | struct omap_dss_device *dssdev = to_dss_device(dev); | 247 | struct omap_dss_device *dssdev = to_dss_device(dev); |
247 | unsigned int wss; | 248 | unsigned int wss; |
248 | 249 | ||
249 | if (!dssdev->get_wss) | 250 | if (!dssdev->driver->get_wss) |
250 | return -ENOENT; | 251 | return -ENOENT; |
251 | 252 | ||
252 | wss = dssdev->get_wss(dssdev); | 253 | wss = dssdev->driver->get_wss(dssdev); |
253 | 254 | ||
254 | return snprintf(buf, PAGE_SIZE, "0x%05x\n", wss); | 255 | return snprintf(buf, PAGE_SIZE, "0x%05x\n", wss); |
255 | } | 256 | } |
@@ -261,7 +262,7 @@ static ssize_t display_wss_store(struct device *dev, | |||
261 | unsigned long wss; | 262 | unsigned long wss; |
262 | int r; | 263 | int r; |
263 | 264 | ||
264 | if (!dssdev->get_wss || !dssdev->set_wss) | 265 | if (!dssdev->driver->get_wss || !dssdev->driver->set_wss) |
265 | return -ENOENT; | 266 | return -ENOENT; |
266 | 267 | ||
267 | if (strict_strtoul(buf, 0, &wss)) | 268 | if (strict_strtoul(buf, 0, &wss)) |
@@ -270,7 +271,7 @@ static ssize_t display_wss_store(struct device *dev, | |||
270 | if (wss > 0xfffff) | 271 | if (wss > 0xfffff) |
271 | return -EINVAL; | 272 | return -EINVAL; |
272 | 273 | ||
273 | r = dssdev->set_wss(dssdev, wss); | 274 | r = dssdev->driver->set_wss(dssdev, wss); |
274 | if (r) | 275 | if (r) |
275 | return r; | 276 | return r; |
276 | 277 | ||
@@ -303,12 +304,13 @@ static struct device_attribute *display_sysfs_attrs[] = { | |||
303 | NULL | 304 | NULL |
304 | }; | 305 | }; |
305 | 306 | ||
306 | static void default_get_resolution(struct omap_dss_device *dssdev, | 307 | void omapdss_default_get_resolution(struct omap_dss_device *dssdev, |
307 | u16 *xres, u16 *yres) | 308 | u16 *xres, u16 *yres) |
308 | { | 309 | { |
309 | *xres = dssdev->panel.timings.x_res; | 310 | *xres = dssdev->panel.timings.x_res; |
310 | *yres = dssdev->panel.timings.y_res; | 311 | *yres = dssdev->panel.timings.y_res; |
311 | } | 312 | } |
313 | EXPORT_SYMBOL(omapdss_default_get_resolution); | ||
312 | 314 | ||
313 | void default_get_overlay_fifo_thresholds(enum omap_plane plane, | 315 | void default_get_overlay_fifo_thresholds(enum omap_plane plane, |
314 | u32 fifo_size, enum omap_burst_size *burst_size, | 316 | u32 fifo_size, enum omap_burst_size *burst_size, |
@@ -323,24 +325,8 @@ void default_get_overlay_fifo_thresholds(enum omap_plane plane, | |||
323 | *fifo_low = fifo_size - burst_size_bytes; | 325 | *fifo_low = fifo_size - burst_size_bytes; |
324 | } | 326 | } |
325 | 327 | ||
326 | static int default_wait_vsync(struct omap_dss_device *dssdev) | 328 | int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev) |
327 | { | 329 | { |
328 | unsigned long timeout = msecs_to_jiffies(500); | ||
329 | u32 irq; | ||
330 | |||
331 | if (dssdev->type == OMAP_DISPLAY_TYPE_VENC) | ||
332 | irq = DISPC_IRQ_EVSYNC_ODD; | ||
333 | else | ||
334 | irq = DISPC_IRQ_VSYNC; | ||
335 | |||
336 | return omap_dispc_wait_for_irq_interruptible_timeout(irq, timeout); | ||
337 | } | ||
338 | |||
339 | static int default_get_recommended_bpp(struct omap_dss_device *dssdev) | ||
340 | { | ||
341 | if (dssdev->panel.recommended_bpp) | ||
342 | return dssdev->panel.recommended_bpp; | ||
343 | |||
344 | switch (dssdev->type) { | 330 | switch (dssdev->type) { |
345 | case OMAP_DISPLAY_TYPE_DPI: | 331 | case OMAP_DISPLAY_TYPE_DPI: |
346 | if (dssdev->phy.dpi.data_lines == 24) | 332 | if (dssdev->phy.dpi.data_lines == 24) |
@@ -362,6 +348,7 @@ static int default_get_recommended_bpp(struct omap_dss_device *dssdev) | |||
362 | BUG(); | 348 | BUG(); |
363 | } | 349 | } |
364 | } | 350 | } |
351 | EXPORT_SYMBOL(omapdss_default_get_recommended_bpp); | ||
365 | 352 | ||
366 | /* Checks if replication logic should be used. Only use for active matrix, | 353 | /* Checks if replication logic should be used. Only use for active matrix, |
367 | * when overlay is in RGB12U or RGB16 mode, and LCD interface is | 354 | * when overlay is in RGB12U or RGB16 mode, and LCD interface is |
@@ -425,10 +412,6 @@ void dss_init_device(struct platform_device *pdev, | |||
425 | return; | 412 | return; |
426 | } | 413 | } |
427 | 414 | ||
428 | dssdev->get_resolution = default_get_resolution; | ||
429 | dssdev->get_recommended_bpp = default_get_recommended_bpp; | ||
430 | dssdev->wait_vsync = default_wait_vsync; | ||
431 | |||
432 | switch (dssdev->type) { | 415 | switch (dssdev->type) { |
433 | case OMAP_DISPLAY_TYPE_DPI: | 416 | case OMAP_DISPLAY_TYPE_DPI: |
434 | r = dpi_init_display(dssdev); | 417 | r = dpi_init_display(dssdev); |
@@ -502,13 +485,13 @@ static int dss_suspend_device(struct device *dev, void *data) | |||
502 | return 0; | 485 | return 0; |
503 | } | 486 | } |
504 | 487 | ||
505 | if (!dssdev->suspend) { | 488 | if (!dssdev->driver->suspend) { |
506 | DSSERR("display '%s' doesn't implement suspend\n", | 489 | DSSERR("display '%s' doesn't implement suspend\n", |
507 | dssdev->name); | 490 | dssdev->name); |
508 | return -ENOSYS; | 491 | return -ENOSYS; |
509 | } | 492 | } |
510 | 493 | ||
511 | r = dssdev->suspend(dssdev); | 494 | r = dssdev->driver->suspend(dssdev); |
512 | if (r) | 495 | if (r) |
513 | return r; | 496 | return r; |
514 | 497 | ||
@@ -537,8 +520,8 @@ static int dss_resume_device(struct device *dev, void *data) | |||
537 | int r; | 520 | int r; |
538 | struct omap_dss_device *dssdev = to_dss_device(dev); | 521 | struct omap_dss_device *dssdev = to_dss_device(dev); |
539 | 522 | ||
540 | if (dssdev->activate_after_resume && dssdev->resume) { | 523 | if (dssdev->activate_after_resume && dssdev->driver->resume) { |
541 | r = dssdev->resume(dssdev); | 524 | r = dssdev->driver->resume(dssdev); |
542 | if (r) | 525 | if (r) |
543 | return r; | 526 | return r; |
544 | } | 527 | } |
@@ -558,7 +541,7 @@ int dss_resume_all_devices(void) | |||
558 | static int dss_disable_device(struct device *dev, void *data) | 541 | static int dss_disable_device(struct device *dev, void *data) |
559 | { | 542 | { |
560 | struct omap_dss_device *dssdev = to_dss_device(dev); | 543 | struct omap_dss_device *dssdev = to_dss_device(dev); |
561 | dssdev->disable(dssdev); | 544 | dssdev->driver->disable(dssdev); |
562 | return 0; | 545 | return 0; |
563 | } | 546 | } |
564 | 547 | ||
@@ -591,10 +574,6 @@ struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from) | |||
591 | 574 | ||
592 | int match(struct device *dev, void *data) | 575 | int match(struct device *dev, void *data) |
593 | { | 576 | { |
594 | /* skip panels connected to controllers */ | ||
595 | if (to_dss_device(dev)->panel.ctrl) | ||
596 | return 0; | ||
597 | |||
598 | return 1; | 577 | return 1; |
599 | } | 578 | } |
600 | 579 | ||
@@ -626,45 +605,21 @@ EXPORT_SYMBOL(omap_dss_find_device); | |||
626 | 605 | ||
627 | int omap_dss_start_device(struct omap_dss_device *dssdev) | 606 | int omap_dss_start_device(struct omap_dss_device *dssdev) |
628 | { | 607 | { |
629 | int r; | ||
630 | |||
631 | if (!dssdev->driver) { | 608 | if (!dssdev->driver) { |
632 | DSSDBG("no driver\n"); | 609 | DSSDBG("no driver\n"); |
633 | r = -ENODEV; | 610 | return -ENODEV; |
634 | goto err0; | ||
635 | } | ||
636 | |||
637 | if (dssdev->ctrl.panel && !dssdev->ctrl.panel->driver) { | ||
638 | DSSDBG("no panel driver\n"); | ||
639 | r = -ENODEV; | ||
640 | goto err0; | ||
641 | } | 611 | } |
642 | 612 | ||
643 | if (!try_module_get(dssdev->dev.driver->owner)) { | 613 | if (!try_module_get(dssdev->dev.driver->owner)) { |
644 | r = -ENODEV; | 614 | return -ENODEV; |
645 | goto err0; | ||
646 | } | ||
647 | |||
648 | if (dssdev->ctrl.panel) { | ||
649 | if (!try_module_get(dssdev->ctrl.panel->dev.driver->owner)) { | ||
650 | r = -ENODEV; | ||
651 | goto err1; | ||
652 | } | ||
653 | } | 615 | } |
654 | 616 | ||
655 | return 0; | 617 | return 0; |
656 | err1: | ||
657 | module_put(dssdev->dev.driver->owner); | ||
658 | err0: | ||
659 | return r; | ||
660 | } | 618 | } |
661 | EXPORT_SYMBOL(omap_dss_start_device); | 619 | EXPORT_SYMBOL(omap_dss_start_device); |
662 | 620 | ||
663 | void omap_dss_stop_device(struct omap_dss_device *dssdev) | 621 | void omap_dss_stop_device(struct omap_dss_device *dssdev) |
664 | { | 622 | { |
665 | if (dssdev->ctrl.panel) | ||
666 | module_put(dssdev->ctrl.panel->dev.driver->owner); | ||
667 | |||
668 | module_put(dssdev->dev.driver->owner); | 623 | module_put(dssdev->dev.driver->owner); |
669 | } | 624 | } |
670 | EXPORT_SYMBOL(omap_dss_stop_device); | 625 | EXPORT_SYMBOL(omap_dss_stop_device); |
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index 2d71031baa25..960e977a8bf0 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c | |||
@@ -25,7 +25,10 @@ | |||
25 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
26 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
28 | #include <linux/err.h> | ||
28 | #include <linux/errno.h> | 29 | #include <linux/errno.h> |
30 | #include <linux/platform_device.h> | ||
31 | #include <linux/regulator/consumer.h> | ||
29 | 32 | ||
30 | #include <plat/display.h> | 33 | #include <plat/display.h> |
31 | #include <plat/cpu.h> | 34 | #include <plat/cpu.h> |
@@ -33,7 +36,7 @@ | |||
33 | #include "dss.h" | 36 | #include "dss.h" |
34 | 37 | ||
35 | static struct { | 38 | static struct { |
36 | int update_enabled; | 39 | struct regulator *vdds_dsi_reg; |
37 | } dpi; | 40 | } dpi; |
38 | 41 | ||
39 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL | 42 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL |
@@ -53,7 +56,7 @@ static int dpi_set_dsi_clk(bool is_tft, unsigned long pck_req, | |||
53 | if (r) | 56 | if (r) |
54 | return r; | 57 | return r; |
55 | 58 | ||
56 | dss_select_clk_source(0, 1); | 59 | dss_select_dispc_clk_source(DSS_SRC_DSI1_PLL_FCLK); |
57 | 60 | ||
58 | r = dispc_set_clock_div(&dispc_cinfo); | 61 | r = dispc_set_clock_div(&dispc_cinfo); |
59 | if (r) | 62 | if (r) |
@@ -150,7 +153,7 @@ static int dpi_basic_init(struct omap_dss_device *dssdev) | |||
150 | return 0; | 153 | return 0; |
151 | } | 154 | } |
152 | 155 | ||
153 | static int dpi_display_enable(struct omap_dss_device *dssdev) | 156 | int omapdss_dpi_display_enable(struct omap_dss_device *dssdev) |
154 | { | 157 | { |
155 | int r; | 158 | int r; |
156 | 159 | ||
@@ -160,10 +163,10 @@ static int dpi_display_enable(struct omap_dss_device *dssdev) | |||
160 | goto err0; | 163 | goto err0; |
161 | } | 164 | } |
162 | 165 | ||
163 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { | 166 | if (cpu_is_omap34xx()) { |
164 | DSSERR("display already enabled\n"); | 167 | r = regulator_enable(dpi.vdds_dsi_reg); |
165 | r = -EINVAL; | 168 | if (r) |
166 | goto err1; | 169 | goto err1; |
167 | } | 170 | } |
168 | 171 | ||
169 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); | 172 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); |
@@ -184,18 +187,10 @@ static int dpi_display_enable(struct omap_dss_device *dssdev) | |||
184 | 187 | ||
185 | mdelay(2); | 188 | mdelay(2); |
186 | 189 | ||
187 | dispc_enable_lcd_out(1); | 190 | dssdev->manager->enable(dssdev->manager); |
188 | |||
189 | r = dssdev->driver->enable(dssdev); | ||
190 | if (r) | ||
191 | goto err5; | ||
192 | |||
193 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
194 | 191 | ||
195 | return 0; | 192 | return 0; |
196 | 193 | ||
197 | err5: | ||
198 | dispc_enable_lcd_out(0); | ||
199 | err4: | 194 | err4: |
200 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL | 195 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL |
201 | dsi_pll_uninit(); | 196 | dsi_pll_uninit(); |
@@ -204,78 +199,35 @@ err3: | |||
204 | #endif | 199 | #endif |
205 | err2: | 200 | err2: |
206 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); | 201 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); |
202 | if (cpu_is_omap34xx()) | ||
203 | regulator_disable(dpi.vdds_dsi_reg); | ||
207 | err1: | 204 | err1: |
208 | omap_dss_stop_device(dssdev); | 205 | omap_dss_stop_device(dssdev); |
209 | err0: | 206 | err0: |
210 | return r; | 207 | return r; |
211 | } | 208 | } |
209 | EXPORT_SYMBOL(omapdss_dpi_display_enable); | ||
212 | 210 | ||
213 | static int dpi_display_resume(struct omap_dss_device *dssdev); | 211 | void omapdss_dpi_display_disable(struct omap_dss_device *dssdev) |
214 | |||
215 | static void dpi_display_disable(struct omap_dss_device *dssdev) | ||
216 | { | 212 | { |
217 | if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED) | 213 | dssdev->manager->disable(dssdev->manager); |
218 | return; | ||
219 | |||
220 | if (dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) | ||
221 | dpi_display_resume(dssdev); | ||
222 | |||
223 | dssdev->driver->disable(dssdev); | ||
224 | |||
225 | dispc_enable_lcd_out(0); | ||
226 | 214 | ||
227 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL | 215 | #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL |
228 | dss_select_clk_source(0, 0); | 216 | dss_select_dispc_clk_source(DSS_SRC_DSS1_ALWON_FCLK); |
229 | dsi_pll_uninit(); | 217 | dsi_pll_uninit(); |
230 | dss_clk_disable(DSS_CLK_FCK2); | 218 | dss_clk_disable(DSS_CLK_FCK2); |
231 | #endif | 219 | #endif |
232 | 220 | ||
233 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); | 221 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); |
234 | 222 | ||
235 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | 223 | if (cpu_is_omap34xx()) |
224 | regulator_disable(dpi.vdds_dsi_reg); | ||
236 | 225 | ||
237 | omap_dss_stop_device(dssdev); | 226 | omap_dss_stop_device(dssdev); |
238 | } | 227 | } |
228 | EXPORT_SYMBOL(omapdss_dpi_display_disable); | ||
239 | 229 | ||
240 | static int dpi_display_suspend(struct omap_dss_device *dssdev) | 230 | void dpi_set_timings(struct omap_dss_device *dssdev, |
241 | { | ||
242 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) | ||
243 | return -EINVAL; | ||
244 | |||
245 | DSSDBG("dpi_display_suspend\n"); | ||
246 | |||
247 | if (dssdev->driver->suspend) | ||
248 | dssdev->driver->suspend(dssdev); | ||
249 | |||
250 | dispc_enable_lcd_out(0); | ||
251 | |||
252 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); | ||
253 | |||
254 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
255 | |||
256 | return 0; | ||
257 | } | ||
258 | |||
259 | static int dpi_display_resume(struct omap_dss_device *dssdev) | ||
260 | { | ||
261 | if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) | ||
262 | return -EINVAL; | ||
263 | |||
264 | DSSDBG("dpi_display_resume\n"); | ||
265 | |||
266 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); | ||
267 | |||
268 | dispc_enable_lcd_out(1); | ||
269 | |||
270 | if (dssdev->driver->resume) | ||
271 | dssdev->driver->resume(dssdev); | ||
272 | |||
273 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
274 | |||
275 | return 0; | ||
276 | } | ||
277 | |||
278 | static void dpi_set_timings(struct omap_dss_device *dssdev, | ||
279 | struct omap_video_timings *timings) | 231 | struct omap_video_timings *timings) |
280 | { | 232 | { |
281 | DSSDBG("dpi_set_timings\n"); | 233 | DSSDBG("dpi_set_timings\n"); |
@@ -285,8 +237,9 @@ static void dpi_set_timings(struct omap_dss_device *dssdev, | |||
285 | dispc_go(OMAP_DSS_CHANNEL_LCD); | 237 | dispc_go(OMAP_DSS_CHANNEL_LCD); |
286 | } | 238 | } |
287 | } | 239 | } |
240 | EXPORT_SYMBOL(dpi_set_timings); | ||
288 | 241 | ||
289 | static int dpi_check_timings(struct omap_dss_device *dssdev, | 242 | int dpi_check_timings(struct omap_dss_device *dssdev, |
290 | struct omap_video_timings *timings) | 243 | struct omap_video_timings *timings) |
291 | { | 244 | { |
292 | bool is_tft; | 245 | bool is_tft; |
@@ -340,56 +293,25 @@ static int dpi_check_timings(struct omap_dss_device *dssdev, | |||
340 | 293 | ||
341 | return 0; | 294 | return 0; |
342 | } | 295 | } |
343 | 296 | EXPORT_SYMBOL(dpi_check_timings); | |
344 | static void dpi_get_timings(struct omap_dss_device *dssdev, | ||
345 | struct omap_video_timings *timings) | ||
346 | { | ||
347 | *timings = dssdev->panel.timings; | ||
348 | } | ||
349 | |||
350 | static int dpi_display_set_update_mode(struct omap_dss_device *dssdev, | ||
351 | enum omap_dss_update_mode mode) | ||
352 | { | ||
353 | if (mode == OMAP_DSS_UPDATE_MANUAL) | ||
354 | return -EINVAL; | ||
355 | |||
356 | if (mode == OMAP_DSS_UPDATE_DISABLED) { | ||
357 | dispc_enable_lcd_out(0); | ||
358 | dpi.update_enabled = 0; | ||
359 | } else { | ||
360 | dispc_enable_lcd_out(1); | ||
361 | dpi.update_enabled = 1; | ||
362 | } | ||
363 | |||
364 | return 0; | ||
365 | } | ||
366 | |||
367 | static enum omap_dss_update_mode dpi_display_get_update_mode( | ||
368 | struct omap_dss_device *dssdev) | ||
369 | { | ||
370 | return dpi.update_enabled ? OMAP_DSS_UPDATE_AUTO : | ||
371 | OMAP_DSS_UPDATE_DISABLED; | ||
372 | } | ||
373 | 297 | ||
374 | int dpi_init_display(struct omap_dss_device *dssdev) | 298 | int dpi_init_display(struct omap_dss_device *dssdev) |
375 | { | 299 | { |
376 | DSSDBG("init_display\n"); | 300 | DSSDBG("init_display\n"); |
377 | 301 | ||
378 | dssdev->enable = dpi_display_enable; | ||
379 | dssdev->disable = dpi_display_disable; | ||
380 | dssdev->suspend = dpi_display_suspend; | ||
381 | dssdev->resume = dpi_display_resume; | ||
382 | dssdev->set_timings = dpi_set_timings; | ||
383 | dssdev->check_timings = dpi_check_timings; | ||
384 | dssdev->get_timings = dpi_get_timings; | ||
385 | dssdev->set_update_mode = dpi_display_set_update_mode; | ||
386 | dssdev->get_update_mode = dpi_display_get_update_mode; | ||
387 | |||
388 | return 0; | 302 | return 0; |
389 | } | 303 | } |
390 | 304 | ||
391 | int dpi_init(void) | 305 | int dpi_init(struct platform_device *pdev) |
392 | { | 306 | { |
307 | if (cpu_is_omap34xx()) { | ||
308 | dpi.vdds_dsi_reg = dss_get_vdds_dsi(); | ||
309 | if (IS_ERR(dpi.vdds_dsi_reg)) { | ||
310 | DSSERR("can't get VDDS_DSI regulator\n"); | ||
311 | return PTR_ERR(dpi.vdds_dsi_reg); | ||
312 | } | ||
313 | } | ||
314 | |||
393 | return 0; | 315 | return 0; |
394 | } | 316 | } |
395 | 317 | ||
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 6122178f5f85..3af207b2bde3 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
@@ -27,11 +27,12 @@ | |||
27 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/mutex.h> | 29 | #include <linux/mutex.h> |
30 | #include <linux/semaphore.h> | ||
30 | #include <linux/seq_file.h> | 31 | #include <linux/seq_file.h> |
31 | #include <linux/platform_device.h> | 32 | #include <linux/platform_device.h> |
32 | #include <linux/regulator/consumer.h> | 33 | #include <linux/regulator/consumer.h> |
33 | #include <linux/kthread.h> | ||
34 | #include <linux/wait.h> | 34 | #include <linux/wait.h> |
35 | #include <linux/workqueue.h> | ||
35 | 36 | ||
36 | #include <plat/display.h> | 37 | #include <plat/display.h> |
37 | #include <plat/clock.h> | 38 | #include <plat/clock.h> |
@@ -199,7 +200,6 @@ enum dsi_vc_mode { | |||
199 | }; | 200 | }; |
200 | 201 | ||
201 | struct dsi_update_region { | 202 | struct dsi_update_region { |
202 | bool dirty; | ||
203 | u16 x, y, w, h; | 203 | u16 x, y, w, h; |
204 | struct omap_dss_device *device; | 204 | struct omap_dss_device *device; |
205 | }; | 205 | }; |
@@ -224,29 +224,25 @@ static struct | |||
224 | enum dsi_vc_mode mode; | 224 | enum dsi_vc_mode mode; |
225 | struct omap_dss_device *dssdev; | 225 | struct omap_dss_device *dssdev; |
226 | enum fifo_size fifo_size; | 226 | enum fifo_size fifo_size; |
227 | int dest_per; /* destination peripheral 0-3 */ | ||
228 | } vc[4]; | 227 | } vc[4]; |
229 | 228 | ||
230 | struct mutex lock; | 229 | struct mutex lock; |
231 | struct mutex bus_lock; | 230 | struct semaphore bus_lock; |
232 | 231 | ||
233 | unsigned pll_locked; | 232 | unsigned pll_locked; |
234 | 233 | ||
235 | struct completion bta_completion; | 234 | struct completion bta_completion; |
236 | 235 | ||
237 | struct task_struct *thread; | 236 | int update_channel; |
238 | wait_queue_head_t waitqueue; | ||
239 | |||
240 | spinlock_t update_lock; | ||
241 | bool framedone_received; | ||
242 | struct dsi_update_region update_region; | 237 | struct dsi_update_region update_region; |
243 | struct dsi_update_region active_update_region; | ||
244 | struct completion update_completion; | ||
245 | 238 | ||
246 | enum omap_dss_update_mode user_update_mode; | ||
247 | enum omap_dss_update_mode update_mode; | ||
248 | bool te_enabled; | 239 | bool te_enabled; |
249 | bool use_ext_te; | 240 | |
241 | struct work_struct framedone_work; | ||
242 | void (*framedone_callback)(int, void *); | ||
243 | void *framedone_data; | ||
244 | |||
245 | struct delayed_work framedone_timeout_work; | ||
250 | 246 | ||
251 | #ifdef DSI_CATCH_MISSING_TE | 247 | #ifdef DSI_CATCH_MISSING_TE |
252 | struct timer_list te_timer; | 248 | struct timer_list te_timer; |
@@ -261,8 +257,6 @@ static struct | |||
261 | #ifdef DEBUG | 257 | #ifdef DEBUG |
262 | ktime_t perf_setup_time; | 258 | ktime_t perf_setup_time; |
263 | ktime_t perf_start_time; | 259 | ktime_t perf_start_time; |
264 | ktime_t perf_start_time_auto; | ||
265 | int perf_measure_frames; | ||
266 | #endif | 260 | #endif |
267 | int debug_read; | 261 | int debug_read; |
268 | int debug_write; | 262 | int debug_write; |
@@ -299,16 +293,21 @@ void dsi_restore_context(void) | |||
299 | 293 | ||
300 | void dsi_bus_lock(void) | 294 | void dsi_bus_lock(void) |
301 | { | 295 | { |
302 | mutex_lock(&dsi.bus_lock); | 296 | down(&dsi.bus_lock); |
303 | } | 297 | } |
304 | EXPORT_SYMBOL(dsi_bus_lock); | 298 | EXPORT_SYMBOL(dsi_bus_lock); |
305 | 299 | ||
306 | void dsi_bus_unlock(void) | 300 | void dsi_bus_unlock(void) |
307 | { | 301 | { |
308 | mutex_unlock(&dsi.bus_lock); | 302 | up(&dsi.bus_lock); |
309 | } | 303 | } |
310 | EXPORT_SYMBOL(dsi_bus_unlock); | 304 | EXPORT_SYMBOL(dsi_bus_unlock); |
311 | 305 | ||
306 | static bool dsi_bus_is_locked(void) | ||
307 | { | ||
308 | return dsi.bus_lock.count == 0; | ||
309 | } | ||
310 | |||
312 | static inline int wait_for_bit_change(const struct dsi_reg idx, int bitnum, | 311 | static inline int wait_for_bit_change(const struct dsi_reg idx, int bitnum, |
313 | int value) | 312 | int value) |
314 | { | 313 | { |
@@ -333,12 +332,6 @@ static void dsi_perf_mark_start(void) | |||
333 | dsi.perf_start_time = ktime_get(); | 332 | dsi.perf_start_time = ktime_get(); |
334 | } | 333 | } |
335 | 334 | ||
336 | static void dsi_perf_mark_start_auto(void) | ||
337 | { | ||
338 | dsi.perf_measure_frames = 0; | ||
339 | dsi.perf_start_time_auto = ktime_get(); | ||
340 | } | ||
341 | |||
342 | static void dsi_perf_show(const char *name) | 335 | static void dsi_perf_show(const char *name) |
343 | { | 336 | { |
344 | ktime_t t, setup_time, trans_time; | 337 | ktime_t t, setup_time, trans_time; |
@@ -348,9 +341,6 @@ static void dsi_perf_show(const char *name) | |||
348 | if (!dsi_perf) | 341 | if (!dsi_perf) |
349 | return; | 342 | return; |
350 | 343 | ||
351 | if (dsi.update_mode == OMAP_DSS_UPDATE_DISABLED) | ||
352 | return; | ||
353 | |||
354 | t = ktime_get(); | 344 | t = ktime_get(); |
355 | 345 | ||
356 | setup_time = ktime_sub(dsi.perf_start_time, dsi.perf_setup_time); | 346 | setup_time = ktime_sub(dsi.perf_start_time, dsi.perf_setup_time); |
@@ -365,76 +355,23 @@ static void dsi_perf_show(const char *name) | |||
365 | 355 | ||
366 | total_us = setup_us + trans_us; | 356 | total_us = setup_us + trans_us; |
367 | 357 | ||
368 | total_bytes = dsi.active_update_region.w * | 358 | total_bytes = dsi.update_region.w * |
369 | dsi.active_update_region.h * | 359 | dsi.update_region.h * |
370 | dsi.active_update_region.device->ctrl.pixel_size / 8; | 360 | dsi.update_region.device->ctrl.pixel_size / 8; |
371 | |||
372 | if (dsi.update_mode == OMAP_DSS_UPDATE_AUTO) { | ||
373 | static u32 s_total_trans_us, s_total_setup_us; | ||
374 | static u32 s_min_trans_us = 0xffffffff, s_min_setup_us; | ||
375 | static u32 s_max_trans_us, s_max_setup_us; | ||
376 | const int numframes = 100; | ||
377 | ktime_t total_time_auto; | ||
378 | u32 total_time_auto_us; | ||
379 | |||
380 | dsi.perf_measure_frames++; | ||
381 | |||
382 | if (setup_us < s_min_setup_us) | ||
383 | s_min_setup_us = setup_us; | ||
384 | 361 | ||
385 | if (setup_us > s_max_setup_us) | 362 | printk(KERN_INFO "DSI(%s): %u us + %u us = %u us (%uHz), " |
386 | s_max_setup_us = setup_us; | 363 | "%u bytes, %u kbytes/sec\n", |
387 | 364 | name, | |
388 | s_total_setup_us += setup_us; | 365 | setup_us, |
389 | 366 | trans_us, | |
390 | if (trans_us < s_min_trans_us) | 367 | total_us, |
391 | s_min_trans_us = trans_us; | 368 | 1000*1000 / total_us, |
392 | 369 | total_bytes, | |
393 | if (trans_us > s_max_trans_us) | 370 | total_bytes * 1000 / total_us); |
394 | s_max_trans_us = trans_us; | ||
395 | |||
396 | s_total_trans_us += trans_us; | ||
397 | |||
398 | if (dsi.perf_measure_frames < numframes) | ||
399 | return; | ||
400 | |||
401 | total_time_auto = ktime_sub(t, dsi.perf_start_time_auto); | ||
402 | total_time_auto_us = (u32)ktime_to_us(total_time_auto); | ||
403 | |||
404 | printk(KERN_INFO "DSI(%s): %u fps, setup %u/%u/%u, " | ||
405 | "trans %u/%u/%u\n", | ||
406 | name, | ||
407 | 1000 * 1000 * numframes / total_time_auto_us, | ||
408 | s_min_setup_us, | ||
409 | s_max_setup_us, | ||
410 | s_total_setup_us / numframes, | ||
411 | s_min_trans_us, | ||
412 | s_max_trans_us, | ||
413 | s_total_trans_us / numframes); | ||
414 | |||
415 | s_total_setup_us = 0; | ||
416 | s_min_setup_us = 0xffffffff; | ||
417 | s_max_setup_us = 0; | ||
418 | s_total_trans_us = 0; | ||
419 | s_min_trans_us = 0xffffffff; | ||
420 | s_max_trans_us = 0; | ||
421 | dsi_perf_mark_start_auto(); | ||
422 | } else { | ||
423 | printk(KERN_INFO "DSI(%s): %u us + %u us = %u us (%uHz), " | ||
424 | "%u bytes, %u kbytes/sec\n", | ||
425 | name, | ||
426 | setup_us, | ||
427 | trans_us, | ||
428 | total_us, | ||
429 | 1000*1000 / total_us, | ||
430 | total_bytes, | ||
431 | total_bytes * 1000 / total_us); | ||
432 | } | ||
433 | } | 371 | } |
434 | #else | 372 | #else |
435 | #define dsi_perf_mark_setup() | 373 | #define dsi_perf_mark_setup() |
436 | #define dsi_perf_mark_start() | 374 | #define dsi_perf_mark_start() |
437 | #define dsi_perf_mark_start_auto() | ||
438 | #define dsi_perf_show(x) | 375 | #define dsi_perf_show(x) |
439 | #endif | 376 | #endif |
440 | 377 | ||
@@ -774,7 +711,7 @@ static unsigned long dsi_fclk_rate(void) | |||
774 | { | 711 | { |
775 | unsigned long r; | 712 | unsigned long r; |
776 | 713 | ||
777 | if (dss_get_dsi_clk_source() == 0) { | 714 | if (dss_get_dsi_clk_source() == DSS_SRC_DSS1_ALWON_FCLK) { |
778 | /* DSI FCLK source is DSS1_ALWON_FCK, which is dss1_fck */ | 715 | /* DSI FCLK source is DSS1_ALWON_FCK, which is dss1_fck */ |
779 | r = dss_clk_get_rate(DSS_CLK_FCK1); | 716 | r = dss_clk_get_rate(DSS_CLK_FCK1); |
780 | } else { | 717 | } else { |
@@ -1227,17 +1164,19 @@ void dsi_dump_clocks(struct seq_file *s) | |||
1227 | seq_printf(s, "dsi1_pll_fck\t%-16luregm3 %u\t(%s)\n", | 1164 | seq_printf(s, "dsi1_pll_fck\t%-16luregm3 %u\t(%s)\n", |
1228 | cinfo->dsi1_pll_fclk, | 1165 | cinfo->dsi1_pll_fclk, |
1229 | cinfo->regm3, | 1166 | cinfo->regm3, |
1230 | dss_get_dispc_clk_source() == 0 ? "off" : "on"); | 1167 | dss_get_dispc_clk_source() == DSS_SRC_DSS1_ALWON_FCLK ? |
1168 | "off" : "on"); | ||
1231 | 1169 | ||
1232 | seq_printf(s, "dsi2_pll_fck\t%-16luregm4 %u\t(%s)\n", | 1170 | seq_printf(s, "dsi2_pll_fck\t%-16luregm4 %u\t(%s)\n", |
1233 | cinfo->dsi2_pll_fclk, | 1171 | cinfo->dsi2_pll_fclk, |
1234 | cinfo->regm4, | 1172 | cinfo->regm4, |
1235 | dss_get_dsi_clk_source() == 0 ? "off" : "on"); | 1173 | dss_get_dsi_clk_source() == DSS_SRC_DSS1_ALWON_FCLK ? |
1174 | "off" : "on"); | ||
1236 | 1175 | ||
1237 | seq_printf(s, "- DSI -\n"); | 1176 | seq_printf(s, "- DSI -\n"); |
1238 | 1177 | ||
1239 | seq_printf(s, "dsi fclk source = %s\n", | 1178 | seq_printf(s, "dsi fclk source = %s\n", |
1240 | dss_get_dsi_clk_source() == 0 ? | 1179 | dss_get_dsi_clk_source() == DSS_SRC_DSS1_ALWON_FCLK ? |
1241 | "dss1_alwon_fclk" : "dsi2_pll_fclk"); | 1180 | "dss1_alwon_fclk" : "dsi2_pll_fclk"); |
1242 | 1181 | ||
1243 | seq_printf(s, "DSI_FCLK\t%lu\n", dsi_fclk_rate()); | 1182 | seq_printf(s, "DSI_FCLK\t%lu\n", dsi_fclk_rate()); |
@@ -1756,29 +1695,10 @@ static int dsi_force_tx_stop_mode_io(void) | |||
1756 | return 0; | 1695 | return 0; |
1757 | } | 1696 | } |
1758 | 1697 | ||
1759 | static void dsi_vc_print_status(int channel) | ||
1760 | { | ||
1761 | u32 r; | ||
1762 | |||
1763 | r = dsi_read_reg(DSI_VC_CTRL(channel)); | ||
1764 | DSSDBG("vc %d: TX_FIFO_NOT_EMPTY %d, BTA_EN %d, VC_BUSY %d, " | ||
1765 | "TX_FIFO_FULL %d, RX_FIFO_NOT_EMPTY %d, ", | ||
1766 | channel, | ||
1767 | FLD_GET(r, 5, 5), | ||
1768 | FLD_GET(r, 6, 6), | ||
1769 | FLD_GET(r, 15, 15), | ||
1770 | FLD_GET(r, 16, 16), | ||
1771 | FLD_GET(r, 20, 20)); | ||
1772 | |||
1773 | r = dsi_read_reg(DSI_TX_FIFO_VC_EMPTINESS); | ||
1774 | DSSDBG("EMPTINESS %d\n", (r >> (8 * channel)) & 0xff); | ||
1775 | } | ||
1776 | |||
1777 | static int dsi_vc_enable(int channel, bool enable) | 1698 | static int dsi_vc_enable(int channel, bool enable) |
1778 | { | 1699 | { |
1779 | if (dsi.update_mode != OMAP_DSS_UPDATE_AUTO) | 1700 | DSSDBG("dsi_vc_enable channel %d, enable %d\n", |
1780 | DSSDBG("dsi_vc_enable channel %d, enable %d\n", | 1701 | channel, enable); |
1781 | channel, enable); | ||
1782 | 1702 | ||
1783 | enable = enable ? 1 : 0; | 1703 | enable = enable ? 1 : 0; |
1784 | 1704 | ||
@@ -1859,10 +1779,12 @@ static void dsi_vc_config_vp(int channel) | |||
1859 | } | 1779 | } |
1860 | 1780 | ||
1861 | 1781 | ||
1862 | static void dsi_vc_enable_hs(int channel, bool enable) | 1782 | void omapdss_dsi_vc_enable_hs(int channel, bool enable) |
1863 | { | 1783 | { |
1864 | DSSDBG("dsi_vc_enable_hs(%d, %d)\n", channel, enable); | 1784 | DSSDBG("dsi_vc_enable_hs(%d, %d)\n", channel, enable); |
1865 | 1785 | ||
1786 | WARN_ON(!dsi_bus_is_locked()); | ||
1787 | |||
1866 | dsi_vc_enable(channel, 0); | 1788 | dsi_vc_enable(channel, 0); |
1867 | dsi_if_enable(0); | 1789 | dsi_if_enable(0); |
1868 | 1790 | ||
@@ -1873,6 +1795,7 @@ static void dsi_vc_enable_hs(int channel, bool enable) | |||
1873 | 1795 | ||
1874 | dsi_force_tx_stop_mode_io(); | 1796 | dsi_force_tx_stop_mode_io(); |
1875 | } | 1797 | } |
1798 | EXPORT_SYMBOL(omapdss_dsi_vc_enable_hs); | ||
1876 | 1799 | ||
1877 | static void dsi_vc_flush_long_data(int channel) | 1800 | static void dsi_vc_flush_long_data(int channel) |
1878 | { | 1801 | { |
@@ -1955,11 +1878,10 @@ static u16 dsi_vc_flush_receive_data(int channel) | |||
1955 | 1878 | ||
1956 | static int dsi_vc_send_bta(int channel) | 1879 | static int dsi_vc_send_bta(int channel) |
1957 | { | 1880 | { |
1958 | if (dsi.update_mode != OMAP_DSS_UPDATE_AUTO && | 1881 | if (dsi.debug_write || dsi.debug_read) |
1959 | (dsi.debug_write || dsi.debug_read)) | ||
1960 | DSSDBG("dsi_vc_send_bta %d\n", channel); | 1882 | DSSDBG("dsi_vc_send_bta %d\n", channel); |
1961 | 1883 | ||
1962 | WARN_ON(!mutex_is_locked(&dsi.bus_lock)); | 1884 | WARN_ON(!dsi_bus_is_locked()); |
1963 | 1885 | ||
1964 | if (REG_GET(DSI_VC_CTRL(channel), 20, 20)) { /* RX_FIFO_NOT_EMPTY */ | 1886 | if (REG_GET(DSI_VC_CTRL(channel), 20, 20)) { /* RX_FIFO_NOT_EMPTY */ |
1965 | DSSERR("rx fifo not empty when sending BTA, dumping data:\n"); | 1887 | DSSERR("rx fifo not empty when sending BTA, dumping data:\n"); |
@@ -2010,10 +1932,9 @@ static inline void dsi_vc_write_long_header(int channel, u8 data_type, | |||
2010 | u32 val; | 1932 | u32 val; |
2011 | u8 data_id; | 1933 | u8 data_id; |
2012 | 1934 | ||
2013 | WARN_ON(!mutex_is_locked(&dsi.bus_lock)); | 1935 | WARN_ON(!dsi_bus_is_locked()); |
2014 | 1936 | ||
2015 | /*data_id = data_type | channel << 6; */ | 1937 | data_id = data_type | channel << 6; |
2016 | data_id = data_type | dsi.vc[channel].dest_per << 6; | ||
2017 | 1938 | ||
2018 | val = FLD_VAL(data_id, 7, 0) | FLD_VAL(len, 23, 8) | | 1939 | val = FLD_VAL(data_id, 7, 0) | FLD_VAL(len, 23, 8) | |
2019 | FLD_VAL(ecc, 31, 24); | 1940 | FLD_VAL(ecc, 31, 24); |
@@ -2056,13 +1977,10 @@ static int dsi_vc_send_long(int channel, u8 data_type, u8 *data, u16 len, | |||
2056 | 1977 | ||
2057 | dsi_vc_write_long_header(channel, data_type, len, ecc); | 1978 | dsi_vc_write_long_header(channel, data_type, len, ecc); |
2058 | 1979 | ||
2059 | /*dsi_vc_print_status(0); */ | ||
2060 | |||
2061 | p = data; | 1980 | p = data; |
2062 | for (i = 0; i < len >> 2; i++) { | 1981 | for (i = 0; i < len >> 2; i++) { |
2063 | if (dsi.debug_write) | 1982 | if (dsi.debug_write) |
2064 | DSSDBG("\tsending full packet %d\n", i); | 1983 | DSSDBG("\tsending full packet %d\n", i); |
2065 | /*dsi_vc_print_status(0); */ | ||
2066 | 1984 | ||
2067 | b1 = *p++; | 1985 | b1 = *p++; |
2068 | b2 = *p++; | 1986 | b2 = *p++; |
@@ -2105,7 +2023,7 @@ static int dsi_vc_send_short(int channel, u8 data_type, u16 data, u8 ecc) | |||
2105 | u32 r; | 2023 | u32 r; |
2106 | u8 data_id; | 2024 | u8 data_id; |
2107 | 2025 | ||
2108 | WARN_ON(!mutex_is_locked(&dsi.bus_lock)); | 2026 | WARN_ON(!dsi_bus_is_locked()); |
2109 | 2027 | ||
2110 | if (dsi.debug_write) | 2028 | if (dsi.debug_write) |
2111 | DSSDBG("dsi_vc_send_short(ch%d, dt %#x, b1 %#x, b2 %#x)\n", | 2029 | DSSDBG("dsi_vc_send_short(ch%d, dt %#x, b1 %#x, b2 %#x)\n", |
@@ -2119,7 +2037,7 @@ static int dsi_vc_send_short(int channel, u8 data_type, u16 data, u8 ecc) | |||
2119 | return -EINVAL; | 2037 | return -EINVAL; |
2120 | } | 2038 | } |
2121 | 2039 | ||
2122 | data_id = data_type | dsi.vc[channel].dest_per << 6; | 2040 | data_id = data_type | channel << 6; |
2123 | 2041 | ||
2124 | r = (data_id << 0) | (data << 8) | (ecc << 24); | 2042 | r = (data_id << 0) | (data << 8) | (ecc << 24); |
2125 | 2043 | ||
@@ -2163,14 +2081,35 @@ int dsi_vc_dcs_write(int channel, u8 *data, int len) | |||
2163 | 2081 | ||
2164 | r = dsi_vc_dcs_write_nosync(channel, data, len); | 2082 | r = dsi_vc_dcs_write_nosync(channel, data, len); |
2165 | if (r) | 2083 | if (r) |
2166 | return r; | 2084 | goto err; |
2167 | 2085 | ||
2168 | r = dsi_vc_send_bta_sync(channel); | 2086 | r = dsi_vc_send_bta_sync(channel); |
2087 | if (r) | ||
2088 | goto err; | ||
2169 | 2089 | ||
2090 | return 0; | ||
2091 | err: | ||
2092 | DSSERR("dsi_vc_dcs_write(ch %d, cmd 0x%02x, len %d) failed\n", | ||
2093 | channel, data[0], len); | ||
2170 | return r; | 2094 | return r; |
2171 | } | 2095 | } |
2172 | EXPORT_SYMBOL(dsi_vc_dcs_write); | 2096 | EXPORT_SYMBOL(dsi_vc_dcs_write); |
2173 | 2097 | ||
2098 | int dsi_vc_dcs_write_0(int channel, u8 dcs_cmd) | ||
2099 | { | ||
2100 | return dsi_vc_dcs_write(channel, &dcs_cmd, 1); | ||
2101 | } | ||
2102 | EXPORT_SYMBOL(dsi_vc_dcs_write_0); | ||
2103 | |||
2104 | int dsi_vc_dcs_write_1(int channel, u8 dcs_cmd, u8 param) | ||
2105 | { | ||
2106 | u8 buf[2]; | ||
2107 | buf[0] = dcs_cmd; | ||
2108 | buf[1] = param; | ||
2109 | return dsi_vc_dcs_write(channel, buf, 2); | ||
2110 | } | ||
2111 | EXPORT_SYMBOL(dsi_vc_dcs_write_1); | ||
2112 | |||
2174 | int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen) | 2113 | int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen) |
2175 | { | 2114 | { |
2176 | u32 val; | 2115 | u32 val; |
@@ -2182,16 +2121,17 @@ int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen) | |||
2182 | 2121 | ||
2183 | r = dsi_vc_send_short(channel, DSI_DT_DCS_READ, dcs_cmd, 0); | 2122 | r = dsi_vc_send_short(channel, DSI_DT_DCS_READ, dcs_cmd, 0); |
2184 | if (r) | 2123 | if (r) |
2185 | return r; | 2124 | goto err; |
2186 | 2125 | ||
2187 | r = dsi_vc_send_bta_sync(channel); | 2126 | r = dsi_vc_send_bta_sync(channel); |
2188 | if (r) | 2127 | if (r) |
2189 | return r; | 2128 | goto err; |
2190 | 2129 | ||
2191 | /* RX_FIFO_NOT_EMPTY */ | 2130 | /* RX_FIFO_NOT_EMPTY */ |
2192 | if (REG_GET(DSI_VC_CTRL(channel), 20, 20) == 0) { | 2131 | if (REG_GET(DSI_VC_CTRL(channel), 20, 20) == 0) { |
2193 | DSSERR("RX fifo empty when trying to read.\n"); | 2132 | DSSERR("RX fifo empty when trying to read.\n"); |
2194 | return -EIO; | 2133 | r = -EIO; |
2134 | goto err; | ||
2195 | } | 2135 | } |
2196 | 2136 | ||
2197 | val = dsi_read_reg(DSI_VC_SHORT_PACKET_HEADER(channel)); | 2137 | val = dsi_read_reg(DSI_VC_SHORT_PACKET_HEADER(channel)); |
@@ -2201,15 +2141,18 @@ int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen) | |||
2201 | if (dt == DSI_DT_RX_ACK_WITH_ERR) { | 2141 | if (dt == DSI_DT_RX_ACK_WITH_ERR) { |
2202 | u16 err = FLD_GET(val, 23, 8); | 2142 | u16 err = FLD_GET(val, 23, 8); |
2203 | dsi_show_rx_ack_with_err(err); | 2143 | dsi_show_rx_ack_with_err(err); |
2204 | return -EIO; | 2144 | r = -EIO; |
2145 | goto err; | ||
2205 | 2146 | ||
2206 | } else if (dt == DSI_DT_RX_SHORT_READ_1) { | 2147 | } else if (dt == DSI_DT_RX_SHORT_READ_1) { |
2207 | u8 data = FLD_GET(val, 15, 8); | 2148 | u8 data = FLD_GET(val, 15, 8); |
2208 | if (dsi.debug_read) | 2149 | if (dsi.debug_read) |
2209 | DSSDBG("\tDCS short response, 1 byte: %02x\n", data); | 2150 | DSSDBG("\tDCS short response, 1 byte: %02x\n", data); |
2210 | 2151 | ||
2211 | if (buflen < 1) | 2152 | if (buflen < 1) { |
2212 | return -EIO; | 2153 | r = -EIO; |
2154 | goto err; | ||
2155 | } | ||
2213 | 2156 | ||
2214 | buf[0] = data; | 2157 | buf[0] = data; |
2215 | 2158 | ||
@@ -2219,8 +2162,10 @@ int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen) | |||
2219 | if (dsi.debug_read) | 2162 | if (dsi.debug_read) |
2220 | DSSDBG("\tDCS short response, 2 byte: %04x\n", data); | 2163 | DSSDBG("\tDCS short response, 2 byte: %04x\n", data); |
2221 | 2164 | ||
2222 | if (buflen < 2) | 2165 | if (buflen < 2) { |
2223 | return -EIO; | 2166 | r = -EIO; |
2167 | goto err; | ||
2168 | } | ||
2224 | 2169 | ||
2225 | buf[0] = data & 0xff; | 2170 | buf[0] = data & 0xff; |
2226 | buf[1] = (data >> 8) & 0xff; | 2171 | buf[1] = (data >> 8) & 0xff; |
@@ -2232,8 +2177,10 @@ int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen) | |||
2232 | if (dsi.debug_read) | 2177 | if (dsi.debug_read) |
2233 | DSSDBG("\tDCS long response, len %d\n", len); | 2178 | DSSDBG("\tDCS long response, len %d\n", len); |
2234 | 2179 | ||
2235 | if (len > buflen) | 2180 | if (len > buflen) { |
2236 | return -EIO; | 2181 | r = -EIO; |
2182 | goto err; | ||
2183 | } | ||
2237 | 2184 | ||
2238 | /* two byte checksum ends the packet, not included in len */ | 2185 | /* two byte checksum ends the packet, not included in len */ |
2239 | for (w = 0; w < len + 2;) { | 2186 | for (w = 0; w < len + 2;) { |
@@ -2255,14 +2202,52 @@ int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen) | |||
2255 | } | 2202 | } |
2256 | 2203 | ||
2257 | return len; | 2204 | return len; |
2258 | |||
2259 | } else { | 2205 | } else { |
2260 | DSSERR("\tunknown datatype 0x%02x\n", dt); | 2206 | DSSERR("\tunknown datatype 0x%02x\n", dt); |
2261 | return -EIO; | 2207 | r = -EIO; |
2208 | goto err; | ||
2262 | } | 2209 | } |
2210 | |||
2211 | BUG(); | ||
2212 | err: | ||
2213 | DSSERR("dsi_vc_dcs_read(ch %d, cmd 0x%02x) failed\n", | ||
2214 | channel, dcs_cmd); | ||
2215 | return r; | ||
2216 | |||
2263 | } | 2217 | } |
2264 | EXPORT_SYMBOL(dsi_vc_dcs_read); | 2218 | EXPORT_SYMBOL(dsi_vc_dcs_read); |
2265 | 2219 | ||
2220 | int dsi_vc_dcs_read_1(int channel, u8 dcs_cmd, u8 *data) | ||
2221 | { | ||
2222 | int r; | ||
2223 | |||
2224 | r = dsi_vc_dcs_read(channel, dcs_cmd, data, 1); | ||
2225 | |||
2226 | if (r < 0) | ||
2227 | return r; | ||
2228 | |||
2229 | if (r != 1) | ||
2230 | return -EIO; | ||
2231 | |||
2232 | return 0; | ||
2233 | } | ||
2234 | EXPORT_SYMBOL(dsi_vc_dcs_read_1); | ||
2235 | |||
2236 | int dsi_vc_dcs_read_2(int channel, u8 dcs_cmd, u16 *data) | ||
2237 | { | ||
2238 | int r; | ||
2239 | |||
2240 | r = dsi_vc_dcs_read(channel, dcs_cmd, (u8 *)data, 2); | ||
2241 | |||
2242 | if (r < 0) | ||
2243 | return r; | ||
2244 | |||
2245 | if (r != 2) | ||
2246 | return -EIO; | ||
2247 | |||
2248 | return 0; | ||
2249 | } | ||
2250 | EXPORT_SYMBOL(dsi_vc_dcs_read_2); | ||
2266 | 2251 | ||
2267 | int dsi_vc_set_max_rx_packet_size(int channel, u16 len) | 2252 | int dsi_vc_set_max_rx_packet_size(int channel, u16 len) |
2268 | { | 2253 | { |
@@ -2491,15 +2476,15 @@ static int dsi_proto_config(struct omap_dss_device *dssdev) | |||
2491 | u32 r; | 2476 | u32 r; |
2492 | int buswidth = 0; | 2477 | int buswidth = 0; |
2493 | 2478 | ||
2494 | dsi_config_tx_fifo(DSI_FIFO_SIZE_128, | 2479 | dsi_config_tx_fifo(DSI_FIFO_SIZE_32, |
2495 | DSI_FIFO_SIZE_0, | 2480 | DSI_FIFO_SIZE_32, |
2496 | DSI_FIFO_SIZE_0, | 2481 | DSI_FIFO_SIZE_32, |
2497 | DSI_FIFO_SIZE_0); | 2482 | DSI_FIFO_SIZE_32); |
2498 | 2483 | ||
2499 | dsi_config_rx_fifo(DSI_FIFO_SIZE_128, | 2484 | dsi_config_rx_fifo(DSI_FIFO_SIZE_32, |
2500 | DSI_FIFO_SIZE_0, | 2485 | DSI_FIFO_SIZE_32, |
2501 | DSI_FIFO_SIZE_0, | 2486 | DSI_FIFO_SIZE_32, |
2502 | DSI_FIFO_SIZE_0); | 2487 | DSI_FIFO_SIZE_32); |
2503 | 2488 | ||
2504 | /* XXX what values for the timeouts? */ | 2489 | /* XXX what values for the timeouts? */ |
2505 | dsi_set_stop_state_counter(1000); | 2490 | dsi_set_stop_state_counter(1000); |
@@ -2537,12 +2522,9 @@ static int dsi_proto_config(struct omap_dss_device *dssdev) | |||
2537 | dsi_write_reg(DSI_CTRL, r); | 2522 | dsi_write_reg(DSI_CTRL, r); |
2538 | 2523 | ||
2539 | dsi_vc_initial_config(0); | 2524 | dsi_vc_initial_config(0); |
2540 | 2525 | dsi_vc_initial_config(1); | |
2541 | /* set all vc targets to peripheral 0 */ | 2526 | dsi_vc_initial_config(2); |
2542 | dsi.vc[0].dest_per = 0; | 2527 | dsi_vc_initial_config(3); |
2543 | dsi.vc[1].dest_per = 0; | ||
2544 | dsi.vc[2].dest_per = 0; | ||
2545 | dsi.vc[3].dest_per = 0; | ||
2546 | 2528 | ||
2547 | return 0; | 2529 | return 0; |
2548 | } | 2530 | } |
@@ -2777,18 +2759,16 @@ static void dsi_update_screen_dispc(struct omap_dss_device *dssdev, | |||
2777 | unsigned packet_payload; | 2759 | unsigned packet_payload; |
2778 | unsigned packet_len; | 2760 | unsigned packet_len; |
2779 | u32 l; | 2761 | u32 l; |
2780 | bool use_te_trigger; | 2762 | const unsigned channel = dsi.update_channel; |
2781 | const unsigned channel = 0; | ||
2782 | /* line buffer is 1024 x 24bits */ | 2763 | /* line buffer is 1024 x 24bits */ |
2783 | /* XXX: for some reason using full buffer size causes considerable TX | 2764 | /* XXX: for some reason using full buffer size causes considerable TX |
2784 | * slowdown with update sizes that fill the whole buffer */ | 2765 | * slowdown with update sizes that fill the whole buffer */ |
2785 | const unsigned line_buf_size = 1023 * 3; | 2766 | const unsigned line_buf_size = 1023 * 3; |
2786 | 2767 | ||
2787 | use_te_trigger = dsi.te_enabled && !dsi.use_ext_te; | 2768 | DSSDBG("dsi_update_screen_dispc(%d,%d %dx%d)\n", |
2769 | x, y, w, h); | ||
2788 | 2770 | ||
2789 | if (dsi.update_mode != OMAP_DSS_UPDATE_AUTO) | 2771 | dsi_vc_config_vp(channel); |
2790 | DSSDBG("dsi_update_screen_dispc(%d,%d %dx%d)\n", | ||
2791 | x, y, w, h); | ||
2792 | 2772 | ||
2793 | bytespp = dssdev->ctrl.pixel_size / 8; | 2773 | bytespp = dssdev->ctrl.pixel_size / 8; |
2794 | bytespl = w * bytespp; | 2774 | bytespl = w * bytespp; |
@@ -2808,15 +2788,12 @@ static void dsi_update_screen_dispc(struct omap_dss_device *dssdev, | |||
2808 | if (bytespf % packet_payload) | 2788 | if (bytespf % packet_payload) |
2809 | total_len += (bytespf % packet_payload) + 1; | 2789 | total_len += (bytespf % packet_payload) + 1; |
2810 | 2790 | ||
2811 | if (0) | ||
2812 | dsi_vc_print_status(1); | ||
2813 | |||
2814 | l = FLD_VAL(total_len, 23, 0); /* TE_SIZE */ | 2791 | l = FLD_VAL(total_len, 23, 0); /* TE_SIZE */ |
2815 | dsi_write_reg(DSI_VC_TE(channel), l); | 2792 | dsi_write_reg(DSI_VC_TE(channel), l); |
2816 | 2793 | ||
2817 | dsi_vc_write_long_header(channel, DSI_DT_DCS_LONG_WRITE, packet_len, 0); | 2794 | dsi_vc_write_long_header(channel, DSI_DT_DCS_LONG_WRITE, packet_len, 0); |
2818 | 2795 | ||
2819 | if (use_te_trigger) | 2796 | if (dsi.te_enabled) |
2820 | l = FLD_MOD(l, 1, 30, 30); /* TE_EN */ | 2797 | l = FLD_MOD(l, 1, 30, 30); /* TE_EN */ |
2821 | else | 2798 | else |
2822 | l = FLD_MOD(l, 1, 31, 31); /* TE_START */ | 2799 | l = FLD_MOD(l, 1, 31, 31); /* TE_START */ |
@@ -2830,9 +2807,14 @@ static void dsi_update_screen_dispc(struct omap_dss_device *dssdev, | |||
2830 | */ | 2807 | */ |
2831 | dispc_disable_sidle(); | 2808 | dispc_disable_sidle(); |
2832 | 2809 | ||
2810 | dsi_perf_mark_start(); | ||
2811 | |||
2812 | schedule_delayed_work(&dsi.framedone_timeout_work, | ||
2813 | msecs_to_jiffies(250)); | ||
2814 | |||
2833 | dss_start_update(dssdev); | 2815 | dss_start_update(dssdev); |
2834 | 2816 | ||
2835 | if (use_te_trigger) { | 2817 | if (dsi.te_enabled) { |
2836 | /* disable LP_RX_TO, so that we can receive TE. Time to wait | 2818 | /* disable LP_RX_TO, so that we can receive TE. Time to wait |
2837 | * for TE is longer than the timer allows */ | 2819 | * for TE is longer than the timer allows */ |
2838 | REG_FLD_MOD(DSI_TIMING2, 0, 15, 15); /* LP_RX_TO */ | 2820 | REG_FLD_MOD(DSI_TIMING2, 0, 15, 15); /* LP_RX_TO */ |
@@ -2852,110 +2834,64 @@ static void dsi_te_timeout(unsigned long arg) | |||
2852 | } | 2834 | } |
2853 | #endif | 2835 | #endif |
2854 | 2836 | ||
2855 | static void dsi_framedone_irq_callback(void *data, u32 mask) | 2837 | static void dsi_framedone_timeout_work_callback(struct work_struct *work) |
2856 | { | 2838 | { |
2857 | /* Note: We get FRAMEDONE when DISPC has finished sending pixels and | 2839 | int r; |
2858 | * turns itself off. However, DSI still has the pixels in its buffers, | 2840 | const int channel = dsi.update_channel; |
2859 | * and is sending the data. | 2841 | |
2860 | */ | 2842 | DSSERR("Framedone not received for 250ms!\n"); |
2861 | 2843 | ||
2862 | /* SIDLEMODE back to smart-idle */ | 2844 | /* SIDLEMODE back to smart-idle */ |
2863 | dispc_enable_sidle(); | 2845 | dispc_enable_sidle(); |
2864 | 2846 | ||
2865 | dsi.framedone_received = true; | 2847 | if (dsi.te_enabled) { |
2866 | wake_up(&dsi.waitqueue); | 2848 | /* enable LP_RX_TO again after the TE */ |
2867 | } | 2849 | REG_FLD_MOD(DSI_TIMING2, 1, 15, 15); /* LP_RX_TO */ |
2868 | |||
2869 | static void dsi_set_update_region(struct omap_dss_device *dssdev, | ||
2870 | u16 x, u16 y, u16 w, u16 h) | ||
2871 | { | ||
2872 | spin_lock(&dsi.update_lock); | ||
2873 | if (dsi.update_region.dirty) { | ||
2874 | dsi.update_region.x = min(x, dsi.update_region.x); | ||
2875 | dsi.update_region.y = min(y, dsi.update_region.y); | ||
2876 | dsi.update_region.w = max(w, dsi.update_region.w); | ||
2877 | dsi.update_region.h = max(h, dsi.update_region.h); | ||
2878 | } else { | ||
2879 | dsi.update_region.x = x; | ||
2880 | dsi.update_region.y = y; | ||
2881 | dsi.update_region.w = w; | ||
2882 | dsi.update_region.h = h; | ||
2883 | } | 2850 | } |
2884 | 2851 | ||
2885 | dsi.update_region.device = dssdev; | 2852 | /* Send BTA after the frame. We need this for the TE to work, as TE |
2886 | dsi.update_region.dirty = true; | 2853 | * trigger is only sent for BTAs without preceding packet. Thus we need |
2887 | 2854 | * to BTA after the pixel packets so that next BTA will cause TE | |
2888 | spin_unlock(&dsi.update_lock); | 2855 | * trigger. |
2889 | 2856 | * | |
2890 | } | 2857 | * This is not needed when TE is not in use, but we do it anyway to |
2891 | 2858 | * make sure that the transfer has been completed. It would be more | |
2892 | static int dsi_set_update_mode(struct omap_dss_device *dssdev, | 2859 | * optimal, but more complex, to wait only just before starting next |
2893 | enum omap_dss_update_mode mode) | 2860 | * transfer. */ |
2894 | { | 2861 | r = dsi_vc_send_bta_sync(channel); |
2895 | int r = 0; | 2862 | if (r) |
2896 | int i; | 2863 | DSSERR("BTA after framedone failed\n"); |
2897 | |||
2898 | WARN_ON(!mutex_is_locked(&dsi.bus_lock)); | ||
2899 | |||
2900 | if (dsi.update_mode != mode) { | ||
2901 | dsi.update_mode = mode; | ||
2902 | |||
2903 | /* Mark the overlays dirty, and do apply(), so that we get the | ||
2904 | * overlays configured properly after update mode change. */ | ||
2905 | for (i = 0; i < omap_dss_get_num_overlays(); ++i) { | ||
2906 | struct omap_overlay *ovl; | ||
2907 | ovl = omap_dss_get_overlay(i); | ||
2908 | if (ovl->manager == dssdev->manager) | ||
2909 | ovl->info_dirty = true; | ||
2910 | } | ||
2911 | |||
2912 | r = dssdev->manager->apply(dssdev->manager); | ||
2913 | |||
2914 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE && | ||
2915 | mode == OMAP_DSS_UPDATE_AUTO) { | ||
2916 | u16 w, h; | ||
2917 | |||
2918 | DSSDBG("starting auto update\n"); | ||
2919 | |||
2920 | dssdev->get_resolution(dssdev, &w, &h); | ||
2921 | |||
2922 | dsi_set_update_region(dssdev, 0, 0, w, h); | ||
2923 | |||
2924 | dsi_perf_mark_start_auto(); | ||
2925 | 2864 | ||
2926 | wake_up(&dsi.waitqueue); | 2865 | /* RX_FIFO_NOT_EMPTY */ |
2927 | } | 2866 | if (REG_GET(DSI_VC_CTRL(channel), 20, 20)) { |
2867 | DSSERR("Received error during frame transfer:\n"); | ||
2868 | dsi_vc_flush_receive_data(channel); | ||
2928 | } | 2869 | } |
2929 | 2870 | ||
2930 | return r; | 2871 | dsi.framedone_callback(-ETIMEDOUT, dsi.framedone_data); |
2931 | } | 2872 | } |
2932 | 2873 | ||
2933 | static int dsi_set_te(struct omap_dss_device *dssdev, bool enable) | 2874 | static void dsi_framedone_irq_callback(void *data, u32 mask) |
2934 | { | 2875 | { |
2935 | int r = 0; | 2876 | /* Note: We get FRAMEDONE when DISPC has finished sending pixels and |
2877 | * turns itself off. However, DSI still has the pixels in its buffers, | ||
2878 | * and is sending the data. | ||
2879 | */ | ||
2936 | 2880 | ||
2937 | if (dssdev->driver->enable_te) { | 2881 | /* SIDLEMODE back to smart-idle */ |
2938 | r = dssdev->driver->enable_te(dssdev, enable); | 2882 | dispc_enable_sidle(); |
2939 | /* XXX for some reason, DSI TE breaks if we don't wait here. | ||
2940 | * Panel bug? Needs more studying */ | ||
2941 | msleep(100); | ||
2942 | } | ||
2943 | 2883 | ||
2944 | return r; | 2884 | schedule_work(&dsi.framedone_work); |
2945 | } | 2885 | } |
2946 | 2886 | ||
2947 | static void dsi_handle_framedone(void) | 2887 | static void dsi_handle_framedone(void) |
2948 | { | 2888 | { |
2949 | int r; | 2889 | int r; |
2950 | const int channel = 0; | 2890 | const int channel = dsi.update_channel; |
2951 | bool use_te_trigger; | ||
2952 | |||
2953 | use_te_trigger = dsi.te_enabled && !dsi.use_ext_te; | ||
2954 | 2891 | ||
2955 | if (dsi.update_mode != OMAP_DSS_UPDATE_AUTO) | 2892 | DSSDBG("FRAMEDONE\n"); |
2956 | DSSDBG("FRAMEDONE\n"); | ||
2957 | 2893 | ||
2958 | if (use_te_trigger) { | 2894 | if (dsi.te_enabled) { |
2959 | /* enable LP_RX_TO again after the TE */ | 2895 | /* enable LP_RX_TO again after the TE */ |
2960 | REG_FLD_MOD(DSI_TIMING2, 1, 15, 15); /* LP_RX_TO */ | 2896 | REG_FLD_MOD(DSI_TIMING2, 1, 15, 15); /* LP_RX_TO */ |
2961 | } | 2897 | } |
@@ -2976,7 +2912,7 @@ static void dsi_handle_framedone(void) | |||
2976 | /* RX_FIFO_NOT_EMPTY */ | 2912 | /* RX_FIFO_NOT_EMPTY */ |
2977 | if (REG_GET(DSI_VC_CTRL(channel), 20, 20)) { | 2913 | if (REG_GET(DSI_VC_CTRL(channel), 20, 20)) { |
2978 | DSSERR("Received error during frame transfer:\n"); | 2914 | DSSERR("Received error during frame transfer:\n"); |
2979 | dsi_vc_flush_receive_data(0); | 2915 | dsi_vc_flush_receive_data(channel); |
2980 | } | 2916 | } |
2981 | 2917 | ||
2982 | #ifdef CONFIG_OMAP2_DSS_FAKE_VSYNC | 2918 | #ifdef CONFIG_OMAP2_DSS_FAKE_VSYNC |
@@ -2984,118 +2920,79 @@ static void dsi_handle_framedone(void) | |||
2984 | #endif | 2920 | #endif |
2985 | } | 2921 | } |
2986 | 2922 | ||
2987 | static int dsi_update_thread(void *data) | 2923 | static void dsi_framedone_work_callback(struct work_struct *work) |
2988 | { | 2924 | { |
2989 | unsigned long timeout; | 2925 | DSSDBGF(); |
2990 | struct omap_dss_device *device; | ||
2991 | u16 x, y, w, h; | ||
2992 | |||
2993 | while (1) { | ||
2994 | bool sched; | ||
2995 | |||
2996 | wait_event_interruptible(dsi.waitqueue, | ||
2997 | dsi.update_mode == OMAP_DSS_UPDATE_AUTO || | ||
2998 | (dsi.update_mode == OMAP_DSS_UPDATE_MANUAL && | ||
2999 | dsi.update_region.dirty == true) || | ||
3000 | kthread_should_stop()); | ||
3001 | |||
3002 | if (kthread_should_stop()) | ||
3003 | break; | ||
3004 | |||
3005 | dsi_bus_lock(); | ||
3006 | |||
3007 | if (dsi.update_mode == OMAP_DSS_UPDATE_DISABLED || | ||
3008 | kthread_should_stop()) { | ||
3009 | dsi_bus_unlock(); | ||
3010 | break; | ||
3011 | } | ||
3012 | |||
3013 | dsi_perf_mark_setup(); | ||
3014 | |||
3015 | if (dsi.update_region.dirty) { | ||
3016 | spin_lock(&dsi.update_lock); | ||
3017 | dsi.active_update_region = dsi.update_region; | ||
3018 | dsi.update_region.dirty = false; | ||
3019 | spin_unlock(&dsi.update_lock); | ||
3020 | } | ||
3021 | 2926 | ||
3022 | device = dsi.active_update_region.device; | 2927 | cancel_delayed_work_sync(&dsi.framedone_timeout_work); |
3023 | x = dsi.active_update_region.x; | ||
3024 | y = dsi.active_update_region.y; | ||
3025 | w = dsi.active_update_region.w; | ||
3026 | h = dsi.active_update_region.h; | ||
3027 | 2928 | ||
3028 | if (device->manager->caps & OMAP_DSS_OVL_MGR_CAP_DISPC) { | 2929 | dsi_handle_framedone(); |
3029 | 2930 | ||
3030 | if (dsi.update_mode == OMAP_DSS_UPDATE_MANUAL) | 2931 | dsi_perf_show("DISPC"); |
3031 | dss_setup_partial_planes(device, | ||
3032 | &x, &y, &w, &h); | ||
3033 | 2932 | ||
3034 | dispc_set_lcd_size(w, h); | 2933 | dsi.framedone_callback(0, dsi.framedone_data); |
3035 | } | 2934 | } |
3036 | 2935 | ||
3037 | if (dsi.active_update_region.dirty) { | 2936 | int omap_dsi_prepare_update(struct omap_dss_device *dssdev, |
3038 | dsi.active_update_region.dirty = false; | 2937 | u16 *x, u16 *y, u16 *w, u16 *h) |
3039 | /* XXX TODO we don't need to send the coords, if they | 2938 | { |
3040 | * are the same that are already programmed to the | 2939 | u16 dw, dh; |
3041 | * panel. That should speed up manual update a bit */ | ||
3042 | device->driver->setup_update(device, x, y, w, h); | ||
3043 | } | ||
3044 | 2940 | ||
3045 | dsi_perf_mark_start(); | 2941 | dssdev->driver->get_resolution(dssdev, &dw, &dh); |
3046 | 2942 | ||
3047 | if (device->manager->caps & OMAP_DSS_OVL_MGR_CAP_DISPC) { | 2943 | if (*x > dw || *y > dh) |
3048 | dsi_vc_config_vp(0); | 2944 | return -EINVAL; |
3049 | 2945 | ||
3050 | if (dsi.te_enabled && dsi.use_ext_te) | 2946 | if (*x + *w > dw) |
3051 | device->driver->wait_for_te(device); | 2947 | return -EINVAL; |
3052 | 2948 | ||
3053 | dsi.framedone_received = false; | 2949 | if (*y + *h > dh) |
2950 | return -EINVAL; | ||
3054 | 2951 | ||
3055 | dsi_update_screen_dispc(device, x, y, w, h); | 2952 | if (*w == 1) |
2953 | return -EINVAL; | ||
3056 | 2954 | ||
3057 | /* wait for framedone */ | 2955 | if (*w == 0 || *h == 0) |
3058 | timeout = msecs_to_jiffies(1000); | 2956 | return -EINVAL; |
3059 | wait_event_timeout(dsi.waitqueue, | ||
3060 | dsi.framedone_received == true, | ||
3061 | timeout); | ||
3062 | 2957 | ||
3063 | if (!dsi.framedone_received) { | 2958 | dsi_perf_mark_setup(); |
3064 | DSSERR("framedone timeout\n"); | ||
3065 | DSSERR("failed update %d,%d %dx%d\n", | ||
3066 | x, y, w, h); | ||
3067 | 2959 | ||
3068 | dispc_enable_sidle(); | 2960 | if (dssdev->manager->caps & OMAP_DSS_OVL_MGR_CAP_DISPC) { |
3069 | dispc_enable_lcd_out(0); | 2961 | dss_setup_partial_planes(dssdev, x, y, w, h); |
2962 | dispc_set_lcd_size(*w, *h); | ||
2963 | } | ||
3070 | 2964 | ||
3071 | dsi_reset_tx_fifo(0); | 2965 | return 0; |
3072 | } else { | 2966 | } |
3073 | dsi_handle_framedone(); | 2967 | EXPORT_SYMBOL(omap_dsi_prepare_update); |
3074 | dsi_perf_show("DISPC"); | ||
3075 | } | ||
3076 | } else { | ||
3077 | dsi_update_screen_l4(device, x, y, w, h); | ||
3078 | dsi_perf_show("L4"); | ||
3079 | } | ||
3080 | 2968 | ||
3081 | sched = atomic_read(&dsi.bus_lock.count) < 0; | 2969 | int omap_dsi_update(struct omap_dss_device *dssdev, |
2970 | int channel, | ||
2971 | u16 x, u16 y, u16 w, u16 h, | ||
2972 | void (*callback)(int, void *), void *data) | ||
2973 | { | ||
2974 | dsi.update_channel = channel; | ||
3082 | 2975 | ||
3083 | complete_all(&dsi.update_completion); | 2976 | if (dssdev->manager->caps & OMAP_DSS_OVL_MGR_CAP_DISPC) { |
2977 | dsi.framedone_callback = callback; | ||
2978 | dsi.framedone_data = data; | ||
3084 | 2979 | ||
3085 | dsi_bus_unlock(); | 2980 | dsi.update_region.x = x; |
2981 | dsi.update_region.y = y; | ||
2982 | dsi.update_region.w = w; | ||
2983 | dsi.update_region.h = h; | ||
2984 | dsi.update_region.device = dssdev; | ||
3086 | 2985 | ||
3087 | /* XXX We need to give others chance to get the bus lock. Is | 2986 | dsi_update_screen_dispc(dssdev, x, y, w, h); |
3088 | * there a better way for this? */ | 2987 | } else { |
3089 | if (dsi.update_mode == OMAP_DSS_UPDATE_AUTO && sched) | 2988 | dsi_update_screen_l4(dssdev, x, y, w, h); |
3090 | schedule_timeout_interruptible(1); | 2989 | dsi_perf_show("L4"); |
2990 | callback(0, data); | ||
3091 | } | 2991 | } |
3092 | 2992 | ||
3093 | DSSDBG("update thread exiting\n"); | ||
3094 | |||
3095 | return 0; | 2993 | return 0; |
3096 | } | 2994 | } |
3097 | 2995 | EXPORT_SYMBOL(omap_dsi_update); | |
3098 | |||
3099 | 2996 | ||
3100 | /* Display funcs */ | 2997 | /* Display funcs */ |
3101 | 2998 | ||
@@ -3203,7 +3100,8 @@ static int dsi_display_init_dsi(struct omap_dss_device *dssdev) | |||
3203 | if (r) | 3100 | if (r) |
3204 | goto err1; | 3101 | goto err1; |
3205 | 3102 | ||
3206 | dss_select_clk_source(true, true); | 3103 | dss_select_dispc_clk_source(DSS_SRC_DSI1_PLL_FCLK); |
3104 | dss_select_dsi_clk_source(DSS_SRC_DSI2_PLL_FCLK); | ||
3207 | 3105 | ||
3208 | DSSDBG("PLL OK\n"); | 3106 | DSSDBG("PLL OK\n"); |
3209 | 3107 | ||
@@ -3229,25 +3127,18 @@ static int dsi_display_init_dsi(struct omap_dss_device *dssdev) | |||
3229 | 3127 | ||
3230 | /* enable interface */ | 3128 | /* enable interface */ |
3231 | dsi_vc_enable(0, 1); | 3129 | dsi_vc_enable(0, 1); |
3130 | dsi_vc_enable(1, 1); | ||
3131 | dsi_vc_enable(2, 1); | ||
3132 | dsi_vc_enable(3, 1); | ||
3232 | dsi_if_enable(1); | 3133 | dsi_if_enable(1); |
3233 | dsi_force_tx_stop_mode_io(); | 3134 | dsi_force_tx_stop_mode_io(); |
3234 | 3135 | ||
3235 | if (dssdev->driver->enable) { | ||
3236 | r = dssdev->driver->enable(dssdev); | ||
3237 | if (r) | ||
3238 | goto err4; | ||
3239 | } | ||
3240 | |||
3241 | /* enable high-speed after initial config */ | ||
3242 | dsi_vc_enable_hs(0, 1); | ||
3243 | |||
3244 | return 0; | 3136 | return 0; |
3245 | err4: | ||
3246 | dsi_if_enable(0); | ||
3247 | err3: | 3137 | err3: |
3248 | dsi_complexio_uninit(); | 3138 | dsi_complexio_uninit(); |
3249 | err2: | 3139 | err2: |
3250 | dss_select_clk_source(false, false); | 3140 | dss_select_dispc_clk_source(DSS_SRC_DSS1_ALWON_FCLK); |
3141 | dss_select_dsi_clk_source(DSS_SRC_DSS1_ALWON_FCLK); | ||
3251 | err1: | 3142 | err1: |
3252 | dsi_pll_uninit(); | 3143 | dsi_pll_uninit(); |
3253 | err0: | 3144 | err0: |
@@ -3256,10 +3147,8 @@ err0: | |||
3256 | 3147 | ||
3257 | static void dsi_display_uninit_dsi(struct omap_dss_device *dssdev) | 3148 | static void dsi_display_uninit_dsi(struct omap_dss_device *dssdev) |
3258 | { | 3149 | { |
3259 | if (dssdev->driver->disable) | 3150 | dss_select_dispc_clk_source(DSS_SRC_DSS1_ALWON_FCLK); |
3260 | dssdev->driver->disable(dssdev); | 3151 | dss_select_dsi_clk_source(DSS_SRC_DSS1_ALWON_FCLK); |
3261 | |||
3262 | dss_select_clk_source(false, false); | ||
3263 | dsi_complexio_uninit(); | 3152 | dsi_complexio_uninit(); |
3264 | dsi_pll_uninit(); | 3153 | dsi_pll_uninit(); |
3265 | } | 3154 | } |
@@ -3280,14 +3169,15 @@ static int dsi_core_init(void) | |||
3280 | return 0; | 3169 | return 0; |
3281 | } | 3170 | } |
3282 | 3171 | ||
3283 | static int dsi_display_enable(struct omap_dss_device *dssdev) | 3172 | int omapdss_dsi_display_enable(struct omap_dss_device *dssdev) |
3284 | { | 3173 | { |
3285 | int r = 0; | 3174 | int r = 0; |
3286 | 3175 | ||
3287 | DSSDBG("dsi_display_enable\n"); | 3176 | DSSDBG("dsi_display_enable\n"); |
3288 | 3177 | ||
3178 | WARN_ON(!dsi_bus_is_locked()); | ||
3179 | |||
3289 | mutex_lock(&dsi.lock); | 3180 | mutex_lock(&dsi.lock); |
3290 | dsi_bus_lock(); | ||
3291 | 3181 | ||
3292 | r = omap_dss_start_device(dssdev); | 3182 | r = omap_dss_start_device(dssdev); |
3293 | if (r) { | 3183 | if (r) { |
@@ -3295,100 +3185,47 @@ static int dsi_display_enable(struct omap_dss_device *dssdev) | |||
3295 | goto err0; | 3185 | goto err0; |
3296 | } | 3186 | } |
3297 | 3187 | ||
3298 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { | ||
3299 | DSSERR("dssdev already enabled\n"); | ||
3300 | r = -EINVAL; | ||
3301 | goto err1; | ||
3302 | } | ||
3303 | |||
3304 | enable_clocks(1); | 3188 | enable_clocks(1); |
3305 | dsi_enable_pll_clock(1); | 3189 | dsi_enable_pll_clock(1); |
3306 | 3190 | ||
3307 | r = _dsi_reset(); | 3191 | r = _dsi_reset(); |
3308 | if (r) | 3192 | if (r) |
3309 | goto err2; | 3193 | goto err1; |
3310 | 3194 | ||
3311 | dsi_core_init(); | 3195 | dsi_core_init(); |
3312 | 3196 | ||
3313 | r = dsi_display_init_dispc(dssdev); | 3197 | r = dsi_display_init_dispc(dssdev); |
3314 | if (r) | 3198 | if (r) |
3315 | goto err2; | 3199 | goto err1; |
3316 | 3200 | ||
3317 | r = dsi_display_init_dsi(dssdev); | 3201 | r = dsi_display_init_dsi(dssdev); |
3318 | if (r) | 3202 | if (r) |
3319 | goto err3; | 3203 | goto err2; |
3320 | |||
3321 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
3322 | |||
3323 | dsi.use_ext_te = dssdev->phy.dsi.ext_te; | ||
3324 | r = dsi_set_te(dssdev, dsi.te_enabled); | ||
3325 | if (r) | ||
3326 | goto err4; | ||
3327 | |||
3328 | dsi_set_update_mode(dssdev, dsi.user_update_mode); | ||
3329 | 3204 | ||
3330 | dsi_bus_unlock(); | ||
3331 | mutex_unlock(&dsi.lock); | 3205 | mutex_unlock(&dsi.lock); |
3332 | 3206 | ||
3333 | return 0; | 3207 | return 0; |
3334 | 3208 | ||
3335 | err4: | ||
3336 | |||
3337 | dsi_display_uninit_dsi(dssdev); | ||
3338 | err3: | ||
3339 | dsi_display_uninit_dispc(dssdev); | ||
3340 | err2: | 3209 | err2: |
3210 | dsi_display_uninit_dispc(dssdev); | ||
3211 | err1: | ||
3341 | enable_clocks(0); | 3212 | enable_clocks(0); |
3342 | dsi_enable_pll_clock(0); | 3213 | dsi_enable_pll_clock(0); |
3343 | err1: | ||
3344 | omap_dss_stop_device(dssdev); | 3214 | omap_dss_stop_device(dssdev); |
3345 | err0: | 3215 | err0: |
3346 | dsi_bus_unlock(); | ||
3347 | mutex_unlock(&dsi.lock); | 3216 | mutex_unlock(&dsi.lock); |
3348 | DSSDBG("dsi_display_enable FAILED\n"); | 3217 | DSSDBG("dsi_display_enable FAILED\n"); |
3349 | return r; | 3218 | return r; |
3350 | } | 3219 | } |
3220 | EXPORT_SYMBOL(omapdss_dsi_display_enable); | ||
3351 | 3221 | ||
3352 | static void dsi_display_disable(struct omap_dss_device *dssdev) | 3222 | void omapdss_dsi_display_disable(struct omap_dss_device *dssdev) |
3353 | { | 3223 | { |
3354 | DSSDBG("dsi_display_disable\n"); | 3224 | DSSDBG("dsi_display_disable\n"); |
3355 | 3225 | ||
3356 | mutex_lock(&dsi.lock); | 3226 | WARN_ON(!dsi_bus_is_locked()); |
3357 | dsi_bus_lock(); | ||
3358 | |||
3359 | if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED || | ||
3360 | dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) | ||
3361 | goto end; | ||
3362 | |||
3363 | dsi.update_mode = OMAP_DSS_UPDATE_DISABLED; | ||
3364 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
3365 | |||
3366 | dsi_display_uninit_dispc(dssdev); | ||
3367 | |||
3368 | dsi_display_uninit_dsi(dssdev); | ||
3369 | |||
3370 | enable_clocks(0); | ||
3371 | dsi_enable_pll_clock(0); | ||
3372 | |||
3373 | omap_dss_stop_device(dssdev); | ||
3374 | end: | ||
3375 | dsi_bus_unlock(); | ||
3376 | mutex_unlock(&dsi.lock); | ||
3377 | } | ||
3378 | |||
3379 | static int dsi_display_suspend(struct omap_dss_device *dssdev) | ||
3380 | { | ||
3381 | DSSDBG("dsi_display_suspend\n"); | ||
3382 | 3227 | ||
3383 | mutex_lock(&dsi.lock); | 3228 | mutex_lock(&dsi.lock); |
3384 | dsi_bus_lock(); | ||
3385 | |||
3386 | if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED || | ||
3387 | dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) | ||
3388 | goto end; | ||
3389 | |||
3390 | dsi.update_mode = OMAP_DSS_UPDATE_DISABLED; | ||
3391 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
3392 | 3229 | ||
3393 | dsi_display_uninit_dispc(dssdev); | 3230 | dsi_display_uninit_dispc(dssdev); |
3394 | 3231 | ||
@@ -3396,312 +3233,19 @@ static int dsi_display_suspend(struct omap_dss_device *dssdev) | |||
3396 | 3233 | ||
3397 | enable_clocks(0); | 3234 | enable_clocks(0); |
3398 | dsi_enable_pll_clock(0); | 3235 | dsi_enable_pll_clock(0); |
3399 | end: | ||
3400 | dsi_bus_unlock(); | ||
3401 | mutex_unlock(&dsi.lock); | ||
3402 | |||
3403 | return 0; | ||
3404 | } | ||
3405 | |||
3406 | static int dsi_display_resume(struct omap_dss_device *dssdev) | ||
3407 | { | ||
3408 | int r; | ||
3409 | |||
3410 | DSSDBG("dsi_display_resume\n"); | ||
3411 | |||
3412 | mutex_lock(&dsi.lock); | ||
3413 | dsi_bus_lock(); | ||
3414 | |||
3415 | if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) { | ||
3416 | DSSERR("dssdev not suspended\n"); | ||
3417 | r = -EINVAL; | ||
3418 | goto err0; | ||
3419 | } | ||
3420 | |||
3421 | enable_clocks(1); | ||
3422 | dsi_enable_pll_clock(1); | ||
3423 | |||
3424 | r = _dsi_reset(); | ||
3425 | if (r) | ||
3426 | goto err1; | ||
3427 | |||
3428 | dsi_core_init(); | ||
3429 | |||
3430 | r = dsi_display_init_dispc(dssdev); | ||
3431 | if (r) | ||
3432 | goto err1; | ||
3433 | |||
3434 | r = dsi_display_init_dsi(dssdev); | ||
3435 | if (r) | ||
3436 | goto err2; | ||
3437 | |||
3438 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
3439 | |||
3440 | r = dsi_set_te(dssdev, dsi.te_enabled); | ||
3441 | if (r) | ||
3442 | goto err2; | ||
3443 | |||
3444 | dsi_set_update_mode(dssdev, dsi.user_update_mode); | ||
3445 | |||
3446 | dsi_bus_unlock(); | ||
3447 | mutex_unlock(&dsi.lock); | ||
3448 | |||
3449 | return 0; | ||
3450 | |||
3451 | err2: | ||
3452 | dsi_display_uninit_dispc(dssdev); | ||
3453 | err1: | ||
3454 | enable_clocks(0); | ||
3455 | dsi_enable_pll_clock(0); | ||
3456 | err0: | ||
3457 | dsi_bus_unlock(); | ||
3458 | mutex_unlock(&dsi.lock); | ||
3459 | DSSDBG("dsi_display_resume FAILED\n"); | ||
3460 | return r; | ||
3461 | } | ||
3462 | |||
3463 | static int dsi_display_update(struct omap_dss_device *dssdev, | ||
3464 | u16 x, u16 y, u16 w, u16 h) | ||
3465 | { | ||
3466 | int r = 0; | ||
3467 | u16 dw, dh; | ||
3468 | |||
3469 | DSSDBG("dsi_display_update(%d,%d %dx%d)\n", x, y, w, h); | ||
3470 | 3236 | ||
3471 | mutex_lock(&dsi.lock); | 3237 | omap_dss_stop_device(dssdev); |
3472 | |||
3473 | if (dsi.update_mode != OMAP_DSS_UPDATE_MANUAL) | ||
3474 | goto end; | ||
3475 | |||
3476 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) | ||
3477 | goto end; | ||
3478 | |||
3479 | dssdev->get_resolution(dssdev, &dw, &dh); | ||
3480 | |||
3481 | if (x > dw || y > dh) | ||
3482 | goto end; | ||
3483 | |||
3484 | if (x + w > dw) | ||
3485 | w = dw - x; | ||
3486 | |||
3487 | if (y + h > dh) | ||
3488 | h = dh - y; | ||
3489 | |||
3490 | if (w == 0 || h == 0) | ||
3491 | goto end; | ||
3492 | |||
3493 | if (w == 1) { | ||
3494 | r = -EINVAL; | ||
3495 | goto end; | ||
3496 | } | ||
3497 | |||
3498 | dsi_set_update_region(dssdev, x, y, w, h); | ||
3499 | |||
3500 | wake_up(&dsi.waitqueue); | ||
3501 | |||
3502 | end: | ||
3503 | mutex_unlock(&dsi.lock); | ||
3504 | |||
3505 | return r; | ||
3506 | } | ||
3507 | |||
3508 | static int dsi_display_sync(struct omap_dss_device *dssdev) | ||
3509 | { | ||
3510 | bool wait; | ||
3511 | |||
3512 | DSSDBG("dsi_display_sync()\n"); | ||
3513 | |||
3514 | mutex_lock(&dsi.lock); | ||
3515 | dsi_bus_lock(); | ||
3516 | |||
3517 | if (dsi.update_mode == OMAP_DSS_UPDATE_MANUAL && | ||
3518 | dsi.update_region.dirty) { | ||
3519 | INIT_COMPLETION(dsi.update_completion); | ||
3520 | wait = true; | ||
3521 | } else { | ||
3522 | wait = false; | ||
3523 | } | ||
3524 | |||
3525 | dsi_bus_unlock(); | ||
3526 | mutex_unlock(&dsi.lock); | ||
3527 | |||
3528 | if (wait) | ||
3529 | wait_for_completion_interruptible(&dsi.update_completion); | ||
3530 | |||
3531 | DSSDBG("dsi_display_sync() done\n"); | ||
3532 | return 0; | ||
3533 | } | ||
3534 | |||
3535 | static int dsi_display_set_update_mode(struct omap_dss_device *dssdev, | ||
3536 | enum omap_dss_update_mode mode) | ||
3537 | { | ||
3538 | int r = 0; | ||
3539 | |||
3540 | DSSDBGF("%d", mode); | ||
3541 | |||
3542 | mutex_lock(&dsi.lock); | ||
3543 | dsi_bus_lock(); | ||
3544 | |||
3545 | dsi.user_update_mode = mode; | ||
3546 | r = dsi_set_update_mode(dssdev, mode); | ||
3547 | 3238 | ||
3548 | dsi_bus_unlock(); | ||
3549 | mutex_unlock(&dsi.lock); | 3239 | mutex_unlock(&dsi.lock); |
3550 | |||
3551 | return r; | ||
3552 | } | 3240 | } |
3241 | EXPORT_SYMBOL(omapdss_dsi_display_disable); | ||
3553 | 3242 | ||
3554 | static enum omap_dss_update_mode dsi_display_get_update_mode( | 3243 | int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable) |
3555 | struct omap_dss_device *dssdev) | ||
3556 | { | 3244 | { |
3557 | return dsi.update_mode; | ||
3558 | } | ||
3559 | |||
3560 | |||
3561 | static int dsi_display_enable_te(struct omap_dss_device *dssdev, bool enable) | ||
3562 | { | ||
3563 | int r = 0; | ||
3564 | |||
3565 | DSSDBGF("%d", enable); | ||
3566 | |||
3567 | if (!dssdev->driver->enable_te) | ||
3568 | return -ENOENT; | ||
3569 | |||
3570 | dsi_bus_lock(); | ||
3571 | |||
3572 | dsi.te_enabled = enable; | 3245 | dsi.te_enabled = enable; |
3573 | |||
3574 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) | ||
3575 | goto end; | ||
3576 | |||
3577 | r = dsi_set_te(dssdev, enable); | ||
3578 | end: | ||
3579 | dsi_bus_unlock(); | ||
3580 | |||
3581 | return r; | ||
3582 | } | ||
3583 | |||
3584 | static int dsi_display_get_te(struct omap_dss_device *dssdev) | ||
3585 | { | ||
3586 | return dsi.te_enabled; | ||
3587 | } | ||
3588 | |||
3589 | static int dsi_display_set_rotate(struct omap_dss_device *dssdev, u8 rotate) | ||
3590 | { | ||
3591 | |||
3592 | DSSDBGF("%d", rotate); | ||
3593 | |||
3594 | if (!dssdev->driver->set_rotate || !dssdev->driver->get_rotate) | ||
3595 | return -EINVAL; | ||
3596 | |||
3597 | dsi_bus_lock(); | ||
3598 | dssdev->driver->set_rotate(dssdev, rotate); | ||
3599 | if (dsi.update_mode == OMAP_DSS_UPDATE_AUTO) { | ||
3600 | u16 w, h; | ||
3601 | /* the display dimensions may have changed, so set a new | ||
3602 | * update region */ | ||
3603 | dssdev->get_resolution(dssdev, &w, &h); | ||
3604 | dsi_set_update_region(dssdev, 0, 0, w, h); | ||
3605 | } | ||
3606 | dsi_bus_unlock(); | ||
3607 | |||
3608 | return 0; | 3246 | return 0; |
3609 | } | 3247 | } |
3610 | 3248 | EXPORT_SYMBOL(omapdss_dsi_enable_te); | |
3611 | static u8 dsi_display_get_rotate(struct omap_dss_device *dssdev) | ||
3612 | { | ||
3613 | if (!dssdev->driver->set_rotate || !dssdev->driver->get_rotate) | ||
3614 | return 0; | ||
3615 | |||
3616 | return dssdev->driver->get_rotate(dssdev); | ||
3617 | } | ||
3618 | |||
3619 | static int dsi_display_set_mirror(struct omap_dss_device *dssdev, bool mirror) | ||
3620 | { | ||
3621 | DSSDBGF("%d", mirror); | ||
3622 | |||
3623 | if (!dssdev->driver->set_mirror || !dssdev->driver->get_mirror) | ||
3624 | return -EINVAL; | ||
3625 | |||
3626 | dsi_bus_lock(); | ||
3627 | dssdev->driver->set_mirror(dssdev, mirror); | ||
3628 | dsi_bus_unlock(); | ||
3629 | |||
3630 | return 0; | ||
3631 | } | ||
3632 | |||
3633 | static bool dsi_display_get_mirror(struct omap_dss_device *dssdev) | ||
3634 | { | ||
3635 | if (!dssdev->driver->set_mirror || !dssdev->driver->get_mirror) | ||
3636 | return 0; | ||
3637 | |||
3638 | return dssdev->driver->get_mirror(dssdev); | ||
3639 | } | ||
3640 | |||
3641 | static int dsi_display_run_test(struct omap_dss_device *dssdev, int test_num) | ||
3642 | { | ||
3643 | int r; | ||
3644 | |||
3645 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) | ||
3646 | return -EIO; | ||
3647 | |||
3648 | DSSDBGF("%d", test_num); | ||
3649 | |||
3650 | dsi_bus_lock(); | ||
3651 | |||
3652 | /* run test first in low speed mode */ | ||
3653 | dsi_vc_enable_hs(0, 0); | ||
3654 | |||
3655 | if (dssdev->driver->run_test) { | ||
3656 | r = dssdev->driver->run_test(dssdev, test_num); | ||
3657 | if (r) | ||
3658 | goto end; | ||
3659 | } | ||
3660 | |||
3661 | /* then in high speed */ | ||
3662 | dsi_vc_enable_hs(0, 1); | ||
3663 | |||
3664 | if (dssdev->driver->run_test) { | ||
3665 | r = dssdev->driver->run_test(dssdev, test_num); | ||
3666 | if (r) | ||
3667 | goto end; | ||
3668 | } | ||
3669 | |||
3670 | end: | ||
3671 | dsi_vc_enable_hs(0, 1); | ||
3672 | |||
3673 | dsi_bus_unlock(); | ||
3674 | |||
3675 | return r; | ||
3676 | } | ||
3677 | |||
3678 | static int dsi_display_memory_read(struct omap_dss_device *dssdev, | ||
3679 | void *buf, size_t size, | ||
3680 | u16 x, u16 y, u16 w, u16 h) | ||
3681 | { | ||
3682 | int r; | ||
3683 | |||
3684 | DSSDBGF(""); | ||
3685 | |||
3686 | if (!dssdev->driver->memory_read) | ||
3687 | return -EINVAL; | ||
3688 | |||
3689 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) | ||
3690 | return -EIO; | ||
3691 | |||
3692 | dsi_bus_lock(); | ||
3693 | |||
3694 | r = dssdev->driver->memory_read(dssdev, buf, size, | ||
3695 | x, y, w, h); | ||
3696 | |||
3697 | /* Memory read usually changes the update area. This will | ||
3698 | * force the next update to re-set the update area */ | ||
3699 | dsi.active_update_region.dirty = true; | ||
3700 | |||
3701 | dsi_bus_unlock(); | ||
3702 | |||
3703 | return r; | ||
3704 | } | ||
3705 | 3249 | ||
3706 | void dsi_get_overlay_fifo_thresholds(enum omap_plane plane, | 3250 | void dsi_get_overlay_fifo_thresholds(enum omap_plane plane, |
3707 | u32 fifo_size, enum omap_burst_size *burst_size, | 3251 | u32 fifo_size, enum omap_burst_size *burst_size, |
@@ -3720,26 +3264,6 @@ int dsi_init_display(struct omap_dss_device *dssdev) | |||
3720 | { | 3264 | { |
3721 | DSSDBG("DSI init\n"); | 3265 | DSSDBG("DSI init\n"); |
3722 | 3266 | ||
3723 | dssdev->enable = dsi_display_enable; | ||
3724 | dssdev->disable = dsi_display_disable; | ||
3725 | dssdev->suspend = dsi_display_suspend; | ||
3726 | dssdev->resume = dsi_display_resume; | ||
3727 | dssdev->update = dsi_display_update; | ||
3728 | dssdev->sync = dsi_display_sync; | ||
3729 | dssdev->set_update_mode = dsi_display_set_update_mode; | ||
3730 | dssdev->get_update_mode = dsi_display_get_update_mode; | ||
3731 | dssdev->enable_te = dsi_display_enable_te; | ||
3732 | dssdev->get_te = dsi_display_get_te; | ||
3733 | |||
3734 | dssdev->get_rotate = dsi_display_get_rotate; | ||
3735 | dssdev->set_rotate = dsi_display_set_rotate; | ||
3736 | |||
3737 | dssdev->get_mirror = dsi_display_get_mirror; | ||
3738 | dssdev->set_mirror = dsi_display_set_mirror; | ||
3739 | |||
3740 | dssdev->run_test = dsi_display_run_test; | ||
3741 | dssdev->memory_read = dsi_display_memory_read; | ||
3742 | |||
3743 | /* XXX these should be figured out dynamically */ | 3267 | /* XXX these should be figured out dynamically */ |
3744 | dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE | | 3268 | dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE | |
3745 | OMAP_DSS_DISPLAY_CAP_TEAR_ELIM; | 3269 | OMAP_DSS_DISPLAY_CAP_TEAR_ELIM; |
@@ -3754,9 +3278,6 @@ int dsi_init(struct platform_device *pdev) | |||
3754 | { | 3278 | { |
3755 | u32 rev; | 3279 | u32 rev; |
3756 | int r; | 3280 | int r; |
3757 | struct sched_param param = { | ||
3758 | .sched_priority = MAX_USER_RT_PRIO-1 | ||
3759 | }; | ||
3760 | 3281 | ||
3761 | spin_lock_init(&dsi.errors_lock); | 3282 | spin_lock_init(&dsi.errors_lock); |
3762 | dsi.errors = 0; | 3283 | dsi.errors = 0; |
@@ -3767,31 +3288,19 @@ int dsi_init(struct platform_device *pdev) | |||
3767 | #endif | 3288 | #endif |
3768 | 3289 | ||
3769 | init_completion(&dsi.bta_completion); | 3290 | init_completion(&dsi.bta_completion); |
3770 | init_completion(&dsi.update_completion); | ||
3771 | |||
3772 | dsi.thread = kthread_create(dsi_update_thread, NULL, "dsi"); | ||
3773 | if (IS_ERR(dsi.thread)) { | ||
3774 | DSSERR("cannot create kthread\n"); | ||
3775 | r = PTR_ERR(dsi.thread); | ||
3776 | goto err0; | ||
3777 | } | ||
3778 | sched_setscheduler(dsi.thread, SCHED_FIFO, ¶m); | ||
3779 | |||
3780 | init_waitqueue_head(&dsi.waitqueue); | ||
3781 | spin_lock_init(&dsi.update_lock); | ||
3782 | 3291 | ||
3783 | mutex_init(&dsi.lock); | 3292 | mutex_init(&dsi.lock); |
3784 | mutex_init(&dsi.bus_lock); | 3293 | sema_init(&dsi.bus_lock, 1); |
3294 | |||
3295 | INIT_WORK(&dsi.framedone_work, dsi_framedone_work_callback); | ||
3296 | INIT_DELAYED_WORK_DEFERRABLE(&dsi.framedone_timeout_work, | ||
3297 | dsi_framedone_timeout_work_callback); | ||
3785 | 3298 | ||
3786 | #ifdef DSI_CATCH_MISSING_TE | 3299 | #ifdef DSI_CATCH_MISSING_TE |
3787 | init_timer(&dsi.te_timer); | 3300 | init_timer(&dsi.te_timer); |
3788 | dsi.te_timer.function = dsi_te_timeout; | 3301 | dsi.te_timer.function = dsi_te_timeout; |
3789 | dsi.te_timer.data = 0; | 3302 | dsi.te_timer.data = 0; |
3790 | #endif | 3303 | #endif |
3791 | |||
3792 | dsi.update_mode = OMAP_DSS_UPDATE_DISABLED; | ||
3793 | dsi.user_update_mode = OMAP_DSS_UPDATE_DISABLED; | ||
3794 | |||
3795 | dsi.base = ioremap(DSI_BASE, DSI_SZ_REGS); | 3304 | dsi.base = ioremap(DSI_BASE, DSI_SZ_REGS); |
3796 | if (!dsi.base) { | 3305 | if (!dsi.base) { |
3797 | DSSERR("can't ioremap DSI\n"); | 3306 | DSSERR("can't ioremap DSI\n"); |
@@ -3799,7 +3308,7 @@ int dsi_init(struct platform_device *pdev) | |||
3799 | goto err1; | 3308 | goto err1; |
3800 | } | 3309 | } |
3801 | 3310 | ||
3802 | dsi.vdds_dsi_reg = regulator_get(&pdev->dev, "vdds_dsi"); | 3311 | dsi.vdds_dsi_reg = dss_get_vdds_dsi(); |
3803 | if (IS_ERR(dsi.vdds_dsi_reg)) { | 3312 | if (IS_ERR(dsi.vdds_dsi_reg)) { |
3804 | iounmap(dsi.base); | 3313 | iounmap(dsi.base); |
3805 | DSSERR("can't get VDDS_DSI regulator\n"); | 3314 | DSSERR("can't get VDDS_DSI regulator\n"); |
@@ -3815,23 +3324,15 @@ int dsi_init(struct platform_device *pdev) | |||
3815 | 3324 | ||
3816 | enable_clocks(0); | 3325 | enable_clocks(0); |
3817 | 3326 | ||
3818 | wake_up_process(dsi.thread); | ||
3819 | |||
3820 | return 0; | 3327 | return 0; |
3821 | err2: | 3328 | err2: |
3822 | iounmap(dsi.base); | 3329 | iounmap(dsi.base); |
3823 | err1: | 3330 | err1: |
3824 | kthread_stop(dsi.thread); | ||
3825 | err0: | ||
3826 | return r; | 3331 | return r; |
3827 | } | 3332 | } |
3828 | 3333 | ||
3829 | void dsi_exit(void) | 3334 | void dsi_exit(void) |
3830 | { | 3335 | { |
3831 | kthread_stop(dsi.thread); | ||
3832 | |||
3833 | regulator_put(dsi.vdds_dsi_reg); | ||
3834 | |||
3835 | iounmap(dsi.base); | 3336 | iounmap(dsi.base); |
3836 | 3337 | ||
3837 | DSSDBG("omap_dsi_exit\n"); | 3338 | DSSDBG("omap_dsi_exit\n"); |
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c index 0a26b7d84d41..8254a4232a53 100644 --- a/drivers/video/omap2/dss/dss.c +++ b/drivers/video/omap2/dss/dss.c | |||
@@ -68,6 +68,9 @@ static struct { | |||
68 | struct dss_clock_info cache_dss_cinfo; | 68 | struct dss_clock_info cache_dss_cinfo; |
69 | struct dispc_clock_info cache_dispc_cinfo; | 69 | struct dispc_clock_info cache_dispc_cinfo; |
70 | 70 | ||
71 | enum dss_clk_source dsi_clk_source; | ||
72 | enum dss_clk_source dispc_clk_source; | ||
73 | |||
71 | u32 ctx[DSS_SZ_REGS / sizeof(u32)]; | 74 | u32 ctx[DSS_SZ_REGS / sizeof(u32)]; |
72 | } dss; | 75 | } dss; |
73 | 76 | ||
@@ -247,23 +250,42 @@ void dss_dump_regs(struct seq_file *s) | |||
247 | #undef DUMPREG | 250 | #undef DUMPREG |
248 | } | 251 | } |
249 | 252 | ||
250 | void dss_select_clk_source(bool dsi, bool dispc) | 253 | void dss_select_dispc_clk_source(enum dss_clk_source clk_src) |
254 | { | ||
255 | int b; | ||
256 | |||
257 | BUG_ON(clk_src != DSS_SRC_DSI1_PLL_FCLK && | ||
258 | clk_src != DSS_SRC_DSS1_ALWON_FCLK); | ||
259 | |||
260 | b = clk_src == DSS_SRC_DSS1_ALWON_FCLK ? 0 : 1; | ||
261 | |||
262 | REG_FLD_MOD(DSS_CONTROL, b, 0, 0); /* DISPC_CLK_SWITCH */ | ||
263 | |||
264 | dss.dispc_clk_source = clk_src; | ||
265 | } | ||
266 | |||
267 | void dss_select_dsi_clk_source(enum dss_clk_source clk_src) | ||
251 | { | 268 | { |
252 | u32 r; | 269 | int b; |
253 | r = dss_read_reg(DSS_CONTROL); | 270 | |
254 | r = FLD_MOD(r, dsi, 1, 1); /* DSI_CLK_SWITCH */ | 271 | BUG_ON(clk_src != DSS_SRC_DSI2_PLL_FCLK && |
255 | r = FLD_MOD(r, dispc, 0, 0); /* DISPC_CLK_SWITCH */ | 272 | clk_src != DSS_SRC_DSS1_ALWON_FCLK); |
256 | dss_write_reg(DSS_CONTROL, r); | 273 | |
274 | b = clk_src == DSS_SRC_DSS1_ALWON_FCLK ? 0 : 1; | ||
275 | |||
276 | REG_FLD_MOD(DSS_CONTROL, b, 1, 1); /* DSI_CLK_SWITCH */ | ||
277 | |||
278 | dss.dsi_clk_source = clk_src; | ||
257 | } | 279 | } |
258 | 280 | ||
259 | int dss_get_dsi_clk_source(void) | 281 | enum dss_clk_source dss_get_dispc_clk_source(void) |
260 | { | 282 | { |
261 | return FLD_GET(dss_read_reg(DSS_CONTROL), 1, 1); | 283 | return dss.dispc_clk_source; |
262 | } | 284 | } |
263 | 285 | ||
264 | int dss_get_dispc_clk_source(void) | 286 | enum dss_clk_source dss_get_dsi_clk_source(void) |
265 | { | 287 | { |
266 | return FLD_GET(dss_read_reg(DSS_CONTROL), 0, 0); | 288 | return dss.dsi_clk_source; |
267 | } | 289 | } |
268 | 290 | ||
269 | /* calculate clock rates using dividers in cinfo */ | 291 | /* calculate clock rates using dividers in cinfo */ |
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 2bcb1245d6c2..24326a5fd292 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h | |||
@@ -119,6 +119,12 @@ enum dss_clock { | |||
119 | DSS_CLK_96M = 1 << 4, | 119 | DSS_CLK_96M = 1 << 4, |
120 | }; | 120 | }; |
121 | 121 | ||
122 | enum dss_clk_source { | ||
123 | DSS_SRC_DSI1_PLL_FCLK, | ||
124 | DSS_SRC_DSI2_PLL_FCLK, | ||
125 | DSS_SRC_DSS1_ALWON_FCLK, | ||
126 | }; | ||
127 | |||
122 | struct dss_clock_info { | 128 | struct dss_clock_info { |
123 | /* rates that we get with dividers below */ | 129 | /* rates that we get with dividers below */ |
124 | unsigned long fck; | 130 | unsigned long fck; |
@@ -169,6 +175,9 @@ unsigned long dss_clk_get_rate(enum dss_clock clk); | |||
169 | int dss_need_ctx_restore(void); | 175 | int dss_need_ctx_restore(void); |
170 | void dss_dump_clocks(struct seq_file *s); | 176 | void dss_dump_clocks(struct seq_file *s); |
171 | struct bus_type *dss_get_bus(void); | 177 | struct bus_type *dss_get_bus(void); |
178 | struct regulator *dss_get_vdds_dsi(void); | ||
179 | struct regulator *dss_get_vdds_sdi(void); | ||
180 | struct regulator *dss_get_vdda_dac(void); | ||
172 | 181 | ||
173 | /* display */ | 182 | /* display */ |
174 | int dss_suspend_all_devices(void); | 183 | int dss_suspend_all_devices(void); |
@@ -216,9 +225,11 @@ void dss_sdi_init(u8 datapairs); | |||
216 | int dss_sdi_enable(void); | 225 | int dss_sdi_enable(void); |
217 | void dss_sdi_disable(void); | 226 | void dss_sdi_disable(void); |
218 | 227 | ||
219 | void dss_select_clk_source(bool dsi, bool dispc); | 228 | void dss_select_dispc_clk_source(enum dss_clk_source clk_src); |
220 | int dss_get_dsi_clk_source(void); | 229 | void dss_select_dsi_clk_source(enum dss_clk_source clk_src); |
221 | int dss_get_dispc_clk_source(void); | 230 | enum dss_clk_source dss_get_dispc_clk_source(void); |
231 | enum dss_clk_source dss_get_dsi_clk_source(void); | ||
232 | |||
222 | void dss_set_venc_output(enum omap_dss_venc_type type); | 233 | void dss_set_venc_output(enum omap_dss_venc_type type); |
223 | void dss_set_dac_pwrdn_bgz(bool enable); | 234 | void dss_set_dac_pwrdn_bgz(bool enable); |
224 | 235 | ||
@@ -261,7 +272,7 @@ void dsi_get_overlay_fifo_thresholds(enum omap_plane plane, | |||
261 | u32 *fifo_low, u32 *fifo_high); | 272 | u32 *fifo_low, u32 *fifo_high); |
262 | 273 | ||
263 | /* DPI */ | 274 | /* DPI */ |
264 | int dpi_init(void); | 275 | int dpi_init(struct platform_device *pdev); |
265 | void dpi_exit(void); | 276 | void dpi_exit(void); |
266 | int dpi_init_display(struct omap_dss_device *dssdev); | 277 | int dpi_init_display(struct omap_dss_device *dssdev); |
267 | 278 | ||
@@ -313,8 +324,8 @@ int dispc_setup_plane(enum omap_plane plane, | |||
313 | 324 | ||
314 | bool dispc_go_busy(enum omap_channel channel); | 325 | bool dispc_go_busy(enum omap_channel channel); |
315 | void dispc_go(enum omap_channel channel); | 326 | void dispc_go(enum omap_channel channel); |
316 | void dispc_enable_lcd_out(bool enable); | 327 | void dispc_enable_channel(enum omap_channel channel, bool enable); |
317 | void dispc_enable_digit_out(bool enable); | 328 | bool dispc_is_channel_enabled(enum omap_channel channel); |
318 | int dispc_enable_plane(enum omap_plane plane, bool enable); | 329 | int dispc_enable_plane(enum omap_plane plane, bool enable); |
319 | void dispc_enable_replication(enum omap_plane plane, bool enable); | 330 | void dispc_enable_replication(enum omap_plane plane, bool enable); |
320 | 331 | ||
diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c index 27d9c465c851..913142d4cab1 100644 --- a/drivers/video/omap2/dss/manager.c +++ b/drivers/video/omap2/dss/manager.c | |||
@@ -501,6 +501,19 @@ static int omap_dss_unset_device(struct omap_overlay_manager *mgr) | |||
501 | return 0; | 501 | return 0; |
502 | } | 502 | } |
503 | 503 | ||
504 | static int dss_mgr_wait_for_vsync(struct omap_overlay_manager *mgr) | ||
505 | { | ||
506 | unsigned long timeout = msecs_to_jiffies(500); | ||
507 | u32 irq; | ||
508 | |||
509 | if (mgr->device->type == OMAP_DISPLAY_TYPE_VENC) | ||
510 | irq = DISPC_IRQ_EVSYNC_ODD; | ||
511 | else | ||
512 | irq = DISPC_IRQ_VSYNC; | ||
513 | |||
514 | return omap_dispc_wait_for_irq_interruptible_timeout(irq, timeout); | ||
515 | } | ||
516 | |||
504 | static int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr) | 517 | static int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr) |
505 | { | 518 | { |
506 | unsigned long timeout = msecs_to_jiffies(500); | 519 | unsigned long timeout = msecs_to_jiffies(500); |
@@ -509,17 +522,18 @@ static int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr) | |||
509 | u32 irq; | 522 | u32 irq; |
510 | int r; | 523 | int r; |
511 | int i; | 524 | int i; |
525 | struct omap_dss_device *dssdev = mgr->device; | ||
512 | 526 | ||
513 | if (!mgr->device) | 527 | if (!dssdev) |
514 | return 0; | 528 | return 0; |
515 | 529 | ||
516 | if (mgr->device->type == OMAP_DISPLAY_TYPE_VENC) { | 530 | if (dssdev->type == OMAP_DISPLAY_TYPE_VENC) { |
517 | irq = DISPC_IRQ_EVSYNC_ODD | DISPC_IRQ_EVSYNC_EVEN; | 531 | irq = DISPC_IRQ_EVSYNC_ODD | DISPC_IRQ_EVSYNC_EVEN; |
518 | channel = OMAP_DSS_CHANNEL_DIGIT; | 532 | channel = OMAP_DSS_CHANNEL_DIGIT; |
519 | } else { | 533 | } else { |
520 | if (mgr->device->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) { | 534 | if (dssdev->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) { |
521 | enum omap_dss_update_mode mode; | 535 | enum omap_dss_update_mode mode; |
522 | mode = mgr->device->get_update_mode(mgr->device); | 536 | mode = dssdev->driver->get_update_mode(dssdev); |
523 | if (mode != OMAP_DSS_UPDATE_AUTO) | 537 | if (mode != OMAP_DSS_UPDATE_AUTO) |
524 | return 0; | 538 | return 0; |
525 | 539 | ||
@@ -592,7 +606,7 @@ int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl) | |||
592 | } else { | 606 | } else { |
593 | if (dssdev->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) { | 607 | if (dssdev->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) { |
594 | enum omap_dss_update_mode mode; | 608 | enum omap_dss_update_mode mode; |
595 | mode = dssdev->get_update_mode(dssdev); | 609 | mode = dssdev->driver->get_update_mode(dssdev); |
596 | if (mode != OMAP_DSS_UPDATE_AUTO) | 610 | if (mode != OMAP_DSS_UPDATE_AUTO) |
597 | return 0; | 611 | return 0; |
598 | 612 | ||
@@ -1064,7 +1078,7 @@ void dss_start_update(struct omap_dss_device *dssdev) | |||
1064 | mc->shadow_dirty = false; | 1078 | mc->shadow_dirty = false; |
1065 | } | 1079 | } |
1066 | 1080 | ||
1067 | dispc_enable_lcd_out(1); | 1081 | dssdev->manager->enable(dssdev->manager); |
1068 | } | 1082 | } |
1069 | 1083 | ||
1070 | static void dss_apply_irq_handler(void *data, u32 mask) | 1084 | static void dss_apply_irq_handler(void *data, u32 mask) |
@@ -1196,7 +1210,8 @@ static int omap_dss_mgr_apply(struct omap_overlay_manager *mgr) | |||
1196 | 1210 | ||
1197 | oc->manual_update = | 1211 | oc->manual_update = |
1198 | dssdev->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE && | 1212 | dssdev->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE && |
1199 | dssdev->get_update_mode(dssdev) != OMAP_DSS_UPDATE_AUTO; | 1213 | dssdev->driver->get_update_mode(dssdev) != |
1214 | OMAP_DSS_UPDATE_AUTO; | ||
1200 | 1215 | ||
1201 | ++num_planes_enabled; | 1216 | ++num_planes_enabled; |
1202 | } | 1217 | } |
@@ -1237,7 +1252,8 @@ static int omap_dss_mgr_apply(struct omap_overlay_manager *mgr) | |||
1237 | 1252 | ||
1238 | mc->manual_update = | 1253 | mc->manual_update = |
1239 | dssdev->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE && | 1254 | dssdev->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE && |
1240 | dssdev->get_update_mode(dssdev) != OMAP_DSS_UPDATE_AUTO; | 1255 | dssdev->driver->get_update_mode(dssdev) != |
1256 | OMAP_DSS_UPDATE_AUTO; | ||
1241 | } | 1257 | } |
1242 | 1258 | ||
1243 | /* XXX TODO: Try to get fifomerge working. The problem is that it | 1259 | /* XXX TODO: Try to get fifomerge working. The problem is that it |
@@ -1351,6 +1367,18 @@ static void omap_dss_mgr_get_info(struct omap_overlay_manager *mgr, | |||
1351 | *info = mgr->info; | 1367 | *info = mgr->info; |
1352 | } | 1368 | } |
1353 | 1369 | ||
1370 | static int dss_mgr_enable(struct omap_overlay_manager *mgr) | ||
1371 | { | ||
1372 | dispc_enable_channel(mgr->id, 1); | ||
1373 | return 0; | ||
1374 | } | ||
1375 | |||
1376 | static int dss_mgr_disable(struct omap_overlay_manager *mgr) | ||
1377 | { | ||
1378 | dispc_enable_channel(mgr->id, 0); | ||
1379 | return 0; | ||
1380 | } | ||
1381 | |||
1354 | static void omap_dss_add_overlay_manager(struct omap_overlay_manager *manager) | 1382 | static void omap_dss_add_overlay_manager(struct omap_overlay_manager *manager) |
1355 | { | 1383 | { |
1356 | ++num_managers; | 1384 | ++num_managers; |
@@ -1394,6 +1422,10 @@ int dss_init_overlay_managers(struct platform_device *pdev) | |||
1394 | mgr->set_manager_info = &omap_dss_mgr_set_info; | 1422 | mgr->set_manager_info = &omap_dss_mgr_set_info; |
1395 | mgr->get_manager_info = &omap_dss_mgr_get_info; | 1423 | mgr->get_manager_info = &omap_dss_mgr_get_info; |
1396 | mgr->wait_for_go = &dss_mgr_wait_for_go; | 1424 | mgr->wait_for_go = &dss_mgr_wait_for_go; |
1425 | mgr->wait_for_vsync = &dss_mgr_wait_for_vsync; | ||
1426 | |||
1427 | mgr->enable = &dss_mgr_enable; | ||
1428 | mgr->disable = &dss_mgr_disable; | ||
1397 | 1429 | ||
1398 | mgr->caps = OMAP_DSS_OVL_MGR_CAP_DISPC; | 1430 | mgr->caps = OMAP_DSS_OVL_MGR_CAP_DISPC; |
1399 | 1431 | ||
diff --git a/drivers/video/omap2/dss/overlay.c b/drivers/video/omap2/dss/overlay.c index b7f9a7339842..0c5bea263ac6 100644 --- a/drivers/video/omap2/dss/overlay.c +++ b/drivers/video/omap2/dss/overlay.c | |||
@@ -350,7 +350,7 @@ int dss_check_overlay(struct omap_overlay *ovl, struct omap_dss_device *dssdev) | |||
350 | return -EINVAL; | 350 | return -EINVAL; |
351 | } | 351 | } |
352 | 352 | ||
353 | dssdev->get_resolution(dssdev, &dw, &dh); | 353 | dssdev->driver->get_resolution(dssdev, &dw, &dh); |
354 | 354 | ||
355 | DSSDBG("check_overlay %d: (%d,%d %dx%d -> %dx%d) disp (%dx%d)\n", | 355 | DSSDBG("check_overlay %d: (%d,%d %dx%d -> %dx%d) disp (%dx%d)\n", |
356 | ovl->id, | 356 | ovl->id, |
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index b936495c065d..cc23f53cc62d 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c | |||
@@ -36,8 +36,6 @@ | |||
36 | #include <plat/display.h> | 36 | #include <plat/display.h> |
37 | #include "dss.h" | 37 | #include "dss.h" |
38 | 38 | ||
39 | /*#define MEASURE_PERF*/ | ||
40 | |||
41 | #define RFBI_BASE 0x48050800 | 39 | #define RFBI_BASE 0x48050800 |
42 | 40 | ||
43 | struct rfbi_reg { u16 idx; }; | 41 | struct rfbi_reg { u16 idx; }; |
@@ -66,8 +64,6 @@ struct rfbi_reg { u16 idx; }; | |||
66 | #define RFBI_VSYNC_WIDTH RFBI_REG(0x0090) | 64 | #define RFBI_VSYNC_WIDTH RFBI_REG(0x0090) |
67 | #define RFBI_HSYNC_WIDTH RFBI_REG(0x0094) | 65 | #define RFBI_HSYNC_WIDTH RFBI_REG(0x0094) |
68 | 66 | ||
69 | #define RFBI_CMD_FIFO_LEN_BYTES (16 * sizeof(struct update_param)) | ||
70 | |||
71 | #define REG_FLD_MOD(idx, val, start, end) \ | 67 | #define REG_FLD_MOD(idx, val, start, end) \ |
72 | rfbi_write_reg(idx, FLD_MOD(rfbi_read_reg(idx), val, start, end)) | 68 | rfbi_write_reg(idx, FLD_MOD(rfbi_read_reg(idx), val, start, end)) |
73 | 69 | ||
@@ -102,7 +98,6 @@ enum update_cmd { | |||
102 | 98 | ||
103 | static int rfbi_convert_timings(struct rfbi_timings *t); | 99 | static int rfbi_convert_timings(struct rfbi_timings *t); |
104 | static void rfbi_get_clk_info(u32 *clk_period, u32 *max_clk_div); | 100 | static void rfbi_get_clk_info(u32 *clk_period, u32 *max_clk_div); |
105 | static void process_cmd_fifo(void); | ||
106 | 101 | ||
107 | static struct { | 102 | static struct { |
108 | void __iomem *base; | 103 | void __iomem *base; |
@@ -125,11 +120,6 @@ static struct { | |||
125 | struct completion cmd_done; | 120 | struct completion cmd_done; |
126 | atomic_t cmd_fifo_full; | 121 | atomic_t cmd_fifo_full; |
127 | atomic_t cmd_pending; | 122 | atomic_t cmd_pending; |
128 | #ifdef MEASURE_PERF | ||
129 | unsigned perf_bytes; | ||
130 | ktime_t perf_setup_time; | ||
131 | ktime_t perf_start_time; | ||
132 | #endif | ||
133 | } rfbi; | 123 | } rfbi; |
134 | 124 | ||
135 | struct update_region { | 125 | struct update_region { |
@@ -139,16 +129,6 @@ struct update_region { | |||
139 | u16 h; | 129 | u16 h; |
140 | }; | 130 | }; |
141 | 131 | ||
142 | struct update_param { | ||
143 | u8 rfbi_module; | ||
144 | u8 cmd; | ||
145 | |||
146 | union { | ||
147 | struct update_region r; | ||
148 | struct completion *sync; | ||
149 | } par; | ||
150 | }; | ||
151 | |||
152 | static inline void rfbi_write_reg(const struct rfbi_reg idx, u32 val) | 132 | static inline void rfbi_write_reg(const struct rfbi_reg idx, u32 val) |
153 | { | 133 | { |
154 | __raw_writel(val, rfbi.base + idx.idx); | 134 | __raw_writel(val, rfbi.base + idx.idx); |
@@ -321,55 +301,6 @@ void omap_rfbi_write_pixels(const void __iomem *buf, int scr_width, | |||
321 | } | 301 | } |
322 | EXPORT_SYMBOL(omap_rfbi_write_pixels); | 302 | EXPORT_SYMBOL(omap_rfbi_write_pixels); |
323 | 303 | ||
324 | #ifdef MEASURE_PERF | ||
325 | static void perf_mark_setup(void) | ||
326 | { | ||
327 | rfbi.perf_setup_time = ktime_get(); | ||
328 | } | ||
329 | |||
330 | static void perf_mark_start(void) | ||
331 | { | ||
332 | rfbi.perf_start_time = ktime_get(); | ||
333 | } | ||
334 | |||
335 | static void perf_show(const char *name) | ||
336 | { | ||
337 | ktime_t t, setup_time, trans_time; | ||
338 | u32 total_bytes; | ||
339 | u32 setup_us, trans_us, total_us; | ||
340 | |||
341 | t = ktime_get(); | ||
342 | |||
343 | setup_time = ktime_sub(rfbi.perf_start_time, rfbi.perf_setup_time); | ||
344 | setup_us = (u32)ktime_to_us(setup_time); | ||
345 | if (setup_us == 0) | ||
346 | setup_us = 1; | ||
347 | |||
348 | trans_time = ktime_sub(t, rfbi.perf_start_time); | ||
349 | trans_us = (u32)ktime_to_us(trans_time); | ||
350 | if (trans_us == 0) | ||
351 | trans_us = 1; | ||
352 | |||
353 | total_us = setup_us + trans_us; | ||
354 | |||
355 | total_bytes = rfbi.perf_bytes; | ||
356 | |||
357 | DSSINFO("%s update %u us + %u us = %u us (%uHz), %u bytes, " | ||
358 | "%u kbytes/sec\n", | ||
359 | name, | ||
360 | setup_us, | ||
361 | trans_us, | ||
362 | total_us, | ||
363 | 1000*1000 / total_us, | ||
364 | total_bytes, | ||
365 | total_bytes * 1000 / total_us); | ||
366 | } | ||
367 | #else | ||
368 | #define perf_mark_setup() | ||
369 | #define perf_mark_start() | ||
370 | #define perf_show(x) | ||
371 | #endif | ||
372 | |||
373 | void rfbi_transfer_area(u16 width, u16 height, | 304 | void rfbi_transfer_area(u16 width, u16 height, |
374 | void (callback)(void *data), void *data) | 305 | void (callback)(void *data), void *data) |
375 | { | 306 | { |
@@ -382,7 +313,7 @@ void rfbi_transfer_area(u16 width, u16 height, | |||
382 | 313 | ||
383 | dispc_set_lcd_size(width, height); | 314 | dispc_set_lcd_size(width, height); |
384 | 315 | ||
385 | dispc_enable_lcd_out(1); | 316 | dispc_enable_channel(OMAP_DSS_CHANNEL_LCD, true); |
386 | 317 | ||
387 | rfbi.framedone_callback = callback; | 318 | rfbi.framedone_callback = callback; |
388 | rfbi.framedone_callback_data = data; | 319 | rfbi.framedone_callback_data = data; |
@@ -396,8 +327,6 @@ void rfbi_transfer_area(u16 width, u16 height, | |||
396 | if (!rfbi.te_enabled) | 327 | if (!rfbi.te_enabled) |
397 | l = FLD_MOD(l, 1, 4, 4); /* ITE */ | 328 | l = FLD_MOD(l, 1, 4, 4); /* ITE */ |
398 | 329 | ||
399 | perf_mark_start(); | ||
400 | |||
401 | rfbi_write_reg(RFBI_CONTROL, l); | 330 | rfbi_write_reg(RFBI_CONTROL, l); |
402 | } | 331 | } |
403 | 332 | ||
@@ -407,8 +336,6 @@ static void framedone_callback(void *data, u32 mask) | |||
407 | 336 | ||
408 | DSSDBG("FRAMEDONE\n"); | 337 | DSSDBG("FRAMEDONE\n"); |
409 | 338 | ||
410 | perf_show("DISPC"); | ||
411 | |||
412 | REG_FLD_MOD(RFBI_CONTROL, 0, 0, 0); | 339 | REG_FLD_MOD(RFBI_CONTROL, 0, 0, 0); |
413 | 340 | ||
414 | rfbi_enable_clocks(0); | 341 | rfbi_enable_clocks(0); |
@@ -416,11 +343,10 @@ static void framedone_callback(void *data, u32 mask) | |||
416 | callback = rfbi.framedone_callback; | 343 | callback = rfbi.framedone_callback; |
417 | rfbi.framedone_callback = NULL; | 344 | rfbi.framedone_callback = NULL; |
418 | 345 | ||
419 | /*callback(rfbi.framedone_callback_data);*/ | 346 | if (callback != NULL) |
347 | callback(rfbi.framedone_callback_data); | ||
420 | 348 | ||
421 | atomic_set(&rfbi.cmd_pending, 0); | 349 | atomic_set(&rfbi.cmd_pending, 0); |
422 | |||
423 | process_cmd_fifo(); | ||
424 | } | 350 | } |
425 | 351 | ||
426 | #if 1 /* VERBOSE */ | 352 | #if 1 /* VERBOSE */ |
@@ -937,52 +863,43 @@ int rfbi_configure(int rfbi_module, int bpp, int lines) | |||
937 | } | 863 | } |
938 | EXPORT_SYMBOL(rfbi_configure); | 864 | EXPORT_SYMBOL(rfbi_configure); |
939 | 865 | ||
940 | static int rfbi_find_display(struct omap_dss_device *dssdev) | 866 | int omap_rfbi_prepare_update(struct omap_dss_device *dssdev, |
867 | u16 *x, u16 *y, u16 *w, u16 *h) | ||
941 | { | 868 | { |
942 | if (dssdev == rfbi.dssdev[0]) | 869 | u16 dw, dh; |
943 | return 0; | ||
944 | 870 | ||
945 | if (dssdev == rfbi.dssdev[1]) | 871 | dssdev->driver->get_resolution(dssdev, &dw, &dh); |
946 | return 1; | ||
947 | 872 | ||
948 | BUG(); | 873 | if (*x > dw || *y > dh) |
949 | return -1; | 874 | return -EINVAL; |
950 | } | ||
951 | 875 | ||
876 | if (*x + *w > dw) | ||
877 | return -EINVAL; | ||
952 | 878 | ||
953 | static void signal_fifo_waiters(void) | 879 | if (*y + *h > dh) |
954 | { | 880 | return -EINVAL; |
955 | if (atomic_read(&rfbi.cmd_fifo_full) > 0) { | ||
956 | /* DSSDBG("SIGNALING: Fifo not full for waiter!\n"); */ | ||
957 | complete(&rfbi.cmd_done); | ||
958 | atomic_dec(&rfbi.cmd_fifo_full); | ||
959 | } | ||
960 | } | ||
961 | 881 | ||
962 | /* returns 1 for async op, and 0 for sync op */ | 882 | if (*w == 1) |
963 | static int do_update(struct omap_dss_device *dssdev, struct update_region *upd) | 883 | return -EINVAL; |
964 | { | ||
965 | u16 x = upd->x; | ||
966 | u16 y = upd->y; | ||
967 | u16 w = upd->w; | ||
968 | u16 h = upd->h; | ||
969 | 884 | ||
970 | perf_mark_setup(); | 885 | if (*w == 0 || *h == 0) |
886 | return -EINVAL; | ||
971 | 887 | ||
972 | if (dssdev->manager->caps & OMAP_DSS_OVL_MGR_CAP_DISPC) { | 888 | if (dssdev->manager->caps & OMAP_DSS_OVL_MGR_CAP_DISPC) { |
973 | /*dssdev->driver->enable_te(dssdev, 1); */ | 889 | dss_setup_partial_planes(dssdev, x, y, w, h); |
974 | dss_setup_partial_planes(dssdev, &x, &y, &w, &h); | 890 | dispc_set_lcd_size(*w, *h); |
975 | } | 891 | } |
976 | 892 | ||
977 | #ifdef MEASURE_PERF | 893 | return 0; |
978 | rfbi.perf_bytes = w * h * 2; /* XXX always 16bit */ | 894 | } |
979 | #endif | 895 | EXPORT_SYMBOL(omap_rfbi_prepare_update); |
980 | |||
981 | dssdev->driver->setup_update(dssdev, x, y, w, h); | ||
982 | 896 | ||
897 | int omap_rfbi_update(struct omap_dss_device *dssdev, | ||
898 | u16 x, u16 y, u16 w, u16 h, | ||
899 | void (*callback)(void *), void *data) | ||
900 | { | ||
983 | if (dssdev->manager->caps & OMAP_DSS_OVL_MGR_CAP_DISPC) { | 901 | if (dssdev->manager->caps & OMAP_DSS_OVL_MGR_CAP_DISPC) { |
984 | rfbi_transfer_area(w, h, NULL, NULL); | 902 | rfbi_transfer_area(w, h, callback, data); |
985 | return 1; | ||
986 | } else { | 903 | } else { |
987 | struct omap_overlay *ovl; | 904 | struct omap_overlay *ovl; |
988 | void __iomem *addr; | 905 | void __iomem *addr; |
@@ -994,123 +911,12 @@ static int do_update(struct omap_dss_device *dssdev, struct update_region *upd) | |||
994 | 911 | ||
995 | omap_rfbi_write_pixels(addr, scr_width, x, y, w, h); | 912 | omap_rfbi_write_pixels(addr, scr_width, x, y, w, h); |
996 | 913 | ||
997 | perf_show("L4"); | 914 | callback(data); |
998 | |||
999 | return 0; | ||
1000 | } | 915 | } |
1001 | } | ||
1002 | |||
1003 | static void process_cmd_fifo(void) | ||
1004 | { | ||
1005 | int len; | ||
1006 | struct update_param p; | ||
1007 | struct omap_dss_device *dssdev; | ||
1008 | unsigned long flags; | ||
1009 | |||
1010 | if (atomic_inc_return(&rfbi.cmd_pending) != 1) | ||
1011 | return; | ||
1012 | |||
1013 | while (true) { | ||
1014 | spin_lock_irqsave(&rfbi.cmd_lock, flags); | ||
1015 | |||
1016 | len = kfifo_out(&rfbi.cmd_fifo, (unsigned char *)&p, | ||
1017 | sizeof(struct update_param)); | ||
1018 | if (len == 0) { | ||
1019 | DSSDBG("nothing more in fifo\n"); | ||
1020 | atomic_set(&rfbi.cmd_pending, 0); | ||
1021 | spin_unlock_irqrestore(&rfbi.cmd_lock, flags); | ||
1022 | break; | ||
1023 | } | ||
1024 | |||
1025 | /* DSSDBG("fifo full %d\n", rfbi.cmd_fifo_full.counter);*/ | ||
1026 | |||
1027 | spin_unlock_irqrestore(&rfbi.cmd_lock, flags); | ||
1028 | |||
1029 | BUG_ON(len != sizeof(struct update_param)); | ||
1030 | BUG_ON(p.rfbi_module > 1); | ||
1031 | |||
1032 | dssdev = rfbi.dssdev[p.rfbi_module]; | ||
1033 | |||
1034 | if (p.cmd == RFBI_CMD_UPDATE) { | ||
1035 | if (do_update(dssdev, &p.par.r)) | ||
1036 | break; /* async op */ | ||
1037 | } else if (p.cmd == RFBI_CMD_SYNC) { | ||
1038 | DSSDBG("Signaling SYNC done!\n"); | ||
1039 | complete(p.par.sync); | ||
1040 | } else | ||
1041 | BUG(); | ||
1042 | } | ||
1043 | |||
1044 | signal_fifo_waiters(); | ||
1045 | } | ||
1046 | 916 | ||
1047 | static void rfbi_push_cmd(struct update_param *p) | 917 | return 0; |
1048 | { | ||
1049 | int ret; | ||
1050 | |||
1051 | while (1) { | ||
1052 | unsigned long flags; | ||
1053 | int available; | ||
1054 | |||
1055 | spin_lock_irqsave(&rfbi.cmd_lock, flags); | ||
1056 | available = RFBI_CMD_FIFO_LEN_BYTES - | ||
1057 | kfifo_len(&rfbi.cmd_fifo); | ||
1058 | |||
1059 | /* DSSDBG("%d bytes left in fifo\n", available); */ | ||
1060 | if (available < sizeof(struct update_param)) { | ||
1061 | DSSDBG("Going to wait because FIFO FULL..\n"); | ||
1062 | spin_unlock_irqrestore(&rfbi.cmd_lock, flags); | ||
1063 | atomic_inc(&rfbi.cmd_fifo_full); | ||
1064 | wait_for_completion(&rfbi.cmd_done); | ||
1065 | /*DSSDBG("Woke up because fifo not full anymore\n");*/ | ||
1066 | continue; | ||
1067 | } | ||
1068 | |||
1069 | ret = kfifo_in(&rfbi.cmd_fifo, (unsigned char *)p, | ||
1070 | sizeof(struct update_param)); | ||
1071 | /* DSSDBG("pushed %d bytes\n", ret);*/ | ||
1072 | |||
1073 | spin_unlock_irqrestore(&rfbi.cmd_lock, flags); | ||
1074 | |||
1075 | BUG_ON(ret != sizeof(struct update_param)); | ||
1076 | |||
1077 | break; | ||
1078 | } | ||
1079 | } | ||
1080 | |||
1081 | static void rfbi_push_update(int rfbi_module, int x, int y, int w, int h) | ||
1082 | { | ||
1083 | struct update_param p; | ||
1084 | |||
1085 | p.rfbi_module = rfbi_module; | ||
1086 | p.cmd = RFBI_CMD_UPDATE; | ||
1087 | |||
1088 | p.par.r.x = x; | ||
1089 | p.par.r.y = y; | ||
1090 | p.par.r.w = w; | ||
1091 | p.par.r.h = h; | ||
1092 | |||
1093 | DSSDBG("RFBI pushed %d,%d %dx%d\n", x, y, w, h); | ||
1094 | |||
1095 | rfbi_push_cmd(&p); | ||
1096 | |||
1097 | process_cmd_fifo(); | ||
1098 | } | ||
1099 | |||
1100 | static void rfbi_push_sync(int rfbi_module, struct completion *sync_comp) | ||
1101 | { | ||
1102 | struct update_param p; | ||
1103 | |||
1104 | p.rfbi_module = rfbi_module; | ||
1105 | p.cmd = RFBI_CMD_SYNC; | ||
1106 | p.par.sync = sync_comp; | ||
1107 | |||
1108 | rfbi_push_cmd(&p); | ||
1109 | |||
1110 | DSSDBG("RFBI sync pushed to cmd fifo\n"); | ||
1111 | |||
1112 | process_cmd_fifo(); | ||
1113 | } | 918 | } |
919 | EXPORT_SYMBOL(omap_rfbi_update); | ||
1114 | 920 | ||
1115 | void rfbi_dump_regs(struct seq_file *s) | 921 | void rfbi_dump_regs(struct seq_file *s) |
1116 | { | 922 | { |
@@ -1155,12 +961,8 @@ int rfbi_init(void) | |||
1155 | { | 961 | { |
1156 | u32 rev; | 962 | u32 rev; |
1157 | u32 l; | 963 | u32 l; |
1158 | int r; | ||
1159 | 964 | ||
1160 | spin_lock_init(&rfbi.cmd_lock); | 965 | spin_lock_init(&rfbi.cmd_lock); |
1161 | r = kfifo_alloc(&rfbi.cmd_fifo, RFBI_CMD_FIFO_LEN_BYTES, GFP_KERNEL); | ||
1162 | if (r) | ||
1163 | return r; | ||
1164 | 966 | ||
1165 | init_completion(&rfbi.cmd_done); | 967 | init_completion(&rfbi.cmd_done); |
1166 | atomic_set(&rfbi.cmd_fifo_full, 0); | 968 | atomic_set(&rfbi.cmd_fifo_full, 0); |
@@ -1196,49 +998,10 @@ void rfbi_exit(void) | |||
1196 | { | 998 | { |
1197 | DSSDBG("rfbi_exit\n"); | 999 | DSSDBG("rfbi_exit\n"); |
1198 | 1000 | ||
1199 | kfifo_free(&rfbi.cmd_fifo); | ||
1200 | |||
1201 | iounmap(rfbi.base); | 1001 | iounmap(rfbi.base); |
1202 | } | 1002 | } |
1203 | 1003 | ||
1204 | /* struct omap_display support */ | 1004 | int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev) |
1205 | static int rfbi_display_update(struct omap_dss_device *dssdev, | ||
1206 | u16 x, u16 y, u16 w, u16 h) | ||
1207 | { | ||
1208 | int rfbi_module; | ||
1209 | |||
1210 | if (w == 0 || h == 0) | ||
1211 | return 0; | ||
1212 | |||
1213 | rfbi_module = rfbi_find_display(dssdev); | ||
1214 | |||
1215 | rfbi_push_update(rfbi_module, x, y, w, h); | ||
1216 | |||
1217 | return 0; | ||
1218 | } | ||
1219 | |||
1220 | static int rfbi_display_sync(struct omap_dss_device *dssdev) | ||
1221 | { | ||
1222 | struct completion sync_comp; | ||
1223 | int rfbi_module; | ||
1224 | |||
1225 | rfbi_module = rfbi_find_display(dssdev); | ||
1226 | |||
1227 | init_completion(&sync_comp); | ||
1228 | rfbi_push_sync(rfbi_module, &sync_comp); | ||
1229 | DSSDBG("Waiting for SYNC to happen...\n"); | ||
1230 | wait_for_completion(&sync_comp); | ||
1231 | DSSDBG("Released from SYNC\n"); | ||
1232 | return 0; | ||
1233 | } | ||
1234 | |||
1235 | static int rfbi_display_enable_te(struct omap_dss_device *dssdev, bool enable) | ||
1236 | { | ||
1237 | dssdev->driver->enable_te(dssdev, enable); | ||
1238 | return 0; | ||
1239 | } | ||
1240 | |||
1241 | static int rfbi_display_enable(struct omap_dss_device *dssdev) | ||
1242 | { | 1005 | { |
1243 | int r; | 1006 | int r; |
1244 | 1007 | ||
@@ -1269,41 +1032,25 @@ static int rfbi_display_enable(struct omap_dss_device *dssdev) | |||
1269 | &dssdev->ctrl.rfbi_timings); | 1032 | &dssdev->ctrl.rfbi_timings); |
1270 | 1033 | ||
1271 | 1034 | ||
1272 | if (dssdev->driver->enable) { | ||
1273 | r = dssdev->driver->enable(dssdev); | ||
1274 | if (r) | ||
1275 | goto err2; | ||
1276 | } | ||
1277 | |||
1278 | return 0; | 1035 | return 0; |
1279 | err2: | ||
1280 | omap_dispc_unregister_isr(framedone_callback, NULL, | ||
1281 | DISPC_IRQ_FRAMEDONE); | ||
1282 | err1: | 1036 | err1: |
1283 | omap_dss_stop_device(dssdev); | 1037 | omap_dss_stop_device(dssdev); |
1284 | err0: | 1038 | err0: |
1285 | return r; | 1039 | return r; |
1286 | } | 1040 | } |
1041 | EXPORT_SYMBOL(omapdss_rfbi_display_enable); | ||
1287 | 1042 | ||
1288 | static void rfbi_display_disable(struct omap_dss_device *dssdev) | 1043 | void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev) |
1289 | { | 1044 | { |
1290 | dssdev->driver->disable(dssdev); | ||
1291 | omap_dispc_unregister_isr(framedone_callback, NULL, | 1045 | omap_dispc_unregister_isr(framedone_callback, NULL, |
1292 | DISPC_IRQ_FRAMEDONE); | 1046 | DISPC_IRQ_FRAMEDONE); |
1293 | omap_dss_stop_device(dssdev); | 1047 | omap_dss_stop_device(dssdev); |
1294 | } | 1048 | } |
1049 | EXPORT_SYMBOL(omapdss_rfbi_display_disable); | ||
1295 | 1050 | ||
1296 | int rfbi_init_display(struct omap_dss_device *dssdev) | 1051 | int rfbi_init_display(struct omap_dss_device *dssdev) |
1297 | { | 1052 | { |
1298 | dssdev->enable = rfbi_display_enable; | ||
1299 | dssdev->disable = rfbi_display_disable; | ||
1300 | dssdev->update = rfbi_display_update; | ||
1301 | dssdev->sync = rfbi_display_sync; | ||
1302 | dssdev->enable_te = rfbi_display_enable_te; | ||
1303 | |||
1304 | rfbi.dssdev[dssdev->phy.rfbi.channel] = dssdev; | 1053 | rfbi.dssdev[dssdev->phy.rfbi.channel] = dssdev; |
1305 | |||
1306 | dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE; | 1054 | dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE; |
1307 | |||
1308 | return 0; | 1055 | return 0; |
1309 | } | 1056 | } |
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c index c24f307d3da1..12eb4042dd82 100644 --- a/drivers/video/omap2/dss/sdi.c +++ b/drivers/video/omap2/dss/sdi.c | |||
@@ -41,7 +41,7 @@ static void sdi_basic_init(void) | |||
41 | dispc_lcd_enable_signal_polarity(1); | 41 | dispc_lcd_enable_signal_polarity(1); |
42 | } | 42 | } |
43 | 43 | ||
44 | static int sdi_display_enable(struct omap_dss_device *dssdev) | 44 | int omapdss_sdi_display_enable(struct omap_dss_device *dssdev) |
45 | { | 45 | { |
46 | struct omap_video_timings *t = &dssdev->panel.timings; | 46 | struct omap_video_timings *t = &dssdev->panel.timings; |
47 | struct dss_clock_info dss_cinfo; | 47 | struct dss_clock_info dss_cinfo; |
@@ -57,12 +57,6 @@ static int sdi_display_enable(struct omap_dss_device *dssdev) | |||
57 | goto err0; | 57 | goto err0; |
58 | } | 58 | } |
59 | 59 | ||
60 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { | ||
61 | DSSERR("dssdev already enabled\n"); | ||
62 | r = -EINVAL; | ||
63 | goto err1; | ||
64 | } | ||
65 | |||
66 | /* In case of skip_init sdi_init has already enabled the clocks */ | 60 | /* In case of skip_init sdi_init has already enabled the clocks */ |
67 | if (!sdi.skip_init) | 61 | if (!sdi.skip_init) |
68 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); | 62 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); |
@@ -119,7 +113,7 @@ static int sdi_display_enable(struct omap_dss_device *dssdev) | |||
119 | mdelay(2); | 113 | mdelay(2); |
120 | } | 114 | } |
121 | 115 | ||
122 | dispc_enable_lcd_out(1); | 116 | dssdev->manager->enable(dssdev->manager); |
123 | 117 | ||
124 | if (dssdev->driver->enable) { | 118 | if (dssdev->driver->enable) { |
125 | r = dssdev->driver->enable(dssdev); | 119 | r = dssdev->driver->enable(dssdev); |
@@ -127,13 +121,11 @@ static int sdi_display_enable(struct omap_dss_device *dssdev) | |||
127 | goto err3; | 121 | goto err3; |
128 | } | 122 | } |
129 | 123 | ||
130 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
131 | |||
132 | sdi.skip_init = 0; | 124 | sdi.skip_init = 0; |
133 | 125 | ||
134 | return 0; | 126 | return 0; |
135 | err3: | 127 | err3: |
136 | dispc_enable_lcd_out(0); | 128 | dssdev->manager->disable(dssdev->manager); |
137 | err2: | 129 | err2: |
138 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); | 130 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); |
139 | err1: | 131 | err1: |
@@ -141,120 +133,27 @@ err1: | |||
141 | err0: | 133 | err0: |
142 | return r; | 134 | return r; |
143 | } | 135 | } |
136 | EXPORT_SYMBOL(omapdss_sdi_display_enable); | ||
144 | 137 | ||
145 | static int sdi_display_resume(struct omap_dss_device *dssdev); | 138 | void omapdss_sdi_display_disable(struct omap_dss_device *dssdev) |
146 | |||
147 | static void sdi_display_disable(struct omap_dss_device *dssdev) | ||
148 | { | 139 | { |
149 | if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED) | ||
150 | return; | ||
151 | |||
152 | if (dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) | ||
153 | if (sdi_display_resume(dssdev)) | ||
154 | return; | ||
155 | |||
156 | if (dssdev->driver->disable) | 140 | if (dssdev->driver->disable) |
157 | dssdev->driver->disable(dssdev); | 141 | dssdev->driver->disable(dssdev); |
158 | 142 | ||
159 | dispc_enable_lcd_out(0); | 143 | dssdev->manager->disable(dssdev->manager); |
160 | 144 | ||
161 | dss_sdi_disable(); | 145 | dss_sdi_disable(); |
162 | 146 | ||
163 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); | 147 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); |
164 | 148 | ||
165 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
166 | |||
167 | omap_dss_stop_device(dssdev); | 149 | omap_dss_stop_device(dssdev); |
168 | } | 150 | } |
169 | 151 | EXPORT_SYMBOL(omapdss_sdi_display_disable); | |
170 | static int sdi_display_suspend(struct omap_dss_device *dssdev) | ||
171 | { | ||
172 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) | ||
173 | return -EINVAL; | ||
174 | |||
175 | if (dssdev->driver->suspend) | ||
176 | dssdev->driver->suspend(dssdev); | ||
177 | |||
178 | dispc_enable_lcd_out(0); | ||
179 | |||
180 | dss_sdi_disable(); | ||
181 | |||
182 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); | ||
183 | |||
184 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
185 | |||
186 | return 0; | ||
187 | } | ||
188 | |||
189 | static int sdi_display_resume(struct omap_dss_device *dssdev) | ||
190 | { | ||
191 | int r; | ||
192 | |||
193 | if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) | ||
194 | return -EINVAL; | ||
195 | |||
196 | dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); | ||
197 | |||
198 | r = dss_sdi_enable(); | ||
199 | if (r) | ||
200 | goto err; | ||
201 | mdelay(2); | ||
202 | |||
203 | dispc_enable_lcd_out(1); | ||
204 | |||
205 | if (dssdev->driver->resume) | ||
206 | dssdev->driver->resume(dssdev); | ||
207 | |||
208 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
209 | |||
210 | return 0; | ||
211 | err: | ||
212 | dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); | ||
213 | return r; | ||
214 | } | ||
215 | |||
216 | static int sdi_display_set_update_mode(struct omap_dss_device *dssdev, | ||
217 | enum omap_dss_update_mode mode) | ||
218 | { | ||
219 | if (mode == OMAP_DSS_UPDATE_MANUAL) | ||
220 | return -EINVAL; | ||
221 | |||
222 | if (mode == OMAP_DSS_UPDATE_DISABLED) { | ||
223 | dispc_enable_lcd_out(0); | ||
224 | sdi.update_enabled = 0; | ||
225 | } else { | ||
226 | dispc_enable_lcd_out(1); | ||
227 | sdi.update_enabled = 1; | ||
228 | } | ||
229 | |||
230 | return 0; | ||
231 | } | ||
232 | |||
233 | static enum omap_dss_update_mode sdi_display_get_update_mode( | ||
234 | struct omap_dss_device *dssdev) | ||
235 | { | ||
236 | return sdi.update_enabled ? OMAP_DSS_UPDATE_AUTO : | ||
237 | OMAP_DSS_UPDATE_DISABLED; | ||
238 | } | ||
239 | |||
240 | static void sdi_get_timings(struct omap_dss_device *dssdev, | ||
241 | struct omap_video_timings *timings) | ||
242 | { | ||
243 | *timings = dssdev->panel.timings; | ||
244 | } | ||
245 | 152 | ||
246 | int sdi_init_display(struct omap_dss_device *dssdev) | 153 | int sdi_init_display(struct omap_dss_device *dssdev) |
247 | { | 154 | { |
248 | DSSDBG("SDI init\n"); | 155 | DSSDBG("SDI init\n"); |
249 | 156 | ||
250 | dssdev->enable = sdi_display_enable; | ||
251 | dssdev->disable = sdi_display_disable; | ||
252 | dssdev->suspend = sdi_display_suspend; | ||
253 | dssdev->resume = sdi_display_resume; | ||
254 | dssdev->set_update_mode = sdi_display_set_update_mode; | ||
255 | dssdev->get_update_mode = sdi_display_get_update_mode; | ||
256 | dssdev->get_timings = sdi_get_timings; | ||
257 | |||
258 | return 0; | 157 | return 0; |
259 | } | 158 | } |
260 | 159 | ||
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 749a5a0f5be4..f0ba5732d84a 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c | |||
@@ -400,114 +400,6 @@ static const struct venc_config *venc_timings_to_config( | |||
400 | BUG(); | 400 | BUG(); |
401 | } | 401 | } |
402 | 402 | ||
403 | |||
404 | |||
405 | |||
406 | |||
407 | /* driver */ | ||
408 | static int venc_panel_probe(struct omap_dss_device *dssdev) | ||
409 | { | ||
410 | dssdev->panel.timings = omap_dss_pal_timings; | ||
411 | |||
412 | return 0; | ||
413 | } | ||
414 | |||
415 | static void venc_panel_remove(struct omap_dss_device *dssdev) | ||
416 | { | ||
417 | } | ||
418 | |||
419 | static int venc_panel_enable(struct omap_dss_device *dssdev) | ||
420 | { | ||
421 | int r = 0; | ||
422 | |||
423 | /* wait couple of vsyncs until enabling the LCD */ | ||
424 | msleep(50); | ||
425 | |||
426 | if (dssdev->platform_enable) | ||
427 | r = dssdev->platform_enable(dssdev); | ||
428 | |||
429 | return r; | ||
430 | } | ||
431 | |||
432 | static void venc_panel_disable(struct omap_dss_device *dssdev) | ||
433 | { | ||
434 | if (dssdev->platform_disable) | ||
435 | dssdev->platform_disable(dssdev); | ||
436 | |||
437 | /* wait at least 5 vsyncs after disabling the LCD */ | ||
438 | |||
439 | msleep(100); | ||
440 | } | ||
441 | |||
442 | static int venc_panel_suspend(struct omap_dss_device *dssdev) | ||
443 | { | ||
444 | venc_panel_disable(dssdev); | ||
445 | return 0; | ||
446 | } | ||
447 | |||
448 | static int venc_panel_resume(struct omap_dss_device *dssdev) | ||
449 | { | ||
450 | return venc_panel_enable(dssdev); | ||
451 | } | ||
452 | |||
453 | static struct omap_dss_driver venc_driver = { | ||
454 | .probe = venc_panel_probe, | ||
455 | .remove = venc_panel_remove, | ||
456 | |||
457 | .enable = venc_panel_enable, | ||
458 | .disable = venc_panel_disable, | ||
459 | .suspend = venc_panel_suspend, | ||
460 | .resume = venc_panel_resume, | ||
461 | |||
462 | .driver = { | ||
463 | .name = "venc", | ||
464 | .owner = THIS_MODULE, | ||
465 | }, | ||
466 | }; | ||
467 | /* driver end */ | ||
468 | |||
469 | |||
470 | |||
471 | int venc_init(struct platform_device *pdev) | ||
472 | { | ||
473 | u8 rev_id; | ||
474 | |||
475 | mutex_init(&venc.venc_lock); | ||
476 | |||
477 | venc.wss_data = 0; | ||
478 | |||
479 | venc.base = ioremap(VENC_BASE, SZ_1K); | ||
480 | if (!venc.base) { | ||
481 | DSSERR("can't ioremap VENC\n"); | ||
482 | return -ENOMEM; | ||
483 | } | ||
484 | |||
485 | venc.vdda_dac_reg = regulator_get(&pdev->dev, "vdda_dac"); | ||
486 | if (IS_ERR(venc.vdda_dac_reg)) { | ||
487 | iounmap(venc.base); | ||
488 | DSSERR("can't get VDDA_DAC regulator\n"); | ||
489 | return PTR_ERR(venc.vdda_dac_reg); | ||
490 | } | ||
491 | |||
492 | venc_enable_clocks(1); | ||
493 | |||
494 | rev_id = (u8)(venc_read_reg(VENC_REV_ID) & 0xff); | ||
495 | printk(KERN_INFO "OMAP VENC rev %d\n", rev_id); | ||
496 | |||
497 | venc_enable_clocks(0); | ||
498 | |||
499 | return omap_dss_register_driver(&venc_driver); | ||
500 | } | ||
501 | |||
502 | void venc_exit(void) | ||
503 | { | ||
504 | omap_dss_unregister_driver(&venc_driver); | ||
505 | |||
506 | regulator_put(venc.vdda_dac_reg); | ||
507 | |||
508 | iounmap(venc.base); | ||
509 | } | ||
510 | |||
511 | static void venc_power_on(struct omap_dss_device *dssdev) | 403 | static void venc_power_on(struct omap_dss_device *dssdev) |
512 | { | 404 | { |
513 | u32 l; | 405 | u32 l; |
@@ -540,7 +432,7 @@ static void venc_power_on(struct omap_dss_device *dssdev) | |||
540 | if (dssdev->platform_enable) | 432 | if (dssdev->platform_enable) |
541 | dssdev->platform_enable(dssdev); | 433 | dssdev->platform_enable(dssdev); |
542 | 434 | ||
543 | dispc_enable_digit_out(1); | 435 | dssdev->manager->enable(dssdev->manager); |
544 | } | 436 | } |
545 | 437 | ||
546 | static void venc_power_off(struct omap_dss_device *dssdev) | 438 | static void venc_power_off(struct omap_dss_device *dssdev) |
@@ -548,7 +440,7 @@ static void venc_power_off(struct omap_dss_device *dssdev) | |||
548 | venc_write_reg(VENC_OUTPUT_CONTROL, 0); | 440 | venc_write_reg(VENC_OUTPUT_CONTROL, 0); |
549 | dss_set_dac_pwrdn_bgz(0); | 441 | dss_set_dac_pwrdn_bgz(0); |
550 | 442 | ||
551 | dispc_enable_digit_out(0); | 443 | dssdev->manager->disable(dssdev->manager); |
552 | 444 | ||
553 | if (dssdev->platform_disable) | 445 | if (dssdev->platform_disable) |
554 | dssdev->platform_disable(dssdev); | 446 | dssdev->platform_disable(dssdev); |
@@ -558,7 +450,23 @@ static void venc_power_off(struct omap_dss_device *dssdev) | |||
558 | venc_enable_clocks(0); | 450 | venc_enable_clocks(0); |
559 | } | 451 | } |
560 | 452 | ||
561 | static int venc_enable_display(struct omap_dss_device *dssdev) | 453 | |
454 | |||
455 | |||
456 | |||
457 | /* driver */ | ||
458 | static int venc_panel_probe(struct omap_dss_device *dssdev) | ||
459 | { | ||
460 | dssdev->panel.timings = omap_dss_pal_timings; | ||
461 | |||
462 | return 0; | ||
463 | } | ||
464 | |||
465 | static void venc_panel_remove(struct omap_dss_device *dssdev) | ||
466 | { | ||
467 | } | ||
468 | |||
469 | static int venc_panel_enable(struct omap_dss_device *dssdev) | ||
562 | { | 470 | { |
563 | int r = 0; | 471 | int r = 0; |
564 | 472 | ||
@@ -568,7 +476,13 @@ static int venc_enable_display(struct omap_dss_device *dssdev) | |||
568 | 476 | ||
569 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { | 477 | if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { |
570 | r = -EINVAL; | 478 | r = -EINVAL; |
571 | goto err; | 479 | goto err1; |
480 | } | ||
481 | |||
482 | if (dssdev->platform_enable) { | ||
483 | r = dssdev->platform_enable(dssdev); | ||
484 | if (r) | ||
485 | goto err2; | ||
572 | } | 486 | } |
573 | 487 | ||
574 | venc_power_on(dssdev); | 488 | venc_power_on(dssdev); |
@@ -576,13 +490,21 @@ static int venc_enable_display(struct omap_dss_device *dssdev) | |||
576 | venc.wss_data = 0; | 490 | venc.wss_data = 0; |
577 | 491 | ||
578 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | 492 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; |
579 | err: | 493 | |
494 | /* wait couple of vsyncs until enabling the LCD */ | ||
495 | msleep(50); | ||
496 | |||
580 | mutex_unlock(&venc.venc_lock); | 497 | mutex_unlock(&venc.venc_lock); |
581 | 498 | ||
582 | return r; | 499 | return r; |
500 | err2: | ||
501 | venc_power_off(dssdev); | ||
502 | err1: | ||
503 | mutex_unlock(&venc.venc_lock); | ||
504 | return r; | ||
583 | } | 505 | } |
584 | 506 | ||
585 | static void venc_disable_display(struct omap_dss_device *dssdev) | 507 | static void venc_panel_disable(struct omap_dss_device *dssdev) |
586 | { | 508 | { |
587 | DSSDBG("venc_disable_display\n"); | 509 | DSSDBG("venc_disable_display\n"); |
588 | 510 | ||
@@ -599,53 +521,40 @@ static void venc_disable_display(struct omap_dss_device *dssdev) | |||
599 | 521 | ||
600 | venc_power_off(dssdev); | 522 | venc_power_off(dssdev); |
601 | 523 | ||
524 | /* wait at least 5 vsyncs after disabling the LCD */ | ||
525 | msleep(100); | ||
526 | |||
527 | if (dssdev->platform_disable) | ||
528 | dssdev->platform_disable(dssdev); | ||
529 | |||
602 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | 530 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; |
603 | end: | 531 | end: |
604 | mutex_unlock(&venc.venc_lock); | 532 | mutex_unlock(&venc.venc_lock); |
605 | } | 533 | } |
606 | 534 | ||
607 | static int venc_display_suspend(struct omap_dss_device *dssdev) | 535 | static int venc_panel_suspend(struct omap_dss_device *dssdev) |
608 | { | 536 | { |
609 | int r = 0; | 537 | venc_panel_disable(dssdev); |
610 | 538 | return 0; | |
611 | DSSDBG("venc_display_suspend\n"); | ||
612 | |||
613 | mutex_lock(&venc.venc_lock); | ||
614 | |||
615 | if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { | ||
616 | r = -EINVAL; | ||
617 | goto err; | ||
618 | } | ||
619 | |||
620 | venc_power_off(dssdev); | ||
621 | |||
622 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
623 | err: | ||
624 | mutex_unlock(&venc.venc_lock); | ||
625 | |||
626 | return r; | ||
627 | } | 539 | } |
628 | 540 | ||
629 | static int venc_display_resume(struct omap_dss_device *dssdev) | 541 | static int venc_panel_resume(struct omap_dss_device *dssdev) |
630 | { | 542 | { |
631 | int r = 0; | 543 | return venc_panel_enable(dssdev); |
632 | 544 | } | |
633 | DSSDBG("venc_display_resume\n"); | ||
634 | |||
635 | mutex_lock(&venc.venc_lock); | ||
636 | |||
637 | if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) { | ||
638 | r = -EINVAL; | ||
639 | goto err; | ||
640 | } | ||
641 | |||
642 | venc_power_on(dssdev); | ||
643 | 545 | ||
644 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | 546 | static enum omap_dss_update_mode venc_get_update_mode( |
645 | err: | 547 | struct omap_dss_device *dssdev) |
646 | mutex_unlock(&venc.venc_lock); | 548 | { |
549 | return OMAP_DSS_UPDATE_AUTO; | ||
550 | } | ||
647 | 551 | ||
648 | return r; | 552 | static int venc_set_update_mode(struct omap_dss_device *dssdev, |
553 | enum omap_dss_update_mode mode) | ||
554 | { | ||
555 | if (mode != OMAP_DSS_UPDATE_AUTO) | ||
556 | return -EINVAL; | ||
557 | return 0; | ||
649 | } | 558 | } |
650 | 559 | ||
651 | static void venc_get_timings(struct omap_dss_device *dssdev, | 560 | static void venc_get_timings(struct omap_dss_device *dssdev, |
@@ -666,8 +575,8 @@ static void venc_set_timings(struct omap_dss_device *dssdev, | |||
666 | dssdev->panel.timings = *timings; | 575 | dssdev->panel.timings = *timings; |
667 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { | 576 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { |
668 | /* turn the venc off and on to get new timings to use */ | 577 | /* turn the venc off and on to get new timings to use */ |
669 | venc_disable_display(dssdev); | 578 | venc_panel_disable(dssdev); |
670 | venc_enable_display(dssdev); | 579 | venc_panel_enable(dssdev); |
671 | } | 580 | } |
672 | } | 581 | } |
673 | 582 | ||
@@ -716,30 +625,79 @@ static int venc_set_wss(struct omap_dss_device *dssdev, u32 wss) | |||
716 | return 0; | 625 | return 0; |
717 | } | 626 | } |
718 | 627 | ||
719 | static enum omap_dss_update_mode venc_display_get_update_mode( | 628 | static struct omap_dss_driver venc_driver = { |
720 | struct omap_dss_device *dssdev) | 629 | .probe = venc_panel_probe, |
630 | .remove = venc_panel_remove, | ||
631 | |||
632 | .enable = venc_panel_enable, | ||
633 | .disable = venc_panel_disable, | ||
634 | .suspend = venc_panel_suspend, | ||
635 | .resume = venc_panel_resume, | ||
636 | |||
637 | .get_resolution = omapdss_default_get_resolution, | ||
638 | .get_recommended_bpp = omapdss_default_get_recommended_bpp, | ||
639 | |||
640 | .set_update_mode = venc_set_update_mode, | ||
641 | .get_update_mode = venc_get_update_mode, | ||
642 | |||
643 | .get_timings = venc_get_timings, | ||
644 | .set_timings = venc_set_timings, | ||
645 | .check_timings = venc_check_timings, | ||
646 | |||
647 | .get_wss = venc_get_wss, | ||
648 | .set_wss = venc_set_wss, | ||
649 | |||
650 | .driver = { | ||
651 | .name = "venc", | ||
652 | .owner = THIS_MODULE, | ||
653 | }, | ||
654 | }; | ||
655 | /* driver end */ | ||
656 | |||
657 | |||
658 | |||
659 | int venc_init(struct platform_device *pdev) | ||
721 | { | 660 | { |
722 | if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) | 661 | u8 rev_id; |
723 | return OMAP_DSS_UPDATE_AUTO; | 662 | |
724 | else | 663 | mutex_init(&venc.venc_lock); |
725 | return OMAP_DSS_UPDATE_DISABLED; | 664 | |
665 | venc.wss_data = 0; | ||
666 | |||
667 | venc.base = ioremap(VENC_BASE, SZ_1K); | ||
668 | if (!venc.base) { | ||
669 | DSSERR("can't ioremap VENC\n"); | ||
670 | return -ENOMEM; | ||
671 | } | ||
672 | |||
673 | venc.vdda_dac_reg = dss_get_vdda_dac(); | ||
674 | if (IS_ERR(venc.vdda_dac_reg)) { | ||
675 | iounmap(venc.base); | ||
676 | DSSERR("can't get VDDA_DAC regulator\n"); | ||
677 | return PTR_ERR(venc.vdda_dac_reg); | ||
678 | } | ||
679 | |||
680 | venc_enable_clocks(1); | ||
681 | |||
682 | rev_id = (u8)(venc_read_reg(VENC_REV_ID) & 0xff); | ||
683 | printk(KERN_INFO "OMAP VENC rev %d\n", rev_id); | ||
684 | |||
685 | venc_enable_clocks(0); | ||
686 | |||
687 | return omap_dss_register_driver(&venc_driver); | ||
688 | } | ||
689 | |||
690 | void venc_exit(void) | ||
691 | { | ||
692 | omap_dss_unregister_driver(&venc_driver); | ||
693 | |||
694 | iounmap(venc.base); | ||
726 | } | 695 | } |
727 | 696 | ||
728 | int venc_init_display(struct omap_dss_device *dssdev) | 697 | int venc_init_display(struct omap_dss_device *dssdev) |
729 | { | 698 | { |
730 | DSSDBG("init_display\n"); | 699 | DSSDBG("init_display\n"); |
731 | 700 | ||
732 | dssdev->enable = venc_enable_display; | ||
733 | dssdev->disable = venc_disable_display; | ||
734 | dssdev->suspend = venc_display_suspend; | ||
735 | dssdev->resume = venc_display_resume; | ||
736 | dssdev->get_timings = venc_get_timings; | ||
737 | dssdev->set_timings = venc_set_timings; | ||
738 | dssdev->check_timings = venc_check_timings; | ||
739 | dssdev->get_wss = venc_get_wss; | ||
740 | dssdev->set_wss = venc_set_wss; | ||
741 | dssdev->get_update_mode = venc_display_get_update_mode; | ||
742 | |||
743 | return 0; | 701 | return 0; |
744 | } | 702 | } |
745 | 703 | ||
diff --git a/drivers/video/omap2/omapfb/Kconfig b/drivers/video/omap2/omapfb/Kconfig index bb694cc52a50..43496d6c377f 100644 --- a/drivers/video/omap2/omapfb/Kconfig +++ b/drivers/video/omap2/omapfb/Kconfig | |||
@@ -16,16 +16,7 @@ config FB_OMAP2_DEBUG_SUPPORT | |||
16 | depends on FB_OMAP2 | 16 | depends on FB_OMAP2 |
17 | help | 17 | help |
18 | Support for debug output. You have to enable the actual printing | 18 | Support for debug output. You have to enable the actual printing |
19 | with debug module parameter. | 19 | with 'debug' module parameter. |
20 | |||
21 | config FB_OMAP2_FORCE_AUTO_UPDATE | ||
22 | bool "Force main display to automatic update mode" | ||
23 | depends on FB_OMAP2 | ||
24 | help | ||
25 | Forces main display to automatic update mode (if possible), | ||
26 | and also enables tearsync (if possible). By default | ||
27 | displays that support manual update are started in manual | ||
28 | update mode. | ||
29 | 20 | ||
30 | config FB_OMAP2_NUM_FBS | 21 | config FB_OMAP2_NUM_FBS |
31 | int "Number of framebuffers" | 22 | int "Number of framebuffers" |
diff --git a/drivers/video/omap2/omapfb/omapfb-ioctl.c b/drivers/video/omap2/omapfb/omapfb-ioctl.c index 4c4bafdfaa43..1ffa760b8545 100644 --- a/drivers/video/omap2/omapfb/omapfb-ioctl.c +++ b/drivers/video/omap2/omapfb/omapfb-ioctl.c | |||
@@ -167,12 +167,12 @@ static int omapfb_update_window_nolock(struct fb_info *fbi, | |||
167 | if (w == 0 || h == 0) | 167 | if (w == 0 || h == 0) |
168 | return 0; | 168 | return 0; |
169 | 169 | ||
170 | display->get_resolution(display, &dw, &dh); | 170 | display->driver->get_resolution(display, &dw, &dh); |
171 | 171 | ||
172 | if (x + w > dw || y + h > dh) | 172 | if (x + w > dw || y + h > dh) |
173 | return -EINVAL; | 173 | return -EINVAL; |
174 | 174 | ||
175 | return display->update(display, x, y, w, h); | 175 | return display->driver->update(display, x, y, w, h); |
176 | } | 176 | } |
177 | 177 | ||
178 | /* This function is exported for SGX driver use */ | 178 | /* This function is exported for SGX driver use */ |
@@ -202,7 +202,7 @@ static int omapfb_set_update_mode(struct fb_info *fbi, | |||
202 | enum omap_dss_update_mode um; | 202 | enum omap_dss_update_mode um; |
203 | int r; | 203 | int r; |
204 | 204 | ||
205 | if (!display || !display->set_update_mode) | 205 | if (!display || !display->driver->set_update_mode) |
206 | return -EINVAL; | 206 | return -EINVAL; |
207 | 207 | ||
208 | switch (mode) { | 208 | switch (mode) { |
@@ -222,7 +222,7 @@ static int omapfb_set_update_mode(struct fb_info *fbi, | |||
222 | return -EINVAL; | 222 | return -EINVAL; |
223 | } | 223 | } |
224 | 224 | ||
225 | r = display->set_update_mode(display, um); | 225 | r = display->driver->set_update_mode(display, um); |
226 | 226 | ||
227 | return r; | 227 | return r; |
228 | } | 228 | } |
@@ -233,10 +233,15 @@ static int omapfb_get_update_mode(struct fb_info *fbi, | |||
233 | struct omap_dss_device *display = fb2display(fbi); | 233 | struct omap_dss_device *display = fb2display(fbi); |
234 | enum omap_dss_update_mode m; | 234 | enum omap_dss_update_mode m; |
235 | 235 | ||
236 | if (!display || !display->get_update_mode) | 236 | if (!display) |
237 | return -EINVAL; | 237 | return -EINVAL; |
238 | 238 | ||
239 | m = display->get_update_mode(display); | 239 | if (!display->driver->get_update_mode) { |
240 | *mode = OMAPFB_AUTO_UPDATE; | ||
241 | return 0; | ||
242 | } | ||
243 | |||
244 | m = display->driver->get_update_mode(display); | ||
240 | 245 | ||
241 | switch (m) { | 246 | switch (m) { |
242 | case OMAP_DSS_UPDATE_DISABLED: | 247 | case OMAP_DSS_UPDATE_DISABLED: |
@@ -374,7 +379,7 @@ static int omapfb_memory_read(struct fb_info *fbi, | |||
374 | void *buf; | 379 | void *buf; |
375 | int r; | 380 | int r; |
376 | 381 | ||
377 | if (!display || !display->memory_read) | 382 | if (!display || !display->driver->memory_read) |
378 | return -ENOENT; | 383 | return -ENOENT; |
379 | 384 | ||
380 | if (!access_ok(VERIFY_WRITE, mr->buffer, mr->buffer_size)) | 385 | if (!access_ok(VERIFY_WRITE, mr->buffer, mr->buffer_size)) |
@@ -389,7 +394,7 @@ static int omapfb_memory_read(struct fb_info *fbi, | |||
389 | return -ENOMEM; | 394 | return -ENOMEM; |
390 | } | 395 | } |
391 | 396 | ||
392 | r = display->memory_read(display, buf, mr->buffer_size, | 397 | r = display->driver->memory_read(display, buf, mr->buffer_size, |
393 | mr->x, mr->y, mr->w, mr->h); | 398 | mr->x, mr->y, mr->w, mr->h); |
394 | 399 | ||
395 | if (r > 0) { | 400 | if (r > 0) { |
@@ -483,6 +488,7 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg) | |||
483 | struct omapfb_memory_read memory_read; | 488 | struct omapfb_memory_read memory_read; |
484 | struct omapfb_vram_info vram_info; | 489 | struct omapfb_vram_info vram_info; |
485 | struct omapfb_tearsync_info tearsync_info; | 490 | struct omapfb_tearsync_info tearsync_info; |
491 | struct omapfb_display_info display_info; | ||
486 | } p; | 492 | } p; |
487 | 493 | ||
488 | int r = 0; | 494 | int r = 0; |
@@ -490,18 +496,18 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg) | |||
490 | switch (cmd) { | 496 | switch (cmd) { |
491 | case OMAPFB_SYNC_GFX: | 497 | case OMAPFB_SYNC_GFX: |
492 | DBG("ioctl SYNC_GFX\n"); | 498 | DBG("ioctl SYNC_GFX\n"); |
493 | if (!display || !display->sync) { | 499 | if (!display || !display->driver->sync) { |
494 | /* DSS1 never returns an error here, so we neither */ | 500 | /* DSS1 never returns an error here, so we neither */ |
495 | /*r = -EINVAL;*/ | 501 | /*r = -EINVAL;*/ |
496 | break; | 502 | break; |
497 | } | 503 | } |
498 | 504 | ||
499 | r = display->sync(display); | 505 | r = display->driver->sync(display); |
500 | break; | 506 | break; |
501 | 507 | ||
502 | case OMAPFB_UPDATE_WINDOW_OLD: | 508 | case OMAPFB_UPDATE_WINDOW_OLD: |
503 | DBG("ioctl UPDATE_WINDOW_OLD\n"); | 509 | DBG("ioctl UPDATE_WINDOW_OLD\n"); |
504 | if (!display || !display->update) { | 510 | if (!display || !display->driver->update) { |
505 | r = -EINVAL; | 511 | r = -EINVAL; |
506 | break; | 512 | break; |
507 | } | 513 | } |
@@ -519,7 +525,7 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg) | |||
519 | 525 | ||
520 | case OMAPFB_UPDATE_WINDOW: | 526 | case OMAPFB_UPDATE_WINDOW: |
521 | DBG("ioctl UPDATE_WINDOW\n"); | 527 | DBG("ioctl UPDATE_WINDOW\n"); |
522 | if (!display || !display->update) { | 528 | if (!display || !display->driver->update) { |
523 | r = -EINVAL; | 529 | r = -EINVAL; |
524 | break; | 530 | break; |
525 | } | 531 | } |
@@ -648,7 +654,7 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg) | |||
648 | break; | 654 | break; |
649 | } | 655 | } |
650 | 656 | ||
651 | r = display->wait_vsync(display); | 657 | r = display->manager->wait_for_vsync(display->manager); |
652 | break; | 658 | break; |
653 | 659 | ||
654 | case OMAPFB_WAITFORGO: | 660 | case OMAPFB_WAITFORGO: |
@@ -669,12 +675,12 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg) | |||
669 | r = -EFAULT; | 675 | r = -EFAULT; |
670 | break; | 676 | break; |
671 | } | 677 | } |
672 | if (!display || !display->run_test) { | 678 | if (!display || !display->driver->run_test) { |
673 | r = -EINVAL; | 679 | r = -EINVAL; |
674 | break; | 680 | break; |
675 | } | 681 | } |
676 | 682 | ||
677 | r = display->run_test(display, p.test_num); | 683 | r = display->driver->run_test(display, p.test_num); |
678 | 684 | ||
679 | break; | 685 | break; |
680 | 686 | ||
@@ -684,12 +690,12 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg) | |||
684 | r = -EFAULT; | 690 | r = -EFAULT; |
685 | break; | 691 | break; |
686 | } | 692 | } |
687 | if (!display || !display->run_test) { | 693 | if (!display || !display->driver->run_test) { |
688 | r = -EINVAL; | 694 | r = -EINVAL; |
689 | break; | 695 | break; |
690 | } | 696 | } |
691 | 697 | ||
692 | r = display->run_test(display, p.test_num); | 698 | r = display->driver->run_test(display, p.test_num); |
693 | 699 | ||
694 | break; | 700 | break; |
695 | 701 | ||
@@ -731,13 +737,37 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg) | |||
731 | break; | 737 | break; |
732 | } | 738 | } |
733 | 739 | ||
734 | if (!display->enable_te) { | 740 | if (!display->driver->enable_te) { |
735 | r = -ENODEV; | 741 | r = -ENODEV; |
736 | break; | 742 | break; |
737 | } | 743 | } |
738 | 744 | ||
739 | r = display->enable_te(display, !!p.tearsync_info.enabled); | 745 | r = display->driver->enable_te(display, |
746 | !!p.tearsync_info.enabled); | ||
747 | |||
748 | break; | ||
749 | } | ||
750 | |||
751 | case OMAPFB_GET_DISPLAY_INFO: { | ||
752 | u16 xres, yres; | ||
740 | 753 | ||
754 | DBG("ioctl GET_DISPLAY_INFO\n"); | ||
755 | |||
756 | if (display == NULL) { | ||
757 | r = -ENODEV; | ||
758 | break; | ||
759 | } | ||
760 | |||
761 | display->driver->get_resolution(display, &xres, &yres); | ||
762 | |||
763 | p.display_info.xres = xres; | ||
764 | p.display_info.yres = yres; | ||
765 | p.display_info.width = 0; | ||
766 | p.display_info.height = 0; | ||
767 | |||
768 | if (copy_to_user((void __user *)arg, &p.display_info, | ||
769 | sizeof(p.display_info))) | ||
770 | r = -EFAULT; | ||
741 | break; | 771 | break; |
742 | } | 772 | } |
743 | 773 | ||
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index d17caef6915a..4a76917b7cc8 100644 --- a/drivers/video/omap2/omapfb/omapfb-main.c +++ b/drivers/video/omap2/omapfb/omapfb-main.c | |||
@@ -54,6 +54,8 @@ module_param_named(test, omapfb_test_pattern, bool, 0644); | |||
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | static int omapfb_fb_init(struct omapfb2_device *fbdev, struct fb_info *fbi); | 56 | static int omapfb_fb_init(struct omapfb2_device *fbdev, struct fb_info *fbi); |
57 | static int omapfb_get_recommended_bpp(struct omapfb2_device *fbdev, | ||
58 | struct omap_dss_device *dssdev); | ||
57 | 59 | ||
58 | #ifdef DEBUG | 60 | #ifdef DEBUG |
59 | static void draw_pixel(struct fb_info *fbi, int x, int y, unsigned color) | 61 | static void draw_pixel(struct fb_info *fbi, int x, int y, unsigned color) |
@@ -152,9 +154,9 @@ static void fill_fb(struct fb_info *fbi) | |||
152 | } | 154 | } |
153 | #endif | 155 | #endif |
154 | 156 | ||
155 | static unsigned omapfb_get_vrfb_offset(struct omapfb_info *ofbi, int rot) | 157 | static unsigned omapfb_get_vrfb_offset(const struct omapfb_info *ofbi, int rot) |
156 | { | 158 | { |
157 | struct vrfb *vrfb = &ofbi->region.vrfb; | 159 | const struct vrfb *vrfb = &ofbi->region.vrfb; |
158 | unsigned offset; | 160 | unsigned offset; |
159 | 161 | ||
160 | switch (rot) { | 162 | switch (rot) { |
@@ -179,7 +181,7 @@ static unsigned omapfb_get_vrfb_offset(struct omapfb_info *ofbi, int rot) | |||
179 | return offset; | 181 | return offset; |
180 | } | 182 | } |
181 | 183 | ||
182 | static u32 omapfb_get_region_rot_paddr(struct omapfb_info *ofbi, int rot) | 184 | static u32 omapfb_get_region_rot_paddr(const struct omapfb_info *ofbi, int rot) |
183 | { | 185 | { |
184 | if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) { | 186 | if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) { |
185 | return ofbi->region.vrfb.paddr[rot] | 187 | return ofbi->region.vrfb.paddr[rot] |
@@ -189,7 +191,7 @@ static u32 omapfb_get_region_rot_paddr(struct omapfb_info *ofbi, int rot) | |||
189 | } | 191 | } |
190 | } | 192 | } |
191 | 193 | ||
192 | static u32 omapfb_get_region_paddr(struct omapfb_info *ofbi) | 194 | static u32 omapfb_get_region_paddr(const struct omapfb_info *ofbi) |
193 | { | 195 | { |
194 | if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) | 196 | if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) |
195 | return ofbi->region.vrfb.paddr[0]; | 197 | return ofbi->region.vrfb.paddr[0]; |
@@ -197,7 +199,7 @@ static u32 omapfb_get_region_paddr(struct omapfb_info *ofbi) | |||
197 | return ofbi->region.paddr; | 199 | return ofbi->region.paddr; |
198 | } | 200 | } |
199 | 201 | ||
200 | static void __iomem *omapfb_get_region_vaddr(struct omapfb_info *ofbi) | 202 | static void __iomem *omapfb_get_region_vaddr(const struct omapfb_info *ofbi) |
201 | { | 203 | { |
202 | if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) | 204 | if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) |
203 | return ofbi->region.vrfb.vaddr[0]; | 205 | return ofbi->region.vrfb.vaddr[0]; |
@@ -703,9 +705,9 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var) | |||
703 | var->width = -1; | 705 | var->width = -1; |
704 | var->grayscale = 0; | 706 | var->grayscale = 0; |
705 | 707 | ||
706 | if (display && display->get_timings) { | 708 | if (display && display->driver->get_timings) { |
707 | struct omap_video_timings timings; | 709 | struct omap_video_timings timings; |
708 | display->get_timings(display, &timings); | 710 | display->driver->get_timings(display, &timings); |
709 | 711 | ||
710 | /* pixclock in ps, the rest in pixclock */ | 712 | /* pixclock in ps, the rest in pixclock */ |
711 | var->pixclock = timings.pixel_clock != 0 ? | 713 | var->pixclock = timings.pixel_clock != 0 ? |
@@ -778,8 +780,8 @@ static int omapfb_release(struct fb_info *fbi, int user) | |||
778 | return 0; | 780 | return 0; |
779 | } | 781 | } |
780 | 782 | ||
781 | static unsigned calc_rotation_offset_dma(struct fb_var_screeninfo *var, | 783 | static unsigned calc_rotation_offset_dma(const struct fb_var_screeninfo *var, |
782 | struct fb_fix_screeninfo *fix, int rotation) | 784 | const struct fb_fix_screeninfo *fix, int rotation) |
783 | { | 785 | { |
784 | unsigned offset; | 786 | unsigned offset; |
785 | 787 | ||
@@ -789,8 +791,8 @@ static unsigned calc_rotation_offset_dma(struct fb_var_screeninfo *var, | |||
789 | return offset; | 791 | return offset; |
790 | } | 792 | } |
791 | 793 | ||
792 | static unsigned calc_rotation_offset_vrfb(struct fb_var_screeninfo *var, | 794 | static unsigned calc_rotation_offset_vrfb(const struct fb_var_screeninfo *var, |
793 | struct fb_fix_screeninfo *fix, int rotation) | 795 | const struct fb_fix_screeninfo *fix, int rotation) |
794 | { | 796 | { |
795 | unsigned offset; | 797 | unsigned offset; |
796 | 798 | ||
@@ -1221,11 +1223,11 @@ static int omapfb_blank(int blank, struct fb_info *fbi) | |||
1221 | if (display->state != OMAP_DSS_DISPLAY_SUSPENDED) | 1223 | if (display->state != OMAP_DSS_DISPLAY_SUSPENDED) |
1222 | goto exit; | 1224 | goto exit; |
1223 | 1225 | ||
1224 | if (display->resume) | 1226 | if (display->driver->resume) |
1225 | r = display->resume(display); | 1227 | r = display->driver->resume(display); |
1226 | 1228 | ||
1227 | if (r == 0 && display->get_update_mode && | 1229 | if (r == 0 && display->driver->get_update_mode && |
1228 | display->get_update_mode(display) == | 1230 | display->driver->get_update_mode(display) == |
1229 | OMAP_DSS_UPDATE_MANUAL) | 1231 | OMAP_DSS_UPDATE_MANUAL) |
1230 | do_update = 1; | 1232 | do_update = 1; |
1231 | 1233 | ||
@@ -1240,8 +1242,8 @@ static int omapfb_blank(int blank, struct fb_info *fbi) | |||
1240 | if (display->state != OMAP_DSS_DISPLAY_ACTIVE) | 1242 | if (display->state != OMAP_DSS_DISPLAY_ACTIVE) |
1241 | goto exit; | 1243 | goto exit; |
1242 | 1244 | ||
1243 | if (display->suspend) | 1245 | if (display->driver->suspend) |
1244 | r = display->suspend(display); | 1246 | r = display->driver->suspend(display); |
1245 | 1247 | ||
1246 | break; | 1248 | break; |
1247 | 1249 | ||
@@ -1252,11 +1254,11 @@ static int omapfb_blank(int blank, struct fb_info *fbi) | |||
1252 | exit: | 1254 | exit: |
1253 | omapfb_unlock(fbdev); | 1255 | omapfb_unlock(fbdev); |
1254 | 1256 | ||
1255 | if (r == 0 && do_update && display->update) { | 1257 | if (r == 0 && do_update && display->driver->update) { |
1256 | u16 w, h; | 1258 | u16 w, h; |
1257 | display->get_resolution(display, &w, &h); | 1259 | display->driver->get_resolution(display, &w, &h); |
1258 | 1260 | ||
1259 | r = display->update(display, 0, 0, w, h); | 1261 | r = display->driver->update(display, 0, 0, w, h); |
1260 | } | 1262 | } |
1261 | 1263 | ||
1262 | return r; | 1264 | return r; |
@@ -1404,6 +1406,7 @@ static int omapfb_alloc_fbmem_display(struct fb_info *fbi, unsigned long size, | |||
1404 | unsigned long paddr) | 1406 | unsigned long paddr) |
1405 | { | 1407 | { |
1406 | struct omapfb_info *ofbi = FB2OFB(fbi); | 1408 | struct omapfb_info *ofbi = FB2OFB(fbi); |
1409 | struct omapfb2_device *fbdev = ofbi->fbdev; | ||
1407 | struct omap_dss_device *display; | 1410 | struct omap_dss_device *display; |
1408 | int bytespp; | 1411 | int bytespp; |
1409 | 1412 | ||
@@ -1412,7 +1415,7 @@ static int omapfb_alloc_fbmem_display(struct fb_info *fbi, unsigned long size, | |||
1412 | if (!display) | 1415 | if (!display) |
1413 | return 0; | 1416 | return 0; |
1414 | 1417 | ||
1415 | switch (display->get_recommended_bpp(display)) { | 1418 | switch (omapfb_get_recommended_bpp(fbdev, display)) { |
1416 | case 16: | 1419 | case 16: |
1417 | bytespp = 2; | 1420 | bytespp = 2; |
1418 | break; | 1421 | break; |
@@ -1427,7 +1430,7 @@ static int omapfb_alloc_fbmem_display(struct fb_info *fbi, unsigned long size, | |||
1427 | if (!size) { | 1430 | if (!size) { |
1428 | u16 w, h; | 1431 | u16 w, h; |
1429 | 1432 | ||
1430 | display->get_resolution(display, &w, &h); | 1433 | display->driver->get_resolution(display, &w, &h); |
1431 | 1434 | ||
1432 | if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) { | 1435 | if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) { |
1433 | size = max(omap_vrfb_min_phys_size(w, h, bytespp), | 1436 | size = max(omap_vrfb_min_phys_size(w, h, bytespp), |
@@ -1636,8 +1639,8 @@ int omapfb_realloc_fbmem(struct fb_info *fbi, unsigned long size, int type) | |||
1636 | if (old_size == size && old_type == type) | 1639 | if (old_size == size && old_type == type) |
1637 | return 0; | 1640 | return 0; |
1638 | 1641 | ||
1639 | if (display && display->sync) | 1642 | if (display && display->driver->sync) |
1640 | display->sync(display); | 1643 | display->driver->sync(display); |
1641 | 1644 | ||
1642 | omapfb_free_fbmem(fbi); | 1645 | omapfb_free_fbmem(fbi); |
1643 | 1646 | ||
@@ -1745,7 +1748,7 @@ static int omapfb_fb_init(struct omapfb2_device *fbdev, struct fb_info *fbi) | |||
1745 | u16 w, h; | 1748 | u16 w, h; |
1746 | int rotation = (var->rotate + ofbi->rotation[0]) % 4; | 1749 | int rotation = (var->rotate + ofbi->rotation[0]) % 4; |
1747 | 1750 | ||
1748 | display->get_resolution(display, &w, &h); | 1751 | display->driver->get_resolution(display, &w, &h); |
1749 | 1752 | ||
1750 | if (rotation == FB_ROTATE_CW || | 1753 | if (rotation == FB_ROTATE_CW || |
1751 | rotation == FB_ROTATE_CCW) { | 1754 | rotation == FB_ROTATE_CCW) { |
@@ -1760,7 +1763,7 @@ static int omapfb_fb_init(struct omapfb2_device *fbdev, struct fb_info *fbi) | |||
1760 | var->yres_virtual = var->yres; | 1763 | var->yres_virtual = var->yres; |
1761 | 1764 | ||
1762 | if (!var->bits_per_pixel) { | 1765 | if (!var->bits_per_pixel) { |
1763 | switch (display->get_recommended_bpp(display)) { | 1766 | switch (omapfb_get_recommended_bpp(fbdev, display)) { |
1764 | case 16: | 1767 | case 16: |
1765 | var->bits_per_pixel = 16; | 1768 | var->bits_per_pixel = 16; |
1766 | break; | 1769 | break; |
@@ -1828,7 +1831,7 @@ static void omapfb_free_resources(struct omapfb2_device *fbdev) | |||
1828 | 1831 | ||
1829 | for (i = 0; i < fbdev->num_displays; i++) { | 1832 | for (i = 0; i < fbdev->num_displays; i++) { |
1830 | if (fbdev->displays[i]->state != OMAP_DSS_DISPLAY_DISABLED) | 1833 | if (fbdev->displays[i]->state != OMAP_DSS_DISPLAY_DISABLED) |
1831 | fbdev->displays[i]->disable(fbdev->displays[i]); | 1834 | fbdev->displays[i]->driver->disable(fbdev->displays[i]); |
1832 | 1835 | ||
1833 | omap_dss_put_device(fbdev->displays[i]); | 1836 | omap_dss_put_device(fbdev->displays[i]); |
1834 | } | 1837 | } |
@@ -2011,7 +2014,8 @@ static int omapfb_mode_to_timings(const char *mode_str, | |||
2011 | } | 2014 | } |
2012 | } | 2015 | } |
2013 | 2016 | ||
2014 | static int omapfb_set_def_mode(struct omap_dss_device *display, char *mode_str) | 2017 | static int omapfb_set_def_mode(struct omapfb2_device *fbdev, |
2018 | struct omap_dss_device *display, char *mode_str) | ||
2015 | { | 2019 | { |
2016 | int r; | 2020 | int r; |
2017 | u8 bpp; | 2021 | u8 bpp; |
@@ -2021,20 +2025,37 @@ static int omapfb_set_def_mode(struct omap_dss_device *display, char *mode_str) | |||
2021 | if (r) | 2025 | if (r) |
2022 | return r; | 2026 | return r; |
2023 | 2027 | ||
2024 | display->panel.recommended_bpp = bpp; | 2028 | fbdev->bpp_overrides[fbdev->num_bpp_overrides].dssdev = display; |
2029 | fbdev->bpp_overrides[fbdev->num_bpp_overrides].bpp = bpp; | ||
2030 | ++fbdev->num_bpp_overrides; | ||
2025 | 2031 | ||
2026 | if (!display->check_timings || !display->set_timings) | 2032 | if (!display->driver->check_timings || !display->driver->set_timings) |
2027 | return -EINVAL; | 2033 | return -EINVAL; |
2028 | 2034 | ||
2029 | r = display->check_timings(display, &timings); | 2035 | r = display->driver->check_timings(display, &timings); |
2030 | if (r) | 2036 | if (r) |
2031 | return r; | 2037 | return r; |
2032 | 2038 | ||
2033 | display->set_timings(display, &timings); | 2039 | display->driver->set_timings(display, &timings); |
2034 | 2040 | ||
2035 | return 0; | 2041 | return 0; |
2036 | } | 2042 | } |
2037 | 2043 | ||
2044 | static int omapfb_get_recommended_bpp(struct omapfb2_device *fbdev, | ||
2045 | struct omap_dss_device *dssdev) | ||
2046 | { | ||
2047 | int i; | ||
2048 | |||
2049 | BUG_ON(dssdev->driver->get_recommended_bpp == NULL); | ||
2050 | |||
2051 | for (i = 0; i < fbdev->num_bpp_overrides; ++i) { | ||
2052 | if (dssdev == fbdev->bpp_overrides[i].dssdev) | ||
2053 | return fbdev->bpp_overrides[i].bpp; | ||
2054 | } | ||
2055 | |||
2056 | return dssdev->driver->get_recommended_bpp(dssdev); | ||
2057 | } | ||
2058 | |||
2038 | static int omapfb_parse_def_modes(struct omapfb2_device *fbdev) | 2059 | static int omapfb_parse_def_modes(struct omapfb2_device *fbdev) |
2039 | { | 2060 | { |
2040 | char *str, *options, *this_opt; | 2061 | char *str, *options, *this_opt; |
@@ -2073,7 +2094,7 @@ static int omapfb_parse_def_modes(struct omapfb2_device *fbdev) | |||
2073 | break; | 2094 | break; |
2074 | } | 2095 | } |
2075 | 2096 | ||
2076 | r = omapfb_set_def_mode(display, mode_str); | 2097 | r = omapfb_set_def_mode(fbdev, display, mode_str); |
2077 | if (r) | 2098 | if (r) |
2078 | break; | 2099 | break; |
2079 | } | 2100 | } |
@@ -2111,18 +2132,23 @@ static int omapfb_probe(struct platform_device *pdev) | |||
2111 | fbdev->dev = &pdev->dev; | 2132 | fbdev->dev = &pdev->dev; |
2112 | platform_set_drvdata(pdev, fbdev); | 2133 | platform_set_drvdata(pdev, fbdev); |
2113 | 2134 | ||
2135 | r = 0; | ||
2114 | fbdev->num_displays = 0; | 2136 | fbdev->num_displays = 0; |
2115 | dssdev = NULL; | 2137 | dssdev = NULL; |
2116 | for_each_dss_dev(dssdev) { | 2138 | for_each_dss_dev(dssdev) { |
2117 | omap_dss_get_device(dssdev); | 2139 | omap_dss_get_device(dssdev); |
2140 | |||
2118 | if (!dssdev->driver) { | 2141 | if (!dssdev->driver) { |
2119 | dev_err(&pdev->dev, "no driver for display\n"); | 2142 | dev_err(&pdev->dev, "no driver for display\n"); |
2120 | r = -EINVAL; | 2143 | r = -ENODEV; |
2121 | goto cleanup; | ||
2122 | } | 2144 | } |
2145 | |||
2123 | fbdev->displays[fbdev->num_displays++] = dssdev; | 2146 | fbdev->displays[fbdev->num_displays++] = dssdev; |
2124 | } | 2147 | } |
2125 | 2148 | ||
2149 | if (r) | ||
2150 | goto cleanup; | ||
2151 | |||
2126 | if (fbdev->num_displays == 0) { | 2152 | if (fbdev->num_displays == 0) { |
2127 | dev_err(&pdev->dev, "no displays\n"); | 2153 | dev_err(&pdev->dev, "no displays\n"); |
2128 | r = -EINVAL; | 2154 | r = -EINVAL; |
@@ -2167,35 +2193,28 @@ static int omapfb_probe(struct platform_device *pdev) | |||
2167 | } | 2193 | } |
2168 | 2194 | ||
2169 | if (def_display) { | 2195 | if (def_display) { |
2170 | #ifndef CONFIG_FB_OMAP2_FORCE_AUTO_UPDATE | 2196 | struct omap_dss_driver *dssdrv = def_display->driver; |
2171 | u16 w, h; | 2197 | |
2172 | #endif | 2198 | r = def_display->driver->enable(def_display); |
2173 | r = def_display->enable(def_display); | 2199 | if (r) { |
2174 | if (r) | ||
2175 | dev_warn(fbdev->dev, "Failed to enable display '%s'\n", | 2200 | dev_warn(fbdev->dev, "Failed to enable display '%s'\n", |
2176 | def_display->name); | 2201 | def_display->name); |
2202 | goto cleanup; | ||
2203 | } | ||
2177 | 2204 | ||
2178 | /* set the update mode */ | ||
2179 | if (def_display->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) { | 2205 | if (def_display->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) { |
2180 | #ifdef CONFIG_FB_OMAP2_FORCE_AUTO_UPDATE | 2206 | u16 w, h; |
2181 | if (def_display->enable_te) | 2207 | if (dssdrv->enable_te) |
2182 | def_display->enable_te(def_display, 1); | 2208 | dssdrv->enable_te(def_display, 1); |
2183 | if (def_display->set_update_mode) | 2209 | if (dssdrv->set_update_mode) |
2184 | def_display->set_update_mode(def_display, | 2210 | dssdrv->set_update_mode(def_display, |
2185 | OMAP_DSS_UPDATE_AUTO); | ||
2186 | #else /* MANUAL_UPDATE */ | ||
2187 | if (def_display->enable_te) | ||
2188 | def_display->enable_te(def_display, 0); | ||
2189 | if (def_display->set_update_mode) | ||
2190 | def_display->set_update_mode(def_display, | ||
2191 | OMAP_DSS_UPDATE_MANUAL); | 2211 | OMAP_DSS_UPDATE_MANUAL); |
2192 | 2212 | ||
2193 | def_display->get_resolution(def_display, &w, &h); | 2213 | dssdrv->get_resolution(def_display, &w, &h); |
2194 | def_display->update(def_display, 0, 0, w, h); | 2214 | def_display->driver->update(def_display, 0, 0, w, h); |
2195 | #endif | ||
2196 | } else { | 2215 | } else { |
2197 | if (def_display->set_update_mode) | 2216 | if (dssdrv->set_update_mode) |
2198 | def_display->set_update_mode(def_display, | 2217 | dssdrv->set_update_mode(def_display, |
2199 | OMAP_DSS_UPDATE_AUTO); | 2218 | OMAP_DSS_UPDATE_AUTO); |
2200 | } | 2219 | } |
2201 | } | 2220 | } |
diff --git a/drivers/video/omap2/omapfb/omapfb.h b/drivers/video/omap2/omapfb/omapfb.h index f7c9c739e5ef..cd54fdbfd8bb 100644 --- a/drivers/video/omap2/omapfb/omapfb.h +++ b/drivers/video/omap2/omapfb/omapfb.h | |||
@@ -83,6 +83,12 @@ struct omapfb2_device { | |||
83 | struct omap_overlay *overlays[10]; | 83 | struct omap_overlay *overlays[10]; |
84 | unsigned num_managers; | 84 | unsigned num_managers; |
85 | struct omap_overlay_manager *managers[10]; | 85 | struct omap_overlay_manager *managers[10]; |
86 | |||
87 | unsigned num_bpp_overrides; | ||
88 | struct { | ||
89 | struct omap_dss_device *dssdev; | ||
90 | u8 bpp; | ||
91 | } bpp_overrides[10]; | ||
86 | }; | 92 | }; |
87 | 93 | ||
88 | struct omapfb_colormode { | 94 | struct omapfb_colormode { |
@@ -105,6 +111,9 @@ void omapfb_remove_sysfs(struct omapfb2_device *fbdev); | |||
105 | 111 | ||
106 | int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg); | 112 | int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg); |
107 | 113 | ||
114 | int omapfb_update_window(struct fb_info *fbi, | ||
115 | u32 x, u32 y, u32 w, u32 h); | ||
116 | |||
108 | int dss_mode_to_fb_mode(enum omap_color_mode dssmode, | 117 | int dss_mode_to_fb_mode(enum omap_color_mode dssmode, |
109 | struct fb_var_screeninfo *var); | 118 | struct fb_var_screeninfo *var); |
110 | 119 | ||
diff --git a/drivers/video/sunxvr500.c b/drivers/video/sunxvr500.c index 18b950706cad..4cd50497264d 100644 --- a/drivers/video/sunxvr500.c +++ b/drivers/video/sunxvr500.c | |||
@@ -400,6 +400,7 @@ static void __devexit e3d_pci_unregister(struct pci_dev *pdev) | |||
400 | 400 | ||
401 | static struct pci_device_id e3d_pci_table[] = { | 401 | static struct pci_device_id e3d_pci_table[] = { |
402 | { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x7a0), }, | 402 | { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x7a0), }, |
403 | { PCI_DEVICE(0x1091, 0x7a0), }, | ||
403 | { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x7a2), }, | 404 | { PCI_DEVICE(PCI_VENDOR_ID_3DLABS, 0x7a2), }, |
404 | { .vendor = PCI_VENDOR_ID_3DLABS, | 405 | { .vendor = PCI_VENDOR_ID_3DLABS, |
405 | .device = PCI_ANY_ID, | 406 | .device = PCI_ANY_ID, |
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 1d5191fab62e..1b6573216998 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
@@ -473,7 +473,8 @@ static void vp_del_vqs(struct virtio_device *vdev) | |||
473 | 473 | ||
474 | list_for_each_entry_safe(vq, n, &vdev->vqs, list) { | 474 | list_for_each_entry_safe(vq, n, &vdev->vqs, list) { |
475 | info = vq->priv; | 475 | info = vq->priv; |
476 | if (vp_dev->per_vq_vectors) | 476 | if (vp_dev->per_vq_vectors && |
477 | info->msix_vector != VIRTIO_MSI_NO_VECTOR) | ||
477 | free_irq(vp_dev->msix_entries[info->msix_vector].vector, | 478 | free_irq(vp_dev->msix_entries[info->msix_vector].vector, |
478 | vq); | 479 | vq); |
479 | vp_del_vq(vq); | 480 | vp_del_vq(vq); |
diff --git a/drivers/w1/masters/Kconfig b/drivers/w1/masters/Kconfig index 3195fb8b7d9a..80b3b123dd7f 100644 --- a/drivers/w1/masters/Kconfig +++ b/drivers/w1/masters/Kconfig | |||
@@ -60,7 +60,7 @@ config W1_MASTER_GPIO | |||
60 | 60 | ||
61 | config HDQ_MASTER_OMAP | 61 | config HDQ_MASTER_OMAP |
62 | tristate "OMAP HDQ driver" | 62 | tristate "OMAP HDQ driver" |
63 | depends on ARCH_OMAP2430 || ARCH_OMAP34XX | 63 | depends on ARCH_OMAP2430 || ARCH_OMAP3 |
64 | help | 64 | help |
65 | Say Y here if you want support for the 1-wire or HDQ Interface | 65 | Say Y here if you want support for the 1-wire or HDQ Interface |
66 | on an OMAP processor. | 66 | on an OMAP processor. |
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 050ee147592f..3da3f48720a7 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -194,7 +194,7 @@ config EP93XX_WATCHDOG | |||
194 | 194 | ||
195 | config OMAP_WATCHDOG | 195 | config OMAP_WATCHDOG |
196 | tristate "OMAP Watchdog" | 196 | tristate "OMAP Watchdog" |
197 | depends on ARCH_OMAP16XX || ARCH_OMAP24XX || ARCH_OMAP34XX | 197 | depends on ARCH_OMAP16XX || ARCH_OMAP2 || ARCH_OMAP3 |
198 | help | 198 | help |
199 | Support for TI OMAP1610/OMAP1710/OMAP2420/OMAP3430 watchdog. Say 'Y' | 199 | Support for TI OMAP1610/OMAP1710/OMAP2420/OMAP3430 watchdog. Say 'Y' |
200 | here to enable the OMAP1610/OMAP1710/OMAP2420/OMAP3430 watchdog timer. | 200 | here to enable the OMAP1610/OMAP1710/OMAP2420/OMAP3430 watchdog timer. |
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c index 430a5848a9a5..c7a9479934af 100644 --- a/drivers/watchdog/pnx4008_wdt.c +++ b/drivers/watchdog/pnx4008_wdt.c | |||
@@ -96,9 +96,6 @@ static void wdt_enable(void) | |||
96 | { | 96 | { |
97 | spin_lock(&io_lock); | 97 | spin_lock(&io_lock); |
98 | 98 | ||
99 | if (wdt_clk) | ||
100 | clk_set_rate(wdt_clk, 1); | ||
101 | |||
102 | /* stop counter, initiate counter reset */ | 99 | /* stop counter, initiate counter reset */ |
103 | __raw_writel(RESET_COUNT, WDTIM_CTRL(wdt_base)); | 100 | __raw_writel(RESET_COUNT, WDTIM_CTRL(wdt_base)); |
104 | /*wait for reset to complete. 100% guarantee event */ | 101 | /*wait for reset to complete. 100% guarantee event */ |
@@ -125,19 +122,25 @@ static void wdt_disable(void) | |||
125 | spin_lock(&io_lock); | 122 | spin_lock(&io_lock); |
126 | 123 | ||
127 | __raw_writel(0, WDTIM_CTRL(wdt_base)); /*stop counter */ | 124 | __raw_writel(0, WDTIM_CTRL(wdt_base)); /*stop counter */ |
128 | if (wdt_clk) | ||
129 | clk_set_rate(wdt_clk, 0); | ||
130 | 125 | ||
131 | spin_unlock(&io_lock); | 126 | spin_unlock(&io_lock); |
132 | } | 127 | } |
133 | 128 | ||
134 | static int pnx4008_wdt_open(struct inode *inode, struct file *file) | 129 | static int pnx4008_wdt_open(struct inode *inode, struct file *file) |
135 | { | 130 | { |
131 | int ret; | ||
132 | |||
136 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) | 133 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) |
137 | return -EBUSY; | 134 | return -EBUSY; |
138 | 135 | ||
139 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | 136 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); |
140 | 137 | ||
138 | ret = clk_enable(wdt_clk); | ||
139 | if (ret) { | ||
140 | clear_bit(WDT_IN_USE, &wdt_status); | ||
141 | return ret; | ||
142 | } | ||
143 | |||
141 | wdt_enable(); | 144 | wdt_enable(); |
142 | 145 | ||
143 | return nonseekable_open(inode, file); | 146 | return nonseekable_open(inode, file); |
@@ -225,6 +228,7 @@ static int pnx4008_wdt_release(struct inode *inode, struct file *file) | |||
225 | printk(KERN_WARNING "WATCHDOG: Device closed unexpectdly\n"); | 228 | printk(KERN_WARNING "WATCHDOG: Device closed unexpectdly\n"); |
226 | 229 | ||
227 | wdt_disable(); | 230 | wdt_disable(); |
231 | clk_disable(wdt_clk); | ||
228 | clear_bit(WDT_IN_USE, &wdt_status); | 232 | clear_bit(WDT_IN_USE, &wdt_status); |
229 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | 233 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); |
230 | 234 | ||
@@ -273,25 +277,33 @@ static int __devinit pnx4008_wdt_probe(struct platform_device *pdev) | |||
273 | } | 277 | } |
274 | wdt_base = (void __iomem *)IO_ADDRESS(res->start); | 278 | wdt_base = (void __iomem *)IO_ADDRESS(res->start); |
275 | 279 | ||
276 | wdt_clk = clk_get(&pdev->dev, "wdt_ck"); | 280 | wdt_clk = clk_get(&pdev->dev, NULL); |
277 | if (IS_ERR(wdt_clk)) { | 281 | if (IS_ERR(wdt_clk)) { |
278 | ret = PTR_ERR(wdt_clk); | 282 | ret = PTR_ERR(wdt_clk); |
279 | release_resource(wdt_mem); | 283 | release_resource(wdt_mem); |
280 | kfree(wdt_mem); | 284 | kfree(wdt_mem); |
281 | goto out; | 285 | goto out; |
282 | } else | 286 | } |
283 | clk_set_rate(wdt_clk, 1); | 287 | |
288 | ret = clk_enable(wdt_clk); | ||
289 | if (ret) { | ||
290 | release_resource(wdt_mem); | ||
291 | kfree(wdt_mem); | ||
292 | goto out; | ||
293 | } | ||
284 | 294 | ||
285 | ret = misc_register(&pnx4008_wdt_miscdev); | 295 | ret = misc_register(&pnx4008_wdt_miscdev); |
286 | if (ret < 0) { | 296 | if (ret < 0) { |
287 | printk(KERN_ERR MODULE_NAME "cannot register misc device\n"); | 297 | printk(KERN_ERR MODULE_NAME "cannot register misc device\n"); |
288 | release_resource(wdt_mem); | 298 | release_resource(wdt_mem); |
289 | kfree(wdt_mem); | 299 | kfree(wdt_mem); |
290 | clk_set_rate(wdt_clk, 0); | 300 | clk_disable(wdt_clk); |
301 | clk_put(wdt_clk); | ||
291 | } else { | 302 | } else { |
292 | boot_status = (__raw_readl(WDTIM_RES(wdt_base)) & WDOG_RESET) ? | 303 | boot_status = (__raw_readl(WDTIM_RES(wdt_base)) & WDOG_RESET) ? |
293 | WDIOF_CARDRESET : 0; | 304 | WDIOF_CARDRESET : 0; |
294 | wdt_disable(); /*disable for now */ | 305 | wdt_disable(); /*disable for now */ |
306 | clk_disable(wdt_clk); | ||
295 | set_bit(WDT_DEVICE_INITED, &wdt_status); | 307 | set_bit(WDT_DEVICE_INITED, &wdt_status); |
296 | } | 308 | } |
297 | 309 | ||
@@ -302,11 +314,10 @@ out: | |||
302 | static int __devexit pnx4008_wdt_remove(struct platform_device *pdev) | 314 | static int __devexit pnx4008_wdt_remove(struct platform_device *pdev) |
303 | { | 315 | { |
304 | misc_deregister(&pnx4008_wdt_miscdev); | 316 | misc_deregister(&pnx4008_wdt_miscdev); |
305 | if (wdt_clk) { | 317 | |
306 | clk_set_rate(wdt_clk, 0); | 318 | clk_disable(wdt_clk); |
307 | clk_put(wdt_clk); | 319 | clk_put(wdt_clk); |
308 | wdt_clk = NULL; | 320 | |
309 | } | ||
310 | if (wdt_mem) { | 321 | if (wdt_mem) { |
311 | release_resource(wdt_mem); | 322 | release_resource(wdt_mem); |
312 | kfree(wdt_mem); | 323 | kfree(wdt_mem); |