Skip to contentSkip to conversation

Add the cat24c208 EDID EEPROM driver + new EDID capability

PATCH Superseded Erling Ljunggren 4 participants 12 messages Aug 3, 2022 – Aug 18, 2022

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add the cat24c208 EDID EEPROM driver + new EDID capability

This series adds support for the standalone cat24c208 EDID EEPROM i2c device. Usually EDID support is part of an HDMI receiver, but this is a standalone EEPROM.

Note that EEPROMs for EDIDs are not regular EEPROM devices, these are dual port devices that follow the VESA E-DDC standard.

Since this is a standalone device that does not capture any video a new V4L2_CAP_EDID_MEMORY capability is introduced to represent such devices. Note that such a device doesn't have to be an EEPROM, it can also be implemented using a microcontroller, for example. Hence the use of the generic word 'MEMORY'.

The new capability uses the free bit 0x00000008. But we are running out of capability bits: only 0x40000000 and 0x00000008 are free at the moment.

There is one other capability V4L2_CAP_ASYNCIO (0x02000000) that is not used at all, it was never implemented. Wouldn't it be better to define V4L2_CAP_ASYNCIO to 0, mark it as obsolete, and instead reuse it for this V4L2_CAP_EDID_MEMORY capability?

v2:
- fix dt binding example
- rename i2c client variables in data struct
- fix include: of_device.h -> mod_devicetable.h
- Sorted makefile
- used define EDID_OFFSET_EXT_FLAG instead of magic number
- removed of_match_ptr
- added bus_info
- remove unneeded headers
- add depends on OF to Kconfig

Erling Ljunggren (4):
media: videodev2.h: add V4L2_CAP_EDID_MEMORY
media: docs: Add V4L2_CAP_EDID_MEMORY
dt-bindings: media: add cat24c208 bindings
media: v4l2-dev: handle V4L2_CAP_EDID_MEMORY

Jonathan Selnes (1):
media: i2c: cat24c208: driver for the cat24c208 EDID EEPROM

 .../bindings/media/i2c/onnn,cat24c208.yaml    |  40 ++
 .../userspace-api/media/v4l/biblio.rst        |  11 +
 .../media/v4l/vidioc-querycap.rst             |   7 +
 .../media/videodev2.h.rst.exceptions          |   1 +
 MAINTAINERS                                   |   7 +
 drivers/media/i2c/Kconfig                     |   9 +
 drivers/media/i2c/Makefile                    |   1 +
 drivers/media/i2c/cat24c208.c                 | 421 ++++++++++++++++++
 drivers/media/v4l2-core/v4l2-dev.c            |   8 +
 include/uapi/linux/videodev2.h                |   1 +
 10 files changed, 506 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/onnn,cat24c208.yaml
 create mode 100644 drivers/media/i2c/cat24c208.c
Signature · 1 line
2.37.1
#1 lore raw

PATCH v2 1/5 media: videodev2.h: add V4L2_CAP_EDID_MEMORY

Add capability flag to indicate that the device is an EDID memory device.

---
 include/uapi/linux/videodev2.h | 1 +
 1 file changed, 1 insertion(+)
