Re: [PATCH v3 1/3] media: mt9m111: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
2019年1月28日(月) 17:34 Sakari Ailus : > > Hi Mita-san, Marco, > > On Sun, Jan 27, 2019 at 09:29:30PM +0900, Akinobu Mita wrote: > > 2019年1月24日(木) 0:17 Marco Felsch : > > > > > > Hi Akinobu, > > > > > > sorry for the delayed response. > > > > > > On 19-01-15 23:05, Akinobu Mita wrote: > > > > The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize > > > > V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE > > > > is specified. > > > > > > > > Cc: Enrico Scholz > > > > Cc: Michael Grzeschik > > > > Cc: Marco Felsch > > > > Cc: Sakari Ailus > > > > Cc: Mauro Carvalho Chehab > > > > Signed-off-by: Akinobu Mita > > > > --- > > > > * v3 > > > > - Set initial try format with default configuration instead of > > > > current one. > > > > > > > > drivers/media/i2c/mt9m111.c | 30 ++ > > > > 1 file changed, 30 insertions(+) > > > > > > > > diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c > > > > index d639b9b..63a5253 100644 > > > > --- a/drivers/media/i2c/mt9m111.c > > > > +++ b/drivers/media/i2c/mt9m111.c > > > > @@ -528,6 +528,16 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd, > > > > if (format->pad) > > > > return -EINVAL; > > > > > > > > + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { > > > > +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API > > > > + mf = v4l2_subdev_get_try_format(sd, cfg, format->pad); > > > > + format->format = *mf; > > > > + return 0; > > > > +#else > > > > + return -ENOTTY; > > > > +#endif > > > > > > If've checked this again and found the ov* devices do this too. IMO it's > > > not good for other developers to check the upper layer if the '#else' > > > path is reachable. There are also some code analyzer tools which will > > > report this as issue/warning. > > > > > > As I said, I checked the v4l2_subdev_get_try_format() usage again and > > > found the solution made by the mt9v111.c better. Why do you don't add a > > > dependency in the Kconfig, so we can drop this ifdef? > > > > I'm ok with adding CONFIG_VIDEO_V4L2_SUBDEV_API dependency to this > > driver, because I always enable it. > > > > But it may cause an issue on some environments that don't require > > CONFIG_VIDEO_V4L2_SUBDEV_API. > > > > Sakari, do you have any opinion? > > I think the dependency is just fine. There are drivers that do not support > MC (and V4L2 sub-device uAPI) but if a driver does, I don't see why it > couldn't depend on the related Kconfig option. OK. I'll prepare a patch that adds the dependency and removes the ifdef. I made similar change for ov2640, so I'll do for mt9m111 and ov2640, respectively.
Re: [PATCH v3 1/3] media: mt9m111: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
Hi Mita-san, Marco, On Sun, Jan 27, 2019 at 09:29:30PM +0900, Akinobu Mita wrote: > 2019年1月24日(木) 0:17 Marco Felsch : > > > > Hi Akinobu, > > > > sorry for the delayed response. > > > > On 19-01-15 23:05, Akinobu Mita wrote: > > > The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize > > > V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE > > > is specified. > > > > > > Cc: Enrico Scholz > > > Cc: Michael Grzeschik > > > Cc: Marco Felsch > > > Cc: Sakari Ailus > > > Cc: Mauro Carvalho Chehab > > > Signed-off-by: Akinobu Mita > > > --- > > > * v3 > > > - Set initial try format with default configuration instead of > > > current one. > > > > > > drivers/media/i2c/mt9m111.c | 30 ++ > > > 1 file changed, 30 insertions(+) > > > > > > diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c > > > index d639b9b..63a5253 100644 > > > --- a/drivers/media/i2c/mt9m111.c > > > +++ b/drivers/media/i2c/mt9m111.c > > > @@ -528,6 +528,16 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd, > > > if (format->pad) > > > return -EINVAL; > > > > > > + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { > > > +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API > > > + mf = v4l2_subdev_get_try_format(sd, cfg, format->pad); > > > + format->format = *mf; > > > + return 0; > > > +#else > > > + return -ENOTTY; > > > +#endif > > > > If've checked this again and found the ov* devices do this too. IMO it's > > not good for other developers to check the upper layer if the '#else' > > path is reachable. There are also some code analyzer tools which will > > report this as issue/warning. > > > > As I said, I checked the v4l2_subdev_get_try_format() usage again and > > found the solution made by the mt9v111.c better. Why do you don't add a > > dependency in the Kconfig, so we can drop this ifdef? > > I'm ok with adding CONFIG_VIDEO_V4L2_SUBDEV_API dependency to this > driver, because I always enable it. > > But it may cause an issue on some environments that don't require > CONFIG_VIDEO_V4L2_SUBDEV_API. > > Sakari, do you have any opinion? I think the dependency is just fine. There are drivers that do not support MC (and V4L2 sub-device uAPI) but if a driver does, I don't see why it couldn't depend on the related Kconfig option. -- Regards, Sakari Ailus sakari.ai...@linux.intel.com
Re: [PATCH v3 1/3] media: mt9m111: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
2019年1月24日(木) 0:17 Marco Felsch : > > Hi Akinobu, > > sorry for the delayed response. > > On 19-01-15 23:05, Akinobu Mita wrote: > > The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize > > V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE > > is specified. > > > > Cc: Enrico Scholz > > Cc: Michael Grzeschik > > Cc: Marco Felsch > > Cc: Sakari Ailus > > Cc: Mauro Carvalho Chehab > > Signed-off-by: Akinobu Mita > > --- > > * v3 > > - Set initial try format with default configuration instead of > > current one. > > > > drivers/media/i2c/mt9m111.c | 30 ++ > > 1 file changed, 30 insertions(+) > > > > diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c > > index d639b9b..63a5253 100644 > > --- a/drivers/media/i2c/mt9m111.c > > +++ b/drivers/media/i2c/mt9m111.c > > @@ -528,6 +528,16 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd, > > if (format->pad) > > return -EINVAL; > > > > + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { > > +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API > > + mf = v4l2_subdev_get_try_format(sd, cfg, format->pad); > > + format->format = *mf; > > + return 0; > > +#else > > + return -ENOTTY; > > +#endif > > If've checked this again and found the ov* devices do this too. IMO it's > not good for other developers to check the upper layer if the '#else' > path is reachable. There are also some code analyzer tools which will > report this as issue/warning. > > As I said, I checked the v4l2_subdev_get_try_format() usage again and > found the solution made by the mt9v111.c better. Why do you don't add a > dependency in the Kconfig, so we can drop this ifdef? I'm ok with adding CONFIG_VIDEO_V4L2_SUBDEV_API dependency to this driver, because I always enable it. But it may cause an issue on some environments that don't require CONFIG_VIDEO_V4L2_SUBDEV_API. Sakari, do you have any opinion?
Re: [PATCH v3 1/3] media: mt9m111: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
Hi Akinobu, sorry for the delayed response. On 19-01-15 23:05, Akinobu Mita wrote: > The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize > V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE > is specified. > > Cc: Enrico Scholz > Cc: Michael Grzeschik > Cc: Marco Felsch > Cc: Sakari Ailus > Cc: Mauro Carvalho Chehab > Signed-off-by: Akinobu Mita > --- > * v3 > - Set initial try format with default configuration instead of > current one. > > drivers/media/i2c/mt9m111.c | 30 ++ > 1 file changed, 30 insertions(+) > > diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c > index d639b9b..63a5253 100644 > --- a/drivers/media/i2c/mt9m111.c > +++ b/drivers/media/i2c/mt9m111.c > @@ -528,6 +528,16 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd, > if (format->pad) > return -EINVAL; > > + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { > +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API > + mf = v4l2_subdev_get_try_format(sd, cfg, format->pad); > + format->format = *mf; > + return 0; > +#else > + return -ENOTTY; > +#endif If've checked this again and found the ov* devices do this too. IMO it's not good for other developers to check the upper layer if the '#else' path is reachable. There are also some code analyzer tools which will report this as issue/warning. As I said, I checked the v4l2_subdev_get_try_format() usage again and found the solution made by the mt9v111.c better. Why do you don't add a dependency in the Kconfig, so we can drop this ifdef? Regards, Marco > + } > + > mf->width = mt9m111->width; > mf->height = mt9m111->height; > mf->code= mt9m111->fmt->code; > @@ -1089,6 +1099,25 @@ static int mt9m111_s_stream(struct v4l2_subdev *sd, > int enable) > return 0; > } > > +static int mt9m111_init_cfg(struct v4l2_subdev *sd, > + struct v4l2_subdev_pad_config *cfg) > +{ > +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API > + struct v4l2_mbus_framefmt *format = > + v4l2_subdev_get_try_format(sd, cfg, 0); > + > + format->width = MT9M111_MAX_WIDTH; > + format->height = MT9M111_MAX_HEIGHT; > + format->code= mt9m111_colour_fmts[0].code; > + format->colorspace = mt9m111_colour_fmts[0].colorspace; > + format->field = V4L2_FIELD_NONE; > + format->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; > + format->quantization= V4L2_QUANTIZATION_DEFAULT; > + format->xfer_func = V4L2_XFER_FUNC_DEFAULT; > +#endif > + return 0; > +} > + > static int mt9m111_g_mbus_config(struct v4l2_subdev *sd, > struct v4l2_mbus_config *cfg) > { > @@ -1114,6 +1143,7 @@ static const struct v4l2_subdev_video_ops > mt9m111_subdev_video_ops = { > }; > > static const struct v4l2_subdev_pad_ops mt9m111_subdev_pad_ops = { > + .init_cfg = mt9m111_init_cfg, > .enum_mbus_code = mt9m111_enum_mbus_code, > .get_selection = mt9m111_get_selection, > .set_selection = mt9m111_set_selection, > -- > 2.7.4 > >
[PATCH v3 1/3] media: mt9m111: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE is specified. Cc: Enrico Scholz Cc: Michael Grzeschik Cc: Marco Felsch Cc: Sakari Ailus Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- * v3 - Set initial try format with default configuration instead of current one. drivers/media/i2c/mt9m111.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c index d639b9b..63a5253 100644 --- a/drivers/media/i2c/mt9m111.c +++ b/drivers/media/i2c/mt9m111.c @@ -528,6 +528,16 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd, if (format->pad) return -EINVAL; + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API + mf = v4l2_subdev_get_try_format(sd, cfg, format->pad); + format->format = *mf; + return 0; +#else + return -ENOTTY; +#endif + } + mf->width = mt9m111->width; mf->height = mt9m111->height; mf->code= mt9m111->fmt->code; @@ -1089,6 +1099,25 @@ static int mt9m111_s_stream(struct v4l2_subdev *sd, int enable) return 0; } +static int mt9m111_init_cfg(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg) +{ +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API + struct v4l2_mbus_framefmt *format = + v4l2_subdev_get_try_format(sd, cfg, 0); + + format->width = MT9M111_MAX_WIDTH; + format->height = MT9M111_MAX_HEIGHT; + format->code= mt9m111_colour_fmts[0].code; + format->colorspace = mt9m111_colour_fmts[0].colorspace; + format->field = V4L2_FIELD_NONE; + format->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; + format->quantization= V4L2_QUANTIZATION_DEFAULT; + format->xfer_func = V4L2_XFER_FUNC_DEFAULT; +#endif + return 0; +} + static int mt9m111_g_mbus_config(struct v4l2_subdev *sd, struct v4l2_mbus_config *cfg) { @@ -1114,6 +1143,7 @@ static const struct v4l2_subdev_video_ops mt9m111_subdev_video_ops = { }; static const struct v4l2_subdev_pad_ops mt9m111_subdev_pad_ops = { + .init_cfg = mt9m111_init_cfg, .enum_mbus_code = mt9m111_enum_mbus_code, .get_selection = mt9m111_get_selection, .set_selection = mt9m111_set_selection, -- 2.7.4
Re: [PATCH v2 1/3] media: mt9m111: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
2019年1月11日(金) 0:28 Akinobu Mita : > > The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize > V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE > is specified. > > Cc: Enrico Scholz > Cc: Michael Grzeschik > Cc: Marco Felsch > Cc: Sakari Ailus > Cc: Mauro Carvalho Chehab > Signed-off-by: Akinobu Mita > --- > * v2 > - Use format->pad for the argument of v4l2_subdev_get_try_format(). > > drivers/media/i2c/mt9m111.c | 31 +++ > 1 file changed, 31 insertions(+) > > diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c > index d639b9b..eb5bf71 100644 > --- a/drivers/media/i2c/mt9m111.c > +++ b/drivers/media/i2c/mt9m111.c > @@ -528,6 +528,16 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd, > if (format->pad) > return -EINVAL; > > + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { > +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API > + mf = v4l2_subdev_get_try_format(sd, cfg, format->pad); > + format->format = *mf; > + return 0; > +#else > + return -ENOTTY; > +#endif > + } > + > mf->width = mt9m111->width; > mf->height = mt9m111->height; > mf->code= mt9m111->fmt->code; > @@ -1089,6 +1099,26 @@ static int mt9m111_s_stream(struct v4l2_subdev *sd, > int enable) > return 0; > } > > +static int mt9m111_init_cfg(struct v4l2_subdev *sd, > + struct v4l2_subdev_pad_config *cfg) > +{ > +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API > + struct mt9m111 *mt9m111 = container_of(sd, struct mt9m111, subdev); > + struct v4l2_mbus_framefmt *format = > + v4l2_subdev_get_try_format(sd, cfg, 0); > + > + format->width = mt9m111->width; > + format->height = mt9m111->height; > + format->code= mt9m111->fmt->code; > + format->colorspace = mt9m111->fmt->colorspace; Oops, I made the same mistake that I did for mt9m001 driver. This should be the default configuration instead of current one.
[PATCH v2 1/3] media: mt9m111: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE is specified. Cc: Enrico Scholz Cc: Michael Grzeschik Cc: Marco Felsch Cc: Sakari Ailus Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- * v2 - Use format->pad for the argument of v4l2_subdev_get_try_format(). drivers/media/i2c/mt9m111.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c index d639b9b..eb5bf71 100644 --- a/drivers/media/i2c/mt9m111.c +++ b/drivers/media/i2c/mt9m111.c @@ -528,6 +528,16 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd, if (format->pad) return -EINVAL; + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API + mf = v4l2_subdev_get_try_format(sd, cfg, format->pad); + format->format = *mf; + return 0; +#else + return -ENOTTY; +#endif + } + mf->width = mt9m111->width; mf->height = mt9m111->height; mf->code= mt9m111->fmt->code; @@ -1089,6 +1099,26 @@ static int mt9m111_s_stream(struct v4l2_subdev *sd, int enable) return 0; } +static int mt9m111_init_cfg(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg) +{ +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API + struct mt9m111 *mt9m111 = container_of(sd, struct mt9m111, subdev); + struct v4l2_mbus_framefmt *format = + v4l2_subdev_get_try_format(sd, cfg, 0); + + format->width = mt9m111->width; + format->height = mt9m111->height; + format->code= mt9m111->fmt->code; + format->colorspace = mt9m111->fmt->colorspace; + format->field = V4L2_FIELD_NONE; + format->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; + format->quantization= V4L2_QUANTIZATION_DEFAULT; + format->xfer_func = V4L2_XFER_FUNC_DEFAULT; +#endif + return 0; +} + static int mt9m111_g_mbus_config(struct v4l2_subdev *sd, struct v4l2_mbus_config *cfg) { @@ -1114,6 +1144,7 @@ static const struct v4l2_subdev_video_ops mt9m111_subdev_video_ops = { }; static const struct v4l2_subdev_pad_ops mt9m111_subdev_pad_ops = { + .init_cfg = mt9m111_init_cfg, .enum_mbus_code = mt9m111_enum_mbus_code, .get_selection = mt9m111_get_selection, .set_selection = mt9m111_set_selection, -- 2.7.4
[PATCH v2 12/13] media: mt9m001: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE is specified. Cc: Guennadi Liakhovetski Cc: Sakari Ailus Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- * v2 - Set initial try format with default configuration instead of current one. drivers/media/i2c/mt9m001.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/drivers/media/i2c/mt9m001.c b/drivers/media/i2c/mt9m001.c index 66a0928..f97ab48 100644 --- a/drivers/media/i2c/mt9m001.c +++ b/drivers/media/i2c/mt9m001.c @@ -329,6 +329,12 @@ static int mt9m001_get_fmt(struct v4l2_subdev *sd, if (format->pad) return -EINVAL; + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { + mf = v4l2_subdev_get_try_format(sd, cfg, 0); + format->format = *mf; + return 0; + } + mf->width = mt9m001->rect.width; mf->height = mt9m001->rect.height; mf->code= mt9m001->fmt->code; @@ -642,6 +648,26 @@ static const struct v4l2_subdev_core_ops mt9m001_subdev_core_ops = { #endif }; +static int mt9m001_init_cfg(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct mt9m001 *mt9m001 = to_mt9m001(client); + struct v4l2_mbus_framefmt *try_fmt = + v4l2_subdev_get_try_format(sd, cfg, 0); + + try_fmt->width = MT9M001_MAX_WIDTH; + try_fmt->height = MT9M001_MAX_HEIGHT; + try_fmt->code = mt9m001->fmts[0].code; + try_fmt->colorspace = mt9m001->fmts[0].colorspace; + try_fmt->field = V4L2_FIELD_NONE; + try_fmt->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; + try_fmt->quantization = V4L2_QUANTIZATION_DEFAULT; + try_fmt->xfer_func = V4L2_XFER_FUNC_DEFAULT; + + return 0; +} + static int mt9m001_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_mbus_code_enum *code) @@ -678,6 +704,7 @@ static const struct v4l2_subdev_sensor_ops mt9m001_subdev_sensor_ops = { }; static const struct v4l2_subdev_pad_ops mt9m001_subdev_pad_ops = { + .init_cfg = mt9m001_init_cfg, .enum_mbus_code = mt9m001_enum_mbus_code, .get_selection = mt9m001_get_selection, .set_selection = mt9m001_set_selection, -- 2.7.4
Re: [PATCH 11/12] media: mt9m001: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
2019年1月7日(月) 20:30 Sakari Ailus : > > Hi Mita-san, > > On Sun, Dec 23, 2018 at 02:12:53AM +0900, Akinobu Mita wrote: > > The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize > > V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE > > is specified. > > > > Cc: Guennadi Liakhovetski > > Cc: Sakari Ailus > > Cc: Mauro Carvalho Chehab > > Signed-off-by: Akinobu Mita > > --- > > drivers/media/i2c/mt9m001.c | 27 +++ > > 1 file changed, 27 insertions(+) > > > > diff --git a/drivers/media/i2c/mt9m001.c b/drivers/media/i2c/mt9m001.c > > index a5b94d7..f4afbc9 100644 > > --- a/drivers/media/i2c/mt9m001.c > > +++ b/drivers/media/i2c/mt9m001.c > > @@ -331,6 +331,12 @@ static int mt9m001_get_fmt(struct v4l2_subdev *sd, > > if (format->pad) > > return -EINVAL; > > > > + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { > > + mf = v4l2_subdev_get_try_format(sd, cfg, 0); > > + format->format = *mf; > > + return 0; > > + } > > + > > mf->width = mt9m001->rect.width; > > mf->height = mt9m001->rect.height; > > mf->code= mt9m001->fmt->code; > > @@ -638,6 +644,26 @@ static const struct v4l2_subdev_core_ops > > mt9m001_subdev_core_ops = { > > #endif > > }; > > > > +static int mt9m001_init_cfg(struct v4l2_subdev *sd, > > + struct v4l2_subdev_pad_config *cfg) > > +{ > > + struct i2c_client *client = v4l2_get_subdevdata(sd); > > + struct mt9m001 *mt9m001 = to_mt9m001(client); > > + struct v4l2_mbus_framefmt *try_fmt = > > + v4l2_subdev_get_try_format(sd, cfg, 0); > > + > > + try_fmt->width = mt9m001->rect.width; > > + try_fmt->height = mt9m001->rect.height; > > + try_fmt->code = mt9m001->fmt->code; > > + try_fmt->colorspace = mt9m001->fmt->colorspace; > > The initial configuration set here should reflect the default, not current > configuration. This appears to refer to the current one. You are right. I'll fix this.
Re: [PATCH 11/12] media: mt9m001: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
Hi Mita-san, On Sun, Dec 23, 2018 at 02:12:53AM +0900, Akinobu Mita wrote: > The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize > V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE > is specified. > > Cc: Guennadi Liakhovetski > Cc: Sakari Ailus > Cc: Mauro Carvalho Chehab > Signed-off-by: Akinobu Mita > --- > drivers/media/i2c/mt9m001.c | 27 +++ > 1 file changed, 27 insertions(+) > > diff --git a/drivers/media/i2c/mt9m001.c b/drivers/media/i2c/mt9m001.c > index a5b94d7..f4afbc9 100644 > --- a/drivers/media/i2c/mt9m001.c > +++ b/drivers/media/i2c/mt9m001.c > @@ -331,6 +331,12 @@ static int mt9m001_get_fmt(struct v4l2_subdev *sd, > if (format->pad) > return -EINVAL; > > + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { > + mf = v4l2_subdev_get_try_format(sd, cfg, 0); > + format->format = *mf; > + return 0; > + } > + > mf->width = mt9m001->rect.width; > mf->height = mt9m001->rect.height; > mf->code= mt9m001->fmt->code; > @@ -638,6 +644,26 @@ static const struct v4l2_subdev_core_ops > mt9m001_subdev_core_ops = { > #endif > }; > > +static int mt9m001_init_cfg(struct v4l2_subdev *sd, > + struct v4l2_subdev_pad_config *cfg) > +{ > + struct i2c_client *client = v4l2_get_subdevdata(sd); > + struct mt9m001 *mt9m001 = to_mt9m001(client); > + struct v4l2_mbus_framefmt *try_fmt = > + v4l2_subdev_get_try_format(sd, cfg, 0); > + > + try_fmt->width = mt9m001->rect.width; > + try_fmt->height = mt9m001->rect.height; > + try_fmt->code = mt9m001->fmt->code; > + try_fmt->colorspace = mt9m001->fmt->colorspace; The initial configuration set here should reflect the default, not current configuration. This appears to refer to the current one. > + try_fmt->field = V4L2_FIELD_NONE; > + try_fmt->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; > + try_fmt->quantization = V4L2_QUANTIZATION_DEFAULT; > + try_fmt->xfer_func = V4L2_XFER_FUNC_DEFAULT; > + > + return 0; > +} > + > static int mt9m001_enum_mbus_code(struct v4l2_subdev *sd, > struct v4l2_subdev_pad_config *cfg, > struct v4l2_subdev_mbus_code_enum *code) > @@ -674,6 +700,7 @@ static const struct v4l2_subdev_sensor_ops > mt9m001_subdev_sensor_ops = { > }; > > static const struct v4l2_subdev_pad_ops mt9m001_subdev_pad_ops = { > + .init_cfg = mt9m001_init_cfg, > .enum_mbus_code = mt9m001_enum_mbus_code, > .get_selection = mt9m001_get_selection, > .set_selection = mt9m001_set_selection, > -- > 2.7.4 > -- Sakari Ailus sakari.ai...@linux.intel.com
Re: [PATCH 2/4] media: mt9m111: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
2019年1月3日(木) 22:47 Marco Felsch : > > On 19-01-01 02:07, Akinobu Mita wrote: > > 2018年12月31日(月) 19:54 Marco Felsch : > > > > > > On 18-12-30 02:07, Akinobu Mita wrote: > > > > The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize > > > > V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE > > > > is specified. > > > > > > > > Cc: Sakari Ailus > > > > Cc: Mauro Carvalho Chehab > > > > Signed-off-by: Akinobu Mita > > > > --- > > > > drivers/media/i2c/mt9m111.c | 31 +++ > > > > 1 file changed, 31 insertions(+) > > > > > > > > diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c > > > > index f0e47fd..acb4dee 100644 > > > > --- a/drivers/media/i2c/mt9m111.c > > > > +++ b/drivers/media/i2c/mt9m111.c > > > > @@ -528,6 +528,16 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd, > > > > if (format->pad) > > > > return -EINVAL; > > > > > > > > + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { > > > > +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API > > > > > > This ifdef is made in the include/media/v4l2-subdev.h, so I would drop > > > it. > > > > I sent similar fix for ov2640 driver and kerel test robot reported > > build test failure. So I think this ifdef is necessary. > > > > v1: https://www.mail-archive.com/linux-media@vger.kernel.org/msg137098.html > > v2: https://www.mail-archive.com/linux-media@vger.kernel.org/msg141735.html > > You are absolutely true, sorry my mistake.. Unfortunately my patch [1] wasn't > applied which fixes it commonly. This patch will avoid the 2nd ifdef in > init_cfg() too. > > [1] https://www.spinics.net/lists/linux-media/msg138940.html > > > > > > > + mf = v4l2_subdev_get_try_format(sd, cfg, 0); > > > > > > I would use format->pad instead of the static 0. > > > > OK. > > > > > > + format->format = *mf; > > > > > > Is this correct? I tought v4l2_subdev_get_try_format() will return the > > > try_pad which we need to fill. > > > > I think this is correct. Other sensor drivers are doing the same thing in > > get_fmt() callback. > > Yes, you're right. > > > > > + return 0; > > > > +#else > > > > + return -ENOTTY; > > > > > > Return this error is not specified in the API-Doc. > > > > I think this 'return -ENOTTY' is not reachable even if > > CONFIG_VIDEO_V4L2_SUBDEV_API is not set, and can be replaced with any > > return value. > > Sorry I didn't catched this. When it's not reachable why is it there and > why isn't it reachable? If the format->which = V4L2_SUBDEV_FORMAT_TRY > and we don't configure CONFIG_VIDEO_V4L2_SUBDEV_API, then this path will > be reached, or overlooked I something? As far as I can see, when CONFIG_VIDEO_V4L2_SUBDEV_API is not defined, the get_fmt() callback is always called with 'format->which == V4L2_SUBDEV_FORMAT_ACTIVE'. There is only one call site that the get_fmt() is called with 'format->which == V4L2_SUBDEV_FORMAT_TRY' in drivers/media/v4l2-core/v4l2-subdev.c: subdev_do_ioctl(). But the call site is enclosed by ifdef CONFIG_VIDEO_V4L2_SUBDEV_API. So the hunk of the patch can be changed to: if (format->which == V4L2_SUBDEV_FORMAT_TRY) { #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API mf = v4l2_subdev_get_try_format(sd, cfg, format->pad); format->format = *mf; return 0; #endif }
Re: [PATCH 2/4] media: mt9m111: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
Hello, sorry to jump in On Thu, Jan 03, 2019 at 02:47:04PM +0100, Marco Felsch wrote: > On 19-01-01 02:07, Akinobu Mita wrote: > > 2018年12月31日(月) 19:54 Marco Felsch : > > > > > > On 18-12-30 02:07, Akinobu Mita wrote: > > > > The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize > > > > V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE > > > > is specified. > > > > > > > > Cc: Sakari Ailus > > > > Cc: Mauro Carvalho Chehab > > > > Signed-off-by: Akinobu Mita > > > > --- > > > > drivers/media/i2c/mt9m111.c | 31 +++ > > > > 1 file changed, 31 insertions(+) > > > > > > > > diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c > > > > index f0e47fd..acb4dee 100644 > > > > --- a/drivers/media/i2c/mt9m111.c > > > > +++ b/drivers/media/i2c/mt9m111.c > > > > @@ -528,6 +528,16 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd, > > > > if (format->pad) > > > > return -EINVAL; > > > > > > > > + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { > > > > +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API > > > > > > This ifdef is made in the include/media/v4l2-subdev.h, so I would drop > > > it. > > > > I sent similar fix for ov2640 driver and kerel test robot reported > > build test failure. So I think this ifdef is necessary. > > > > v1: https://www.mail-archive.com/linux-media@vger.kernel.org/msg137098.html > > v2: https://www.mail-archive.com/linux-media@vger.kernel.org/msg141735.html > > You are absolutely true, sorry my mistake.. Unfortunately my patch [1] wasn't > applied which fixes it commonly. This patch will avoid the 2nd ifdef in > init_cfg() too. > > [1] https://www.spinics.net/lists/linux-media/msg138940.html > There have been recents attempts to do the same, please see: https://lkml.org/lkml/2018/11/28/1080 and Hans' attempt at https://patchwork.kernel.org/patch/10717699/ Unfortunately seems like we're gonna live with those ifdefs Thanks j signature.asc Description: PGP signature
Re: [PATCH 2/4] media: mt9m111: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
On 19-01-01 02:07, Akinobu Mita wrote: > 2018年12月31日(月) 19:54 Marco Felsch : > > > > On 18-12-30 02:07, Akinobu Mita wrote: > > > The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize > > > V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE > > > is specified. > > > > > > Cc: Sakari Ailus > > > Cc: Mauro Carvalho Chehab > > > Signed-off-by: Akinobu Mita > > > --- > > > drivers/media/i2c/mt9m111.c | 31 +++ > > > 1 file changed, 31 insertions(+) > > > > > > diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c > > > index f0e47fd..acb4dee 100644 > > > --- a/drivers/media/i2c/mt9m111.c > > > +++ b/drivers/media/i2c/mt9m111.c > > > @@ -528,6 +528,16 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd, > > > if (format->pad) > > > return -EINVAL; > > > > > > + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { > > > +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API > > > > This ifdef is made in the include/media/v4l2-subdev.h, so I would drop > > it. > > I sent similar fix for ov2640 driver and kerel test robot reported > build test failure. So I think this ifdef is necessary. > > v1: https://www.mail-archive.com/linux-media@vger.kernel.org/msg137098.html > v2: https://www.mail-archive.com/linux-media@vger.kernel.org/msg141735.html You are absolutely true, sorry my mistake.. Unfortunately my patch [1] wasn't applied which fixes it commonly. This patch will avoid the 2nd ifdef in init_cfg() too. [1] https://www.spinics.net/lists/linux-media/msg138940.html > > > > + mf = v4l2_subdev_get_try_format(sd, cfg, 0); > > > > I would use format->pad instead of the static 0. > > OK. > > > > + format->format = *mf; > > > > Is this correct? I tought v4l2_subdev_get_try_format() will return the > > try_pad which we need to fill. > > I think this is correct. Other sensor drivers are doing the same thing in > get_fmt() callback. Yes, you're right. > > > + return 0; > > > +#else > > > + return -ENOTTY; > > > > Return this error is not specified in the API-Doc. > > I think this 'return -ENOTTY' is not reachable even if > CONFIG_VIDEO_V4L2_SUBDEV_API is not set, and can be replaced with any > return value. Sorry I didn't catched this. When it's not reachable why is it there and why isn't it reachable? If the format->which = V4L2_SUBDEV_FORMAT_TRY and we don't configure CONFIG_VIDEO_V4L2_SUBDEV_API, then this path will be reached, or overlooked I something? > > > > +#endif > > > + } > > > + > > > > If I understood it right, your patch should look like: > > > > > + if (format->which == V4L2_SUBDEV_FORMAT_TRY) > > > + mf = v4l2_subdev_get_try_format(sd, cfg, format->pad); > > > > Sakari please correct me if it's wrong. > > > > > mf->width = mt9m111->width; > > > mf->height = mt9m111->height; > > > mf->code= mt9m111->fmt->code; > > > @@ -1090,6 +1100,26 @@ static int mt9m111_s_stream(struct v4l2_subdev > > > *sd, int enable) > > > return 0; > > > } > > > > > > +static int mt9m111_init_cfg(struct v4l2_subdev *sd, > > > + struct v4l2_subdev_pad_config *cfg) > > > > Is this related to the patch description? I would split this into a > > seperate patch. > > The mt9m111_init_cfg() initializes the try format with default setting. > So this is required in case get_fmt() with V4L2_SUBDEV_FORMAT_TRY is > called before set_fmt() with V4L2_SUBDEV_FORMAT_TRY is called. Okay, I would split this but it's my personal opinion. Kind regards, Marco > > > +{ > > > +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API > > > + struct mt9m111 *mt9m111 = container_of(sd, struct mt9m111, subdev); > > > + struct v4l2_mbus_framefmt *format = > > > + v4l2_subdev_get_try_format(sd, cfg, 0); > > > + > > > + format->width = mt9m111->width; > > > + format->height = mt9m111->height; > > > + format->code= mt9m111->fmt->code; > > > + format->colorspace = mt9m111->fmt->colorspace; > > > + format->field = V4L2_FIELD_NONE; > > > + format->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; > > > + format->quantization= V4L2_QUANTIZATION_DEFAULT; > > > + format->xfer_func = V4L2_XFER_FUNC_DEFAULT; > > > +#endif > > > + return 0; > > > +} > > > + > > > static int mt9m111_g_mbus_config(struct v4l2_subdev *sd, > > > struct v4l2_mbus_config *cfg) > > > { > > > @@ -1115,6 +1145,7 @@ static const struct v4l2_subdev_video_ops > > > mt9m111_subdev_video_ops = { > > > }; > > > > > > static const struct v4l2_subdev_pad_ops mt9m111_subdev_pad_ops = { > > > + .init_cfg = mt9m111_init_cfg, > > > .enum_mbus_code = mt9m111_enum_mbus_code, > > > .get_selection = mt9m111_get_selection, > > > .set_selection = mt9m111_set_selection, > > > -- > > > 2.7.4 > > > > > > >
Re: [PATCH 2/4] media: mt9m111: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
2018年12月31日(月) 19:54 Marco Felsch : > > On 18-12-30 02:07, Akinobu Mita wrote: > > The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize > > V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE > > is specified. > > > > Cc: Sakari Ailus > > Cc: Mauro Carvalho Chehab > > Signed-off-by: Akinobu Mita > > --- > > drivers/media/i2c/mt9m111.c | 31 +++ > > 1 file changed, 31 insertions(+) > > > > diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c > > index f0e47fd..acb4dee 100644 > > --- a/drivers/media/i2c/mt9m111.c > > +++ b/drivers/media/i2c/mt9m111.c > > @@ -528,6 +528,16 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd, > > if (format->pad) > > return -EINVAL; > > > > + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { > > +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API > > This ifdef is made in the include/media/v4l2-subdev.h, so I would drop > it. I sent similar fix for ov2640 driver and kerel test robot reported build test failure. So I think this ifdef is necessary. v1: https://www.mail-archive.com/linux-media@vger.kernel.org/msg137098.html v2: https://www.mail-archive.com/linux-media@vger.kernel.org/msg141735.html > > + mf = v4l2_subdev_get_try_format(sd, cfg, 0); > > I would use format->pad instead of the static 0. OK. > > + format->format = *mf; > > Is this correct? I tought v4l2_subdev_get_try_format() will return the > try_pad which we need to fill. I think this is correct. Other sensor drivers are doing the same thing in get_fmt() callback. > > + return 0; > > +#else > > + return -ENOTTY; > > Return this error is not specified in the API-Doc. I think this 'return -ENOTTY' is not reachable even if CONFIG_VIDEO_V4L2_SUBDEV_API is not set, and can be replaced with any return value. > > +#endif > > + } > > + > > If I understood it right, your patch should look like: > > > + if (format->which == V4L2_SUBDEV_FORMAT_TRY) > > + mf = v4l2_subdev_get_try_format(sd, cfg, format->pad); > > Sakari please correct me if it's wrong. > > > mf->width = mt9m111->width; > > mf->height = mt9m111->height; > > mf->code= mt9m111->fmt->code; > > @@ -1090,6 +1100,26 @@ static int mt9m111_s_stream(struct v4l2_subdev *sd, > > int enable) > > return 0; > > } > > > > +static int mt9m111_init_cfg(struct v4l2_subdev *sd, > > + struct v4l2_subdev_pad_config *cfg) > > Is this related to the patch description? I would split this into a > seperate patch. The mt9m111_init_cfg() initializes the try format with default setting. So this is required in case get_fmt() with V4L2_SUBDEV_FORMAT_TRY is called before set_fmt() with V4L2_SUBDEV_FORMAT_TRY is called. > > +{ > > +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API > > + struct mt9m111 *mt9m111 = container_of(sd, struct mt9m111, subdev); > > + struct v4l2_mbus_framefmt *format = > > + v4l2_subdev_get_try_format(sd, cfg, 0); > > + > > + format->width = mt9m111->width; > > + format->height = mt9m111->height; > > + format->code= mt9m111->fmt->code; > > + format->colorspace = mt9m111->fmt->colorspace; > > + format->field = V4L2_FIELD_NONE; > > + format->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; > > + format->quantization= V4L2_QUANTIZATION_DEFAULT; > > + format->xfer_func = V4L2_XFER_FUNC_DEFAULT; > > +#endif > > + return 0; > > +} > > + > > static int mt9m111_g_mbus_config(struct v4l2_subdev *sd, > > struct v4l2_mbus_config *cfg) > > { > > @@ -1115,6 +1145,7 @@ static const struct v4l2_subdev_video_ops > > mt9m111_subdev_video_ops = { > > }; > > > > static const struct v4l2_subdev_pad_ops mt9m111_subdev_pad_ops = { > > + .init_cfg = mt9m111_init_cfg, > > .enum_mbus_code = mt9m111_enum_mbus_code, > > .get_selection = mt9m111_get_selection, > > .set_selection = mt9m111_set_selection, > > -- > > 2.7.4 > > > >
Re: [PATCH 2/4] media: mt9m111: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
On 18-12-30 02:07, Akinobu Mita wrote: > The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize > V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE > is specified. > > Cc: Sakari Ailus > Cc: Mauro Carvalho Chehab > Signed-off-by: Akinobu Mita > --- > drivers/media/i2c/mt9m111.c | 31 +++ > 1 file changed, 31 insertions(+) > > diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c > index f0e47fd..acb4dee 100644 > --- a/drivers/media/i2c/mt9m111.c > +++ b/drivers/media/i2c/mt9m111.c > @@ -528,6 +528,16 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd, > if (format->pad) > return -EINVAL; > > + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { > +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API This ifdef is made in the include/media/v4l2-subdev.h, so I would drop it. > + mf = v4l2_subdev_get_try_format(sd, cfg, 0); I would use format->pad instead of the static 0. > + format->format = *mf; Is this correct? I tought v4l2_subdev_get_try_format() will return the try_pad which we need to fill. > + return 0; > +#else > + return -ENOTTY; Return this error is not specified in the API-Doc. > +#endif > + } > + If I understood it right, your patch should look like: > + if (format->which == V4L2_SUBDEV_FORMAT_TRY) > + mf = v4l2_subdev_get_try_format(sd, cfg, format->pad); Sakari please correct me if it's wrong. > mf->width = mt9m111->width; > mf->height = mt9m111->height; > mf->code= mt9m111->fmt->code; > @@ -1090,6 +1100,26 @@ static int mt9m111_s_stream(struct v4l2_subdev *sd, > int enable) > return 0; > } > > +static int mt9m111_init_cfg(struct v4l2_subdev *sd, > + struct v4l2_subdev_pad_config *cfg) Is this related to the patch description? I would split this into a seperate patch. > +{ > +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API > + struct mt9m111 *mt9m111 = container_of(sd, struct mt9m111, subdev); > + struct v4l2_mbus_framefmt *format = > + v4l2_subdev_get_try_format(sd, cfg, 0); > + > + format->width = mt9m111->width; > + format->height = mt9m111->height; > + format->code= mt9m111->fmt->code; > + format->colorspace = mt9m111->fmt->colorspace; > + format->field = V4L2_FIELD_NONE; > + format->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; > + format->quantization= V4L2_QUANTIZATION_DEFAULT; > + format->xfer_func = V4L2_XFER_FUNC_DEFAULT; > +#endif > + return 0; > +} > + > static int mt9m111_g_mbus_config(struct v4l2_subdev *sd, > struct v4l2_mbus_config *cfg) > { > @@ -1115,6 +1145,7 @@ static const struct v4l2_subdev_video_ops > mt9m111_subdev_video_ops = { > }; > > static const struct v4l2_subdev_pad_ops mt9m111_subdev_pad_ops = { > + .init_cfg = mt9m111_init_cfg, > .enum_mbus_code = mt9m111_enum_mbus_code, > .get_selection = mt9m111_get_selection, > .set_selection = mt9m111_set_selection, > -- > 2.7.4 > >
[PATCH 2/4] media: mt9m111: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE is specified. Cc: Sakari Ailus Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- drivers/media/i2c/mt9m111.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c index f0e47fd..acb4dee 100644 --- a/drivers/media/i2c/mt9m111.c +++ b/drivers/media/i2c/mt9m111.c @@ -528,6 +528,16 @@ static int mt9m111_get_fmt(struct v4l2_subdev *sd, if (format->pad) return -EINVAL; + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API + mf = v4l2_subdev_get_try_format(sd, cfg, 0); + format->format = *mf; + return 0; +#else + return -ENOTTY; +#endif + } + mf->width = mt9m111->width; mf->height = mt9m111->height; mf->code= mt9m111->fmt->code; @@ -1090,6 +1100,26 @@ static int mt9m111_s_stream(struct v4l2_subdev *sd, int enable) return 0; } +static int mt9m111_init_cfg(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg) +{ +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API + struct mt9m111 *mt9m111 = container_of(sd, struct mt9m111, subdev); + struct v4l2_mbus_framefmt *format = + v4l2_subdev_get_try_format(sd, cfg, 0); + + format->width = mt9m111->width; + format->height = mt9m111->height; + format->code= mt9m111->fmt->code; + format->colorspace = mt9m111->fmt->colorspace; + format->field = V4L2_FIELD_NONE; + format->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; + format->quantization= V4L2_QUANTIZATION_DEFAULT; + format->xfer_func = V4L2_XFER_FUNC_DEFAULT; +#endif + return 0; +} + static int mt9m111_g_mbus_config(struct v4l2_subdev *sd, struct v4l2_mbus_config *cfg) { @@ -1115,6 +1145,7 @@ static const struct v4l2_subdev_video_ops mt9m111_subdev_video_ops = { }; static const struct v4l2_subdev_pad_ops mt9m111_subdev_pad_ops = { + .init_cfg = mt9m111_init_cfg, .enum_mbus_code = mt9m111_enum_mbus_code, .get_selection = mt9m111_get_selection, .set_selection = mt9m111_set_selection, -- 2.7.4
[PATCH 11/12] media: mt9m001: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE is specified. Cc: Guennadi Liakhovetski Cc: Sakari Ailus Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- drivers/media/i2c/mt9m001.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/drivers/media/i2c/mt9m001.c b/drivers/media/i2c/mt9m001.c index a5b94d7..f4afbc9 100644 --- a/drivers/media/i2c/mt9m001.c +++ b/drivers/media/i2c/mt9m001.c @@ -331,6 +331,12 @@ static int mt9m001_get_fmt(struct v4l2_subdev *sd, if (format->pad) return -EINVAL; + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { + mf = v4l2_subdev_get_try_format(sd, cfg, 0); + format->format = *mf; + return 0; + } + mf->width = mt9m001->rect.width; mf->height = mt9m001->rect.height; mf->code= mt9m001->fmt->code; @@ -638,6 +644,26 @@ static const struct v4l2_subdev_core_ops mt9m001_subdev_core_ops = { #endif }; +static int mt9m001_init_cfg(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct mt9m001 *mt9m001 = to_mt9m001(client); + struct v4l2_mbus_framefmt *try_fmt = + v4l2_subdev_get_try_format(sd, cfg, 0); + + try_fmt->width = mt9m001->rect.width; + try_fmt->height = mt9m001->rect.height; + try_fmt->code = mt9m001->fmt->code; + try_fmt->colorspace = mt9m001->fmt->colorspace; + try_fmt->field = V4L2_FIELD_NONE; + try_fmt->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; + try_fmt->quantization = V4L2_QUANTIZATION_DEFAULT; + try_fmt->xfer_func = V4L2_XFER_FUNC_DEFAULT; + + return 0; +} + static int mt9m001_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_mbus_code_enum *code) @@ -674,6 +700,7 @@ static const struct v4l2_subdev_sensor_ops mt9m001_subdev_sensor_ops = { }; static const struct v4l2_subdev_pad_ops mt9m001_subdev_pad_ops = { + .init_cfg = mt9m001_init_cfg, .enum_mbus_code = mt9m001_enum_mbus_code, .get_selection = mt9m001_get_selection, .set_selection = mt9m001_set_selection, -- 2.7.4
[PATCH v2 2/3] media: ov2640: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE is specified. Cc: Sakari Ailus Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- * v2 - fix build error when CONFIG_VIDEO_V4L2_SUBDEV_API is not defined, reported by kbuild test robot. drivers/media/i2c/ov2640.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c index a07e6f2..84b1b15 100644 --- a/drivers/media/i2c/ov2640.c +++ b/drivers/media/i2c/ov2640.c @@ -926,6 +926,15 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd, if (format->pad) return -EINVAL; + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API + mf = v4l2_subdev_get_try_format(sd, cfg, 0); + format->format = *mf; + return 0; +#else + return -ENOTTY; +#endif + } mf->width = priv->win->width; mf->height = priv->win->height; @@ -992,6 +1001,27 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd, return ret; } +static int ov2640_init_cfg(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg) +{ +#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct ov2640_priv *priv = to_ov2640(client); + struct v4l2_mbus_framefmt *try_fmt = + v4l2_subdev_get_try_format(sd, cfg, 0); + + try_fmt->width = priv->win->width; + try_fmt->height = priv->win->height; + try_fmt->code = priv->cfmt_code; + try_fmt->colorspace = V4L2_COLORSPACE_SRGB; + try_fmt->field = V4L2_FIELD_NONE; + try_fmt->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; + try_fmt->quantization = V4L2_QUANTIZATION_DEFAULT; + try_fmt->xfer_func = V4L2_XFER_FUNC_DEFAULT; +#endif + return 0; +} + static int ov2640_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_mbus_code_enum *code) @@ -1101,6 +1131,7 @@ static const struct v4l2_subdev_core_ops ov2640_subdev_core_ops = { }; static const struct v4l2_subdev_pad_ops ov2640_subdev_pad_ops = { + .init_cfg = ov2640_init_cfg, .enum_mbus_code = ov2640_enum_mbus_code, .get_selection = ov2640_get_selection, .get_fmt= ov2640_get_fmt, -- 2.7.4
Re: [PATCH 2/3] media: ov2640: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
Hi Akinobu, I love your patch! Yet something to improve: [auto build test ERROR on linuxtv-media/master] [also build test ERROR on v4.20-rc5 next-20181207] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Akinobu-Mita/media-ov2640-fix-two-problems/20181208-165345 base: git://linuxtv.org/media_tree.git master config: x86_64-randconfig-x011-201848 (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All error/warnings (new ones prefixed by >>): drivers/media//i2c/ov2640.c: In function 'ov2640_get_fmt': >> drivers/media//i2c/ov2640.c:930:8: error: implicit declaration of function >> 'v4l2_subdev_get_try_format'; did you mean 'v4l2_subdev_notify_event'? >> [-Werror=implicit-function-declaration] mf = v4l2_subdev_get_try_format(sd, cfg, 0); ^~ v4l2_subdev_notify_event >> drivers/media//i2c/ov2640.c:930:6: warning: assignment makes pointer from >> integer without a cast [-Wint-conversion] mf = v4l2_subdev_get_try_format(sd, cfg, 0); ^ drivers/media//i2c/ov2640.c: In function 'ov2640_init_cfg': >> drivers/media//i2c/ov2640.c:1007:3: warning: initialization makes pointer >> from integer without a cast [-Wint-conversion] v4l2_subdev_get_try_format(sd, cfg, 0); ^~ cc1: some warnings being treated as errors vim +930 drivers/media//i2c/ov2640.c 917 918 static int ov2640_get_fmt(struct v4l2_subdev *sd, 919 struct v4l2_subdev_pad_config *cfg, 920 struct v4l2_subdev_format *format) 921 { 922 struct v4l2_mbus_framefmt *mf = &format->format; 923 struct i2c_client *client = v4l2_get_subdevdata(sd); 924 struct ov2640_priv *priv = to_ov2640(client); 925 926 if (format->pad) 927 return -EINVAL; 928 929 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { > 930 mf = v4l2_subdev_get_try_format(sd, cfg, 0); 931 format->format = *mf; 932 933 return 0; 934 } 935 936 mf->width = priv->win->width; 937 mf->height = priv->win->height; 938 mf->code= priv->cfmt_code; 939 mf->colorspace = V4L2_COLORSPACE_SRGB; 940 mf->field = V4L2_FIELD_NONE; 941 942 return 0; 943 } 944 945 static int ov2640_set_fmt(struct v4l2_subdev *sd, 946 struct v4l2_subdev_pad_config *cfg, 947 struct v4l2_subdev_format *format) 948 { 949 struct v4l2_mbus_framefmt *mf = &format->format; 950 struct i2c_client *client = v4l2_get_subdevdata(sd); 951 struct ov2640_priv *priv = to_ov2640(client); 952 const struct ov2640_win_size *win; 953 int ret = 0; 954 955 if (format->pad) 956 return -EINVAL; 957 958 mutex_lock(&priv->lock); 959 960 /* select suitable win */ 961 win = ov2640_select_win(mf->width, mf->height); 962 mf->width = win->width; 963 mf->height = win->height; 964 965 mf->field = V4L2_FIELD_NONE; 966 mf->colorspace = V4L2_COLORSPACE_SRGB; 967 968 switch (mf->code) { 969 case MEDIA_BUS_FMT_RGB565_2X8_BE: 970 case MEDIA_BUS_FMT_RGB565_2X8_LE: 971 case MEDIA_BUS_FMT_YUYV8_2X8: 972 case MEDIA_BUS_FMT_UYVY8_2X8: 973 case MEDIA_BUS_FMT_YVYU8_2X8: 974 case MEDIA_BUS_FMT_VYUY8_2X8: 975 break; 976 default: 977 mf->code = MEDIA_BUS_FMT_UYVY8_2X8; 978 break; 979 } 980 981 if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) { 982 struct ov2640_priv *priv = to_ov2640(client); 983 984 if (priv->streaming) { 985 ret = -EBUSY; 986 goto out; 987 } 988 /* select win */ 989 priv->win = win; 990 /* select format */ 991 priv->cfmt_code = mf->code; 992 } else { 993 cfg->try_fmt = *mf; 994 } 995 out: 996 mutex_unlock(&priv->lock); 997 998 return ret; 999 } 1000 1001 static int ov2640_init_cfg(struct v4l2_subdev *sd, 1002 struct v4l2_subdev_pad_config *cfg) 1003 { 1004 struct i2c_client *client = v4l2_get_subdevdata(sd); 1005 struct ov2640_priv *priv = to_ov2640(cli
[PATCH 2/3] media: ov2640: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE is specified. Cc: Sakari Ailus Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- drivers/media/i2c/ov2640.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c index a07e6f2..5f888f5 100644 --- a/drivers/media/i2c/ov2640.c +++ b/drivers/media/i2c/ov2640.c @@ -926,6 +926,12 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd, if (format->pad) return -EINVAL; + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { + mf = v4l2_subdev_get_try_format(sd, cfg, 0); + format->format = *mf; + + return 0; + } mf->width = priv->win->width; mf->height = priv->win->height; @@ -992,6 +998,26 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd, return ret; } +static int ov2640_init_cfg(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct ov2640_priv *priv = to_ov2640(client); + struct v4l2_mbus_framefmt *try_fmt = + v4l2_subdev_get_try_format(sd, cfg, 0); + + try_fmt->width = priv->win->width; + try_fmt->height = priv->win->height; + try_fmt->code = priv->cfmt_code; + try_fmt->colorspace = V4L2_COLORSPACE_SRGB; + try_fmt->field = V4L2_FIELD_NONE; + try_fmt->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; + try_fmt->quantization = V4L2_QUANTIZATION_DEFAULT; + try_fmt->xfer_func = V4L2_XFER_FUNC_DEFAULT; + + return 0; +} + static int ov2640_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_mbus_code_enum *code) @@ -1101,6 +1127,7 @@ static const struct v4l2_subdev_core_ops ov2640_subdev_core_ops = { }; static const struct v4l2_subdev_pad_ops ov2640_subdev_pad_ops = { + .init_cfg = ov2640_init_cfg, .enum_mbus_code = ov2640_enum_mbus_code, .get_selection = ov2640_get_selection, .get_fmt= ov2640_get_fmt, -- 2.7.4
Re: [Xen-devel][RFC 2/3] xen/grant-table: Extend API to work with DMA buffers
On 05/19/2018 01:19 AM, Boris Ostrovsky wrote: On 05/17/2018 04:26 AM, Oleksandr Andrushchenko wrote: From: Oleksandr Andrushchenko Signed-off-by: Oleksandr Andrushchenko --- drivers/xen/grant-table.c | 49 +++ include/xen/grant_table.h | 7 ++ 2 files changed, 56 insertions(+) diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index bb36b1e1dbcc..c27bcc420575 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c @@ -729,6 +729,55 @@ void gnttab_free_pages(int nr_pages, struct page **pages) } EXPORT_SYMBOL(gnttab_free_pages); +int gnttab_dma_alloc_pages(struct device *dev, bool coherent, + int nr_pages, struct page **pages, + void **vaddr, dma_addr_t *dev_bus_addr) +{ + int i; + int ret; + + ret = alloc_dma_xenballooned_pages(dev, coherent, nr_pages, pages, + vaddr, dev_bus_addr); + if (ret < 0) + return ret; + + for (i = 0; i < nr_pages; i++) { +#if BITS_PER_LONG < 64 + struct xen_page_foreign *foreign; + + foreign = kzalloc(sizeof(*foreign), GFP_KERNEL); + if (!foreign) { + gnttab_dma_free_pages(dev, flags, nr_pages, pages, + *vaddr, *dev_bus_addr); + return -ENOMEM; + } + set_page_private(pages[i], (unsigned long)foreign); +#endif + SetPagePrivate(pages[i]); + } + return 0; +} +EXPORT_SYMBOL(gnttab_dma_alloc_pages); + +void gnttab_dma_free_pages(struct device *dev, bool coherent, + int nr_pages, struct page **pages, + void *vaddr, dma_addr_t dev_bus_addr) +{ + int i; + + for (i = 0; i < nr_pages; i++) { + if (PagePrivate(pages[i])) { +#if BITS_PER_LONG < 64 + kfree((void *)page_private(pages[i])); +#endif + ClearPagePrivate(pages[i]); + } + } + free_dma_xenballooned_pages(dev, coherent, nr_pages, pages, + vaddr, dev_bus_addr); +} +EXPORT_SYMBOL(gnttab_dma_free_pages); Given that these routines look almost exactly like their non-dma counterparts I wonder whether common code could be factored out. Yes, this can be done -boris + /* Handling of paged out grant targets (GNTST_eagain) */ #define MAX_DELAY 256 static inline void diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h index 34b1379f9777..20ee2b5ba965 100644 --- a/include/xen/grant_table.h +++ b/include/xen/grant_table.h @@ -195,6 +195,13 @@ void gnttab_free_auto_xlat_frames(void); int gnttab_alloc_pages(int nr_pages, struct page **pages); void gnttab_free_pages(int nr_pages, struct page **pages); +int gnttab_dma_alloc_pages(struct device *dev, bool coherent, + int nr_pages, struct page **pages, + void **vaddr, dma_addr_t *dev_bus_addr); +void gnttab_dma_free_pages(struct device *dev, bool coherent, + int nr_pages, struct page **pages, + void *vaddr, dma_addr_t dev_bus_addr); + int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, struct gnttab_map_grant_ref *kmap_ops, struct page **pages, unsigned int count);
Re: [Xen-devel][RFC 2/3] xen/grant-table: Extend API to work with DMA buffers
On 05/17/2018 04:26 AM, Oleksandr Andrushchenko wrote: > From: Oleksandr Andrushchenko > > Signed-off-by: Oleksandr Andrushchenko > --- > drivers/xen/grant-table.c | 49 +++ > include/xen/grant_table.h | 7 ++ > 2 files changed, 56 insertions(+) > > diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c > index bb36b1e1dbcc..c27bcc420575 100644 > --- a/drivers/xen/grant-table.c > +++ b/drivers/xen/grant-table.c > @@ -729,6 +729,55 @@ void gnttab_free_pages(int nr_pages, struct page **pages) > } > EXPORT_SYMBOL(gnttab_free_pages); > > +int gnttab_dma_alloc_pages(struct device *dev, bool coherent, > +int nr_pages, struct page **pages, > +void **vaddr, dma_addr_t *dev_bus_addr) > +{ > + int i; > + int ret; > + > + ret = alloc_dma_xenballooned_pages(dev, coherent, nr_pages, pages, > +vaddr, dev_bus_addr); > + if (ret < 0) > + return ret; > + > + for (i = 0; i < nr_pages; i++) { > +#if BITS_PER_LONG < 64 > + struct xen_page_foreign *foreign; > + > + foreign = kzalloc(sizeof(*foreign), GFP_KERNEL); > + if (!foreign) { > + gnttab_dma_free_pages(dev, flags, nr_pages, pages, > + *vaddr, *dev_bus_addr); > + return -ENOMEM; > + } > + set_page_private(pages[i], (unsigned long)foreign); > +#endif > + SetPagePrivate(pages[i]); > + } > + return 0; > +} > +EXPORT_SYMBOL(gnttab_dma_alloc_pages); > + > +void gnttab_dma_free_pages(struct device *dev, bool coherent, > +int nr_pages, struct page **pages, > +void *vaddr, dma_addr_t dev_bus_addr) > +{ > + int i; > + > + for (i = 0; i < nr_pages; i++) { > + if (PagePrivate(pages[i])) { > +#if BITS_PER_LONG < 64 > + kfree((void *)page_private(pages[i])); > +#endif > + ClearPagePrivate(pages[i]); > + } > + } > + free_dma_xenballooned_pages(dev, coherent, nr_pages, pages, > + vaddr, dev_bus_addr); > +} > +EXPORT_SYMBOL(gnttab_dma_free_pages); Given that these routines look almost exactly like their non-dma counterparts I wonder whether common code could be factored out. -boris > + > /* Handling of paged out grant targets (GNTST_eagain) */ > #define MAX_DELAY 256 > static inline void > diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h > index 34b1379f9777..20ee2b5ba965 100644 > --- a/include/xen/grant_table.h > +++ b/include/xen/grant_table.h > @@ -195,6 +195,13 @@ void gnttab_free_auto_xlat_frames(void); > int gnttab_alloc_pages(int nr_pages, struct page **pages); > void gnttab_free_pages(int nr_pages, struct page **pages); > > +int gnttab_dma_alloc_pages(struct device *dev, bool coherent, > +int nr_pages, struct page **pages, > +void **vaddr, dma_addr_t *dev_bus_addr); > +void gnttab_dma_free_pages(struct device *dev, bool coherent, > +int nr_pages, struct page **pages, > +void *vaddr, dma_addr_t dev_bus_addr); > + > int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, > struct gnttab_map_grant_ref *kmap_ops, > struct page **pages, unsigned int count);
[Xen-devel][RFC 2/3] xen/grant-table: Extend API to work with DMA buffers
From: Oleksandr Andrushchenko Signed-off-by: Oleksandr Andrushchenko --- drivers/xen/grant-table.c | 49 +++ include/xen/grant_table.h | 7 ++ 2 files changed, 56 insertions(+) diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index bb36b1e1dbcc..c27bcc420575 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c @@ -729,6 +729,55 @@ void gnttab_free_pages(int nr_pages, struct page **pages) } EXPORT_SYMBOL(gnttab_free_pages); +int gnttab_dma_alloc_pages(struct device *dev, bool coherent, + int nr_pages, struct page **pages, + void **vaddr, dma_addr_t *dev_bus_addr) +{ + int i; + int ret; + + ret = alloc_dma_xenballooned_pages(dev, coherent, nr_pages, pages, + vaddr, dev_bus_addr); + if (ret < 0) + return ret; + + for (i = 0; i < nr_pages; i++) { +#if BITS_PER_LONG < 64 + struct xen_page_foreign *foreign; + + foreign = kzalloc(sizeof(*foreign), GFP_KERNEL); + if (!foreign) { + gnttab_dma_free_pages(dev, flags, nr_pages, pages, + *vaddr, *dev_bus_addr); + return -ENOMEM; + } + set_page_private(pages[i], (unsigned long)foreign); +#endif + SetPagePrivate(pages[i]); + } + return 0; +} +EXPORT_SYMBOL(gnttab_dma_alloc_pages); + +void gnttab_dma_free_pages(struct device *dev, bool coherent, + int nr_pages, struct page **pages, + void *vaddr, dma_addr_t dev_bus_addr) +{ + int i; + + for (i = 0; i < nr_pages; i++) { + if (PagePrivate(pages[i])) { +#if BITS_PER_LONG < 64 + kfree((void *)page_private(pages[i])); +#endif + ClearPagePrivate(pages[i]); + } + } + free_dma_xenballooned_pages(dev, coherent, nr_pages, pages, + vaddr, dev_bus_addr); +} +EXPORT_SYMBOL(gnttab_dma_free_pages); + /* Handling of paged out grant targets (GNTST_eagain) */ #define MAX_DELAY 256 static inline void diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h index 34b1379f9777..20ee2b5ba965 100644 --- a/include/xen/grant_table.h +++ b/include/xen/grant_table.h @@ -195,6 +195,13 @@ void gnttab_free_auto_xlat_frames(void); int gnttab_alloc_pages(int nr_pages, struct page **pages); void gnttab_free_pages(int nr_pages, struct page **pages); +int gnttab_dma_alloc_pages(struct device *dev, bool coherent, + int nr_pages, struct page **pages, + void **vaddr, dma_addr_t *dev_bus_addr); +void gnttab_dma_free_pages(struct device *dev, bool coherent, + int nr_pages, struct page **pages, + void *vaddr, dma_addr_t dev_bus_addr); + int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, struct gnttab_map_grant_ref *kmap_ops, struct page **pages, unsigned int count); -- 2.17.0
[PATCH v14 30/33] rcar-vin: extend {start,stop}_streaming to work with media controller
The procedure to start or stop streaming using the non-MC single subdevice and the MC graph and multiple subdevices are quite different. Create a new function to abstract which method is used based on which mode the driver is running in and add logic to start the MC graph. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Reviewed-by: Hans Verkuil --- * Changes since v12 - Rebase to latest media-tree/master changed a 'return ret' to a 'goto out' in rvin_start_streaming(). --- drivers/media/platform/rcar-vin/rcar-dma.c | 135 +++-- 1 file changed, 127 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index d70a689d9dd3713f..4a3a195e7f59047c 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -996,10 +996,126 @@ static void rvin_buffer_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&vin->qlock, flags); } +static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd, + struct media_pad *pad) +{ + struct v4l2_subdev_format fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + + fmt.pad = pad->index; + if (v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt)) + return -EPIPE; + + switch (fmt.format.code) { + case MEDIA_BUS_FMT_YUYV8_1X16: + case MEDIA_BUS_FMT_UYVY8_2X8: + case MEDIA_BUS_FMT_UYVY10_2X10: + case MEDIA_BUS_FMT_RGB888_1X24: + vin->mbus_code = fmt.format.code; + break; + default: + return -EPIPE; + } + + switch (fmt.format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Supported natively */ + break; + case V4L2_FIELD_ALTERNATE: + switch (vin->format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + break; + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Use VIN hardware to combine the two fields */ + fmt.format.height *= 2; + break; + default: + return -EPIPE; + } + break; + default: + return -EPIPE; + } + + if (fmt.format.width != vin->format.width || + fmt.format.height != vin->format.height || + fmt.format.code != vin->mbus_code) + return -EPIPE; + + return 0; +} + +static int rvin_set_stream(struct rvin_dev *vin, int on) +{ + struct media_pipeline *pipe; + struct media_device *mdev; + struct v4l2_subdev *sd; + struct media_pad *pad; + int ret; + + /* No media controller used, simply pass operation to subdevice. */ + if (!vin->info->use_mc) { + ret = v4l2_subdev_call(vin->digital->subdev, video, s_stream, + on); + + return ret == -ENOIOCTLCMD ? 0 : ret; + } + + pad = media_entity_remote_pad(&vin->pad); + if (!pad) + return -EPIPE; + + sd = media_entity_to_v4l2_subdev(pad->entity); + + if (!on) { + media_pipeline_stop(&vin->vdev.entity); + return v4l2_subdev_call(sd, video, s_stream, 0); + } + + ret = rvin_mc_validate_format(vin, sd, pad); + if (ret) + return ret; + + /* +* The graph lock needs to be taken to protect concurrent +* starts of multiple VIN instances as they might share +* a common subdevice down the line and then should use +* the same pipe. +*/ + mdev = vin->vdev.entity.graph_obj.mdev; + mutex_lock(&mdev->graph_mutex); + pipe = sd->entity.pipe ? sd->entity.pipe : &vin->vdev.pipe; + ret = __media_pipeline_start(&vin->vdev.entity, pipe); + mutex_unlock(&mdev->graph_mutex); + if (ret) + return ret; + + ret = v4l2_subdev_call(sd, video, s_stream, 1); + if (ret == -ENOIOCTLCMD) + ret = 0; + if (ret) + media_pipeline_stop(&vin->vdev.entity); + + return ret; +} + static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) { struct rvin_dev *vin = vb2_get_drv_priv(vq); - struct v4l2_subdev *sd; unsigned long flags; int ret; @@ -1014,8 +1130,13 @@ static int rvin_start
[PATCH v13 30/33] rcar-vin: extend {start,stop}_streaming to work with media controller
The procedure to start or stop streaming using the non-MC single subdevice and the MC graph and multiple subdevices are quite different. Create a new function to abstract which method is used based on which mode the driver is running in and add logic to start the MC graph. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Reviewed-by: Hans Verkuil --- * Changes since v12 - Rebase to latest media-tree/master changed a 'return ret' to a 'goto out' in rvin_start_streaming(). --- drivers/media/platform/rcar-vin/rcar-dma.c | 135 +++-- 1 file changed, 127 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index a93772c10baaa003..00bdc523294f2280 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -997,10 +997,126 @@ static void rvin_buffer_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&vin->qlock, flags); } +static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd, + struct media_pad *pad) +{ + struct v4l2_subdev_format fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + + fmt.pad = pad->index; + if (v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt)) + return -EPIPE; + + switch (fmt.format.code) { + case MEDIA_BUS_FMT_YUYV8_1X16: + case MEDIA_BUS_FMT_UYVY8_2X8: + case MEDIA_BUS_FMT_UYVY10_2X10: + case MEDIA_BUS_FMT_RGB888_1X24: + vin->mbus_code = fmt.format.code; + break; + default: + return -EPIPE; + } + + switch (fmt.format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Supported natively */ + break; + case V4L2_FIELD_ALTERNATE: + switch (vin->format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + break; + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Use VIN hardware to combine the two fields */ + fmt.format.height *= 2; + break; + default: + return -EPIPE; + } + break; + default: + return -EPIPE; + } + + if (fmt.format.width != vin->format.width || + fmt.format.height != vin->format.height || + fmt.format.code != vin->mbus_code) + return -EPIPE; + + return 0; +} + +static int rvin_set_stream(struct rvin_dev *vin, int on) +{ + struct media_pipeline *pipe; + struct media_device *mdev; + struct v4l2_subdev *sd; + struct media_pad *pad; + int ret; + + /* No media controller used, simply pass operation to subdevice. */ + if (!vin->info->use_mc) { + ret = v4l2_subdev_call(vin->digital->subdev, video, s_stream, + on); + + return ret == -ENOIOCTLCMD ? 0 : ret; + } + + pad = media_entity_remote_pad(&vin->pad); + if (!pad) + return -EPIPE; + + sd = media_entity_to_v4l2_subdev(pad->entity); + + if (!on) { + media_pipeline_stop(&vin->vdev.entity); + return v4l2_subdev_call(sd, video, s_stream, 0); + } + + ret = rvin_mc_validate_format(vin, sd, pad); + if (ret) + return ret; + + /* +* The graph lock needs to be taken to protect concurrent +* starts of multiple VIN instances as they might share +* a common subdevice down the line and then should use +* the same pipe. +*/ + mdev = vin->vdev.entity.graph_obj.mdev; + mutex_lock(&mdev->graph_mutex); + pipe = sd->entity.pipe ? sd->entity.pipe : &vin->vdev.pipe; + ret = __media_pipeline_start(&vin->vdev.entity, pipe); + mutex_unlock(&mdev->graph_mutex); + if (ret) + return ret; + + ret = v4l2_subdev_call(sd, video, s_stream, 1); + if (ret == -ENOIOCTLCMD) + ret = 0; + if (ret) + media_pipeline_stop(&vin->vdev.entity); + + return ret; +} + static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) { struct rvin_dev *vin = vb2_get_drv_priv(vq); - struct v4l2_subdev *sd; unsigned long flags; int ret; @@ -1015,8 +1131,13 @@ static int rvin_start
Re: [PATCH v12 30/33] rcar-vin: extend {start,stop}_streaming to work with media controller
On 07/03/18 23:05, Niklas Söderlund wrote: > The procedure to start or stop streaming using the non-MC single > subdevice and the MC graph and multiple subdevices are quite different. > Create a new function to abstract which method is used based on which > mode the driver is running in and add logic to start the MC graph. > > Signed-off-by: Niklas Söderlund > Reviewed-by: Laurent Pinchart Reviewed-by: Hans Verkuil Regards, Hans > --- > drivers/media/platform/rcar-vin/rcar-dma.c | 133 > +++-- > 1 file changed, 126 insertions(+), 7 deletions(-) > > diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c > b/drivers/media/platform/rcar-vin/rcar-dma.c > index da113531f0ce7dc0..580b286acbf2dab6 100644 > --- a/drivers/media/platform/rcar-vin/rcar-dma.c > +++ b/drivers/media/platform/rcar-vin/rcar-dma.c > @@ -1082,15 +1082,136 @@ static void rvin_buffer_queue(struct vb2_buffer *vb) > spin_unlock_irqrestore(&vin->qlock, flags); > } > > +static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev > *sd, > +struct media_pad *pad) > +{ > + struct v4l2_subdev_format fmt = { > + .which = V4L2_SUBDEV_FORMAT_ACTIVE, > + }; > + > + fmt.pad = pad->index; > + if (v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt)) > + return -EPIPE; > + > + switch (fmt.format.code) { > + case MEDIA_BUS_FMT_YUYV8_1X16: > + case MEDIA_BUS_FMT_UYVY8_2X8: > + case MEDIA_BUS_FMT_UYVY10_2X10: > + case MEDIA_BUS_FMT_RGB888_1X24: > + vin->mbus_code = fmt.format.code; > + break; > + default: > + return -EPIPE; > + } > + > + switch (fmt.format.field) { > + case V4L2_FIELD_TOP: > + case V4L2_FIELD_BOTTOM: > + case V4L2_FIELD_NONE: > + case V4L2_FIELD_INTERLACED_TB: > + case V4L2_FIELD_INTERLACED_BT: > + case V4L2_FIELD_INTERLACED: > + case V4L2_FIELD_SEQ_TB: > + case V4L2_FIELD_SEQ_BT: > + /* Supported natively */ > + break; > + case V4L2_FIELD_ALTERNATE: > + switch (vin->format.field) { > + case V4L2_FIELD_TOP: > + case V4L2_FIELD_BOTTOM: > + case V4L2_FIELD_NONE: > + break; > + case V4L2_FIELD_INTERLACED_TB: > + case V4L2_FIELD_INTERLACED_BT: > + case V4L2_FIELD_INTERLACED: > + case V4L2_FIELD_SEQ_TB: > + case V4L2_FIELD_SEQ_BT: > + /* Use VIN hardware to combine the two fields */ > + fmt.format.height *= 2; > + break; > + default: > + return -EPIPE; > + } > + break; > + default: > + return -EPIPE; > + } > + > + if (fmt.format.width != vin->format.width || > + fmt.format.height != vin->format.height || > + fmt.format.code != vin->mbus_code) > + return -EPIPE; > + > + return 0; > +} > + > +static int rvin_set_stream(struct rvin_dev *vin, int on) > +{ > + struct media_pipeline *pipe; > + struct media_device *mdev; > + struct v4l2_subdev *sd; > + struct media_pad *pad; > + int ret; > + > + /* No media controller used, simply pass operation to subdevice. */ > + if (!vin->info->use_mc) { > + ret = v4l2_subdev_call(vin->digital->subdev, video, s_stream, > +on); > + > + return ret == -ENOIOCTLCMD ? 0 : ret; > + } > + > + pad = media_entity_remote_pad(&vin->pad); > + if (!pad) > + return -EPIPE; > + > + sd = media_entity_to_v4l2_subdev(pad->entity); > + > + if (!on) { > + media_pipeline_stop(&vin->vdev.entity); > + return v4l2_subdev_call(sd, video, s_stream, 0); > + } > + > + ret = rvin_mc_validate_format(vin, sd, pad); > + if (ret) > + return ret; > + > + /* > + * The graph lock needs to be taken to protect concurrent > + * starts of multiple VIN instances as they might share > + * a common subdevice down the line and then should use > + * the same pipe. > + */ > + mdev = vin->vdev.entity.graph_obj.mdev; > + mutex_lock(&mdev->graph_mutex); > + pipe = sd->entity.pipe ? sd->entity.pipe : &vin->vdev.pipe; > + ret = __media_pipeline_start(&vin->vdev.entity, pipe); > + mutex_unlock(&mdev->graph_mutex); > + if (ret) > + return ret; > + > + ret = v4l2_subdev_call(sd, video, s_stream, 1); > + if (ret == -ENOIOCTLCMD) > + ret = 0; > + if (ret) > + media_pipeline_stop(&vin->vdev.entity); > + > + return ret; > +} > + > static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) > { > struct rvin_dev *vin = vb2_get_drv_priv(vq); > - struct v4l2_subdev *sd; > unsigned long flags; > int ret; > > - sd
[PATCH v12 30/33] rcar-vin: extend {start,stop}_streaming to work with media controller
The procedure to start or stop streaming using the non-MC single subdevice and the MC graph and multiple subdevices are quite different. Create a new function to abstract which method is used based on which mode the driver is running in and add logic to start the MC graph. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- drivers/media/platform/rcar-vin/rcar-dma.c | 133 +++-- 1 file changed, 126 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index da113531f0ce7dc0..580b286acbf2dab6 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -1082,15 +1082,136 @@ static void rvin_buffer_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&vin->qlock, flags); } +static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd, + struct media_pad *pad) +{ + struct v4l2_subdev_format fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + + fmt.pad = pad->index; + if (v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt)) + return -EPIPE; + + switch (fmt.format.code) { + case MEDIA_BUS_FMT_YUYV8_1X16: + case MEDIA_BUS_FMT_UYVY8_2X8: + case MEDIA_BUS_FMT_UYVY10_2X10: + case MEDIA_BUS_FMT_RGB888_1X24: + vin->mbus_code = fmt.format.code; + break; + default: + return -EPIPE; + } + + switch (fmt.format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Supported natively */ + break; + case V4L2_FIELD_ALTERNATE: + switch (vin->format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + break; + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Use VIN hardware to combine the two fields */ + fmt.format.height *= 2; + break; + default: + return -EPIPE; + } + break; + default: + return -EPIPE; + } + + if (fmt.format.width != vin->format.width || + fmt.format.height != vin->format.height || + fmt.format.code != vin->mbus_code) + return -EPIPE; + + return 0; +} + +static int rvin_set_stream(struct rvin_dev *vin, int on) +{ + struct media_pipeline *pipe; + struct media_device *mdev; + struct v4l2_subdev *sd; + struct media_pad *pad; + int ret; + + /* No media controller used, simply pass operation to subdevice. */ + if (!vin->info->use_mc) { + ret = v4l2_subdev_call(vin->digital->subdev, video, s_stream, + on); + + return ret == -ENOIOCTLCMD ? 0 : ret; + } + + pad = media_entity_remote_pad(&vin->pad); + if (!pad) + return -EPIPE; + + sd = media_entity_to_v4l2_subdev(pad->entity); + + if (!on) { + media_pipeline_stop(&vin->vdev.entity); + return v4l2_subdev_call(sd, video, s_stream, 0); + } + + ret = rvin_mc_validate_format(vin, sd, pad); + if (ret) + return ret; + + /* +* The graph lock needs to be taken to protect concurrent +* starts of multiple VIN instances as they might share +* a common subdevice down the line and then should use +* the same pipe. +*/ + mdev = vin->vdev.entity.graph_obj.mdev; + mutex_lock(&mdev->graph_mutex); + pipe = sd->entity.pipe ? sd->entity.pipe : &vin->vdev.pipe; + ret = __media_pipeline_start(&vin->vdev.entity, pipe); + mutex_unlock(&mdev->graph_mutex); + if (ret) + return ret; + + ret = v4l2_subdev_call(sd, video, s_stream, 1); + if (ret == -ENOIOCTLCMD) + ret = 0; + if (ret) + media_pipeline_stop(&vin->vdev.entity); + + return ret; +} + static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) { struct rvin_dev *vin = vb2_get_drv_priv(vq); - struct v4l2_subdev *sd; unsigned long flags; int ret; - sd = vin_to_source(vin); - v4l2_subdev_call(sd, video, s_stream, 1); + ret = rvin_set_stream(vin, 1); + if (ret) { + spin_lock_irqsave(&vin->qlock, flags); +
[PATCH v11 29/32] rcar-vin: extend {start,stop}_streaming to work with media controller
The procedure to start or stop streaming using the non-MC single subdevice and the MC graph and multiple subdevices are quite different. Create a new function to abstract which method is used based on which mode the driver is running in and add logic to start the MC graph. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- drivers/media/platform/rcar-vin/rcar-dma.c | 133 +++-- 1 file changed, 126 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 27d0c098f1da40f9..dd70d12ff693e500 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -1087,15 +1087,136 @@ static void rvin_buffer_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&vin->qlock, flags); } +static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd, + struct media_pad *pad) +{ + struct v4l2_subdev_format fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + + fmt.pad = pad->index; + if (v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt)) + return -EPIPE; + + switch (fmt.format.code) { + case MEDIA_BUS_FMT_YUYV8_1X16: + case MEDIA_BUS_FMT_UYVY8_2X8: + case MEDIA_BUS_FMT_UYVY10_2X10: + case MEDIA_BUS_FMT_RGB888_1X24: + vin->mbus_code = fmt.format.code; + break; + default: + return -EPIPE; + } + + switch (fmt.format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Supported natively */ + break; + case V4L2_FIELD_ALTERNATE: + switch (vin->format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + break; + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Use VIN hardware to combine the two fields */ + fmt.format.height *= 2; + break; + default: + return -EPIPE; + } + break; + default: + return -EPIPE; + } + + if (fmt.format.width != vin->format.width || + fmt.format.height != vin->format.height || + fmt.format.code != vin->mbus_code) + return -EPIPE; + + return 0; +} + +static int rvin_set_stream(struct rvin_dev *vin, int on) +{ + struct media_pipeline *pipe; + struct media_device *mdev; + struct v4l2_subdev *sd; + struct media_pad *pad; + int ret; + + /* No media controller used, simply pass operation to subdevice. */ + if (!vin->info->use_mc) { + ret = v4l2_subdev_call(vin->digital->subdev, video, s_stream, + on); + + return ret == -ENOIOCTLCMD ? 0 : ret; + } + + pad = media_entity_remote_pad(&vin->pad); + if (!pad) + return -EPIPE; + + sd = media_entity_to_v4l2_subdev(pad->entity); + + if (!on) { + media_pipeline_stop(&vin->vdev.entity); + return v4l2_subdev_call(sd, video, s_stream, 0); + } + + ret = rvin_mc_validate_format(vin, sd, pad); + if (ret) + return ret; + + /* +* The graph lock needs to be taken to protect concurrent +* starts of multiple VIN instances as they might share +* a common subdevice down the line and then should use +* the same pipe. +*/ + mdev = vin->vdev.entity.graph_obj.mdev; + mutex_lock(&mdev->graph_mutex); + pipe = sd->entity.pipe ? sd->entity.pipe : &vin->vdev.pipe; + ret = __media_pipeline_start(&vin->vdev.entity, pipe); + mutex_unlock(&mdev->graph_mutex); + if (ret) + return ret; + + ret = v4l2_subdev_call(sd, video, s_stream, 1); + if (ret == -ENOIOCTLCMD) + ret = 0; + if (ret) + media_pipeline_stop(&vin->vdev.entity); + + return ret; +} + static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) { struct rvin_dev *vin = vb2_get_drv_priv(vq); - struct v4l2_subdev *sd; unsigned long flags; int ret; - sd = vin_to_source(vin); - v4l2_subdev_call(sd, video, s_stream, 1); + ret = rvin_set_stream(vin, 1); + if (ret) { + spin_lock_irqsave(&vin->qlock, flags); +
Re: [PATCH v10 27/30] rcar-vin: extend {start,stop}_streaming to work with media controller
Hi Niklas, Thank you for the patch. On Monday, 29 January 2018 18:34:32 EET Niklas Söderlund wrote: > The procedure to start or stop streaming using the non-MC single > subdevice and the MC graph and multiple subdevices are quite different. > Create a new function to abstract which method is used based on which > mode the driver is running in and add logic to start the MC graph. > > Signed-off-by: Niklas Söderlund > --- > drivers/media/platform/rcar-vin/rcar-dma.c | 123 +++-- > 1 file changed, 116 insertions(+), 7 deletions(-) > > diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c > b/drivers/media/platform/rcar-vin/rcar-dma.c index > 811d8f8638d21200..6784e7eb3d96e1c0 100644 > --- a/drivers/media/platform/rcar-vin/rcar-dma.c > +++ b/drivers/media/platform/rcar-vin/rcar-dma.c > @@ -1087,15 +1087,126 @@ static void rvin_buffer_queue(struct vb2_buffer > *vb) spin_unlock_irqrestore(&vin->qlock, flags); > } > > +static int rvin_set_stream(struct rvin_dev *vin, int on) > +{ > + struct v4l2_subdev_format fmt = { > + .which = V4L2_SUBDEV_FORMAT_ACTIVE, > + }; > + struct media_pipeline *pipe; > + struct media_device *mdev; > + struct v4l2_subdev *sd; > + struct media_pad *pad; > + int ret; > + > + /* No media controller used, simply pass operation to subdevice */ > + if (!vin->info->use_mc) { > + ret = v4l2_subdev_call(vin->digital->subdev, video, s_stream, > +on); > + > + return ret == -ENOIOCTLCMD ? 0 : ret; > + } > + > + pad = media_entity_remote_pad(&vin->pad); > + if (!pad) > + return -EPIPE; > + > + sd = media_entity_to_v4l2_subdev(pad->entity); > + > + if (!on) { > + media_pipeline_stop(&vin->vdev.entity); > + return v4l2_subdev_call(sd, video, s_stream, 0); > + } > + > + fmt.pad = pad->index; > + if (v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt)) > + return -EPIPE; > + > + switch (fmt.format.code) { > + case MEDIA_BUS_FMT_YUYV8_1X16: > + case MEDIA_BUS_FMT_UYVY8_2X8: > + case MEDIA_BUS_FMT_UYVY10_2X10: > + case MEDIA_BUS_FMT_RGB888_1X24: > + vin->code = fmt.format.code; > + break; > + default: > + return -EPIPE; > + } > + > + switch (fmt.format.field) { > + case V4L2_FIELD_TOP: > + case V4L2_FIELD_BOTTOM: > + case V4L2_FIELD_NONE: > + case V4L2_FIELD_INTERLACED_TB: > + case V4L2_FIELD_INTERLACED_BT: > + case V4L2_FIELD_INTERLACED: > + case V4L2_FIELD_SEQ_TB: > + case V4L2_FIELD_SEQ_BT: > + /* Supported natively */ > + break; > + case V4L2_FIELD_ALTERNATE: > + switch (vin->format.field) { > + case V4L2_FIELD_TOP: > + case V4L2_FIELD_BOTTOM: > + case V4L2_FIELD_NONE: > + break; > + case V4L2_FIELD_INTERLACED_TB: > + case V4L2_FIELD_INTERLACED_BT: > + case V4L2_FIELD_INTERLACED: > + case V4L2_FIELD_SEQ_TB: > + case V4L2_FIELD_SEQ_BT: > + /* Use VIN hardware to combine the two fields */ > + fmt.format.height *= 2; > + break; > + default: > + return -EPIPE; > + } > + break; > + default: > + return -EPIPE; > + } > + > + if (fmt.format.width != vin->format.width || > + fmt.format.height != vin->format.height || > + fmt.format.code != vin->code) > + return -EPIPE; I'd create a rvin_mc_validate_format() function and move this code there. This function is growing a bit too big. > + mdev = vin->vdev.entity.graph_obj.mdev; > + > + /* > + * The graph lock needs to be taken to protect concurrent > + * starts of multiple VIN instances as they might share > + * a common subdevice down the line and then should use > + * the same pipe. > + */ > + mutex_lock(&mdev->graph_mutex); I'd say mutex_lock_interruptible(), but videobuf2 won't support that :-S > + pipe = sd->entity.pipe ? sd->entity.pipe : &vin->vdev.pipe; > + ret = __media_pipeline_start(&vin->vdev.entity, pipe); > + mutex_unlock(&mdev->graph_mutex); > + if (ret) > + return ret; > + > + ret = v4l2_subdev_call(sd, video, s_stream, 1); > + if (ret == -ENOIOCTLCMD) > + ret = 0; > + if (ret) > + media_pipeline_stop(&vin->vdev.entity); > + > + return ret; > +} > + > static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) > { > struct rvin_dev *vin = vb2_get_drv_priv(vq); > - struct v4l2_subdev *sd; > unsigned long flags; > int ret; > > - sd = vin_to_source(vin); > - v4l2_subdev_call(sd, video, s_stream, 1); > + ret = rvin_set_stream(vin, 1); > + if (ret) { > +
[PATCH v10 27/30] rcar-vin: extend {start,stop}_streaming to work with media controller
The procedure to start or stop streaming using the non-MC single subdevice and the MC graph and multiple subdevices are quite different. Create a new function to abstract which method is used based on which mode the driver is running in and add logic to start the MC graph. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-dma.c | 123 +++-- 1 file changed, 116 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 811d8f8638d21200..6784e7eb3d96e1c0 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -1087,15 +1087,126 @@ static void rvin_buffer_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&vin->qlock, flags); } +static int rvin_set_stream(struct rvin_dev *vin, int on) +{ + struct v4l2_subdev_format fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + struct media_pipeline *pipe; + struct media_device *mdev; + struct v4l2_subdev *sd; + struct media_pad *pad; + int ret; + + /* No media controller used, simply pass operation to subdevice */ + if (!vin->info->use_mc) { + ret = v4l2_subdev_call(vin->digital->subdev, video, s_stream, + on); + + return ret == -ENOIOCTLCMD ? 0 : ret; + } + + pad = media_entity_remote_pad(&vin->pad); + if (!pad) + return -EPIPE; + + sd = media_entity_to_v4l2_subdev(pad->entity); + + if (!on) { + media_pipeline_stop(&vin->vdev.entity); + return v4l2_subdev_call(sd, video, s_stream, 0); + } + + fmt.pad = pad->index; + if (v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt)) + return -EPIPE; + + switch (fmt.format.code) { + case MEDIA_BUS_FMT_YUYV8_1X16: + case MEDIA_BUS_FMT_UYVY8_2X8: + case MEDIA_BUS_FMT_UYVY10_2X10: + case MEDIA_BUS_FMT_RGB888_1X24: + vin->code = fmt.format.code; + break; + default: + return -EPIPE; + } + + switch (fmt.format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Supported natively */ + break; + case V4L2_FIELD_ALTERNATE: + switch (vin->format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + break; + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Use VIN hardware to combine the two fields */ + fmt.format.height *= 2; + break; + default: + return -EPIPE; + } + break; + default: + return -EPIPE; + } + + if (fmt.format.width != vin->format.width || + fmt.format.height != vin->format.height || + fmt.format.code != vin->code) + return -EPIPE; + + mdev = vin->vdev.entity.graph_obj.mdev; + + /* +* The graph lock needs to be taken to protect concurrent +* starts of multiple VIN instances as they might share +* a common subdevice down the line and then should use +* the same pipe. +*/ + mutex_lock(&mdev->graph_mutex); + pipe = sd->entity.pipe ? sd->entity.pipe : &vin->vdev.pipe; + ret = __media_pipeline_start(&vin->vdev.entity, pipe); + mutex_unlock(&mdev->graph_mutex); + if (ret) + return ret; + + ret = v4l2_subdev_call(sd, video, s_stream, 1); + if (ret == -ENOIOCTLCMD) + ret = 0; + if (ret) + media_pipeline_stop(&vin->vdev.entity); + + return ret; +} + static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) { struct rvin_dev *vin = vb2_get_drv_priv(vq); - struct v4l2_subdev *sd; unsigned long flags; int ret; - sd = vin_to_source(vin); - v4l2_subdev_call(sd, video, s_stream, 1); + ret = rvin_set_stream(vin, 1); + if (ret) { + spin_lock_irqsave(&vin->qlock, flags); + return_all_buffers(vin, VB2_BUF_STATE_QUEUED); + spin_unlock_irqrestore(&vin->qlock, flags); + return ret; + } spin_lock_irqsave(&vin->qlock, flags); @@ -1104,7 +1215,7 @@ static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count)
Re: [PATCH v9 25/28] rcar-vin: extend {start,stop}_streaming to work with media controller
Hi Niklas, Thank you for the patch. On Friday, 8 December 2017 03:08:39 EET Niklas Söderlund wrote: > The procedure to start or stop streaming using the non-MC single > subdevice and the MC graph and multiple subdevices are quite different. > Create a new function to abstract which method is used based on which > mode the driver is running in and add logic to start the MC graph. > > Signed-off-by: Niklas Söderlund > Reviewed-by: Hans Verkuil > --- > drivers/media/platform/rcar-vin/rcar-dma.c | 112 -- > 1 file changed, 105 insertions(+), 7 deletions(-) > > diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c > b/drivers/media/platform/rcar-vin/rcar-dma.c index > 6c5df13b30d6dd14..8a6674a891aab357 100644 > --- a/drivers/media/platform/rcar-vin/rcar-dma.c > +++ b/drivers/media/platform/rcar-vin/rcar-dma.c > @@ -1087,15 +1087,115 @@ static void rvin_buffer_queue(struct vb2_buffer > *vb) spin_unlock_irqrestore(&vin->qlock, flags); > } > > +static int rvin_set_stream(struct rvin_dev *vin, int on) > +{ > + struct v4l2_subdev_format fmt = { > + .which = V4L2_SUBDEV_FORMAT_ACTIVE, > + }; > + struct media_pipeline *pipe; > + struct v4l2_subdev *sd; > + struct media_pad *pad; > + int ret; > + > + /* No media controller used, simply pass operation to subdevice */ > + if (!vin->info->use_mc) { > + ret = v4l2_subdev_call(vin->digital->subdev, video, s_stream, > +on); > + > + return ret == -ENOIOCTLCMD ? 0 : ret; > + } > + > + pad = media_entity_remote_pad(&vin->pad); > + if (!pad) > + return -EPIPE; > + > + sd = media_entity_to_v4l2_subdev(pad->entity); > + if (!sd) > + return -EPIPE; Can a pad have no entity ? > + if (!on) { > + media_pipeline_stop(&vin->vdev.entity); > + return v4l2_subdev_call(sd, video, s_stream, 0); > + } > + > + fmt.pad = pad->index; > + if (v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt)) > + return -EPIPE; > + > + switch (fmt.format.code) { > + case MEDIA_BUS_FMT_YUYV8_1X16: > + case MEDIA_BUS_FMT_UYVY8_2X8: > + case MEDIA_BUS_FMT_UYVY10_2X10: > + case MEDIA_BUS_FMT_RGB888_1X24: > + vin->code = fmt.format.code; > + break; > + default: > + return -EPIPE; > + } > + > + switch (fmt.format.field) { > + case V4L2_FIELD_TOP: > + case V4L2_FIELD_BOTTOM: > + case V4L2_FIELD_NONE: > + case V4L2_FIELD_INTERLACED_TB: > + case V4L2_FIELD_INTERLACED_BT: > + case V4L2_FIELD_INTERLACED: > + case V4L2_FIELD_SEQ_TB: > + case V4L2_FIELD_SEQ_BT: > + /* Supported natively */ > + break; > + case V4L2_FIELD_ALTERNATE: > + switch (vin->format.field) { > + case V4L2_FIELD_TOP: > + case V4L2_FIELD_BOTTOM: > + case V4L2_FIELD_NONE: > + break; > + case V4L2_FIELD_INTERLACED_TB: > + case V4L2_FIELD_INTERLACED_BT: > + case V4L2_FIELD_INTERLACED: > + case V4L2_FIELD_SEQ_TB: > + case V4L2_FIELD_SEQ_BT: > + /* Use VIN hardware to combine the two fields */ > + fmt.format.height *= 2; > + break; > + default: > + return -EPIPE; > + } > + break; > + default: > + return -EPIPE; > + } > + > + if (fmt.format.width != vin->format.width || > + fmt.format.height != vin->format.height) > + return -EPIPE; Shouldn't you also validate the media bus pixel code against the pixel format ? > + pipe = sd->entity.pipe ? sd->entity.pipe : &vin->vdev.pipe; How is this protected against race conditions if you call VIDIOC_STREAMON on two VIN instances connected to the same CSI-2 receiver ? And how does this handle two VIN instances connected to two different CSI-2 receivers that are both connected to the same source ? We will use two different pipeline objects, is that a problem ? > + if (media_pipeline_start(&vin->vdev.entity, pipe)) > + return -EPIPE; > + > + ret = v4l2_subdev_call(sd, video, s_stream, 1); > + if (ret == -ENOIOCTLCMD) > + ret = 0; > + if (ret) > + media_pipeline_stop(&vin->vdev.entity); > + > + return ret; > +} > + > static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) > { > struct rvin_dev *vin = vb2_get_drv_priv(vq); > - struct v4l2_subdev *sd; > unsigned long flags; > int ret; > > - sd = vin_to_source(vin); > - v4l2_subdev_call(sd, video, s_stream, 1); > + ret = rvin_set_stream(vin, 1); > + if (ret) { > + spin_lock_irqsave(&vin->qlock, flags); > + return_all_buffers(vin, VB2_BUF_STATE_QUEUED); > + spin_unlock_irqrestore(&v
[PATCH v9 25/28] rcar-vin: extend {start,stop}_streaming to work with media controller
The procedure to start or stop streaming using the non-MC single subdevice and the MC graph and multiple subdevices are quite different. Create a new function to abstract which method is used based on which mode the driver is running in and add logic to start the MC graph. Signed-off-by: Niklas Söderlund Reviewed-by: Hans Verkuil --- drivers/media/platform/rcar-vin/rcar-dma.c | 112 +++-- 1 file changed, 105 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 6c5df13b30d6dd14..8a6674a891aab357 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -1087,15 +1087,115 @@ static void rvin_buffer_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&vin->qlock, flags); } +static int rvin_set_stream(struct rvin_dev *vin, int on) +{ + struct v4l2_subdev_format fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + struct media_pipeline *pipe; + struct v4l2_subdev *sd; + struct media_pad *pad; + int ret; + + /* No media controller used, simply pass operation to subdevice */ + if (!vin->info->use_mc) { + ret = v4l2_subdev_call(vin->digital->subdev, video, s_stream, + on); + + return ret == -ENOIOCTLCMD ? 0 : ret; + } + + pad = media_entity_remote_pad(&vin->pad); + if (!pad) + return -EPIPE; + + sd = media_entity_to_v4l2_subdev(pad->entity); + if (!sd) + return -EPIPE; + + if (!on) { + media_pipeline_stop(&vin->vdev.entity); + return v4l2_subdev_call(sd, video, s_stream, 0); + } + + fmt.pad = pad->index; + if (v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt)) + return -EPIPE; + + switch (fmt.format.code) { + case MEDIA_BUS_FMT_YUYV8_1X16: + case MEDIA_BUS_FMT_UYVY8_2X8: + case MEDIA_BUS_FMT_UYVY10_2X10: + case MEDIA_BUS_FMT_RGB888_1X24: + vin->code = fmt.format.code; + break; + default: + return -EPIPE; + } + + switch (fmt.format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Supported natively */ + break; + case V4L2_FIELD_ALTERNATE: + switch (vin->format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + break; + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Use VIN hardware to combine the two fields */ + fmt.format.height *= 2; + break; + default: + return -EPIPE; + } + break; + default: + return -EPIPE; + } + + if (fmt.format.width != vin->format.width || + fmt.format.height != vin->format.height) + return -EPIPE; + + pipe = sd->entity.pipe ? sd->entity.pipe : &vin->vdev.pipe; + if (media_pipeline_start(&vin->vdev.entity, pipe)) + return -EPIPE; + + ret = v4l2_subdev_call(sd, video, s_stream, 1); + if (ret == -ENOIOCTLCMD) + ret = 0; + if (ret) + media_pipeline_stop(&vin->vdev.entity); + + return ret; +} + static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) { struct rvin_dev *vin = vb2_get_drv_priv(vq); - struct v4l2_subdev *sd; unsigned long flags; int ret; - sd = vin_to_source(vin); - v4l2_subdev_call(sd, video, s_stream, 1); + ret = rvin_set_stream(vin, 1); + if (ret) { + spin_lock_irqsave(&vin->qlock, flags); + return_all_buffers(vin, VB2_BUF_STATE_QUEUED); + spin_unlock_irqrestore(&vin->qlock, flags); + return ret; + } spin_lock_irqsave(&vin->qlock, flags); @@ -1104,7 +1204,7 @@ static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) ret = rvin_capture_start(vin); if (ret) { return_all_buffers(vin, VB2_BUF_STATE_QUEUED); - v4l2_subdev_call(sd, video, s_stream, 0); + rvin_set_stream(vin, 0); } spin_unlock_irqrestore(&vin->qlock, flags); @@ -1115,7 +1215,6 @@ static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) static void rvin_s
[PATCH v8 25/28] rcar-vin: extend {start,stop}_streaming to work with media controller
The procedure to start or stop streaming using the non-MC single subdevice and the MC graph and multiple subdevices are quite different. Create a new function to abstract which method is used based on which mode the driver is running in and add logic to start the MC graph. Signed-off-by: Niklas Söderlund Reviewed-by: Hans Verkuil --- drivers/media/platform/rcar-vin/rcar-dma.c | 112 +++-- 1 file changed, 105 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 6c5df13b30d6dd14..8a6674a891aab357 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -1087,15 +1087,115 @@ static void rvin_buffer_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&vin->qlock, flags); } +static int rvin_set_stream(struct rvin_dev *vin, int on) +{ + struct v4l2_subdev_format fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + struct media_pipeline *pipe; + struct v4l2_subdev *sd; + struct media_pad *pad; + int ret; + + /* No media controller used, simply pass operation to subdevice */ + if (!vin->info->use_mc) { + ret = v4l2_subdev_call(vin->digital->subdev, video, s_stream, + on); + + return ret == -ENOIOCTLCMD ? 0 : ret; + } + + pad = media_entity_remote_pad(&vin->pad); + if (!pad) + return -EPIPE; + + sd = media_entity_to_v4l2_subdev(pad->entity); + if (!sd) + return -EPIPE; + + if (!on) { + media_pipeline_stop(&vin->vdev.entity); + return v4l2_subdev_call(sd, video, s_stream, 0); + } + + fmt.pad = pad->index; + if (v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt)) + return -EPIPE; + + switch (fmt.format.code) { + case MEDIA_BUS_FMT_YUYV8_1X16: + case MEDIA_BUS_FMT_UYVY8_2X8: + case MEDIA_BUS_FMT_UYVY10_2X10: + case MEDIA_BUS_FMT_RGB888_1X24: + vin->code = fmt.format.code; + break; + default: + return -EPIPE; + } + + switch (fmt.format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Supported natively */ + break; + case V4L2_FIELD_ALTERNATE: + switch (vin->format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + break; + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Use VIN hardware to combine the two fields */ + fmt.format.height *= 2; + break; + default: + return -EPIPE; + } + break; + default: + return -EPIPE; + } + + if (fmt.format.width != vin->format.width || + fmt.format.height != vin->format.height) + return -EPIPE; + + pipe = sd->entity.pipe ? sd->entity.pipe : &vin->vdev.pipe; + if (media_pipeline_start(&vin->vdev.entity, pipe)) + return -EPIPE; + + ret = v4l2_subdev_call(sd, video, s_stream, 1); + if (ret == -ENOIOCTLCMD) + ret = 0; + if (ret) + media_pipeline_stop(&vin->vdev.entity); + + return ret; +} + static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) { struct rvin_dev *vin = vb2_get_drv_priv(vq); - struct v4l2_subdev *sd; unsigned long flags; int ret; - sd = vin_to_source(vin); - v4l2_subdev_call(sd, video, s_stream, 1); + ret = rvin_set_stream(vin, 1); + if (ret) { + spin_lock_irqsave(&vin->qlock, flags); + return_all_buffers(vin, VB2_BUF_STATE_QUEUED); + spin_unlock_irqrestore(&vin->qlock, flags); + return ret; + } spin_lock_irqsave(&vin->qlock, flags); @@ -1104,7 +1204,7 @@ static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) ret = rvin_capture_start(vin); if (ret) { return_all_buffers(vin, VB2_BUF_STATE_QUEUED); - v4l2_subdev_call(sd, video, s_stream, 0); + rvin_set_stream(vin, 0); } spin_unlock_irqrestore(&vin->qlock, flags); @@ -1115,7 +1215,6 @@ static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) static void rvin_s
Re: [PATCH v7 23/25] rcar-vin: extend {start,stop}_streaming to work with media controller
On 11/11/17 01:38, Niklas Söderlund wrote: > The procedure to start or stop streaming using the non-MC single > subdevice and the MC graph and multiple subdevices are quite different. > Create a new function to abstract which method is used based on which > mode the driver is running in and add logic to start the MC graph. > > Signed-off-by: Niklas Söderlund One tiny typo in a comment, see below. After fixing that you can add my: Reviewed-by: Hans Verkuil Regards, Hans > --- > drivers/media/platform/rcar-vin/rcar-dma.c | 113 > +++-- > 1 file changed, 106 insertions(+), 7 deletions(-) > > diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c > b/drivers/media/platform/rcar-vin/rcar-dma.c > index fe1319eb4c5df02d..b16b892a4de876bb 100644 > --- a/drivers/media/platform/rcar-vin/rcar-dma.c > +++ b/drivers/media/platform/rcar-vin/rcar-dma.c > @@ -1087,15 +1087,116 @@ static void rvin_buffer_queue(struct vb2_buffer *vb) > spin_unlock_irqrestore(&vin->qlock, flags); > } > > +static int rvin_set_stream(struct rvin_dev *vin, int on) > +{ > + struct v4l2_subdev_format fmt = { > + .which = V4L2_SUBDEV_FORMAT_ACTIVE, > + }; > + struct media_pipeline *pipe; > + struct v4l2_subdev *sd; > + struct media_pad *pad; > + int ret; > + > + /* No media controller used, simply pass operation to subdevice */ > + if (!vin->info->use_mc) { > + ret = v4l2_subdev_call(vin->digital->subdev, video, s_stream, > +on); > + > + return ret == -ENOIOCTLCMD ? 0 : ret; > + } > + > + pad = media_entity_remote_pad(&vin->pad); > + if (!pad) > + return -EPIPE; > + > + sd = media_entity_to_v4l2_subdev(pad->entity); > + if (!sd) > + return -EPIPE; > + > + if (!on) { > + media_pipeline_stop(&vin->vdev.entity); > + ret = v4l2_subdev_call(sd, video, s_stream, 0); > + return 0; > + } > + > + fmt.pad = pad->index; > + if (v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt)) > + return -EPIPE; > + > + switch (fmt.format.code) { > + case MEDIA_BUS_FMT_YUYV8_1X16: > + case MEDIA_BUS_FMT_UYVY8_2X8: > + case MEDIA_BUS_FMT_UYVY10_2X10: > + case MEDIA_BUS_FMT_RGB888_1X24: > + vin->code = fmt.format.code; > + break; > + default: > + return -EPIPE; > + } > + > + switch (fmt.format.field) { > + case V4L2_FIELD_TOP: > + case V4L2_FIELD_BOTTOM: > + case V4L2_FIELD_NONE: > + case V4L2_FIELD_INTERLACED_TB: > + case V4L2_FIELD_INTERLACED_BT: > + case V4L2_FIELD_INTERLACED: > + case V4L2_FIELD_SEQ_TB: > + case V4L2_FIELD_SEQ_BT: > + /* Supported nativly */ nativly -> natively > + break; > + case V4L2_FIELD_ALTERNATE: > + switch (vin->format.field) { > + case V4L2_FIELD_TOP: > + case V4L2_FIELD_BOTTOM: > + case V4L2_FIELD_NONE: > + break; > + case V4L2_FIELD_INTERLACED_TB: > + case V4L2_FIELD_INTERLACED_BT: > + case V4L2_FIELD_INTERLACED: > + case V4L2_FIELD_SEQ_TB: > + case V4L2_FIELD_SEQ_BT: > + /* Use VIN hardware to combine the two fields */ > + fmt.format.height *= 2; > + break; > + default: > + return -EPIPE; > + } > + break; > + default: > + return -EPIPE; > + } > + > + if (fmt.format.width != vin->format.width || > + fmt.format.height != vin->format.height) > + return -EPIPE; > + > + pipe = sd->entity.pipe ? sd->entity.pipe : &vin->vdev.pipe; > + if (media_pipeline_start(&vin->vdev.entity, pipe)) > + return -EPIPE; > + > + ret = v4l2_subdev_call(sd, video, s_stream, 1); > + if (ret == -ENOIOCTLCMD) > + ret = 0; > + if (ret) > + media_pipeline_stop(&vin->vdev.entity); > + > + return ret; > +} > + > static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) > { > struct rvin_dev *vin = vb2_get_drv_priv(vq); > - struct v4l2_subdev *sd; > unsigned long flags; > int ret; > > - sd = vin_to_source(vin); > - v4l2_subdev_call(sd, video, s_stream, 1); > + ret = rvin_set_stream(vin, 1); > + if (ret) { > + spin_lock_irqsave(&vin->qlock, flags); > + return_all_buffers(vin, VB2_BUF_STATE_QUEUED); > + spin_unlock_irqrestore(&vin->qlock, flags); > + return ret; > + } > > spin_lock_irqsave(&vin->qlock, flags); > > @@ -1104,7 +1205,7 @@ static int rvin_start_streaming(struct vb2_queue *vq, > unsigned int count) > ret = rvin_capture_start(vin); > if (ret) { > return_all_buffers(vin, VB2_BUF_STATE_QUEUED); > -
[PATCH v7 23/25] rcar-vin: extend {start,stop}_streaming to work with media controller
The procedure to start or stop streaming using the non-MC single subdevice and the MC graph and multiple subdevices are quite different. Create a new function to abstract which method is used based on which mode the driver is running in and add logic to start the MC graph. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-dma.c | 113 +++-- 1 file changed, 106 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index fe1319eb4c5df02d..b16b892a4de876bb 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -1087,15 +1087,116 @@ static void rvin_buffer_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&vin->qlock, flags); } +static int rvin_set_stream(struct rvin_dev *vin, int on) +{ + struct v4l2_subdev_format fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + struct media_pipeline *pipe; + struct v4l2_subdev *sd; + struct media_pad *pad; + int ret; + + /* No media controller used, simply pass operation to subdevice */ + if (!vin->info->use_mc) { + ret = v4l2_subdev_call(vin->digital->subdev, video, s_stream, + on); + + return ret == -ENOIOCTLCMD ? 0 : ret; + } + + pad = media_entity_remote_pad(&vin->pad); + if (!pad) + return -EPIPE; + + sd = media_entity_to_v4l2_subdev(pad->entity); + if (!sd) + return -EPIPE; + + if (!on) { + media_pipeline_stop(&vin->vdev.entity); + ret = v4l2_subdev_call(sd, video, s_stream, 0); + return 0; + } + + fmt.pad = pad->index; + if (v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt)) + return -EPIPE; + + switch (fmt.format.code) { + case MEDIA_BUS_FMT_YUYV8_1X16: + case MEDIA_BUS_FMT_UYVY8_2X8: + case MEDIA_BUS_FMT_UYVY10_2X10: + case MEDIA_BUS_FMT_RGB888_1X24: + vin->code = fmt.format.code; + break; + default: + return -EPIPE; + } + + switch (fmt.format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Supported nativly */ + break; + case V4L2_FIELD_ALTERNATE: + switch (vin->format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + break; + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Use VIN hardware to combine the two fields */ + fmt.format.height *= 2; + break; + default: + return -EPIPE; + } + break; + default: + return -EPIPE; + } + + if (fmt.format.width != vin->format.width || + fmt.format.height != vin->format.height) + return -EPIPE; + + pipe = sd->entity.pipe ? sd->entity.pipe : &vin->vdev.pipe; + if (media_pipeline_start(&vin->vdev.entity, pipe)) + return -EPIPE; + + ret = v4l2_subdev_call(sd, video, s_stream, 1); + if (ret == -ENOIOCTLCMD) + ret = 0; + if (ret) + media_pipeline_stop(&vin->vdev.entity); + + return ret; +} + static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) { struct rvin_dev *vin = vb2_get_drv_priv(vq); - struct v4l2_subdev *sd; unsigned long flags; int ret; - sd = vin_to_source(vin); - v4l2_subdev_call(sd, video, s_stream, 1); + ret = rvin_set_stream(vin, 1); + if (ret) { + spin_lock_irqsave(&vin->qlock, flags); + return_all_buffers(vin, VB2_BUF_STATE_QUEUED); + spin_unlock_irqrestore(&vin->qlock, flags); + return ret; + } spin_lock_irqsave(&vin->qlock, flags); @@ -1104,7 +1205,7 @@ static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) ret = rvin_capture_start(vin); if (ret) { return_all_buffers(vin, VB2_BUF_STATE_QUEUED); - v4l2_subdev_call(sd, video, s_stream, 0); + rvin_set_stream(vin, 0); } spin_unlock_irqrestore(&vin->qlock, flags); @@ -1115,7 +1216,6 @@ static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) static void rvin_stop
Re: 32bit userland cannot work with DVB drivers in 64bit kernel, design issue
For the moment, I am focusing on the frontend ioctl problem According to the fops: static const struct file_operations dvb_frontend_fops = { .owner = THIS_MODULE, .unlocked_ioctl = dvb_generic_ioctl, .poll = dvb_frontend_poll, .open = dvb_frontend_open, .release = dvb_frontend_release, .llseek = noop_llseek, }; There is no support for compact_ioctl, so it must be added 2017-11-02 19:52 GMT+01:00 Alan Cox : > On Thu, 2 Nov 2017 12:16:39 +0100 > Menion wrote: > >> Hi all >> I am investigating for Armbian, the feasability of running 32bit >> userland on single board computers based on arm64 SoC, where only 64 >> bit kernel is available, for reducing the memory footprint. >> I have discovered that there is a flaw in the DVB frontend ioctl (at >> least) that prevents to do so. >> in frontend.h the biggest problem is: >> >> struct dtv_properties { >> __u32 num; >> struct dtv_property *props; >> }; >> >> The master userland-kernel ioctl structure is based on an array set by >> pointer, so the 32bit userland will allocate 32bit pointer (and the >> resulting structure size) while the 64bit kernel will expect the 64bit >> pointers > > And in some cases the pointer might end up aligned to the next 64bit > boundary. > >> The void *reserved2 field will also give problem when crossing the >> 32-64bits boundaries >> As today the endire dvb linux infrastructure can only work in 32-32 >> and 64-64 bit mode > > If this isn't handled by the existing media compat_ioctl support then you > can send patches to use compat_ioctl handlers to fix this. > > Alan
Re: 32bit userland cannot work with DVB drivers in 64bit kernel, design issue
On Thu, 2 Nov 2017 12:16:39 +0100 Menion wrote: > Hi all > I am investigating for Armbian, the feasability of running 32bit > userland on single board computers based on arm64 SoC, where only 64 > bit kernel is available, for reducing the memory footprint. > I have discovered that there is a flaw in the DVB frontend ioctl (at > least) that prevents to do so. > in frontend.h the biggest problem is: > > struct dtv_properties { > __u32 num; > struct dtv_property *props; > }; > > The master userland-kernel ioctl structure is based on an array set by > pointer, so the 32bit userland will allocate 32bit pointer (and the > resulting structure size) while the 64bit kernel will expect the 64bit > pointers And in some cases the pointer might end up aligned to the next 64bit boundary. > The void *reserved2 field will also give problem when crossing the > 32-64bits boundaries > As today the endire dvb linux infrastructure can only work in 32-32 > and 64-64 bit mode If this isn't handled by the existing media compat_ioctl support then you can send patches to use compat_ioctl handlers to fix this. Alan
32bit userland cannot work with DVB drivers in 64bit kernel, design issue
Hi all I am investigating for Armbian, the feasability of running 32bit userland on single board computers based on arm64 SoC, where only 64 bit kernel is available, for reducing the memory footprint. I have discovered that there is a flaw in the DVB frontend ioctl (at least) that prevents to do so. in frontend.h the biggest problem is: struct dtv_properties { __u32 num; struct dtv_property *props; }; The master userland-kernel ioctl structure is based on an array set by pointer, so the 32bit userland will allocate 32bit pointer (and the resulting structure size) while the 64bit kernel will expect the 64bit pointers Also struct dtv_property { __u32 cmd; __u32 reserved[3]; union { __u32 data; struct dtv_fe_stats st; struct { __u8 data[32]; __u32 len; __u32 reserved1[3]; void *reserved2; } buffer; } u; int result; } __attribute__ ((packed)); The void *reserved2 field will also give problem when crossing the 32-64bits boundaries As today the endire dvb linux infrastructure can only work in 32-32 and 64-64 bit mode Bye Antonio
Re: [PATCH v6 23/25] rcar-vin: extend {start,stop}_streaming to work with media controller
On 23/08/17 01:26, Niklas Söderlund wrote: > The procedure to start or stop streaming using the none MC single none MC -> non-MC > subdevice and the MC graph and multiple subdevices are quiet different. quiet -> quite > Create a new function to abstract which method is used based on which > mode the driver is running in and add logic to start the MC graph. > > Signed-off-by: Niklas Söderlund > --- > drivers/media/platform/rcar-vin/rcar-dma.c | 112 > +++-- > 1 file changed, 105 insertions(+), 7 deletions(-) > > diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c > b/drivers/media/platform/rcar-vin/rcar-dma.c > index de1486ee2786b499..499253f94390f43e 100644 > --- a/drivers/media/platform/rcar-vin/rcar-dma.c > +++ b/drivers/media/platform/rcar-vin/rcar-dma.c > @@ -1087,15 +1087,115 @@ static void rvin_buffer_queue(struct vb2_buffer *vb) > spin_unlock_irqrestore(&vin->qlock, flags); > } > > +static int rvin_set_stream(struct rvin_dev *vin, int on) > +{ > + struct v4l2_subdev_format fmt = { > + .which = V4L2_SUBDEV_FORMAT_ACTIVE, > + }; > + struct media_pipeline *pipe; > + struct v4l2_subdev *sd; > + struct media_pad *pad; > + int ret; > + > + /* Not media controller used, simply pass operation to subdevice */ > + if (!vin->info->use_mc) { > + ret = v4l2_subdev_call(vin->digital.subdev, video, s_stream, > +on); > + > + return ret == -ENOIOCTLCMD ? 0 : ret; > + } > + > + pad = media_entity_remote_pad(&vin->pad); > + if (!pad) > + return -EPIPE; > + > + sd = media_entity_to_v4l2_subdev(pad->entity); > + if (!sd) > + return -EPIPE; > + > + if (on) { Handle !on first and return. The remaining code then has one indent level less. > + fmt.pad = pad->index; > + if (v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt)) > + return -EPIPE; > + > + switch (fmt.format.code) { > + case MEDIA_BUS_FMT_YUYV8_1X16: > + case MEDIA_BUS_FMT_UYVY8_2X8: > + case MEDIA_BUS_FMT_UYVY10_2X10: > + case MEDIA_BUS_FMT_RGB888_1X24: > + vin->code = fmt.format.code; > + break; > + default: > + return -EPIPE; > + } > + > + switch (fmt.format.field) { > + case V4L2_FIELD_TOP: > + case V4L2_FIELD_BOTTOM: > + case V4L2_FIELD_NONE: > + case V4L2_FIELD_INTERLACED_TB: > + case V4L2_FIELD_INTERLACED_BT: > + case V4L2_FIELD_INTERLACED: > + case V4L2_FIELD_SEQ_TB: > + case V4L2_FIELD_SEQ_BT: > + /* Supported nativly */ > + break; > + case V4L2_FIELD_ALTERNATE: > + switch (vin->format.field) { > + case V4L2_FIELD_TOP: > + case V4L2_FIELD_BOTTOM: > + case V4L2_FIELD_NONE: > + break; > + case V4L2_FIELD_INTERLACED_TB: > + case V4L2_FIELD_INTERLACED_BT: > + case V4L2_FIELD_INTERLACED: > + case V4L2_FIELD_SEQ_TB: > + case V4L2_FIELD_SEQ_BT: > + /* Use VIN hardware to combine the two fields */ > + fmt.format.height *= 2; > + break; > + default: > + return -EPIPE; > + } > + break; > + default: > + return -EPIPE; > + } > + > + if (fmt.format.width != vin->format.width || > + fmt.format.height != vin->format.height) > + return -EPIPE; > + > + pipe = sd->entity.pipe ? sd->entity.pipe : &vin->vdev.pipe; > + if (media_pipeline_start(&vin->vdev.entity, pipe)) > + return -EPIPE; > + > + ret = v4l2_subdev_call(sd, video, s_stream, 1); > + if (ret == -ENOIOCTLCMD) > + ret = 0; > + if (ret) > + media_pipeline_stop(&vin->vdev.entity); > + } else { > + media_pipeline_stop(&vin->vdev.entity); > + ret = v4l2_subdev_call(sd, video, s_stream, 0); > + } > + > + return ret; > +} > + > static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) > { > struct rvin_dev *vin = vb2_get_drv_priv(vq); > - struct v4l2_subdev *sd; > unsigned long flags; > int ret; > > - sd = vin_to_source(vin); > - v4l2_subdev_call(sd, video, s_stream, 1); > + ret = rvin_set_stream(vin, 1); > + if (ret) { > + spin_lock_irqsave(&vin->qlock, flags); > + return_all_buffers(vi
[PATCH v6 23/25] rcar-vin: extend {start,stop}_streaming to work with media controller
The procedure to start or stop streaming using the none MC single subdevice and the MC graph and multiple subdevices are quiet different. Create a new function to abstract which method is used based on which mode the driver is running in and add logic to start the MC graph. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-dma.c | 112 +++-- 1 file changed, 105 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index de1486ee2786b499..499253f94390f43e 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -1087,15 +1087,115 @@ static void rvin_buffer_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&vin->qlock, flags); } +static int rvin_set_stream(struct rvin_dev *vin, int on) +{ + struct v4l2_subdev_format fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + struct media_pipeline *pipe; + struct v4l2_subdev *sd; + struct media_pad *pad; + int ret; + + /* Not media controller used, simply pass operation to subdevice */ + if (!vin->info->use_mc) { + ret = v4l2_subdev_call(vin->digital.subdev, video, s_stream, + on); + + return ret == -ENOIOCTLCMD ? 0 : ret; + } + + pad = media_entity_remote_pad(&vin->pad); + if (!pad) + return -EPIPE; + + sd = media_entity_to_v4l2_subdev(pad->entity); + if (!sd) + return -EPIPE; + + if (on) { + fmt.pad = pad->index; + if (v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt)) + return -EPIPE; + + switch (fmt.format.code) { + case MEDIA_BUS_FMT_YUYV8_1X16: + case MEDIA_BUS_FMT_UYVY8_2X8: + case MEDIA_BUS_FMT_UYVY10_2X10: + case MEDIA_BUS_FMT_RGB888_1X24: + vin->code = fmt.format.code; + break; + default: + return -EPIPE; + } + + switch (fmt.format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Supported nativly */ + break; + case V4L2_FIELD_ALTERNATE: + switch (vin->format.field) { + case V4L2_FIELD_TOP: + case V4L2_FIELD_BOTTOM: + case V4L2_FIELD_NONE: + break; + case V4L2_FIELD_INTERLACED_TB: + case V4L2_FIELD_INTERLACED_BT: + case V4L2_FIELD_INTERLACED: + case V4L2_FIELD_SEQ_TB: + case V4L2_FIELD_SEQ_BT: + /* Use VIN hardware to combine the two fields */ + fmt.format.height *= 2; + break; + default: + return -EPIPE; + } + break; + default: + return -EPIPE; + } + + if (fmt.format.width != vin->format.width || + fmt.format.height != vin->format.height) + return -EPIPE; + + pipe = sd->entity.pipe ? sd->entity.pipe : &vin->vdev.pipe; + if (media_pipeline_start(&vin->vdev.entity, pipe)) + return -EPIPE; + + ret = v4l2_subdev_call(sd, video, s_stream, 1); + if (ret == -ENOIOCTLCMD) + ret = 0; + if (ret) + media_pipeline_stop(&vin->vdev.entity); + } else { + media_pipeline_stop(&vin->vdev.entity); + ret = v4l2_subdev_call(sd, video, s_stream, 0); + } + + return ret; +} + static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) { struct rvin_dev *vin = vb2_get_drv_priv(vq); - struct v4l2_subdev *sd; unsigned long flags; int ret; - sd = vin_to_source(vin); - v4l2_subdev_call(sd, video, s_stream, 1); + ret = rvin_set_stream(vin, 1); + if (ret) { + spin_lock_irqsave(&vin->qlock, flags); + return_all_buffers(vin, VB2_BUF_STATE_QUEUED); + spin_unlock_irqrestore(&vin->qlock, flags); + return ret; + } spin_lock_irqsave(&vin->qlock, flags); @@ -1104,7 +1204,7 @@ static int rvin_start_streaming(struct vb
[PATCH v4 25/27] rcar-vin: extend {start,stop}_streaming to work with media controller
The procedure to start or stop streaming using the none MC single subdevice and the MC graph and multiple subdevices are quiet different. Create a new function to abstract which method is used based on which mode the driver is running in and add logic to start the MC graph. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-dma.c | 79 +++--- 1 file changed, 72 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 34f01f32bab7bd32..46491a6b63ed0397 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -1099,15 +1099,82 @@ static void rvin_buffer_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&vin->qlock, flags); } +static int rvin_set_stream(struct rvin_dev *vin, int on) +{ + struct v4l2_subdev_format fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + struct media_pipeline *pipe; + struct v4l2_subdev *sd; + struct media_pad *pad; + int ret; + + /* Not media controller used, simply pass operation to subdevice */ + if (!vin->info->use_mc) { + ret = v4l2_subdev_call(vin->digital.subdev, video, s_stream, + on); + + return ret == -ENOIOCTLCMD ? 0 : ret; + } + + pad = media_entity_remote_pad(&vin->pad); + if (!pad) + return -EPIPE; + + sd = media_entity_to_v4l2_subdev(pad->entity); + if (!sd) + return -EPIPE; + + if (on) { + fmt.pad = pad->index; + if (v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt)) + return -EPIPE; + + switch (fmt.format.code) { + case MEDIA_BUS_FMT_YUYV8_1X16: + case MEDIA_BUS_FMT_UYVY8_2X8: + case MEDIA_BUS_FMT_UYVY10_2X10: + case MEDIA_BUS_FMT_RGB888_1X24: + vin->code = fmt.format.code; + break; + default: + return -EPIPE; + } + + if (fmt.format.width != vin->format.width || + fmt.format.height != vin->format.height) + return -EPIPE; + + pipe = sd->entity.pipe ? sd->entity.pipe : &vin->vdev->pipe; + if (media_pipeline_start(&vin->vdev->entity, pipe)) + return -EPIPE; + + ret = v4l2_subdev_call(sd, video, s_stream, 1); + if (ret == -ENOIOCTLCMD) + ret = 0; + if (ret) + media_pipeline_stop(&vin->vdev->entity); + } else { + media_pipeline_stop(&vin->vdev->entity); + ret = v4l2_subdev_call(sd, video, s_stream, 0); + } + + return ret; +} + static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) { struct rvin_dev *vin = vb2_get_drv_priv(vq); - struct v4l2_subdev *sd; unsigned long flags; int ret; - sd = vin_to_source(vin); - v4l2_subdev_call(sd, video, s_stream, 1); + ret = rvin_set_stream(vin, 1); + if (ret) { + spin_lock_irqsave(&vin->qlock, flags); + return_all_buffers(vin, VB2_BUF_STATE_QUEUED); + spin_unlock_irqrestore(&vin->qlock, flags); + return ret; + } spin_lock_irqsave(&vin->qlock, flags); @@ -1116,7 +1183,7 @@ static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) ret = rvin_capture_start(vin); if (ret) { return_all_buffers(vin, VB2_BUF_STATE_QUEUED); - v4l2_subdev_call(sd, video, s_stream, 0); + rvin_set_stream(vin, 0); } spin_unlock_irqrestore(&vin->qlock, flags); @@ -1127,7 +1194,6 @@ static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) static void rvin_stop_streaming(struct vb2_queue *vq) { struct rvin_dev *vin = vb2_get_drv_priv(vq); - struct v4l2_subdev *sd; unsigned long flags; int retries = 0; @@ -1166,8 +1232,7 @@ static void rvin_stop_streaming(struct vb2_queue *vq) spin_unlock_irqrestore(&vin->qlock, flags); - sd = vin_to_source(vin); - v4l2_subdev_call(sd, video, s_stream, 0); + rvin_set_stream(vin, 0); /* disable interrupts */ rvin_disable_interrupts(vin); -- 2.12.2
[PATCH v3 25/27] rcar-vin: extend {start,stop}_streaming to work with media controller
The procedure to start or stop streaming using the none MC single subdevice and the MC graph and multiple subdevices are quiet different. Create a new function to abstract which method is used based on which mode the driver is running in and add logic to start the MC graph. Signed-off-by: Niklas Söderlund --- drivers/media/platform/rcar-vin/rcar-dma.c | 82 +++--- 1 file changed, 75 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index 34f01f32bab7bd32..2a525bb3506c2e37 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -1099,15 +1099,85 @@ static void rvin_buffer_queue(struct vb2_buffer *vb) spin_unlock_irqrestore(&vin->qlock, flags); } +static int rvin_set_stream(struct rvin_dev *vin, int on) +{ + struct v4l2_subdev_format fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + struct media_pipeline *pipe; + struct v4l2_subdev *sd; + struct media_pad *pad; + int ret = -EPIPE; + + /* Not media controller used, simply pass operation to subdevice */ + if (!vin->info->use_mc) { + ret = v4l2_subdev_call(vin->digital.subdev, video, s_stream, + on); + + return ret == -ENOIOCTLCMD ? 0 : ret; + } + mutex_lock(&vin->group->lock); + + pad = media_entity_remote_pad(&vin->pad); + if (!pad) + goto out; + + sd = media_entity_to_v4l2_subdev(pad->entity); + if (!sd) + goto out; + + if (on) { + fmt.pad = pad->index; + if (v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt)) + goto out; + + switch (fmt.format.code) { + case MEDIA_BUS_FMT_YUYV8_1X16: + case MEDIA_BUS_FMT_UYVY8_2X8: + case MEDIA_BUS_FMT_UYVY10_2X10: + case MEDIA_BUS_FMT_RGB888_1X24: + vin->code = fmt.format.code; + break; + default: + goto out; + } + + if (fmt.format.width != vin->format.width || + fmt.format.height != vin->format.height) + goto out; + + pipe = sd->entity.pipe ? sd->entity.pipe : &vin->vdev->pipe; + if (media_pipeline_start(&vin->vdev->entity, pipe)) + goto out; + + ret = v4l2_subdev_call(sd, video, s_stream, 1); + if (ret == -ENOIOCTLCMD) + ret = 0; + if (ret) + media_pipeline_stop(&vin->vdev->entity); + } else { + media_pipeline_stop(&vin->vdev->entity); + ret = v4l2_subdev_call(sd, video, s_stream, 0); + } +out: + mutex_unlock(&vin->group->lock); + + return ret; +} + static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) { struct rvin_dev *vin = vb2_get_drv_priv(vq); - struct v4l2_subdev *sd; unsigned long flags; int ret; - sd = vin_to_source(vin); - v4l2_subdev_call(sd, video, s_stream, 1); + ret = rvin_set_stream(vin, 1); + if (ret) { + spin_lock_irqsave(&vin->qlock, flags); + return_all_buffers(vin, VB2_BUF_STATE_QUEUED); + spin_unlock_irqrestore(&vin->qlock, flags); + return ret; + } spin_lock_irqsave(&vin->qlock, flags); @@ -1116,7 +1186,7 @@ static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) ret = rvin_capture_start(vin); if (ret) { return_all_buffers(vin, VB2_BUF_STATE_QUEUED); - v4l2_subdev_call(sd, video, s_stream, 0); + rvin_set_stream(vin, 0); } spin_unlock_irqrestore(&vin->qlock, flags); @@ -1127,7 +1197,6 @@ static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count) static void rvin_stop_streaming(struct vb2_queue *vq) { struct rvin_dev *vin = vb2_get_drv_priv(vq); - struct v4l2_subdev *sd; unsigned long flags; int retries = 0; @@ -1166,8 +1235,7 @@ static void rvin_stop_streaming(struct vb2_queue *vq) spin_unlock_irqrestore(&vin->qlock, flags); - sd = vin_to_source(vin); - v4l2_subdev_call(sd, video, s_stream, 0); + rvin_set_stream(vin, 0); /* disable interrupts */ rvin_disable_interrupts(vin); -- 2.12.0
[RESEND PATCH] [PATCH 0/3] A few patches make s5p-mfc work with Gstreamer
A user-space application will follow the V4l2 document, but I meet a problem when I test it with Gstreamer. I look at the V4l2 document, the driver check the external setting which the document not cover, so that is what the second patch do. The first patch comes from chromium project, but I didn't find it is merged, so I sent it again with new kernel API. But I have not test it with 4.6-rc6, as I meet sysmmu problem there. But all those patches have been confirmed at Linux 4.1.16. ayaka (3): [media] s5p-mfc: Add handling of buffer freeing reqbufs request [media] s5p-mfc: remove unnecessary check in try_fmt [media] s5p-mfc: fix a typo in s5p_mfc_dec drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 2 +- drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 12 +++- 2 files changed, 4 insertions(+), 10 deletions(-) -- 2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 5/9] [media] make VIDIOC_DQEVENT work with 64-bit time_t
The v4l2 event queue uses a 'struct timespec' to pass monotonic timestamps. This is not a problem by itself, but it breaks when user space redefines timespec to use 'long long' on 32-bit systems. This is the second approach on fixing the problem, by changing the kernel to internally use 64-bit members for the timestamps in struct v4l2_event, and letting user space use either version. Unfortunately, we cannot use timespec64 here, because that does not have a well-defined ABI yet, and differs from the 64-bit version of 'timespec'. Using a pair of __s64 members makes sure the structure is well-defined and contains no padding that might leak kernel stack data. We now need the handling for VIDIOC_DQEVENT32 on both 32-bit and 64-bit architectures, so the handling for that is moved from v4l2-compat-ioctl32.c to v4l2-ioctl.c and v4l2-subdev.c. Signed-off-by: Arnd Bergmann --- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 35 -- drivers/media/v4l2-core/v4l2-event.c | 35 +++--- drivers/media/v4l2-core/v4l2-ioctl.c | 53 --- drivers/media/v4l2-core/v4l2-subdev.c | 6 +++ include/media/v4l2-event.h| 2 + include/uapi/linux/videodev2.h| 31 6 files changed, 107 insertions(+), 55 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c index af635430524e..9ffe7302206e 100644 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -735,32 +735,6 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext return 0; } -struct v4l2_event32 { - __u32 type; - union { - __u8data[64]; - } u; - __u32 pending; - __u32 sequence; - struct compat_timespec timestamp; - __u32 id; - __u32 reserved[8]; -}; - -static int put_v4l2_event32(struct v4l2_event *kp, struct v4l2_event32 __user *up) -{ - if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_event32)) || - put_user(kp->type, &up->type) || - copy_to_user(&up->u, &kp->u, sizeof(kp->u)) || - put_user(kp->pending, &up->pending) || - put_user(kp->sequence, &up->sequence) || - compat_put_timespec(&kp->timestamp, &up->timestamp) || - put_user(kp->id, &up->id) || - copy_to_user(up->reserved, kp->reserved, 8 * sizeof(__u32))) - return -EFAULT; - return 0; -} - struct v4l2_edid32 { __u32 pad; __u32 start_block; @@ -814,7 +788,6 @@ static int put_v4l2_edid32(struct v4l2_edid *kp, struct v4l2_edid32 __user *up) #define VIDIOC_G_EXT_CTRLS32_IOWR('V', 71, struct v4l2_ext_controls32) #define VIDIOC_S_EXT_CTRLS32_IOWR('V', 72, struct v4l2_ext_controls32) #define VIDIOC_TRY_EXT_CTRLS32 _IOWR('V', 73, struct v4l2_ext_controls32) -#defineVIDIOC_DQEVENT32_IOR ('V', 89, struct v4l2_event32) #define VIDIOC_CREATE_BUFS32 _IOWR('V', 92, struct v4l2_create_buffers32) #define VIDIOC_PREPARE_BUF32 _IOWR('V', 93, struct v4l2_buffer32) @@ -860,7 +833,6 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar case VIDIOC_G_EXT_CTRLS32: cmd = VIDIOC_G_EXT_CTRLS; break; case VIDIOC_S_EXT_CTRLS32: cmd = VIDIOC_S_EXT_CTRLS; break; case VIDIOC_TRY_EXT_CTRLS32: cmd = VIDIOC_TRY_EXT_CTRLS; break; - case VIDIOC_DQEVENT32: cmd = VIDIOC_DQEVENT; break; case VIDIOC_OVERLAY32: cmd = VIDIOC_OVERLAY; break; case VIDIOC_STREAMON32: cmd = VIDIOC_STREAMON; break; case VIDIOC_STREAMOFF32: cmd = VIDIOC_STREAMOFF; break; @@ -940,9 +912,6 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar err = get_v4l2_ext_controls32(&karg.v2ecs, up); compatible_arg = 0; break; - case VIDIOC_DQEVENT: - compatible_arg = 0; - break; } if (err) return err; @@ -983,10 +952,6 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar err = put_v4l2_framebuffer32(&karg.v2fb, up); break; - case VIDIOC_DQEVENT: - err = put_v4l2_event32(&karg.v2ev, up); - break; - case VIDIOC_G_EDID: case VIDIOC_S_EDID: err = put_v4l2_edid32(&karg.v2edid, up); diff --git a/drivers/media/v4l2-core/v4l2-event.c b/drivers/media/v4l2-core/v4l2-event.c index 8d3171c6bee8..149342490e91 100644 --- a/drivers/media/v4l2-core/v4l2-event.c +++ b/drivers/media/v4l2-core/v4l2-event.c @@ -92,6 +92,28 @@ int v4l2_event_dequeue(struct v4l2_fh *fh, st
work with
My name is Gatan Magsino, I work with Mediterranean Bank in Malta. Can i trust you with a business worth 8.3 million USD? Please reply ONLY to my private email: mga...@rogers.com for more information. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Is it fair to say that the Terratec S7 does not in fact work with DVB-S2?
I have a Terratec S7 USB device(actually an Elgato EyeTV Sat). This works fine on a Mac Mini running EyeTV. It doesn't seem to scan DVB-S2 channels at all under Linux-DVB. I've noticed numerous messages in the mailing list archive documenting problems with this device in regards to S2. The only maintenance that seems to occur on the driver for this device is to periodically update the list of identification strings for this device. So, because I want to use Linux-DVB for receiving DVB-S2 channels I have the following questions: 1) Is the Terratec S7 (in its many guises) actually supported at all by either Terratec or someone else for use with DVB-S2 under linux-dvb? And are there any cases where the device actually works under linux-dvb as well as it does on a Mac or Windows system? 2) If not, are there in fact any devices for DVB-S2 with drivers that are fully supported in linux-dvb and that in fact work on DVB-S2 channels with the utilities found in linux-dvb? (If there are I'd get rid of my Terratec S7 and get something else). 3) Or, is it not the case that there is any (active) support at all in the linux-dvb community for DVB-S2 (perhaps because interest is focused on different modulation methods and transmission types)? Thanks for any information you can impart regarding this. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Help wanted patching saa7164 driver to work with Compro E900F
>> Where did you purchase the card? > > Hi Steve > > It is a pleasure, I'm finding it very interesting, and it would > certainly be satisfying if I did get it working. Thankyou for writing > the driver! You are welcome! > > I bought it from either msy.com.au or skycomp.com.au quite a few years > ago, but I don't see it listed anywhere now in Australia except here > (http://www.foxcomp.com.au/ProductDetail.asp?ID=10591, > http://www.ht.com.au/part/AF826-Compro-VideoMate-Vista-E900F-DVB-T-HDTV-receiver-analogue-TV-radio-tuner-video-input-adapter-PCIe/detail.hts). > I can't see many tv tuners for sale anymore. Crazy prices, a sign that its generally no longer available in quantity. HVR2200 is still a good option and generally available worldwide. I did find a E900F available in the UK (amazon - roughly $40 USD) but they won't ship it overseas. Grrr. - Steve -- Steven Toth - Kernel Labs http://www.kernellabs.com -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Help wanted patching saa7164 driver to work with Compro E900F
On Wed, Feb 5, 2014 at 12:32 AM, Steven Toth wrote: > On Tue, Feb 4, 2014 at 5:29 AM, Daniel Playfair Cal . > > Hey Daniel, > > Thanks for showing an interest in the driver. > > I've been trying to source one of these cards for quite a while, > occasionally checking amazon etc. I can't seem to find anything in > retail on amazon or on ebay. > > Where did you purchase the card? Hi Steve It is a pleasure, I'm finding it very interesting, and it would certainly be satisfying if I did get it working. Thankyou for writing the driver! I bought it from either msy.com.au or skycomp.com.au quite a few years ago, but I don't see it listed anywhere now in Australia except here (http://www.foxcomp.com.au/ProductDetail.asp?ID=10591, http://www.ht.com.au/part/AF826-Compro-VideoMate-Vista-E900F-DVB-T-HDTV-receiver-analogue-TV-radio-tuner-video-input-adapter-PCIe/detail.hts). I can't see many tv tuners for sale anymore. Daniel -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Help wanted patching saa7164 driver to work with Compro E900F
On Tue, Feb 4, 2014 at 5:29 AM, Daniel Playfair Cal wrote: > Hello all, > > I've been working on patching the saa7164 driver to work with the > Compro Videomate Vista E900F. This is a PCI-e tuner card that seems to > be almost identical to the Hauppauge HVR-2200, many versions of which > are supported. I've had some success but there are a few problems Hey Daniel, Thanks for showing an interest in the driver. I've been trying to source one of these cards for quite a while, occasionally checking amazon etc. I can't seem to find anything in retail on amazon or on ebay. Where did you purchase the card? - Steve -- Steven Toth - Kernel Labs http://www.kernellabs.com -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Help wanted patching saa7164 driver to work with Compro E900F
Hello all, I've been working on patching the saa7164 driver to work with the Compro Videomate Vista E900F. This is a PCI-e tuner card that seems to be almost identical to the Hauppauge HVR-2200, many versions of which are supported. I've had some success but there are a few problems which I'm not sure how to approach and I would appreciate any help/advice. The most important point is number 2 under things that are confusing. CARD DETAILS: - Dual hybrid DVB-T/analogue TV tuner - hardware analogue source encoders - Various analogue video inputs - IR remote input - pci ID: 185b:e900 - Main IC: phillips saa7164 rev2 - Tuners: 2x NXP tda18271 - DVB-T Demodulators: 2x NXP tda10048 WHAT I'VE DONE My approach has been to modify the driver to make the kernel output resemble the sample shown for the HVR-2200 here: http://www.linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-2200#Sample_kernel_output I patched saa7164-cards.c and saa7164.h to include the details of the card (see https://gist.github.com/anonymous/8801027), and added the card to the first case in saa7164_dvb_register() in saa7164-dvb.c (the case covering the Hauppauge DVB-T cards). This results in the card being recognised, the tuner/digital demodulator chips being detected, and the DVB frontend devices being registered correctly. Kernel log of this process is here: https://gist.github.com/anonymous/8799960. The output of w_scan is here: https://gist.github.com/anonymous/881. w_scan correctly finds frequencies on which there is a signal in my area but seems to fail to get any data from those transmissions like channel names etc. Kernel logs collected during that run of w_scan are here: https://gist.github.com/anonymous/8800084. The behaviour is the same on both adapters. MISCELLANEOUS OBSERVATIONS/ACTIONS: - the card's firmware is different to any of the hauppauge firmwares. The earlier two rev2 firmwares on Steven Toth's site boot correctly and behave similarly to the stock firmware under linux but result in the card failing to work at all under windows. The rev3 firmwares and the newer/larger rev2 firmwares fail to boot. The firmware in the windows driver has a different header structure to that in the hauppauge firmware files, but I haven't bothered tackling that problem yet since the firmware persists even through a full power cycle. I've just been using the Compro firmware as flashed by the windows driver. - My best guess is that the two GPIO pins connected to the tda10048 demodulator reset pin are the same as on the HVR-2200. When I disabled setting these pins on initialisation, the demodulators were not correctly detected after a reboot, and strobing these pins as is done for the HVR-2200 fixed the problem. THINGS THAT ARE CONFUSING TO ME AND SEEM TO BE WRONG: 1. RF calibration for the tda18271 occurs only on the second of the two tuners. When tda18271c2_rf_cal_init() is called from within tda18271_attach(...) in tda18271-fe.c, cfg->rf_cal_on_startup is 0 for the first chip and 1 for the second. I don't know why this is the case, but I'm currently assuming its not a serious problem. 2. firmware is not loaded onto either of the tda10048's. tda10048_init() seems to never be called. I don't understand how it is meant to be called and why it isn't being called. Does the firmware on this chip not persist through a reboot or reset, and would this explain why w_scan is unable to see the channels on the frequencies? What is the expected series of events that results in tda10048_init being called to initialise the demodulator? At the moment I feel like this is likely the biggest problem. 3. The firmware seems to object the the get firmware debug status command sent from saa7164_api_set_debug() with a 0x9 status code (SAA_ERR_BAD_PARAMETER), but not to the set debug status command, so I don't see that this matters. I can see messages in the log starting with FWMSG like what saa7164_api_collect_debug() would print, so it seems that the firmware debugging is working in any case. 4. The output of saa7164_api_dump_subdevs() (see kernel log: https://gist.github.com/anonymous/8799960) indicates that there is an EEPROM with unitID 0x02. I have configured the card with this unitID but the firmware returns 0x09 (SAA_ERR_BAD_PARAMETER) and the eeprom is not read. I don't know why this is the case, and I am curious as to why the particular read addresses are used in saa7164_api_read_eeprom() in saa7164-api.c. ("u8 reg[] = { 0x0f, 0x00 };"). Might the correct address vary between cards? If so, how would I got about finding the correct address? Am I correct in thinking that the failure to read the EEPROM will not affect digital reception? (btw, I also tried using all other unitIDs 0-0xff and none resulted in a successful eeprom read) 5. Some of the configurations of hvr-2200 cards do not include analog demodulators. I assume one must be present and configured in th
Re: [PATCH v5 4/4] media: s5p-tv: Fix mixer driver to work with CCF
On 09/25/2013 06:09 PM, Tomasz Stanislawski wrote: rename to 'media: s5p-tv: mixer: integrate with CCF' On 09/21/2013 05:00 PM, Mateusz Krawczuk wrote: > Replace clk_enable by clock_enable_prepare and clk_disable with clk_disable_unprepare. > Clock prepare is required by Clock Common Framework, and old clock driver didn`t support it. > Without it Common Clock Framework prints a warning. > > Signed-off-by: Mateusz Krawczuk > Signed-off-by: Kyungmin Park Acked-by: Tomasz Stanislawski Patch applied with following commit log: commit 526ec3cc57a0751ff087e93acd1566e6d063fb17 Author: Mateusz Krawczuk Date: Sat Sep 21 14:00:49 2013 + s5p-tv: mixer: Prepare for common clock framework Replace clk_enable() by clock_enable_prepare() and clk_disable() with clk_disable_unprepare(). clk_{prepare/unprepare} calls are required by common clock framework and this driver was missed while converting all users of the Samsung original clocks driver to its new implementation based on the common clock API. Signed-off-by: Mateusz Krawczuk Signed-off-by: Kyungmin Park Acked-by: Tomasz Stanislawski [s.nawro...@samsung.com: edited commit description] Signed-off-by: Sylwester Nawrocki -- Regards, Sylwester -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 3/4] media: s5p-tv: Fix sdo driver to work with CCF
On 09/25/2013 05:59 PM, Tomasz Stanislawski wrote: Rename to 'media: s5p-tv: sdo: integrate with CCF' On 09/21/2013 05:00 PM, Mateusz Krawczuk wrote: Replace clk_enable by clock_enable_prepare and clk_disable with clk_disable_unprepare. Clock prepare is required by Clock Common Framework, and old clock driver didn`t support it. Without it Common Clock Framework prints a warning. Signed-off-by: Mateusz Krawczuk Signed-off-by: Kyungmin Park Patch applied with following commit log: commit 526ec3cc57a0751ff087e93acd1566e6d063fb17 Author: Mateusz Krawczuk Date: Sat Sep 21 14:00:49 2013 + s5p-tv: mixer: Prepare for common clock framework Replace clk_enable() by clock_enable_prepare() and clk_disable() with clk_disable_unprepare(). clk_{prepare/unprepare} calls are required by common clock framework and this driver was missed while converting all users of the Samsung original clocks driver to its new implementation based on the common clock API. Signed-off-by: Mateusz Krawczuk Signed-off-by: Kyungmin Park Acked-by: Tomasz Stanislawski [s.nawro...@samsung.com: edited commit description] Signed-off-by: Sylwester Nawrocki -- Regards, Sylwester -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 4/4] media: s5p-tv: Fix mixer driver to work with CCF
On 09/23/2013 02:44 PM, Sylwester Nawrocki wrote: > On 21/09/13 17:00, Mateusz Krawczuk wrote: >> Replace clk_enable by clock_enable_prepare and clk_disable with >> clk_disable_unprepare. >> Clock prepare is required by Clock Common Framework, and old clock driver >> didn`t support it. >> Without it Common Clock Framework prints a warning. > > nit: Please wrap this text to not exceed 80 columns. > >> Signed-off-by: Mateusz Krawczuk >> Signed-off-by: Kyungmin Park >> --- >> drivers/media/platform/s5p-tv/mixer_drv.c | 34 >> +-- >> 1 file changed, 28 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c >> b/drivers/media/platform/s5p-tv/mixer_drv.c >> index 8ce7c3e..7eea286 100644 >> --- a/drivers/media/platform/s5p-tv/mixer_drv.c >> +++ b/drivers/media/platform/s5p-tv/mixer_drv.c >> @@ -347,19 +347,41 @@ static int mxr_runtime_resume(struct device *dev) >> { >> struct mxr_device *mdev = to_mdev(dev); >> struct mxr_resources *res = &mdev->res; >> +int ret; >> >> dev_dbg(mdev->dev, "resume - start\n"); >> mutex_lock(&mdev->mutex); >> /* turn clocks on */ >> -clk_enable(res->mixer); >> -clk_enable(res->vp); >> -clk_enable(res->sclk_mixer); >> +ret = clk_prepare_enable(res->mixer); >> +if (ret < 0) { >> +dev_err(mdev->dev, "clk_prepare_enable(mixer) failed\n"); >> +goto fail; >> +} >> +ret = clk_prepare_enable(res->vp); >> +if (ret < 0) { >> +dev_err(mdev->dev, "clk_prepare_enable(vp) failed\n"); >> +goto fail_mixer; >> +} >> +ret = clk_prepare_enable(res->sclk_mixer); >> +if (ret < 0) { >> +dev_err(mdev->dev, "clk_prepare_enable(sclk_mixer) failed\n"); >> +goto fail_vp; >> +} >> /* apply default configuration */ >> mxr_reg_reset(mdev); >> dev_dbg(mdev->dev, "resume - finished\n"); >> >> mutex_unlock(&mdev->mutex); >> return 0; >> + >> +fail_vp: >> +clk_disable_unprepare(res->vp); >> +fail_mixer: >> +clk_disable_unprepare(res->mixer); >> +fail: > > How about only one error log here if any of the clk_prepare_enable() calls > fails ? I'm not sure if we need a separate log for each single clock. > I think it would nice to know which clock caused a failure. >> +mutex_unlock(&mdev->mutex); >> +dev_err(mdev->dev, "resume failed\n"); >> +return ret; >> } > > Regards, > Sylwester > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 4/4] media: s5p-tv: Fix mixer driver to work with CCF
rename to 'media: s5p-tv: mixer: integrate with CCF' On 09/21/2013 05:00 PM, Mateusz Krawczuk wrote: > Replace clk_enable by clock_enable_prepare and clk_disable with > clk_disable_unprepare. > Clock prepare is required by Clock Common Framework, and old clock driver > didn`t support it. > Without it Common Clock Framework prints a warning. > > Signed-off-by: Mateusz Krawczuk > Signed-off-by: Kyungmin Park Acked-by: Tomasz Stanislawski > --- > drivers/media/platform/s5p-tv/mixer_drv.c | 34 > +-- > 1 file changed, 28 insertions(+), 6 deletions(-) > > diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c > b/drivers/media/platform/s5p-tv/mixer_drv.c > index 8ce7c3e..7eea286 100644 > --- a/drivers/media/platform/s5p-tv/mixer_drv.c > +++ b/drivers/media/platform/s5p-tv/mixer_drv.c > @@ -347,19 +347,41 @@ static int mxr_runtime_resume(struct device *dev) > { > struct mxr_device *mdev = to_mdev(dev); > struct mxr_resources *res = &mdev->res; > + int ret; > > dev_dbg(mdev->dev, "resume - start\n"); > mutex_lock(&mdev->mutex); > /* turn clocks on */ > - clk_enable(res->mixer); > - clk_enable(res->vp); > - clk_enable(res->sclk_mixer); > + ret = clk_prepare_enable(res->mixer); > + if (ret < 0) { > + dev_err(mdev->dev, "clk_prepare_enable(mixer) failed\n"); > + goto fail; > + } > + ret = clk_prepare_enable(res->vp); > + if (ret < 0) { > + dev_err(mdev->dev, "clk_prepare_enable(vp) failed\n"); > + goto fail_mixer; > + } > + ret = clk_prepare_enable(res->sclk_mixer); > + if (ret < 0) { > + dev_err(mdev->dev, "clk_prepare_enable(sclk_mixer) failed\n"); > + goto fail_vp; > + } > /* apply default configuration */ > mxr_reg_reset(mdev); > dev_dbg(mdev->dev, "resume - finished\n"); > > mutex_unlock(&mdev->mutex); > return 0; > + > +fail_vp: > + clk_disable_unprepare(res->vp); > +fail_mixer: > + clk_disable_unprepare(res->mixer); > +fail: > + mutex_unlock(&mdev->mutex); > + dev_err(mdev->dev, "resume failed\n"); > + return ret; > } > > static int mxr_runtime_suspend(struct device *dev) > @@ -369,9 +391,9 @@ static int mxr_runtime_suspend(struct device *dev) > dev_dbg(mdev->dev, "suspend - start\n"); > mutex_lock(&mdev->mutex); > /* turn clocks off */ > - clk_disable(res->sclk_mixer); > - clk_disable(res->vp); > - clk_disable(res->mixer); > + clk_disable_unprepare(res->sclk_mixer); > + clk_disable_unprepare(res->vp); > + clk_disable_unprepare(res->mixer); > mutex_unlock(&mdev->mutex); > dev_dbg(mdev->dev, "suspend - finished\n"); > return 0; > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 3/4] media: s5p-tv: Fix sdo driver to work with CCF
Rename to 'media: s5p-tv: sdo: integrate with CCF' On 09/21/2013 05:00 PM, Mateusz Krawczuk wrote: > Replace clk_enable by clock_enable_prepare and clk_disable with > clk_disable_unprepare. > Clock prepare is required by Clock Common Framework, and old clock driver > didn`t support it. > Without it Common Clock Framework prints a warning. > > Signed-off-by: Mateusz Krawczuk > Signed-off-by: Kyungmin Park > --- > drivers/media/platform/s5p-tv/sdo_drv.c | 20 > 1 file changed, 12 insertions(+), 8 deletions(-) > > diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c > b/drivers/media/platform/s5p-tv/sdo_drv.c > index e49ac6c..17272e1 100644 > --- a/drivers/media/platform/s5p-tv/sdo_drv.c > +++ b/drivers/media/platform/s5p-tv/sdo_drv.c > @@ -208,9 +208,9 @@ static int sdo_streamon(struct sdo_device *sdev) > clk_get_rate(sdev->fout_vpll)); > /* enable clock in SDO */ > sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON); > - ret = clk_enable(sdev->dacphy); > + ret = clk_prepare_enable(sdev->dacphy); > if (ret < 0) { > - dev_err(sdev->dev, "clk_enable(dacphy) failed\n"); > + dev_err(sdev->dev, "clk_prepare_enable(dacphy) failed\n"); > goto fail; > } > /* enable DAC */ > @@ -229,7 +229,7 @@ static int sdo_streamoff(struct sdo_device *sdev) > int tries; > > sdo_write_mask(sdev, SDO_DAC, 0, SDO_POWER_ON_DAC); > - clk_disable(sdev->dacphy); > + clk_disable_unprepare(sdev->dacphy); > sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON); > for (tries = 100; tries; --tries) { > if (sdo_read(sdev, SDO_CLKCON) & SDO_TVOUT_CLOCK_READY) > @@ -273,7 +273,7 @@ static int sdo_runtime_suspend(struct device *dev) > dev_info(dev, "suspend\n"); > regulator_disable(sdev->vdet); > regulator_disable(sdev->vdac); > - clk_disable(sdev->sclk_dac); > + clk_disable_unprepare(sdev->sclk_dac); > return 0; > } > > @@ -285,7 +285,7 @@ static int sdo_runtime_resume(struct device *dev) > > dev_info(dev, "resume\n"); > > - ret = clk_enable(sdev->sclk_dac); > + ret = clk_prepare_enable(sdev->sclk_dac); > if (ret < 0) > return ret; > > @@ -318,7 +318,7 @@ static int sdo_runtime_resume(struct device *dev) > vdac_r_dis: > regulator_disable(sdev->vdac); > dac_clk_dis: > - clk_disable(sdev->sclk_dac); > + clk_disable_unprepare(sdev->sclk_dac); > return ret; > } > > @@ -424,7 +424,11 @@ static int sdo_probe(struct platform_device *pdev) > } > > /* enable gate for dac clock, because mixer uses it */ > - clk_enable(sdev->dac); > + ret = clk_prepare_enable(sdev->dac); > + if (ret < 0) { > + dev_err(dev, "clk_prepare_enable(dac) failed\n"); > + goto fail_fout_vpll; > + } > > /* configure power management */ > pm_runtime_enable(dev); > @@ -463,7 +467,7 @@ static int sdo_remove(struct platform_device *pdev) > struct sdo_device *sdev = sd_to_sdev(sd); > > pm_runtime_disable(&pdev->dev); > - clk_disable(sdev->dac); > + clk_disable_unprepare(sdev->dac); > clk_put(sdev->fout_vpll); > clk_put(sdev->dacphy); > clk_put(sdev->dac); > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 4/4] media: s5p-tv: Fix mixer driver to work with CCF
On 21/09/13 17:00, Mateusz Krawczuk wrote: > Replace clk_enable by clock_enable_prepare and clk_disable with > clk_disable_unprepare. > Clock prepare is required by Clock Common Framework, and old clock driver > didn`t support it. > Without it Common Clock Framework prints a warning. nit: Please wrap this text to not exceed 80 columns. > Signed-off-by: Mateusz Krawczuk > Signed-off-by: Kyungmin Park > --- > drivers/media/platform/s5p-tv/mixer_drv.c | 34 > +-- > 1 file changed, 28 insertions(+), 6 deletions(-) > > diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c > b/drivers/media/platform/s5p-tv/mixer_drv.c > index 8ce7c3e..7eea286 100644 > --- a/drivers/media/platform/s5p-tv/mixer_drv.c > +++ b/drivers/media/platform/s5p-tv/mixer_drv.c > @@ -347,19 +347,41 @@ static int mxr_runtime_resume(struct device *dev) > { > struct mxr_device *mdev = to_mdev(dev); > struct mxr_resources *res = &mdev->res; > + int ret; > > dev_dbg(mdev->dev, "resume - start\n"); > mutex_lock(&mdev->mutex); > /* turn clocks on */ > - clk_enable(res->mixer); > - clk_enable(res->vp); > - clk_enable(res->sclk_mixer); > + ret = clk_prepare_enable(res->mixer); > + if (ret < 0) { > + dev_err(mdev->dev, "clk_prepare_enable(mixer) failed\n"); > + goto fail; > + } > + ret = clk_prepare_enable(res->vp); > + if (ret < 0) { > + dev_err(mdev->dev, "clk_prepare_enable(vp) failed\n"); > + goto fail_mixer; > + } > + ret = clk_prepare_enable(res->sclk_mixer); > + if (ret < 0) { > + dev_err(mdev->dev, "clk_prepare_enable(sclk_mixer) failed\n"); > + goto fail_vp; > + } > /* apply default configuration */ > mxr_reg_reset(mdev); > dev_dbg(mdev->dev, "resume - finished\n"); > > mutex_unlock(&mdev->mutex); > return 0; > + > +fail_vp: > + clk_disable_unprepare(res->vp); > +fail_mixer: > + clk_disable_unprepare(res->mixer); > +fail: How about only one error log here if any of the clk_prepare_enable() calls fails ? I'm not sure if we need a separate log for each single clock. > + mutex_unlock(&mdev->mutex); > + dev_err(mdev->dev, "resume failed\n"); > + return ret; > } Regards, Sylwester -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 3/4] media: s5p-tv: Fix sdo driver to work with CCF
Replace clk_enable by clock_enable_prepare and clk_disable with clk_disable_unprepare. Clock prepare is required by Clock Common Framework, and old clock driver didn`t support it. Without it Common Clock Framework prints a warning. Signed-off-by: Mateusz Krawczuk Signed-off-by: Kyungmin Park --- drivers/media/platform/s5p-tv/sdo_drv.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c b/drivers/media/platform/s5p-tv/sdo_drv.c index e49ac6c..17272e1 100644 --- a/drivers/media/platform/s5p-tv/sdo_drv.c +++ b/drivers/media/platform/s5p-tv/sdo_drv.c @@ -208,9 +208,9 @@ static int sdo_streamon(struct sdo_device *sdev) clk_get_rate(sdev->fout_vpll)); /* enable clock in SDO */ sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON); - ret = clk_enable(sdev->dacphy); + ret = clk_prepare_enable(sdev->dacphy); if (ret < 0) { - dev_err(sdev->dev, "clk_enable(dacphy) failed\n"); + dev_err(sdev->dev, "clk_prepare_enable(dacphy) failed\n"); goto fail; } /* enable DAC */ @@ -229,7 +229,7 @@ static int sdo_streamoff(struct sdo_device *sdev) int tries; sdo_write_mask(sdev, SDO_DAC, 0, SDO_POWER_ON_DAC); - clk_disable(sdev->dacphy); + clk_disable_unprepare(sdev->dacphy); sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON); for (tries = 100; tries; --tries) { if (sdo_read(sdev, SDO_CLKCON) & SDO_TVOUT_CLOCK_READY) @@ -273,7 +273,7 @@ static int sdo_runtime_suspend(struct device *dev) dev_info(dev, "suspend\n"); regulator_disable(sdev->vdet); regulator_disable(sdev->vdac); - clk_disable(sdev->sclk_dac); + clk_disable_unprepare(sdev->sclk_dac); return 0; } @@ -285,7 +285,7 @@ static int sdo_runtime_resume(struct device *dev) dev_info(dev, "resume\n"); - ret = clk_enable(sdev->sclk_dac); + ret = clk_prepare_enable(sdev->sclk_dac); if (ret < 0) return ret; @@ -318,7 +318,7 @@ static int sdo_runtime_resume(struct device *dev) vdac_r_dis: regulator_disable(sdev->vdac); dac_clk_dis: - clk_disable(sdev->sclk_dac); + clk_disable_unprepare(sdev->sclk_dac); return ret; } @@ -424,7 +424,11 @@ static int sdo_probe(struct platform_device *pdev) } /* enable gate for dac clock, because mixer uses it */ - clk_enable(sdev->dac); + ret = clk_prepare_enable(sdev->dac); + if (ret < 0) { + dev_err(dev, "clk_prepare_enable(dac) failed\n"); + goto fail_fout_vpll; + } /* configure power management */ pm_runtime_enable(dev); @@ -463,7 +467,7 @@ static int sdo_remove(struct platform_device *pdev) struct sdo_device *sdev = sd_to_sdev(sd); pm_runtime_disable(&pdev->dev); - clk_disable(sdev->dac); + clk_disable_unprepare(sdev->dac); clk_put(sdev->fout_vpll); clk_put(sdev->dacphy); clk_put(sdev->dac); -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v5 4/4] media: s5p-tv: Fix mixer driver to work with CCF
Replace clk_enable by clock_enable_prepare and clk_disable with clk_disable_unprepare. Clock prepare is required by Clock Common Framework, and old clock driver didn`t support it. Without it Common Clock Framework prints a warning. Signed-off-by: Mateusz Krawczuk Signed-off-by: Kyungmin Park --- drivers/media/platform/s5p-tv/mixer_drv.c | 34 +-- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c b/drivers/media/platform/s5p-tv/mixer_drv.c index 8ce7c3e..7eea286 100644 --- a/drivers/media/platform/s5p-tv/mixer_drv.c +++ b/drivers/media/platform/s5p-tv/mixer_drv.c @@ -347,19 +347,41 @@ static int mxr_runtime_resume(struct device *dev) { struct mxr_device *mdev = to_mdev(dev); struct mxr_resources *res = &mdev->res; + int ret; dev_dbg(mdev->dev, "resume - start\n"); mutex_lock(&mdev->mutex); /* turn clocks on */ - clk_enable(res->mixer); - clk_enable(res->vp); - clk_enable(res->sclk_mixer); + ret = clk_prepare_enable(res->mixer); + if (ret < 0) { + dev_err(mdev->dev, "clk_prepare_enable(mixer) failed\n"); + goto fail; + } + ret = clk_prepare_enable(res->vp); + if (ret < 0) { + dev_err(mdev->dev, "clk_prepare_enable(vp) failed\n"); + goto fail_mixer; + } + ret = clk_prepare_enable(res->sclk_mixer); + if (ret < 0) { + dev_err(mdev->dev, "clk_prepare_enable(sclk_mixer) failed\n"); + goto fail_vp; + } /* apply default configuration */ mxr_reg_reset(mdev); dev_dbg(mdev->dev, "resume - finished\n"); mutex_unlock(&mdev->mutex); return 0; + +fail_vp: + clk_disable_unprepare(res->vp); +fail_mixer: + clk_disable_unprepare(res->mixer); +fail: + mutex_unlock(&mdev->mutex); + dev_err(mdev->dev, "resume failed\n"); + return ret; } static int mxr_runtime_suspend(struct device *dev) @@ -369,9 +391,9 @@ static int mxr_runtime_suspend(struct device *dev) dev_dbg(mdev->dev, "suspend - start\n"); mutex_lock(&mdev->mutex); /* turn clocks off */ - clk_disable(res->sclk_mixer); - clk_disable(res->vp); - clk_disable(res->mixer); + clk_disable_unprepare(res->sclk_mixer); + clk_disable_unprepare(res->vp); + clk_disable_unprepare(res->mixer); mutex_unlock(&mdev->mutex); dev_dbg(mdev->dev, "suspend - finished\n"); return 0; -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 4/6] media: s5p-tv: Fix mixer driver to work with CCF
On Wednesday 28 of August 2013 18:13:02 Mateusz Krawczuk wrote: > Replace clk_enable by clock_enable_prepare and clk_disable with > clk_disable_unprepare. Clock prepare is required by Clock Common > Framework, and old clock driver didn`t support it. Without it Common > Clock Framework prints a warning. > > Signed-off-by: Mateusz Krawczuk > --- > drivers/media/platform/s5p-tv/mixer_drv.c | 35 > --- 1 file changed, 28 insertions(+), 7 > deletions(-) > > diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c > b/drivers/media/platform/s5p-tv/mixer_drv.c index 8ce7c3e..3b2b305 > 100644 > --- a/drivers/media/platform/s5p-tv/mixer_drv.c > +++ b/drivers/media/platform/s5p-tv/mixer_drv.c > @@ -347,19 +347,40 @@ static int mxr_runtime_resume(struct device *dev) > { > struct mxr_device *mdev = to_mdev(dev); > struct mxr_resources *res = &mdev->res; > + int ret; > > dev_dbg(mdev->dev, "resume - start\n"); > mutex_lock(&mdev->mutex); > /* turn clocks on */ > - clk_enable(res->mixer); > - clk_enable(res->vp); > - clk_enable(res->sclk_mixer); > + ret = clk_prepare_enable(res->mixer); > + if (ret < 0) { > + dev_err(mdev->dev, "clk_prepare_enable(mixer) failed\n"); > + goto fail; > + } > + ret = clk_prepare_enable(res->vp); > + if (ret < 0) { > + dev_err(mdev->dev, "clk_prepare_enable(vp) failed\n"); > + goto fail_mixer; > + } > + ret = clk_prepare_enable(res->sclk_mixer); > + if (ret < 0) { > + dev_err(mdev->dev, "clk_prepare_enable(sclk_mixer) failed\n"); > + goto fail_vp; > + } > /* apply default configuration */ > mxr_reg_reset(mdev); > - dev_dbg(mdev->dev, "resume - finished\n"); > > mutex_unlock(&mdev->mutex); > + dev_dbg(mdev->dev, "resume - finished\n"); Why is this line moved in this patch? > return 0; nit: A blank line would look good here. > +fail_vp: > + clk_disable_unprepare(res->vp); > +fail_mixer: > + clk_disable_unprepare(res->mixer); > +fail: > + mutex_unlock(&mdev->mutex); > + dev_info(mdev->dev, "resume failed\n"); dev_err? Best regards, Tomasz > + return ret; > } > > static int mxr_runtime_suspend(struct device *dev) > @@ -369,9 +390,9 @@ static int mxr_runtime_suspend(struct device *dev) > dev_dbg(mdev->dev, "suspend - start\n"); > mutex_lock(&mdev->mutex); > /* turn clocks off */ > - clk_disable(res->sclk_mixer); > - clk_disable(res->vp); > - clk_disable(res->mixer); > + clk_disable_unprepare(res->sclk_mixer); > + clk_disable_unprepare(res->vp); > + clk_disable_unprepare(res->mixer); > mutex_unlock(&mdev->mutex); > dev_dbg(mdev->dev, "suspend - finished\n"); > return 0; -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 3/6] media: s5p-tv: Fix sdo driver to work with CCF
Hi Mateusz, On Wednesday 28 of August 2013 18:13:01 Mateusz Krawczuk wrote: > Replace clk_enable by clock_enable_prepare and clk_disable with > clk_disable_unprepare. Clock prepare is required by Clock Common > Framework, and old clock driver didn`t support it. Without it Common > Clock Framework prints a warning. > > Signed-off-by: Mateusz Krawczuk > --- > drivers/media/platform/s5p-tv/sdo_drv.c | 25 +++-- > 1 file changed, 15 insertions(+), 10 deletions(-) > > diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c > b/drivers/media/platform/s5p-tv/sdo_drv.c index 9dbdfe6..a79e620 100644 > --- a/drivers/media/platform/s5p-tv/sdo_drv.c > +++ b/drivers/media/platform/s5p-tv/sdo_drv.c > @@ -209,10 +209,10 @@ static int sdo_streamon(struct sdo_device *sdev) > clk_get_rate(sdev->fout_vpll)); > /* enable clock in SDO */ > sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON); > - ret = clk_enable(sdev->dacphy); > + ret = clk_prepare_enable(sdev->dacphy); > if (ret < 0) { > dev_err(sdev->dev, > - "clk_enable(dacphy) failed !\n"); > + "clk_prepare_enable(dacphy) failed !\n"); nit: I haven't noticed this when reviewing previous patch, but please tone down those errors messages a bit, by removing the exclamation mark (and the space before it). We shouldn't be shouting at users. ;) > goto fail; > } > /* enable DAC */ > @@ -230,7 +230,7 @@ static int sdo_streamoff(struct sdo_device *sdev) > int tries; > > sdo_write_mask(sdev, SDO_DAC, 0, SDO_POWER_ON_DAC); > - clk_disable(sdev->dacphy); > + clk_disable_unprepare(sdev->dacphy); > sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON); > for (tries = 100; tries; --tries) { > if (sdo_read(sdev, SDO_CLKCON) & SDO_TVOUT_CLOCK_READY) > @@ -274,7 +274,7 @@ static int sdo_runtime_suspend(struct device *dev) > dev_info(dev, "suspend\n"); > regulator_disable(sdev->vdet); > regulator_disable(sdev->vdac); > - clk_disable(sdev->sclk_dac); > + clk_disable_unprepare(sdev->sclk_dac); > return 0; > } > > @@ -286,7 +286,7 @@ static int sdo_runtime_resume(struct device *dev) > > dev_info(dev, "resume\n"); > > - ret = clk_enable(sdev->sclk_dac); > + ret = clk_prepare_enable(sdev->sclk_dac); > if (ret < 0) > return ret; > > @@ -319,7 +319,7 @@ static int sdo_runtime_resume(struct device *dev) > vdac_r_dis: > regulator_disable(sdev->vdac); > dac_clk_dis: > - clk_disable(sdev->sclk_dac); > + clk_disable_unprepare(sdev->sclk_dac); > return ret; > } > > @@ -333,7 +333,7 @@ static int sdo_probe(struct platform_device *pdev) > struct device *dev = &pdev->dev; > struct sdo_device *sdev; > struct resource *res; > - int ret = 0; > + int ret; Hmm, this change doesn't look like belonging to this patch. > struct clk *sclk_vpll; > > dev_info(dev, "probe start\n"); > @@ -425,8 +425,13 @@ static int sdo_probe(struct platform_device *pdev) > } > > /* enable gate for dac clock, because mixer uses it */ > - clk_enable(sdev->dac); > - > + ret = clk_prepare_enable(sdev->dac); > + if (ret < 0) { > + dev_err(dev, > + "clk_prepare_enable_enable(dac) failed !\n"); > + ret = PTR_ERR(sdev->dac); Hmm, ret already contains the error value returned by clk_prepare_enable() here, so this looks like a copy paste error. Best regards, Tomasz > + goto fail_fout_vpll; > + } > /* configure power management */ > pm_runtime_enable(dev); > > @@ -464,7 +469,7 @@ static int sdo_remove(struct platform_device *pdev) > struct sdo_device *sdev = sd_to_sdev(sd); > > pm_runtime_disable(&pdev->dev); > - clk_disable(sdev->dac); > + clk_disable_unprepare(sdev->dac); > clk_put(sdev->fout_vpll); > clk_put(sdev->dacphy); > clk_put(sdev->dac); -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 4/6] media: s5p-tv: Fix mixer driver to work with CCF
Replace clk_enable by clock_enable_prepare and clk_disable with clk_disable_unprepare. Clock prepare is required by Clock Common Framework, and old clock driver didn`t support it. Without it Common Clock Framework prints a warning. Signed-off-by: Mateusz Krawczuk --- drivers/media/platform/s5p-tv/mixer_drv.c | 35 --- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c b/drivers/media/platform/s5p-tv/mixer_drv.c index 8ce7c3e..3b2b305 100644 --- a/drivers/media/platform/s5p-tv/mixer_drv.c +++ b/drivers/media/platform/s5p-tv/mixer_drv.c @@ -347,19 +347,40 @@ static int mxr_runtime_resume(struct device *dev) { struct mxr_device *mdev = to_mdev(dev); struct mxr_resources *res = &mdev->res; + int ret; dev_dbg(mdev->dev, "resume - start\n"); mutex_lock(&mdev->mutex); /* turn clocks on */ - clk_enable(res->mixer); - clk_enable(res->vp); - clk_enable(res->sclk_mixer); + ret = clk_prepare_enable(res->mixer); + if (ret < 0) { + dev_err(mdev->dev, "clk_prepare_enable(mixer) failed\n"); + goto fail; + } + ret = clk_prepare_enable(res->vp); + if (ret < 0) { + dev_err(mdev->dev, "clk_prepare_enable(vp) failed\n"); + goto fail_mixer; + } + ret = clk_prepare_enable(res->sclk_mixer); + if (ret < 0) { + dev_err(mdev->dev, "clk_prepare_enable(sclk_mixer) failed\n"); + goto fail_vp; + } /* apply default configuration */ mxr_reg_reset(mdev); - dev_dbg(mdev->dev, "resume - finished\n"); mutex_unlock(&mdev->mutex); + dev_dbg(mdev->dev, "resume - finished\n"); return 0; +fail_vp: + clk_disable_unprepare(res->vp); +fail_mixer: + clk_disable_unprepare(res->mixer); +fail: + mutex_unlock(&mdev->mutex); + dev_info(mdev->dev, "resume failed\n"); + return ret; } static int mxr_runtime_suspend(struct device *dev) @@ -369,9 +390,9 @@ static int mxr_runtime_suspend(struct device *dev) dev_dbg(mdev->dev, "suspend - start\n"); mutex_lock(&mdev->mutex); /* turn clocks off */ - clk_disable(res->sclk_mixer); - clk_disable(res->vp); - clk_disable(res->mixer); + clk_disable_unprepare(res->sclk_mixer); + clk_disable_unprepare(res->vp); + clk_disable_unprepare(res->mixer); mutex_unlock(&mdev->mutex); dev_dbg(mdev->dev, "suspend - finished\n"); return 0; -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 3/6] media: s5p-tv: Fix sdo driver to work with CCF
Replace clk_enable by clock_enable_prepare and clk_disable with clk_disable_unprepare. Clock prepare is required by Clock Common Framework, and old clock driver didn`t support it. Without it Common Clock Framework prints a warning. Signed-off-by: Mateusz Krawczuk --- drivers/media/platform/s5p-tv/sdo_drv.c | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c b/drivers/media/platform/s5p-tv/sdo_drv.c index 9dbdfe6..a79e620 100644 --- a/drivers/media/platform/s5p-tv/sdo_drv.c +++ b/drivers/media/platform/s5p-tv/sdo_drv.c @@ -209,10 +209,10 @@ static int sdo_streamon(struct sdo_device *sdev) clk_get_rate(sdev->fout_vpll)); /* enable clock in SDO */ sdo_write_mask(sdev, SDO_CLKCON, ~0, SDO_TVOUT_CLOCK_ON); - ret = clk_enable(sdev->dacphy); + ret = clk_prepare_enable(sdev->dacphy); if (ret < 0) { dev_err(sdev->dev, - "clk_enable(dacphy) failed !\n"); + "clk_prepare_enable(dacphy) failed !\n"); goto fail; } /* enable DAC */ @@ -230,7 +230,7 @@ static int sdo_streamoff(struct sdo_device *sdev) int tries; sdo_write_mask(sdev, SDO_DAC, 0, SDO_POWER_ON_DAC); - clk_disable(sdev->dacphy); + clk_disable_unprepare(sdev->dacphy); sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON); for (tries = 100; tries; --tries) { if (sdo_read(sdev, SDO_CLKCON) & SDO_TVOUT_CLOCK_READY) @@ -274,7 +274,7 @@ static int sdo_runtime_suspend(struct device *dev) dev_info(dev, "suspend\n"); regulator_disable(sdev->vdet); regulator_disable(sdev->vdac); - clk_disable(sdev->sclk_dac); + clk_disable_unprepare(sdev->sclk_dac); return 0; } @@ -286,7 +286,7 @@ static int sdo_runtime_resume(struct device *dev) dev_info(dev, "resume\n"); - ret = clk_enable(sdev->sclk_dac); + ret = clk_prepare_enable(sdev->sclk_dac); if (ret < 0) return ret; @@ -319,7 +319,7 @@ static int sdo_runtime_resume(struct device *dev) vdac_r_dis: regulator_disable(sdev->vdac); dac_clk_dis: - clk_disable(sdev->sclk_dac); + clk_disable_unprepare(sdev->sclk_dac); return ret; } @@ -333,7 +333,7 @@ static int sdo_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct sdo_device *sdev; struct resource *res; - int ret = 0; + int ret; struct clk *sclk_vpll; dev_info(dev, "probe start\n"); @@ -425,8 +425,13 @@ static int sdo_probe(struct platform_device *pdev) } /* enable gate for dac clock, because mixer uses it */ - clk_enable(sdev->dac); - + ret = clk_prepare_enable(sdev->dac); + if (ret < 0) { + dev_err(dev, + "clk_prepare_enable_enable(dac) failed !\n"); + ret = PTR_ERR(sdev->dac); + goto fail_fout_vpll; + } /* configure power management */ pm_runtime_enable(dev); @@ -464,7 +469,7 @@ static int sdo_remove(struct platform_device *pdev) struct sdo_device *sdev = sd_to_sdev(sd); pm_runtime_disable(&pdev->dev); - clk_disable(sdev->dac); + clk_disable_unprepare(sdev->dac); clk_put(sdev->fout_vpll); clk_put(sdev->dacphy); clk_put(sdev->dac); -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/5] media: s5p-tv: Fix sdo driver to work with CCF
Replace clk_enable by clock_enable_prepare and clk_disable with clk_disable_unprepare. Clock prepare is required by Clock Common Framework, and old clock driver didn`t support it. Without it Common Clock Framework prints a warning. Signed-off-by: Mateusz Krawczuk --- drivers/media/platform/s5p-tv/sdo_drv.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c b/drivers/media/platform/s5p-tv/sdo_drv.c index b919008..acdae6b 100644 --- a/drivers/media/platform/s5p-tv/sdo_drv.c +++ b/drivers/media/platform/s5p-tv/sdo_drv.c @@ -230,7 +230,7 @@ static int sdo_streamoff(struct sdo_device *sdev) int tries; sdo_write_mask(sdev, SDO_DAC, 0, SDO_POWER_ON_DAC); - clk_disable(sdev->dacphy); + clk_disable_unprepare(sdev->dacphy); sdo_write_mask(sdev, SDO_CLKCON, 0, SDO_TVOUT_CLOCK_ON); for (tries = 100; tries; --tries) { if (sdo_read(sdev, SDO_CLKCON) & SDO_TVOUT_CLOCK_READY) @@ -274,7 +274,7 @@ static int sdo_runtime_suspend(struct device *dev) dev_info(dev, "suspend\n"); regulator_disable(sdev->vdet); regulator_disable(sdev->vdac); - clk_disable(sdev->sclk_dac); + clk_disable_unprepare(sdev->sclk_dac); return 0; } @@ -286,7 +286,7 @@ static int sdo_runtime_resume(struct device *dev) dev_info(dev, "resume\n"); - ret = clk_enable(sdev->sclk_dac); + ret = clk_prepare_enable(sdev->sclk_dac); if (ret < 0) return ret; @@ -319,7 +319,7 @@ static int sdo_runtime_resume(struct device *dev) vdac_r_dis: regulator_disable(sdev->vdac); dac_clk_dis: - clk_disable(sdev->sclk_dac); + clk_disable_unprepare(sdev->sclk_dac); return ret; } @@ -333,7 +333,7 @@ static int sdo_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct sdo_device *sdev; struct resource *res; - int ret = 0; + int ret; struct clk *sclk_vpll; dev_info(dev, "probe start\n"); @@ -425,8 +425,13 @@ static int sdo_probe(struct platform_device *pdev) } /* enable gate for dac clock, because mixer uses it */ - clk_enable(sdev->dac); - + clk_prepare_enable(sdev->dac); + if (IS_ERR(sdev->dac)) { + dev_err(dev, + "%s: Failed to prepare and enable clock !\n", __func__); + ret = PTR_ERR(sdev->dac); + goto fail_fout_vpll; + } /* configure power management */ pm_runtime_enable(dev); @@ -464,7 +469,7 @@ static int sdo_remove(struct platform_device *pdev) struct sdo_device *sdev = sd_to_sdev(sd); pm_runtime_disable(&pdev->dev); - clk_disable(sdev->dac); + clk_disable_unprepare(sdev->dac); clk_put(sdev->fout_vpll); clk_put(sdev->dacphy); clk_put(sdev->dac); -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 3/5] media: s5p-tv: Fix mixer driver to work with CCF
Replace clk_enable by clock_enable_prepare and clk_disable with clk_disable_unprepare. Clock prepare is required by Clock Common Framework, and old clock driver didn`t support it. Without it Common Clock Framework prints a warning. Signed-off-by: Mateusz Krawczuk --- drivers/media/platform/s5p-tv/mixer_drv.c | 35 --- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/s5p-tv/mixer_drv.c b/drivers/media/platform/s5p-tv/mixer_drv.c index 51805a5..435c8c0 100644 --- a/drivers/media/platform/s5p-tv/mixer_drv.c +++ b/drivers/media/platform/s5p-tv/mixer_drv.c @@ -345,21 +345,42 @@ fail: static int mxr_runtime_resume(struct device *dev) { + int ret; struct mxr_device *mdev = to_mdev(dev); struct mxr_resources *res = &mdev->res; mxr_dbg(mdev, "resume - start\n"); mutex_lock(&mdev->mutex); /* turn clocks on */ - clk_enable(res->mixer); - clk_enable(res->vp); - clk_enable(res->sclk_mixer); + ret = clk_prepare_enable(res->mixer); + if (ret < 0) { + mxr_err(mdev, "clk_prepare_enable(mixer) failed\n"); + goto fail; + } + ret = clk_prepare_enable(res->vp); + if (ret < 0) { + mxr_err(mdev, "clk_prepare_enable(vp) failed\n"); + goto fail_mixer; + } + ret = clk_prepare_enable(res->sclk_mixer); + if (ret < 0) { + mxr_err(mdev, "clk_prepare_enable(sclk_mixer) failed\n"); + goto fail_vp; + } /* apply default configuration */ mxr_reg_reset(mdev); - mxr_dbg(mdev, "resume - finished\n"); mutex_unlock(&mdev->mutex); + mxr_dbg(mdev, "resume - finished\n"); return 0; +fail_vp: + clk_disable_unprepare(res->vp); +fail_mixer: + clk_disable_unprepare(res->mixer); +fail: + mutex_unlock(&mdev->mutex); + mxr_info(mdev, "resume failed\n"); + return ret; } static int mxr_runtime_suspend(struct device *dev) @@ -369,9 +390,9 @@ static int mxr_runtime_suspend(struct device *dev) mxr_dbg(mdev, "suspend - start\n"); mutex_lock(&mdev->mutex); /* turn clocks off */ - clk_disable(res->sclk_mixer); - clk_disable(res->vp); - clk_disable(res->mixer); + clk_disable_unprepare(res->sclk_mixer); + clk_disable_unprepare(res->vp); + clk_disable_unprepare(res->mixer); mutex_unlock(&mdev->mutex); mxr_dbg(mdev, "suspend - finished\n"); return 0; -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/46] [media] siano: make load firmware logic to work with newer firmwares
There are new firmwares for sms2xxx devices. Change the firmware load logic to handle those newer firmwares and devices. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/siano/smscoreapi.c | 348 drivers/media/common/siano/smscoreapi.h | 8 +- 2 files changed, 220 insertions(+), 136 deletions(-) diff --git a/drivers/media/common/siano/smscoreapi.c b/drivers/media/common/siano/smscoreapi.c index 0bfb429..74a2cb5 100644 --- a/drivers/media/common/siano/smscoreapi.c +++ b/drivers/media/common/siano/smscoreapi.c @@ -683,6 +683,7 @@ int smscore_register_device(struct smsdevice_params_t *params, /* init completion events */ init_completion(&dev->version_ex_done); init_completion(&dev->data_download_done); + init_completion(&dev->data_validity_done); init_completion(&dev->trigger_done); init_completion(&dev->init_device_done); init_completion(&dev->reload_start_done); @@ -753,7 +754,13 @@ EXPORT_SYMBOL_GPL(smscore_register_device); static int smscore_sendrequest_and_wait(struct smscore_device_t *coredev, void *buffer, size_t size, struct completion *completion) { - int rc = coredev->sendrequest_handler(coredev->context, buffer, size); + int rc; + + if (completion == NULL) + return -EINVAL; + init_completion(completion); + + rc = coredev->sendrequest_handler(coredev->context, buffer, size); if (rc < 0) { sms_info("sendrequest returned error %d", rc); return rc; @@ -850,8 +857,9 @@ static int smscore_load_firmware_family2(struct smscore_device_t *coredev, void *buffer, size_t size) { struct SmsFirmware_ST *firmware = (struct SmsFirmware_ST *) buffer; - struct SmsMsgHdr_ST *msg; - u32 mem_address; + struct SmsMsgData_ST4 *msg; + u32 mem_address, calc_checksum = 0; + u32 i, *ptr; u8 *payload = firmware->Payload; int rc = 0; firmware->StartAddress = le32_to_cpu(firmware->StartAddress); @@ -874,34 +882,35 @@ static int smscore_load_firmware_family2(struct smscore_device_t *coredev, if (coredev->mode != DEVICE_MODE_NONE) { sms_debug("sending reload command."); - SMS_INIT_MSG(msg, MSG_SW_RELOAD_START_REQ, + SMS_INIT_MSG(&msg->xMsgHeader, MSG_SW_RELOAD_START_REQ, sizeof(struct SmsMsgHdr_ST)); rc = smscore_sendrequest_and_wait(coredev, msg, - msg->msgLength, + msg->xMsgHeader.msgLength, &coredev->reload_start_done); + if (rc < 0) { + sms_err("device reload failed, rc %d", rc); + goto exit_fw_download; + } mem_address = *(u32 *) &payload[20]; } + for (i = 0, ptr = (u32 *)firmware->Payload; i < firmware->Length/4 ; +i++, ptr++) + calc_checksum += *ptr; + while (size && rc >= 0) { struct SmsDataDownload_ST *DataMsg = (struct SmsDataDownload_ST *) msg; int payload_size = min((int) size, SMS_MAX_PAYLOAD_SIZE); - SMS_INIT_MSG(msg, MSG_SMS_DATA_DOWNLOAD_REQ, + SMS_INIT_MSG(&msg->xMsgHeader, MSG_SMS_DATA_DOWNLOAD_REQ, (u16)(sizeof(struct SmsMsgHdr_ST) + sizeof(u32) + payload_size)); DataMsg->MemAddr = mem_address; memcpy(DataMsg->Payload, payload, payload_size); - if ((coredev->device_flags & SMS_ROM_NO_RESPONSE) && - (coredev->mode == DEVICE_MODE_NONE)) - rc = coredev->sendrequest_handler( - coredev->context, DataMsg, - DataMsg->xMsgHeader.msgLength); - else - rc = smscore_sendrequest_and_wait( - coredev, DataMsg, + rc = smscore_sendrequest_and_wait(coredev, DataMsg, DataMsg->xMsgHeader.msgLength, &coredev->data_download_done); @@ -910,44 +919,65 @@ static int smscore_load_firmware_family2(struct smscore_device_t *coredev, mem_address += payload_size; } - if (rc >= 0) { - if (coredev->mode == DEVICE_MODE_NONE) { - struct SmsMsgData_ST *TriggerMsg = - (struct SmsMsgData_ST *) msg; - - SMS_INIT_MSG(msg, MSG_SMS_SWDOWNLOAD_TRIGGER_REQ, -sizeof(struct SmsMsgHdr_ST) + -sizeof(u32) * 5); - - Trigg
Re: Strong pairing cam doesn't work with CT-3650 driver (ttusb2)
On Friday 17 August 2012 22:59:21 Antti Palosaari wrote: > On 08/17/2012 10:35 PM, Hans Petter Selasky wrote: > > Hi, > > > > Have anyone out there tested the CT-3650 USB driver in the Linux kernel > > with a "strong pairing cam". > > Likely that means CI+ with some pairing features enabled. > > > According to some web-forums, the hardware should support that given > > using the vendor provided DVB WinXXX software. > > > > drivers/media/dvb/dvb-usb/ttusb2.c > > > > Any clues how to debug or what can be wrong? > > Take USB traffic capture from working Windows setup and analyze what is > done differently. > Just forget this thread. The CAM was broken. Works now. --HPS -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Strong pairing cam doesn't work with CT-3650 driver (ttusb2)
On 08/17/2012 10:35 PM, Hans Petter Selasky wrote: Hi, Have anyone out there tested the CT-3650 USB driver in the Linux kernel with a "strong pairing cam". Likely that means CI+ with some pairing features enabled. According to some web-forums, the hardware should support that given using the vendor provided DVB WinXXX software. drivers/media/dvb/dvb-usb/ttusb2.c Any clues how to debug or what can be wrong? Take USB traffic capture from working Windows setup and analyze what is done differently. When inserting the CAM, VDR says that a CAM is present, but then after a while no CAM is present. Log: ttusb2: tt3650_ci_slot_reset 0 ttusb2: tt3650_ci_read_attribute_mem -> 0 0x00 ttusb2: tt3650_ci_read_attribute_mem 0002 -> 0 0x00 TUPLE type:0x0 length:0 dvb_ca adapter 0: Invalid PC card inserted :( dvb_ca_en50221_io_open dvb_ca_en50221_thread_wakeup dvb_ca_en50221_io_do_ioctl dvb_ca_en50221_io_do_ioctl dvb_ca_en50221_slot_shutdown ttusb2: tt3650_ci_set_video_port 0 0 Slot 0 shutdown dvb_ca_en50221_thread_wakeup dvb_ca_en50221_io_poll ttusb2: tt3650_ci_slot_reset 0 dvb_ca_en50221_io_do_ioctl dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll ttusb2: tt3650_ci_read_attribute_mem -> 0 0x1d ttusb2: tt3650_ci_read_attribute_mem 0002 -> 0 0x04 TUPLE type:0x1d length:4 ttusb2: tt3650_ci_read_attribute_mem 0004 -> 0 0x00 0x00: 0x00 . ttusb2: tt3650_ci_read_attribute_mem 0006 -> 0 0xdb 0x01: 0xdb . ttusb2: tt3650_ci_read_attribute_mem 0008 -> 0 0x08 0x02: 0x08 . ttusb2: tt3650_ci_read_attribute_mem 000a -> 0 0xff 0x03: 0xff . dvb_ca adapter 0: Invalid PC card inserted :( dvb_ca_en50221_io_do_ioctl regards Antti -- http://palosaari.fi/ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Strong pairing cam doesn't work with CT-3650 driver (ttusb2)
Hi, Have anyone out there tested the CT-3650 USB driver in the Linux kernel with a "strong pairing cam". According to some web-forums, the hardware should support that given using the vendor provided DVB WinXXX software. drivers/media/dvb/dvb-usb/ttusb2.c Any clues how to debug or what can be wrong? When inserting the CAM, VDR says that a CAM is present, but then after a while no CAM is present. Log: ttusb2: tt3650_ci_slot_reset 0 ttusb2: tt3650_ci_read_attribute_mem -> 0 0x00 ttusb2: tt3650_ci_read_attribute_mem 0002 -> 0 0x00 TUPLE type:0x0 length:0 dvb_ca adapter 0: Invalid PC card inserted :( dvb_ca_en50221_io_open dvb_ca_en50221_thread_wakeup dvb_ca_en50221_io_do_ioctl dvb_ca_en50221_io_do_ioctl dvb_ca_en50221_slot_shutdown ttusb2: tt3650_ci_set_video_port 0 0 Slot 0 shutdown dvb_ca_en50221_thread_wakeup dvb_ca_en50221_io_poll ttusb2: tt3650_ci_slot_reset 0 dvb_ca_en50221_io_do_ioctl dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll dvb_ca_en50221_io_poll ttusb2: tt3650_ci_read_attribute_mem -> 0 0x1d ttusb2: tt3650_ci_read_attribute_mem 0002 -> 0 0x04 TUPLE type:0x1d length:4 ttusb2: tt3650_ci_read_attribute_mem 0004 -> 0 0x00 0x00: 0x00 . ttusb2: tt3650_ci_read_attribute_mem 0006 -> 0 0xdb 0x01: 0xdb . ttusb2: tt3650_ci_read_attribute_mem 0008 -> 0 0x08 0x02: 0x08 . ttusb2: tt3650_ci_read_attribute_mem 000a -> 0 0xff 0x03: 0xff . dvb_ca adapter 0: Invalid PC card inserted :( dvb_ca_en50221_io_do_ioctl --HPS -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/3] Modified RTL28xxU driver to work with RTL2832
On 08.05.2012 00:28, Hans-Frieder Vogt wrote: Am Montag, 7. Mai 2012 schrieb Antti Palosaari: On 07.05.2012 21:38, Thomas Mair wrote: On 07.05.2012 09:59, Antti Palosaari wrote: @@ -330,12 +335,12 @@ static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap) /* check QT1010 ID(?) register; reg=0f val=2c */ ret = rtl28xxu_ctrl_msg(adap->dev,&req_qt1010); if (ret == 0&&buf[0] == 0x2c) { -priv->tuner = TUNER_RTL2830_QT1010; +priv->tuner = TUNER_RTL28XX_QT1010; The idea why I named it as a TUNER_RTL2830_QT1010 was to map RTL2830 and given tuner. It could be nice to identify used demod/tuner combination in some cases if there will even be such combination same tuner used for multiple RTL28XXU chips. Ok. Should we use the TUNER_RTL2830/TUNER_RTL2832 approach or the RUNER_RTL28XX? I vote for style example; RTL2830_QT1010 versus RTL2832_QT1010, just in case same tuner could be used for multiple configurations. But it is not big issue for RTL2830 as it supports only 3 tuners currently - and there will not be likely any new. But there is some other RTL28XXU chips, like DVB-C model and etc. Antti, Thomas, I don't understand why it should be benefitial to distinguish between e.g. the qt1010 connected to the RTL2830 or connected to the RTL2832. After all, the demodulator knows which type it is, so there is no need to keep the combination demodulator_tuner. And I find it rather confusing to have the same tuner defined for either demod. For my it sounds better to save it as a DEMOD+TUNER combination. You will not likely see any same tuner used with RTL2830 and RTL2832 but instead those other newer demods like RTL2832, RTL2840, RTL2836B, etc. It is not big issue, almost no mean at all... +#define RTL28XXU_TUNERS_H + +enum rtl28xxu_tuner { + TUNER_NONE, + TUNER_RTL28XX_QT1010, + TUNER_RTL28XX_MT2060, + TUNER_RTL28XX_MT2266, + TUNER_RTL28XX_MT2063, + TUNER_RTL28XX_MAX3543, + TUNER_RTL28XX_TUA9001, + TUNER_RTL28XX_MXL5005S, + TUNER_RTL28XX_MXL5007T, + TUNER_RTL28XX_FC2580, + TUNER_RTL28XX_FC0012, + TUNER_RTL28XX_FC0013, + TUNER_RTL28XX_E4000, + TUNER_RTL28XX_TDA18272, +}; + +#endif I don't see it good idea to export tuners from the DVB-USB-driver to the demodulator. Demod drivers should be independent. For the other direction it is OK, I mean you can add tuners for demod config (rtl2832.h). Ok. So the definitions of the tuners would go into the rtl2830.h and rtl2832.h. Put those to the demod as a af9013 and af9033 for example has. rtl2830.h does not need to know tuner at all, not need to add. what about renaming the header file to rtl283x_tuners.h, then it would be clearer that the tuners are not defined in the USB driver, but rather as part of all demod drivers available (ignore for a moment the rtl2840, which doesn't fit into the proposed naming scheme)? Common tuners file between all Realtek demods sounds better. If you end up that then frontends/rtl28xx_tuners.h (or even frontends/rtl28xx_common.h so you can add some other common stuff here too) could be suitable name as it likely will fit better Realtek future chips naming scheme. You can include header file from frontends/ to dvb-usb but for the other direction it is not so good idea as we want keep demodulators totally disconnected from the dvb-usb/ drivers. Demods are sold separately and it is up to time when there is new device using demod as a standalone without Realtek own USB-interface. So after all I recommend to make rtl28xx common file for Realtek demods and put all tuners there. No need to pair demod+tuner, just commonly RTL28XX_QT1010, RTL28XX_FC0012, etc... regards Antti -- http://palosaari.fi/ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/3] Modified RTL28xxU driver to work with RTL2832
Am Montag, 7. Mai 2012 schrieb Antti Palosaari: > On 07.05.2012 21:38, Thomas Mair wrote: > > On 07.05.2012 09:59, Antti Palosaari wrote: > >>> @@ -330,12 +335,12 @@ static int rtl2831u_frontend_attach(struct > >>> dvb_usb_adapter *adap) > >>> > >>>/* check QT1010 ID(?) register; reg=0f val=2c */ > >>>ret = rtl28xxu_ctrl_msg(adap->dev,&req_qt1010); > >>>if (ret == 0&& buf[0] == 0x2c) { > >>> > >>> -priv->tuner = TUNER_RTL2830_QT1010; > >>> +priv->tuner = TUNER_RTL28XX_QT1010; > >> > >> The idea why I named it as a TUNER_RTL2830_QT1010 was to map RTL2830 and > >> given tuner. It could be nice to identify used demod/tuner combination > >> in some cases if there will even be such combination same tuner used > >> for multiple RTL28XXU chips. > > > > Ok. Should we use the TUNER_RTL2830/TUNER_RTL2832 approach or the > > RUNER_RTL28XX? > > I vote for style example; RTL2830_QT1010 versus RTL2832_QT1010, just in > case same tuner could be used for multiple configurations. > > But it is not big issue for RTL2830 as it supports only 3 tuners > currently - and there will not be likely any new. But there is some > other RTL28XXU chips, like DVB-C model and etc. > Antti, Thomas, I don't understand why it should be benefitial to distinguish between e.g. the qt1010 connected to the RTL2830 or connected to the RTL2832. After all, the demodulator knows which type it is, so there is no need to keep the combination demodulator_tuner. And I find it rather confusing to have the same tuner defined for either demod. > >> It is ~same function that existing one but without LED GPIO. Hmmm, dunno > >> what to do. Maybe it is OK still as switching "random" GPIOs during > >> streaming control is not good idea. > > > > I know. I had the same thougths and could not come up with a more elegant > > idea. Maybe here the TUNER_RTL2832 definition could be used. But that is > > too not the ideal solution I guess. > > I dont even care if whole LED GPIO is removed. It is not needed at all > and I even suspect it is not on same GPIO for all RTL2831U devices... Do > what you want - leave it as you already did. > > >> This looks weird as you write demod register. Is that really needed? > >> > >> If you has some problems I suspect those are coming from the fact page > >> cached by the driver isdifferent than page used by chip. Likely demod > >> is reseted and page is 0 after that. > >> > >> If you really have seen some problems then set page 0 in demod sleep. Or > >> set page directly to that driver priv. > > > > I'll check that. > > > >>> +#define RTL28XXU_TUNERS_H > >>> + > >>> +enum rtl28xxu_tuner { > >>> + TUNER_NONE, > >>> + TUNER_RTL28XX_QT1010, > >>> + TUNER_RTL28XX_MT2060, > >>> + TUNER_RTL28XX_MT2266, > >>> + TUNER_RTL28XX_MT2063, > >>> + TUNER_RTL28XX_MAX3543, > >>> + TUNER_RTL28XX_TUA9001, > >>> + TUNER_RTL28XX_MXL5005S, > >>> + TUNER_RTL28XX_MXL5007T, > >>> + TUNER_RTL28XX_FC2580, > >>> + TUNER_RTL28XX_FC0012, > >>> + TUNER_RTL28XX_FC0013, > >>> + TUNER_RTL28XX_E4000, > >>> + TUNER_RTL28XX_TDA18272, > >>> +}; > >>> + > >>> +#endif > >> > >> I don't see it good idea to export tuners from the DVB-USB-driver to the > >> demodulator. Demod drivers should be independent. For the other > >> direction it is OK, I mean you can add tuners for demod config > >> (rtl2832.h). > > > > Ok. So the definitions of the tuners would go into the rtl2830.h and > > rtl2832.h. > > Put those to the demod as a af9013 and af9033 for example has. rtl2830.h > does not need to know tuner at all, not need to add. > what about renaming the header file to rtl283x_tuners.h, then it would be clearer that the tuners are not defined in the USB driver, but rather as part of all demod drivers available (ignore for a moment the rtl2840, which doesn't fit into the proposed naming scheme)? > >> After all, you have done rather much changes. Even such changes that are > >> not relevant for the RTL2832 support. One patch per one change is the > >> rule. Also that patch serie is wrong order, it will break compilation > >> for example very bad when git bisect is taken. It should be done in > >> order first tuner or demod driver then DVB-USB-driver. > > > > Sorry for the inconsistent patches. I will go over my changes again and > > split them into smaller chunks, trying to keep the changes to a minimum. > > That includes to change the order of the patches to tuner, demod and > > finally dvb-usb driver. Thanks for all the comments. They really help me > > getting the driver nice and neat. I will probably not be able to do the > > changes before next weekend. > > regards > Antti Regards, Hans-Frieder Hans-Frieder Vogt e-mail: hfvogt gmx .dot. net -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vge
Re: [PATCH v3 1/3] Modified RTL28xxU driver to work with RTL2832
On 07.05.2012 21:38, Thomas Mair wrote: On 07.05.2012 09:59, Antti Palosaari wrote: @@ -330,12 +335,12 @@ static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap) /* check QT1010 ID(?) register; reg=0f val=2c */ ret = rtl28xxu_ctrl_msg(adap->dev,&req_qt1010); if (ret == 0&& buf[0] == 0x2c) { -priv->tuner = TUNER_RTL2830_QT1010; +priv->tuner = TUNER_RTL28XX_QT1010; The idea why I named it as a TUNER_RTL2830_QT1010 was to map RTL2830 and given tuner. It could be nice to identify used demod/tuner combination in some cases if there will even be such combination same tuner used for multiple RTL28XXU chips. Ok. Should we use the TUNER_RTL2830/TUNER_RTL2832 approach or the RUNER_RTL28XX? I vote for style example; RTL2830_QT1010 versus RTL2832_QT1010, just in case same tuner could be used for multiple configurations. But it is not big issue for RTL2830 as it supports only 3 tuners currently - and there will not be likely any new. But there is some other RTL28XXU chips, like DVB-C model and etc. It is ~same function that existing one but without LED GPIO. Hmmm, dunno what to do. Maybe it is OK still as switching "random" GPIOs during streaming control is not good idea. I know. I had the same thougths and could not come up with a more elegant idea. Maybe here the TUNER_RTL2832 definition could be used. But that is too not the ideal solution I guess. I dont even care if whole LED GPIO is removed. It is not needed at all and I even suspect it is not on same GPIO for all RTL2831U devices... Do what you want - leave it as you already did. This looks weird as you write demod register. Is that really needed? If you has some problems I suspect those are coming from the fact page cached by the driver isdifferent than page used by chip. Likely demod is reseted and page is 0 after that. If you really have seen some problems then set page 0 in demod sleep. Or set page directly to that driver priv. I'll check that. +#define RTL28XXU_TUNERS_H + +enum rtl28xxu_tuner { + TUNER_NONE, + TUNER_RTL28XX_QT1010, + TUNER_RTL28XX_MT2060, + TUNER_RTL28XX_MT2266, + TUNER_RTL28XX_MT2063, + TUNER_RTL28XX_MAX3543, + TUNER_RTL28XX_TUA9001, + TUNER_RTL28XX_MXL5005S, + TUNER_RTL28XX_MXL5007T, + TUNER_RTL28XX_FC2580, + TUNER_RTL28XX_FC0012, + TUNER_RTL28XX_FC0013, + TUNER_RTL28XX_E4000, + TUNER_RTL28XX_TDA18272, +}; + +#endif I don't see it good idea to export tuners from the DVB-USB-driver to the demodulator. Demod drivers should be independent. For the other direction it is OK, I mean you can add tuners for demod config (rtl2832.h). Ok. So the definitions of the tuners would go into the rtl2830.h and rtl2832.h. Put those to the demod as a af9013 and af9033 for example has. rtl2830.h does not need to know tuner at all, not need to add. After all, you have done rather much changes. Even such changes that are not relevant for the RTL2832 support. One patch per one change is the rule. Also that patch serie is wrong order, it will break compilation for example very bad when git bisect is taken. It should be done in order first tuner or demod driver then DVB-USB-driver. Sorry for the inconsistent patches. I will go over my changes again and split them into smaller chunks, trying to keep the changes to a minimum. That includes to change the order of the patches to tuner, demod and finally dvb-usb driver. Thanks for all the comments. They really help me getting the driver nice and neat. I will probably not be able to do the changes before next weekend. regards Antti -- http://palosaari.fi/ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/3] Modified RTL28xxU driver to work with RTL2832
On 07.05.2012 09:59, Antti Palosaari wrote: > Good morning! > Comments below. > > On 06.05.2012 15:46, Thomas Mair wrote: >> Hi everyone, >> >> this is the first complete version of the rtl2832 demod driver. I >> splitted the patches in three parts: >> 1. changes in the dvb-usb part (dvb_usb_rtl28xxu) >> 2. demod driver (rtl2832) >> 3. tuner driver (fc0012) >> >> - added tuner probing with log output >> - added callback for tuners to change UHF/VHF band >> - moved and renamed tuner enums to own header file >> - supported devices: >>- Terratec Cinergy T Stick Black >>- G-Tek Electronics Group Lifeview LV5TDLX DVB-T [RTL2832U] >> >> Signed-off-by: Thomas Mair >> --- >> drivers/media/dvb/dvb-usb/rtl28xxu.c| 604 >> ++- >> drivers/media/dvb/dvb-usb/rtl28xxu.h| 19 - >> drivers/media/dvb/dvb-usb/rtl28xxu_tuners.h | 42 ++ >> 3 files changed, 544 insertions(+), 121 deletions(-) >> create mode 100644 drivers/media/dvb/dvb-usb/rtl28xxu_tuners.h >> >> diff --git a/drivers/media/dvb/dvb-usb/rtl28xxu.c >> b/drivers/media/dvb/dvb-usb/rtl28xxu.c >> index 8f4736a..00bd712 100644 >> --- a/drivers/media/dvb/dvb-usb/rtl28xxu.c >> +++ b/drivers/media/dvb/dvb-usb/rtl28xxu.c >> @@ -3,6 +3,7 @@ >>* >>* Copyright (C) 2009 Antti Palosaari >>* Copyright (C) 2011 Antti Palosaari >> + * Copyright (C) 2012 Thomas Mair >>* >>*This program is free software; you can redistribute it and/or modify >>*it under the terms of the GNU General Public License as published by >> @@ -20,17 +21,20 @@ >>*/ >> >> #include "rtl28xxu.h" >> +#include "rtl28xxu_tuners.h" >> >> #include "rtl2830.h" >> +#include "rtl2832.h" >> >> #include "qt1010.h" >> #include "mt2060.h" >> #include "mxl5005s.h" >> +#include "fc0012.h" >> + >> >> -/* debug */ >> static int dvb_usb_rtl28xxu_debug; >> module_param_named(debug, dvb_usb_rtl28xxu_debug, int, 0644); >> -MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS); >> +MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); > Why you changed that at all? > And it is DVB USB driver, not frontend (demodulator), as it now says. Ok that was a bad idea. I'll revert that. >> DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); >> >> static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct >> rtl28xxu_req *req) >> @@ -76,11 +80,11 @@ static int rtl28xxu_ctrl_msg(struct dvb_usb_device >> *d, struct rtl28xxu_req *req) >> >> return ret; >> err: >> -deb_info("%s: failed=%d\n", __func__, ret); >> +deb_info("%s: failed=%d", __func__, ret); > > Why you have removed new line from all the existing debugs? > >> return ret; >> } >> >> -static int rtl2831_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int >> len) >> +static int rtl28xx_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int >> len) > > That's renaming OK, my mistake originally... > >> { >> struct rtl28xxu_req req; >> >> @@ -98,7 +102,7 @@ static int rtl2831_wr_regs(struct dvb_usb_device >> *d, u16 reg, u8 *val, int len) >> return rtl28xxu_ctrl_msg(d,&req); >> } >> >> -static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int >> len) >> +static int rtl28xx_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int >> len) >> { >> struct rtl28xxu_req req; >> >> @@ -116,14 +120,14 @@ static int rtl2831_rd_regs(struct dvb_usb_device >> *d, u16 reg, u8 *val, int len) >> return rtl28xxu_ctrl_msg(d,&req); >> } >> >> -static int rtl2831_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val) >> +static int rtl28xx_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val) >> { >> -return rtl2831_wr_regs(d, reg,&val, 1); >> +return rtl28xx_wr_regs(d, reg,&val, 1); >> } >> >> -static int rtl2831_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val) >> +static int rtl28xx_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val) >> { >> -return rtl2831_rd_regs(d, reg, val, 1); >> +return rtl28xx_rd_regs(d, reg, val, 1); >> } >> >> /* I2C */ >> @@ -297,7 +301,7 @@ static int rtl2831u_frontend_attach(struct >> dvb_usb_adapter *adap) >> /* for QT1010 tuner probe */ >> struct rtl28xxu_req req_qt1010 = { 0x0fc4, CMD_I2C_RD, 1, buf }; >> >> -deb_info("%s:\n", __func__); >> +deb_info("%s:", __func__); >> >> /* >>* RTL2831U GPIOs >> @@ -308,12 +312,13 @@ static int rtl2831u_frontend_attach(struct >> dvb_usb_adapter *adap) >>*/ >> >> /* GPIO direction */ >> -ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_DIR, 0x0a); >> +ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_DIR, 0x0a); >> if (ret) >> goto err; >> >> + >> /* enable as output GPIO0, GPIO2, GPIO4 */ >> -ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_OUT_EN, 0x15); >> +ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_OUT_EN, 0x15); >> if (ret) >> goto err; >> >> @@ -330,12 +335,12 @@ static int rtl2831u_frontend_attach(struct >> dvb_u
Re: [PATCH v3 1/3] Modified RTL28xxU driver to work with RTL2832
Good morning! Comments below. On 06.05.2012 15:46, Thomas Mair wrote: Hi everyone, this is the first complete version of the rtl2832 demod driver. I splitted the patches in three parts: 1. changes in the dvb-usb part (dvb_usb_rtl28xxu) 2. demod driver (rtl2832) 3. tuner driver (fc0012) - added tuner probing with log output - added callback for tuners to change UHF/VHF band - moved and renamed tuner enums to own header file - supported devices: - Terratec Cinergy T Stick Black - G-Tek Electronics Group Lifeview LV5TDLX DVB-T [RTL2832U] Signed-off-by: Thomas Mair --- drivers/media/dvb/dvb-usb/rtl28xxu.c| 604 ++- drivers/media/dvb/dvb-usb/rtl28xxu.h| 19 - drivers/media/dvb/dvb-usb/rtl28xxu_tuners.h | 42 ++ 3 files changed, 544 insertions(+), 121 deletions(-) create mode 100644 drivers/media/dvb/dvb-usb/rtl28xxu_tuners.h diff --git a/drivers/media/dvb/dvb-usb/rtl28xxu.c b/drivers/media/dvb/dvb-usb/rtl28xxu.c index 8f4736a..00bd712 100644 --- a/drivers/media/dvb/dvb-usb/rtl28xxu.c +++ b/drivers/media/dvb/dvb-usb/rtl28xxu.c @@ -3,6 +3,7 @@ * * Copyright (C) 2009 Antti Palosaari * Copyright (C) 2011 Antti Palosaari + * Copyright (C) 2012 Thomas Mair * *This program is free software; you can redistribute it and/or modify *it under the terms of the GNU General Public License as published by @@ -20,17 +21,20 @@ */ #include "rtl28xxu.h" +#include "rtl28xxu_tuners.h" #include "rtl2830.h" +#include "rtl2832.h" #include "qt1010.h" #include "mt2060.h" #include "mxl5005s.h" +#include "fc0012.h" + -/* debug */ static int dvb_usb_rtl28xxu_debug; module_param_named(debug, dvb_usb_rtl28xxu_debug, int, 0644); -MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS); +MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); Why you changed that at all? And it is DVB USB driver, not frontend (demodulator), as it now says. DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req) @@ -76,11 +80,11 @@ static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req) return ret; err: - deb_info("%s: failed=%d\n", __func__, ret); + deb_info("%s: failed=%d", __func__, ret); Why you have removed new line from all the existing debugs? return ret; } -static int rtl2831_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) +static int rtl28xx_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) That's renaming OK, my mistake originally... { struct rtl28xxu_req req; @@ -98,7 +102,7 @@ static int rtl2831_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) return rtl28xxu_ctrl_msg(d,&req); } -static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) +static int rtl28xx_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) { struct rtl28xxu_req req; @@ -116,14 +120,14 @@ static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) return rtl28xxu_ctrl_msg(d,&req); } -static int rtl2831_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val) +static int rtl28xx_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val) { - return rtl2831_wr_regs(d, reg,&val, 1); + return rtl28xx_wr_regs(d, reg,&val, 1); } -static int rtl2831_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val) +static int rtl28xx_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val) { - return rtl2831_rd_regs(d, reg, val, 1); + return rtl28xx_rd_regs(d, reg, val, 1); } /* I2C */ @@ -297,7 +301,7 @@ static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap) /* for QT1010 tuner probe */ struct rtl28xxu_req req_qt1010 = { 0x0fc4, CMD_I2C_RD, 1, buf }; - deb_info("%s:\n", __func__); + deb_info("%s:", __func__); /* * RTL2831U GPIOs @@ -308,12 +312,13 @@ static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap) */ /* GPIO direction */ - ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_DIR, 0x0a); + ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_DIR, 0x0a); if (ret) goto err; + /* enable as output GPIO0, GPIO2, GPIO4 */ - ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_OUT_EN, 0x15); + ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_OUT_EN, 0x15); if (ret) goto err; @@ -330,12 +335,12 @@ static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap) /* check QT1010 ID(?) register; reg=0f val=2c */ ret = rtl28xxu_ctrl_msg(adap->dev,&req_qt1010); if (ret == 0&& buf[0] == 0x2c) { - priv->tuner = TUNER_RTL2830_QT1010; + priv->tuner = TUNER_RTL28XX_QT1010; The idea why I named it as a TUNER_RTL2830_QT1010 was to map RTL2830 and given tuner. It could be nice to identify used demod/tuner combination i
[PATCH v4 1/3] Modified RTL28xxU driver to work with RTL2832
- added tuner probing with log output - added callback for tuners to change UHF/VHF band - moved and renamed tuner enums to own header file - supported devices: - Terratec Cinergy T Stick Black - G-Tek Electronics Group Lifeview LV5TDLX DVB-T [RTL2832U] Signed-off-by: Thomas Mair --- drivers/media/dvb/dvb-usb/dvb-usb-ids.h |2 + drivers/media/dvb/dvb-usb/rtl28xxu.c| 604 ++- drivers/media/dvb/dvb-usb/rtl28xxu.h| 19 - drivers/media/dvb/dvb-usb/rtl28xxu_tuners.h | 42 ++ 4 files changed, 546 insertions(+), 121 deletions(-) create mode 100644 drivers/media/dvb/dvb-usb/rtl28xxu_tuners.h diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index 2418e41..22df252 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -135,6 +135,7 @@ #define USB_PID_GENIUS_TVGO_DVB_T030x4012 #define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0 #define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1 +#define USB_PID_GTEK 0xb803 #define USB_PID_INTEL_CE9500 0x9500 #define USB_PID_ITETECH_IT9135 0x9135 #define USB_PID_ITETECH_IT9135_90050x9005 @@ -157,6 +158,7 @@ #define USB_PID_TERRATEC_CINERGY_T_STICK 0x0093 #define USB_PID_TERRATEC_CINERGY_T_STICK_RC0x0097 #define USB_PID_TERRATEC_CINERGY_T_STICK_DUAL_RC 0x0099 +#define USB_PID_TERRATEC_CINERGY_T_STICK_BLACK_REV10x00a9 #define USB_PID_TWINHAN_VP7041_COLD0x3201 #define USB_PID_TWINHAN_VP7041_WARM0x3202 #define USB_PID_TWINHAN_VP7020_COLD0x3203 diff --git a/drivers/media/dvb/dvb-usb/rtl28xxu.c b/drivers/media/dvb/dvb-usb/rtl28xxu.c index 8f4736a..1a735be 100644 --- a/drivers/media/dvb/dvb-usb/rtl28xxu.c +++ b/drivers/media/dvb/dvb-usb/rtl28xxu.c @@ -3,6 +3,7 @@ * * Copyright (C) 2009 Antti Palosaari * Copyright (C) 2011 Antti Palosaari + * Copyright (C) 2012 Thomas Mair * *This program is free software; you can redistribute it and/or modify *it under the terms of the GNU General Public License as published by @@ -20,17 +21,20 @@ */ #include "rtl28xxu.h" +#include "rtl28xxu_tuners.h" #include "rtl2830.h" +#include "rtl2832.h" #include "qt1010.h" #include "mt2060.h" #include "mxl5005s.h" +#include "fc0012.h" + -/* debug */ static int dvb_usb_rtl28xxu_debug; module_param_named(debug, dvb_usb_rtl28xxu_debug, int, 0644); -MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS); +MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req) @@ -76,11 +80,11 @@ static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req) return ret; err: - deb_info("%s: failed=%d\n", __func__, ret); + deb_info("%s: failed=%d", __func__, ret); return ret; } -static int rtl2831_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) +static int rtl28xx_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) { struct rtl28xxu_req req; @@ -98,7 +102,7 @@ static int rtl2831_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) return rtl28xxu_ctrl_msg(d, &req); } -static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) +static int rtl28xx_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) { struct rtl28xxu_req req; @@ -116,14 +120,14 @@ static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) return rtl28xxu_ctrl_msg(d, &req); } -static int rtl2831_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val) +static int rtl28xx_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val) { - return rtl2831_wr_regs(d, reg, &val, 1); + return rtl28xx_wr_regs(d, reg, &val, 1); } -static int rtl2831_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val) +static int rtl28xx_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val) { - return rtl2831_rd_regs(d, reg, val, 1); + return rtl28xx_rd_regs(d, reg, val, 1); } /* I2C */ @@ -297,7 +301,7 @@ static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap) /* for QT1010 tuner probe */ struct rtl28xxu_req req_qt1010 = { 0x0fc4, CMD_I2C_RD, 1, buf }; - deb_info("%s:\n", __func__); + deb_info("%s:", __func__); /* * RTL2831U GPIOs @@ -308,12 +312,13 @@ static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap) */ /* GPIO direction */ - ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_DIR, 0x0a); + ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_DIR, 0x0a); if (ret) goto err; + /* enable as output GPIO0,
Re: [PATCH v3 1/3] Modified RTL28xxU driver to work with RTL2832
On 06.05.2012 17:37, Hans-Frieder Vogt wrote: > > line wrapped. This prevents the patch to apply. Please switch off the > automatic > line wrap in your mailer! > Sorry. Now the issue should be resolved. - added tuner probing with log output - added callback for tuners to change UHF/VHF band - moved and renamed tuner enums to own header file - supported devices: - Terratec Cinergy T Stick Black - G-Tek Electronics Group Lifeview LV5TDLX DVB-T [RTL2832U] Signed-off-by: Thomas Mair --- drivers/media/dvb/dvb-usb/rtl28xxu.c| 604 ++- drivers/media/dvb/dvb-usb/rtl28xxu.h| 19 - drivers/media/dvb/dvb-usb/rtl28xxu_tuners.h | 42 ++ 3 files changed, 544 insertions(+), 121 deletions(-) create mode 100644 drivers/media/dvb/dvb-usb/rtl28xxu_tuners.h diff --git a/drivers/media/dvb/dvb-usb/rtl28xxu.c b/drivers/media/dvb/dvb-usb/rtl28xxu.c index 8f4736a..00bd712 100644 --- a/drivers/media/dvb/dvb-usb/rtl28xxu.c +++ b/drivers/media/dvb/dvb-usb/rtl28xxu.c @@ -3,6 +3,7 @@ * * Copyright (C) 2009 Antti Palosaari * Copyright (C) 2011 Antti Palosaari + * Copyright (C) 2012 Thomas Mair * *This program is free software; you can redistribute it and/or modify *it under the terms of the GNU General Public License as published by @@ -20,17 +21,20 @@ */ #include "rtl28xxu.h" +#include "rtl28xxu_tuners.h" #include "rtl2830.h" +#include "rtl2832.h" #include "qt1010.h" #include "mt2060.h" #include "mxl5005s.h" +#include "fc0012.h" + -/* debug */ static int dvb_usb_rtl28xxu_debug; module_param_named(debug, dvb_usb_rtl28xxu_debug, int, 0644); -MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS); +MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req) @@ -76,11 +80,11 @@ static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req) return ret; err: - deb_info("%s: failed=%d\n", __func__, ret); + deb_info("%s: failed=%d", __func__, ret); return ret; } -static int rtl2831_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) +static int rtl28xx_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) { struct rtl28xxu_req req; @@ -98,7 +102,7 @@ static int rtl2831_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) return rtl28xxu_ctrl_msg(d, &req); } -static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) +static int rtl28xx_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) { struct rtl28xxu_req req; @@ -116,14 +120,14 @@ static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) return rtl28xxu_ctrl_msg(d, &req); } -static int rtl2831_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val) +static int rtl28xx_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val) { - return rtl2831_wr_regs(d, reg, &val, 1); + return rtl28xx_wr_regs(d, reg, &val, 1); } -static int rtl2831_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val) +static int rtl28xx_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val) { - return rtl2831_rd_regs(d, reg, val, 1); + return rtl28xx_rd_regs(d, reg, val, 1); } /* I2C */ @@ -297,7 +301,7 @@ static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap) /* for QT1010 tuner probe */ struct rtl28xxu_req req_qt1010 = { 0x0fc4, CMD_I2C_RD, 1, buf }; - deb_info("%s:\n", __func__); + deb_info("%s:", __func__); /* * RTL2831U GPIOs @@ -308,12 +312,13 @@ static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap) */ /* GPIO direction */ - ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_DIR, 0x0a); + ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_DIR, 0x0a); if (ret) goto err; + /* enable as output GPIO0, GPIO2, GPIO4 */ - ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_OUT_EN, 0x15); + ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_OUT_EN, 0x15); if (ret) goto err; @@ -330,12 +335,12 @@ static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap) /* check QT1010 ID(?) register; reg=0f val=2c */ ret = rtl28xxu_ctrl_msg(adap->dev, &req_qt1010); if (ret == 0 && buf[0] == 0x2c) { - priv->tuner = TUNER_RTL2830_QT1010; + priv->tuner = TUNER_RTL28XX_QT1010; rtl2830_config = &rtl28xxu_rtl2830_qt1010_config; - deb_info("%s: QT1010\n", __func__); + deb_info("%s: QT1010", __func__); goto found; } else { - deb_info("%s: QT1010 probe failed=%d - %02x\n", + deb_info("%s: QT1010 probe failed=%d - %02x", __func__, ret, buf[0]); } @@ -347,20 +352,20 @@ static int rtl2831u_front
Re: [PATCH v3 1/3] Modified RTL28xxU driver to work with RTL2832
Am Sonntag, 6. Mai 2012 schrieb Hans-Frieder Vogt: > Am Sonntag, 6. Mai 2012 schrieben Sie: > > Hi everyone, > > > > this is the first complete version of the rtl2832 demod driver. I > > splitted the patches in three parts: > > 1. changes in the dvb-usb part (dvb_usb_rtl28xxu) > > 2. demod driver (rtl2832) > > 3. tuner driver (fc0012) [...] > > + * Realtek RTL28xxU DVB USB driver > > + * > > + * Copyright (C) 2009 Antti Palosaari > > + * Copyright (C) 2011 Antti Palosaari > > + * > > + *This program is free software; you can redistribute it and/or > > modify + *it under the terms of the GNU General Public License as > > published by + *the Free Software Foundation; either version 2 of > > the License, or + *(at your option) any later version. > > + * > > + *This program is distributed in the hope that it will be useful, > > + *but WITHOUT ANY WARRANTY; without even the implied warranty of > > + *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > > + *GNU General Public License for more details. > > + * > > + *You should have received a copy of the GNU General Public License > > along + *with this program; if not, write to the Free Software > > Foundation, Inc., + *51 Franklin Street, Fifth Floor, Boston, MA > > 02110-1301 USA. + */ > > something went wrong here. > forget this comment. I fell into the same "line wrap" trap... > > + > > +#ifndef RTL28XXU_TUNERS_H > > +#define RTL28XXU_TUNERS_H [...] Hans-Frieder Vogt e-mail: hfvogt gmx .dot. net -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 1/3] Modified RTL28xxU driver to work with RTL2832
Am Sonntag, 6. Mai 2012 schrieben Sie: > Hi everyone, > > this is the first complete version of the rtl2832 demod driver. I > splitted the patches in three parts: > 1. changes in the dvb-usb part (dvb_usb_rtl28xxu) > 2. demod driver (rtl2832) > 3. tuner driver (fc0012) > > - added tuner probing with log output > - added callback for tuners to change UHF/VHF band > - moved and renamed tuner enums to own header file > - supported devices: > - Terratec Cinergy T Stick Black > - G-Tek Electronics Group Lifeview LV5TDLX DVB-T [RTL2832U] > > Signed-off-by: Thomas Mair > --- > drivers/media/dvb/dvb-usb/rtl28xxu.c| 604 > ++- drivers/media/dvb/dvb-usb/rtl28xxu.h| > 19 - > drivers/media/dvb/dvb-usb/rtl28xxu_tuners.h | 42 ++ > 3 files changed, 544 insertions(+), 121 deletions(-) > create mode 100644 drivers/media/dvb/dvb-usb/rtl28xxu_tuners.h > > diff --git a/drivers/media/dvb/dvb-usb/rtl28xxu.c > b/drivers/media/dvb/dvb-usb/rtl28xxu.c > index 8f4736a..00bd712 100644 > --- a/drivers/media/dvb/dvb-usb/rtl28xxu.c > +++ b/drivers/media/dvb/dvb-usb/rtl28xxu.c > @@ -3,6 +3,7 @@ > * > * Copyright (C) 2009 Antti Palosaari > * Copyright (C) 2011 Antti Palosaari > + * Copyright (C) 2012 Thomas Mair > * > *This program is free software; you can redistribute it and/or modify > *it under the terms of the GNU General Public License as published by > @@ -20,17 +21,20 @@ > */ > > #include "rtl28xxu.h" > +#include "rtl28xxu_tuners.h" > > #include "rtl2830.h" > +#include "rtl2832.h" > > #include "qt1010.h" > #include "mt2060.h" > #include "mxl5005s.h" > +#include "fc0012.h" > + > > -/* debug */ > static int dvb_usb_rtl28xxu_debug; > module_param_named(debug, dvb_usb_rtl28xxu_debug, int, 0644); > -MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS); > +MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); > DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); > > static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct > rtl28xxu_req *req) > @@ -76,11 +80,11 @@ static int rtl28xxu_ctrl_msg(struct dvb_usb_device > *d, struct rtl28xxu_req *req) line wrapped. This prevents the patch to apply. Please switch off the automatic line wrap in your mailer! > > return ret; > err: > - deb_info("%s: failed=%d\n", __func__, ret); > + deb_info("%s: failed=%d", __func__, ret); > return ret; > } > > -static int rtl2831_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int > len) +static int rtl28xx_wr_regs(struct dvb_usb_device *d, u16 reg, u8 > *val, int len) { > struct rtl28xxu_req req; > > @@ -98,7 +102,7 @@ static int rtl2831_wr_regs(struct dvb_usb_device > *d, u16 reg, u8 *val, int len) > return rtl28xxu_ctrl_msg(d, &req); > } > > -static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int > len) +static int rtl28xx_rd_regs(struct dvb_usb_device *d, u16 reg, u8 > *val, int len) { > struct rtl28xxu_req req; > > @@ -116,14 +120,14 @@ static int rtl2831_rd_regs(struct dvb_usb_device > *d, u16 reg, u8 *val, int len) same here (and many more times below). > return rtl28xxu_ctrl_msg(d, &req); > } > > -static int rtl2831_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val) > +static int rtl28xx_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val) > { > - return rtl2831_wr_regs(d, reg, &val, 1); > + return rtl28xx_wr_regs(d, reg, &val, 1); > } > > -static int rtl2831_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val) > +static int rtl28xx_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val) > { > - return rtl2831_rd_regs(d, reg, val, 1); > + return rtl28xx_rd_regs(d, reg, val, 1); > } > > /* I2C */ > @@ -297,7 +301,7 @@ static int rtl2831u_frontend_attach(struct > dvb_usb_adapter *adap) > /* for QT1010 tuner probe */ > struct rtl28xxu_req req_qt1010 = { 0x0fc4, CMD_I2C_RD, 1, buf }; > > - deb_info("%s:\n", __func__); > + deb_info("%s:", __func__); > > /* >* RTL2831U GPIOs > @@ -308,12 +312,13 @@ static int rtl2831u_frontend_attach(struct > dvb_usb_adapter *adap) >*/ > > /* GPIO direction */ > - ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_DIR, 0x0a); > + ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_DIR, 0x0a); > if (ret) > goto err; > > + > /* enable as output GPIO0, GPIO2, GPIO4 */ > - ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_OUT_EN, 0x15); > + ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_OUT_EN, 0x15); > if (ret) > goto err; > > @@ -330,12 +335,12 @@ static int rtl2831u_frontend_attach(struct > dvb_usb_adapter *adap) > /* check QT1010 ID(?) register; reg=0f val=2c */ > ret = rtl28xxu_ctrl_msg(adap->dev, &req_qt1010); > if (ret == 0 && buf[0] == 0x2c) { > - priv->tuner = TUNER_RTL2830_QT1010; > + priv->tuner = TUNER_RTL28XX_QT1010; > rtl2830_config = &rtl28xxu_rtl2830_qt1010_config
[PATCH v3 1/3] Modified RTL28xxU driver to work with RTL2832
Hi everyone, this is the first complete version of the rtl2832 demod driver. I splitted the patches in three parts: 1. changes in the dvb-usb part (dvb_usb_rtl28xxu) 2. demod driver (rtl2832) 3. tuner driver (fc0012) - added tuner probing with log output - added callback for tuners to change UHF/VHF band - moved and renamed tuner enums to own header file - supported devices: - Terratec Cinergy T Stick Black - G-Tek Electronics Group Lifeview LV5TDLX DVB-T [RTL2832U] Signed-off-by: Thomas Mair --- drivers/media/dvb/dvb-usb/rtl28xxu.c| 604 ++- drivers/media/dvb/dvb-usb/rtl28xxu.h| 19 - drivers/media/dvb/dvb-usb/rtl28xxu_tuners.h | 42 ++ 3 files changed, 544 insertions(+), 121 deletions(-) create mode 100644 drivers/media/dvb/dvb-usb/rtl28xxu_tuners.h diff --git a/drivers/media/dvb/dvb-usb/rtl28xxu.c b/drivers/media/dvb/dvb-usb/rtl28xxu.c index 8f4736a..00bd712 100644 --- a/drivers/media/dvb/dvb-usb/rtl28xxu.c +++ b/drivers/media/dvb/dvb-usb/rtl28xxu.c @@ -3,6 +3,7 @@ * * Copyright (C) 2009 Antti Palosaari * Copyright (C) 2011 Antti Palosaari + * Copyright (C) 2012 Thomas Mair * *This program is free software; you can redistribute it and/or modify *it under the terms of the GNU General Public License as published by @@ -20,17 +21,20 @@ */ #include "rtl28xxu.h" +#include "rtl28xxu_tuners.h" #include "rtl2830.h" +#include "rtl2832.h" #include "qt1010.h" #include "mt2060.h" #include "mxl5005s.h" +#include "fc0012.h" + -/* debug */ static int dvb_usb_rtl28xxu_debug; module_param_named(debug, dvb_usb_rtl28xxu_debug, int, 0644); -MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS); +MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req) @@ -76,11 +80,11 @@ static int rtl28xxu_ctrl_msg(struct dvb_usb_device *d, struct rtl28xxu_req *req) return ret; err: - deb_info("%s: failed=%d\n", __func__, ret); + deb_info("%s: failed=%d", __func__, ret); return ret; } -static int rtl2831_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) +static int rtl28xx_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) { struct rtl28xxu_req req; @@ -98,7 +102,7 @@ static int rtl2831_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) return rtl28xxu_ctrl_msg(d, &req); } -static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) +static int rtl28xx_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) { struct rtl28xxu_req req; @@ -116,14 +120,14 @@ static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len) return rtl28xxu_ctrl_msg(d, &req); } -static int rtl2831_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val) +static int rtl28xx_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val) { - return rtl2831_wr_regs(d, reg, &val, 1); + return rtl28xx_wr_regs(d, reg, &val, 1); } -static int rtl2831_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val) +static int rtl28xx_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val) { - return rtl2831_rd_regs(d, reg, val, 1); + return rtl28xx_rd_regs(d, reg, val, 1); } /* I2C */ @@ -297,7 +301,7 @@ static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap) /* for QT1010 tuner probe */ struct rtl28xxu_req req_qt1010 = { 0x0fc4, CMD_I2C_RD, 1, buf }; - deb_info("%s:\n", __func__); + deb_info("%s:", __func__); /* * RTL2831U GPIOs @@ -308,12 +312,13 @@ static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap) */ /* GPIO direction */ - ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_DIR, 0x0a); + ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_DIR, 0x0a); if (ret) goto err; + /* enable as output GPIO0, GPIO2, GPIO4 */ - ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_OUT_EN, 0x15); + ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_OUT_EN, 0x15); if (ret) goto err; @@ -330,12 +335,12 @@ static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap) /* check QT1010 ID(?) register; reg=0f val=2c */ ret = rtl28xxu_ctrl_msg(adap->dev, &req_qt1010); if (ret == 0 && buf[0] == 0x2c) { - priv->tuner = TUNER_RTL2830_QT1010; + priv->tuner = TUNER_RTL28XX_QT1010; rtl2830_config = &rtl28xxu_rtl2830_qt1010_config; - deb_info("%s: QT1010\n", __func__); + deb_info("%s: QT1010", __func__); goto found; } else { - deb_info("%s: QT1010 probe failed=%d - %02x\n", + deb_info("%s: QT1010 probe failed=%d - %02x", __func__, ret, buf[0]); } @@ -347,20 +352,20 @@ static int rtl2831u_frontend_attach(struct
which fm cards/hardware work with linux kernel 3.x?
hi all, I'm a linux-media user who for many years used an fm radio card. After recent kernel updates, fm no longer works. I frankly, don't know enough to determine where the problem lies--whether it's hardware or out of date drivers or unmaintained code. FM Radio seems to join the "dustbins of tech" along with teletype, wire recorders, and, am radio. For now it's still very helpful for legally recording OTA broadcasts. I'm ready to upgrade my fm card. If you know a working solution--specific fm cards or usb fm receivers-- as well as any software tweaks--please respond to this thread or email me directly. thanks in advance, will -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Hauppauge HVR900H don't work with kernel 3.*
Hi, Try with 2.6.39 and it work but I've some freezes. I've try copying tm6000 directory from 2.6.39 to 3.0 and it as work sometimes. This is not an issue because this produce kernels panics. So for me there are 2 problems: - 2.6.38 dvb-t work good - 2.6.39, dvb-t work but sometime freeze the computer - 3.* dvb-t don't work I'm trying to apply all the patchs from a 2.6.38 to obtain the same files as a 3.0 to find what patch causes the problem but I've a lot of errors. Thanks On 17 November 2011 19:35, Esteban Tarroni a écrit : > Norret Thierry > > Hello, > I have this card > http://www.linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-900H > and use gentoo id 2040:6600 > Since I upgrade my kernel from 2.6.38 to 3.* scan for channel doesn't work > and > channels can't be lock > > The modules (tm6000) are load, the firmware (xc3028L-v36.fw) is copied to > /lib/firmware, the signal is > good but no channels found with w_scan/vlc/mplayer/kaffeineI don't see any > error in dmesg. > > I've try last distros (ubuntu 11.10, fedora 16) with kernel 3.* and same > results. > The last git sources from v4l/dvb don't resolve the problem. > > Thanks > > # dmesg > [ 81.132653] IR NEC protocol handler initialized > [ 81.158229] tm6000: module is from the staging directory, the quality is > unknown, you have been warned. > [ 81.158801] tm6000 v4l2 driver version 0.0.2 loaded > [ 81.160885] tm6000: alt 0, interface 0, class 255 > [ 81.160890] tm6000: alt 0, interface 0, class 255 > [ 81.160895] tm6000: Bulk IN endpoint: 0x82 (max size=512 bytes) > [ 81.160899] tm6000: alt 0, interface 0, class 255 > [ 81.160903] tm6000: alt 1, interface 0, class 255 > [ 81.160907] tm6000: ISOC IN endpoint: 0x81 (max size=3072 bytes) > [ 81.160911] tm6000: alt 1, interface 0, class 255 > [ 81.160914] tm6000: alt 1, interface 0, class 255 > [ 81.160918] tm6000: INT IN endpoint: 0x83 (max size=4 bytes) > [ 81.160922] tm6000: alt 2, interface 0, class 255 > [ 81.160925] tm6000: alt 2, interface 0, class 255 > [ 81.160929] tm6000: alt 2, interface 0, class 255 > [ 81.160932] tm6000: alt 3, interface 0, class 255 > [ 81.160936] tm6000: alt 3, interface 0, class 255 > [ 81.160939] tm6000: alt 3, interface 0, class 255 > [ 81.160943] tm6000: New video device @ 480 Mbps (2040:6600, ifnum 0) > [ 81.160947] tm6000: Found Hauppauge WinTV HVR-900H / WinTV USB2-Stick > [ 81.167856] Found tm6010 > [ 81.176973] IR RC5(x) protocol handler initialized > [ 81.183409] IR RC6 protocol handler initialized > [ 81.185159] IR JVC protocol handler initialized > [ 81.187524] IR Sony protocol handler initialized > [ 81.201304] lirc_dev: IR Remote Control driver registered, major 250 > [ 81.206121] IR LIRC bridge handler initialized > [ 81.964984] tm6000 #0: i2c eeprom 00: 01 59 54 45 12 01 00 02 00 00 00 40 > 40 > 20 00 66 .YTE...@@ .f > [ 82.076933] tm6000 #0: i2c eeprom 10: 69 00 10 20 40 01 02 03 48 00 79 00 > 62 > 00 72 00 i.. @...H.y.b.r. > [ 82.188834] tm6000 #0: i2c eeprom 20: ff 00 64 ff ff ff ff ff ff ff ff ff > ff > ff ff ff ..d. > [ 82.300725] tm6000 #0: i2c eeprom 30: ff ff ff ff ff ff ff ff ff ff ff ff > ff > ff ff ff > [ 82.412622] tm6000 #0: i2c eeprom 40: 10 03 48 00 56 00 52 00 39 00 30 00 > 30 > 00 48 00 ..H.V.R.9.0.0.H. > [ 82.524561] tm6000 #0: i2c eeprom 50: ff ff ff ff ff ff ff ff ff ff ff ff > ff > ff ff ff > [ 82.636402] tm6000 #0: i2c eeprom 60: 30 ff ff ff 0f ff ff ff ff ff 0a 03 > 32 > 00 2e 00 0...2... > [ 82.748303] tm6000 #0: i2c eeprom 70: 3f 00 ff ff ff ff ff ff ff ff ff ff > ff > ff ff ff ?... > [ 82.860197] tm6000 #0: i2c eeprom 80: ff ff ff ff ff ff ff ff ff ff ff ff > ff > ff ff ff > [ 82.972092] tm6000 #0: i2c eeprom 90: 32 ff ff ff 16 03 34 00 30 00 33 00 > 32 > 00 31 00 2.4.0.3.2.1. > [ 83.083977] tm6000 #0: i2c eeprom a0: 33 00 34 00 39 00 30 00 32 00 00 00 > 00 > 00 ff ff 3.4.9.0.2... > [ 83.195871] tm6000 #0: i2c eeprom b0: ff ff ff ff ff ff ff ff ff ff ff ff > ff > ff ff ff > [ 83.307773] tm6000 #0: i2c eeprom c0: ff ff ff ff ff ff ff ff ff ff ff ff > ff > ff ff ff > [ 83.419666] tm6000 #0: i2c eeprom d0: ff ff ff ff ff ff ff ff ff ff ff ff > ff > ff ff ff > [ 83.531535] tm6000 #0: i2c eeprom e0: ff ff ff ff ff ff ff ff ff ff ff ff > ff > ff ff ff > [ 83.643448] tm6000 #0: i2c eeprom f0: ff ff ff ff ff ff ff ff ff ff ff ff > ff > ff ff ff > [ 83.801012] i2c-core: driver [tuner] using legacy suspend method > [ 83.801017] i2c-core: driver [tuner] using legacy resume method > [ 83.801303] tuner 1-0061: Tuner -1 found with type(s) Radio TV. > [ 83.801309] xc2028 1-0061: creating new instance > [ 83.801311] xc2028 1-0061: type set to XCeive
Re: Hauppauge HVR900H don't work with kernel 3.*
Norret Thierry http://www.linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-900H and use gentoo Since I upgrade my kernel from 2.6.38 to 3.* scan for channel doesn't work and channels can't be lock The modules (tm6000) are load, the firmware (xc3028L-v36.fw) is copied to /lib/firmware, the signal is good but no channels found with w_scan/vlc/mplayer/kaffeineI don't see any error in dmesg. I've try last distros (ubuntu 11.10, fedora 16) with kernel 3.* and same results. The last git sources from v4l/dvb don't resolve the problem. Thanks # dmesg [ 81.132653] IR NEC protocol handler initialized [ 81.158229] tm6000: module is from the staging directory, the quality is unknown, you have been warned. [ 81.158801] tm6000 v4l2 driver version 0.0.2 loaded [ 81.160885] tm6000: alt 0, interface 0, class 255 [ 81.160890] tm6000: alt 0, interface 0, class 255 [ 81.160895] tm6000: Bulk IN endpoint: 0x82 (max size=512 bytes) [ 81.160899] tm6000: alt 0, interface 0, class 255 [ 81.160903] tm6000: alt 1, interface 0, class 255 [ 81.160907] tm6000: ISOC IN endpoint: 0x81 (max size=3072 bytes) [ 81.160911] tm6000: alt 1, interface 0, class 255 [ 81.160914] tm6000: alt 1, interface 0, class 255 [ 81.160918] tm6000: INT IN endpoint: 0x83 (max size=4 bytes) [ 81.160922] tm6000: alt 2, interface 0, class 255 [ 81.160925] tm6000: alt 2, interface 0, class 255 [ 81.160929] tm6000: alt 2, interface 0, class 255 [ 81.160932] tm6000: alt 3, interface 0, class 255 [ 81.160936] tm6000: alt 3, interface 0, class 255 [ 81.160939] tm6000: alt 3, interface 0, class 255 [ 81.160943] tm6000: New video device @ 480 Mbps (2040:6600, ifnum 0) [ 81.160947] tm6000: Found Hauppauge WinTV HVR-900H / WinTV USB2-Stick [ 81.167856] Found tm6010 [ 81.176973] IR RC5(x) protocol handler initialized [ 81.183409] IR RC6 protocol handler initialized [ 81.185159] IR JVC protocol handler initialized [ 81.187524] IR Sony protocol handler initialized [ 81.201304] lirc_dev: IR Remote Control driver registered, major 250 [ 81.206121] IR LIRC bridge handler initialized [ 81.964984] tm6000 #0: i2c eeprom 00: 01 59 54 45 12 01 00 02 00 00 00 40 40 20 00 66 .YTE...@@ .f [ 82.076933] tm6000 #0: i2c eeprom 10: 69 00 10 20 40 01 02 03 48 00 79 00 62 00 72 00 i.. @...H.y.b.r. [ 82.188834] tm6000 #0: i2c eeprom 20: ff 00 64 ff ff ff ff ff ff ff ff ff ff ff ff ff ..d. [ 82.300725] tm6000 #0: i2c eeprom 30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 82.412622] tm6000 #0: i2c eeprom 40: 10 03 48 00 56 00 52 00 39 00 30 00 30 00 48 00 ..H.V.R.9.0.0.H. [ 82.524561] tm6000 #0: i2c eeprom 50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 82.636402] tm6000 #0: i2c eeprom 60: 30 ff ff ff 0f ff ff ff ff ff 0a 03 32 00 2e 00 0...2... [ 82.748303] tm6000 #0: i2c eeprom 70: 3f 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ?... [ 82.860197] tm6000 #0: i2c eeprom 80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 82.972092] tm6000 #0: i2c eeprom 90: 32 ff ff ff 16 03 34 00 30 00 33 00 32 00 31 00 2.4.0.3.2.1. [ 83.083977] tm6000 #0: i2c eeprom a0: 33 00 34 00 39 00 30 00 32 00 00 00 00 00 ff ff 3.4.9.0.2... [ 83.195871] tm6000 #0: i2c eeprom b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 83.307773] tm6000 #0: i2c eeprom c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 83.419666] tm6000 #0: i2c eeprom d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 83.531535] tm6000 #0: i2c eeprom e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 83.643448] tm6000 #0: i2c eeprom f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 83.801012] i2c-core: driver [tuner] using legacy suspend method [ 83.801017] i2c-core: driver [tuner] using legacy resume method [ 83.801303] tuner 1-0061: Tuner -1 found with type(s) Radio TV. [ 83.801309] xc2028 1-0061: creating new instance [ 83.801311] xc2028 1-0061: type set to XCeive xc2028/xc3028 tuner [ 83.801313] Setting firmware parameters for xc2028 [ 83.804849] xc2028 1-0061: Loading 81 firmware images from xc3028L-v36.fw, type: xc2028 firmware, ver 3.6 [ 84.021087] xc2028 1-0061: Loading firmware for type=BASE (1), id . [ 109.684698] xc2028 1-0061: Loading firmware for type=(0), id b700. [ 110.118322] SCODE (2000), id b700: [ 110.118331] xc2028 1-0061: Loading SCODE for type=MONO SCODE HAS_IF_4320 (60008000), id 8000. [ 110.733824] tm6000 #0: registered device video1 [ 110.733831] Trident TVMaster TM5600/TM6000/TM6010 USB2 board (Load status: 0) [ 110.733865] usbcore: registered new interface driver tm6000 [ 110.735587] tm6000: open called (dev=video1) [ 110.812501] tm6000_dvb: mod
Re: Hauppauge HVR900H don't work with kernel 3.*
Same problem here since upgrade to ubuntu 11.10 I've found these topics but no solutions http://forum.ubuntuusers.de/topic/dvb-t-stick-wird-nicht-erkannt http://forum.ubuntu-it.org/index.php/topic,59926.160.html http://forums.gentoo.org/viewtopic-t-900714.html -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Hauppauge HVR900H don't work with kernel 3.*
i dont know about digital, but to me it crashes the USB probe after connect-disconnect-reconnect. after that, it doesnt notice any changes in connected USB devices and need to restart. it may be possible, that there is some module hanging in there, because i get the same problem when i have femon running and then disconnect the dvb device (no matter which one - volarHD in my case), because it is stuck as femon "uses" the driver. when i kill femon, everything runns again. so my theory is, that there is somewhat stuck in there. and it doesnt help to remove the DVB driver. so it is definitely something with the analogue part (and analog is what i need, because there are not many devices that do analog any more). On Wed, 9 Nov 2011 21:08:59 + (GMT) Norret Thierry wrote: > Hello, > I have this card > http://www.linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-900H and > use gentoo Since I upgrade my kernel from 2.6.38 to 3.* scan for > channel doesn't work and channels can't be lock > > The modules (tm6000) are load, the firmware (xc3028L-v36.fw) is > copied to /lib/firmware, the signal is good but no channels found > with w_scan/vlc/mplayer/kaffeineI don't see any error in dmesg. > > I've try last distros (ubuntu 11.10, fedora 16) with kernel 3.* and > same results. The last git sources from v4l/dvb don't resolve the > problem. > > Thanks > > > # dmesg > [ 81.132653] IR NEC protocol handler initialized > [ 81.158229] tm6000: module is from the staging directory, the > quality is unknown, you have been warned. > [ 81.158801] tm6000 v4l2 driver version 0.0.2 loaded > [ 81.160885] tm6000: alt 0, interface 0, class 255 > [ 81.160890] tm6000: alt 0, interface 0, class 255 > [ 81.160895] tm6000: Bulk IN endpoint: 0x82 (max size=512 bytes) > [ 81.160899] tm6000: alt 0, interface 0, class 255 > [ 81.160903] tm6000: alt 1, interface 0, class 255 > [ 81.160907] tm6000: ISOC IN endpoint: 0x81 (max size=3072 bytes) > [ 81.160911] tm6000: alt 1, interface 0, class 255 > [ 81.160914] tm6000: alt 1, interface 0, class 255 > [ 81.160918] tm6000: INT IN endpoint: 0x83 (max size=4 bytes) > [ 81.160922] tm6000: alt 2, interface 0, class 255 > [ 81.160925] tm6000: alt 2, interface 0, class 255 > [ 81.160929] tm6000: alt 2, interface 0, class 255 > [ 81.160932] tm6000: alt 3, interface 0, class 255 > [ 81.160936] tm6000: alt 3, interface 0, class 255 > [ 81.160939] tm6000: alt 3, interface 0, class 255 > [ 81.160943] tm6000: New video device @ 480 Mbps (2040:6600, ifnum > 0) [ 81.160947] tm6000: Found Hauppauge WinTV HVR-900H / WinTV > USB2-Stick [ 81.167856] Found tm6010 > [ 81.176973] IR RC5(x) protocol handler initialized > [ 81.183409] IR RC6 protocol handler initialized > [ 81.185159] IR JVC protocol handler initialized > [ 81.187524] IR Sony protocol handler initialized > [ 81.201304] lirc_dev: IR Remote Control driver registered, major > 250 [ 81.206121] IR LIRC bridge handler initialized > [ 81.964984] tm6000 #0: i2c eeprom 00: 01 59 54 45 12 01 00 02 00 > 00 00 40 40 20 00 66 .YTE...@@ .f > [ 82.076933] tm6000 #0: i2c eeprom 10: 69 00 10 20 40 01 02 03 48 > 00 79 00 62 00 72 00 i.. @...H.y.b.r. > [ 82.188834] tm6000 #0: i2c eeprom 20: ff 00 64 ff ff ff ff ff ff > ff ff ff ff ff ff ff ..d. > [ 82.300725] tm6000 #0: i2c eeprom 30: ff ff ff ff ff ff ff ff ff > ff ff ff ff ff ff ff > [ 82.412622] tm6000 #0: i2c eeprom 40: 10 03 48 00 56 00 52 00 39 > 00 30 00 30 00 48 00 ..H.V.R.9.0.0.H. > [ 82.524561] tm6000 #0: i2c eeprom 50: ff ff ff ff ff ff ff ff ff > ff ff ff ff ff ff ff > [ 82.636402] tm6000 #0: i2c eeprom 60: 30 ff ff ff 0f ff ff ff ff > ff 0a 03 32 00 2e 00 0...2... > [ 82.748303] tm6000 #0: i2c eeprom 70: 3f 00 ff ff ff ff ff ff ff > ff ff ff ff ff ff ff ?... > [ 82.860197] tm6000 #0: i2c eeprom 80: ff ff ff ff ff ff ff ff ff > ff ff ff ff ff ff ff > [ 82.972092] tm6000 #0: i2c eeprom 90: 32 ff ff ff 16 03 34 00 30 > 00 33 00 32 00 31 00 2.4.0.3.2.1. > [ 83.083977] tm6000 #0: i2c eeprom a0: 33 00 34 00 39 00 30 00 32 > 00 00 00 00 00 ff ff 3.4.9.0.2... > [ 83.195871] tm6000 #0: i2c eeprom b0: ff ff ff ff ff ff ff ff ff > ff ff ff ff ff ff ff > [ 83.307773] tm6000 #0: i2c eeprom c0: ff ff ff ff ff ff ff ff ff > ff ff ff ff ff ff ff > [ 83.419666] tm6000 #0: i2c eeprom d0: ff ff ff ff ff ff ff ff ff > ff ff ff ff ff ff ff > [ 83.531535] tm6000 #0: i2c eeprom e0: ff ff ff ff ff ff ff ff ff > ff ff ff ff ff ff ff > [ 83.643448] tm6000 #0: i2c eeprom f0: ff ff ff ff ff ff ff ff ff > ff ff ff ff ff ff ff > [ 83.801012] i2c-core: driver [tuner] using legacy suspend method > [ 83.801017] i2c-core: driver [tuner] using legacy resume method > [ 83.801303] tuner 1-0061: Tuner -1 found with type(s) Radio TV. > [ 83.801309] xc2028 1
Hauppauge HVR900H don't work with kernel 3.*
Hello, I have this card http://www.linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-900H and use gentoo Since I upgrade my kernel from 2.6.38 to 3.* scan for channel doesn't work and channels can't be lock The modules (tm6000) are load, the firmware (xc3028L-v36.fw) is copied to /lib/firmware, the signal is good but no channels found with w_scan/vlc/mplayer/kaffeineI don't see any error in dmesg. I've try last distros (ubuntu 11.10, fedora 16) with kernel 3.* and same results. The last git sources from v4l/dvb don't resolve the problem. Thanks # dmesg [ 81.132653] IR NEC protocol handler initialized [ 81.158229] tm6000: module is from the staging directory, the quality is unknown, you have been warned. [ 81.158801] tm6000 v4l2 driver version 0.0.2 loaded [ 81.160885] tm6000: alt 0, interface 0, class 255 [ 81.160890] tm6000: alt 0, interface 0, class 255 [ 81.160895] tm6000: Bulk IN endpoint: 0x82 (max size=512 bytes) [ 81.160899] tm6000: alt 0, interface 0, class 255 [ 81.160903] tm6000: alt 1, interface 0, class 255 [ 81.160907] tm6000: ISOC IN endpoint: 0x81 (max size=3072 bytes) [ 81.160911] tm6000: alt 1, interface 0, class 255 [ 81.160914] tm6000: alt 1, interface 0, class 255 [ 81.160918] tm6000: INT IN endpoint: 0x83 (max size=4 bytes) [ 81.160922] tm6000: alt 2, interface 0, class 255 [ 81.160925] tm6000: alt 2, interface 0, class 255 [ 81.160929] tm6000: alt 2, interface 0, class 255 [ 81.160932] tm6000: alt 3, interface 0, class 255 [ 81.160936] tm6000: alt 3, interface 0, class 255 [ 81.160939] tm6000: alt 3, interface 0, class 255 [ 81.160943] tm6000: New video device @ 480 Mbps (2040:6600, ifnum 0) [ 81.160947] tm6000: Found Hauppauge WinTV HVR-900H / WinTV USB2-Stick [ 81.167856] Found tm6010 [ 81.176973] IR RC5(x) protocol handler initialized [ 81.183409] IR RC6 protocol handler initialized [ 81.185159] IR JVC protocol handler initialized [ 81.187524] IR Sony protocol handler initialized [ 81.201304] lirc_dev: IR Remote Control driver registered, major 250 [ 81.206121] IR LIRC bridge handler initialized [ 81.964984] tm6000 #0: i2c eeprom 00: 01 59 54 45 12 01 00 02 00 00 00 40 40 20 00 66 .YTE...@@ .f [ 82.076933] tm6000 #0: i2c eeprom 10: 69 00 10 20 40 01 02 03 48 00 79 00 62 00 72 00 i.. @...H.y.b.r. [ 82.188834] tm6000 #0: i2c eeprom 20: ff 00 64 ff ff ff ff ff ff ff ff ff ff ff ff ff ..d. [ 82.300725] tm6000 #0: i2c eeprom 30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 82.412622] tm6000 #0: i2c eeprom 40: 10 03 48 00 56 00 52 00 39 00 30 00 30 00 48 00 ..H.V.R.9.0.0.H. [ 82.524561] tm6000 #0: i2c eeprom 50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 82.636402] tm6000 #0: i2c eeprom 60: 30 ff ff ff 0f ff ff ff ff ff 0a 03 32 00 2e 00 0...2... [ 82.748303] tm6000 #0: i2c eeprom 70: 3f 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ?... [ 82.860197] tm6000 #0: i2c eeprom 80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 82.972092] tm6000 #0: i2c eeprom 90: 32 ff ff ff 16 03 34 00 30 00 33 00 32 00 31 00 2.4.0.3.2.1. [ 83.083977] tm6000 #0: i2c eeprom a0: 33 00 34 00 39 00 30 00 32 00 00 00 00 00 ff ff 3.4.9.0.2... [ 83.195871] tm6000 #0: i2c eeprom b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 83.307773] tm6000 #0: i2c eeprom c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 83.419666] tm6000 #0: i2c eeprom d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 83.531535] tm6000 #0: i2c eeprom e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 83.643448] tm6000 #0: i2c eeprom f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 83.801012] i2c-core: driver [tuner] using legacy suspend method [ 83.801017] i2c-core: driver [tuner] using legacy resume method [ 83.801303] tuner 1-0061: Tuner -1 found with type(s) Radio TV. [ 83.801309] xc2028 1-0061: creating new instance [ 83.801311] xc2028 1-0061: type set to XCeive xc2028/xc3028 tuner [ 83.801313] Setting firmware parameters for xc2028 [ 83.804849] xc2028 1-0061: Loading 81 firmware images from xc3028L-v36.fw, type: xc2028 firmware, ver 3.6 [ 84.021087] xc2028 1-0061: Loading firmware for type=BASE (1), id . [ 109.684698] xc2028 1-0061: Loading firmware for type=(0), id b700. [ 110.118322] SCODE (2000), id b700: [ 110.118331] xc2028 1-0061: Loading SCODE for type=MONO SCODE HAS_IF_4320 (60008000), id 8000. [ 110.733824] tm6000 #0: registered device video1 [ 110.733831] Trident TVMaster TM5600/TM6000/TM6010 USB2 board (Load status: 0) [ 110.733865] usbcore: registered new interface driver tm6000 [ 110.735587] tm6000: open called (dev=video1) [ 110.812501] tm6000_dvb: module is from the staging directory, the quality is unknown, you have been warne
Re: [PATCH v3 - resend] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend.
On Thursday 02 June 2011 11:46:15 Lutz Sammer wrote: > Hello Hans Petter, Hi, > > I haven't tested your patch yet, but looking at the source I see some > problems. > > What does your patch fix and how? It switches from software derot to hardware derot, by writing zero to the derot register. > > If you have problem locking channels, try my locking patch: > https://patchwork.kernel.org/patch/753382/ > > On each step (timing, carrier, data) you reset the derot: > stb0899_set_derot(state, 0); > Why? I have no good reason. It just works. > > Afaik you destroy already locked frequencies, which slows > down the locking. > > Than you do 8 loops: > for (index = 0; index < 8; index++) { > Why? > > All checks already contains some delays, if the delays are too > short, you should fix this delays. I can test patches regarding channel locking. The initial problem was the the stb0899 driver would not tune any channels. --HPS -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v3 - resend] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend.
Hello Hans Petter, I haven't tested your patch yet, but looking at the source I see some problems. What does your patch fix and how? If you have problem locking channels, try my locking patch: https://patchwork.kernel.org/patch/753382/ On each step (timing, carrier, data) you reset the derot: stb0899_set_derot(state, 0); Why? Afaik you destroy already locked frequencies, which slows down the locking. Than you do 8 loops: for (index = 0; index < 8; index++) { Why? All checks already contains some delays, if the delays are too short, you should fix this delays. Johns -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend.
On Saturday 28 May 2011 12:30:17 Mariusz Bialonczyk wrote: > Hello > I don't know what mailer you're using but your patches > to the ML are malformed (word wrapped). > > Please have a look: > http://www.kernel.org/doc/Documentation/email-clients.txt > > I don't know for sure but you may need to send them > again (all those malformed)... > > regards, I tried to resend the e-mail w/o word wrapping. I'm using KMail. --HPS -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 - resend] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend.
(Hopefully without line wrapping of KMail.) >From 5449f996bb340e4423b3146d1e0172dd635c0398 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Tue, 24 May 2011 21:44:53 +0200 Subject: [PATCH] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend. Signed-off-by: Hans Petter Selasky --- drivers/media/dvb/frontends/stb0899_algo.c | 173 drivers/media/dvb/frontends/stb0899_drv.c |1 - drivers/media/dvb/frontends/stb0899_priv.h |3 - 3 files changed, 75 insertions(+), 102 deletions(-) diff --git a/drivers/media/dvb/frontends/stb0899_algo.c b/drivers/media/dvb/frontends/stb0899_algo.c index d70eee0..9156c3b 100644 --- a/drivers/media/dvb/frontends/stb0899_algo.c +++ b/drivers/media/dvb/frontends/stb0899_algo.c @@ -117,7 +117,7 @@ static u32 stb0899_set_srate(struct stb0899_state *state, u32 master_clk, u32 sr */ static long stb0899_calc_derot_time(long srate) { - if (srate > 0) + if (srate > 999) return (10 / (srate / 1000)); else return 0; @@ -200,6 +200,39 @@ static enum stb0899_status stb0899_check_tmg(struct stb0899_state *state) } /* + * stb0899_set_derot + * set frequency derotor in HZ. + */ +static void +stb0899_set_derot(struct stb0899_state *state, s16 derot) +{ + u8 cfr[2]; + + derot *= state->config->inversion; + + cfr[0] = (u8)(derot >> 8); + cfr[1] = (u8)derot; + + /* set derotator frequency in Hz */ + stb0899_write_regs(state, STB0899_CFRM, cfr, 2); +} + +/* + * stb0899_get_derot + * get frequency derotor in HZ. + */ +static s16 +stb0899_get_derot(struct stb0899_state *state) +{ + u8 cfr[2] = {0, 0}; + + /* get derotator frequency in Hz */ + stb0899_read_regs(state, STB0899_CFRM, cfr, 2); + + return (state->config->inversion * (s16)MAKEWORD16(cfr[0], cfr[1])); +} + +/* * stb0899_search_tmg * perform a fs/2 zig-zag to find timing */ @@ -207,36 +240,22 @@ static enum stb0899_status stb0899_search_tmg(struct stb0899_state *state) { struct stb0899_internal *internal = &state->internal; struct stb0899_params *params = &state->params; - - short int derot_step, derot_freq = 0, derot_limit, next_loop = 3; - int index = 0; - u8 cfr[2]; + int index; internal->status = NOTIMING; - /* timing loop computation & symbol rate optimisation */ - derot_limit = (internal->sub_range / 2L) / internal->mclk; - derot_step = (params->srate / 2L) / internal->mclk; + /* let the hardware figure out derot frequency */ + stb0899_set_derot(state, 0); - while ((stb0899_check_tmg(state) != TIMINGOK) && next_loop) { - index++; - derot_freq += index * internal->direction * derot_step; /* next derot zig zag position */ - - if (abs(derot_freq) > derot_limit) - next_loop--; + for (index = 0; index < 8; index++) { + if (stb0899_check_tmg(state) == TIMINGOK) { + /* get derotator frequency */ + internal->derot_freq = stb0899_get_derot(state); - if (next_loop) { - STB0899_SETFIELD_VAL(CFRM, cfr[0], MSB(state->config->inversion * derot_freq)); - STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(state->config->inversion * derot_freq)); - stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ + dprintk(state->verbose, FE_DEBUG, 1, "--->TIMING OK ! " + "Derot Freq = %d @ %d", internal->derot_freq, index); + break; } - internal->direction = -internal->direction; /* Change zigzag direction */ - } - - if (internal->status == TIMINGOK) { - stb0899_read_regs(state, STB0899_CFRM, cfr, 2); /* get derotator frequency */ - internal->derot_freq = state->config->inversion * MAKEWORD16(cfr[0], cfr[1]); - dprintk(state->verbose, FE_DEBUG, 1, "--->TIMING OK ! Derot Freq = %d", internal->derot_freq); } return internal->status; @@ -277,50 +296,26 @@ static enum stb0899_status stb0899_check_carrier(struct stb0899_state *state) static enum stb0899_status stb0899_search_carrier(struct stb0899_state *state) { struct stb0899_internal *internal = &state->internal; - - short int derot_freq = 0, last_derot_freq = 0, derot_limit, next_loop = 3; - int index = 0; - u8 cfr[2]; + int index; u8 reg; internal->status = NOCARRIER; - derot_limit = (internal->sub_range / 2L) / internal->mclk; - derot_
Re: [PATCH v3] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend.
Hello I don't know what mailer you're using but your patches to the ML are malformed (word wrapped). Please have a look: http://www.kernel.org/doc/Documentation/email-clients.txt I don't know for sure but you may need to send them again (all those malformed)... regards, -- Mariusz Bialonczyk jabber/e-mail: ma...@skyboo.net http://manio.skyboo.net -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend.
(This patch needs testing and review.) >From 5449f996bb340e4423b3146d1e0172dd635c0398 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Tue, 24 May 2011 21:44:53 +0200 Subject: [PATCH] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend. Signed-off-by: Hans Petter Selasky --- drivers/media/dvb/frontends/stb0899_algo.c | 173 drivers/media/dvb/frontends/stb0899_drv.c |1 - drivers/media/dvb/frontends/stb0899_priv.h |3 - 3 files changed, 75 insertions(+), 102 deletions(-) diff --git a/drivers/media/dvb/frontends/stb0899_algo.c b/drivers/media/dvb/frontends/stb0899_algo.c index d70eee0..9156c3b 100644 --- a/drivers/media/dvb/frontends/stb0899_algo.c +++ b/drivers/media/dvb/frontends/stb0899_algo.c @@ -117,7 +117,7 @@ static u32 stb0899_set_srate(struct stb0899_state *state, u32 master_clk, u32 sr */ static long stb0899_calc_derot_time(long srate) { - if (srate > 0) + if (srate > 999) return (10 / (srate / 1000)); else return 0; @@ -200,6 +200,39 @@ static enum stb0899_status stb0899_check_tmg(struct stb0899_state *state) } /* + * stb0899_set_derot + * set frequency derotor in HZ. + */ +static void +stb0899_set_derot(struct stb0899_state *state, s16 derot) +{ + u8 cfr[2]; + + derot *= state->config->inversion; + + cfr[0] = (u8)(derot >> 8); + cfr[1] = (u8)derot; + + /* set derotator frequency in Hz */ + stb0899_write_regs(state, STB0899_CFRM, cfr, 2); +} + +/* + * stb0899_get_derot + * get frequency derotor in HZ. + */ +static s16 +stb0899_get_derot(struct stb0899_state *state) +{ + u8 cfr[2] = {0, 0}; + + /* get derotator frequency in Hz */ + stb0899_read_regs(state, STB0899_CFRM, cfr, 2); + + return (state->config->inversion * (s16)MAKEWORD16(cfr[0], cfr[1])); +} + +/* * stb0899_search_tmg * perform a fs/2 zig-zag to find timing */ @@ -207,36 +240,22 @@ static enum stb0899_status stb0899_search_tmg(struct stb0899_state *state) { struct stb0899_internal *internal = &state->internal; struct stb0899_params *params = &state->params; - - short int derot_step, derot_freq = 0, derot_limit, next_loop = 3; - int index = 0; - u8 cfr[2]; + int index; internal->status = NOTIMING; - /* timing loop computation & symbol rate optimisation */ - derot_limit = (internal->sub_range / 2L) / internal->mclk; - derot_step = (params->srate / 2L) / internal->mclk; + /* let the hardware figure out derot frequency */ + stb0899_set_derot(state, 0); - while ((stb0899_check_tmg(state) != TIMINGOK) && next_loop) { - index++; - derot_freq += index * internal->direction * derot_step; /* next derot zig zag position */ - - if (abs(derot_freq) > derot_limit) - next_loop--; + for (index = 0; index < 8; index++) { + if (stb0899_check_tmg(state) == TIMINGOK) { + /* get derotator frequency */ + internal->derot_freq = stb0899_get_derot(state); - if (next_loop) { - STB0899_SETFIELD_VAL(CFRM, cfr[0], MSB(state->config->inversion * derot_freq)); - STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(state->config->inversion * derot_freq)); - stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ + dprintk(state->verbose, FE_DEBUG, 1, "--->TIMING OK ! " + "Derot Freq = %d @ %d", internal->derot_freq, index); + break; } - internal->direction = -internal->direction; /* Change zigzag direction */ - } - - if (internal->status == TIMINGOK) { - stb0899_read_regs(state, STB0899_CFRM, cfr, 2); /* get derotator frequency */ - internal->derot_freq = state->config->inversion * MAKEWORD16(cfr[0], cfr[1]); - dprintk(state->verbose, FE_DEBUG, 1, "--->TIMING OK ! Derot Freq = %d", internal->derot_freq); } return internal->status; @@ -277,50 +296,26 @@ static enum stb0899_status stb0899_check_carrier(struct stb0899_state *state) static enum stb0899_status stb0899_search_carrier(struct stb0899_state *state) { struct stb0899_internal *internal = &state->internal; - - short int derot_freq = 0, last_derot_freq = 0, derot_limit, next_loop = 3; - int index = 0; - u8 cfr[2]; + int index; u8 reg; internal->status = NOCARRIER; - derot_limit = (internal->sub_range / 2L) / internal->mclk; - derot_
[PATCH v2] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend
(The initial patch cause too long tune delay on non-present carriers. Use the hardware derot, by writing zero to the derot register.) >From 2b960abaeeaa32f6bcaa350ca80906c467ab9cb1 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Tue, 24 May 2011 21:44:53 +0200 Subject: [PATCH] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend hardware. Signed-off-by: Hans Petter Selasky --- drivers/media/dvb/frontends/stb0899_algo.c | 130 drivers/media/dvb/frontends/stb0899_priv.h |2 - 2 files changed, 36 insertions(+), 96 deletions(-) diff --git a/drivers/media/dvb/frontends/stb0899_algo.c b/drivers/media/dvb/frontends/stb0899_algo.c index d70eee0..0cdaac2 100644 --- a/drivers/media/dvb/frontends/stb0899_algo.c +++ b/drivers/media/dvb/frontends/stb0899_algo.c @@ -117,7 +117,7 @@ static u32 stb0899_set_srate(struct stb0899_state *state, u32 master_clk, u32 sr */ static long stb0899_calc_derot_time(long srate) { - if (srate > 0) + if (srate > 999) return (10 / (srate / 1000)); else return 0; @@ -207,36 +207,23 @@ static enum stb0899_status stb0899_search_tmg(struct stb0899_state *state) { struct stb0899_internal *internal = &state->internal; struct stb0899_params *params = &state->params; - - short int derot_step, derot_freq = 0, derot_limit, next_loop = 3; - int index = 0; - u8 cfr[2]; + int index; + u8 cfr[2] = {0,0}; internal->status = NOTIMING; - /* timing loop computation & symbol rate optimisation */ - derot_limit = (internal->sub_range / 2L) / internal->mclk; - derot_step = (params->srate / 2L) / internal->mclk; - - while ((stb0899_check_tmg(state) != TIMINGOK) && next_loop) { - index++; - derot_freq += index * internal->direction * derot_step; /* next derot zig zag position */ + /* let the hardware figure out derot frequency */ + stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ - if (abs(derot_freq) > derot_limit) - next_loop--; - - if (next_loop) { - STB0899_SETFIELD_VAL(CFRM, cfr[0], MSB(state->config->inversion * derot_freq)); - STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(state->config->inversion * derot_freq)); - stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ + for (index = 0; index < 8; index++) { + if (stb0899_check_tmg(state) == TIMINGOK) { + /* get derotator frequency */ + stb0899_read_regs(state, STB0899_CFRM, cfr, 2); + internal->derot_freq = state->config->inversion * MAKEWORD16(cfr[0], cfr[1]); + dprintk(state->verbose, FE_DEBUG, 1, "--->TIMING OK ! " + "Derot Freq = %d", internal->derot_freq); + break; } - internal->direction = -internal->direction; /* Change zigzag direction */ - } - - if (internal->status == TIMINGOK) { - stb0899_read_regs(state, STB0899_CFRM, cfr, 2); /* get derotator frequency */ - internal->derot_freq = state->config->inversion * MAKEWORD16(cfr[0], cfr[1]); - dprintk(state->verbose, FE_DEBUG, 1, "--->TIMING OK ! Derot Freq = %d", internal->derot_freq); } return internal->status; @@ -277,50 +264,25 @@ static enum stb0899_status stb0899_check_carrier(struct stb0899_state *state) static enum stb0899_status stb0899_search_carrier(struct stb0899_state *state) { struct stb0899_internal *internal = &state->internal; - - short int derot_freq = 0, last_derot_freq = 0, derot_limit, next_loop = 3; - int index = 0; + int index; u8 cfr[2]; u8 reg; internal->status = NOCARRIER; - derot_limit = (internal->sub_range / 2L) / internal->mclk; - derot_freq = internal->derot_freq; reg = stb0899_read_reg(state, STB0899_CFD); STB0899_SETFIELD_VAL(CFD_ON, reg, 1); stb0899_write_reg(state, STB0899_CFD, reg); - do { - dprintk(state->verbose, FE_DEBUG, 1, "Derot Freq=%d, mclk=%d", derot_freq, internal->mclk); - if (stb0899_check_carrier(state) == NOCARRIER) { - index++; - last_derot_freq = derot_freq; - derot_freq += index * internal->direction * internal->derot_step; /* next zig zag derotator position */ - - if(ab
[PATCH] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend hardware.
(This time without any word wrappings) >From 83224b9c4b5402332589139549b387066bff8277 Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Tue, 24 May 2011 21:44:53 +0200 Subject: [PATCH] Fix the derot zig-zag to work with TT-USB2.0 TechnoTrend hardware. Signed-off-by: Hans Petter Selasky --- drivers/media/dvb/frontends/stb0899_algo.c | 113 --- 1 files changed, 50 insertions(+), 63 deletions(-) diff --git a/drivers/media/dvb/frontends/stb0899_algo.c b/drivers/media/dvb/frontends/stb0899_algo.c index d70eee0..1dbd9be 100644 --- a/drivers/media/dvb/frontends/stb0899_algo.c +++ b/drivers/media/dvb/frontends/stb0899_algo.c @@ -23,6 +23,13 @@ #include "stb0899_priv.h" #include "stb0899_reg.h" +#include +#include + +static int derot_max = 8192; +module_param(derot_max, int, 0644); +MODULE_PARM_DESC(derot_max, "Set Maximum Derot Value (0..32767)"); + static inline u32 stb0899_do_div(u64 n, u32 d) { /* wrap do_div() for ease of use */ @@ -117,7 +124,7 @@ static u32 stb0899_set_srate(struct stb0899_state *state, u32 master_clk, u32 sr */ static long stb0899_calc_derot_time(long srate) { - if (srate > 0) + if (srate > 999) return (10 / (srate / 1000)); else return 0; @@ -207,30 +214,22 @@ static enum stb0899_status stb0899_search_tmg(struct stb0899_state *state) { struct stb0899_internal *internal = &state->internal; struct stb0899_params *params = &state->params; - - short int derot_step, derot_freq = 0, derot_limit, next_loop = 3; + int derot_freq = 0; int index = 0; u8 cfr[2]; internal->status = NOTIMING; + internal->direction = 1; - /* timing loop computation & symbol rate optimisation */ - derot_limit = (internal->sub_range / 2L) / internal->mclk; - derot_step = (params->srate / 2L) / internal->mclk; + while ((stb0899_check_tmg(state) != TIMINGOK) && (abs(derot_freq) <= derot_max)) { + derot_freq += index * (index - 1) * internal->direction; /* next derot zig zag position */ - while ((stb0899_check_tmg(state) != TIMINGOK) && next_loop) { - index++; - derot_freq += index * internal->direction * derot_step; /* next derot zig zag position */ + STB0899_SETFIELD_VAL(CFRM, cfr[0], MSB(state->config->inversion * derot_freq)); + STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(state->config->inversion * derot_freq)); + stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ - if (abs(derot_freq) > derot_limit) - next_loop--; - - if (next_loop) { - STB0899_SETFIELD_VAL(CFRM, cfr[0], MSB(state->config->inversion * derot_freq)); - STB0899_SETFIELD_VAL(CFRL, cfr[1], LSB(state->config->inversion * derot_freq)); - stb0899_write_regs(state, STB0899_CFRM, cfr, 2); /* derotator frequency */ - } internal->direction = -internal->direction; /* Change zigzag direction */ + index++; } if (internal->status == TIMINGOK) { @@ -277,50 +276,41 @@ static enum stb0899_status stb0899_check_carrier(struct stb0899_state *state) static enum stb0899_status stb0899_search_carrier(struct stb0899_state *state) { struct stb0899_internal *internal = &state->internal; - - short int derot_freq = 0, last_derot_freq = 0, derot_limit, next_loop = 3; + int derot_freq; int index = 0; u8 cfr[2]; u8 reg; internal->status = NOCARRIER; - derot_limit = (internal->sub_range / 2L) / internal->mclk; + internal->direction = 1; derot_freq = internal->derot_freq; reg = stb0899_read_reg(state, STB0899_CFD); STB0899_SETFIELD_VAL(CFD_ON, reg, 1); stb0899_write_reg(state, STB0899_CFD, reg); - do { + while ((stb0899_check_carrier(state) == NOCARRIER) && (abs(derot_freq) <= derot_max)) { + + derot_freq += index * (index - 1) * internal->direction; /* next derot zig zag position */ + dprintk(state->verbose, FE_DEBUG, 1, "Derot Freq=%d, mclk=%d", derot_freq, internal->mclk); - if (stb0899_check_carrier(state) == NOCARRIER) { - index++; - last_derot_freq = derot_freq; - derot_freq += index * internal->direction * internal->derot_step; /* next zig zag derotator position */ - - if(abs(derot_freq) > derot_limit) - next_loop--; - - if (next_loop)
Re: Genuis Emessenger 310 webcam slow work with pac7302 in 2.6.37.1 kernel
В Сбт, 26/02/2011 в 17:11 +0600, housegregory299 пишет: > Hello! My name is Galym, I'm from Kazakhstan. Sorry for my bad English. > My Genuis E-messenger 310 webcam slow work with pac7302 in 2.6.37.1 > kernel. > I lowered the Exposure value ((to reduce freezes) since my webcam is > running slow, (ie, slow picture) but the picture freezes completely. I > had to return the value. (In the previous kernel 2.6.32 everything was > OK, because there used pac7311). > > My device ID: > Bus 005 Device 002: ID 093a:2624 Pixart Imaging, Inc. Webcam > > My system: Debian Squeeze Stable 64-bit with 2.6.37.1 kernel (kernel > installed from Sid Repository) > > I hope for your help. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Genuis Emessenger 310 webcam slow work with pac7302 in 2.6.37.1 kernel
В Вск, 27/02/2011 в 18:37 +0600, housegregory299 пишет: > > As I understand the webcam was not working properly even using 2.6.32 > > kernel. > > Yes, this is so. But in near installed Windows 7 webcam also work slow > and picture quality is worse than on Debian with 2.6.37. I think my > webcam very limited functionality. I have to keep both the kernels on my > system - 2.6.32 and 2.6.37 and switch between them on the need. > > > Are you using v4l2ucp for setting exposure value? This command is > > available > > from the v4l2ucp Debian package. Are the other controls working > > properly? > > I use v4l2ucp from command line to saving and loading webcam's > customised parameters, (v4l2ucp -s .webcam and v4l2ucp -l .webcam) > but with other keys are not used. All parameters in Guvcview work fine > and properly, except Exposure. > > > Some more hints for the trying the "test images": make sure that > > v4l-utils > > Debian package is installed ("apt-get install v4l-utils" as root). > > Then > > you can use the command "v4l2-dbg --set-register=0x72 x" where "x" is > > any > > number between 0 and 15. This command has to be executed as root. To > > return > > to the normal operation just use the zero value for x. I'm not sure > > that > > these test patterns will work for your webcam model also, but it would > > be > > interesting to try. > > command "v4l2-dbg --set-register=0x72 10 not help to me: With value 0 > output are similar: > > root@debian:/home/t800# v4l2-dbg --set-register=0x72 10 > Failed to set register 0x0072 value 0xa: Invalid argument > > But i try setup my webcam with v4l-utils. > > > The main problem is that the manufacturer of the chip which is > > included > > in your webcam neither released programming documentation nor > > implemented > > a standard protocol like USB Video Class. Without documentation open > > source > > projects can only use trial and error > > ( http://en.wikipedia.org/wiki/Trial_and_error ). > > I understand, OK. So.. Which webcam is better suited for Linux systems - > UVC standard ? This is open? or closed? Sorry, if this question is wrong > - i don't know which webcam select for my Linux-system. > > > I would strongly recommend to add the mailing list > > "linux-media@vger.kernel.org" > > in CC field, so more people can see this conversation. > > OK. I do it -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Genuis Emessenger 310 webcam slow work with pac7302 in 2.6.37.1 kernel
В Вск, 27/02/2011 в 05:26 +0600, housegregory299 пишет: > Hello! Thanks for answer to me. > Outputs from these commands: > > root@debian:/home/t800# cat /proc/version > Linux version 2.6.37-1-amd64 (Debian 2.6.37-1) (b...@decadent.org.uk) > (gcc version 4.4.5 (Debian 4.4.5-10) ) #1 SMP Tue Feb 15 17:43:38 UTC > 2011 > > dpkg -l libv4l-0 : > ii libv4l-0 0.8.0-1Collection of video4linux support > libraries > > root@debian:/home/t800# dpkg -l |grep linux-image > ii linux-image-2.6-amd64 2.6.32+29 > Linux 2.6 for 64-bit PCs (meta-package) > ii linux-image-2.6.32-5-amd642.6.32-30 > Linux 2.6.32 for 64-bit PCs > ii linux-image-2.6.37-1-amd642.6.37-1 > Linux 2.6.37 for 64-bit PCs > > dmesg output: No Errors > [5.497771] gspca: v2.10.0 registered > [5.575635] gspca: probing 093a:2624 > [5.579935] input: pac7302 > as /devices/pci:00/:00:1d.3/usb5/5-2/input/input6 > [5.580056] gspca: video0 created > [5.580084] usbcore: registered new interface driver pac7302 > [5.658209] usbcore: registered new interface driver snd-usb-audio > > Frame rate not depend on the content of image, but in 2.6.32 kernel is > depend on Exposure, i set up the webcam through the program guvcview, > (in 2.6.32) and lowered Exposure value to 0% and freezes disappeared, > and will be OK. But the colors were a bit distorted and blurred. > In the 2.6.37.1 (Installed from Sid Repository) colors are better on > image, but I can not lower the value Exposure to reduce freezes, but > increase this value is impossible without freezes or slow frame rate. > > Therefore, I usually lower them parameter to configure. Earlier this > helps. But not with the new kernel. I also tried ubuntu 10.10 with > 2.6.35.xx stock kernel and freezes there be similar. > Webcam's image normally visible in Cheese, skype and Kopete. > Thank you for tips, > I'll definitely try them. It is a pity that it happened, in the new > kernel has many improvements to my PC > > My PC's quick specs: > Gigabyte G31M-ES2L Motherboard > CPU: Intel Dualcore 2.93 GHz > 4 GB Ram > Realtek HD alc883 audio integrated > GPU: ATI Radeon HD 4650 (1024 mb) GDDR2 PC-e x16 by Gigabyte > > In Debian/Ubuntu distros all devices work fine - without any problem > except webcam. > > Translating partially done by Google Translator and > > I'll understand a little English =) > > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/8] Make both analog and digital modes work with Kworld SBTVD
This patch fixes saa7134 driver to allow both analog and digital modes to work. While here, I fixed some issues I saw at tda8290 driver and on mb82a20s. The biggest issue I found is a a hard to track bug between tda829x/tda18271/saa7134. This series adds a workaround for it, but we'll need to do some fix at the code, for it to work better. The issue is that tda829x wants to go to analog mode during DVB initialization, causing some I2C errors. The analog failure doesn't cause any harm, as the device were already properly initialized in analog mode. However, the failure at the digital mode causes the frontend mb86a20s to not initialize. Fortunately, at least on my tests, it was possible to detect that the device is a mb86a20s before the failure. What happens is that tda8290 is a very bad boy: during DVB setup, it keeps insisting to call tda18271 analog_set_params, that calls tune_agc code. The tune_agc code calls saa7134 driver, changing the value of GPIO 27, switching from digital to analog mode and disabling the access to mb86a20s, as, on Kworld SBTVD, the same GPIO used to switch the hardware AGC mode seems to be used to enable the I2C switch that allows access to the frontend (mb86a20s). So, a call to analog_set_params ultimately disables the access to the frontend, and causes a failure at the init frontend logic. This patch is a workaround for this issue: it simply checks if the frontend init had any failure. If so, it will init the frontend when some DTV application will try to set DVB mode. Patches that teach good behaviors to tda8290 are welcome, as this guy should not interrrupt somebody's else talk. Mauro Carvalho Chehab (8): [media] tda8290: Make all read operations atomic [media] tda8290: Fix a bug if no tuner is detected [media] tda8290: Turn tda829x on before touching at the I2C gate [media] mb86a20s: Fix i2c read/write error messages [media] mb86a20s: Be sure that device is initialized before starting DVB [media] saa7134: Fix analog mode for Kworld SBTVD [media] saa7134: Fix digital mode on Kworld SBTVD [media] saa7134: Kworld SBTVD: make both analog and digital to work drivers/media/common/tuners/tda8290.c | 130 +++ drivers/media/dvb/frontends/mb86a20s.c | 36 ++-- drivers/media/video/saa7134/saa7134-cards.c | 51 +++ drivers/media/video/saa7134/saa7134-dvb.c | 80 - 4 files changed, 152 insertions(+), 145 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[regression] DVB cards doesn't work with 2.6.37/ current git
I tried two things: 1.) compile media_build.git for my 2.6.32 Ubuntu Kernel. It compiles, driver loads without errors. [ 8.500109] DVB: registering adapter 0 frontend 0 (Philips TDA10023 DVB-C)... [ 8.981263] DVB: registering adapter 1 frontend 0 (Philips TDA10021 DVB-C)... But when I start vdr none of my DVB cards (Cinergy 1200C and Technotrend 1500C) is working. After some time vdr has 100% CPU load. 2.) install a complete 2.6.37 Ubuntu Kernel. Same result as above An Ubuntu 2.6.36-Kernel is working. ??? -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Any remotes that work with the pcHDTV HD5500?
Greetings: The pcHDTV HD5500 ships with an IR receiver but no remote. Support seems to be there: input: cx88 IR (pcHDTV HD5500 HDTV) as /devices/pci:00/:00:06.0/:01:07.1/input/input6 Does anyone know of a remote that actually works with it? I have read that it is supposed to be a "Phillips/Magnavox" type, so I tried setting several programmable remotes to the codes for Phillips and Magnavox TVs, but nothing has worked so far. Thanks, -- Mark -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Mosaico ITV 300 not work with GNU/Linux
Hi, people. My 1st post is on Mosaico ITV 300' suport into Linux. Dmesg display that the chipset card's is detected (SAA7130), but properly no. You see these messages: http://www.lindrix.xpg.com.br/log_saa7130_description.txt Excuse me, they are many messages... The Mosaico's home page was: http://www.mosaico.com.tw But it is out. Images: http://www.multimidia.inf.br/media/catalog/product/cache/1/small_image/135x135/5e06319eda06f020e43594a9c230972d/i/m/image_5131_99.jpg Thanks to all. Humberto, Brazilian. -- José Humberto da Silva Soares Licenciado em Computação - UEPB; Técnico em Informática. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
knc1 dvb-c plus doesn't work with kenrel 2.6.31
Hello list, The mentioned card doesnÄ't work any more. I am running an opensuse 2.6.31 kernel. It sems that no frontend can be loaded. I am getting also many cam inserted or cam ejected messages. dmesg contains this message: [ 1067.280898] budget-av: A frontend driver was not found for device [1131:7146] subsystem [1894:0021] lspci -vvv 01:05.0 Multimedia controller: Philips Semiconductors SAA7146 (rev 01) Subsystem: KNC One Device 0021 Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- S Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- http://vger.kernel.org/majordomo-info.html