misc: BMP180: add BMP180 barometer driver

BMP180 barometer is exactly same as BMP085 except for that
BMP180 doesn't have an IRQ pin different from BMP085.

Pressure value is read based on timer and pushed in the queue
of input device named barometer.

This driver can be enabled or disabled through sysfs path.
poll_delay through sysfs decides how often pressure value
should be read and pushed.

Change-Id: I982b3c6649415697c34dfe8350fec6677529ef85
Signed-off-by: hwham <hwham@sta.samsung.com>
misc: BMP180: modify poll_delay_store

If poll_delay is set lower than DELAY_LOWBOUND, then
DELAY_LOWBOUND should be set DELAY_LOWBOUND.
DELAY_MAXBOUND is removed because values higher
DELAY_MAXBOUND is applicable. DELAY_MAXBOUND is meaningless.

DELAY_LOWBOUND is calculated based on the BMP180 datasheet.
The DELAY_LOWBOUND, lower bound of poll_delay, is set to
50 msec because it should include
time for reading temperature(20 msec),
timer for reading pressure(24.5 msec),+
time cushion for stability(around 5.5 msec).

Change-Id: I7f012b09d1e7faf21287487c931779b1dfc09141
Signed-off-by: hwham <hwham@sta.samsung.com>
Initial checkin of the invensense gyroscope driver

Supports MPU3050 only
Slave devices are in a seperate commit.

Change-Id: I5a2381bdd7c625351f134b5b8ac3d813218ad800
Signed-off-by: Nathan Royer <nroyer@invensense.com>

Conflicts:
	drivers/misc/Makefile
Addition of slave sensor modules.

Each slave can be compiled and linked sumultanously.  It
is up to the board file to only probe one slave of each type.

Change-Id: I3f301eb88be6e82af9b78f8c09d4e8d7e1e4b227
Signed-off-by: Nathan Royer <nroyer@invensense.com>
misc: inv_mpu: Fix read returning 0 incorrectly.

There is an issue in read where the expected buffer size was
sizeof(unsigned long) too large.

Change-Id: Id4f22306653304faaead2f10a8ff987e3193f715
Signed-off-by: Nathan Royer <nroyer@invensense.com>
misc: inv_mpu: add interface to get offset regs.

yamaha compass has internal offset register we need to persist. This change
allows access to those registers.

Change-Id: I93034b3a478bfddfc8b71d9cb95e6d7d565838b1
Signed-off-by: Kevin Powell <kpowell@invensense.com>
misc: inv_mpu: yas530.c: Fix noisy performance.

The issue was a variable that was suppose to be unsigned was signed.
This lead to all negative numbers on the trim factors being way off.
One of the temperature compensation values was suppose to be slightly
negative and the sign error made it a large negative which caused the problem.

Change-Id: I80de9327504499e57547d9209dc06f5fdcf56636
Signed-off-by: Nathan Royer <nroyer@invensense.com>
misc: inv_mpu: change irqtime to use monotonic clock

Populate irqtime in mpuirq_data with ktime_to_ns(ktime_get()).

Change-Id: Ib30f823a909c8a7fbd78446e4eaf9d1c1a693b01
Signed-off-by: Nathan Royer <nroyer@invensense.com>
Signed-off-by: Arve Hjønnevåg <arve@android.com>
invensense: bma250: disable reading of New data Status

The interrupt seems to be cleared automatically.
There does not seem to be a need to read the NewDataStatus(0x0A) register.

This avoids extra write and a read on i2c bus.

Change-Id: I36d0a82fd9a9bb657541f5f60e15679d14b6d0af
Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
Cc: Nathan Royer <nroyer@invensense.com>
misc: inv_mpu: yas530: Added static soft iron correction feature

A correction matrix for compensating static soft iron effect is added.
This matrix is defined in a board file. If it is not defined,
this will be skipped.

Change-Id: I18c2d2663943f7527410d457353edbadf5ac4cee
Signed-off-by: Jinkyu Song <jksong@sta.samsung.com>
misc: inv_mpu: yas530: Report the error flag for overflow or underflow

Invensense libmllite needs to be notified when either overflow or underflow
happens in raw values.
When HAL requires to measure hardware offset, coil init will be triggered.

Change-Id: Ib2185242efeceff87c9a1680004699f4f27fef66
Signed-off-by: Jinkyu Song <jksong@sta.samsung.com>
misc: inv_mpu: Unregister PM notifier

Unregister PM notifier on probe error or remove.  Avoids use
after free function calls observed in suspend/resume.

Change-Id: I8a2a4c523323c090c061cb7525c40c500115bfcc
Signed-off-by: Todd Poynor <toddpoynor@google.com>
misc: sec_jack: initial SEC ear jack driver

This driver is derived from previous work to enable ear jack detection
for Samsung devices. It receives an interrupt from a gpio specified in
platform data for plug insert, controls the ear mic bias, and reads an
ADC channel to detect the type of headset.

Signed-off-by: Chris Kelly <c-kelly@ti.com>

Conflicts:
	drivers/misc/Makefile
misc: sec_jack: detect presence of headset at probe time

If a headset is connected before the kernel is booted, no interrupt
will occur and the headset will not be detected. The contents of
the threaded IRQ handler are moved into a work queue so it can be
queued at probe() time. The threaded IRQ handler is no longer
required and the existing single threaded work queue is shared.

Signed-off-by: Simon Wilson <simonwilson@google.com>
misc: sec_jack: disable mic bias when same headset type detected

Disable the ear mic bias when the same headset type is detected,
except 4 pole headset, if a detection interrupt is received
after processing.

Change-Id: I0c6862f2735eefc8470bc242ad326866322674c3
Signed-off-by: Changoh Heo <changoh.heo@samsung.com>
misc: sec-jack: Convert detection WQ into freezable

There can be a small window wherein system wide suspend can break
the headset detection algorithm. Draining headset detection workqueue
is required to guarantee that detection algorithm completes properly
(including userspace notification of new accesory type), that can be
achieved by converting the existing workqueue into freezable type.

Issue repro:
- Let system wide suspend triggered.
- Now, plugin a two pole headset
- allow system to hit suspend again
- unplug the headset.
- allow system to hit suspend again
- Repeat above steps till you see suspend/OFF is broken because
  of I2C1 is ON.

Change-Id: I85aac5b78d4a7025c9cd651aca6d404f67b71997
Signed-off-by: Girish S G <girishsg@ti.com>
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>