msm: mdss: cancel AD calc work and destroy workqueue at power off

The queued work for an iteration of pp_ad_calc_worker might run
post the final fb release call. This can cause NULL pointer
dereferences. Now cancelling the pending AD calc work and
destroying the workqueue upon shutdown call to prevent any
such scenarios.

The vsync handler would continue to work until a call for
POWERDOWN arrives from userspace post shutdown notification.
So vsync handler might continue to queue work regardless of
existence of AD workqueue. Preventing this by checking the
ad state to see if shutdown has been set. If shutdown is set
then we do not queue AD calc work. The shutdown mask will be
set in state during a call to fb shutdown.

Change-Id: I10b6f3001b49b010eb4ca52d3b0dc03b2f7c190c
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
Signed-off-by: Justin Philip <jphili@codeaurora.org>
3 files changed