video: add sii9234 MHL bridge driver

Change-Id: I5c37eae0475e42078db462f5ed568e4cad02f871
Signed-off-by: Erik Gilling <konkers@android.com>
video: MHL: enable charging with MHL dongle

Enable charging when the MHL dongle detection is established.

Change-Id: Ie498327f0a88502902ef87127cba36e188d44381
Signed-off-by: hs46.jeong <hs46.jeong@samsung.com>
video: sii9234: change vbus state on powerdown only if claimed

Change-Id: I329e3b73ad5b9f78e5ae1b187043a4028385455d
Signed-off-by: Dima Zavin <dima@android.com>
video: mhl: fix interrupt disable imbalance

This change prevents the sii9234 from disabling the interrupt
twice if the RSEN loss interrupt occurs and the discovery
process exits for another.

Change-Id: Ib31412a3b5d1b18a3142c131a882af276f170f86
Signed-off-by: Adam Hampson <ahampson@sta.samsung.com>
video: mhl: check state or rgnd when timeout occurs

Change-Id: I5ffc70269ffec1900632a6e7d84d7aff8e29cde4
Signed-off-by: Adam Hampson <ahampson@sta.samsung.com>
video: mhl: add RSEN check to MHL discovery

This change a check to wait for RSEN to go high before concluding
the discovery process.

Change-Id: If46e3a0fe91d34c5277a1610a8663137d6c92bb3
Signed-off-by: Adam Hampson <ahampson@sta.samsung.com>
video: sii9234: add msc/cbus support and read devcap

Change-Id: Ic739fa5340f190f663c0e4dc18a3fd005de12522
Signed-off-by: Erik Gilling <konkers@android.com>
video: sii9234: report devcap registers to platform callback on connect

Change-Id: I3ef618c8a19cf8f456558c369d1b8b00f69f78b8
Signed-off-by: Erik Gilling <konkers@android.com>
video: sii9234: fix race condition on devcap reading

If the remote MHL device was unplugged while we were trying to read the devcap
registers, we'd get stuck in the connected state.

Change-Id: Idc8b08af6da4902e20c54cfa3bf52a361fabeb99
Signed-off-by: Erik Gilling <konkers@android.com>
video: sii9234: fix devcap error handling

Change-Id: Ie4407eef9a370c8fda464f6f587877a9e99712fc
Signed-off-by: Erik Gilling <konkers@android.com>
Add {first_,second_}data params to sii9234_msc_req_locked()

Some msc requests need these fields; decide whether they're actually used
based on the request type

Change-Id: I3f6ec5e6affe55cc781615cce90ddd2a7f373db6
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Create sii9234 rcp input device

Change-Id: I35353c044c8b9ba0fa8d7b7e9c3a00326e4b25e6
Signed-off-by: Greg Hackmann <ghackmann@google.com>
Handle rcp keys

RCP keys get put on a list and serviced by a work queue

Change-Id: Ie7186029413ebfe949cd7f7b0accb2049d9611e0
Signed-off-by: Greg Hackmann <ghackmann@google.com>
drivers: mhl: Add routines for cbus error interrupts

MHL driver only warns when it gets cbus error interrupts
(e.g, ddc abort,response abort or request abort error).

Adding routines to handle these error interrupts in
more appropriate way.

Change-Id: Id38b110491392b1d59b3570c82a62bf2009d4dd7
Signed-off-by: Dharam Kumar <dharam.kr@samsung.com>
drivers: mhl: support additional cbus commands

- Added CBUS interrupt & status register offsets(used by CBUS
  commands). Refer Table 18 in PRM or Table 7-20 in MHL Specs 1.1

- list of cbus commands[MHL Specs 1.1, Table 7.3]

- modified existing sii9234_msc_event function to perform SET_INT,
  WRITE_STAT, READ_DEVCAP etc.

Change-Id: If116484294630b45c5aa513f7381b5219dace889
Signed-off-by: Dharam Kumar <dharam.kr@samsung.com>
drivers: mhl: add link_mode flag and handle PATH_EN changes

Please refer MHL 1.1 specs[section 7.8.3.2].

What this patch does:
"On detection of the Sink writing PATH_EN{SINK} = 1,Source
should write PATH_EN{SOURCE} = 1. On detection of the Sink
writing PATH_EN{SINK} = 0, the source shall write PATH_EN{SOURCE} = 0."

TODO:
"Source may only enable its TMDS output after the sink writes PATH_EN{SINK} = 1
and shall disable its TMDS output after the sink writes PATH_EN{SINK} = 0".
Currently, we are not disabling the TMDS output on the basis of
PATH_EN{SINK} changes.

Change-Id: I5f03de6d721485fc7ed443328c8e5714099e3e18
Signed-off-by: Dharam Kumar <dharam.kr@samsung.com>
drivers: mhl: handling glitch in RSEN

As per MHL specs 1.1, Source should be able to
handle glitch in RSEN signal.

Hence,when we see RSEN as low,we are sleeping for
DEGLITCH time period, If RSEN stays low even after
DEGLITCH time, then disconnection routines should be called.

Change-Id: Id8624d41cb60cc3a192581930ca322ad87fb14fd
Signed-off-by: Dharam Kumar <dharam.kr@samsung.com>
drivers: mhl: retry detection if discovery process fails

"On failed completion of the wake sequence and discovery pulse
process, a Source should reattempt discovery by re-checking
impedance for proper CBUS discovery and then preceding through
the states to retry the discovery pulse process.

This loop of states should be repeated - reattempting discovery
using wake and discovery pulse sequences - multiple times
for as long as the Source requirement for discovery persists."
[MHL Specs 1.1 , Notes on Table 8-4]

Change-Id: Icfb5b9783e91a784d67b3f44f4c9b5135604356a
Signed-off-by: Dharam Kumar <dharam.kr@samsung.com>
sii9234: delegate all devcap reads to msc helper thread

Detection callback now schedules an artificial DEVCAP_READ event instead
of directly issuing devcap read.  Prevents deadlock when detection
callback tries to read devcap while msc helper is servicing requests.

Change-Id: If82cde6be89ffc550ecd22d5cd17981835fc9d05
Signed-off-by: Greg Hackmann <ghackmann@google.com>
sii9234: bypass own OTG notification when disconnecting

Otherwise immediate re-detection is attempted, which can lead to (real) reconnection events being missed

Change-Id: I9087a51220a621c2bc692d532f0281159c4aac53
Signed-off-by: Greg Hackmann <ghackmann@google.com>