include/uapi/linux/videodev2.h +1 -0
index 343b95107fce..1837e89b350d 100644
@@ -451,6 +451,7 @@ struct v4l2_capability {
 #define V4L2_CAP_VIDEO_CAPTURE		0x00000001  /* Is a video capture device */
 #define V4L2_CAP_VIDEO_OUTPUT		0x00000002  /* Is a video output device */
 #define V4L2_CAP_VIDEO_OVERLAY		0x00000004  /* Can do video overlay */
+#define V4L2_CAP_EDID_MEMORY		0x00000008  /* Is an EDID memory only device */
 #define V4L2_CAP_VBI_CAPTURE		0x00000010  /* Is a raw VBI capture device */
 #define V4L2_CAP_VBI_OUTPUT		0x00000020  /* Is a raw VBI output device */
 #define V4L2_CAP_SLICED_VBI_CAPTURE	0x00000040  /* Is a sliced VBI capture device */
Signature · 1 line
2.37.1
#2 lore raw

PATCH v2 2/5 media: docs: Add V4L2_CAP_EDID_MEMORY

In reply to Erling Ljunggren

Add documentation for the new edid eeprom capability.

---
 Documentation/userspace-api/media/v4l/biblio.rst      | 11 +++++++++++
 .../userspace-api/media/v4l/vidioc-querycap.rst       |  7 +++++++
 .../userspace-api/media/videodev2.h.rst.exceptions    |  1 +
 3 files changed, 19 insertions(+)
Documentation/userspace-api/media/v4l/biblio.rst +11 -0
index 9cd18c153d19..5cbe41877a63 100644
@@ -334,6 +334,17 @@ VESA DMT
 
 :author:    Video Electronics Standards Association (http://www.vesa.org)
 
+.. _vesaeddc:
+
+E-DDC
+====
+
+
+:title:     VESA Enhanced Display Data Channel (E-DDC) Standard
+:subtitle:  Version 1.3
+
+:author:    Video Electronics Standards Association (http://www.vesa.org)
+
 .. _vesaedid:
 
 EDID
Documentation/userspace-api/media/v4l/vidioc-querycap.rst +7 -0
index 63e23f6f95ee..bdb530bd6816 100644
@@ -173,6 +173,13 @@ specification the ioctl returns an ``EINVAL`` error code.
 	interface. A video overlay device typically stores captured images
 	directly in the video memory of a graphics card, with hardware
 	clipping and scaling.
+    * - ``V4L2_CAP_EDID_MEMORY``
+      - 0x00000008
+      - The device is a standalone EDID memory device. This is typically an eeprom
+        that supports the VESA Enhanced Display Data Channel Standard.
+
+        While an eeprom is the most common implementation, it can be something else
+        as well, such as a microcontroller. Hence the generic name 'memory'.
     * - ``V4L2_CAP_VBI_CAPTURE``
       - 0x00000010
       - The device supports the :ref:`Raw VBI Capture <raw-vbi>`
Documentation/userspace-api/media/videodev2.h.rst.exceptions +1 -0
index 9cbb7a0c354a..12fa290828e7 100644
@@ -185,6 +185,7 @@ replace define V4L2_CAP_META_OUTPUT device-capabilities
 replace define V4L2_CAP_DEVICE_CAPS device-capabilities
 replace define V4L2_CAP_TOUCH device-capabilities
 replace define V4L2_CAP_IO_MC device-capabilities
+replace define V4L2_CAP_EDID_MEMORY device-capabilities
 
 # V4L2 pix flags
 replace define V4L2_PIX_FMT_PRIV_MAGIC :c:type:`v4l2_pix_format`
Signature · 1 line
2.37.1
#3 lore raw

Re: [PATCH v2 2/5] media: docs: Add V4L2_CAP_EDID_MEMORY

Hi Erling,

Quoted 36 lines · Erling Ljunggren

Add documentation for the new edid eeprom capability.

---
 Documentation/userspace-api/media/v4l/biblio.rst      | 11 +++++++++++
 .../userspace-api/media/v4l/vidioc-querycap.rst       |  7 +++++++
 .../userspace-api/media/videodev2.h.rst.exceptions    |  1 +
 3 files changed, 19 insertions(+)
Documentation/userspace-api/media/v4l/biblio.rst +11 -0
index 9cd18c153d19..5cbe41877a63 100644
@@ -334,6 +334,17 @@ VESA DMT
 
 :author:    Video Electronics Standards Association (http://www.vesa.org)
 
+.. _vesaeddc:
+
+E-DDC
+====
+
+
+:title:     VESA Enhanced Display Data Channel (E-DDC) Standard
+:subtitle:  Version 1.3
+
+:author:    Video Electronics Standards Association (http://www.vesa.org)
+
 .. _vesaedid:
 
 EDID
Documentation/userspace-api/media/v4l/vidioc-querycap.rst +0 -0
index 63e23f6f95ee..bdb530bd6816 100644

Documentation/userspace-api/media/v4l/vidioc-querycap.rst specification the ioctl returns an ``EINVAL`` error code. · line 182

Quoted 10 lines
Documentation/userspace-api/media/v4l/vidioc-querycap.rst +7 -0
@@ -173,6 +173,13 @@ specification the ioctl returns an ``EINVAL`` error code.
 	interface. A video overlay device typically stores captured images
 	directly in the video memory of a graphics card, with hardware
 	clipping and scaling.
+    * - ``V4L2_CAP_EDID_MEMORY``
+      - 0x00000008
+      - The device is a standalone EDID memory device. This is typically an eeprom
+        that supports the VESA Enhanced Display Data Channel Standard.
+
+        While an eeprom is the most common implementation, it can be something else
+        as well, such as a microcontroller. Hence the generic name 'memory'.

I realized that this is not just needed for inputs, but also for outputs.

This is the case for an HDMI splitter that is connected to a computer via (typically) a serial port where you can use that to get/set the EDID for the input port and get the EDIDs for the output ports (i.e. the EDIDs from the connected displays).

It's the same concept: a standalone EDID device. However, you are not talking directly to a memory device like an eeprom. So I think to keep things generic this capability should be renamed to just V4L2_CAP_EDID.

The description should be updated as well since it is no longer just for inputs.

And I think we can drop the references to 'memory'. It's really about hardware devices that store an EDID for a sink or read an EDID from a source.

Patch 5 will have to be updated as well since for an output device this cap is associated with ENUM/S/G_OUTPUT. And for output S_EDID is not supported, of course.

I'm working on a driver for an HDMI Splitter (CEC and EDID support), so this would come in very handy for that.

Regards,

Hans

Quoted 15 lines
Documentation/userspace-api/media/v4l/vidioc-querycap.rst +0 -0
     * - ``V4L2_CAP_VBI_CAPTURE``
       - 0x00000010
       - The device supports the :ref:`Raw VBI Capture <raw-vbi>`
Documentation/userspace-api/media/videodev2.h.rst.exceptions +1 -0
index 9cbb7a0c354a..12fa290828e7 100644
@@ -185,6 +185,7 @@ replace define V4L2_CAP_META_OUTPUT device-capabilities
 replace define V4L2_CAP_DEVICE_CAPS device-capabilities
 replace define V4L2_CAP_TOUCH device-capabilities
 replace define V4L2_CAP_IO_MC device-capabilities
+replace define V4L2_CAP_EDID_MEMORY device-capabilities
 
 # V4L2 pix flags
 replace define V4L2_PIX_FMT_PRIV_MAGIC :c:type:`v4l2_pix_format`
#4 lore raw

PATCH v2 3/5 dt-bindings: media: add cat24c208 bindings

In reply to Erling Ljunggren

Add devicetree bindings for new cat24c208 EDID EEPROM driver.

---
 .../bindings/media/i2c/onnn,cat24c208.yaml    | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/onnn,cat24c208.yaml
Documentation/devicetree/bindings/media/i2c/onnn,cat24c208.yaml new file +40 -0
new file mode 100644
index 000000000000..590cdf0cbdc1
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/onnn,cat24c208.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ON Semiconductor CAT24C208 EDID EEPROM driver
+
+maintainers:
+  - Hans Verkuil <[email protected]>
+
+description: |
+  CAT24C208 is a dual port i2c EEPROM designed for EDID storage.
+
+
+properties:
+  compatible:
+    const: onnn,cat24c208
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        cat24c208@31 {
+            compatible = "onnn,cat24c208";
+            reg = <0x31>;
+        };
+    };
+...
Signature · 1 line
2.37.1
maintainer Reviewed-by on v2 3/5
#5 lore raw

Re: [PATCH v2 3/5] dt-bindings: media: add cat24c208 bindings

Quoted 8 lines · Erling Ljunggren

Add devicetree bindings for new cat24c208 EDID EEPROM driver.

---
 .../bindings/media/i2c/onnn,cat24c208.yaml    | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/onnn,cat24c208.yaml
#6 lore raw

PATCH v2 4/5 media: i2c: cat24c208: driver for the cat24c208 EDID EEPROM

In reply to Erling Ljunggren

From: Jonathan Selnes <[email protected]>

Support reading and writing the EDID EEPROM through the v4l2 API.

---
 MAINTAINERS                   |   7 +
 drivers/media/i2c/Kconfig     |   9 +
 drivers/media/i2c/Makefile    |   1 +
 drivers/media/i2c/cat24c208.c | 421 ++++++++++++++++++++++++++++++++++
 4 files changed, 438 insertions(+)
 create mode 100644 drivers/media/i2c/cat24c208.c
MAINTAINERS +7 -0
index 7d9490a5c15a..407d76c42bab 100644
@@ -14912,6 +14912,13 @@ S:	Maintained
 T:	git git://linuxtv.org/media_tree.git
 F:	drivers/media/i2c/ov9734.c
 
+ON SEMICONDUCTOR CAT24C208 EDID EEPROM DRIVER
+M:	Hans Verkuil <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/media/i2c/onnn,cat24c208.yaml
+F:	drivers/media/i2c/cat24c208*
+
 ONENAND FLASH DRIVER
 M:	Kyungmin Park <[email protected]>
 L:	[email protected]
drivers/media/i2c/Kconfig +9 -0
index 2b20aa6c37b1..2f5f9f058b48 100644
@@ -1530,6 +1530,15 @@ endmenu
 menu "Miscellaneous helper chips"
 	visible if !MEDIA_HIDE_ANCILLARY_SUBDRV
 
+config VIDEO_CAT24C208
+	tristate "ON Semiconductor cat24c208 EDID EEPROM"
+	depends on VIDEO_DEV && I2C && OF
+	help
+	  Support for the ON Semiconductor CAT24C208 Dual Port EDID EEPROM.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called cat24c208.
+
 config VIDEO_I2C
 	tristate "I2C transport video support"
 	depends on VIDEO_DEV && I2C
drivers/media/i2c/Makefile +1 -0
index 3e1696963e7f..70e4360a21ba 100644
@@ -22,6 +22,7 @@ obj-$(CONFIG_VIDEO_APTINA_PLL) += aptina-pll.o
 obj-$(CONFIG_VIDEO_BT819) += bt819.o
 obj-$(CONFIG_VIDEO_BT856) += bt856.o
 obj-$(CONFIG_VIDEO_BT866) += bt866.o
+obj-$(CONFIG_VIDEO_CAT24C208) += cat24c208.o
 obj-$(CONFIG_VIDEO_CCS) += ccs/
 obj-$(CONFIG_VIDEO_CCS_PLL) += ccs-pll.o
 obj-$(CONFIG_VIDEO_CS3308) += cs3308.o
drivers/media/i2c/cat24c208.c new file +421 -0

421 lines not on this page · raw message

Signature · 1 line
2.37.1
#7 lore raw

PATCH v2 5/5 media: v4l2-dev: handle V4L2_CAP_EDID_MEMORY

In reply to Erling Ljunggren

When the V4L2_CAP_EDID_MEMORY capability flag is set, ioctls for enum inputs and get/set edid are automatically set.

---
 drivers/media/v4l2-core/v4l2-dev.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/media/v4l2-core/v4l2-dev.c +8 -0
index d00237ee4cae..39437911edcc 100644
@@ -556,6 +556,7 @@ static void determine_valid_ioctls(struct video_device *vdev)
 	bool is_rx = vdev->vfl_dir != VFL_DIR_TX;
 	bool is_tx = vdev->vfl_dir != VFL_DIR_RX;
 	bool is_io_mc = vdev->device_caps & V4L2_CAP_IO_MC;
+	bool is_edid_mem =  vdev->device_caps & V4L2_CAP_EDID_MEMORY;
 
 	bitmap_zero(valid_ioctls, BASE_VIDIOC_PRIVATE);
 
@@ -778,6 +779,13 @@ static void determine_valid_ioctls(struct video_device *vdev)
 		SET_VALID_IOCTL(ops, VIDIOC_S_TUNER, vidioc_s_tuner);
 		SET_VALID_IOCTL(ops, VIDIOC_S_HW_FREQ_SEEK, vidioc_s_hw_freq_seek);
 	}
+	if (is_edid_mem) {
+		SET_VALID_IOCTL(ops, VIDIOC_G_EDID, vidioc_g_edid);
+		SET_VALID_IOCTL(ops, VIDIOC_S_EDID, vidioc_s_edid);
+		SET_VALID_IOCTL(ops, VIDIOC_ENUMINPUT, vidioc_enum_input);
+		SET_VALID_IOCTL(ops, VIDIOC_G_INPUT, vidioc_g_input);
+		SET_VALID_IOCTL(ops, VIDIOC_S_INPUT, vidioc_s_input);
+	}
 
 	bitmap_andnot(vdev->valid_ioctls, valid_ioctls, vdev->valid_ioctls,
 			BASE_VIDIOC_PRIVATE);
Signature · 1 line
2.37.1
#8 lore raw
In reply to Erling Ljunggren

Hi Erling,

(CC'ing the linux-i2c mailing list and Srinivas, the maintainer of the nvmem framework)

Thank you for the patches.

Quoted 11 lines · Erling Ljunggren

This series adds support for the standalone cat24c208 EDID EEPROM i2c device. Usually EDID support is part of an HDMI receiver, but this is a standalone EEPROM.

Note that EEPROMs for EDIDs are not regular EEPROM devices, these are dual port devices that follow the VESA E-DDC standard.

Since this is a standalone device that does not capture any video a new V4L2_CAP_EDID_MEMORY capability is introduced to represent such devices. Note that such a device doesn't have to be an EEPROM, it can also be implemented using a microcontroller, for example. Hence the use of the generic word 'MEMORY'.

Why can't this be exposed as a nvmem device, like other types of eeproms here ?

Quoted 41 lines

The new capability uses the free bit 0x00000008. But we are running out of capability bits: only 0x40000000 and 0x00000008 are free at the moment.

There is one other capability V4L2_CAP_ASYNCIO (0x02000000) that is not used at all, it was never implemented. Wouldn't it be better to define V4L2_CAP_ASYNCIO to 0, mark it as obsolete, and instead reuse it for this V4L2_CAP_EDID_MEMORY capability?

v2:
- fix dt binding example
- rename i2c client variables in data struct
- fix include: of_device.h -> mod_devicetable.h
- Sorted makefile
- used define EDID_OFFSET_EXT_FLAG instead of magic number
- removed of_match_ptr
- added bus_info
- remove unneeded headers
- add depends on OF to Kconfig

Erling Ljunggren (4):
media: videodev2.h: add V4L2_CAP_EDID_MEMORY
media: docs: Add V4L2_CAP_EDID_MEMORY
dt-bindings: media: add cat24c208 bindings
media: v4l2-dev: handle V4L2_CAP_EDID_MEMORY

Jonathan Selnes (1):
media: i2c: cat24c208: driver for the cat24c208 EDID EEPROM

 .../bindings/media/i2c/onnn,cat24c208.yaml    |  40 ++
 .../userspace-api/media/v4l/biblio.rst        |  11 +
 .../media/v4l/vidioc-querycap.rst             |   7 +
 .../media/videodev2.h.rst.exceptions          |   1 +
 MAINTAINERS                                   |   7 +
 drivers/media/i2c/Kconfig                     |   9 +
 drivers/media/i2c/Makefile                    |   1 +
 drivers/media/i2c/cat24c208.c                 | 421 ++++++++++++++++++
 drivers/media/v4l2-core/v4l2-dev.c            |   8 +
 include/uapi/linux/videodev2.h                |   1 +
 10 files changed, 506 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/onnn,cat24c208.yaml
 create mode 100644 drivers/media/i2c/cat24c208.c
Signature · 3 lines
Regards,

Laurent Pinchart
#9 lore raw
Quoted 14 lines · Laurent Pinchart

Hi Erling,

(CC'ing the linux-i2c mailing list and Srinivas, the maintainer of the nvmem framework)

Thank you for the patches.

Quoted 6 lines · Erling Ljunggren

This series adds support for the standalone cat24c208 EDID EEPROM i2c device. Usually EDID support is part of an HDMI receiver, but this is a standalone EEPROM.

Note that EEPROMs for EDIDs are not regular EEPROM devices, these are dual port devices that follow the VESA E-DDC standard.

Quoted 8 lines
Quoted 5 lines

Since this is a standalone device that does not capture any video a new V4L2_CAP_EDID_MEMORY capability is introduced to represent such devices. Note that such a device doesn't have to be an EEPROM, it can also be implemented using a microcontroller, for example. Hence the use of the generic word 'MEMORY'.

Why can't this be exposed as a nvmem device, like other types of eeproms here ?

Because it isn't. Same discussion I had with Andy: it's not a regular eeprom but a dedicated eeprom for EDIDs. And we have support for that already in V4L2. It's specific to receivers as well, so the only subsystem it belongs to is V4L2.

See the discussion I had with Andy on this:

https://patchwork.linuxtv.org/project/linux-media/patch/[email protected]/

Regards,

Hans

Quoted 43 lines
Quoted 42 lines

The new capability uses the free bit 0x00000008. But we are running out of capability bits: only 0x40000000 and 0x00000008 are free at the moment.

There is one other capability V4L2_CAP_ASYNCIO (0x02000000) that is not used at all, it was never implemented. Wouldn't it be better to define V4L2_CAP_ASYNCIO to 0, mark it as obsolete, and instead reuse it for this V4L2_CAP_EDID_MEMORY capability?

v2:
- fix dt binding example
- rename i2c client variables in data struct
- fix include: of_device.h -> mod_devicetable.h
- Sorted makefile
- used define EDID_OFFSET_EXT_FLAG instead of magic number
- removed of_match_ptr
- added bus_info
- remove unneeded headers
- add depends on OF to Kconfig

Erling Ljunggren (4):
media: videodev2.h: add V4L2_CAP_EDID_MEMORY
media: docs: Add V4L2_CAP_EDID_MEMORY
dt-bindings: media: add cat24c208 bindings
media: v4l2-dev: handle V4L2_CAP_EDID_MEMORY

Jonathan Selnes (1):
media: i2c: cat24c208: driver for the cat24c208 EDID EEPROM

 .../bindings/media/i2c/onnn,cat24c208.yaml    |  40 ++
 .../userspace-api/media/v4l/biblio.rst        |  11 +
 .../media/v4l/vidioc-querycap.rst             |   7 +
 .../media/videodev2.h.rst.exceptions          |   1 +
 MAINTAINERS                                   |   7 +
 drivers/media/i2c/Kconfig                     |   9 +
 drivers/media/i2c/Makefile                    |   1 +
 drivers/media/i2c/cat24c208.c                 | 421 ++++++++++++++++++
 drivers/media/v4l2-core/v4l2-dev.c            |   8 +
 include/uapi/linux/videodev2.h                |   1 +
 10 files changed, 506 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/onnn,cat24c208.yaml
 create mode 100644 drivers/media/i2c/cat24c208.c
#10 lore raw

Hi Hans,

Quoted 21 lines · Hans Verkuil
Quoted 20 lines · Laurent Pinchart

Hi Erling,

(CC'ing the linux-i2c mailing list and Srinivas, the maintainer of the nvmem framework)

Thank you for the patches.

Quoted 11 lines · Erling Ljunggren

This series adds support for the standalone cat24c208 EDID EEPROM i2c device. Usually EDID support is part of an HDMI receiver, but this is a standalone EEPROM.

Note that EEPROMs for EDIDs are not regular EEPROM devices, these are dual port devices that follow the VESA E-DDC standard.

Since this is a standalone device that does not capture any video a new V4L2_CAP_EDID_MEMORY capability is introduced to represent such devices. Note that such a device doesn't have to be an EEPROM, it can also be implemented using a microcontroller, for example. Hence the use of the generic word 'MEMORY'.

Quoted 6 lines
Quoted 2 lines

Why can't this be exposed as a nvmem device, like other types of eeproms here ?

Because it isn't. Same discussion I had with Andy: it's not a regular eeprom but a dedicated eeprom for EDIDs. And we have support for that already in V4L2. It's specific to receivers as well, so the only subsystem it belongs to is V4L2.

Why does that matter ? It's still an NVMEM device that stores 512 bytes of data, even if the I2C interface to read/write it is different than other types of standard EEPROMs.

Quoted 45 lines

See the discussion I had with Andy on this:

https://patchwork.linuxtv.org/project/linux-media/patch/[email protected]/

Quoted 41 lines
Quoted 41 lines

The new capability uses the free bit 0x00000008. But we are running out of capability bits: only 0x40000000 and 0x00000008 are free at the moment.

There is one other capability V4L2_CAP_ASYNCIO (0x02000000) that is not used at all, it was never implemented. Wouldn't it be better to define V4L2_CAP_ASYNCIO to 0, mark it as obsolete, and instead reuse it for this V4L2_CAP_EDID_MEMORY capability?

v2:
- fix dt binding example
- rename i2c client variables in data struct
- fix include: of_device.h -> mod_devicetable.h
- Sorted makefile
- used define EDID_OFFSET_EXT_FLAG instead of magic number
- removed of_match_ptr
- added bus_info
- remove unneeded headers
- add depends on OF to Kconfig

Erling Ljunggren (4):
media: videodev2.h: add V4L2_CAP_EDID_MEMORY
media: docs: Add V4L2_CAP_EDID_MEMORY
dt-bindings: media: add cat24c208 bindings
media: v4l2-dev: handle V4L2_CAP_EDID_MEMORY

Jonathan Selnes (1):
media: i2c: cat24c208: driver for the cat24c208 EDID EEPROM

 .../bindings/media/i2c/onnn,cat24c208.yaml    |  40 ++
 .../userspace-api/media/v4l/biblio.rst        |  11 +
 .../media/v4l/vidioc-querycap.rst             |   7 +
 .../media/videodev2.h.rst.exceptions          |   1 +
 MAINTAINERS                                   |   7 +
 drivers/media/i2c/Kconfig                     |   9 +
 drivers/media/i2c/Makefile                    |   1 +
 drivers/media/i2c/cat24c208.c                 | 421 ++++++++++++++++++
 drivers/media/v4l2-core/v4l2-dev.c            |   8 +
 include/uapi/linux/videodev2.h                |   1 +
 10 files changed, 506 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/onnn,cat24c208.yaml
 create mode 100644 drivers/media/i2c/cat24c208.c
Signature · 3 lines
Regards,

Laurent Pinchart
#11 lore raw

Hi Laurent,

Quoted 27 lines · Laurent Pinchart

Hi Hans,

Quoted 24 lines · Hans Verkuil
Quoted 22 lines · Laurent Pinchart

Hi Erling,

(CC'ing the linux-i2c mailing list and Srinivas, the maintainer of the nvmem framework)

Thank you for the patches.

Quoted 11 lines · Erling Ljunggren

This series adds support for the standalone cat24c208 EDID EEPROM i2c device. Usually EDID support is part of an HDMI receiver, but this is a standalone EEPROM.

Note that EEPROMs for EDIDs are not regular EEPROM devices, these are dual port devices that follow the VESA E-DDC standard.

Since this is a standalone device that does not capture any video a new V4L2_CAP_EDID_MEMORY capability is introduced to represent such devices. Note that such a device doesn't have to be an EEPROM, it can also be implemented using a microcontroller, for example. Hence the use of the generic word 'MEMORY'.

Why can't this be exposed as a nvmem device, like other types of eeproms here ?

Quoted 7 lines
Quoted 3 lines

Because it isn't. Same discussion I had with Andy: it's not a regular eeprom but a dedicated eeprom for EDIDs. And we have support for that already in V4L2. It's specific to receivers as well, so the only subsystem it belongs to is V4L2.

Why does that matter ? It's still an NVMEM device that stores 512 bytes of data, even if the I2C interface to read/write it is different than other types of standard EEPROMs.

EDID support is already present in various HDMI receivers (e.g. adv7604). We have the API for that (VIDIOC_G/S_EDID). The only difference is that for those HDMI receivers the EDID is in volatile memory and is integrated into the receiver.

Regardless of the underlying implementation (integrated into an HDMI receiver, a standalone eeprom, or even implemented with a microcontroller), these devices are dedicated to storing an EDID and are hooked up to the DDC lines of an HDMI input (or even to multiple HDMI inputs, as supported by the adv7604).

Changing an EDID typically requires additional work such as toggling the hotplug detect pin, and (if CEC is supported) updating the physical address of the CEC adapter. While that is not (yet) supported in this driver, it is something that we might add later.

None of this is good fit for a nvmem driver. The key feature is that this is for EDIDs. Whether it is implemented as volatile or non-volatile memory is irrelevant, the relevant feature is that it stores an EDID and is able (if needed) to take care of HPD toggling and CEC physical addresses.

Perhaps if we add support for e.g. toggling an HPD pin (even though it is not needed yet for our use-case), it would become more obvious that this not a nvmem device?

Comparing this driver with adv7604 I see that it would make sense to also validate the EDID (the physical address in particular). Adding that would also more clearly tie it to the v4l2 subsystem.

V4L2 has all the infrastructure for EDIDs, both in the kernel and in userspace, so it really does not make sense to go for nvmem, just because it happens to be an eeprom.

Regards,

Hans

Quoted 47 lines
Quoted 46 lines

See the discussion I had with Andy on this:

https://patchwork.linuxtv.org/project/linux-media/patch/[email protected]/

Quoted 41 lines
Quoted 41 lines

The new capability uses the free bit 0x00000008. But we are running out of capability bits: only 0x40000000 and 0x00000008 are free at the moment.

There is one other capability V4L2_CAP_ASYNCIO (0x02000000) that is not used at all, it was never implemented. Wouldn't it be better to define V4L2_CAP_ASYNCIO to 0, mark it as obsolete, and instead reuse it for this V4L2_CAP_EDID_MEMORY capability?

v2:
- fix dt binding example
- rename i2c client variables in data struct
- fix include: of_device.h -> mod_devicetable.h
- Sorted makefile
- used define EDID_OFFSET_EXT_FLAG instead of magic number
- removed of_match_ptr
- added bus_info
- remove unneeded headers
- add depends on OF to Kconfig

Erling Ljunggren (4):
media: videodev2.h: add V4L2_CAP_EDID_MEMORY
media: docs: Add V4L2_CAP_EDID_MEMORY
dt-bindings: media: add cat24c208 bindings
media: v4l2-dev: handle V4L2_CAP_EDID_MEMORY

Jonathan Selnes (1):
media: i2c: cat24c208: driver for the cat24c208 EDID EEPROM

 .../bindings/media/i2c/onnn,cat24c208.yaml    |  40 ++
 .../userspace-api/media/v4l/biblio.rst        |  11 +
 .../media/v4l/vidioc-querycap.rst             |   7 +
 .../media/videodev2.h.rst.exceptions          |   1 +
 MAINTAINERS                                   |   7 +
 drivers/media/i2c/Kconfig                     |   9 +
 drivers/media/i2c/Makefile                    |   1 +
 drivers/media/i2c/cat24c208.c                 | 421 ++++++++++++++++++
 drivers/media/v4l2-core/v4l2-dev.c            |   8 +
 include/uapi/linux/videodev2.h                |   1 +
 10 files changed, 506 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/onnn,cat24c208.yaml
 create mode 100644 drivers/media/i2c/cat24c208.c