rewrite of ambient light sensor

Change-Id: Ife2ab008ba6cc6e2bc19107bd42480276685b962
leds-otter-button: corrected module load / naming

Change-Id: I98951e43edddd7d4a3450e56602dd54d9bc401ce
bma250: moved sysfs entries to i2c device / cleanup

Change-Id: I7b0c60b0e9bc154fd5e239ce15d1d09b1dd9a412
stk_als22x7: attach sysfs to i2c device / minor cleanup

Change-Id: I15beda92c781be267b76794014b5ab157759e6af
rpmsg: omx: fix rpmsg_omx_connect return value

The rpmsg_omx_connect() is currently returning a positive value on
success (as returned by the wait_for_completion_interruptible_timeout
function - remaining jiffies to timeout value) instead of 0. This
regression was introduced by commit,
ac7dcb8 "rpmsg: omx: revise mutex protection for rpmsg_omx file".

This regression is fixed up to return the following as well
   - 0 when omx->state == OMX_CONNECTED
   - -EIO when omx->state == OMX_UNCONNECTED and timeout not expired.

Change-Id: Iee428919d73ebb843421be915e91b9553d71cbd7
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
stk_als22x7: add max report value of 8192

Change-Id: I1779b9fc682a1894cf8d0f8d5e916a796af447e4
OMAPDSS: DISPC: Do not enable MFLAG by default

We should not enable MFLAG by default.
DSSCOMP will decide either MFLAG should be enabled or not.

Change-Id: I528ac09c507adc9b25d252990e8d20af36b6ee99
Signed-off-by: Victor Kleinik <x0150886@ti.com>
OMAPDSS: DSSCOMP: Enable MFLAG only for FULL HD compositions with 4 overlays

Enable MFLAG only for FULL HD compositions with 4 pipelines to avoid
conflicts with ISS.

Change-Id: I79f49af577740510c71d1b449852b1caee8adf4b
Signed-off-by: Victor Kleinik <x0150886@ti.com>
OMAP4: Add platform data to support HDMI default display

Adding new platform data to support HDMI default display feature.
HDMI platform data is selected if HDMI is selected as default
display in boot args.

Change-Id: If31be22ecf09140a0c63246bd1a055e01a315a6f
Signed-off-by: Oleksandr Krol <oleksandr.krol@globallogic.com>
OMAP4: Blaze: populate board file with sgx config data

This sgx data will be needed in multi display configuration
to reflect number of framebuffers and swapchains to allocate.

Change-Id: I99373beeb860f777ec1d52558e1410cfc2176c83
Signed-off-by: Oleksandr Krol <oleksandr.krol@globallogic.com>
rpmsg: omx: fix a race condition in rpmsg_omx_probe()

The rpmsg_omx is a client driver on the rpmsg bus, providing a user
space interface to the remote OMX server (represented as a rpmsg_omx
device). The rpmsg_omx device(s) are created at runtime when a remote
processor publishes the device(s) through the rpmsg bus's name service
announcement. The devices are destroyed during a remoteproc recovery
process, unless there are open references to the device. Such pre-
existing handles are rechecked for during the driver probe.

