qup_i2c: Add runtime PM support to I2C QUP controller

Runtime PM is used to turn clocks on and off when the
controller is not in use. When the controller is used
for messaging, pm_runtime_get_sync is called before
sending the message. pm_runtime_mark_last_busy and
pm_runtime_put_autosuspend are called when message
is sent and/or response is received.

Change-Id: Icb1d6e6ad222663c9a3598da10bdc154845083a0
CRs-Fixed: 406910
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
Signed-off-by: Manish Kumar <manishku@codeaurora.org>

Conflicts:
	drivers/i2c/busses/i2c-qup.c
qup_i2c: Manage gpio configuration from runtime pm.

Due to gpio_request and gpio_free calls are made from
multiple places in i2c driver code and can cause erroneous
condition where same gpios are assigned/freed multiple times.

Move the gpio reques/free calls under runtime pm to
manage better.

CRs-Fixed: 432971
Change-Id: Ic44202e0743fa56806a0612243d3b800bad1433f
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
Signed-off-by: Manish Kumar <manishku@codeaurora.org>

Conflicts:
	drivers/i2c/busses/i2c-qup.c
qup_i2c: Avoid potential panic issue

I2c register access is happening in isr before check
PM runtime status. This can lead to potential hang because of
unwanted interrupts and i2c clocks are off.

Update the i2c driver code to have register access
after PM runtime status check.

CRs-Fixed: 454710
Change-Id: I11a3d8df24c514205203f24be8e08d7c1ea1a7b8
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
qup_i2c: Update clock ready check condition

While doing i2c transfer that involved write and
immediate read, the driver will put the controller
to RESET and do an immediate read before the write completes.
This issue is hard to produce internally because clock stretch
from slave device is involved during the failure time. CLK
state in QUP status register will be FORCED_LOW_STATE.

O/p fifo empty check added to determine clock idle.

CRs-Fixed: 455743
Change-Id: I51c1d9f9de42381fc85710e9185aa4177f6cd302
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
qup_i2c: Use separate variables to store i2c gpios settings

In i2c bus recovery function GPIO settings for both
SCL and SDA are stored in one variable in this order
before writing recovery settings.
So, SCL setting is overwritten with SDA setting.
And when saved gpios settings write it back after
recovery, the setting for SDA is written both on SCL and SDA.
It means the setting of SCL is broken.

Use separate instances of variables to store GPIO settings
of SDA and SCL separately

CRs-Fixed: 447585
Change-Id: I7014a5b12d4c7ef41fd28c543834d45c619695a9
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
i2c-qup: adjustments.