port your camera in 2018 - linux foundation events€¦ · edinburgh, 10/2018 jacopo mondi...
TRANSCRIPT
![Page 1: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/1.jpg)
Port your camera in 2018Port your camera in 2018
Jacopo Mondi ELC-E 2018
Edinburgh, 10/2018
Jacopo Mondi ELC-E 2018
Edinburgh, 10/[email protected]@jmondi.org
![Page 2: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/2.jpg)
Hello!Hello!
• My name’s Jacopo– [email protected]
– irc: jmondi @ freenode
• Embedded Linux and free software developer
• Working as consultant
• Renesas Electronics upstream kernel team
![Page 3: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/3.jpg)
Hello!Hello!
• Thanks Renesas for supporting me in this activity!
![Page 4: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/4.jpg)
Talk outlineTalk outline
• soc_camera: what’s happening?
• What has changed since the soc_camera days:
• Board files vs firmware support
• Device discovery and linking
• Power Management
• Practical example: ov772x.c
• Q/A
![Page 5: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/5.jpg)
The soc_camera frameworkThe soc_camera framework
• soc_camera was GREAT
• Widely adopted– Mainline drivers
– In BSPs and downstream kernel
![Page 6: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/6.jpg)
What’s happening to soc_camera What’s happening to soc_camera
In mainline kernels:
• soc_camera to be ‘soon’ deprecated (with ‘soon’ to be defined)
• Last soc_camera dependent bridge driver has been re-implemented last year
• soc_camera sensor drivers are not officially supported anymore
![Page 7: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/7.jpg)
What’s happening to soc_camera What’s happening to soc_camera
File organization:● drivers/media/platform/
drivers/media/platform/soc_camera/
● drivers/media/i2c/drivers/media/i2c/soc_camera/
● drivers/media/i2c/mt9t112.cdrivers/media/i2c/soc_camera/mt9t112.c
![Page 8: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/8.jpg)
soc_camera: the goodsoc_camera: the good
• Provides and abstraction to the crude V4L2 APIs
• Ease linking bridge drivers to sensor drivers
• Abstract driver operations to a structure of function pointers
![Page 9: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/9.jpg)
soc_camera: the badsoc_camera: the bad
• Designed for board-files:
• OF and ACPI support is limited (hold on...)
• Use on a set of deprecated operations and frameworks
• Media-controller and subdev APIs are game changers
The single device node abstraction is showing its age...
![Page 10: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/10.jpg)
What has changed?What has changed?
• device discovery and linking:
• notifier(s) and async matching
• power management
• clocks and regulators handling
![Page 11: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/11.jpg)
video4linux2: device probingvideo4linux2: device probing
• Device matching and probing:
• The old world: i2c addresses based
• The new world: firmware based
![Page 12: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/12.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 13: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/13.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 14: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/14.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 15: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/15.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 16: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/16.jpg)
video4linux2: device probingvideo4linux2: device probing
i2c bus numberi2c dev addr
![Page 17: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/17.jpg)
video4linux2: device probingvideo4linux2: device probing
i2c bus numberi2c dev addr
i2c bus numberi2c dev addr
![Page 18: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/18.jpg)
video4linux2: device probingvideo4linux2: device probing
• Old world– Device identified by i2c bus number and i2c
address
– Device probing is sequential
– Guarantees a bridge driver probes before the sensor driver it will connect to
![Page 19: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/19.jpg)
video4linux2: device probingvideo4linux2: device probing
• New world– Devices are created parsing a firmware
description of the system (OF or ACPI)
– Device are identified by they ‘firmware node’ references
– No guarantees on the probing order
![Page 20: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/20.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 21: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/21.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 22: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/22.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 23: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/23.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 24: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/24.jpg)
video4linux2: device probingvideo4linux2: device probing
of_graph.txt
![Page 25: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/25.jpg)
video4linux2: device probingvideo4linux2: device probing
of_graph.txt
ACPI_DSD extension
![Page 26: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/26.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 27: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/27.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 28: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/28.jpg)
video4linux2: device probingvideo4linux2: device probing
• Device probing is now asynchronous
• Devices are now identified by their firmware node references
![Page 29: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/29.jpg)
video4linux2: device probingvideo4linux2: device probing
• Device probing is now asynchronous• Devices are now identified by their firmware
node references
• V4L2 framework support
• v4l2-async
• v4l2-fwnode
![Page 30: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/30.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 31: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/31.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 32: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/32.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 33: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/33.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 34: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/34.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 35: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/35.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 36: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/36.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 37: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/37.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 38: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/38.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 39: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/39.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 40: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/40.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 41: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/41.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 42: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/42.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 43: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/43.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 44: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/44.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 45: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/45.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 46: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/46.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 47: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/47.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 48: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/48.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 49: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/49.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 50: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/50.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 51: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/51.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 52: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/52.jpg)
video4linux2: device probingvideo4linux2: device probing
• soc_camera can do that– Uses v4l2-async
– Uses v4l2-fwnode
• What has changed then?
![Page 53: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/53.jpg)
video4linux2: device probingvideo4linux2: device probing
• soc_camera can do that– Uses v4l2-async
– Uses v4l2-fwnode
• What has changed then?– That now subdevs can have notifiers too!
– Introducing subnotifiers (late 2017)Niklas, Sakari Laurent – rcar-csi.c
![Page 54: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/54.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 55: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/55.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 56: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/56.jpg)
video4linux2: device probingvideo4linux2: device probing
![Page 57: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/57.jpg)
video4linux2: power managementvideo4linux2: power management
• Non media controller equipped device– Single device node abstraction
– Sequential operations flow
![Page 58: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/58.jpg)
video4linux2: power managementvideo4linux2: power management
• Non media controller equipped device– Single device node abstraction
– Sequential operations flow
• Media controller equipped device– Video device node and subdevice nodes
– Asynchronous sequence of operations
![Page 59: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/59.jpg)
video4linux2: power managementvideo4linux2: power management
![Page 60: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/60.jpg)
video4linux2: power managementvideo4linux2: power management
![Page 61: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/61.jpg)
video4linux2: power managementvideo4linux2: power management
![Page 62: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/62.jpg)
video4linux2: power managementvideo4linux2: power management
![Page 63: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/63.jpg)
video4linux2: power managementvideo4linux2: power management
![Page 64: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/64.jpg)
video4linux2: power managementvideo4linux2: power management
![Page 65: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/65.jpg)
video4linux2: power managementvideo4linux2: power management
![Page 66: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/66.jpg)
video4linux2: power managementvideo4linux2: power management
![Page 67: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/67.jpg)
video4linux2: power managementvideo4linux2: power management
![Page 68: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/68.jpg)
video4linux2: power managementvideo4linux2: power management
![Page 69: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/69.jpg)
video4linux2: power managementvideo4linux2: power management
![Page 70: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/70.jpg)
video4linux2: power managementvideo4linux2: power management
![Page 71: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/71.jpg)
video4linux2: power managementvideo4linux2: power management
![Page 72: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/72.jpg)
video4linux2: power managementvideo4linux2: power management
![Page 73: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/73.jpg)
video4linux2: power managementvideo4linux2: power management
![Page 74: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/74.jpg)
video4linux2: power managementvideo4linux2: power management
• CACHE
![Page 75: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/75.jpg)
video4linux2: power managementvideo4linux2: power management
• CACHE YOUR
![Page 76: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/76.jpg)
video4linux2: power managementvideo4linux2: power management
• CACHE YOUR SETTINGS
![Page 77: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/77.jpg)
video4linux2: power managementvideo4linux2: power management
• CACHE YOUR SETTINGS
• Maintain a driver-wise ‘power state’ notion
![Page 78: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/78.jpg)
video4linux2: power managementvideo4linux2: power management
• CACHE YOUR SETTINGS
• Maintain a ref-counted driver-wise ‘power state’ notion
• Apply the cached settings at stream-on time
![Page 79: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/79.jpg)
video4linux2: power managementvideo4linux2: power management
• CACHE YOUR SETTINGS
• Maintain a ref-counted driver-wise ‘power state’ notion
• Apply the cached settings at stream-on time
• Use RUNTIME_PM whenever possible
![Page 80: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/80.jpg)
video4linux2: clks, gpios, regulatorsvideo4linux2: clks, gpios, regulators
• Legacy board files provided to drivers power management routines
static struct soc_camera_link ov7725_link = { .power = ov7725_power, .board_info = &migor_i2c_camera[0], .i2c_adapter_id = 0, .priv = &ov7725_info,};
![Page 81: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/81.jpg)
video4linux2: clks, gpios, regulatorsvideo4linux2: clks, gpios, regulators
• Use gpio, clock, and regulator frameworks
• Collect references from firmaware*_get(dev, “name”);
• Have the driver enable/disable them at s_power time
![Page 82: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/82.jpg)
Practical: ov772x.cPractical: ov772x.c
• Copy the driver code from soc_camera
media: i2c: Copy ov772x soc_camera sensor driver
Copy the soc_camera based driver in v4l2 sensor driver directory. This commit just copies the original file without modifying it.
No modification to KConfig and Makefile as soc_camera framework dependencies need to be removed first in next commit.
drivers/media/i2c/ov772x.c | 1124 ++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 1124 insertions(+)
![Page 83: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/83.jpg)
Practical: ov772x.cPractical: ov772x.c
• Remove soc_camera dependencies
media: i2c: ov772x: Remove soc_camera dependencies Remove soc_camera framework dependencies from ov772x sensor driver. - Handle clock and gpios - Register async subdevice - Remove soc_camera specific g/s_mbus_config operations - Change image format colorspace from JPEG to SRGB as the two use the same colorspace information but JPEG makes assumptions on color components quantization that do not apply to the sensor - Remove sizes crop from get_selection as driver can't scale - Add kernel doc to driver interface header file - Adjust build system
![Page 84: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/84.jpg)
Practical: ov772x.cPractical: ov772x.c
• Here is where the fun begins:
$ git log –-oneline drivers/media/i2c/ov772x.c
3508949 media: i2c: ov772x: Support frame interval handling4b610d6 media: ov772x: add media controller supportc2cae89 media: ov772x: support device tree probing34af7d9 media: ov772x: handle nested s_power() calls95f5a45 media: ov772x: avoid accessing registers under power saving mode7b9998c media: ov772x: make set_fmt() and s_frame_interval() return -EBUSY while streaming795bce4 media: ov772x: create subdevice device node
![Page 85: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/85.jpg)
Thank you for the attentionThank you for the attention
• Questions?
This presentation was made with inkscape and LibreOffice: a big thanks to the developers of these two softwares!
![Page 86: Port your camera in 2018 - Linux Foundation Events€¦ · Edinburgh, 10/2018 Jacopo Mondi jacopo@jmondi.orgjacopo@jmondi.org Edinburgh, 10/2018. Hello! • My name’s Jacopo –](https://reader037.vdocuments.net/reader037/viewer/2022090607/605d6dc9742b0d00880ef629/html5/thumbnails/86.jpg)