acpi_ec: changes in communication with hardware
acpi_ec: changes in communication with hardware

Short description of the changes:
- attempt to retry some commands for which it is possible (read, query)
- always make a short sleep before checking EC status in polled mode
- periodically poll EC status in interrupt mode
- change logic for detecting broken interrupt delivery and falling back
  to polled mode
- check that EC is ready for input before starting a new command, wait
  if necessary

This commit is based on the original patch by David Naylor.

PR:		kern/150517
Submitted by:	David Naylor <naylor.b.david@gmail.com>
Reviewed by:	jkim
MFC after:	3 weeks

jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase