Skip to contentSkip to conversation

staging: media: rkisp1: make links immutable by default

PATCH In review Helen Koike 2 participants 3 messages Jan 17, 2020 – Jan 19, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: media: rkisp1: make links immutable by default

The only places which make sese to allow users to enable or disable links are:

* between sensors and isp:
So users can select which sensor should be used while streaming

* between isp and the resizers:

              |
              v here
rkisp1_isp:2 -> rkisp1_resizer_mainpath -> rkisp1_mainpath (capture)
            \-> rkisp1_resizer_selfpath -> rkisp1_selfpath (capture)
              ^ here
              |

So users can disable one of the capture paths when unused, to avoid worring about matching formats.

Make the following links immutable to simplify userspace:

rkisp1_resizer_mainpath -> rkisp1_mainpath
rkisp1_resizer_selfpath -> rkisp1_selfpath
rkisp1_params -> rkisp1_isp
rkisp1_isp -> rkisp1_stats

---
This is the topology graph after disabling all the links with media -r
http://col.la/rkisp1immutable

Dashed links are the only one can can be enabled/disabled, the others are immutable.

 drivers/staging/media/rkisp1/rkisp1-dev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/media/rkisp1/rkisp1-dev.c +3 -2
index 558126e66465..4030d5e71af1 100644
@@ -145,14 +145,15 @@ static int rkisp1_create_links(struct rkisp1_device *rkisp1)
 		flags = 0;
 	}
 
-	flags = MEDIA_LNK_FL_ENABLED;
+	flags = MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE;
 
 	/* create ISP->RSZ->CAP links */
 	for (i = 0; i < 2; i++) {
 		source = &rkisp1->isp.sd.entity;
 		sink = &rkisp1->resizer_devs[i].sd.entity;
 		ret = media_create_pad_link(source, RKISP1_ISP_PAD_SOURCE_VIDEO,
-					    sink, RKISP1_RSZ_PAD_SINK, flags);
+					    sink, RKISP1_RSZ_PAD_SINK,
+					    MEDIA_LNK_FL_ENABLED);
 		if (ret)
 			return ret;
 
Signature · 1 line
2.24.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Helen,

Thanks for your work.

Quoted 42 lines · Helen Koike

The only places which make sese to allow users to enable or disable links are:

* between sensors and isp:
So users can select which sensor should be used while streaming

* between isp and the resizers:

              |
              v here
rkisp1_isp:2 -> rkisp1_resizer_mainpath -> rkisp1_mainpath (capture)
            \-> rkisp1_resizer_selfpath -> rkisp1_selfpath (capture)
              ^ here
              |

So users can disable one of the capture paths when unused, to avoid worring about matching formats.

Make the following links immutable to simplify userspace:

rkisp1_resizer_mainpath -> rkisp1_mainpath
rkisp1_resizer_selfpath -> rkisp1_selfpath
rkisp1_params -> rkisp1_isp
rkisp1_isp -> rkisp1_stats

---
This is the topology graph after disabling all the links with media -r
http://col.la/rkisp1immutable

Dashed links are the only one can can be enabled/disabled, the others are immutable.

 drivers/staging/media/rkisp1/rkisp1-dev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/media/rkisp1/rkisp1-dev.c +0 -0
index 558126e66465..4030d5e71af1 100644

drivers/staging/media/rkisp1/rkisp1-dev.c static int rkisp1_create_links(struct rkisp1_device *rkisp1) · line 153

Quoted 10 lines
drivers/staging/media/rkisp1/rkisp1-dev.c +1 -1
@@ -145,14 +145,15 @@ static int rkisp1_create_links(struct rkisp1_device *rkisp1)
 		flags = 0;
 	}
 
-	flags = MEDIA_LNK_FL_ENABLED;
+	flags = MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE;
 
 	/* create ISP->RSZ->CAP links */
 	for (i = 0; i < 2; i++) {
 		source = &rkisp1->isp.sd.entity;
 		sink = &rkisp1->resizer_devs[i].sd.entity;

nit: To keep with the style of the rest of the function I would set flags here and once more bellow in the same loop.

With or without this fixed,

Quoted 10 lines
drivers/staging/media/rkisp1/rkisp1-dev.c +2 -1
 		ret = media_create_pad_link(source, RKISP1_ISP_PAD_SOURCE_VIDEO,
-					    sink, RKISP1_RSZ_PAD_SINK, flags);
+					    sink, RKISP1_RSZ_PAD_SINK,
+					    MEDIA_LNK_FL_ENABLED);
 		if (ret)
 			return ret;
 
Signature · 1 line
2.24.0
Signature · 2 lines
Regards,
Niklas Söderlund
#2 lore raw
Quoted 53 lines · Niklas Söderlund

Hi Helen,

Thanks for your work.

Quoted 48 lines · Helen Koike

The only places which make sese to allow users to enable or disable links are:

* between sensors and isp:
So users can select which sensor should be used while streaming

* between isp and the resizers:

              |
              v here
rkisp1_isp:2 -> rkisp1_resizer_mainpath -> rkisp1_mainpath (capture)
            \-> rkisp1_resizer_selfpath -> rkisp1_selfpath (capture)
              ^ here
              |

So users can disable one of the capture paths when unused, to avoid worring about matching formats.

Make the following links immutable to simplify userspace:

rkisp1_resizer_mainpath -> rkisp1_mainpath
rkisp1_resizer_selfpath -> rkisp1_selfpath
rkisp1_params -> rkisp1_isp
rkisp1_isp -> rkisp1_stats

---
This is the topology graph after disabling all the links with media -r
http://col.la/rkisp1immutable

Dashed links are the only one can can be enabled/disabled, the others are immutable.

 drivers/staging/media/rkisp1/rkisp1-dev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/media/rkisp1/rkisp1-dev.c +1 -1
index 558126e66465..4030d5e71af1 100644
@@ -145,14 +145,15 @@ static int rkisp1_create_links(struct rkisp1_device *rkisp1)
 		flags = 0;
 	}
 
-	flags = MEDIA_LNK_FL_ENABLED;
+	flags = MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE;
 
Quoted 7 lines

drivers/staging/media/rkisp1/rkisp1-dev.c static int rkisp1_create_links(struct rkisp1_device *rkisp1) · line 153

Quoted 4 lines
drivers/staging/media/rkisp1/rkisp1-dev.c +0 -0
 	/* create ISP->RSZ->CAP links */
 	for (i = 0; i < 2; i++) {
 		source = &rkisp1->isp.sd.entity;
 		sink = &rkisp1->resizer_devs[i].sd.entity;

nit: To keep with the style of the rest of the function I would set flags here and once more bellow in the same loop.

Do you mean this: http://ix.io/27Pm ?
hmm, I don't see why to assign flags inside the loop.
the previous loop is a different case, since it sets the link to the first sensor as enabled, but the other sensor links are disabled (in case there are more then one link).

Quoted 4 lines

With or without this fixed,

Thanks,
Helen

Quoted 12 lines
Quoted 11 lines
drivers/staging/media/rkisp1/rkisp1-dev.c +2 -1
 		ret = media_create_pad_link(source, RKISP1_ISP_PAD_SOURCE_VIDEO,
-					    sink, RKISP1_RSZ_PAD_SINK, flags);
+					    sink, RKISP1_RSZ_PAD_SINK,
+					    MEDIA_LNK_FL_ENABLED);
 		if (ret)
 			return ret;
 
Signature · 1 line
2.24.0