drm: xilinx: dp: Return -ETIMEDOUT after waiting 2ms for aux reply

Return -ETIMEDOUT if there's no aux reply for 2ms.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drm: xilinx: dp: Replace spinlock with mutex for aux communication

Use mutex for aux communication synchronization. User thread and
the threaded interrupt context can call aux functions, and calling
thread may sleep and wait after acquiring the lock. This patch
replaces spinlock with mutex for such synchronization process.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drm: xilinx: dp: Replace udelay() with usleep_range()

Change the 1ms delay (udelay(1000)) to sleep (usleep_range(1000, 1100)),
since 1ms is too long to be a delay and there's no need to do busy wait.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drm: xilinx: dp: Use 'for' loop for PHY ready iteration

Simplify the PHY ready function using the 'for' loop. This also removes
the unneccessary wait when PHY is ready right away.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drm: xilinx: dp: Use DRM_ERROR() instead of dev_err()

Use DRM_ERROR() for errors after the drm encoder operation is attached.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drm: xilinx: dp: Add documentation for aux synchronization

Add documentation for aux communication synchronization. More function
description is added for xilinx_drm_dp_aux_cmd_submit(), and aux_lock
documentation is more detailed.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drm: xilinx: dp: Clean up the mutex

Clean up the mutex when error-exiting and when driver is removed.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>