OMAP4: DSS: Fix to correct the manager index for VSYNC irq handler

Patch to fix the Manager id in dss_completion_irq_handler.
DSSCOMP is expecting the manager id 1 to be mapped to HDMI display.
This patch fixes the DSSCOMP_STATE_DISPLAYED callback in DSSCOMP.

Change-Id: I0aab3e494cb305d75a64fabc4cd6919def636285
Signed-off-by: Muralidhar Dixit <murali.dixit@ti.com>
Signed-off-by: Varadarajan Charulatha <charu@ti.com>
OMAP4: HDMI: Add delay after Wrapper reset for HDCP keys to be loaded correctly

After HDMI wrapper reset we are not waiting for suffecient time
for the HDCP keys to be loaded to HDMI_DESHDCP_KEYS memory. This is
sometimes causing in the first byte to be read as 0 and subsequently
results in error being returned due to invalid AKSV key.
We need to have a small delay for the memory to be populated with
HDCP keys before reading it after wrapper reset.

Change-Id: I51f032d31ae05eb9c21ca697cd6b7ac18cdd1c2a
Signed-off-by: Srinivas Pulukuru <srinivas.pulukuru@ti.com>
btwilink: avoid double freeing of recv skb

Upon error in hci_recv_frame, the HCI Core is freed before the error
is reported to btwilink. When the error does get to btwilink and forwarded
to ST core, ST core also attempts to free the skb.

Although the 2 frees of skb should theoritically cause any harm, this is
redundant and hence this patch returns 0 to ST core even upon error,
because there is no action to be taken.

Remove also the #define DEBUG which was used to debug the code.

Change-Id: I05f8c3a9d9795ac3e3e9916006630e809d27e33a
Signed-off-by: Manjunatha Halli <x0130808@ti.com>
Signed-off-by: Pavan Savoy <pavan_savoy@ti.com>
OMAP4: Clock: Force a DPLL clkdm/pwrdm ON before a relock

All DPLLs except USB are in ALWON powerdomain. Make sure the
clkdm/pwrdm for USB DPLL (l3init) is turned on before attempting
a DPLL relock. So, mark the database accordingly.

Without this fix, it was seen that DPLL relock fails while testing
relock in a loop of USB DPLL.

Change-Id: I52f621a2c83e3e0dc4f6c440291860b285854e12
Tested-by: Ameya Palande <ameya.palande@ti.com>
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
OMAP: dmtimer: Fix memory leak on dmtimer error

Change-Id: I858c24a21410f2c1c85b1b8b2c1fc4dc5d3c1e6d
Signed-off-by: Jared Suttles <jsuttles@motorola.com>
OMAP: dmtimer: Fix timer handling logic for non loses_context timers

The use of the enabled flag is currently tightly coupled with the
loses_context flag on the timer struct. This change makes the enabled
flag behave more sanely without consideration of the loses_context flag.

Change-Id: I9d33bb4cc3fd7917ad493adde75cf57cb240b106
Signed-off-by: Jared Suttles <jsuttles@motorola.com>
OMAP4: PM: work around for CPU1 onlining from OFF/OSWR state on older PPA

Originally detected in OMAP4430 ES2.3 HS samples, CPU1 crashes the
device upon calling PPA service DEFAULT_POR_NS_SMP(0x25).

Rootcause showed that cache maintenance operations required to be
performed before handing over control of CPU1 to HLOS, were incomplete
and not broadcasted from CPU0 to CPU1.

Kernel workaround for this is to use WFI to put CPU1 in OFF
state if CPU0 is not ready yet (this mechanism was in place in previous
versions of this code base but was meant to address a different need).
When putting CPU1 back to off, its internal MMU descriptors are reset
and sync'd with CPU0. CPU1 is brought online by later kernel subsystems.
Note: CPU0 power state is made to OFF for both OSWR and OFF modes.

This issue has been analysed to impact all OMAP4 non GP devices.

A config flag is introduced to allow platforms and distributions to
enable/disable if PPA version requirement is not met.

