gpio/omap: skip redundant operations in runtime callbacks

Most operations within runtime callbacks are associated with
preparing the GPIO Banks for generating wakeup events before
going to off-mode in *_runtime_suspend() and then restoring
the contexts in the *_runtime_resume(). Since GPIO Bank#0
is in WKUP power domain these operations are redundant so
far as Bank#0 gpio pins are concerned. The only valid
operation is to disable debounce clock in *_runtime_suspend()
and enable debounce clock in *_runtime_resume().

Also, added a warning in probe() if get_context_loss_count()
is NULL.

Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com>
gpio/omap: remove loses_context check in prepare_for_idle/resume_after_idle

This check prevents pm_runtime_put/get* calls in the idle path
for GPIO Bank#0. This means _gpio_dbck_disable/enable() which
are present in the runtime callbacks would never get called
for all gpio pins which are in Bank#0 (WKUP Power Domain).
As a result Bank#0 would not idle if any of the pins in this
bank are used. Hence, remove this check from *_prepare_for_idle()
and *_resume_after_idle().

Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com>
gpio/omap: free irq domain in probe() failure paths

Currently the IRQ domain is not freed once allocated in the case
omap_gpio_probe() fails. Therefore, ensure we free the domain if probe
does fail. Furthermore, the local variable "ret" is not needed and so
remove this.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>
gpio/omap: remove extra context restores in *_runtime_resume()

68942edb09f69b6e09522d1d346665eb3aadde49 (gpio/omap: fix wakeups
on level-triggered GPIOs) already restores the fallingdetect and
risingdetect contexts in *_runtime_resume(). These registers were
modified in *_runtime_suspend() to include even those configured
as level-triggered since only edge-triggered gpios can generate
wakeup events. Therefore, the old context restores of the same
registers present later in the code is not needed any more.
Remove them.

Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@ti.com>
Signed-off-by: Jon Hunter <jon-hunter@ti.com>
gpio/omap: Optimise interrupt service routine

The OMAP GPIO interrupt service routine is checking each bit in the
GPIO interrupt status register to see which bits are set. It is not
efficient to check every bit especially if only a few bits are set.
Therefore, instead of checking every bit use the __ffs() function,
which returns the location of the first set bit, to find all the set
bits.

This optimisation was suggested-by and developed in collaboration
with Felipe Balbi.

Signed-off-by: Jon Hunter <jon-hunter@ti.com>