MFD: twl6040-codec: Add test registers definitions

Add definitions for test registers.

Change-Id: Ic046f4639781981ca2421f5b75c0c5408a3dc976
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
MFD: twl6040-codec: Add uEvent based event notification

Add initial support for a kobject event based notification mechanism
to inform userspace about TWL6040 events like handsfree overcurrent,
vibrator overcurrent, thermal event.

Since the events can be handled in other drivers apart from the MFD,
a new API (twl6040_report_event) is created so that MFD clients can
notify their events using a single kobject.

Change-Id: I07f71d1693a6eb189ca07fffeb3ebc12e539d4ae
Signed-off-by: Chris Kelly <c-kelly@ti.com>
MFD: twl6040-codec: Add register cache

Add register cache and define register operations (read, write,
set_bits, clear_bits) on cache only. So register operations
performed on I2C registers are now differentiated.

Register operations APIs exported by TWL6040 MFD are a wrapper
to its I2C counterparts at the moment.

Change-Id: I76137099e6264de9ac3213c596f662a50299aa82
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>
Signed-off-by: Chris Kelly <c-kelly@ti.com>
MFD: twl6040-codec: Add register supply query APIs

Add a new set of APIs to TWL6040 MFD to query the supply of its
registers: twl6040_get_reg_supply(), twl6040_reg_is_vdd() and
twl6040_reg_is_vio().

Change-Id: Ic320ad7759c66d705f6025361cd6a296ac695dd9
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Chris Kelly <c-kelly@ti.com>
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>
MFD: twl6040-codec: Add register context restore

Add register context restore per supply.

Change-Id: I4918efee4fcc83f4998f59f3d376b798822ca3ce
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Chris Kelly <c-kelly@ti.com>
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>
MFD: twl6040-codec: Handle thermal interrupt

When the TWL6040 temperature increases above a threshold that could
damage the device, a thermal interrupt and shutdown are started
automatically by the hardware.

The thermal event handling involves the following steps:
1. Forcefully deassert AUDPWRON to avoid keeping TWL6040 is
   Power-On state any longer
2. The event is notified to Android userspace through the switch
   class based mechanism so that further actions can be taken
3. While the device is in thermal shutdown, accesses to VDD/VSS
   registers will affect only register cache
4. Once the device has recovered from the thermal event, it will
   be put back to Power-On state regardless of the state requested
   by MFD clients:
   4.1. If clients have requested Power-On state, then the context
        of VDD/VSS registers is restored
   4.2. If clients have requested Sleep state, then the request will
        be honored. The additional Power-On -> Sleep transition is
        required to ensure that reference system is disabled after
        thermal shutdown
5. An additional notification is sent to Android userspace to inform
   about thermal shutdown recovery.

Change-Id: I38afa98fea03210312fc01ab0d2c6ab2a10c447d
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Chris Kelly <c-kelly@ti.com>
ASoC: DSP: Fix BE link state and hw_params in debugfs

BE state and hw_params were incorrectly shown in DSP state debugfs,
it was showing FE's values instead.

Change-Id: Ib5afb1537824634208741b0b635a31152c5aaddd
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
OMAP4: clock: Fixing clock internal source selection for ABE ports

ABE ports need a mask of two bits in order to select the
correct internal source clock. This patch fix this mask that
was only one bit and was overlaping with source clock bits.

Change-Id: I8597efd9cec6707e815da39598a0adb7a3ce3c61
Signed-off-by: Israel Cepeda <icepeda@ti.com>
TWL6030: Fix false GPADC conversion timeout.

When scheduler preempts just started GPADC conversion,
the timeout appears because a time is exhausted
but actual status register value is not updated yet.
Simple scenario:
1. GPADC convertion is started before this function starts to run.
2. reg = twl6030_gpadc_read(gpadc, status_reg);
3.  if (!(reg & TWL6030_GPADC_BUSY) && (reg & TWL6030_GPADC_EOC_SW))
            return 0;
    GPADC is not yet ready, so function does not return.
4.  This moment the context is switched to another thread(s)
      ----------------------------------------------------------------------->
5.                           thread(s) work(s) for    timeout_ms   or more  time.
                             GPADC convertion is finished.
6.    <-----------------------------------------------------------------------
      The context is switched back.
7.  } while (!time_after(jiffies, timeout))
      Next cycle pass does not start, even if GPADC is yet ready.
8.  The Timeout Error is returned.

Additional GPADC status register reading is added for such cases.

	modified:   drivers/mfd/twl6030-gpadc.c

Change-Id: I94b61bb8318c6a03972ad057ab3fd026d1b4c13f
Signed-off-by: x0169938 <vasyl.yushchyshen@ti.com>
TWL6030: relaxing the GPADC busy loop with a sleep.