The current rpmsg_omx probe is racy when checking for a pre-existing
omx service device. The rpmsg omx devices are created by a kthread
(the vq messages in omap_remoteproc are processed through a kthread),
and so the rpmsg_omx_probe can be executed in parallel in a SMP
environment. An error can occur in _match_omx_service cb ("Unable to
handle kernel NULL pointer dereference at virtual address 0000002c")
within the probe due to a NULL dev pointer. This race condition is
possible any time a remote processor is booted up, including during
the kernel boot.

The race condition scenario is explained below:

thread1:                          thread2:
...                               ...
rpmsg_omx_probe() for 1st device  ...
  omxserv=idr_for_each(...)       ...
    _match_omx_service(...)       ...
  ...                             rpmsg_omx_probe() for 2st device
  idr_get_new(...) _               omxserv = idr_for_each(...)
  ...               |                _match_omx_service(...)
                    |
  cdev_init(...)    |_               Oops! omxserv->dev is NULL for 1st device
  cdev_add(...)     |
  ...              _|
  omxserv->dev=device_create(...)
  ...

The race condition can be eliminated by making sure the service
channel is added to the list only after the device node is created,
but protecting the entire probe using a lock ensures that the device
name check is also atomic. The spinlock defining the lock is converted
to the more suitable mutex.

Change-Id: Ifcc2e505da6ae32fcb67303852140c98f4200214
Signed-off-by: Oleksandr Tyshchenko <oleksandr.tyshchenko@ti.com>
[s-anna@ti.com: revise patch description and retain variable name]
Signed-off-by: Suman Anna <s-anna@ti.com>
remoteproc: check for proper rproc state before power off

Add a check for the current rproc state in rproc_shutdown() to prevent
powering off the remote processor if it has not been booted completely.
The remote processor would remain in offline state if the boot fails
for any reason, and the cleanup would be handled automatically in the
rproc_fw_boot() function upon a boot failure.

Change-Id: Ie01eee861c0a75d134bda55f573eb42a85ff8b81
Signed-off-by: Oleksandr Tyshchenko <oleksandr.tyshchenko@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
I2C: OMAP: use pm_qos_update_request to set PM QoS constraints

Now PM QoS constraints have been set in omap_i2c_xfer() using
pm_qos_add_request() and pm_qos_remove_request() PM QoS API and this
introduces additional run-time overhead.

So, use pm_qos_update_request() to set PM QoS constraints in
omap_i2c_xfer().

Change-Id: I17746719a3d5a17c72dadd5374f30ec02577084d
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
mux: allow otter to set WAKEUPENABLE

Change-Id: Ib1864871d7e969850f6b42f4b0f101dd540207c6
drivers/power/bq27541_battery: update driver

Change-Id: I15da26de239bcc82ccfeb1ebf74041dff31409f5
drivers/power/smb347: update driver -- WIP (DO NOT TEST)

Change-Id: I8e2fabb4aeeb96b26550dcb4577712d81602814c
drivers/usb/otg: changes for smb347 driver

Change-Id: I5aa4ac0a93c94a88186adc67165c1df546814bbc
board: driver updates and board reconfig (added serial code back in)

Change-Id: Iafb00891f2e5487626fb260dc16d6f271b9abbc2
usb: ehci-omap: configure default PHY settings on boot

On Blaze Tablet, USB PHY doesn't have ability to be
reset because its /RESET line is soldered to Vcc.

As a workaround, during OMAP EHCI initialization we
reset it using [Function Control].Reset=1 bit.
As per datasheet, this resets transceiver but not
the ULPI interface or register set. This means,
that PHY may store previous registers settings.

It is OK if we do 'cold' power ON of board because the PHY
is in its default state after that. However if we do reset
of the board by pressing the 'reset' button or as
result of kernel panic, PHY do not loose its power so PHY's
registers will hold old values that may be incorrect
and an USB device, connected to the PHY may be not enumerated
for example. In Blaze Tablet particular case, devices
are not enumerated after 'reset' button or kernel panic
till power OFF-ON sequence.

In this patch we configure default PHY settings after its
soft reset so EHCI controller will expect correct behavior.

Change-Id: I7747c0a39eb8e51d499bd62c3ac0d311d19a924d
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>
ext4: check bh in ext4_read_block_bitmap()

Validate the bh pointer before using it, since
ext4_read_block_bitmap_nowait() might return NULL.

I've seen this in fsfuzz testing.

 EXT4-fs error (device loop0): ext4_read_block_bitmap_nowait:385: comm touch: Cannot get buffer for block bitmap - block_group = 0, block_bitmap = 3925999616
 BUG: unable to handle kernel NULL pointer dereference at           (null)
 IP: [<ffffffff8121de25>] ext4_wait_block_bitmap+0x25/0xe0
 ...
 Call Trace:
  [<ffffffff8121e1e5>] ext4_read_block_bitmap+0x35/0x60
  [<ffffffff8125e9c6>] ext4_free_blocks+0x236/0xb80
  [<ffffffff811d0d36>] ? __getblk+0x36/0x70
  [<ffffffff811d0a5f>] ? __find_get_block+0x8f/0x210
  [<ffffffff81191ef3>] ? kmem_cache_free+0x33/0x140
  [<ffffffff812678e5>] ext4_xattr_release_block+0x1b5/0x1d0
  [<ffffffff812679be>] ext4_xattr_delete_inode+0xbe/0x100
  [<ffffffff81222a7c>] ext4_free_inode+0x7c/0x4d0
  [<ffffffff812277b8>] ? ext4_mark_inode_dirty+0x88/0x230
  [<ffffffff8122993c>] ext4_evict_inode+0x32c/0x490
  [<ffffffff811b8cd7>] evict+0xa7/0x1c0
  [<ffffffff811b8ed3>] iput_final+0xe3/0x170
  [<ffffffff811b8f9e>] iput+0x3e/0x50
  [<ffffffff812316fd>] ext4_add_nondir+0x4d/0x90
  [<ffffffff81231d0b>] ext4_create+0xeb/0x170
  [<ffffffff811aae9c>] vfs_create+0xac/0xd0
  [<ffffffff811ac845>] lookup_open+0x185/0x1c0
  [<ffffffff8129e3b9>] ? selinux_inode_permission+0xa9/0x170
  [<ffffffff811acb54>] do_last+0x2d4/0x7a0
  [<ffffffff811af743>] path_openat+0xb3/0x480
  [<ffffffff8116a8a1>] ? handle_mm_fault+0x251/0x3b0
  [<ffffffff811afc49>] do_filp_open+0x49/0xa0
  [<ffffffff811bbaad>] ? __alloc_fd+0xdd/0x150
  [<ffffffff8119da28>] do_sys_open+0x108/0x1f0
  [<ffffffff8119db51>] sys_open+0x21/0x30
  [<ffffffff81618959>] system_call_fastpath+0x16/0x1b

Also fix comment for ext4_read_block_bitmap_nowait()

Change-Id: I078306b8c4e99a0fd8c609e17744249cf8e3358c
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
[Ruslan: cherry-picked from mainline 15b49132]
Signed-off-by: Ruslan Bilovol <ruslan.bilovol@ti.com>