43
Supporting Video (de)serializers in Linux: Challenges and Works in Progress Luca Ceresoli — AIM Sportline [email protected] https://lucaceresoli.net Embedded Linux Conference Europe 2019

)serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline [email protected] https: ... • Some have remote UART,

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

Page 1: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Supporting Video (de)serializers in Linux:Challenges and Works in Progress

Luca Ceresoli — AIM [email protected]://lucaceresoli.netEmbedded Linux Conference Europe 2019

Page 2: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

About me

• Embedded Linux engineerat AIM Sportlinewww.aim-sportline.com

• Develop products on customhardware

• Kernel, drivers, bootloader, FPGA• Integration, build system

• Open source enthusiast• Contributor to the Linux kernel,

U-Boot, Buildroot and others

1

Page 3: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Contents

1 Video serdes chips

2 Linux support

3 Troubles and tribulations

4 Way out

5 Remote I2C

6 Conclusions

2

Page 4: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Video serdes chips

Page 5: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Serializer/deserializers chipset

ImageSensor

SoC

Video (MIPI, LVDS, parallel)

Control (I2C, GPIOs)

ImageSensor

SoC SerializerDeserializerFast,robustlink

3

Page 6: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Serializer/deserializers chipset

ImageSensor

SoC

Video (MIPI, LVDS, parallel)

Control (I2C, GPIOs)

ImageSensor

SoC SerializerDeserializerFast,robustlink

3

Page 7: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Typical application

• Typical use: automotive• Autonomous driving (ADAS) cameras• Rear camera• Infotainment display

• SoC-centric• Cameras/displays model well known in advance• Cameras/displays always connected• High electrical noise

4

Page 8: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

My application

• Action camera• Base module (SoC, processing, storage)• Two hot-plug camera modules

• Interchangeable• While recording from the other module• Possibly with a different model

5

Page 9: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Available serdes chips

• Main competitors• Texas Instruments FPD-Link

• Maxim GMSL

• Camera or display• Video bus: MIPI CSI-2, Sub-LVDS, parallel• Robust link in high electrical noise environment• 1 to 4 inputs per serializer• Most have remote I2C, GPIO• Some have remote UART, audio

6

Page 10: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Texas Instruments DS90UB954 and DS90UB953

DS90UB953Serializer

DS90UB954Deserializer

FPD-Link III

DS90UB953SerializerFPD-Link III

CSI-2

CLK

I2C

4x GPIO

CSI-2

CLK

I2C

4x GPIO

CSI-2CLKI2C

7x GPIO,IRQ

7

Page 11: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Linux support

Page 12: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Existing patches

[PATCH v4 0/4] MAX9286 GMSL Support

• By Kieran Bingham, Laurent Pinchart, Jacopo Mondi, Niklas Söderlund• For Maxim GMSL chips• See also the ALS 2018 talk slides

[PATCH 0/7] mfd/pinctrl: add initial support of TI DS90Ux9xx ICs

• By Vladimir Zapolskiy• For TI DS90Ux9xx chips• See also the ALS 2018 talk slides

[RFC,v2 0/6] TI camera serdes and I2C address translation

• By Luca Ceresoli• For TI DS90Ux9xx chips• See also: this talk :)

8

Page 13: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Existing patches

[PATCH v4 0/4] MAX9286 GMSL Support

• By Kieran Bingham, Laurent Pinchart, Jacopo Mondi, Niklas Söderlund• For Maxim GMSL chips• See also the ALS 2018 talk slides

[PATCH 0/7] mfd/pinctrl: add initial support of TI DS90Ux9xx ICs

• By Vladimir Zapolskiy• For TI DS90Ux9xx chips• See also the ALS 2018 talk slides

[RFC,v2 0/6] TI camera serdes and I2C address translation

• By Luca Ceresoli• For TI DS90Ux9xx chips• See also: this talk :)

8

Page 14: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Existing patches

[PATCH v4 0/4] MAX9286 GMSL Support

• By Kieran Bingham, Laurent Pinchart, Jacopo Mondi, Niklas Söderlund• For Maxim GMSL chips• See also the ALS 2018 talk slides

[PATCH 0/7] mfd/pinctrl: add initial support of TI DS90Ux9xx ICs

