OMAP: TILER: Optimize placement for NV12 buffers

This patch changes the behaviour when allocating 2D buffers.  If
the required alignment is less than 4KiB and a security token is set,
the allocation will be flagged specifically for this format.  All
subsequent buffers of the same format and size will be placed inside
this area until the area is exhausted.

For NV12 allocations, this means that all Y allocations will share
one area, and the UV allocations will share another.

Change-Id: I13d29257c0cbab627c2938d4623557918448ee86
Signed-off-by: Andy Gross <andy.gross@ti.com>
OMAP4: ST: Disabling UART if ldisc not installed.

In cases when there is no line discipline to be installed UART chip must be
disabled.

Rationale: if ldisc is not installed so it can't be uninstalled.
Thus UART chip still enabled and we have wakelock for it
(see plat_uart_enable() function in both blaze and 44xx-tablet board files).
In that case we can't go in suspend mode.

Motivation: when using busybox ramdisk (e.g. for testing kernel w/o AFS) we
have no ldisc that causes impossibility to go to suspend mode.

Change-Id: I6fac0b9411ed765e8e598328b89a41a50b5fbfea
Signed-off-by: Semen Protsenko <semen.protsenko@ti.com>
drivers:misc:ti-st:remove redundant enable/disable

Platform specific chip enable/disable function need to be called only once
during the chip initialization routine.
This is to enable any platform specific initialization to be done for a given
platform.

Change-Id: I7fa815c073e424d745dd4a2d84efc07bf64a0490
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
drivers:misc:ti-st: Send wake_up_ack also in awake state

In case a wake_up_ack packet the host send to the BT device is lost,
the BT device will send another wake_up_indication.
Since the host was already in awake state, it did not answer the wake_up_indication.
It is safe to send wake_up_ack every time we get the wake_up_indication,
even if we are already in awake state or in transition state from sleep
to awake.

Change-Id: I99dd0872f8ef041b7886aa06a731071386ac4ad3
Signed-off-by: Amir Ayun <amira@ti.com>
drivers:misc: ti-st: free skb on firmware download

If during validation of the firmware download the data doesn't match what is
expected out of the chip, this calls for a firmware download failure and a
retry.
Free the SKB which collects response during such scenarios.

Change-Id: I78dc3bdc4ea87faa5dce7eea61371718999d3f87
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
drivers:misc:ti-st: platform hooks for chip states

Certain platform specific or Host-WiLink Interface specific actions would be
required to be taken when the chip is being enabled and after the chip is
disabled such as configuration of the mux modes for the GPIO of host connected
to the nshutdown of the chip or relinquishing UART after the chip is disabled.

Similar actions can also be taken when the chip is in deep sleep or when the
chip is awake. Performance enhancements such as configuring the host to run
faster when chip is awake and slower when chip is asleep can also be made
here.

Change-Id: I5baad900633e69740396bf1d6900feec4f2b596e
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
drivers: misc: ti-st: Added BT enable/disable hook

Added functionality to call UART get sync/put sync
through pltform board file for run time PM adaptation.

Change-Id: Ieb9676391b1472d84355615eef9ba442fcb5fd81
Signed-off-by: x0099048 <x0099048@ti.com>
drivers:misc:ti-st:remove redundant enable/disable

Platform specific chip enable/disable function need to be called only once
during the chip initialization routine.
This is to enable any platform specific initialization to be done for a given
platform.

Change-Id: I7fa815c073e424d745dd4a2d84efc07bf64a0490
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
drivers:misc: ti-st: reinit completion on ver read

After the version information has been read, the completion which assists in
wait_for_completion during the firmware send/wait sequence is being re-used
and hence this needs to be re-initialised for fool proof firmware download
retries.

Change-Id: Ia75485b83992ecbdd70cfcf15a41f551a1d86c56
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
drivers:misc: ti-st: reinit completion before send

download firmware behaves differently at different times, when logs are
enabled and the system is loaded, the wait_for_completion is able to wait for
every send, However during other times the wait does not happen.

So, for reliability reinitializing the completion before every send, makes
sure the wait happens for every send.

fixes: OMAPS00245110

Change-Id: Iff96d806a06338aadad65c43c272c205660c78d1
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
drivers:misc: ti-st: wait for completion at fail

