Skip to content
Commit 14348a5c authored by Nick Hollinghurst's avatar Nick Hollinghurst
Browse files

RP1 DSI -> CSI-2 loopback test drivers: First version



First rather messy version using a mixture of module parameters
and sysfs files via global variables! TODO: Tidy and use debugfs?

These drivers allow short strings to be sent from RP1's MIPI DSI
on VC=0 DT=0x29 with configurable bit-rate and number of lanes;
and for the same to be received by CSI-2 and placed in a buffer.

The test drivers do not use DRM, V4L2 or the ISP-FE. They have
different compatible strings from the "real" drivers and can
rub shoulders with them, provided both are not enabled at once.
The test drivers must be enabled by DTS, which also determines
direction (currently MIPI0 DSI transmit -> MIPI1 CSI-2 receive).

A small change is made in "rp1_dsi_dsi.c" (shared with the real
DSI driver) to enable HS commands; which should not break any
existing (incomplete) functionality, but future changes in
this area are anticipated and may cause merge issues.

Based on my dsi-clocks-v3 branch as it needs changes from there
(on top of the previous change to delay clock startup).

Example DSI -> CSI-2 loopbcak test script (run as root):

#!/bin/bash
anyfail=0
for nl in 2 4; do
  for mbps in 80 320 1200 1500; do
    string="DSI to CSI-2 loopback test, ${nl} lanes x ${mbps} Mbps"
    echo $string
    echo $mbps >/sys/module/rp1_csi_test/parameters/mbps
    echo $mbps >/sys/module/rp1_dsi_test/parameters/mbps
    echo $nl   >/sys/module/rp1_csi_test/parameters/num_lanes
    echo $nl   >/sys/module/rp1_dsi_test/parameters/num_lanes
    echo -ne '\0' >/sys/kernel/rp1_dsi_test/rp1_dsi_test   # stop DSI
    cat /sys/kernel/rp1_dsi_test/rp1_dsi_test >/dev/null   # sync
    echo -ne '\0' >/sys/kernel/rp1_csi_test/rp1_csi_test   # restart CSI-2
    cat /sys/kernel/rp1_csi_test/rp1_csi_test >/dev/null   # sync
    echo -n $string >/sys/kernel/rp1_dsi_test/rp1_dsi_test # start and send DSI
    cat /sys/kernel/rp1_dsi_test/rp1_dsi_test >/dev/null   # sync
    sleep 0.05                                             # wait for arrival
    if ! grep -q "${string}" /sys/kernel/rp1_csi_test/rp1_csi_test; then
      echo FAILED FOR $nl $mbps
      anyfail=`expr ${anyfail} + 1`
    fi
  done
done
if [ $anyfail -eq 0 ]; then
  echo SUCCESS
else
  echo FAILURES: $anyfail
  exit 1
fi

Signed-off-by: default avatarNick Hollinghurst <nick.hollinghurst@raspberrypi.com>
parent 78a686d4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment