rtc: alarm: Set power-on alarm 120 sec before actual alarm time

This will add extra buffer time for booting-up the device before
actual alarm expiration time.

Change-Id: I02cad84c394a6aab943fff37a1a0de56bb511f56
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
kernel: alarm: :fix the BUG that device automatically powers on

The value of alarm.time is invalid if we get it by:
    memset(&alarm, 0, sizeof(alarm)).
So function of rtc_set_alarm aborts before it really calls into:
    rtc->ops->set_alarm.
Then we can`t disable the RTC alarm by that. The result is some
alarms enabled by alarm_suspend are not disabled correctly during
alarm_resume. And device will automatically power on.

CRs-fixed: 524051
Change-Id: Ibc99e62878d17ad4f50325630bf0862207e2cf3f
Signed-off-by: Figo Wang <figow@codeaurora.org>
kernel: alarm: add dedicated alarm type for poweroff alarm

Now we use type of RTC_WAKEUP for the poweroff alarm.
Actually lots of other applications also use this type.
But these applications never expect the device will
power on after it has been shut down. So we need to
add dedicated alarm type for the Deskclock or similar
applications.

CRs-fixed: 529674
Change-Id: I9b7911906446daa1aeb5835478c9837f8ef797f2
Signed-off-by: Figo Wang <figow@codeaurora.org>
kernel: alarm: Do not call rtc_alarm_irq_enable in IRQ Disabled context

Currently shutdown hook of alarm driver is calling
the rtc_alarm_irq_enable API in interrupts disabled
context. So fix the alarm_shutdown function to call
in API rtc_alarm_irq_enable in interrupt enabled context.

CRs-Fixed: 591790
Change-Id: Iebd82482be1dc95c6c978b617e1c18eb36e1b6eb
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
arm: msm: add alarm reboot reason

Add alarm reboot reason for power off charging.

Change-Id: If94d0e4a7ec250cfaa61bf578cae9324db05d32c
Signed-off-by: Maria Yu <aiquny@codeaurora.org>
msm: sps: Enable the clocks when BAMDMA available

The dfab and bamdma clocks are used only by bamdma.
Move the clocks api under bamdma option.

Update local device node data with platform device
node data from probe to avoid clock failures.

Change-Id: I97bd107eed400a989f0638c958f6361330bc6091
Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
msm: Remove old unused sdio related code

Cleanup mach-msm by removing unused sdio related code.

Change-Id: I485deb7d6499771294b494f5542ba510c10255cb
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
msm: mdss: Returning NOTIFY_SUSPEND while polling NOTIFY_UPDATE

mdss_fb_update_notify does not return Suspend in NOTIFY_UPDATE
case. Daemon polls on NOTIFY_UPDATE but does not get Suspend
notification. Hence Daemon would not stop polling.

Suspend Case is added in UPDATE case.

Change-Id: Iaeaf819a6849acda2eb7eb78f0fc3306866d1b64
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
msm: mdss: Avoid variable overloading

A particular variable is overloaded and used in 2 different
contexts. This causes overwriting of original value and leads
to incorrect error handling. This code adds a new variable to
avoid such condition.

Change-Id: Ibd040e6b4ce95759cc0011304940365c70e6c12a
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
msm: mdss: restructure rotator code and add mutex for rotator api

The rotator data structure should be maintained in the rotator file
and rotator api calls should be following current ioctls, namely,
rotator_setup follows overlay_set, rotator_play follows overlay_play,
and rotator_unset follows overlay_unset. In this way, rotator code is
modulized and data is isolated easily by adding proper locking.

CRs-fixed: 563019
Change-Id: I3aa0db57d65cf9ae88c7e7cbccb3fa73a25e5902
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
msm: mdss: Fix mdss iommu detach-attach issue

Move iommu attach logic to rotator play and writeback
queue buffer from overlay_kickoff to make sure iommu is
enable before mapping any buffers.

Change-Id: I92eb3d4686c1641728980d057f2de6c0d324be71
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
msm: mdss: do proper error handling in case of rotator setup fail

When rotator setup fails, the session should only be finished internally
if it hasn't been reported to userspace. At the same time, need to
ensure that proper cleanup of rotator list is happening, through
internal release path.

Change-Id: I7a6f46261bf8783547de1c7f7fd6893916b25827
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: move rotator SMP reservation to rotator setup

Shared memory pool (SMP) blocks are limited, in some cases where there
are many overlay pipes used, we may not be able to get enough blocks for
rotator sessions. In such cases fall-back solution must be considered,
however for this to happen this would need to be identified during
rotator session setup. Move logic to do pipe resource reservation in
rotator setup if possible.

Change-Id: I223281fb51b81baf852cac415a8c61c0de35c2c4
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: Fix under run on interlace clip play in landscape

Rotator src rect y co-ordinate is getting odd after de-interlace
calculation but mdss expects even.

Change-Id: I124d059c89c51126208ad1de02a9d34d87b0f553
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
msm: mdss: Add commit handler to writeback display

Add support for a "vsync handler" for writeback displays to be able to
schedule tasks to be run as soon as the frame has completed.

Change-Id: I8c6945a6e914e307de67b2ec6df25f4509a50da7
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
Signed-off-by: Pravin Tamkhane <pravint@codeaurora.org>
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
msm: mdss: Call wait4comp after commit for wb intf

Writeback path uses the comp event allocated on
stack to wait for ISR done. It crashes if
ISR tries to set the comp event after kickoff
thread timeout. This change removes the comp
event usage for writeback interface and starts
to use the wait4comp API like video/command
mode interfaces.

CRs-fixed: 555036
Change-Id: I74994a0cbe4039c6d3d4a51d573d343751182bff
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
msm: mdss:  Set rotator output format as pseudo planar 420

Set rotator output format for planar 420 as pseudo planar 420.
Configure BWC output format as MDP_Y_CRCB_H2V2 when
input color format is MDP_Y_CBCR_H2V2.

CRs-Fixed: 549326 552372 552375
Change-Id: I9c39ab3d8a867909853ffd6ecc2120ab160914d1
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
video: mdss: Clean up rotator merge

Change-Id: I1195281c0e8cf5f2be5fcd9232c2e68dfc6ad63f