switch: hds_max1462x: Add maxim headset detection(max1462x) driver

Change-Id: I8df8303126d4b380aa6f33f6b0bcd4b12679714d
Author: Hyunsub Na <hyunsub.na@lge.com>
Signed-off-by: Hyunsub Na <hyunsub.na@lge.com>
Signed-off-by: Devin Kim <dojip.kim@lge.com>
switch: hds_max1462x: fix the mismatch enable/disable of key_irq

irq_key is automatically enabled in request_threaded_irq function.
So, the duplicated IRQ warning message is displayed in kmsg.
Therefore, it's changed to disable irq_key after irq request.
Because the irq_key is need only 4-pole.

Change-Id: I6eee5a0c8372884305c3878f13bed22d5bb09cbd
Signed-off-by: sangwoo <sangwoo2.park@lge.com>
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Sensors: Invensense 5.1.6 IIO driver release

-- Patches provided to handle poll function better in Kfifo situation in
   industrialio-buffer.c
-- the new IIO MPU6515 (Accelerometer/Gyro) driver
-- secondary bus support of AKM8963 (compass)
-- secondary bus support of BMP280 (pressure)

Change-Id: I0c16e032723894951ee3fe1e0ad21a74208780b7
Signed-off-by: chohee.park <chohee.park@lge.com>
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Sensors: Fix permission of iio:device0 nodes

sysfs nodes should not be world writable.

Change-Id: Ia22378c48aff6db87f006f006c0d924329431d3e
Signed-off-by: Devin Kim <dojip.kim@lge.com>
ashmem: avoid deadlock between read and mmap calls

Avoid holding ashmem_mutex across code that can page fault.  Page faults
grab the mmap_sem for the process, which are also held by mmap calls
prior to calling ashmem_mmap, which locks ashmem_mutex.  The reversed
order of locking between the two can deadlock.

The calls that can page fault are read() and the ASHMEM_SET_NAME and
ASHMEM_GET_NAME ioctls.  Move the code that accesses userspace pages
outside the ashmem_mutex.

Bug: 9261835
Change-Id: If1322e981d29c889a56cdc9dfcbc6df2729a45e9
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Sensors: Invensense Motion Apps 5.1.6 Release Candidate 25

- Added multi-rate support for sensors in batch mode.
- Fix step detector and step counter bugs.
- Calib-bias entries are now updated after executing self_test.
- Fix batching mode bug where timeout greater than buffer size was not being handled correctly.
- Ensure MPU goes into sleep mode when idle.
- Fifo overflows checks added to batch mode.
- Batch mode takes priority over continuous mode when concurrent requests are made.

Change-Id: I0cb827df09dd9eda3b6f981280f6d05802853721
Signed-off-by: chohee.park <chohee.park@lge.com>
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Revert "staging: android: ram_console: honor dmesg_restrict"

This reverts commit dd09979346813357200adf71b07003fc0a778089.

Signed-off-by: Patrick Tjin <pattjin@google.com>
binder: use freezable blocking calls

Avoid waking up every thread sleeping in a binder call during
suspend and resume by calling a freezable blocking call.  Previous
patches modified the freezer to avoid sending wakeups to threads
that are blocked in freezable blocking calls.

This call was selected to be converted to a freezable call because
it doesn't hold any locks or release any resources when interrupted
that might be needed by another freezing task or a kernel driver
during suspend, and is a common site where idle userspace tasks are
blocked.

Change-Id: Ic4458ae90447f6caa895cc62f08e515caa7790ba
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Sensors: Invensense Motion Apps 5.1.6 Release Candidate 33

Changes:
- Improved the handling of the biases both for factory calibration and
  runtime calibration via the gyro and accel offset and dmp_bias sysfs
  entries
- Prevented a possible race condition in batch mode settings
- Improved the data flow handling for some sensors and sensor scenarios
- Keep track of the batch mode requests for sensors even if the system
  proceeds in continuous mode - necessary when batch mode is restored
- Changed pressure values to floating point for better resolution
- Pedometer time and steps representation is now 64 bits
- Fixes a number of sensor combination corner cases involving Pedometer
  Step Detector
- Fixed long term drift issue in batched Game Rotation Vector
- Fixed misconfiguration caused by Significant Motion getting detected
  while working with other sensors
- Fixed Linear Accelerometer sample count in batching
- Fixed handling of the rates with combination of sensors involving
  virtual sensors
- Output all the data in the FIFO when a Significant Motion is detected.
  Do the same when the system comes back up from suspended.
- Fixed sensors getting left wrongly configured and not outputting any
  data when other sensors are enabled or disabled
- Fixed duplicated timestamp issues with Gravity vector sensor
- Fixed problems with the sensor rates in continuous and batch mode
- Fixed a problem causing high timestamp variance for the Gyroscope sensor
  while running the Step Detector sensor
- Applied patch to self-test fail on heamerhead

Change-Id: I6c54e5aadd9a57fc38a8de8015fc009f1652a90c
Signed-off-by: chohee.park <chohee.park@lge.com>
Signed-off-by: Devin Kim <dojip.kim@lge.com>
Motion Apps 5.1.6 Release Candidate 54

Changes since MA 5.1.6 RC33

- Integrated flush feature within batching support with FLUSH_COMPLETE
  metadata indicator
- Handling accelerometer biases through the device's offset registers
  as for the gyroscope
- Added ability to write the accelerometer and gyroscope biases
  on the offset registers directly after self-test test execution
  for more seamless production floor handling
