Skip to contentSkip to conversation

Keep MEDIA_PAD_FL_INTERNAL for kernel only, for now

PATCH Superseded Sakari Ailus 3 participants 7 messages Oct 7 – Oct 8

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Sakari Ailus

author maintainer
#0 lore raw

cover Keep MEDIA_PAD_FL_INTERNAL for kernel only, for now

Hi all,

These two patches limit the visibility of the INTERNAL pad flag to the kernel as well as disable creating the pads with INTERNAL pad flag so it won't be enumerable via the MC IOCTLs.

These patches (or later versions of the set) will be merged for 7.4 before rc1 and reverted once the rest of the metadata series can be merged.

The patches are compile tested only. Review and testing is welcome.

Sakari Ailus (2):
media: mc: Keep INTERNAL pad flags just for the kernel, for now
media: maxim-serdes: Disable test pattern generator for now

 drivers/media/i2c/maxim-serdes/max_des.c | 3 +--
 drivers/media/i2c/maxim-serdes/max_ser.c | 3 +--
 include/uapi/linux/media.h               | 6 ++++++
 3 files changed, 8 insertions(+), 4 deletions(-)
Signature · 1 line
2.47.3
author maintainer
#1 lore raw

PATCH 1/2 media: mc: Keep INTERNAL pad flags just for the kernel, for now

Do not expose INTERNAL pads on UAPI as the documentation nor v4l2-compliance changes to support MEDIA_PAD_FL_INTERNAL pads has not yet been merged.

---
 include/uapi/linux/media.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/uapi/linux/media.h +6 -0
