Re: [PATCHv2 6/7] cec-pin-error-inj.rst: document CEC Pin Error Injection
> > I'll wait for a v3 with the debugfs ABI documentation in order to merge > > it. Feel free to put it on a separate patch. > > debugfs ABI? Sounds like an oxymoron to me. Heh, thought the same :) signature.asc Description: PGP signature
Re: [PATCHv2 6/7] cec-pin-error-inj.rst: document CEC Pin Error Injection
On Wed, 21 Mar 2018, Mauro Carvalho Chehab wrote: > Please notice that all debugfs/sysfs entries should *also* be > documented at the standard way, e. g. by adding the corresponding > documentation at Documentation/ABI. > > Please see Documentation/ABI/README. > > Additionally, there are a few minor nitpicks on this patch. > See below. > > The remaining patches looked ok on my eyes. > > I'll wait for a v3 with the debugfs ABI documentation in order to merge > it. Feel free to put it on a separate patch. debugfs ABI? Sounds like an oxymoron to me. BR, Jani. -- Jani Nikula, Intel Open Source Technology Center
Re: [PATCHv2 6/7] cec-pin-error-inj.rst: document CEC Pin Error Injection
Em Mon, 5 Mar 2018 14:51:38 +0100 Hans Verkuil escreveu: > From: Hans Verkuil > > The CEC Pin framework adds support for Error Injection. > > Document all the error injections commands and how to use it. Please notice that all debugfs/sysfs entries should *also* be documented at the standard way, e. g. by adding the corresponding documentation at Documentation/ABI. Please see Documentation/ABI/README. Additionally, there are a few minor nitpicks on this patch. See below. The remaining patches looked ok on my eyes. I'll wait for a v3 with the debugfs ABI documentation in order to merge it. Feel free to put it on a separate patch. Regards, Mauro > > Signed-off-by: Hans Verkuil > --- > .../media/cec-drivers/cec-pin-error-inj.rst| 322 > + > Documentation/media/cec-drivers/index.rst | 1 + > MAINTAINERS| 1 + > 3 files changed, 324 insertions(+) > create mode 100644 Documentation/media/cec-drivers/cec-pin-error-inj.rst > > diff --git a/Documentation/media/cec-drivers/cec-pin-error-inj.rst > b/Documentation/media/cec-drivers/cec-pin-error-inj.rst > new file mode 100644 > index ..21bda831d3fb > --- /dev/null > +++ b/Documentation/media/cec-drivers/cec-pin-error-inj.rst > @@ -0,0 +1,322 @@ > +CEC Pin Framework Error Injection > += > + > +The CEC Pin Framework is a core CEC framework for CEC hardware that only > +has low-level support for the CEC bus. Most hardware today will have > +high-level CEC support where the hardware deals with driving the CEC bus, > +but some older devices aren't that fancy. However, this framework also > +allows you to connect the CEC pin to a GPIO on e.g. a Raspberry Pi and > +you can become an instant CEC adapter. > + > +What makes doing this so interesting is that since we have full control > +over the bus it is easy to support error injection. This is ideal to > +test how well CEC adapters can handle error conditions. > + > +Currently only the cec-gpio driver (when the CEC line is directly > +connected to a pull-up GPIO line) and the AllWinner A10/A20 drm driver > +support this framework. > + > +If ``CONFIG_CEC_PIN_ERROR_INJ`` is enabled, then error injection is available > +through debugfs. Specifically, in ``/sys/kernel/debug/cec/cecX/`` there is > +now an ``error-inj`` file. > + > +With ``cat error-inj`` you can see both the possible commands and the current > +error injection status: > + > +.. code-block:: none It is usually better to use "::" instead of ".. code-block". > + > + $ cat /sys/kernel/debug/cec/cec0/error-inj > + # Clear error injections: > + # clear clear all rx and tx error injections > + # rx-clear clear all rx error injections > + # tx-clear clear all tx error injections > + #clear clear all rx and tx error injections for > + #rx-clear clear all rx error injections for > + #tx-clear clear all tx error injections for > + # > + # RX error injection: > + # [,] rx-nack NACK the message instead of > sending an ACK > + # [,] rx-low-driveforce a low-drive condition at > this bit position > + # [,] rx-add-byte add a spurious byte to the > received CEC message > + # [,] rx-remove-byte remove the last byte from the > received CEC message > + # [,] rx-arb-lostgenerate a POLL message to > trigger an arbitration lost > + # > + # TX error injection settings: > + # tx-ignore-nack-until-eom ignore early NACKs until EOM > + # tx-custom-low-usecs define the 'low' time for the > custom pulse > + # tx-custom-high-usecsdefine the 'high' time for the > custom pulse > + # tx-custom-pulsetransmit the custom pulse once > the bus is idle > + # > + # TX error injection: > + # [,] tx-no-eomdon't set the EOM bit > + # [,] tx-early-eom set the EOM bit one byte too soon > + # [,] tx-add-bytesappend (1-255) spurious > bytes to the message > + # [,] tx-remove-byte drop the last byte from the > message > + # [,] tx-short-bitmake this bit shorter than > allowed > + # [,] tx-long-bit make this bit longer than allowed > + # [,] tx-custom-bit send the custom pulse instead of > this bit > + # [,] tx-short-start send a start pulse that's too > short > + # [,] tx-long-startsend a start pulse that's too > long > + # [,] tx-custom-start send the custom pulse instead of > the start pulse > + # [,] tx-last-bit stop sending after this bit > + # [,] tx-low-driveforce a low-drive condition at > this bit position > + # > + #CEC message opcode (0-255) or 'any' > + # 'once' (default), 'always', 'toggle' or 'off' > + # CEC message bit (0-159) > +
[PATCHv2 6/7] cec-pin-error-inj.rst: document CEC Pin Error Injection
From: Hans Verkuil The CEC Pin framework adds support for Error Injection. Document all the error injections commands and how to use it. Signed-off-by: Hans Verkuil --- .../media/cec-drivers/cec-pin-error-inj.rst| 322 + Documentation/media/cec-drivers/index.rst | 1 + MAINTAINERS| 1 + 3 files changed, 324 insertions(+) create mode 100644 Documentation/media/cec-drivers/cec-pin-error-inj.rst diff --git a/Documentation/media/cec-drivers/cec-pin-error-inj.rst b/Documentation/media/cec-drivers/cec-pin-error-inj.rst new file mode 100644 index ..21bda831d3fb --- /dev/null +++ b/Documentation/media/cec-drivers/cec-pin-error-inj.rst @@ -0,0 +1,322 @@ +CEC Pin Framework Error Injection += + +The CEC Pin Framework is a core CEC framework for CEC hardware that only +has low-level support for the CEC bus. Most hardware today will have +high-level CEC support where the hardware deals with driving the CEC bus, +but some older devices aren't that fancy. However, this framework also +allows you to connect the CEC pin to a GPIO on e.g. a Raspberry Pi and +you can become an instant CEC adapter. + +What makes doing this so interesting is that since we have full control +over the bus it is easy to support error injection. This is ideal to +test how well CEC adapters can handle error conditions. + +Currently only the cec-gpio driver (when the CEC line is directly +connected to a pull-up GPIO line) and the AllWinner A10/A20 drm driver +support this framework. + +If ``CONFIG_CEC_PIN_ERROR_INJ`` is enabled, then error injection is available +through debugfs. Specifically, in ``/sys/kernel/debug/cec/cecX/`` there is +now an ``error-inj`` file. + +With ``cat error-inj`` you can see both the possible commands and the current +error injection status: + +.. code-block:: none + + $ cat /sys/kernel/debug/cec/cec0/error-inj + # Clear error injections: + # clear clear all rx and tx error injections + # rx-clear clear all rx error injections + # tx-clear clear all tx error injections + #clear clear all rx and tx error injections for + #rx-clear clear all rx error injections for + #tx-clear clear all tx error injections for + # + # RX error injection: + # [,] rx-nack NACK the message instead of sending an ACK + # [,] rx-low-driveforce a low-drive condition at this bit position + # [,] rx-add-byte add a spurious byte to the received CEC message + # [,] rx-remove-byte remove the last byte from the received CEC message + # [,] rx-arb-lostgenerate a POLL message to trigger an arbitration lost + # + # TX error injection settings: + # tx-ignore-nack-until-eom ignore early NACKs until EOM + # tx-custom-low-usecs define the 'low' time for the custom pulse + # tx-custom-high-usecsdefine the 'high' time for the custom pulse + # tx-custom-pulsetransmit the custom pulse once the bus is idle + # + # TX error injection: + # [,] tx-no-eomdon't set the EOM bit + # [,] tx-early-eom set the EOM bit one byte too soon + # [,] tx-add-bytesappend (1-255) spurious bytes to the message + # [,] tx-remove-byte drop the last byte from the message + # [,] tx-short-bitmake this bit shorter than allowed + # [,] tx-long-bit make this bit longer than allowed + # [,] tx-custom-bit send the custom pulse instead of this bit + # [,] tx-short-start send a start pulse that's too short + # [,] tx-long-startsend a start pulse that's too long + # [,] tx-custom-start send the custom pulse instead of the start pulse + # [,] tx-last-bit stop sending after this bit + # [,] tx-low-driveforce a low-drive condition at this bit position + # + #CEC message opcode (0-255) or 'any' + # 'once' (default), 'always', 'toggle' or 'off' + # CEC message bit (0-159) + #10 bits per 'byte': bits 0-7: data, bit 8: EOM, bit 9: ACK + # CEC poll message used to test arbitration lost (0x00-0xff, default 0x0f) + # microseconds (0-1000, default 1000) + + clear + +You can write error injection commands to ``error-inj`` using ``echo 'cmd' >error-inj`` +or ``cat cmd.txt >error-inj``. The ``cat error-inj`` output contains the current +error commands. You can save the output to a file and use it as an input to +``error-inj`` later. + +Basic Syntax + + +Leading spaces/tabs are ignored. If the next character is a ``#`` or the end of the +line was reached, then the whole line is ignored. Otherwise a command is expected