ARM: OMAP4: PM: Handle LPDDR CLK IO errata during suspend/idle

There is a HW bug in CMD PHY which gives ISO signals as same for both
PADn and PADp on differential IO pad, because of which IO leaks higher
as pull controls are differential internally and pull value does not
match A value. Though there is no functionality impact due to this bug,
it is seen that by disabling the pulls there is a savings ~500uA in
OSWR, but draws ~300uA more during OFF mode.

To save power during both idle/suspend following approach taken:
1) Enable WA during boot-up.
2) Disable WA while attempting suspend and enable during resume.

TI EID: i736; IMPACTED: all OMAP4

Change-Id: Ie361446ed4d70ec4183f916fba880ab4049ba28f
Reported-by: Logan Lee <hklee@ti.com>
Signed-off-by: Shashi Shekar B.S. <shashi.shekar@ti.com>
Signed-off-by: Ambresh K <ambresh@ti.com>
[grygorii.strashko@ti.com - Forward port from K3.0]
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com
ASoC: twl6040: Reduce i2c writes during power mode change

Replace direct i2c writes to TWL6040 by calls to snd_soc_update_bits()
which prevents unnecessary i2c writes when reg cache and hardware are
in sync.

Change-Id: I8bb02d83fb419a478707d33498a95efa6e98a45c
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>

Conflicts:
	sound/soc/codecs/twl6040.c
ASoC: twl6040: SW WA for DC Offset On EAR Differential Output

Correct Sequencing To Ensure No DC offset On EAR Outputs.
Fix the pops on switches between HF to EP

Change-Id: I497f8d6a2c2662406720a28e7906c5e58917fb24
Signed-off-by: Pierre Moos <p-moos@ti.com>
Signed-off-by: Francois Mazard <f-mazard@ti.com>

Conflicts:
	sound/soc/codecs/twl6040.c

Conflicts:
	sound/soc/codecs/twl6040.c
ASoC: twl6040: Fix HS DACs DC offset errata

Current implementation of HSDACs DC offset errata disables DACR when
headset and earpiece outputs are used simultaneously. A simpler approach
is used:

- Headset DAC Left:
  o HSDACR must be enabled before enabling HSDACL, since HSDACL reset is
    done when HSDACR is enabled
  o No additional handling required for power-down

- Headset DAC Right:
  o No special handling required for power-up
  o HSDACR reset is done when HSDACL is enabled, so in case DACL was
    already disabled, re-enabled it momentarily while HSDACR power-down
    occurs.

Change-Id: I20f29602268d701b64c10dfa86cc43f66b8325b0
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
ASoC: twl6040: Use HS DC offset errata for TWL6041 ES2.0

Headset DC offset errata also applies for TWL6041 ES2.0.

Change-Id: Ia1c6f837507d146d137fd62e3e500ad427cad233
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
ASoC: twl6040: Split HF DAC event handler

Use a dedicated event handler for HS DAC widgets whose only task is
wait for the settling time of at least 80us.

Change-Id: I2f13051fdc02466c184cf2ee9ed5653b75644023
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>

Conflicts:
	sound/soc/codecs/twl6040.c
ASoC: twl6040: Reorder HSDAC/DRV power mode change

HSDAC and HSDRV power mode change cannot be performed when the
corresponding DAC is enabled, which is now explicitly rejected.
This constraint has an important impact on eapiece path, since
it can work only in high-performance mode.

In such case, we need to force the power mode before enabling
the DACs and restore previous mode after DACs have been disabled.
That sequence cannot be achieved if the event is associated with
a switch widget, so using a supply widget instead.

Change-Id: I3bddf3dc6fc038c78f83f1eb6f21f578c80cfee2
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>

Conflicts:
	sound/soc/codecs/twl6040.c