index 80cfd12a43fc..63e69a517987 100644
@@ -208,7 +208,13 @@ struct media_entity_desc {
 #define MEDIA_PAD_FL_SINK			(1U << 0)
 #define MEDIA_PAD_FL_SOURCE			(1U << 1)
 #define MEDIA_PAD_FL_MUST_CONNECT		(1U << 2)
+#if defined(__KERNEL__)
+/*
+ * Forgo INTERNAL pads until proper documentation and v4l2-compliance testing is
+ * merged.
+ */
 #define MEDIA_PAD_FL_INTERNAL			(1U << 3)
+#endif /* __KERNEL__ */
 
 struct media_pad_desc {
 	__u32 entity;		/* entity ID */
Signature · 1 line
2.47.3
author maintainer
#4 lore raw

PATCH 2/2 media: maxim-serdes: Disable test pattern generator for now

In reply to Sakari Ailus

Disable the test pattern generator that uses the INTERNAL pad flags for now.

---
 drivers/media/i2c/maxim-serdes/max_des.c | 3 +--
 drivers/media/i2c/maxim-serdes/max_ser.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/media/i2c/maxim-serdes/max_des.c +1 -2
index 1cbe4c3a3233..cb43edf7a9ae 100644
@@ -137,8 +137,7 @@ static inline unsigned int max_des_phy_to_pad(struct max_des *des,
 
 static inline unsigned int max_des_num_pads(struct max_des *des)
 {
-	return des->info->num_links + des->info->num_phys +
-	       (des->ops->set_tpg ? 1 : 0);
+	return des->info->num_links + des->info->num_phys;
 }
 
 static struct max_des_phy *max_des_pad_to_phy(struct max_des *des, u32 pad)
drivers/media/i2c/maxim-serdes/max_ser.c +1 -2
index e9bb722ea22f..c8dd5c3d352c 100644
@@ -90,8 +90,7 @@ static inline unsigned int max_ser_phy_to_pad(struct max_ser *ser,
 
 static inline unsigned int max_ser_num_pads(struct max_ser *ser)
 {
-	return ser->ops->num_phys + MAX_SER_NUM_LINKS +
-	       (ser->ops->set_tpg ? 1 : 0);
+	return ser->ops->num_phys + MAX_SER_NUM_LINKS;
 }
 
 static struct max_ser_phy *max_ser_pad_to_phy(struct max_ser *ser, u32 pad)
Signature · 1 line
2.47.3
maintainer Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] media: mc: Keep INTERNAL pad flags just for the kernel, for now

In reply to Sakari Ailus
Quoted 1 line · Sakari Ailus

Do not expose INTERNAL pads on UAPI as the documentation nor

s/as the/as neither the/

Quoted 2 lines

v4l2-compliance changes to support MEDIA_PAD_FL_INTERNAL pads has not yet been merged.

"have been merged yet"

Quoted 10 lines
---
 include/uapi/linux/media.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/uapi/linux/media.h +0 -0
index 80cfd12a43fc..63e69a517987 100644

include/uapi/linux/media.h struct media_entity_desc { · line 213

Quoted 6 lines
include/uapi/linux/media.h +3 -0
@@ -208,7 +208,13 @@ struct media_entity_desc {
 #define MEDIA_PAD_FL_SINK			(1U << 0)
 #define MEDIA_PAD_FL_SOURCE			(1U << 1)
 #define MEDIA_PAD_FL_MUST_CONNECT		(1U << 2)
+#if defined(__KERNEL__)
+/*
+ * Forgo INTERNAL pads until proper documentation and v4l2-compliance testing is

s/is$/are/

Quoted 7 lines
include/uapi/linux/media.h +3 -0
+ * merged.
+ */
 #define MEDIA_PAD_FL_INTERNAL			(1U << 3)
+#endif /* __KERNEL__ */
 
 struct media_pad_desc {
 	__u32 entity;		/* entity ID */
Signature · 3 lines
Regards,

Laurent Pinchart
Reviewed-by on v1 1/2
#3 lore raw

Re: [PATCH 1/2] media: mc: Keep INTERNAL pad flags just for the kernel, for now

In reply to Sakari Ailus
Quoted 5 lines · Sakari Ailus

Do not expose INTERNAL pads on UAPI as the documentation nor v4l2-compliance changes to support MEDIA_PAD_FL_INTERNAL pads has not yet been merged.

Regards,

Hans

Quoted 22 lines
---
 include/uapi/linux/media.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/uapi/linux/media.h +6 -0
index 80cfd12a43fc..63e69a517987 100644
@@ -208,7 +208,13 @@ struct media_entity_desc {
 #define MEDIA_PAD_FL_SINK			(1U << 0)
 #define MEDIA_PAD_FL_SOURCE			(1U << 1)
 #define MEDIA_PAD_FL_MUST_CONNECT		(1U << 2)
+#if defined(__KERNEL__)
+/*
+ * Forgo INTERNAL pads until proper documentation and v4l2-compliance testing is
+ * merged.
+ */
 #define MEDIA_PAD_FL_INTERNAL			(1U << 3)
+#endif /* __KERNEL__ */
 
 struct media_pad_desc {
 	__u32 entity;		/* entity ID */
#5 lore raw

Re: [PATCH 2/2] media: maxim-serdes: Disable test pattern generator for now

In reply to Sakari Ailus
Quoted 14 lines · Sakari Ailus

Disable the test pattern generator that uses the INTERNAL pad flags for now.

---
 drivers/media/i2c/maxim-serdes/max_des.c | 3 +--
 drivers/media/i2c/maxim-serdes/max_ser.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/media/i2c/maxim-serdes/max_des.c +0 -0
index 1cbe4c3a3233..cb43edf7a9ae 100644

drivers/media/i2c/maxim-serdes/max_des.c static inline unsigned int max_des_phy_to_pad(struct max_des *des, · line 140

Quoted 6 lines
drivers/media/i2c/maxim-serdes/max_des.c +1 -2
@@ -137,8 +137,7 @@ static inline unsigned int max_des_phy_to_pad(struct max_des *des,
 
 static inline unsigned int max_des_num_pads(struct max_des *des)
 {
-	return des->info->num_links + des->info->num_phys +
-	       (des->ops->set_tpg ? 1 : 0);
+	return des->info->num_links + des->info->num_phys;

I think you need to add a comment here and also in max_ser.c.

E.g. something like this:

static inline unsigned int max_des_num_pads(struct max_des *des) {
return des->info->num_links + des->info->num_phys; /*
* TODO: once MEDIA_PAD_FL_INTERNAL is enabled in the uAPI we
* can add the TPG pad:
* return des->info->num_links + des->info->num_phys +
* (des->ops->set_tpg ? 1 : 0);
*/
}

That way it is actually recorded in the source why the tpg pad is currently not added and what to do to add it back.

Regards,

Hans

Quoted 17 lines
drivers/media/i2c/maxim-serdes/max_des.c +0 -0
 }
 
 static struct max_des_phy *max_des_pad_to_phy(struct max_des *des, u32 pad)
drivers/media/i2c/maxim-serdes/max_ser.c +1 -2
index e9bb722ea22f..c8dd5c3d352c 100644
@@ -90,8 +90,7 @@ static inline unsigned int max_ser_phy_to_pad(struct max_ser *ser,
 
 static inline unsigned int max_ser_num_pads(struct max_ser *ser)
 {
-	return ser->ops->num_phys + MAX_SER_NUM_LINKS +
-	       (ser->ops->set_tpg ? 1 : 0);
+	return ser->ops->num_phys + MAX_SER_NUM_LINKS;
 }
 
 static struct max_ser_phy *max_ser_pad_to_phy(struct max_ser *ser, u32 pad)
author maintainer
#6 lore raw

Re: [PATCH 2/2] media: maxim-serdes: Disable test pattern generator for now

Hi Hans,

Quoted 37 lines · Hans Verkuil
Quoted 14 lines · Sakari Ailus

Disable the test pattern generator that uses the INTERNAL pad flags for now.

---
 drivers/media/i2c/maxim-serdes/max_des.c | 3 +--
 drivers/media/i2c/maxim-serdes/max_ser.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/media/i2c/maxim-serdes/max_des.c +0 -0
index 1cbe4c3a3233..cb43edf7a9ae 100644

drivers/media/i2c/maxim-serdes/max_des.c static inline unsigned int max_des_phy_to_pad(struct max_des *des, · line 140

Quoted 6 lines
drivers/media/i2c/maxim-serdes/max_des.c +1 -2
@@ -137,8 +137,7 @@ static inline unsigned int max_des_phy_to_pad(struct max_des *des,
 
 static inline unsigned int max_des_num_pads(struct max_des *des)
 {
-	return des->info->num_links + des->info->num_phys +
-	       (des->ops->set_tpg ? 1 : 0);
+	return des->info->num_links + des->info->num_phys;

I think you need to add a comment here and also in max_ser.c.

E.g. something like this:

static inline unsigned int max_des_num_pads(struct max_des *des) {
return des->info->num_links + des->info->num_phys; /*
* TODO: once MEDIA_PAD_FL_INTERNAL is enabled in the uAPI we
* can add the TPG pad:
* return des->info->num_links + des->info->num_phys +
* (des->ops->set_tpg ? 1 : 0);
*/
}

Quoted 2 lines

That way it is actually recorded in the source why the tpg pad is currently not added and what to do to add it back.

I'm adding the reverts of the two patches to my metadata series. I can add a comment here, too, if you wish.

Signature · 3 lines
Regards,

Sakari Ailus