• By Vladimir Zapolskiy• For TI DS90Ux9xx chips• See also the ALS 2018 talk slides

[RFC,v2 0/6] TI camera serdes and I2C address translation

• By Luca Ceresoli• For TI DS90Ux9xx chips• See also: this talk :) 8

Page 15: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Ideal implementation

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

9

Page 16: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Ideal implementation

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

9

Page 17: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Ideal implementation

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

9

Page 18: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Ideal implementation

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

9

Page 19: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Ideal implementation

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

9

Page 20: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Ideal implementation

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

DESSoC SERImageSensor

I2Cadapter

GPIOchip

ID

9

Page 21: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Ideal implementation

• Similar to BBB capes, RPi hats, but hot-plug• I2C EEPROM on each camera (fixed slave address)• When a camera is connected

1. Add serializer, I2C adapter, GPIO chip2. Add I2C EEPROM, read model ID3. Insert model-specific device tree overlay4. DTO adds sensor and other remote devices

• On disconnection, remove overlay

10

Page 22: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Troubles and tribulations

Page 23: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

V4L2 troubles

The ideal pipeline →

1. Stream multiplexing: no support in mainline yet2. Reliability: pipe should work with some nodes disabled

• A sensor goes faulty3. Dynamic pipe: remove some nodes, add different ones

• A sensor is removed, a different model added

sensor0

0

0

ser0 1-003d

1

0 1

des 0-0030

2

sensor1

0

0

ser1 2-003d

1

0

csirx

1 2

0

scaler_0

1

0

scaler_1

1

/dev/video0 /dev/video1

11

Page 24: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Devicetree troubles

1. Runtime DT insertion/removal not in mainline yet2. Video pipelines: bidirectional endpoints links

