Message ID | 1607022002-26575-11-git-send-email-skomatineni@nvidia.com |
---|---|
State | New |
Headers | show |
Series | tegra-video: Add support for capturing from HDMI-to-CSI bridge | expand |
On Thu, Dec 03, 2020 at 10:59:59AM -0800, Sowjanya Komatineni wrote: > Some CSI2 receivers support 8 data lanes. > > So, this patch updates CSI2 maximum data lanes to be 8. > > Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
On 03/12/2020 19:59, Sowjanya Komatineni wrote: > Some CSI2 receivers support 8 data lanes. > > So, this patch updates CSI2 maximum data lanes to be 8. > > Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com> > --- > drivers/media/platform/ti-vpe/cal-camerarx.c | 2 +- > include/media/v4l2-fwnode.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/platform/ti-vpe/cal-camerarx.c b/drivers/media/platform/ti-vpe/cal-camerarx.c > index 806cbf1..47e2143 100644 > --- a/drivers/media/platform/ti-vpe/cal-camerarx.c > +++ b/drivers/media/platform/ti-vpe/cal-camerarx.c > @@ -534,7 +534,7 @@ static int cal_camerarx_parse_dt(struct cal_camerarx *phy) > { > struct v4l2_fwnode_endpoint *endpoint = &phy->endpoint; > struct device_node *ep_node; > - char data_lanes[V4L2_FWNODE_CSI2_MAX_DATA_LANES * 2]; > + char data_lanes[V4L2_FWNODE_CSI2_MAX_DATA_LANES]; > unsigned int i; > int ret; > I'm not so sure about this change: it relies on the implicit knowledge that this cal driver can handle only 4 lanes max, so that doubling V4L2_FWNODE_CSI2_MAX_DATA_LANES is the same as the old 'V4L2_FWNODE_CSI2_MAX_DATA_LANES * 2'. I think we should either keep the existing code (which means data_lanes is now larger than needed, so stack usage increases by 8 bytes), or perhaps create a new define for this driver like CAL_MAX_DATA_LANES and use that. In my opinion the original code should just be kept, but I've CC-ed Laurent on this to hear what he thinks. Regards, Hans > diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h > index 4e1f6e1d..92401c1 100644 > --- a/include/media/v4l2-fwnode.h > +++ b/include/media/v4l2-fwnode.h > @@ -25,7 +25,7 @@ struct fwnode_handle; > struct v4l2_async_notifier; > struct v4l2_async_subdev; > > -#define V4L2_FWNODE_CSI2_MAX_DATA_LANES 4 > +#define V4L2_FWNODE_CSI2_MAX_DATA_LANES 8 > > /** > * struct v4l2_fwnode_bus_mipi_csi2 - MIPI CSI-2 bus data structure >
Hi Hans, On Mon, Dec 07, 2020 at 11:47:38AM +0100, Hans Verkuil wrote: > On 03/12/2020 19:59, Sowjanya Komatineni wrote: > > Some CSI2 receivers support 8 data lanes. > > > > So, this patch updates CSI2 maximum data lanes to be 8. > > > > Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com> > > --- > > drivers/media/platform/ti-vpe/cal-camerarx.c | 2 +- > > include/media/v4l2-fwnode.h | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/media/platform/ti-vpe/cal-camerarx.c b/drivers/media/platform/ti-vpe/cal-camerarx.c > > index 806cbf1..47e2143 100644 > > --- a/drivers/media/platform/ti-vpe/cal-camerarx.c > > +++ b/drivers/media/platform/ti-vpe/cal-camerarx.c > > @@ -534,7 +534,7 @@ static int cal_camerarx_parse_dt(struct cal_camerarx *phy) > > { > > struct v4l2_fwnode_endpoint *endpoint = &phy->endpoint; > > struct device_node *ep_node; > > - char data_lanes[V4L2_FWNODE_CSI2_MAX_DATA_LANES * 2]; > > + char data_lanes[V4L2_FWNODE_CSI2_MAX_DATA_LANES]; > > unsigned int i; > > int ret; > > > > I'm not so sure about this change: it relies on the implicit knowledge that > this cal driver can handle only 4 lanes max, so that doubling > V4L2_FWNODE_CSI2_MAX_DATA_LANES is the same as the old 'V4L2_FWNODE_CSI2_MAX_DATA_LANES * 2'. > > I think we should either keep the existing code (which means data_lanes > is now larger than needed, so stack usage increases by 8 bytes), or perhaps > create a new define for this driver like CAL_MAX_DATA_LANES and use that. > > In my opinion the original code should just be kept, but I've CC-ed Laurent > on this to hear what he thinks. I further looked at the code there and it does *depend* on a particular value of V4L2_FWNODE_CSI2_MAX_DATA_LANES. That needs to be fixed. This part can (or should) be dropped from the patch though. -- Regards, Sakari Ailus
On 12/8/20 11:59 AM, Sakari Ailus wrote: > Hi Hans, > > On Mon, Dec 07, 2020 at 11:47:38AM +0100, Hans Verkuil wrote: >> On 03/12/2020 19:59, Sowjanya Komatineni wrote: >>> Some CSI2 receivers support 8 data lanes. >>> >>> So, this patch updates CSI2 maximum data lanes to be 8. >>> >>> Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com> >>> --- >>> drivers/media/platform/ti-vpe/cal-camerarx.c | 2 +- >>> include/media/v4l2-fwnode.h | 2 +- >>> 2 files changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/media/platform/ti-vpe/cal-camerarx.c b/drivers/media/platform/ti-vpe/cal-camerarx.c >>> index 806cbf1..47e2143 100644 >>> --- a/drivers/media/platform/ti-vpe/cal-camerarx.c >>> +++ b/drivers/media/platform/ti-vpe/cal-camerarx.c >>> @@ -534,7 +534,7 @@ static int cal_camerarx_parse_dt(struct cal_camerarx *phy) >>> { >>> struct v4l2_fwnode_endpoint *endpoint = &phy->endpoint; >>> struct device_node *ep_node; >>> - char data_lanes[V4L2_FWNODE_CSI2_MAX_DATA_LANES * 2]; >>> + char data_lanes[V4L2_FWNODE_CSI2_MAX_DATA_LANES]; >>> unsigned int i; >>> int ret; >>> >> I'm not so sure about this change: it relies on the implicit knowledge that >> this cal driver can handle only 4 lanes max, so that doubling >> V4L2_FWNODE_CSI2_MAX_DATA_LANES is the same as the old 'V4L2_FWNODE_CSI2_MAX_DATA_LANES * 2'. >> >> I think we should either keep the existing code (which means data_lanes >> is now larger than needed, so stack usage increases by 8 bytes), or perhaps >> create a new define for this driver like CAL_MAX_DATA_LANES and use that. >> >> In my opinion the original code should just be kept, but I've CC-ed Laurent >> on this to hear what he thinks. > I further looked at the code there and it does *depend* on a particular > value of V4L2_FWNODE_CSI2_MAX_DATA_LANES. That needs to be fixed. This part > can (or should) be dropped from the patch though. > Thanks Sakari and Hans. OK. Will drop updating cal-camerarx.c from this patch in next version.
diff --git a/drivers/media/platform/ti-vpe/cal-camerarx.c b/drivers/media/platform/ti-vpe/cal-camerarx.c index 806cbf1..47e2143 100644 --- a/drivers/media/platform/ti-vpe/cal-camerarx.c +++ b/drivers/media/platform/ti-vpe/cal-camerarx.c @@ -534,7 +534,7 @@ static int cal_camerarx_parse_dt(struct cal_camerarx *phy) { struct v4l2_fwnode_endpoint *endpoint = &phy->endpoint; struct device_node *ep_node; - char data_lanes[V4L2_FWNODE_CSI2_MAX_DATA_LANES * 2]; + char data_lanes[V4L2_FWNODE_CSI2_MAX_DATA_LANES]; unsigned int i; int ret; diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h index 4e1f6e1d..92401c1 100644 --- a/include/media/v4l2-fwnode.h +++ b/include/media/v4l2-fwnode.h @@ -25,7 +25,7 @@ struct fwnode_handle; struct v4l2_async_notifier; struct v4l2_async_subdev; -#define V4L2_FWNODE_CSI2_MAX_DATA_LANES 4 +#define V4L2_FWNODE_CSI2_MAX_DATA_LANES 8 /** * struct v4l2_fwnode_bus_mipi_csi2 - MIPI CSI-2 bus data structure
Some CSI2 receivers support 8 data lanes. So, this patch updates CSI2 maximum data lanes to be 8. Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com> --- drivers/media/platform/ti-vpe/cal-camerarx.c | 2 +- include/media/v4l2-fwnode.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)