Change-Id: I82c5880ec2d9a98a54755dfbd01aa981cfed9852
[nm@ti.com, cileija@ti.com: improvements and rootcause support]
Signed-off-by: Carlos Leija <cileija@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com]
[wwang@ti.com: WA identification]
Signed-off-by: Wenbiao Wang <wwang@ti.com>
OMAP4: Correct Errata i684 WA

OMAP4470 not impacted of Errata i684.
Errata WA should not be applied for this CPU type.

Errata i684:
  Due to trimming program issue but also due to architecture limitation,
the LPDDR I/O and Smart I/O can not be trimmed correctly. The default
value in CONTROL_EFUSE_2 is not correct.

Workaround:
  For all units, the value of CONTROL_EFUSE_2 must be overwritten
with 0x00084000.

Change-Id: I7003d3097d3a8fdd3aa203513d1e9bf4582eee1d
Signed-off-by: Volodymyr Riazantsev <v.riazantsev@ti.com>
gccore: new core driver enhancements

new drop from vivante corp, which allows batching and four
source blending in one pass. this drop also contains some
code refactoring and other minor bug fixes and improvements.

reference:
https://github.com/hemanthariyani/omap-kernel/commits/4470

    gccore: fix mem allocation bug.
    1) use page_adress for grabbing virt addr
    2) add in logic to enable bb2d clock

    gccore: wakeup fixes.

    gccore: create generic flush functions
    create generic flush functions for user surfaces
    and pages.

    gccore: disable gccore driver by default.
    Relocate where bb2d clocks get enabled/disabled.

    gccore: disable logging by default.
    also, add additional debugging points.

    gccore: fix to address 2d mmu issues.
    testing of multiple large resolutions exposed some
    issues with the 2d mmu logic.

    gccore: fix some performance related issues.
    1) replaced polling logic with semaphore
    2) increased command buffer size
    3) fix bug in free pages logic

    gccore: added pipe select function to gccommit.
    gccore: increase command buffer size
    gccore: change registers from AQ to GC
    gccore: changes to surface logic
    gccore: replace semaphore with completion.
    Also, add timeout detection

    gccore: perform 2d cache ops during map/unmapping
    gccore: only init driver for omap4470

Change-Id: I06a05cc07eab7f76b05fb34d0a795686135d2805
Signed-off-by: David Sin <davidsin@ti.com>
gccore: disable core driver by default

at this point, we are not ready to have the driver on by default.
this will prevent incorrect system power measurement readings because
the gc320 clocks are always on when the driver is initialized.

Change-Id: Ic453fa21e72a87c64875d29afd66da1f76c838cf
Signed-off-by: David Sin <davidsin@ti.com>
GC: Initial Bltsville kernel implementation

Initial working Bltsville kernel implementation for the GC 2D core.

Note: This patch breaks the GC 2D bltsville library in user side.
Additional changes are needed to make it coexist with the kernel
bltsville implementation.

Change-Id: I68394b5fe05799a663b680c830d7ac83c8af1b26
Signed-off-by: Gustavo Diaz Prado <a0273371@ti.com>
rpmsg: omx: add return values to the pa to da convert function

This patch adds return values to the pa to da conversion function.
This will help in propagation of proper error codes to the calling
functions.

Change-Id: Ie547f7b7e7c51eff4b7998cbd336a61663995708
Signed-off-by: Subramaniam C.A <subramaniam.ca@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
rpmsg: omx: re-work buffer lookup to support contiguous NV12

SGX544 requires Y and UV to be contiguous in SGX virtual address space. This
is done by using single FD for two ion handles.

Change-Id: I33ced876905d74e6293a2c32df0612f01a23d13f
Signed-off-by: Hemant Hariyani <hemanthariyani@ti.com>
Signed-off-by: Subramaniam C.A <subramaniam.ca@ti.com>
rpmsg-omx: tiler_virt2phys called for 1D buffers