deser@30 { // base DTports {port@0 {deser_input: endpoint {remote-endpoint = <&ser_output>;

ser@3d { // DT overlayports {port@1 {ser_output: endpoint {remote-endpoint = <&deser_input>;

sensor0

0

0

ser0 1-003d

1

0 1

des 0-0030

2

sensor1

0

0

ser1 2-003d

1

0

csirx

1 2

0

scaler_0

1

0

scaler_1

1

/dev/video0 /dev/video1

12

Page 25: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Way out

Page 26: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Work around main blockers

• Main blockers for hotplug applications• Non-modifiable pipeline• Runtime Device Tree overlays

• Find a workaround that• Is needed only for hotplug applications• Does not “infect” serdes drivers

• Workaround: sensors always instantiated• V4L2 is happy• Device Tree is static• Sensor driver becomes a hack

13

Page 27: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Work around main blockers

• Main blockers for hotplug applications• Non-modifiable pipeline• Runtime Device Tree overlays

• Find a workaround that• Is needed only for hotplug applications• Does not “infect” serdes drivers

• Workaround: sensors always instantiated• V4L2 is happy• Device Tree is static• Sensor driver becomes a hack

13

Page 28: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Work around main blockers

• Main blockers for hotplug applications• Non-modifiable pipeline• Runtime Device Tree overlays

• Find a workaround that• Is needed only for hotplug applications• Does not “infect” serdes drivers

• Workaround: sensors always instantiated• V4L2 is happy• Device Tree is static• Sensor driver becomes a hack

13

Page 29: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

I2C: ideal solution

SERDESImageSensor

I2Cadapter

SoC

14

Page 30: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

I2C: proposed solution

SERDESImageSensor

I2Cadapter

SoC

15

Page 31: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Remote GPIO

SERDES

0

1

Remote GPIO [0..6]

01

FrameSync

REM

OTE G

PIO

(valu

e[4

], irq

)Remote GPIO [0..3] 01 INT{various status bits}

GPIO

[0

..3

]

16

Page 32: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Remote GPIO

SERDESImageSensor

I2Cadapter

GPIOchip

SoC

17

Page 33: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Remote I2C

Page 34: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Remote I2C

• Different between TI and Maxim chips• Discussed in linux-i2c• BoF during Linux Plumbers Conference 2019

• https://lucaceresoli.net/plumbers-i2c-bof• https://etherpad.openstack.org/p/2019-09-11-I2C-BoF

• Talk by I2C core maintainer Wolfram Sang (“Linux I2C in the 21st Century”,yesterday)

18

Page 35: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Maxim GMSL: I2C switch

SER + DES Slave0x0A

SoC

Slave0x0B

Slave0x0A

Slave0x0B

Slave0x0A

0x0A

• SER+DES are equivalent to an I2C switch

19

Page 36: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

TI FPD-Link III: Address Translation (ATR)

SER+

DES

Slave0x0A

SoC

Slave0x0B

Slave0x0A

Slave0x0B

1A 0A1B 0B

Slave0x0A

0x2A

2A 0A2B 0B

0x0A

• I2C transactions are replicated based on an alias table

20

Page 37: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Address Translation (ATR)

# i2cdetect -li2c-0 i2c amba:camera-i2c@0 I2C adapteri2c-4 i2c i2c-0-atr-0 I2C adapteri2c-5 i2c i2c-0-atr-1 I2C adapter#

echo eeprom 0x0a > /sys/bus/i2c/devices/i2c-4/new_device# dmesg | tail -n2ds90ub954 0-0030: rx0: client 0x0a mapped at alias 0x4b (eeprom)i2c i2c-4: new_device: Instantiated device eeprom at 0x0a# hexdump /sys/bus/i2c/devices/4-000a/eeprom0000000 ffff ffff ffff ffff ffff ffff ffff ffff*0000100#

21

Page 38: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Address Translation (ATR)

# i2cdetect -li2c-0 i2c amba:camera-i2c@0 I2C adapteri2c-4 i2c i2c-0-atr-0 I2C adapteri2c-5 i2c i2c-0-atr-1 I2C adapter# echo eeprom 0x0a > /sys/bus/i2c/devices/i2c-4/new_device#

dmesg | tail -n2ds90ub954 0-0030: rx0: client 0x0a mapped at alias 0x4b (eeprom)i2c i2c-4: new_device: Instantiated device eeprom at 0x0a# hexdump /sys/bus/i2c/devices/4-000a/eeprom0000000 ffff ffff ffff ffff ffff ffff ffff ffff*0000100#

21

Page 39: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Address Translation (ATR)

# i2cdetect -li2c-0 i2c amba:camera-i2c@0 I2C adapteri2c-4 i2c i2c-0-atr-0 I2C adapteri2c-5 i2c i2c-0-atr-1 I2C adapter# echo eeprom 0x0a > /sys/bus/i2c/devices/i2c-4/new_device# dmesg | tail -n2ds90ub954 0-0030: rx0: client 0x0a mapped at alias 0x4b (eeprom)i2c i2c-4: new_device: Instantiated device eeprom at 0x0a#

hexdump /sys/bus/i2c/devices/4-000a/eeprom0000000 ffff ffff ffff ffff ffff ffff ffff ffff*0000100#

21

Page 40: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Address Translation (ATR)

# i2cdetect -li2c-0 i2c amba:camera-i2c@0 I2C adapteri2c-4 i2c i2c-0-atr-0 I2C adapteri2c-5 i2c i2c-0-atr-1 I2C adapter# echo eeprom 0x0a > /sys/bus/i2c/devices/i2c-4/new_device# dmesg | tail -n2ds90ub954 0-0030: rx0: client 0x0a mapped at alias 0x4b (eeprom)i2c i2c-4: new_device: Instantiated device eeprom at 0x0a# hexdump /sys/bus/i2c/devices/4-000a/eeprom0000000 ffff ffff ffff ffff ffff ffff ffff ffff*0000100#

21

Page 41: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Conclusions

Page 42: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Conclusions

• Video serdes are complex• Video pipeline is an issue

• V4L2 limitations• Additional limitations for hotplug (V4L2, Device Tree overlays)• There’s a workaround, implies some compromise

• There is a plan for proper implementation of remote I2C (on TI chips)

22

Page 43: )serializers in Linux: Challenges and Works in Progress · Challenges and Works in Progress Luca Ceresoli — AIM Sportline luca@lucaceresoli.net https: ... • Some have remote UART,

Questions?

Thank you for your attention!

Luca [email protected]

https://lucaceresoli.net

© Copyright 2019, Luca CeresoliSlides released under

Creative Commons Attribution - Share Alike 3.0 Licensehttps://creativecommons.org/licenses/by-sa/3.0/

23