ASoC: qcom: qdsp6v2: fix crash due to asynchronous read/write

Whenever an async read command is issued to dsp when
the driver is not enabled, there is a crash in userspace.
The read command is disallowed in the driver and an error
is propagated to userspace which results in the crash.
The driver is re-enabled in a subsequent asynchronous write
command anyway, so the async read command can be allowed.
Ensure that read is allowed by removing a superfluous check.

CRs-Fixed: 675131
Signed-off-by: Satya Krishna Pindiproli <satyak@codeaurora.org>
Change-Id: I5d0598e37d08ac1090f98c24be49fd99c132e22f
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
asoc: msm: MBHC fixes, round 2

 * Reset the gnd-mic switch when the headset is inserted. Some
   headsets end up in a weird state otherwise.
 * Micbias does not need to be on all the time for regular headsets
   in order to detect button presses. Disable it.
 * Tweak the thresholds such that headsets which require 2.7V on
   micbias correctly start as HIGH_HPH. They will be corrected to
   headsets after the micbias is turned on in subsequent passes.

Change-Id: Ia846d95b81f2dcde1f14e77b0d69d6ab034b4bb4
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
asoc: msm: Check headset insertion for consistency

 * It's possible to get a noisy reading during polling when
   transitioning to PLUG_TYPE_HEADSET. Poll again to double
   check that it's really a headset.
 * This helps when music is at full volume and a headphone
   is inserted. Double-checking the reading vastly improves
   the case where a noisy reading causes a mic to be detected.

Change-Id: I6e0863a46cdfd5316d798bc9b8348927fa403890
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
asoc: msm: Enable spammy MBHC debugging

 * Accidentally got removed from previous patch. Enable spammy debugging
   so we can collect data about more types of headsets.

Change-Id: If65168e2fbb470562433f9738886025c51096ff6
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
asoc: msm: More MBHC tunings!

 * All day every day!
 * It seems that certain OEM handset makers who are also in the
   accessory biz have chosen resistence values which lie directly
   on the threshold of the reference design. I can only think of
   a few reasons why someone would do this.
 * Nice trolling, Xiaomi :)

Change-Id: I0ff08b0f2253f10422f16f00ef5a8911455c5348
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
asoc: msm: MBHC tunings forever!

 * Franco's Apple headset is right on the boundary for HIGH_HPH.
 * Move the threshold down to 180.

Change-Id: I487af13663cb74d55ff8a270bda917537284966f
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Implement kexec-hardboot

"Allows hard booting (i.e., with a full hardware reboot) to a kernel
previously loaded in memory by kexec.  This works around the problem of
soft-booted kernel hangs due to improper device shutdown and/or
reinitialization."
More info in /arch/arm/Kconfig.

Original author: Mike Kasick <mike@kasick.org>

Vojtech Bocek <vbocek@gmail.com>:
  I've ported it to hammerhead, it is based of my mako/grouper port, which is
  based of Asus TF201 patch ported by Jens Andersen <jens.andersen@gmail.com>

  Hammerhead is the first device I've ported this patch to which uses
  device tree binary instead of atags. It is also rather picky - its
  bootloader erases first 128MB of RAM on reboot, so following hacks had
  to be applied:
  * Copy dtb to location passed in r2 before jumping to kexecd' kernel,
    the kernel would just freeze when I left dtb above 128MB of RAM.
  * Copy kexecd' kernel to location in the first 128MB before jumping to it,
    the decompressor operates very slowly if the kernel is above the cached
    area, copying it lower and decompressing it afterwards is much faster.

  Same as my mako/flo patches, the guest kernel does not require any
  modifications, kexec-hardboot is equivalent to standard kexec.

  To support dtb, following commit was backported from the mainline:
    commit 4cabd1d9625c7d88acd143f4021fbef75394f154
    Author: Matthew Leach <matthew.leach@arm.com>
    Date:   Fri Sep 21 18:56:02 2012 +0100

      ARM: 7539/1: kexec: scan for dtb magic in segments

      This patch allows a dtb to be passed to a new kernel using the kexec
      mechinism.

      When loading segments from userspace, scan each segment's first four
      bytes for the dtb magic. If this is found set the kexec_boot_atags
      parameter to the relocate_kernel code to the phyical address of this
      segment.

Davide Pianca <kingbabasula@gmail.com>:
  Ported from https://gist.github.com/Tasssadar/7833796
  Adapted for bacon

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>