- Fixed batch mode timestamps across system suspend and resumes
- Estimate the timestamps using the devices's clock more reliably;
- Output the data in the FIFO when switching data mode (batching
  to continuous and vice versa, change of rate, addition/removal of a sensor)
- Accelerometer auto calibration does not overwrite the self-test accelerometer
  biases unless they are improving
- Added dynamic control of the HAL and SensorService logging
  using Android properties.

Change-Id: I94cf6eaedeb719f0bc2292c1dcfd20e24d8134f7
Signed-off-by: chohee.park <chohee.park@lge.com>
Signed-off-by: Devin Kim <dojip.kim@lge.com>
spi_qsd: Add high speed mode support

The SPI mini-core has a specialized signal sampling mode which
improves signal to noise ratio for bus rates that are greater
then or equal to 26MHz.
This patch sets the mini-core in high-speed mode whan
the bus rate is greater or equal to this limit.

CRs-Fixed: 460451
Change-Id: I9a5094c92f3be8b683cd28a7737501d26b45b082
Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
slim_msm: Support TX message queues

TX message queues are setup using BAM descriptors and event to
notify when the descriptor is done. This type of access ensures
lesser interrupts for slimbus controller, and offloads CPU from
copying message buffer into registers.
At this time, TX message queues are enabled on non-ported generic
device per HW recommendation.

Change-Id: I26423ef4d9fb3d54594d64555417f9a0c1dac37d
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
slim_ngd: Make sure transaction is not dereferenced after it's freed

Every read transaction over slimbus is a set of one transmit and one
receive. Receive part frees meta-data for the read transaction since
it is no longer needed, and the transaction-ID can be reused.
Make sure that the transmit function doesn't try to dereference the
transaction meta-data after possibly receiving a response.

CRs-fixed: 515802
Change-Id: Id736ad368d4944a6aabc89f4ff295d664bc5efa0
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
slimbus: Add support for report-absent and device-down notification

device_down callback will be called when the device sends
report-absent message per slimbus specification, or if the device
cannot be reached due to some other reason (e.g. bus going down).
device_up will be called when the device sends reports present again.

Change-Id: Ie48c2e3891b55cb1ec9c675a32cdb0a568fdcc18
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Glenn Kasten <gkasten@google.com>
scsi_pm: resume device if suspend failed

For scsi devices which use scsi bus runtime callback, runtime suspend
will call scsi_dev_type_suspend, and if the drv->suspend failed, the
device will still be in active state. But since scsi_device_quiesce is
called, the device will not be able to respond any more commands.
So add a check here to see if err occured, if so, bring the device back
to normal state with scsi_device_resume.

Change-Id: I9d92645cae9a72da7e3f6d7596d18e5f925109a4
Signed-off-by: Aaron Lu <aaron.lu@amd.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Git-commit: d20ec597cba1e8ea407c9a7c668a9e04fc057c83
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
scsi_pm: use callbacks from dev_pm_ops for scsi devices

Use of pm_message_t is deprecated and device driver is not supposed
to use that. This patch migrates the SCSI bus level pm callbacks
to call device's pm callbacks defined in its driver's dev_pm_ops.

This is achieved by finding out which device pm callback should be used
in bus callback function, and then pass that callback function pointer
as a param to the scsi_bus_{suspend,resume}_common routine, which will
further pass that callback to scsi_dev_type_{suspend,resume} after
proper handling.

The special case for freeze in scsi_bus_suspend_common is not necessary
since there is no high level SCSI driver has implemented freeze, so no
need to runtime resume the device if it is in runtime suspended state
for system freeze, just return like the system suspend/hibernate case.

Since only sd has implemented drv->suspend/drv->resume, and I'll update
sd driver to use the new callbacks in the following patch, there is no
need to fallback to call drv->suspend/drv->resume if dev_pm_ops is NULL.

Change-Id: I08b44d12e480cdbb736a39c8a4a7c7e7e8a42c36
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Git-commit: 80d2fd48cca2a0de806c3130551744a04ad5b80b
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[sthumma@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
sd: use REQ_PM in sd's runtime suspend operation

With the introduction of REQ_PM, modify sd's runtime suspend operation
functions to use that flag so that the operations to put the device into
runtime suspended state(i.e. sync cache and stop device) will not affect
its runtime PM status.

Change-Id: I0fe93acfbfbd01ce265a6dd2df6349ca26598fca
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Git-commit: 9b21493c4520970f8f404e0265f48e37f9cffaf5
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[sthumma@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
sd: change to auto suspend mode

Uses block layer runtime pm helper functions in
scsi_runtime_suspend/resume for devices that take advantage of it.

Remove scsi_autopm_* from sd open/release path and check_events path.

Change-Id: I9ac9a474bc34ecb526c5fedf910c51f1cc2d71a5
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Git-commit: 6df339a51e3bf18b868384bdeb31e49a4fbaa3d8
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
rtc: qpnp-rtc: Add module parameter to control power-on alarm

Power-on alarm feature can be enabled/disabled by writing 1/0
to the module parameter exported by driver.

CRs-Fixed: 432312
Change-Id: I2a2337adb2ddc186ec312648b11b6a35ea698856
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
regulator: qpnp-regulator: Don't print errors during probe deferral

Make the error printing statements after the qpnp-regulator
drivers calls regulator_register() conditional upon the error
code not being -EPROBE_DEFER.  This removes some unnecessary
kernel log messages that take place when a qpnp-regulator device
attempts to probe before its parent regulator.

Change-Id: I92d4ed61a238d384bae43458e3ca86c0079380c0
Signed-off-by: David Collins <collinsd@codeaurora.org>