When the line discipline install fails for reasons such as missing user-space
UIM or broken communication between UIM and ST driver, then the ST
attempts/retries to request for ldisc installation again.
based out of: OMAPS00246156

Change-Id: Ib1cd03ebd078bbbc2d93b68a37ba2ce1e7fa497e
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
drivers:misc: ti-st: flush UART upon fw failure

Upon failure to read firmware version from chip or upon failure in responses
to firmware download the UART needs to be flushed of its existing buffers so
that the UIM can restart UART properly.

Change-Id: I7eed959b80ead5dadc6ba4cccb8e6512e45fd047
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
drivers:misc: ti-st: DEBUG uart, baud rate mods

To debug different UARTs at different baud-rates connected to the WiLink
connectivity combo-chipset, this patch enables the debugging code so that upon
boot different UARTs at different baud-rates can be tried out to verify the
interface with WiLink.

Change-Id: Ib178e54c0e08b28e484efc60f330985da05ea0cc
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
OMAP: hsi_char: added new module author

Official request for being module author (maintainer) of hsi_char module.

Change-Id: I1adf9b64635d7b444b130ed08e14fda91cf3698b
Signed-off-by: Djamil Elaidi <d-elaidi@ti.com>
OMAP: HSI: set hsi_char default channel to ch 0

When hsi_char driver is loaded, it must be given 2 arguments :
 - port
 - channels_map
If they are ommited, channel 0 of port 1 is opened by default.

Change-Id: I618e8d9266179604cc4a9d3e091cb02b148aa7b5
Signed-off-by: Djamil Elaidi <d-elaidi@ti.com>
OMAP: xSI: auto create hsi_char devices during module registration

Previously, after hsi_char driver was registered, user still needed to retrieve
the major number & use
 mknod to create character file & register to sysfs.

This fix introduces :
* automatic udev class creation : hsi_char
* automatic device file creation for all channels passed in module parameter :
/dev/hsi0, /dev/hsi1, etc.

New hsi_char driver does not require usage of mknod anymore. Names are :
/dev/hsi0, /dev/hsi1, etc...
instead of /dev/hsi/0, /dev/hsi/1, etc...

Change-Id: I6e1894a1d5857aabbd1733e3e84d156a98ee1781
Signed-off-by: Wei-Bin Feng <w20088@motorola.com>
Signed-off-by: Djamil Elaidi <d-elaidi@ti.com>
OMAP4: HSI: fix FIFO flush API

APIs for flushing HSI RX and TX FIFOs were using the SSI method, which doesn't work for HSI because
HSI_HSR_RXSTATE_REG and HSI_HST_TXSTATE_REG are Read Only in HSI.

Now split the FIFO flush into HSI and SSI specific code.
* For HSI we simply need to read as many frames as there are in the FIFO.
  OK for RX, not possible for TX
* For SSI we clear the state machine. Warning : all FIFOs are flushed.
  OK for RX and TX

Once a FIFO is flushed, the corresponding RX or TX interrupt is acked.

Change-Id: I510f5c14496147634e4e1e9b299f00964da39401
Signed-off-by: Djamil Elaidi <d-elaidi@ti.com>
OMAP3+: xSI: Add FIFO flush after R/W cancel

When hsi_read_cancel is called, it simply cancels the DMA or acknowledge the RX interrupt.
But data in the FIFO remains present, which can cause next hsi_read to contain up to 8
garbage (old) frames (as FIFO size is 8 frames) in the beginning of the reception.

Same for TX side.

Change-Id: I946d05120815def27fe401677e24c37ca8a6532e
Signed-off-by: Djamil Elaidi <d-elaidi@ti.com>
OMAP4: HSI: fix checkpatch & build warnings

Change-Id: I3a21ff3214566010a9963e0f279cbd954685fcaa
Signed-off-by: Djamil Elaidi <d-elaidi@ti.com>

Conflicts:
	drivers/omap_hsi/hsi_driver.h
OMAP4: HSI: clean platform data access

Replaced direct access to dev->platform_data by usage of dev_get_platdata()

Change-Id: Ifd4c18d449f848f32ceca83b3ec4520f2eea2c83
Signed-off-by: Djamil Elaidi <d-elaidi@ti.com>