After GPADC conversion is started, we wait for finish it with
a busy flag polling in twl6030_gpadc_wait_conversion_ready().
Actually the GPADC busy loop finishes immediately, but for the
worst case condition the sleep is added.

      modified:   drivers/mfd/twl6030-gpadc.c

Change-Id: If20a9bfe6943814bcce98e591fd876d66f986e44
Signed-off-by: x0169938 <vasyl.yushchyshen@ti.com>
omap: iommu: lower trace level in iommu_enable

The version of the iommu is printed using dev_info in iommu_enable.
This trace is quite rudimentary and hence is converted to use a
dev_dbg. The iommu_enable function is invoked every-time a processor
has to be booted, and so this conversion also helps with the overall
processor init time.

Change-Id: Ia6cfbdf7e6424a917b5d49083c994c88103c0049
Signed-off-by: Subramaniam C.A <subramaniam.ca@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
remoteproc: use dev_dbg to print image version

The version of the remote processor's resource table format is printed
using dev_info during the startup path of a remoteproc. The version
changes very rarely and hence is converted to use a dev_dbg. An error
message is printed anyway in case of a mismatch, so this conversion is
useful in helping improve the overall processor init time.

Also, version info can be looked up using an offline readrprc utility.

Change-Id: I546d3c73582bb7a3fdb2b32b4e3df03ce3a6e7f2
Signed-off-by: Subramaniam C.A <subramaniam.ca@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
rpmsg: use dev_dbg for channel creation/deletion messages

The number of rpmsg channels is decently high enough during
both the initialization and tear-up/recovery of the remote
processor to effect overall boot time. The trace level of this
print is therefore reduced to improves the overall image init
time. It also helps with the runtime performance of usecases as
they have to create and delete a channel.

Change-Id: I96c293d990bc41f1a9dcd6710ef1388fa2ce2cec
Signed-off-by: Subramaniam C.A <subramaniam.ca@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
rpmsg: fix device definitions in rpmsg client drivers

The rpmsg client drivers - rpmsg_omx, rpmsg_resmgr and the rpmsg
sample drivers - rpmsg_client_sample & rpmsg_server_sample, are
all defining the supported devices incorrectly as a 'platform'
device.

The devices these drivers support should all be 'rpmsg' devices,
and the device id tables declared by these drivers has been
corrected accordingly.

Change-Id: Ib1a0f0de5ffad48fe52937730e90a3254265a2f6
Reported-by: Xavier Boudet <x-boudet@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
omap: remoteproc: add a notification for loading error

When calling rproc_get for the first time, the loading of
the remoteproc image will be requested using a non-blocking
request_firmware_no_wait, and the caller can continue before
the actual loading is complete.

The loader later can return an error due to a non-existing
or wrong image and there should be a way to notify about this
to users having a rproc handle.

This functionality is added and is leveraged by rpmsg to
release some resources it had already acquired since requesting
a firmware load.

Change-Id: I1d3523efbcfd613bca74d363084791ceaaaa9989
Signed-off-by: Miguel Vadillo <vadillo@ti.com>
MFD: twl6030-gpadc update trim information

In the latest iteration of the data sheet the TRIM information was
changed from 2s complement to magnitude + sign. And the codes for
channel 10 were updated. Update code to reflect this change.

Change-Id: Ibaa3cbbe2241e1ce844e1249f0ab6389a1ed9b93
Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
MFD: TWL6032_GPADC: Correct calibration parametrs.

This patch corrects GPADC calibration for the TWL6032 due to the
TWL6032 data manual.

Change-Id: I15fb4148bf94a5123467e8b7a316e7edcdb55ebc
Signed-off-by: Oleksandr Dmytryshyn <oleksandr.dmytryshyn@ti.com>
OMAP4+: HSI: Prevent HSI clock disable while ACWAKE is high

If HSI clocks are disabled while ACWAKE is high, it is possible that ACWAKE
goes low unexpectedly.
This is not seen on Link Layers which do not comply with MIPI, because in this
case ACWAKE and CAWAKE are high at the same time, so HSI clocks are not
disabled.
But for Link Layers which comply with MIPI, CAWAKE will go low independtly of
CAWAKE, and HSI driver might cut the clocks while ACWAKE is high, which causes
CAWAKE to have an unknwon value.

Change-Id: Ib37982b3702ed64a917626d1a7407d558df1b49a
Signed-off-by: Djamil Elaidi <d-elaidi@ti.com>
gcx: moved GC320 pixel cache flush to the end of the batch.

Change-Id: I72eb7c3dfb298329ccbef965f12bec55fef4eea6
Signed-off-by: Alexei Shlychkov <shlychkov@gmail.com>
gcx: optimized programming of the destination.

Change-Id: I39381097a64dffe4af6632d9da414c73978505f5
Signed-off-by: Alexei Shlychkov <shlychkov@gmail.com>