* [PATCH] media: i2c: ov7740: implement get_mbus_config @ 2021-11-02 15:30 Eugen Hristev 2021-11-03 8:08 ` Sakari Ailus 0 siblings, 1 reply; 5+ messages in thread From: Eugen Hristev @ 2021-11-02 15:30 UTC (permalink / raw) To: akinobu.mita, linux-media, linux-kernel; +Cc: sakari.ailus, Eugen Hristev Implement the get_mbus_config callback. ov7740 is a parallel sensor, and according to datasheet, the register REG12 controls the CCIR656 mode. This register is written to 0 in yuyv mode. According to REG12[5] , CCIR656 mode, the behavior is: CCIR656: disabled REG28 controls the polarity of the signals. This register is unused. The default behavior is then: HSYNC polarity : positive VSYNC polarity : positive HREF polarity: positive Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com> --- drivers/media/i2c/ov7740.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c index 2539cfee85c8..f8a717aecb6f 100644 --- a/drivers/media/i2c/ov7740.c +++ b/drivers/media/i2c/ov7740.c @@ -873,12 +873,26 @@ static int ov7740_get_fmt(struct v4l2_subdev *sd, return ret; } +static int ov7740_get_mbus_config(struct v4l2_subdev *sd, + unsigned int pad, + struct v4l2_mbus_config *cfg) +{ + cfg->type = V4L2_MBUS_PARALLEL; + cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_HSYNC_ACTIVE_HIGH | + V4L2_MBUS_VSYNC_ACTIVE_HIGH | + V4L2_MBUS_PCLK_SAMPLE_RISING | + V4L2_MBUS_FIELD_EVEN_LOW | V4L2_MBUS_DATA_ACTIVE_HIGH; + + return 0; +} + static const struct v4l2_subdev_pad_ops ov7740_subdev_pad_ops = { .enum_frame_interval = ov7740_enum_frame_interval, .enum_frame_size = ov7740_enum_frame_size, .enum_mbus_code = ov7740_enum_mbus_code, .get_fmt = ov7740_get_fmt, .set_fmt = ov7740_set_fmt, + .get_mbus_config = ov7740_get_mbus_config, }; static const struct v4l2_subdev_ops ov7740_subdev_ops = { -- 2.25.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] media: i2c: ov7740: implement get_mbus_config 2021-11-02 15:30 [PATCH] media: i2c: ov7740: implement get_mbus_config Eugen Hristev @ 2021-11-03 8:08 ` Sakari Ailus 2021-11-03 12:39 ` Eugen.Hristev 0 siblings, 1 reply; 5+ messages in thread From: Sakari Ailus @ 2021-11-03 8:08 UTC (permalink / raw) To: Eugen Hristev; +Cc: akinobu.mita, linux-media, linux-kernel Hi Eugen, Thanks for the patch. On Tue, Nov 02, 2021 at 05:30:08PM +0200, Eugen Hristev wrote: > Implement the get_mbus_config callback. > ov7740 is a parallel sensor, and according to datasheet, the register > REG12 controls the CCIR656 mode. This register is written to 0 in yuyv mode. > According to REG12[5] , CCIR656 mode, the behavior is: > CCIR656: disabled > REG28 controls the polarity of the signals. This register is unused. > The default behavior is then: > HSYNC polarity : positive > VSYNC polarity : positive > HREF polarity: positive > Doesn't the receiver driver get this information from DT? > Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com> > --- > drivers/media/i2c/ov7740.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c > index 2539cfee85c8..f8a717aecb6f 100644 > --- a/drivers/media/i2c/ov7740.c > +++ b/drivers/media/i2c/ov7740.c > @@ -873,12 +873,26 @@ static int ov7740_get_fmt(struct v4l2_subdev *sd, > return ret; > } > > +static int ov7740_get_mbus_config(struct v4l2_subdev *sd, > + unsigned int pad, > + struct v4l2_mbus_config *cfg) > +{ > + cfg->type = V4L2_MBUS_PARALLEL; > + cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_HSYNC_ACTIVE_HIGH | > + V4L2_MBUS_VSYNC_ACTIVE_HIGH | > + V4L2_MBUS_PCLK_SAMPLE_RISING | > + V4L2_MBUS_FIELD_EVEN_LOW | V4L2_MBUS_DATA_ACTIVE_HIGH; > + > + return 0; > +} > + > static const struct v4l2_subdev_pad_ops ov7740_subdev_pad_ops = { > .enum_frame_interval = ov7740_enum_frame_interval, > .enum_frame_size = ov7740_enum_frame_size, > .enum_mbus_code = ov7740_enum_mbus_code, > .get_fmt = ov7740_get_fmt, > .set_fmt = ov7740_set_fmt, > + .get_mbus_config = ov7740_get_mbus_config, > }; > > static const struct v4l2_subdev_ops ov7740_subdev_ops = { -- Regards, Sakari Ailus ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: i2c: ov7740: implement get_mbus_config 2021-11-03 8:08 ` Sakari Ailus @ 2021-11-03 12:39 ` Eugen.Hristev 2021-11-03 13:46 ` Jacopo Mondi 2021-11-03 14:17 ` Sakari Ailus 0 siblings, 2 replies; 5+ messages in thread From: Eugen.Hristev @ 2021-11-03 12:39 UTC (permalink / raw) To: sakari.ailus; +Cc: akinobu.mita, linux-media, linux-kernel, jacopo On 11/3/21 10:08 AM, Sakari Ailus wrote: > Hi Eugen, > > Thanks for the patch. > > On Tue, Nov 02, 2021 at 05:30:08PM +0200, Eugen Hristev wrote: >> Implement the get_mbus_config callback. >> ov7740 is a parallel sensor, and according to datasheet, the register >> REG12 controls the CCIR656 mode. This register is written to 0 in yuyv mode. >> According to REG12[5] , CCIR656 mode, the behavior is: >> CCIR656: disabled >> REG28 controls the polarity of the signals. This register is unused. >> The default behavior is then: >> HSYNC polarity : positive >> VSYNC polarity : positive >> HREF polarity: positive >> > > Doesn't the receiver driver get this information from DT? > Hi Sakari, This patch comes as a result of my discussions with Jacopo, he advised to get mbus configuration via the get_mbus_config . I agree that this information can be taken from DT as you said. In the end , my understanding is that get_mbus_config should be used only for runtime configuration which can change. Thus, if all this information is static, then, I will proceed with obtaining it from DT, and you can disregard this patch, as it is not useful. Thanks, Eugen >> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com> >> --- >> drivers/media/i2c/ov7740.c | 14 ++++++++++++++ >> 1 file changed, 14 insertions(+) >> >> diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c >> index 2539cfee85c8..f8a717aecb6f 100644 >> --- a/drivers/media/i2c/ov7740.c >> +++ b/drivers/media/i2c/ov7740.c >> @@ -873,12 +873,26 @@ static int ov7740_get_fmt(struct v4l2_subdev *sd, >> return ret; >> } >> >> +static int ov7740_get_mbus_config(struct v4l2_subdev *sd, >> + unsigned int pad, >> + struct v4l2_mbus_config *cfg) >> +{ >> + cfg->type = V4L2_MBUS_PARALLEL; >> + cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_HSYNC_ACTIVE_HIGH | >> + V4L2_MBUS_VSYNC_ACTIVE_HIGH | >> + V4L2_MBUS_PCLK_SAMPLE_RISING | >> + V4L2_MBUS_FIELD_EVEN_LOW | V4L2_MBUS_DATA_ACTIVE_HIGH; >> + >> + return 0; >> +} >> + >> static const struct v4l2_subdev_pad_ops ov7740_subdev_pad_ops = { >> .enum_frame_interval = ov7740_enum_frame_interval, >> .enum_frame_size = ov7740_enum_frame_size, >> .enum_mbus_code = ov7740_enum_mbus_code, >> .get_fmt = ov7740_get_fmt, >> .set_fmt = ov7740_set_fmt, >> + .get_mbus_config = ov7740_get_mbus_config, >> }; >> >> static const struct v4l2_subdev_ops ov7740_subdev_ops = { > > -- > Regards, > > Sakari Ailus > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: i2c: ov7740: implement get_mbus_config 2021-11-03 12:39 ` Eugen.Hristev @ 2021-11-03 13:46 ` Jacopo Mondi 2021-11-03 14:17 ` Sakari Ailus 1 sibling, 0 replies; 5+ messages in thread From: Jacopo Mondi @ 2021-11-03 13:46 UTC (permalink / raw) To: Eugen.Hristev; +Cc: sakari.ailus, akinobu.mita, linux-media, linux-kernel Hello, for a bit more of context On Wed, Nov 03, 2021 at 12:39:52PM +0000, Eugen.Hristev@microchip.com wrote: > On 11/3/21 10:08 AM, Sakari Ailus wrote: > > Hi Eugen, > > > > Thanks for the patch. > > > > On Tue, Nov 02, 2021 at 05:30:08PM +0200, Eugen Hristev wrote: > >> Implement the get_mbus_config callback. > >> ov7740 is a parallel sensor, and according to datasheet, the register > >> REG12 controls the CCIR656 mode. This register is written to 0 in yuyv mode. > >> According to REG12[5] , CCIR656 mode, the behavior is: > >> CCIR656: disabled > >> REG28 controls the polarity of the signals. This register is unused. > >> The default behavior is then: > >> HSYNC polarity : positive > >> VSYNC polarity : positive > >> HREF polarity: positive > >> > > > > Doesn't the receiver driver get this information from DT? > > > > Hi Sakari, > > This patch comes as a result of my discussions with Jacopo, he advised > to get mbus configuration via the get_mbus_config . I agree that this That's where getting info at runtime was suggested https://patchwork.linuxtv.org/project/linux-media/patch/20200826065142.205000-1-eugen.hristev@microchip.com/#122336 > information can be taken from DT as you said. > In the end , my understanding is that get_mbus_config should be used > only for runtime configuration which can change. > Thus, if all this information is static, then, I will proceed with > obtaining it from DT, and you can disregard this patch, as it is not useful. And the latest comment where getting it from DTS was suggested https://patchwork.linuxtv.org/project/linux-media/patch/20211022075247.518880-4-eugen.hristev@microchip.com/#132605 Thanks j > > Thanks, > Eugen > > >> Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com> > >> --- > >> drivers/media/i2c/ov7740.c | 14 ++++++++++++++ > >> 1 file changed, 14 insertions(+) > >> > >> diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c > >> index 2539cfee85c8..f8a717aecb6f 100644 > >> --- a/drivers/media/i2c/ov7740.c > >> +++ b/drivers/media/i2c/ov7740.c > >> @@ -873,12 +873,26 @@ static int ov7740_get_fmt(struct v4l2_subdev *sd, > >> return ret; > >> } > >> > >> +static int ov7740_get_mbus_config(struct v4l2_subdev *sd, > >> + unsigned int pad, > >> + struct v4l2_mbus_config *cfg) > >> +{ > >> + cfg->type = V4L2_MBUS_PARALLEL; > >> + cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_HSYNC_ACTIVE_HIGH | > >> + V4L2_MBUS_VSYNC_ACTIVE_HIGH | > >> + V4L2_MBUS_PCLK_SAMPLE_RISING | > >> + V4L2_MBUS_FIELD_EVEN_LOW | V4L2_MBUS_DATA_ACTIVE_HIGH; > >> + > >> + return 0; > >> +} > >> + > >> static const struct v4l2_subdev_pad_ops ov7740_subdev_pad_ops = { > >> .enum_frame_interval = ov7740_enum_frame_interval, > >> .enum_frame_size = ov7740_enum_frame_size, > >> .enum_mbus_code = ov7740_enum_mbus_code, > >> .get_fmt = ov7740_get_fmt, > >> .set_fmt = ov7740_set_fmt, > >> + .get_mbus_config = ov7740_get_mbus_config, > >> }; > >> > >> static const struct v4l2_subdev_ops ov7740_subdev_ops = { > > > > -- > > Regards, > > > > Sakari Ailus > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: i2c: ov7740: implement get_mbus_config 2021-11-03 12:39 ` Eugen.Hristev 2021-11-03 13:46 ` Jacopo Mondi @ 2021-11-03 14:17 ` Sakari Ailus 1 sibling, 0 replies; 5+ messages in thread From: Sakari Ailus @ 2021-11-03 14:17 UTC (permalink / raw) To: Eugen.Hristev; +Cc: akinobu.mita, linux-media, linux-kernel, jacopo On Wed, Nov 03, 2021 at 12:39:52PM +0000, Eugen.Hristev@microchip.com wrote: > On 11/3/21 10:08 AM, Sakari Ailus wrote: > > Hi Eugen, > > > > Thanks for the patch. > > > > On Tue, Nov 02, 2021 at 05:30:08PM +0200, Eugen Hristev wrote: > >> Implement the get_mbus_config callback. > >> ov7740 is a parallel sensor, and according to datasheet, the register > >> REG12 controls the CCIR656 mode. This register is written to 0 in yuyv mode. > >> According to REG12[5] , CCIR656 mode, the behavior is: > >> CCIR656: disabled > >> REG28 controls the polarity of the signals. This register is unused. > >> The default behavior is then: > >> HSYNC polarity : positive > >> VSYNC polarity : positive > >> HREF polarity: positive > >> > > > > Doesn't the receiver driver get this information from DT? > > > > Hi Sakari, > > This patch comes as a result of my discussions with Jacopo, he advised > to get mbus configuration via the get_mbus_config . I agree that this > information can be taken from DT as you said. > In the end , my understanding is that get_mbus_config should be used > only for runtime configuration which can change. > Thus, if all this information is static, then, I will proceed with > obtaining it from DT, and you can disregard this patch, as it is not useful. Yes, please. Getting this from DT is preferred if no dynamic configuration is needed. -- Sakari Ailus ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-11-03 14:17 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-11-02 15:30 [PATCH] media: i2c: ov7740: implement get_mbus_config Eugen Hristev 2021-11-03 8:08 ` Sakari Ailus 2021-11-03 12:39 ` Eugen.Hristev 2021-11-03 13:46 ` Jacopo Mondi 2021-11-03 14:17 ` Sakari Ailus
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.