While migrating to the new PVR APIs, the changes caused
a the tiler_virt2phys to be bypassed in case it is not
a PVR buffer. This patches fixes the issue

Change-Id: I9a3353053d58a7bc0ef89012de46534fad5f4b88
Signed-off-by: Subramaniam C.A <subramaniam.ca@ti.com>
Signed-off-by: Tate Hornbeck <tate.hornbeck@ti.com>
omap4: control: Add the CONTROL_SMART2IO_PADCONF_2 register definition

This patch adds missing CONTROL_SMART2IO_PADCONF_2 register
definition

Change-Id: I9bec7e1e95e7b86ae6c5c4e0f457370c8db20e4a
Signed-off-by: Ruslan Bilovol <x0155540@ti.com>
ARM: OMAP4: Only wait for module ready for clocks enabled via MODULEMODE

Some clocks are enabled by programming the MODULEMODE bit field of the PRCM
CLKCTRL registers. For these clocks, we should wait for the module to
transition from the idle state when we enable them. For other clocks, such as
optional clocks, that are enabled via other bits in the CLKCTRL registers, the
idle state is not updated when we enable them and so we should not wait for
the idle state to change when we enable them. This is causing unnecessary
delays to occur when enabling optional clocks as we are waiting for the idle
state to change and eventually timeout.

Change-Id: Iaa8a86d38a55b4faa95988c48e4bac0e772c7492
Signed-off-by: Jon Hunter <jon-hunter@ti.com>
Signed-off-by: Huzefa Kankroliwala <huzefank@ti.com>
OMAP4430: OPP/voltage: 1.2GHz needs different SR ntarget

nTarget value for 1.2GHz uses the nTarget efuse offset meant
for 1GHz. This can cause instabilities since the voltage levels
are lower than required for operating at 1.2GHz.

Since SR nTarget values are hooked to omap_volt_data structure and
Vnom for 1.2GHz is same as 1GHz, we need to ensure a uniquely
identifiable voltage for 1.2GHz to supply the right offset.
We do this by adding a 10mV step on top of 1GHz Vnom. This
additional step should have no impact as SmartReflex AVS will
adjust this to optimal voltage on enabling SR from Vnom in operation.

With the unique voltage entry in omap_volt_data for 1.2GHz, we
provide the right efuse offset for 1.2GHz and map the OPP entry
for 1.2GHz to use this "OPPNITROSB" voltage. This will allow
voltage and SmartReflex AVS mapping back to the right nTarget
offsets + adjust voltage to the correct optimal voltage levels
for 1.2GHz.

Change-Id: I1e8d0efa46cfb5d6db1b54ef5fc323d0b7877fef
Signed-off-by: Taras Kondratiuk <taras@ti.com>
Signed-off-by: Eugen Mandrenko <ievgen.mandrenko@ti.com>
OMAPDSS: DSS: Complete callbacks on mgr->blank if not wait_for_go

Disabled panels do not clear GO automatically, therefore, we
assume no wait_for_go on disabled panels.

When not waiting for GO, complete all pending composition
callbacks regardless of dirty state, as dirty state will not
be propagated.

Change-Id: Ic5ddd81414bab56d136a716907fd8e6dfa0f795f
Signed-off-by: Lajos Molnar <lajos@ti.com>
OMAP4: PM: Fix L3INSTR/IVAHD save/restore context logic

The L3INSTR/IVAHD contexts are restored
when MPU is going through both OSWR and OFF states
on HS/EMU devices (not only OFF state).

Change-Id: I516a9e88932485f6d77c529602647f7199fa7212
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
OMAP: PM: Fix the build error when SmartReflex is not selected

Fix a build error when Smart Reflex is not selected in kernel
configuration.

Corrected the api definition in header to add the omap_volt_data to
omap_sr_enable in the else of the CONFIG_OMAP_SMARTREFLEX.

Change-Id: I552c9092afcf00a9ac6f45402a2f4414890f87fc
Signed-off-by: Mohan V <mohanv@ti.com>