[experimental:tvp5150-5 135/138] drivers/media/i2c/tvp5150.c:1018:10: error: implicit declaration of function 'v4l2_subdev_get_try_crop'
tree: git://linuxtv.org/mchehab/experimental tvp5150-5 head: c223c451df23ac71a844d05aab65ede057b70eb0 commit: bc93ce496fa909d8fa9496c93d36e9ea413a9065 [135/138] tvp5150: add FORMAT_TRY support for get/set selection handlers config: i386-randconfig-s0-09171149 (attached as .config) compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026 reproduce: git checkout bc93ce496fa909d8fa9496c93d36e9ea413a9065 # save the attached .config to linux build tree make ARCH=i386 All error/warnings (new ones prefixed by >>): drivers/media/i2c/tvp5150.c:72:32: error: 'TVP5150_NUM_PADS' undeclared here (not in a function) struct device_node *endpoints[TVP5150_NUM_PADS + 1]; ^~~~ drivers/media/i2c/tvp5150.c: In function '__tvp5150_get_pad_crop': >> drivers/media/i2c/tvp5150.c:1018:10: error: implicit declaration of function >> 'v4l2_subdev_get_try_crop' [-Werror=implicit-function-declaration] return v4l2_subdev_get_try_crop(&decoder->sd, cfg, pad); ^~~~ >> drivers/media/i2c/tvp5150.c:1018:10: warning: return makes pointer from >> integer without a cast [-Wint-conversion] return v4l2_subdev_get_try_crop(&decoder->sd, cfg, pad); ^~~~ drivers/media/i2c/tvp5150.c: In function 'tvp5150_fill_fmt': drivers/media/i2c/tvp5150.c:1034:33: error: 'TVP5150_PAD_VID_OUT' undeclared (first use in this function) if (!format || (format->pad != TVP5150_PAD_VID_OUT)) ^~~ drivers/media/i2c/tvp5150.c:1034:33: note: each undeclared identifier is reported only once for each function it appears in drivers/media/i2c/tvp5150.c: In function 'tvp5150_mc_init': drivers/media/i2c/tvp5150.c:1881:9: error: 'ret' undeclared (first use in this function) return ret; ^~~ drivers/media/i2c/tvp5150.c:1880:1: warning: label 'out' defined but not used [-Wunused-label] out: ^~~ drivers/media/i2c/tvp5150.c: In function 'tvp5150_of_valid_input': drivers/media/i2c/tvp5150.c:1893:7: error: 'TVP5150_PAD_AIP1A' undeclared (first use in this function) case TVP5150_PAD_AIP1A: ^ drivers/media/i2c/tvp5150.c:1901:7: error: 'TVP5150_PAD_AIP1B' undeclared (first use in this function) case TVP5150_PAD_AIP1B: ^ drivers/media/i2c/tvp5150.c: In function 'tvp5150_parse_dt': drivers/media/i2c/tvp5150.c:1945:8: error: 'TVP5150_PAD_AIP1A' undeclared (first use in this function) case TVP5150_PAD_AIP1A: ^ drivers/media/i2c/tvp5150.c:1946:8: error: 'TVP5150_PAD_AIP1B' undeclared (first use in this function) case TVP5150_PAD_AIP1B: ^ drivers/media/i2c/tvp5150.c:1956:8: error: 'TVP5150_PAD_VID_OUT' undeclared (first use in this function) case TVP5150_PAD_VID_OUT: ^~~ drivers/media/i2c/tvp5150.c:1988:9: error: 'struct tvp5150' has no member named 'connectors_num' decoder->connectors_num = in; ^~ drivers/media/i2c/tvp5150.c: In function 'tvp5150_mc_init': drivers/media/i2c/tvp5150.c:1882:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors vim +/v4l2_subdev_get_try_crop +1018 drivers/media/i2c/tvp5150.c 1010 1011 static struct v4l2_rect * 1012 __tvp5150_get_pad_crop(struct tvp5150 *decoder, 1013 struct v4l2_subdev_pad_config *cfg, unsigned int pad, 1014 enum v4l2_subdev_format_whence which) 1015 { 1016 switch (which) { 1017 case V4L2_SUBDEV_FORMAT_TRY: > 1018 return v4l2_subdev_get_try_crop(&decoder->sd, cfg, pad); 1019 case V4L2_SUBDEV_FORMAT_ACTIVE: 1020 return &decoder->rect; 1021 default: 1022 return NULL; 1023 } 1024 } 1025 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip
Wohltätigkeitsspende in Höhe von € 2.000.000,00
Lieber Freund, Ich bin Herr Tayeb Souami, New Jersey, Vereinigte Staaten von Amerika, der Mega-Gewinner von $ 315million In Mega Millions Jackpot, spende ich an 5 zufällige Personen, wenn Sie diese E-Mail erhalten, dann wurde Ihre E-Mail nach einem Spinball ausgewählt.Ich habe den größten Teil meines Vermögens auf eine Reihe von Wohltätigkeitsorganisationen und Organisationen verteilt.Ich habe mich freiwillig dazu entschieden, die Summe von € 2.000.000,00 an Sie als eine der ausgewählten 5 zu spenden, um meine Gewinne zu überprüfen, sehen Sie bitte meine You Tube Seite unten. UHR MICH HIER: https://www.youtube.com/watch?v=Z6ui8ZDQ6Ks Das ist dein Spendencode: [DFC530342018] Antworten Sie mit dem SPENDE-CODE an diese E-Mail: financialfundingcompan...@gmail.com Ich hoffe, Sie und Ihre Familie glücklich zu machen. Grüße Herr Tayeb Souami
Re: [PATCH 4/5] media: video-i2c: support changing frame interval
On Mon, Sep 17, 2018 at 6:03 PM Akinobu Mita wrote: > > AMG88xx has a register for setting frame rate 1 or 10 FPS. > This adds support changing frame interval. > > Reference specifications: > https://docid81hrs3j1.cloudfront.net/medialibrary/2017/11/PANA-S-A0002141979-1.pdf > > Cc: Matt Ranostay > Cc: Sakari Ailus > Cc: Hans Verkuil > Cc: Mauro Carvalho Chehab > Signed-off-by: Akinobu Mita Acked-by: Matt Ranostay > --- > drivers/media/i2c/video-i2c.c | 76 > --- > 1 file changed, 64 insertions(+), 12 deletions(-) > > diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c > index 90d389b..916f36e 100644 > --- a/drivers/media/i2c/video-i2c.c > +++ b/drivers/media/i2c/video-i2c.c > @@ -52,6 +52,8 @@ struct video_i2c_data { > > struct task_struct *kthread_vid_cap; > struct list_head vid_cap_active; > + > + struct v4l2_fract frame_interval; > }; > > static const struct v4l2_fmtdesc amg88xx_format = { > @@ -74,8 +76,9 @@ struct video_i2c_chip { > const struct v4l2_fmtdesc *format; > const struct v4l2_frmsize_discrete *size; > > - /* max frames per second */ > - unsigned int max_fps; > + /* available frame intervals */ > + const struct v4l2_fract *frame_intervals; > + unsigned int num_frame_intervals; > > /* pixel buffer size */ > unsigned int buffer_size; > @@ -85,6 +88,9 @@ struct video_i2c_chip { > > const struct regmap_config *regmap_config; > > + /* setup function */ > + int (*setup)(struct video_i2c_data *data); > + > /* xfer function */ > int (*xfer)(struct video_i2c_data *data, char *buf); > > @@ -98,6 +104,22 @@ static int amg88xx_xfer(struct video_i2c_data *data, char > *buf) > data->chip->buffer_size); > } > > +#define AMG88XX_REG_FPSC 0x02 > +#define AMG88XX_FPSC_1FPS BIT(0) > + > +static int amg88xx_setup(struct video_i2c_data *data) > +{ > + unsigned int mask = AMG88XX_FPSC_1FPS; > + unsigned int val; > + > + if (data->frame_interval.numerator == > data->frame_interval.denominator) > + val = mask; > + else > + val = 0; > + > + return regmap_update_bits(data->regmap, AMG88XX_REG_FPSC, mask, val); > +} > + > #if IS_ENABLED(CONFIG_HWMON) > > static const u32 amg88xx_temp_config[] = { > @@ -172,14 +194,21 @@ static int amg88xx_hwmon_init(struct video_i2c_data > *data) > > #define AMG88XX0 > > +static const struct v4l2_fract amg88xx_frame_intervals[] = { > + { 1, 10 }, > + { 1, 1 }, > +}; > + > static const struct video_i2c_chip video_i2c_chip[] = { > [AMG88XX] = { > .size = &amg88xx_size, > .format = &amg88xx_format, > - .max_fps= 10, > + .frame_intervals= amg88xx_frame_intervals, > + .num_frame_intervals= ARRAY_SIZE(amg88xx_frame_intervals), > .buffer_size= 128, > .bpp= 16, > .regmap_config = &amg88xx_regmap_config, > + .setup = &amg88xx_setup, > .xfer = &amg88xx_xfer, > .hwmon_init = amg88xx_hwmon_init, > }, > @@ -244,7 +273,8 @@ static void buffer_queue(struct vb2_buffer *vb) > static int video_i2c_thread_vid_cap(void *priv) > { > struct video_i2c_data *data = priv; > - unsigned int delay = msecs_to_jiffies(1000 / data->chip->max_fps); > + unsigned int delay = mult_frac(HZ, data->frame_interval.numerator, > + data->frame_interval.denominator); > > set_freezable(); > > @@ -306,19 +336,26 @@ static void video_i2c_del_list(struct vb2_queue *vq, > enum vb2_buffer_state state > static int start_streaming(struct vb2_queue *vq, unsigned int count) > { > struct video_i2c_data *data = vb2_get_drv_priv(vq); > + int ret; > > if (data->kthread_vid_cap) > return 0; > > + ret = data->chip->setup(data); > + if (ret) > + goto error_del_list; > + > data->sequence = 0; > data->kthread_vid_cap = kthread_run(video_i2c_thread_vid_cap, data, > "%s-vid-cap", > data->v4l2_dev.name); > - if (!IS_ERR(data->kthread_vid_cap)) > + ret = PTR_ERR_OR_ZERO(data->kthread_vid_cap); > + if (!ret) > return 0; > > +error_del_list: > video_i2c_del_list(vq, VB2_BUF_STATE_QUEUED); > > - return PTR_ERR(data->kthread_vid_cap); > + return ret; > } > > static void stop_streaming(struct vb2_queue *vq) > @@ -425,15 +462,14 @@ static int video_i2c_enum_frameintervals(struct file > *file, void *priv, > const struct video_i2c_data *data = video_drvdata(file); > const struct v4l2_frmsize_dis
Re: [PATCH 5/5] media: video-i2c: support runtime PM
On Mon, Sep 17, 2018 at 6:03 PM Akinobu Mita wrote: > > AMG88xx has a register for setting operating mode. This adds support > runtime PM by changing the operating mode. > > The instruction for changing sleep mode to normal mode is from the > reference specifications. > > https://docid81hrs3j1.cloudfront.net/medialibrary/2017/11/PANA-S-A0002141979-1.pdf > > Cc: Matt Ranostay > Cc: Sakari Ailus > Cc: Hans Verkuil > Cc: Mauro Carvalho Chehab > Signed-off-by: Akinobu Mita > --- > drivers/media/i2c/video-i2c.c | 140 > +- > 1 file changed, 138 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c > index 916f36e..93822f4 100644 > --- a/drivers/media/i2c/video-i2c.c > +++ b/drivers/media/i2c/video-i2c.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -94,6 +95,9 @@ struct video_i2c_chip { > /* xfer function */ > int (*xfer)(struct video_i2c_data *data, char *buf); > > + /* power control function */ > + int (*set_power)(struct video_i2c_data *data, bool on); > + > /* hwmon init function */ > int (*hwmon_init)(struct video_i2c_data *data); > }; > @@ -104,6 +108,14 @@ static int amg88xx_xfer(struct video_i2c_data *data, > char *buf) > data->chip->buffer_size); > } > > +#define AMG88XX_REG_PCTL 0x00 > +#define AMG88XX_PCTL_NORMAL0x00 > +#define AMG88XX_PCTL_SLEEP 0x10 > + > +#define AMG88XX_REG_RST0x01 > +#define AMG88XX_RST_FLAG 0x30 > +#define AMG88XX_RST_INIT 0x3f > + > #define AMG88XX_REG_FPSC 0x02 > #define AMG88XX_FPSC_1FPS BIT(0) > > @@ -120,6 +132,59 @@ static int amg88xx_setup(struct video_i2c_data *data) > return regmap_update_bits(data->regmap, AMG88XX_REG_FPSC, mask, val); > } > > +static int amg88xx_set_power_on(struct video_i2c_data *data) > +{ > + int ret; > + > + ret = regmap_write(data->regmap, AMG88XX_REG_PCTL, > AMG88XX_PCTL_NORMAL); > + if (ret) > + return ret; > + > + msleep(50); > + > + ret = regmap_write(data->regmap, AMG88XX_REG_RST, AMG88XX_RST_INIT); > + if (ret) > + return ret; > + > + msleep(2); > + > + ret = regmap_write(data->regmap, AMG88XX_REG_RST, AMG88XX_RST_FLAG); > + if (ret) > + return ret; > + > + /* > +* Wait two frames before reading thermistor and temperature registers > +*/ > + msleep(200); > + > + return 0; > +} > + > +static int amg88xx_set_power_off(struct video_i2c_data *data) > +{ > + int ret; > + > + ret = regmap_write(data->regmap, AMG88XX_REG_PCTL, > AMG88XX_PCTL_SLEEP); > + if (ret) > + return ret; > + /* > +* Wait for a while to avoid resuming normal mode immediately after > +* entering sleep mode, otherwise the device occasionally goes wrong > +* (thermistor and temperature registers are not updated at all) > +*/ > + msleep(100); > + > + return 0; > +} > + > +static int amg88xx_set_power(struct video_i2c_data *data, bool on) > +{ > + if (on) > + return amg88xx_set_power_on(data); > + > + return amg88xx_set_power_off(data); > +} > + > #if IS_ENABLED(CONFIG_HWMON) > > static const u32 amg88xx_temp_config[] = { > @@ -151,7 +216,15 @@ static int amg88xx_read(struct device *dev, enum > hwmon_sensor_types type, > __le16 buf; > int tmp; > > + tmp = pm_runtime_get_sync(regmap_get_device(data->regmap)); > + if (tmp < 0) { > + pm_runtime_put_noidle(regmap_get_device(data->regmap)); > + return tmp; > + } > + > tmp = regmap_bulk_read(data->regmap, 0x0e, &buf, 2); > + pm_runtime_mark_last_busy(regmap_get_device(data->regmap)); > + pm_runtime_put_autosuspend(regmap_get_device(data->regmap)); > if (tmp) > return tmp; > > @@ -210,6 +283,7 @@ static const struct video_i2c_chip video_i2c_chip[] = { > .regmap_config = &amg88xx_regmap_config, > .setup = &amg88xx_setup, > .xfer = &amg88xx_xfer, > + .set_power = amg88xx_set_power, > .hwmon_init = amg88xx_hwmon_init, > }, > }; > @@ -336,14 +410,21 @@ static void video_i2c_del_list(struct vb2_queue *vq, > enum vb2_buffer_state state > static int start_streaming(struct vb2_queue *vq, unsigned int count) > { > struct video_i2c_data *data = vb2_get_drv_priv(vq); > + struct device *dev = regmap_get_device(data->regmap); > int ret; > > if (data->kthread_vid_cap) > return 0; > > + ret = pm_runtime_get_sync(dev); > + if (ret < 0) { > + pm_run
[experimental:tvp5150-5 131/138] drivers/media/i2c/tvp5150.c:71:32: error: 'TVP5150_NUM_PADS' undeclared here (not in a function)
tree: git://linuxtv.org/mchehab/experimental tvp5150-5 head: c223c451df23ac71a844d05aab65ede057b70eb0 commit: 71c04fa3b90605e64a5bf2ea9b686c2d64f0066b [131/138] tvp5150: add input source selection of_graph support config: i386-randconfig-s0-09171149 (attached as .config) compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026 reproduce: git checkout 71c04fa3b90605e64a5bf2ea9b686c2d64f0066b # save the attached .config to linux build tree make ARCH=i386 All error/warnings (new ones prefixed by >>): >> drivers/media/i2c/tvp5150.c:71:32: error: 'TVP5150_NUM_PADS' undeclared here >> (not in a function) struct device_node *endpoints[TVP5150_NUM_PADS + 1]; ^~~~ drivers/media/i2c/tvp5150.c: In function 'tvp5150_fill_fmt': >> drivers/media/i2c/tvp5150.c:1017:33: error: 'TVP5150_PAD_VID_OUT' undeclared >> (first use in this function) if (!format || (format->pad != TVP5150_PAD_VID_OUT)) ^~~ drivers/media/i2c/tvp5150.c:1017:33: note: each undeclared identifier is reported only once for each function it appears in drivers/media/i2c/tvp5150.c: In function 'tvp5150_mc_init': >> drivers/media/i2c/tvp5150.c:1840:9: error: 'ret' undeclared (first use in >> this function) return ret; ^~~ drivers/media/i2c/tvp5150.c:1839:1: warning: label 'out' defined but not used [-Wunused-label] out: ^~~ drivers/media/i2c/tvp5150.c: In function 'tvp5150_of_valid_input': >> drivers/media/i2c/tvp5150.c:1852:7: error: 'TVP5150_PAD_AIP1A' undeclared >> (first use in this function) case TVP5150_PAD_AIP1A: ^ >> drivers/media/i2c/tvp5150.c:1860:7: error: 'TVP5150_PAD_AIP1B' undeclared >> (first use in this function) case TVP5150_PAD_AIP1B: ^ drivers/media/i2c/tvp5150.c: In function 'tvp5150_parse_dt': drivers/media/i2c/tvp5150.c:1904:8: error: 'TVP5150_PAD_AIP1A' undeclared (first use in this function) case TVP5150_PAD_AIP1A: ^ drivers/media/i2c/tvp5150.c:1905:8: error: 'TVP5150_PAD_AIP1B' undeclared (first use in this function) case TVP5150_PAD_AIP1B: ^ drivers/media/i2c/tvp5150.c:1915:8: error: 'TVP5150_PAD_VID_OUT' undeclared (first use in this function) case TVP5150_PAD_VID_OUT: ^~~ >> drivers/media/i2c/tvp5150.c:1947:9: error: 'struct tvp5150' has no member >> named 'connectors_num' decoder->connectors_num = in; ^~ drivers/media/i2c/tvp5150.c: In function 'tvp5150_mc_init': >> drivers/media/i2c/tvp5150.c:1841:1: warning: control reaches end of non-void >> function [-Wreturn-type] } ^ vim +/TVP5150_NUM_PADS +71 drivers/media/i2c/tvp5150.c 67 68 struct tvp5150 { 69 struct v4l2_subdev sd; 70 /* additional additional endpoint for the svideo connector */ > 71 struct device_node *endpoints[TVP5150_NUM_PADS + 1]; 72 unsigned int endpoints_num; 73 #if defined(CONFIG_MEDIA_CONTROLLER) 74 struct media_pad pads[TVP5150_NUM_PADS]; 75 int pads_state[TVP5150_NUM_PADS]; 76 struct tvp5150_connector *connectors; 77 int connectors_num; 78 bool modify_second_link; 79 #endif 80 struct v4l2_ctrl_handler hdl; 81 struct v4l2_rect rect; 82 struct regmap *regmap; 83 int irq; 84 85 v4l2_std_id norm; /* Current set standard */ 86 v4l2_std_id detected_norm; 87 u32 input; 88 u32 output; 89 u32 oe; 90 int enable; 91 bool lock; 92 93 u16 dev_id; 94 u16 rom_ver; 95 96 enum v4l2_mbus_type mbus_type; 97 }; 98 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip
cron job: media_tree daily build: OK
This message is generated daily by a cron job that builds media_tree for the kernels and architectures in the list below. Results of the daily build of media_tree: date: Tue Sep 18 04:00:17 CEST 2018 media-tree git hash:985cdcb08a0488558d1005139596b64d73bee267 media_build git hash: 44385b9c61ecc27059a651885895c8ea09cd4179 v4l-utils git hash: dea954e56e3d0886d7e679ff08e3535b73f3617c edid-decode git hash: 5eeb151a748788666534d6ea3da07f90400d24c2 gcc version:i686-linux-gcc (GCC) 8.2.0 sparse version: 0.5.2 smatch version: 0.5.1 host hardware: x86_64 host os:4.17.0-3-amd64 linux-git-arm-at91: OK linux-git-arm-davinci: OK linux-git-arm-multi: OK linux-git-arm-pxa: OK linux-git-arm-stm32: OK linux-git-arm64: OK linux-git-i686: OK linux-git-mips: OK linux-git-powerpc64: OK linux-git-sh: OK linux-git-x86_64: OK Check COMPILE_TEST: OK linux-3.0.101-i686: OK linux-3.0.101-x86_64: OK linux-3.1.10-i686: OK linux-3.1.10-x86_64: OK linux-3.2.102-i686: OK linux-3.2.102-x86_64: OK linux-3.3.8-i686: OK linux-3.3.8-x86_64: OK linux-3.4.113-i686: OK linux-3.4.113-x86_64: OK linux-3.5.7-i686: OK linux-3.5.7-x86_64: OK linux-3.6.11-i686: OK linux-3.6.11-x86_64: OK linux-3.7.10-i686: OK linux-3.7.10-x86_64: OK linux-3.8.13-i686: OK linux-3.8.13-x86_64: OK linux-3.9.11-i686: OK linux-3.9.11-x86_64: OK linux-3.10.108-i686: OK linux-3.10.108-x86_64: OK linux-3.11.10-i686: OK linux-3.11.10-x86_64: OK linux-3.12.74-i686: OK linux-3.12.74-x86_64: OK linux-3.13.11-i686: OK linux-3.13.11-x86_64: OK linux-3.14.79-i686: OK linux-3.14.79-x86_64: OK linux-3.15.10-i686: OK linux-3.15.10-x86_64: OK linux-3.16.57-i686: OK linux-3.16.57-x86_64: OK linux-3.17.8-i686: OK linux-3.17.8-x86_64: OK linux-3.18.119-i686: OK linux-3.18.119-x86_64: OK linux-3.19.8-i686: OK linux-3.19.8-x86_64: OK linux-4.0.9-i686: OK linux-4.0.9-x86_64: OK linux-4.1.52-i686: OK linux-4.1.52-x86_64: OK linux-4.2.8-i686: OK linux-4.2.8-x86_64: OK linux-4.3.6-i686: OK linux-4.3.6-x86_64: OK linux-4.4.152-i686: OK linux-4.4.152-x86_64: OK linux-4.5.7-i686: OK linux-4.5.7-x86_64: OK linux-4.6.7-i686: OK linux-4.6.7-x86_64: OK linux-4.7.10-i686: OK linux-4.7.10-x86_64: OK linux-4.8.17-i686: OK linux-4.8.17-x86_64: OK linux-4.9.124-i686: OK linux-4.9.124-x86_64: OK linux-4.10.17-i686: OK linux-4.10.17-x86_64: OK linux-4.11.12-i686: OK linux-4.11.12-x86_64: OK linux-4.12.14-i686: OK linux-4.12.14-x86_64: OK linux-4.13.16-i686: OK linux-4.13.16-x86_64: OK linux-4.14.67-i686: OK linux-4.14.67-x86_64: OK linux-4.15.18-i686: OK linux-4.15.18-x86_64: OK linux-4.16.18-i686: OK linux-4.16.18-x86_64: OK linux-4.17.19-i686: OK linux-4.17.19-x86_64: OK linux-4.18.5-i686: OK linux-4.18.5-x86_64: OK linux-4.19-rc1-i686: OK linux-4.19-rc1-x86_64: OK apps: OK spec-git: OK sparse: WARNINGS Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Tuesday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Tuesday.tar.bz2 The Media Infrastructure API from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/index.html
Re: [PATCH 2/5] media: video-i2c: use i2c regmap
On Mon, Sep 17, 2018 at 9:03 AM Akinobu Mita wrote: > > Use regmap for i2c register access. This simplifies register accesses and > chooses suitable access commands based on the functionality that the > adapter supports. > > Cc: Matt Ranostay > Cc: Sakari Ailus > Cc: Hans Verkuil > Cc: Mauro Carvalho Chehab > Signed-off-by: Akinobu Mita > --- > drivers/media/i2c/video-i2c.c | 54 > ++- > 1 file changed, 28 insertions(+), 26 deletions(-) > > diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c > index b7a2af9..90d389b 100644 > --- a/drivers/media/i2c/video-i2c.c > +++ b/drivers/media/i2c/video-i2c.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -38,7 +39,7 @@ struct video_i2c_buffer { > }; > > struct video_i2c_data { > - struct i2c_client *client; > + struct regmap *regmap; > const struct video_i2c_chip *chip; > struct mutex lock; > spinlock_t slock; > @@ -62,6 +63,12 @@ static const struct v4l2_frmsize_discrete amg88xx_size = { > .height = 8, > }; > > +static const struct regmap_config amg88xx_regmap_config = { > + .reg_bits = 8, > + .val_bits = 8, > + .max_register = 0xff > +}; > + > struct video_i2c_chip { > /* video dimensions */ > const struct v4l2_fmtdesc *format; > @@ -76,6 +83,8 @@ struct video_i2c_chip { > /* pixel size in bits */ > unsigned int bpp; > > + const struct regmap_config *regmap_config; > + > /* xfer function */ > int (*xfer)(struct video_i2c_data *data, char *buf); > > @@ -85,24 +94,8 @@ struct video_i2c_chip { > > static int amg88xx_xfer(struct video_i2c_data *data, char *buf) > { > - struct i2c_client *client = data->client; > - struct i2c_msg msg[2]; > - u8 reg = 0x80; > - int ret; > - > - msg[0].addr = client->addr; > - msg[0].flags = 0; > - msg[0].len = 1; > - msg[0].buf = (char *)® > - > - msg[1].addr = client->addr; > - msg[1].flags = I2C_M_RD; > - msg[1].len = data->chip->buffer_size; > - msg[1].buf = (char *)buf; > - > - ret = i2c_transfer(client->adapter, msg, 2); > - > - return (ret == 2) ? 0 : -EIO; > + return regmap_bulk_read(data->regmap, 0x80, buf, > + data->chip->buffer_size); May as well make 0x80 into a AMG88XX_REG_* define as in the later patch in this series > } > > #if IS_ENABLED(CONFIG_HWMON) > @@ -133,12 +126,15 @@ static int amg88xx_read(struct device *dev, enum > hwmon_sensor_types type, > u32 attr, int channel, long *val) > { > struct video_i2c_data *data = dev_get_drvdata(dev); > - struct i2c_client *client = data->client; > - int tmp = i2c_smbus_read_word_data(client, 0x0e); > + __le16 buf; > + int tmp; > > - if (tmp < 0) > + tmp = regmap_bulk_read(data->regmap, 0x0e, &buf, 2); Same with 0x0e - Matt > + if (tmp) > return tmp; > > + tmp = le16_to_cpu(buf); > + > /* > * Check for sign bit, this isn't a two's complement value but an > * absolute temperature that needs to be inverted in the case of being > @@ -164,8 +160,9 @@ static const struct hwmon_chip_info amg88xx_chip_info = { > > static int amg88xx_hwmon_init(struct video_i2c_data *data) > { > - void *hwmon = devm_hwmon_device_register_with_info(&data->client->dev, > - "amg88xx", data, &amg88xx_chip_info, NULL); > + struct device *dev = regmap_get_device(data->regmap); > + void *hwmon = devm_hwmon_device_register_with_info(dev, "amg88xx", > data, > + &amg88xx_chip_info, NULL); > > return PTR_ERR_OR_ZERO(hwmon); > } > @@ -182,6 +179,7 @@ static const struct video_i2c_chip video_i2c_chip[] = { > .max_fps= 10, > .buffer_size= 128, > .bpp= 16, > + .regmap_config = &amg88xx_regmap_config, > .xfer = &amg88xx_xfer, > .hwmon_init = amg88xx_hwmon_init, > }, > @@ -350,7 +348,8 @@ static int video_i2c_querycap(struct file *file, void > *priv, > struct v4l2_capability *vcap) > { > struct video_i2c_data *data = video_drvdata(file); > - struct i2c_client *client = data->client; > + struct device *dev = regmap_get_device(data->regmap); > + struct i2c_client *client = to_i2c_client(dev); > > strlcpy(vcap->driver, data->v4l2_dev.name, sizeof(vcap->driver)); > strlcpy(vcap->card, data->vdev.name, sizeof(vcap->card)); > @@ -527,7 +526,10 @@ static int video_i2c_probe(struct i2c_client *client, > else > return -ENODEV; > > - data->client = client; > + data->regmap =
Re: [PATCH v5] media: imx208: Add imx208 camera sensor driver
On Fri, Sep 14, 2018 at 4:41 AM Sakari Ailus wrote: > > Hi Ping-chung, > > My apologies for the late review. Yeah...I had the impression this was already accepted. Though it should be straight forward to fix up additional things as normal patches. [sorry pruning heavily] ... > > +/* HBLANK control - read only */ > > +#define IMX208_PPL_384MHZ2248 > > +#define IMX208_PPL_96MHZ 2248 > > Does this generally depend on the link frequency? This was discussed in earlier patch version: in a nutshell, yes. ... > > +/* Configurations for supported link frequencies */ > > +#define IMX208_MHZ (1000*1000ULL) > > +#define IMX208_LINK_FREQ_384MHZ (384ULL * IMX208_MHZ) > > +#define IMX208_LINK_FREQ_96MHZ (96ULL * IMX208_MHZ) > > You could simply write these as 38400 and 9600. The original code did that. I agree IMX208_MHZ makes this much easier to read. ... > > + /* Current mode */ > > + const struct imx208_mode *cur_mode; > > + > > + /* > > + * Mutex for serialized access: > > + * Protect sensor set pad format and start/stop streaming safely. > > + * Protect access to sensor v4l2 controls. > > + */ > > + struct mutex imx208_mx; > > How about calling it simply e.g. a "mutex"? The struct is already specific > to imx208. I specifically asked the code not use "mutex" because trying to find this specific use of "mutex" with cscope (ctags) is impossible. Defining "mutex" in multiple name spaces is asking for trouble even though technically it's "safe" to do. ... > > +static int imx208_set_pad_format(struct v4l2_subdev *sd, > > +struct v4l2_subdev_pad_config *cfg, > > +struct v4l2_subdev_format *fmt) > > +{ > > + struct imx208 *imx208 = to_imx208(sd); > > + const struct imx208_mode *mode; > > + s32 vblank_def; > > + s32 vblank_min; > > + s64 h_blank; > > + s64 pixel_rate; > > + s64 link_freq; > > + > > + mutex_lock(&imx208->imx208_mx); > > + > > + fmt->format.code = imx208_get_format_code(imx208); > > + mode = v4l2_find_nearest_size( > > + supported_modes, ARRAY_SIZE(supported_modes), width, height, > > + fmt->format.width, fmt->format.height); > > + imx208_mode_to_pad_format(imx208, mode, fmt); > > + if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { > > + *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format; > > + } else { > > + imx208->cur_mode = mode; > > + __v4l2_ctrl_s_ctrl(imx208->link_freq, mode->link_freq_index); > > + link_freq = link_freq_menu_items[mode->link_freq_index]; > > Same as on the imx319 driver --- the link frequencies that are available > need to reflect what is specified in firmware. :) ... > > +static int imx208_set_stream(struct v4l2_subdev *sd, int enable) > > +{ > > + struct imx208 *imx208 = to_imx208(sd); > > + struct i2c_client *client = v4l2_get_subdevdata(sd); > > + int ret = 0; > > + > > + mutex_lock(&imx208->imx208_mx); > > + if (imx208->streaming == enable) { > > + mutex_unlock(&imx208->imx208_mx); > > + return 0; > > + } > > + > > + if (enable) { > > + ret = pm_runtime_get_sync(&client->dev); > > + if (ret < 0) > > + goto err_rpm_put; > > + > > + /* > > + * Apply default & customized values > > + * and then start streaming. > > + */ > > + ret = imx208_start_streaming(imx208); > > + if (ret) > > + goto err_rpm_put; > > + } else { > > + imx208_stop_streaming(imx208); > > + pm_runtime_put(&client->dev); > > + } > > + > > + imx208->streaming = enable; > > + mutex_unlock(&imx208->imx208_mx); > > + > > + /* vflip and hflip cannot change during streaming */ > > + v4l2_ctrl_grab(imx208->vflip, enable); > > + v4l2_ctrl_grab(imx208->hflip, enable); > > Please grab before releasing the lock; use __v4l2_ctrl_grab() here: > > https://git.linuxtv.org/sailus/media_tree.git/log/?h=unlocked-ctrl-grab> Is the current implementation not correct or is this just the preferred way to "grab"? (And thanks for pointing at the patch which adds the new "API") (and I'm ignoring the remaining nit on the assumption it can be addressed in the next patch) cheers, grant
[PATCH v6 6/6] media: add Rockchip VPU JPEG encoder driver
Add a mem2mem driver for the VPU available on Rockchip SoCs. Currently only JPEG encoding is supported, for RK3399 and RK3288 platforms. Signed-off-by: Ezequiel Garcia --- MAINTAINERS | 7 + drivers/staging/media/Kconfig | 2 + drivers/staging/media/Makefile| 1 + drivers/staging/media/rockchip/vpu/Makefile | 9 + drivers/staging/media/rockchip/vpu/TODO | 5 + .../media/rockchip/vpu/rk3288_vpu_hw.c| 123 .../rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c | 126 .../media/rockchip/vpu/rk3288_vpu_regs.h | 442 + .../media/rockchip/vpu/rk3399_vpu_hw.c| 123 .../rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c | 154 + .../media/rockchip/vpu/rk3399_vpu_regs.h | 601 + .../staging/media/rockchip/vpu/rockchip_vpu.h | 292 + .../media/rockchip/vpu/rockchip_vpu_common.h | 31 + .../media/rockchip/vpu/rockchip_vpu_drv.c | 528 +++ .../media/rockchip/vpu/rockchip_vpu_enc.c | 604 ++ .../media/rockchip/vpu/rockchip_vpu_hw.h | 65 ++ 16 files changed, 3113 insertions(+) create mode 100644 drivers/staging/media/rockchip/vpu/Makefile create mode 100644 drivers/staging/media/rockchip/vpu/TODO create mode 100644 drivers/staging/media/rockchip/vpu/rk3288_vpu_hw.c create mode 100644 drivers/staging/media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c create mode 100644 drivers/staging/media/rockchip/vpu/rk3288_vpu_regs.h create mode 100644 drivers/staging/media/rockchip/vpu/rk3399_vpu_hw.c create mode 100644 drivers/staging/media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c create mode 100644 drivers/staging/media/rockchip/vpu/rk3399_vpu_regs.h create mode 100644 drivers/staging/media/rockchip/vpu/rockchip_vpu.h create mode 100644 drivers/staging/media/rockchip/vpu/rockchip_vpu_common.h create mode 100644 drivers/staging/media/rockchip/vpu/rockchip_vpu_drv.c create mode 100644 drivers/staging/media/rockchip/vpu/rockchip_vpu_enc.c create mode 100644 drivers/staging/media/rockchip/vpu/rockchip_vpu_hw.h diff --git a/MAINTAINERS b/MAINTAINERS index 9812ae1a1a40..44a043019d0e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12462,6 +12462,13 @@ S: Maintained F: drivers/media/platform/rockchip/rga/ F: Documentation/devicetree/bindings/media/rockchip-rga.txt +ROCKCHIP VPU CODEC DRIVER +M: Ezequiel Garcia +L: linux-media@vger.kernel.org +S: Maintained +F: drivers/staging/media/platform/rockchip/vpu/ +F: Documentation/devicetree/bindings/media/rockchip-vpu.txt + ROCKER DRIVER M: Jiri Pirko L: net...@vger.kernel.org diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig index b3620a8f2d9f..c6f3404dea43 100644 --- a/drivers/staging/media/Kconfig +++ b/drivers/staging/media/Kconfig @@ -31,6 +31,8 @@ source "drivers/staging/media/mt9t031/Kconfig" source "drivers/staging/media/omap4iss/Kconfig" +source "drivers/staging/media/rockchip/vpu/Kconfig" + source "drivers/staging/media/sunxi/Kconfig" source "drivers/staging/media/tegra-vde/Kconfig" diff --git a/drivers/staging/media/Makefile b/drivers/staging/media/Makefile index 42948f805548..43c7bee1fc8c 100644 --- a/drivers/staging/media/Makefile +++ b/drivers/staging/media/Makefile @@ -8,3 +8,4 @@ obj-$(CONFIG_VIDEO_OMAP4) += omap4iss/ obj-$(CONFIG_VIDEO_SUNXI) += sunxi/ obj-$(CONFIG_TEGRA_VDE)+= tegra-vde/ obj-$(CONFIG_VIDEO_ZORAN) += zoran/ +obj-$(CONFIG_VIDEO_ROCKCHIP_VPU) += rockchip/vpu/ diff --git a/drivers/staging/media/rockchip/vpu/Makefile b/drivers/staging/media/rockchip/vpu/Makefile new file mode 100644 index ..2fb99adfbdb9 --- /dev/null +++ b/drivers/staging/media/rockchip/vpu/Makefile @@ -0,0 +1,9 @@ +obj-$(CONFIG_VIDEO_ROCKCHIP_VPU) += rockchip-vpu.o + +rockchip-vpu-y += \ + rockchip_vpu_drv.o \ + rockchip_vpu_enc.o \ + rk3288_vpu_hw.o \ + rk3288_vpu_hw_jpeg_enc.o \ + rk3399_vpu_hw.o \ + rk3399_vpu_hw_jpeg_enc.o diff --git a/drivers/staging/media/rockchip/vpu/TODO b/drivers/staging/media/rockchip/vpu/TODO new file mode 100644 index ..99bd1add7628 --- /dev/null +++ b/drivers/staging/media/rockchip/vpu/TODO @@ -0,0 +1,5 @@ +This driver is in staging until the V4L controls stabilize. + +Given the V4L controls are part of the uABI, it's better +to have the driver in staging, so users are aware of this +driver having an unstable interface. diff --git a/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw.c b/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw.c new file mode 100644 index ..ccb5cd0d88a7 --- /dev/null +++ b/drivers/staging/media/rockchip/vpu/rk3288_vpu_hw.c @@ -0,0 +1,123 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Rockchip VPU codec driver + * + * Copyright (C) 2018 Rockchip Electronics Co., Ltd. + * Jeffy Chen + */ + +#include + +#include
[PATCH v6 5/6] media: Add controls for JPEG quantization tables
From: Shunqian Zheng Add V4L2_CID_JPEG_QUANTIZATION compound control to allow userspace configure the JPEG quantization tables. Signed-off-by: Shunqian Zheng Signed-off-by: Ezequiel Garcia --- .../media/uapi/v4l/extended-controls.rst | 25 +++ .../media/videodev2.h.rst.exceptions | 1 + drivers/media/v4l2-core/v4l2-ctrls.c | 8 ++ include/uapi/linux/v4l2-controls.h| 10 include/uapi/linux/videodev2.h| 1 + 5 files changed, 45 insertions(+) diff --git a/Documentation/media/uapi/v4l/extended-controls.rst b/Documentation/media/uapi/v4l/extended-controls.rst index 65a1d873196b..6effae175be1 100644 --- a/Documentation/media/uapi/v4l/extended-controls.rst +++ b/Documentation/media/uapi/v4l/extended-controls.rst @@ -3530,7 +3530,32 @@ JPEG Control IDs Specify which JPEG markers are included in compressed stream. This control is valid only for encoders. +.. _jpeg-quant-tables-control: +``V4L2_CID_JPEG_QUANTIZATION (struct)`` +Specifies the luma and chroma quantization matrices for encoding +or decoding a V4L2_PIX_FMT_JPEG_RAW format buffer. +This control supports 8-bit quantization coefficients, for +the baseline profile, as specified by :ref:`itu-t81`. +Coefficients must be set in JPEG zigzag scan order. + + +.. c:type:: struct v4l2_ctrl_jpeg_quantization + +.. cssclass:: longtable + +.. flat-table:: struct v4l2_ctrl_jpeg_quantization +:header-rows: 0 +:stub-columns: 0 +:widths: 1 1 2 + +* - __u8 + - ``luma_quantization_matrix[64]`` + - Sets the luma quantization table. + +* - __u8 + - ``chroma_quantization_matrix[64]`` + - Sets the chroma quantization table. .. flat-table:: :header-rows: 0 diff --git a/Documentation/media/videodev2.h.rst.exceptions b/Documentation/media/videodev2.h.rst.exceptions index 1c043d552313..fbdd827e4229 100644 --- a/Documentation/media/videodev2.h.rst.exceptions +++ b/Documentation/media/videodev2.h.rst.exceptions @@ -131,6 +131,7 @@ replace symbol V4L2_CTRL_TYPE_U32 :c:type:`v4l2_ctrl_type` replace symbol V4L2_CTRL_TYPE_U8 :c:type:`v4l2_ctrl_type` replace symbol V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMS :c:type:`v4l2_ctrl_type` replace symbol V4L2_CTRL_TYPE_MPEG2_QUANTIZATION :c:type:`v4l2_ctrl_type` +replace symbol V4L2_CTRL_TYPE_JPEG_QUANTIZATION :c:type:`v4l2_ctrl_type` # V4L2 capability defines replace define V4L2_CAP_VIDEO_CAPTURE device-capabilities diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index dfdc31edb1dd..7b913a461b2e 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1001,6 +1001,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_JPEG_RESTART_INTERVAL:return "Restart Interval"; case V4L2_CID_JPEG_COMPRESSION_QUALITY: return "Compression Quality"; case V4L2_CID_JPEG_ACTIVE_MARKER: return "Active Markers"; + case V4L2_CID_JPEG_QUANTIZATION:return "JPEG Quantization Tables"; /* Image source controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ @@ -1288,6 +1289,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_DETECT_MD_REGION_GRID: *type = V4L2_CTRL_TYPE_U8; break; + case V4L2_CID_JPEG_QUANTIZATION: + *type = V4L2_CTRL_TYPE_JPEG_QUANTIZATION; + break; case V4L2_CID_DETECT_MD_THRESHOLD_GRID: *type = V4L2_CTRL_TYPE_U16; break; @@ -1667,6 +1671,7 @@ static int std_validate(const struct v4l2_ctrl *ctrl, u32 idx, return 0; case V4L2_CTRL_TYPE_MPEG2_QUANTIZATION: + case V4L2_CTRL_TYPE_JPEG_QUANTIZATION: return 0; default: @@ -2249,6 +2254,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, case V4L2_CTRL_TYPE_MPEG2_QUANTIZATION: elem_size = sizeof(struct v4l2_ctrl_mpeg2_quantization); break; + case V4L2_CTRL_TYPE_JPEG_QUANTIZATION: + elem_size = sizeof(struct v4l2_ctrl_jpeg_quantization); + break; default: if (type < V4L2_CTRL_COMPOUND_TYPES) elem_size = sizeof(s32); diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 51b095898f4b..5a8bdb732cfe 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -990,6 +990,16 @@ enum v4l2_jpeg_chroma_subsampling { #defineV4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17) #defineV4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18) +#define V4L2_CID_JPEG_QUANTIZATION (V4L2_CID_JPEG_CLASS_BASE + 5) +struct v4l2_ctrl_jpeg_quantization { + /* ITU-T.81 specifies two quantization coefficient precisions: +* 8-bit
[PATCH v6 4/6] media: Add JPEG_RAW format
From: Shunqian Zheng Add V4L2_PIX_FMT_JPEG_RAW format that does not contain JPEG header in the output frame. Signed-off-by: Shunqian Zheng Signed-off-by: Ezequiel Garcia --- Documentation/media/uapi/v4l/pixfmt-compressed.rst | 9 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 11 insertions(+) diff --git a/Documentation/media/uapi/v4l/pixfmt-compressed.rst b/Documentation/media/uapi/v4l/pixfmt-compressed.rst index ba0f6c49d9bf..ad73076276ec 100644 --- a/Documentation/media/uapi/v4l/pixfmt-compressed.rst +++ b/Documentation/media/uapi/v4l/pixfmt-compressed.rst @@ -23,6 +23,15 @@ Compressed Formats - 'JPEG' - TBD. See also :ref:`VIDIOC_G_JPEGCOMP `, :ref:`VIDIOC_S_JPEGCOMP `. +* .. _V4L2-PIX-FMT-JPEG-RAW: + + - ``V4L2_PIX_FMT_JPEG_RAW`` + - 'Raw JPEG' + - Raw JPEG bitstream, containing a compressed payload. This format +contains an image scan, i.e. without any metadata or headers. +The user is expected to set the needed metadata such as +quantization and entropy encoding tables, via ``V4L2_CID_JPEG`` +controls, see :ref:`jpeg-control-id`. * .. _V4L2-PIX-FMT-MPEG: - ``V4L2_PIX_FMT_MPEG`` diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index c63746968fa3..945efb2894d0 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1301,6 +1301,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) /* Max description length mask: descr = "0123456789012345678901234567890" */ case V4L2_PIX_FMT_MJPEG:descr = "Motion-JPEG"; break; case V4L2_PIX_FMT_JPEG: descr = "JFIF JPEG"; break; + case V4L2_PIX_FMT_JPEG_RAW: descr = "Raw JPEG"; break; case V4L2_PIX_FMT_DV: descr = "1394"; break; case V4L2_PIX_FMT_MPEG: descr = "MPEG-1/2/4"; break; case V4L2_PIX_FMT_H264: descr = "H.264"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index b133e69ad5ce..4c979886e8b2 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -627,6 +627,7 @@ struct v4l2_pix_format { /* compressed formats */ #define V4L2_PIX_FMT_MJPEGv4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */ #define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */ +#define V4L2_PIX_FMT_JPEG_RAW v4l2_fourcc('J', 'P', 'G', 'R') /* JFIF JPEG RAW without headers */ #define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */ #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 Multiplexed */ #define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4') /* H264 with start codes */ -- 2.19.0.rc2
[PATCH v6 3/6] arm64: dts: rockchip: add VPU device node for RK3399
Add the Video Processing Unit node for the RK3399 SoC. Also, fix the VPU IOMMU node, which was disabled and lacking its power domain property. Signed-off-by: Ezequiel Garcia --- arch/arm64/boot/dts/rockchip/rk3399.dtsi | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi index c88e603396f6..5efb124e5c3a 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi @@ -1198,6 +1198,18 @@ status = "disabled"; }; + vpu: video-codec@ff65 { + compatible = "rockchip,rk3399-vpu"; + reg = <0x0 0xff65 0x0 0x800>; + interrupts = , +; + interrupt-names = "vepu", "vdpu"; + clocks = <&cru ACLK_VCODEC>, <&cru HCLK_VCODEC>; + clock-names = "aclk", "hclk"; + power-domains = <&power RK3399_PD_VCODEC>; + iommus = <&vpu_mmu>; + }; + vpu_mmu: iommu@ff650800 { compatible = "rockchip,iommu"; reg = <0x0 0xff650800 0x0 0x40>; @@ -1205,8 +1217,8 @@ interrupt-names = "vpu_mmu"; clocks = <&cru ACLK_VCODEC>, <&cru HCLK_VCODEC>; clock-names = "aclk", "iface"; + power-domains = <&power RK3399_PD_VCODEC>; #iommu-cells = <0>; - status = "disabled"; }; vdec_mmu: iommu@ff660480 { -- 2.19.0.rc2
[PATCH v6 2/6] ARM: dts: rockchip: add VPU device node for RK3288
Add the Video Processing Unit node for RK3288 SoC. Fix the VPU IOMMU node, which was disabled and lacking its power domain property. Signed-off-by: Ezequiel Garcia --- arch/arm/boot/dts/rk3288.dtsi | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi index 0840ffb3205c..40d203cdca09 100644 --- a/arch/arm/boot/dts/rk3288.dtsi +++ b/arch/arm/boot/dts/rk3288.dtsi @@ -1223,6 +1223,18 @@ }; }; + vpu: video-codec@ff9a { + compatible = "rockchip,rk3288-vpu"; + reg = <0x0 0xff9a 0x0 0x800>; + interrupts = , +; + interrupt-names = "vepu", "vdpu"; + clocks = <&cru ACLK_VCODEC>, <&cru HCLK_VCODEC>; + clock-names = "aclk", "hclk"; + power-domains = <&power RK3288_PD_VIDEO>; + iommus = <&vpu_mmu>; + }; + vpu_mmu: iommu@ff9a0800 { compatible = "rockchip,iommu"; reg = <0x0 0xff9a0800 0x0 0x100>; @@ -1230,8 +1242,8 @@ interrupt-names = "vpu_mmu"; clocks = <&cru ACLK_VCODEC>, <&cru HCLK_VCODEC>; clock-names = "aclk", "iface"; + power-domains = <&power RK3288_PD_VIDEO>; #iommu-cells = <0>; - status = "disabled"; }; hevc_mmu: iommu@ff9c0440 { -- 2.19.0.rc2
Re: [PATCH 1/5] media: video-i2c: avoid accessing released memory area when removing driver
On Mon, Sep 17, 2018 at 9:03 AM Akinobu Mita wrote: > > The struct video_i2c_data is released when video_unregister_device() is > called, but it will still be accessed after calling > video_unregister_device(). > > Use devm_kzalloc() and let the memory be automatically released on driver > detach. > > Fixes: 5cebaac60974 ("media: video-i2c: add video-i2c driver") > Cc: Matt Ranostay > Cc: Sakari Ailus > Cc: Hans Verkuil > Cc: Mauro Carvalho Chehab > Signed-off-by: Akinobu Mita Acked-by: Matt Ranostay > --- > drivers/media/i2c/video-i2c.c | 18 +- > 1 file changed, 5 insertions(+), 13 deletions(-) > > diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c > index 06d29d8..b7a2af9 100644 > --- a/drivers/media/i2c/video-i2c.c > +++ b/drivers/media/i2c/video-i2c.c > @@ -508,20 +508,15 @@ static const struct v4l2_ioctl_ops video_i2c_ioctl_ops > = { > .vidioc_streamoff = vb2_ioctl_streamoff, > }; > > -static void video_i2c_release(struct video_device *vdev) > -{ > - kfree(video_get_drvdata(vdev)); > -} > - > static int video_i2c_probe(struct i2c_client *client, > const struct i2c_device_id *id) > { > struct video_i2c_data *data; > struct v4l2_device *v4l2_dev; > struct vb2_queue *queue; > - int ret = -ENODEV; > + int ret; > > - data = kzalloc(sizeof(*data), GFP_KERNEL); > + data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); > if (!data) > return -ENOMEM; > > @@ -530,7 +525,7 @@ static int video_i2c_probe(struct i2c_client *client, > else if (id) > data->chip = &video_i2c_chip[id->driver_data]; > else > - goto error_free_device; > + return -ENODEV; > > data->client = client; > v4l2_dev = &data->v4l2_dev; > @@ -538,7 +533,7 @@ static int video_i2c_probe(struct i2c_client *client, > > ret = v4l2_device_register(&client->dev, v4l2_dev); > if (ret < 0) > - goto error_free_device; > + return ret; > > mutex_init(&data->lock); > mutex_init(&data->queue_lock); > @@ -568,7 +563,7 @@ static int video_i2c_probe(struct i2c_client *client, > data->vdev.fops = &video_i2c_fops; > data->vdev.lock = &data->lock; > data->vdev.ioctl_ops = &video_i2c_ioctl_ops; > - data->vdev.release = video_i2c_release; > + data->vdev.release = video_device_release_empty; > data->vdev.device_caps = V4L2_CAP_VIDEO_CAPTURE | > V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; > > @@ -597,9 +592,6 @@ static int video_i2c_probe(struct i2c_client *client, > mutex_destroy(&data->lock); > mutex_destroy(&data->queue_lock); > > -error_free_device: > - kfree(data); > - > return ret; > } > > -- > 2.7.4 >
[PATCH v6 0/6] Add Rockchip VPU JPEG encoder
This series adds support for JPEG encoding via the VPU block present in Rockchip platforms. Currently, support for RK3288 and RK3399 is included. Please, see the previous versions of this cover letter for more information. Compared to v5, the only change is in the V4L2_CID_JPEG_QUANTIZATION control. We've decided to support only baseline profile, and only add 8-bit luma and chroma tables. struct v4l2_ctrl_jpeg_quantization { __u8luma_quantization_matrix[64]; __u8chroma_quantization_matrix[64]; }; By doing this, it's clear that we don't currently support anything but baseline. This series should apply cleanly on top of git://linuxtv.org/hverkuil/media_tree.git br-cedrus tag. If everyone is happy with this series, I'd like to route the devicetree changes through the rockchip tree, and the rest via the media subsystem. Compliance == (Same results as v3) v4l2-compliance SHA: d0f4ea7ddab6d0244c4fe1e960bb2aaeefb911b9, 64 bits Compliance test for device /dev/video0: Driver Info: Driver name : rockchip-vpu Card type: rockchip,rk3399-vpu-enc Bus info : platform: rockchip-vpu Driver version : 4.18.0 Capabilities : 0x84204000 Video Memory-to-Memory Multiplanar Streaming Extended Pix Format Device Capabilities Device Caps : 0x04204000 Video Memory-to-Memory Multiplanar Streaming Extended Pix Format Media Driver Info: Driver name : rockchip-vpu Model: rockchip-vpu Serial : Bus info : Media version: 4.18.0 Hardware revision: 0x (0) Driver version : 4.18.0 Interface Info: ID : 0x030c Type : V4L Video Entity Info: ID : 0x0001 (1) Name : rockchip,rk3399-vpu-enc-source Function : V4L2 I/O Pad 0x0102 : Source Link 0x0208: to remote pad 0x105 of entity 'rockchip,rk3399-vpu-enc-proc': Data, Enabled, Immutable Required ioctls: test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK Allow for multiple opens: test second /dev/video0 open: OK test VIDIOC_QUERYCAP: OK test VIDIOC_G/S_PRIORITY: OK test for unlimited opens: OK Debug ioctls: test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported) Input ioctls: test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported) test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported) Inputs: 0 Audio Inputs: 0 Tuners: 0 Output ioctls: test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported) Outputs: 0 Audio Outputs: 0 Modulators: 0 Input/Output configuration ioctls: test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported) Control ioctls: test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK test VIDIOC_G/S_CTRL: OK test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 2 Private Controls: 0 Format ioctls: test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK test VIDIOC_TRY_FMT: OK test VIDIOC_S_FMT: OK test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported) test Composing: OK (Not Supported) test Scaling: OK Codec ioctls: test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) Buffer ioctls: test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK Test input 0: Streaming ioctls: test read/write: OK (Not Supported) test blocking wait: OK test MMAP: OK test USERPTR: OK (Not Supported) test DMABUF: Cannot test, specify --expbuf-device Total: 48, Succeeded: 48, Failed: 0, Warnings: 0 v6: - As agreed with Hans change the q
[PATCH v6 1/6] dt-bindings: Document the Rockchip VPU bindings
Add devicetree binding documentation for Rockchip Video Processing Unit IP. Reviewed-by: Rob Herring Signed-off-by: Ezequiel Garcia --- .../bindings/media/rockchip-vpu.txt | 30 +++ 1 file changed, 30 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/rockchip-vpu.txt diff --git a/Documentation/devicetree/bindings/media/rockchip-vpu.txt b/Documentation/devicetree/bindings/media/rockchip-vpu.txt new file mode 100644 index ..5e0d421301ca --- /dev/null +++ b/Documentation/devicetree/bindings/media/rockchip-vpu.txt @@ -0,0 +1,30 @@ +device-tree bindings for rockchip VPU codec + +Rockchip (Video Processing Unit) present in various Rockchip platforms, +such as RK3288 and RK3399. + +Required properties: +- compatible: value should be one of the following + "rockchip,rk3288-vpu"; + "rockchip,rk3399-vpu"; +- interrupts: encoding and decoding interrupt specifiers +- interrupt-names: should be "vepu" and "vdpu" +- clocks: phandle to VPU aclk, hclk clocks +- clock-names: should be "aclk" and "hclk" +- power-domains: phandle to power domain node +- iommus: phandle to a iommu node + +Example: +SoC-specific DT entry: + vpu: video-codec@ff9a { + compatible = "rockchip,rk3288-vpu"; + reg = <0x0 0xff9a 0x0 0x800>; + interrupts = , +; + interrupt-names = "vepu", "vdpu"; + clocks = <&cru ACLK_VCODEC>, <&cru HCLK_VCODEC>; + clock-names = "aclk", "hclk"; + power-domains = <&power RK3288_PD_VIDEO>; + iommus = <&vpu_mmu>; + }; + -- 2.19.0.rc2
[PATCH 2/5] media: video-i2c: use i2c regmap
Use regmap for i2c register access. This simplifies register accesses and chooses suitable access commands based on the functionality that the adapter supports. Cc: Matt Ranostay Cc: Sakari Ailus Cc: Hans Verkuil Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- drivers/media/i2c/video-i2c.c | 54 ++- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c index b7a2af9..90d389b 100644 --- a/drivers/media/i2c/video-i2c.c +++ b/drivers/media/i2c/video-i2c.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -38,7 +39,7 @@ struct video_i2c_buffer { }; struct video_i2c_data { - struct i2c_client *client; + struct regmap *regmap; const struct video_i2c_chip *chip; struct mutex lock; spinlock_t slock; @@ -62,6 +63,12 @@ static const struct v4l2_frmsize_discrete amg88xx_size = { .height = 8, }; +static const struct regmap_config amg88xx_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .max_register = 0xff +}; + struct video_i2c_chip { /* video dimensions */ const struct v4l2_fmtdesc *format; @@ -76,6 +83,8 @@ struct video_i2c_chip { /* pixel size in bits */ unsigned int bpp; + const struct regmap_config *regmap_config; + /* xfer function */ int (*xfer)(struct video_i2c_data *data, char *buf); @@ -85,24 +94,8 @@ struct video_i2c_chip { static int amg88xx_xfer(struct video_i2c_data *data, char *buf) { - struct i2c_client *client = data->client; - struct i2c_msg msg[2]; - u8 reg = 0x80; - int ret; - - msg[0].addr = client->addr; - msg[0].flags = 0; - msg[0].len = 1; - msg[0].buf = (char *)® - - msg[1].addr = client->addr; - msg[1].flags = I2C_M_RD; - msg[1].len = data->chip->buffer_size; - msg[1].buf = (char *)buf; - - ret = i2c_transfer(client->adapter, msg, 2); - - return (ret == 2) ? 0 : -EIO; + return regmap_bulk_read(data->regmap, 0x80, buf, + data->chip->buffer_size); } #if IS_ENABLED(CONFIG_HWMON) @@ -133,12 +126,15 @@ static int amg88xx_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, int channel, long *val) { struct video_i2c_data *data = dev_get_drvdata(dev); - struct i2c_client *client = data->client; - int tmp = i2c_smbus_read_word_data(client, 0x0e); + __le16 buf; + int tmp; - if (tmp < 0) + tmp = regmap_bulk_read(data->regmap, 0x0e, &buf, 2); + if (tmp) return tmp; + tmp = le16_to_cpu(buf); + /* * Check for sign bit, this isn't a two's complement value but an * absolute temperature that needs to be inverted in the case of being @@ -164,8 +160,9 @@ static const struct hwmon_chip_info amg88xx_chip_info = { static int amg88xx_hwmon_init(struct video_i2c_data *data) { - void *hwmon = devm_hwmon_device_register_with_info(&data->client->dev, - "amg88xx", data, &amg88xx_chip_info, NULL); + struct device *dev = regmap_get_device(data->regmap); + void *hwmon = devm_hwmon_device_register_with_info(dev, "amg88xx", data, + &amg88xx_chip_info, NULL); return PTR_ERR_OR_ZERO(hwmon); } @@ -182,6 +179,7 @@ static const struct video_i2c_chip video_i2c_chip[] = { .max_fps= 10, .buffer_size= 128, .bpp= 16, + .regmap_config = &amg88xx_regmap_config, .xfer = &amg88xx_xfer, .hwmon_init = amg88xx_hwmon_init, }, @@ -350,7 +348,8 @@ static int video_i2c_querycap(struct file *file, void *priv, struct v4l2_capability *vcap) { struct video_i2c_data *data = video_drvdata(file); - struct i2c_client *client = data->client; + struct device *dev = regmap_get_device(data->regmap); + struct i2c_client *client = to_i2c_client(dev); strlcpy(vcap->driver, data->v4l2_dev.name, sizeof(vcap->driver)); strlcpy(vcap->card, data->vdev.name, sizeof(vcap->card)); @@ -527,7 +526,10 @@ static int video_i2c_probe(struct i2c_client *client, else return -ENODEV; - data->client = client; + data->regmap = devm_regmap_init_i2c(client, data->chip->regmap_config); + if (IS_ERR(data->regmap)) + return PTR_ERR(data->regmap); + v4l2_dev = &data->v4l2_dev; strlcpy(v4l2_dev->name, VIDEO_I2C_DRIVER, sizeof(v4l2_dev->name)); -- 2.7.4
[PATCH 4/5] media: video-i2c: support changing frame interval
AMG88xx has a register for setting frame rate 1 or 10 FPS. This adds support changing frame interval. Reference specifications: https://docid81hrs3j1.cloudfront.net/medialibrary/2017/11/PANA-S-A0002141979-1.pdf Cc: Matt Ranostay Cc: Sakari Ailus Cc: Hans Verkuil Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- drivers/media/i2c/video-i2c.c | 76 --- 1 file changed, 64 insertions(+), 12 deletions(-) diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c index 90d389b..916f36e 100644 --- a/drivers/media/i2c/video-i2c.c +++ b/drivers/media/i2c/video-i2c.c @@ -52,6 +52,8 @@ struct video_i2c_data { struct task_struct *kthread_vid_cap; struct list_head vid_cap_active; + + struct v4l2_fract frame_interval; }; static const struct v4l2_fmtdesc amg88xx_format = { @@ -74,8 +76,9 @@ struct video_i2c_chip { const struct v4l2_fmtdesc *format; const struct v4l2_frmsize_discrete *size; - /* max frames per second */ - unsigned int max_fps; + /* available frame intervals */ + const struct v4l2_fract *frame_intervals; + unsigned int num_frame_intervals; /* pixel buffer size */ unsigned int buffer_size; @@ -85,6 +88,9 @@ struct video_i2c_chip { const struct regmap_config *regmap_config; + /* setup function */ + int (*setup)(struct video_i2c_data *data); + /* xfer function */ int (*xfer)(struct video_i2c_data *data, char *buf); @@ -98,6 +104,22 @@ static int amg88xx_xfer(struct video_i2c_data *data, char *buf) data->chip->buffer_size); } +#define AMG88XX_REG_FPSC 0x02 +#define AMG88XX_FPSC_1FPS BIT(0) + +static int amg88xx_setup(struct video_i2c_data *data) +{ + unsigned int mask = AMG88XX_FPSC_1FPS; + unsigned int val; + + if (data->frame_interval.numerator == data->frame_interval.denominator) + val = mask; + else + val = 0; + + return regmap_update_bits(data->regmap, AMG88XX_REG_FPSC, mask, val); +} + #if IS_ENABLED(CONFIG_HWMON) static const u32 amg88xx_temp_config[] = { @@ -172,14 +194,21 @@ static int amg88xx_hwmon_init(struct video_i2c_data *data) #define AMG88XX0 +static const struct v4l2_fract amg88xx_frame_intervals[] = { + { 1, 10 }, + { 1, 1 }, +}; + static const struct video_i2c_chip video_i2c_chip[] = { [AMG88XX] = { .size = &amg88xx_size, .format = &amg88xx_format, - .max_fps= 10, + .frame_intervals= amg88xx_frame_intervals, + .num_frame_intervals= ARRAY_SIZE(amg88xx_frame_intervals), .buffer_size= 128, .bpp= 16, .regmap_config = &amg88xx_regmap_config, + .setup = &amg88xx_setup, .xfer = &amg88xx_xfer, .hwmon_init = amg88xx_hwmon_init, }, @@ -244,7 +273,8 @@ static void buffer_queue(struct vb2_buffer *vb) static int video_i2c_thread_vid_cap(void *priv) { struct video_i2c_data *data = priv; - unsigned int delay = msecs_to_jiffies(1000 / data->chip->max_fps); + unsigned int delay = mult_frac(HZ, data->frame_interval.numerator, + data->frame_interval.denominator); set_freezable(); @@ -306,19 +336,26 @@ static void video_i2c_del_list(struct vb2_queue *vq, enum vb2_buffer_state state static int start_streaming(struct vb2_queue *vq, unsigned int count) { struct video_i2c_data *data = vb2_get_drv_priv(vq); + int ret; if (data->kthread_vid_cap) return 0; + ret = data->chip->setup(data); + if (ret) + goto error_del_list; + data->sequence = 0; data->kthread_vid_cap = kthread_run(video_i2c_thread_vid_cap, data, "%s-vid-cap", data->v4l2_dev.name); - if (!IS_ERR(data->kthread_vid_cap)) + ret = PTR_ERR_OR_ZERO(data->kthread_vid_cap); + if (!ret) return 0; +error_del_list: video_i2c_del_list(vq, VB2_BUF_STATE_QUEUED); - return PTR_ERR(data->kthread_vid_cap); + return ret; } static void stop_streaming(struct vb2_queue *vq) @@ -425,15 +462,14 @@ static int video_i2c_enum_frameintervals(struct file *file, void *priv, const struct video_i2c_data *data = video_drvdata(file); const struct v4l2_frmsize_discrete *size = data->chip->size; - if (fe->index > 0) + if (fe->index >= data->chip->num_frame_intervals) return -EINVAL; if (fe->width != size->width || fe->height != size->height) return -EINVAL; fe->type = V4L2_FRMIVAL_TYPE_DISCRETE; - fe->discrete.numerator = 1;
[PATCH 1/5] media: video-i2c: avoid accessing released memory area when removing driver
The struct video_i2c_data is released when video_unregister_device() is called, but it will still be accessed after calling video_unregister_device(). Use devm_kzalloc() and let the memory be automatically released on driver detach. Fixes: 5cebaac60974 ("media: video-i2c: add video-i2c driver") Cc: Matt Ranostay Cc: Sakari Ailus Cc: Hans Verkuil Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- drivers/media/i2c/video-i2c.c | 18 +- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c index 06d29d8..b7a2af9 100644 --- a/drivers/media/i2c/video-i2c.c +++ b/drivers/media/i2c/video-i2c.c @@ -508,20 +508,15 @@ static const struct v4l2_ioctl_ops video_i2c_ioctl_ops = { .vidioc_streamoff = vb2_ioctl_streamoff, }; -static void video_i2c_release(struct video_device *vdev) -{ - kfree(video_get_drvdata(vdev)); -} - static int video_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct video_i2c_data *data; struct v4l2_device *v4l2_dev; struct vb2_queue *queue; - int ret = -ENODEV; + int ret; - data = kzalloc(sizeof(*data), GFP_KERNEL); + data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; @@ -530,7 +525,7 @@ static int video_i2c_probe(struct i2c_client *client, else if (id) data->chip = &video_i2c_chip[id->driver_data]; else - goto error_free_device; + return -ENODEV; data->client = client; v4l2_dev = &data->v4l2_dev; @@ -538,7 +533,7 @@ static int video_i2c_probe(struct i2c_client *client, ret = v4l2_device_register(&client->dev, v4l2_dev); if (ret < 0) - goto error_free_device; + return ret; mutex_init(&data->lock); mutex_init(&data->queue_lock); @@ -568,7 +563,7 @@ static int video_i2c_probe(struct i2c_client *client, data->vdev.fops = &video_i2c_fops; data->vdev.lock = &data->lock; data->vdev.ioctl_ops = &video_i2c_ioctl_ops; - data->vdev.release = video_i2c_release; + data->vdev.release = video_device_release_empty; data->vdev.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; @@ -597,9 +592,6 @@ static int video_i2c_probe(struct i2c_client *client, mutex_destroy(&data->lock); mutex_destroy(&data->queue_lock); -error_free_device: - kfree(data); - return ret; } -- 2.7.4
[PATCH 3/5] media: v4l2-common: add v4l2_find_closest_fract()
Add a function to locate the closest element in a sorted v4l2_fract array. The implementation is based on find_closest() macro in linux/util_macros.h and the way to compare two v4l2_fract in vivid_vid_cap_s_parm in drivers/media/platform/vivid/vivid-vid-cap.c. Cc: Matt Ranostay Cc: Sakari Ailus Cc: Hans Verkuil Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- drivers/media/v4l2-core/v4l2-common.c | 26 ++ include/media/v4l2-common.h | 12 2 files changed, 38 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index b518b92..91bd460 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -387,6 +387,32 @@ __v4l2_find_nearest_size(const void *array, size_t array_size, } EXPORT_SYMBOL_GPL(__v4l2_find_nearest_size); +#define FRACT_CMP(a, OP, b)\ + ((u64)(a).numerator * (b).denominator OP\ +(u64)(b).numerator * (a).denominator) + +int v4l2_find_closest_fract(struct v4l2_fract x, const struct v4l2_fract *array, + size_t num) +{ + int i; + + for (i = 0; i < num - 1; i++) { + struct v4l2_fract a = array[i]; + struct v4l2_fract b = array[i + 1]; + struct v4l2_fract midpoint = { + .numerator = a.numerator * b.denominator + +b.numerator * a.denominator, + .denominator = 2 * a.denominator * b.denominator, + }; + + if (FRACT_CMP(x, <=, midpoint)) + break; + } + + return i; +} +EXPORT_SYMBOL_GPL(v4l2_find_closest_fract); + void v4l2_get_timestamp(struct timeval *tv) { struct timespec ts; diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index cdc87ec..e388f4e 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -350,6 +350,18 @@ __v4l2_find_nearest_size(const void *array, size_t array_size, size_t height_offset, s32 width, s32 height); /** + * v4l2_find_closest_fract - locate the closest element in a sorted array + * @x: The reference value. + * @array: The array in which to look for the closest element. Must be sorted + * in ascending order. + * @num: number of elements in 'array'. + * + * Returns the index of the element closest to 'x'. + */ +int v4l2_find_closest_fract(struct v4l2_fract x, const struct v4l2_fract *array, + size_t num); + +/** * v4l2_get_timestamp - helper routine to get a timestamp to be used when * filling streaming metadata. Internally, it uses ktime_get_ts(), * which is the recommended way to get it. -- 2.7.4
[PATCH 5/5] media: video-i2c: support runtime PM
AMG88xx has a register for setting operating mode. This adds support runtime PM by changing the operating mode. The instruction for changing sleep mode to normal mode is from the reference specifications. https://docid81hrs3j1.cloudfront.net/medialibrary/2017/11/PANA-S-A0002141979-1.pdf Cc: Matt Ranostay Cc: Sakari Ailus Cc: Hans Verkuil Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- drivers/media/i2c/video-i2c.c | 140 +- 1 file changed, 138 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c index 916f36e..93822f4 100644 --- a/drivers/media/i2c/video-i2c.c +++ b/drivers/media/i2c/video-i2c.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -94,6 +95,9 @@ struct video_i2c_chip { /* xfer function */ int (*xfer)(struct video_i2c_data *data, char *buf); + /* power control function */ + int (*set_power)(struct video_i2c_data *data, bool on); + /* hwmon init function */ int (*hwmon_init)(struct video_i2c_data *data); }; @@ -104,6 +108,14 @@ static int amg88xx_xfer(struct video_i2c_data *data, char *buf) data->chip->buffer_size); } +#define AMG88XX_REG_PCTL 0x00 +#define AMG88XX_PCTL_NORMAL0x00 +#define AMG88XX_PCTL_SLEEP 0x10 + +#define AMG88XX_REG_RST0x01 +#define AMG88XX_RST_FLAG 0x30 +#define AMG88XX_RST_INIT 0x3f + #define AMG88XX_REG_FPSC 0x02 #define AMG88XX_FPSC_1FPS BIT(0) @@ -120,6 +132,59 @@ static int amg88xx_setup(struct video_i2c_data *data) return regmap_update_bits(data->regmap, AMG88XX_REG_FPSC, mask, val); } +static int amg88xx_set_power_on(struct video_i2c_data *data) +{ + int ret; + + ret = regmap_write(data->regmap, AMG88XX_REG_PCTL, AMG88XX_PCTL_NORMAL); + if (ret) + return ret; + + msleep(50); + + ret = regmap_write(data->regmap, AMG88XX_REG_RST, AMG88XX_RST_INIT); + if (ret) + return ret; + + msleep(2); + + ret = regmap_write(data->regmap, AMG88XX_REG_RST, AMG88XX_RST_FLAG); + if (ret) + return ret; + + /* +* Wait two frames before reading thermistor and temperature registers +*/ + msleep(200); + + return 0; +} + +static int amg88xx_set_power_off(struct video_i2c_data *data) +{ + int ret; + + ret = regmap_write(data->regmap, AMG88XX_REG_PCTL, AMG88XX_PCTL_SLEEP); + if (ret) + return ret; + /* +* Wait for a while to avoid resuming normal mode immediately after +* entering sleep mode, otherwise the device occasionally goes wrong +* (thermistor and temperature registers are not updated at all) +*/ + msleep(100); + + return 0; +} + +static int amg88xx_set_power(struct video_i2c_data *data, bool on) +{ + if (on) + return amg88xx_set_power_on(data); + + return amg88xx_set_power_off(data); +} + #if IS_ENABLED(CONFIG_HWMON) static const u32 amg88xx_temp_config[] = { @@ -151,7 +216,15 @@ static int amg88xx_read(struct device *dev, enum hwmon_sensor_types type, __le16 buf; int tmp; + tmp = pm_runtime_get_sync(regmap_get_device(data->regmap)); + if (tmp < 0) { + pm_runtime_put_noidle(regmap_get_device(data->regmap)); + return tmp; + } + tmp = regmap_bulk_read(data->regmap, 0x0e, &buf, 2); + pm_runtime_mark_last_busy(regmap_get_device(data->regmap)); + pm_runtime_put_autosuspend(regmap_get_device(data->regmap)); if (tmp) return tmp; @@ -210,6 +283,7 @@ static const struct video_i2c_chip video_i2c_chip[] = { .regmap_config = &amg88xx_regmap_config, .setup = &amg88xx_setup, .xfer = &amg88xx_xfer, + .set_power = amg88xx_set_power, .hwmon_init = amg88xx_hwmon_init, }, }; @@ -336,14 +410,21 @@ static void video_i2c_del_list(struct vb2_queue *vq, enum vb2_buffer_state state static int start_streaming(struct vb2_queue *vq, unsigned int count) { struct video_i2c_data *data = vb2_get_drv_priv(vq); + struct device *dev = regmap_get_device(data->regmap); int ret; if (data->kthread_vid_cap) return 0; + ret = pm_runtime_get_sync(dev); + if (ret < 0) { + pm_runtime_put_noidle(dev); + goto error_del_list; + } + ret = data->chip->setup(data); if (ret) - goto error_del_list; + goto error_rpm_put; data->sequence = 0; data->kthread_vid_cap = kthread_run(video_i2c_thread_vid_cap, data, @@ -352,6 +433,9 @@ static int start_streami
[PATCH 0/5] media: video-i2c: support changing frame interval and runtime PM
This patchset adds support for changing frame interval and runtime PM for video-i2c driver. This also adds an helper function to v4l2 common internal API that is used to to find a suitable frame interval. There are a couple of unrelated changes that are included for simplifying driver initialization code and register accesses. Akinobu Mita (5): media: video-i2c: avoid accessing released memory area when removing driver media: video-i2c: use i2c regmap media: v4l2-common: add v4l2_find_closest_fract() media: video-i2c: support changing frame interval media: video-i2c: support runtime PM drivers/media/i2c/video-i2c.c | 276 -- drivers/media/v4l2-core/v4l2-common.c | 26 include/media/v4l2-common.h | 12 ++ 3 files changed, 267 insertions(+), 47 deletions(-) Cc: Matt Ranostay Cc: Sakari Ailus Cc: Hans Verkuil Cc: Mauro Carvalho Chehab -- 2.7.4
[PATCH] [media] VPU: mediatek: don't pass an unused parameter
The load_requested_vpu() function returns a freed vpu_fw pointer. It's not used so it doesn't cause any problems, but Smatch complains about it: drivers/media/platform/mtk-vpu/mtk_vpu.c:578 vpu_load_firmware() warn: passing freed memory 'vpu_fw' We can clean up the code a bit and silence the static checker warning by not passing the parameter at all. Signed-off-by: Dan Carpenter diff --git a/drivers/media/platform/mtk-vpu/mtk_vpu.c b/drivers/media/platform/mtk-vpu/mtk_vpu.c index f8d35e3ac1dc..616f78b24a79 100644 --- a/drivers/media/platform/mtk-vpu/mtk_vpu.c +++ b/drivers/media/platform/mtk-vpu/mtk_vpu.c @@ -480,12 +480,12 @@ EXPORT_SYMBOL_GPL(vpu_get_plat_device); /* load vpu program/data memory */ static int load_requested_vpu(struct mtk_vpu *vpu, - const struct firmware *vpu_fw, u8 fw_type) { size_t tcm_size = fw_type ? VPU_DTCM_SIZE : VPU_PTCM_SIZE; size_t fw_size = fw_type ? VPU_D_FW_SIZE : VPU_P_FW_SIZE; char *fw_name = fw_type ? VPU_D_FW : VPU_P_FW; + const struct firmware *vpu_fw; size_t dl_size = 0; size_t extra_fw_size = 0; void *dest; @@ -539,7 +539,6 @@ int vpu_load_firmware(struct platform_device *pdev) struct mtk_vpu *vpu; struct device *dev = &pdev->dev; struct vpu_run *run; - const struct firmware *vpu_fw = NULL; int ret; if (!pdev) { @@ -568,14 +567,14 @@ int vpu_load_firmware(struct platform_device *pdev) run->signaled = false; dev_dbg(vpu->dev, "firmware request\n"); /* Downloading program firmware to device*/ - ret = load_requested_vpu(vpu, vpu_fw, P_FW); + ret = load_requested_vpu(vpu, P_FW); if (ret < 0) { dev_err(dev, "Failed to request %s, %d\n", VPU_P_FW, ret); goto OUT_LOAD_FW; } /* Downloading data firmware to device */ - ret = load_requested_vpu(vpu, vpu_fw, D_FW); + ret = load_requested_vpu(vpu, D_FW); if (ret < 0) { dev_err(dev, "Failed to request %s, %d\n", VPU_D_FW, ret); goto OUT_LOAD_FW;
Re: [PATCH v3 0/5] Fix OV5640 exposure & gain
On Mon, Sep 17, 2018 at 09:47:19AM +0200, jacopo mondi wrote: > Hi Sakari, > thanks for handling this > > On Sun, Sep 16, 2018 at 02:02:30AM +0300, Sakari Ailus wrote: > > Hi Jacopo, Hugues, > > > > On Fri, Sep 14, 2018 at 06:07:12PM +0200, jacopo mondi wrote: > > > Hi Sakari, > > > > > > On Tue, Sep 11, 2018 at 03:48:16PM +0200, Hugues Fruchet wrote: > > > > This patch serie fixes some problems around exposure & gain in OV5640 > > > > driver. > > > > > > As you offered to collect this series and my CSI-2 fixes I have just > > > re-sent, you might be interested in this branch: > > > > > > git://jmondi.org/linux > > > engicam-imx6q/media-master/ov5640/csi2_init_v4_exposure_v3 > > > > > > I have there re-based this series on top of mine, which is in turn > > > based on latest media master, where this series do not apply as-is > > > afaict. > > > > > > I have added to Hugues' patches my reviewed-by and tested-by tags. > > > If you prefer to I can send you a pull request, or if you want to have > > > a chance to review the whole patch list please refer to the above > > > branch. > > > > > > Let me know if I can help speeding up the inclusion of these two > > > series as they fix two real issues of MIPI CSI-2 capture operations > > > for this sensor. > > > > I've pushed the patches here: > > > > https://git.linuxtv.org/sailus/media_tree.git/log/?h=for-4.20-5> > > > > There was a merge commit and a few extra patches in your tree; I threw them > > out. :-) > > Yeah, those are a few patches I need for my testing platform... Forgot to > remove them, hope you didn't spend too much time on this. No, it was rather easy to remove them. I've sent a pull request on these: https://patchwork.linuxtv.org/patch/52091/> -- Sakari Ailus e-mail: sakari.ai...@iki.fi
[PATCH] vidioc-dqevent.rst: clarify V4L2_EVENT_SRC_CH_RESOLUTION
Clarify that when you receive V4L2_EVENT_SOURCE_CHANGE with flag V4L2_EVENT_SRC_CH_RESOLUTION set, and the new resolution appears identical to the old resolution, then you still must restart the streaming I/O. Signed-off-by: Hans Verkuil --- diff --git a/Documentation/media/uapi/v4l/vidioc-dqevent.rst b/Documentation/media/uapi/v4l/vidioc-dqevent.rst index cb3565f36793..04416b6943c0 100644 --- a/Documentation/media/uapi/v4l/vidioc-dqevent.rst +++ b/Documentation/media/uapi/v4l/vidioc-dqevent.rst @@ -379,7 +379,17 @@ call. - 0x0001 - This event gets triggered when a resolution change is detected at an input. This can come from an input connector or from a video - decoder. + decoder. Applications will have to query the new resolution (if + any, the signal may also have been lost). + + *Important*: even if the new video timings appear identical to the old + ones, receiving this event indicates that there was an issue with the + video signal and you must stop and restart streaming + (:ref:`VIDIOC_STREAMOFF ` + followed by :ref:`VIDIOC_STREAMON `). The reason is + that many devices are not able to recover from a temporary loss of + signal and so restarting streaming I/O is required in order for the + hardware to synchronize to the video signal. Return Value
Re: [PATCH v5] media: add imx319 camera sensor driver
Hi Bingbu, Thanks for the update! A few more small comments, I think we're done after these. On Mon, Sep 17, 2018 at 01:57:52PM +0800, bingbu@intel.com wrote: > From: Bingbu Cao > > Add a v4l2 sub-device driver for the Sony imx319 image sensor. > This is a camera sensor using the i2c bus for control and the > csi-2 bus for data. > > This driver supports following features: > - manual exposure and analog/digital gain control support > - vblank/hblank control support > - 4 test patterns control support > - vflip/hflip control support (will impact the output bayer order) > - support following resolutions: > - 3264x2448, 3280x2464 @ 30fps > - 1936x1096, 1920x1080 @ 60fps > - 1640x1232, 1640x922, 1296x736, 1280x720 @ 120fps > - support 4 bayer orders output (via change v/hflip) > - SRGGB10(default), SGRBG10, SGBRG10, SBGGR10 > > Signed-off-by: Bingbu Cao > Signed-off-by: Tianshu Qiu > > --- > > This patch is based on sakari's media-tree git: > https://git.linuxtv.org/sailus/media_tree.git/log/?h=for-4.20-1 > > Changes from v4 to v5: > - use single PLL for all internal clocks > - change link frequency to 482.4MHz > - adjust frame timing for 2x2 binning modes >and enlarge frame readout time > - get CSI-2 link frequencies and external clock >from firmware > - use unlocked __v4l2_ctrl_grab() with change from: >https://git.linuxtv.org/sailus/media_tree.git/commit/?h=unlocked-ctrl-grab > > Changes since v1: > - fix some coding style issues - line breaks > - add v4l2_ctrl_grab() to prevent v/hflip change >during streaming > - add v4l2 ctrl event (un)subscribe support > - add more info into commit message > > --- > --- > MAINTAINERS|7 + > drivers/media/i2c/Kconfig | 11 + > drivers/media/i2c/Makefile |1 + > drivers/media/i2c/imx319.c | 2524 > > 4 files changed, 2543 insertions(+) > create mode 100644 drivers/media/i2c/imx319.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index a5b256b25905..abc4abb6f83c 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -13530,6 +13530,13 @@ S: Maintained > F: drivers/media/i2c/imx274.c > F: Documentation/devicetree/bindings/media/i2c/imx274.txt > > +SONY IMX319 SENSOR DRIVER > +M: Bingbu Cao > +L: linux-media@vger.kernel.org > +T: git git://linuxtv.org/media_tree.git > +S: Maintained > +F: drivers/media/i2c/imx319.c > + > SONY MEMORYSTICK CARD SUPPORT > M: Alex Dubov > W: http://tifmxx.berlios.de/ > diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig > index bfdb494686bf..603ac087975b 100644 > --- a/drivers/media/i2c/Kconfig > +++ b/drivers/media/i2c/Kconfig > @@ -614,6 +614,17 @@ config VIDEO_IMX274 > This is a V4L2 sensor driver for the Sony IMX274 > CMOS image sensor. > > +config VIDEO_IMX319 > + tristate "Sony IMX319 sensor support" > + depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API > + depends on MEDIA_CAMERA_SUPPORT > + help > + This is a Video4Linux2 sensor driver for the Sony > + IMX319 camera. > + > + To compile this driver as a module, choose M here: the > + module will be called imx319. > + > config VIDEO_OV2640 > tristate "OmniVision OV2640 sensor support" > depends on VIDEO_V4L2 && I2C > diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile > index a94eb03d10d4..d10b438577be 100644 > --- a/drivers/media/i2c/Makefile > +++ b/drivers/media/i2c/Makefile > @@ -108,5 +108,6 @@ obj-$(CONFIG_VIDEO_OV2659)+= ov2659.o > obj-$(CONFIG_VIDEO_TC358743) += tc358743.o > obj-$(CONFIG_VIDEO_IMX258) += imx258.o > obj-$(CONFIG_VIDEO_IMX274) += imx274.o > +obj-$(CONFIG_VIDEO_IMX319) += imx319.o > > obj-$(CONFIG_SDR_MAX2175) += max2175.o > diff --git a/drivers/media/i2c/imx319.c b/drivers/media/i2c/imx319.c > new file mode 100644 > index ..43c28c701431 > --- /dev/null > +++ b/drivers/media/i2c/imx319.c > @@ -0,0 +1,2524 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// Copyright (C) 2018 Intel Corporation > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define IMX319_REG_MODE_SELECT 0x0100 > +#define IMX319_MODE_STANDBY 0x00 > +#define IMX319_MODE_STREAMING0x01 > + > +/* Chip ID */ > +#define IMX319_REG_CHIP_ID 0x0016 > +#define IMX319_CHIP_ID 0x0319 > + > +/* V_TIMING internal */ > +#define IMX319_REG_FLL 0x0340 > +#define IMX319_FLL_MAX 0x > + > +/* Exposure control */ > +#define IMX319_REG_EXPOSURE 0x0202 > +#define IMX319_EXPOSURE_MIN 1 > +#define IMX319_EXPOSURE_STEP 1 > +#define IMX319_EXPOSURE_DEFAULT 0x04f6 > + > +/* Analog gain control */ > +#define IMX319_REG_ANALOG_GAIN 0x0204 > +#define IMX319_ANA_GAIN_MIN 0 > +#define IMX31
Re: [PATCH 1/1] v4l: samsung, ov9650: Rely on V4L2-set sub-device names
Hi Sakari, I love your patch! Yet something to improve: [auto build test ERROR on linuxtv-media/master] [also build test ERROR on next-20180913] [cannot apply to v4.19-rc4] [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/Sakari-Ailus/v4l-samsung-ov9650-Rely-on-V4L2-set-sub-device-names/20180916-232558 base: git://linuxtv.org/media_tree.git master config: i386-randconfig-x0-09171846 (attached as .config) compiler: gcc-5 (Debian 5.5.0-3) 5.4.1 20171010 reproduce: # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): drivers/media/i2c/s5c73m3/s5c73m3-core.c: In function 's5c73m3_probe': >> drivers/media/i2c/s5c73m3/s5c73m3-core.c:1686:2: error: implicit declaration >> of function 'v4l2_i2c_subdev_set_name' >> [-Werror=implicit-function-declaration] v4l2_i2c_subdev_set_name(sd, client, NULL, NULL); ^ cc1: some warnings being treated as errors vim +/v4l2_i2c_subdev_set_name +1686 drivers/media/i2c/s5c73m3/s5c73m3-core.c 1660 1661 static int s5c73m3_probe(struct i2c_client *client, 1662 const struct i2c_device_id *id) 1663 { 1664 struct device *dev = &client->dev; 1665 struct v4l2_subdev *sd; 1666 struct v4l2_subdev *oif_sd; 1667 struct s5c73m3 *state; 1668 int ret, i; 1669 1670 state = devm_kzalloc(dev, sizeof(*state), GFP_KERNEL); 1671 if (!state) 1672 return -ENOMEM; 1673 1674 state->i2c_client = client; 1675 ret = s5c73m3_get_platform_data(state); 1676 if (ret < 0) 1677 return ret; 1678 1679 mutex_init(&state->lock); 1680 sd = &state->sensor_sd; 1681 oif_sd = &state->oif_sd; 1682 1683 v4l2_subdev_init(sd, &s5c73m3_subdev_ops); 1684 sd->owner = client->dev.driver->owner; 1685 v4l2_set_subdevdata(sd, state); > 1686 v4l2_i2c_subdev_set_name(sd, client, NULL, NULL); 1687 1688 sd->internal_ops = &s5c73m3_internal_ops; 1689 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 1690 1691 state->sensor_pads[S5C73M3_JPEG_PAD].flags = MEDIA_PAD_FL_SOURCE; 1692 state->sensor_pads[S5C73M3_ISP_PAD].flags = MEDIA_PAD_FL_SOURCE; 1693 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; 1694 1695 ret = media_entity_pads_init(&sd->entity, S5C73M3_NUM_PADS, 1696 state->sensor_pads); 1697 if (ret < 0) 1698 return ret; 1699 1700 v4l2_i2c_subdev_init(oif_sd, client, &oif_subdev_ops); 1701 v4l2_i2c_subdev_set_name(sd, client, NULL, "-oif"); 1702 1703 oif_sd->internal_ops = &oif_internal_ops; 1704 oif_sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 1705 1706 state->oif_pads[OIF_ISP_PAD].flags = MEDIA_PAD_FL_SINK; 1707 state->oif_pads[OIF_JPEG_PAD].flags = MEDIA_PAD_FL_SINK; 1708 state->oif_pads[OIF_SOURCE_PAD].flags = MEDIA_PAD_FL_SOURCE; 1709 oif_sd->entity.function = MEDIA_ENT_F_PROC_VIDEO_SCALER; 1710 1711 ret = media_entity_pads_init(&oif_sd->entity, OIF_NUM_PADS, 1712 state->oif_pads); 1713 if (ret < 0) 1714 return ret; 1715 1716 ret = s5c73m3_configure_gpios(state); 1717 if (ret) 1718 goto out_err; 1719 1720 for (i = 0; i < S5C73M3_MAX_SUPPLIES; i++) 1721 state->supplies[i].supply = s5c73m3_supply_names[i]; 1722 1723 ret = devm_regulator_bulk_get(dev, S5C73M3_MAX_SUPPLIES, 1724 state->supplies); 1725 if (ret) { 1726 dev_err(dev, "failed to get regulators\n"); 1727 goto out_err; 1728 } 1729 1730 ret = s5c73m3_init_controls(state); 1731 if (ret) 1732 goto out_err; 1733 1734 state->sensor_pix_size[RES_ISP] = &s5c73m3_isp_resolutions[1]; 1735 state->sensor_pix_size[RES_JPEG] = &s5c73m3_jpeg_resolutions[1]; 1736 state->oif_pix_size[RES_ISP] = state->sensor_pix_size[RES_ISP]; 1737 state->oif_pix_size[RES_JPEG] = state->sensor_pix_size[RES_JPEG]; 1738 1739 state->mbus_code = S5C73M3_ISP_FMT; 1740 1741 state->fiv = &s5c73m3_intervals[S5C73M3_DEFAULT_FRAME_INTERVAL]; 1742 1743 state->fw_file_version[0] = 'G'; 1744 state->fw_file_version[1] = 'C'; 1745 1746 ret = s5c73m3_register_spi_driver(state); 1747 if (ret < 0) 1748 goto out_err; 1749 1750
[GIT FIXES FOR v4.19] Fix cros-ec-cec build error
The following changes since commit 78cf8c842c111df656c63b5d04997ea4e40ef26a: media: drxj: fix spelling mistake in fall-through annotations (2018-09-12 11:21:52 -0400) are available in the Git repository at: git://linuxtv.org/hverkuil/media_tree.git tags/v4.19b for you to fetch changes up to 8b700bb12aea882e14eb1a48789581dd7724c410: media: platform: fix cros-ec-cec build error (2018-09-17 11:40:14 +0200) Tag v4.19b Randy Dunlap (1): media: platform: fix cros-ec-cec build error drivers/media/platform/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
Re: [PATCH 3/5] media: dt-bindings: media: rcar_vin: Add r8a774a1 support
Hi Biju, Thanks for your patch. On 2018-09-10 15:31:16 +0100, Biju Das wrote: > Document RZ/G2M (R8A774A1) SoC bindings. > > The RZ/G2M SoC is similar to R-Car M3-W (R8A7796). > > Signed-off-by: Biju Das > Reviewed-by: Fabrizio Castro Acked-by: Niklas Söderlund > --- > Documentation/devicetree/bindings/media/rcar_vin.txt | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/Documentation/devicetree/bindings/media/rcar_vin.txt > b/Documentation/devicetree/bindings/media/rcar_vin.txt > index 2f42005..8c81689 100644 > --- a/Documentation/devicetree/bindings/media/rcar_vin.txt > +++ b/Documentation/devicetree/bindings/media/rcar_vin.txt > @@ -12,6 +12,7 @@ on Gen3 platforms to a CSI-2 receiver. > - compatible: Must be one or more of the following > - "renesas,vin-r8a7743" for the R8A7743 device > - "renesas,vin-r8a7745" for the R8A7745 device > + - "renesas,vin-r8a774a1" for the R8A774A1 device > - "renesas,vin-r8a7778" for the R8A7778 device > - "renesas,vin-r8a7779" for the R8A7779 device > - "renesas,vin-r8a7790" for the R8A7790 device > @@ -58,9 +59,9 @@ The per-board settings Gen2 platforms: > - data-enable-active: polarity of CLKENB signal, see [1] for >description. Default is active high. > > -The per-board settings Gen3 platforms: > +The per-board settings Gen3 and RZ/G2 platforms: > > -Gen3 platforms can support both a single connected parallel input source > +Gen3 and RZ/G2 platforms can support both a single connected parallel input > source > from external SoC pins (port@0) and/or multiple parallel input sources > from local SoC CSI-2 receivers (port@1) depending on SoC. > > -- > 2.7.4 > -- Regards, Niklas Söderlund
[GIT PULL FOR v4.20] Various fixes
Nothing special, just lots of fixes. Note that my four cec patches have a CC for stable for 4.17 and up (they no longer apply for 4.16 and older). I decided not to add them for 4.19 since these patches are a bit bigger than I'd like and it's been broken since 4.12 without anyone noticing. So a few extra weeks before they are backported to 4.19 shouldn't matter. Once they are merged I might make another patch set for the 4.14 longterm kernel, the only longterm kernel that is affected by this. Regards, Hans The following changes since commit 78cf8c842c111df656c63b5d04997ea4e40ef26a: media: drxj: fix spelling mistake in fall-through annotations (2018-09-12 11:21:52 -0400) are available in the Git repository at: git://linuxtv.org/hverkuil/media_tree.git tags/v4.20c for you to fetch changes up to dbfb412d7e38fdcc6ada339b2431b9d5db1df667: media: davinci: Fix implicit enum conversion warning (2018-09-17 12:46:13 +0200) Tag v4.20c Alexandre GRIVEAUX (1): saa7134: add P7131_4871 analog inputs Arnd Bergmann (1): media: imx: work around false-positive warning, again Brad Love (2): au0828: cannot kfree dev before usb disconnect au0828: Fix incorrect error messages Ezequiel Garcia (2): vicodec: Drop unneeded symbol dependency vicodec: Drop unused job_abort() Gustavo A. R. Silva (1): venus: helpers: use true and false for boolean values Hans Verkuil (8): cec: make cec_get_edid_spa_location() an inline function cec: integrate cec_validate_phys_addr() in cec-api.c cec/v4l2: move V4L2 specific CEC functions to V4L2 cec: remove cec-edid.c vicodec: check for valid format in v4l2_fwht_en/decode vicodec: set state->info before calling the encode/decode funcs media: replace ADOBERGB by OPRGB media colorspaces*.rst: rename AdobeRGB to opRGB Jia-Ju Bai (1): media: pci: ivtv: Fix a sleep-in-atomic-context bug in ivtv_yuv_init() Johan Fjeldtvedt (1): vb2: check for sane values from queue_setup Lucas Stach (1): media: coda: don't overwrite h.264 profile_idc on decoder instance Nathan Chancellor (2): bt8xx: Remove unnecessary self-assignment media: davinci: Fix implicit enum conversion warning Nicholas Mc Guire (1): media: pci: cx23885: handle adding to list failure Niklas Söderlund (1): v4l2-common: fix typo in documentation for v4l_bound_align_image() Philipp Zabel (1): media: imx-pxp: fix compilation on i386 or x86_64 zhong jiang (2): media: coda: remove redundant null pointer check before of_node_put media: platform: remove redundant null pointer check before of_node_put Documentation/media/uapi/v4l/biblio.rst | 10 -- Documentation/media/uapi/v4l/colorspaces-defs.rst| 8 +- Documentation/media/uapi/v4l/colorspaces-details.rst | 13 ++- Documentation/media/videodev2.h.rst.exceptions | 6 +- drivers/media/cec/Makefile | 2 +- drivers/media/cec/cec-adap.c | 13 +++ drivers/media/cec/cec-api.c | 19 +++- drivers/media/cec/cec-edid.c | 155 drivers/media/common/v4l2-tpg/v4l2-tpg-colors.c | 262 +++ drivers/media/common/videobuf2/videobuf2-core.c | 9 ++ drivers/media/i2c/adv7511.c | 2 +- drivers/media/i2c/adv7604.c | 6 +- drivers/media/i2c/adv7842.c | 4 +- drivers/media/i2c/tc358743.c | 6 +- drivers/media/pci/bt8xx/bttv-driver.c| 1 - drivers/media/pci/cx23885/altera-ci.c| 10 ++ drivers/media/pci/ivtv/ivtv-yuv.c| 2 +- drivers/media/pci/saa7134/saa7134-cards.c| 15 +++ drivers/media/platform/coda/coda-common.c| 6 +- drivers/media/platform/davinci/vpbe_display.c| 2 +- drivers/media/platform/imx-pxp.c | 1 + drivers/media/platform/qcom/venus/helpers.c | 2 +- drivers/media/platform/ti-vpe/cal.c | 12 +-- drivers/media/platform/vicodec/Kconfig | 2 +- drivers/media/platform/vicodec/codec-v4l2-fwht.c | 15 ++- drivers/media/platform/vicodec/codec-v4l2-fwht.h | 7 +- drivers/media/platform/vicodec/vicodec-core.c| 23 ++--- drivers/media/platform/vivid/vivid-core.h| 2 +- drivers/media/platform/vivid/vivid-ctrls.c | 6 +- drivers/media/platform/vivid/vivid-vid-cap.c | 4 +- drivers/media/platform/vivid/vivid-vid-common.c | 2 +- drivers/media/platform/vivid/vivid-vid-out.c | 2 +- drivers/media/usb/au0828/au0828-core.c | 5 +- drivers/media/v4l2-core
Re: [PATCH v5] media: add imx319 camera sensor driver
Hi Bingbu, I love your patch! Yet something to improve: [auto build test ERROR on linuxtv-media/master] [also build test ERROR on v4.19-rc4 next-20180913] [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/bingbu-cao-intel-com/media-add-imx319-camera-sensor-driver/20180917-135744 base: git://linuxtv.org/media_tree.git master config: i386-allmodconfig (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=i386 All errors (new ones prefixed by >>): drivers/media/i2c/imx319.c: In function 'imx319_set_stream': >> drivers/media/i2c/imx319.c:2146:2: error: implicit declaration of function >> '__v4l2_ctrl_grab'; did you mean 'v4l2_ctrl_grab'? >> [-Werror=implicit-function-declaration] __v4l2_ctrl_grab(imx319->vflip, enable); ^~~~ v4l2_ctrl_grab cc1: some warnings being treated as errors vim +2146 drivers/media/i2c/imx319.c 2111 2112 static int imx319_set_stream(struct v4l2_subdev *sd, int enable) 2113 { 2114 struct imx319 *imx319 = to_imx319(sd); 2115 struct i2c_client *client = v4l2_get_subdevdata(sd); 2116 int ret = 0; 2117 2118 mutex_lock(&imx319->mutex); 2119 if (imx319->streaming == enable) { 2120 mutex_unlock(&imx319->mutex); 2121 return 0; 2122 } 2123 2124 if (enable) { 2125 ret = pm_runtime_get_sync(&client->dev); 2126 if (ret < 0) { 2127 pm_runtime_put_noidle(&client->dev); 2128 goto err_unlock; 2129 } 2130 2131 /* 2132 * Apply default & customized values 2133 * and then start streaming. 2134 */ 2135 ret = imx319_start_streaming(imx319); 2136 if (ret) 2137 goto err_rpm_put; 2138 } else { 2139 imx319_stop_streaming(imx319); 2140 pm_runtime_put(&client->dev); 2141 } 2142 2143 imx319->streaming = enable; 2144 2145 /* vflip and hflip cannot change during streaming */ > 2146 __v4l2_ctrl_grab(imx319->vflip, enable); 2147 __v4l2_ctrl_grab(imx319->hflip, enable); 2148 2149 mutex_unlock(&imx319->mutex); 2150 2151 return ret; 2152 2153 err_rpm_put: 2154 pm_runtime_put(&client->dev); 2155 err_unlock: 2156 mutex_unlock(&imx319->mutex); 2157 2158 return ret; 2159 } 2160 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip
Re: [PATCH] media: imx: Skip every second frame in VDIC DIRECT mode
On 05/07/2018 11:54 AM, Hans Verkuil wrote: > On 07/04/18 15:04, Marek Vasut wrote: >> In VDIC direct mode, the VDIC applies combing filter during and >> doubles the framerate, that is, after the first two half-frames >> are received and the first frame is emitted by the VDIC, every >> subsequent half-frame is patched into the result and a full frame >> is produced. The half-frame order in the full frames is as follows >> 12 32 34 54 etc. >> >> Drop every second frame to trim the framerate back to the original >> one of the signal and skip the odd patched frames. >> >> Signed-off-by: Marek Vasut >> Cc: Steve Longerbeam >> Cc: Philipp Zabel > > Steve, Philipp, > > I saw there was a discussion about this patch, but no clear answer whether > or not this patch is OK. If it is, then please Ack this patch. Marking this patch as Obsoleted since I have no seen any activity for a long time. Regards, Hans > > Regards, > > Hans > >> --- >> drivers/staging/media/imx/imx-media-vdic.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/drivers/staging/media/imx/imx-media-vdic.c >> b/drivers/staging/media/imx/imx-media-vdic.c >> index 482250d47e7c..b538bbebedc5 100644 >> --- a/drivers/staging/media/imx/imx-media-vdic.c >> +++ b/drivers/staging/media/imx/imx-media-vdic.c >> @@ -289,6 +289,7 @@ static int vdic_setup_direct(struct vdic_priv *priv) >> /* set VDIC to receive from CSI for direct path */ >> ipu_fsu_link(priv->ipu, IPUV3_CHANNEL_CSI_DIRECT, >> IPUV3_CHANNEL_CSI_VDI_PREV); >> +ipu_set_vdi_skip(priv->ipu, 0x2); >> >> return 0; >> } >> @@ -313,6 +314,8 @@ static int vdic_setup_indirect(struct vdic_priv *priv) >> const struct imx_media_pixfmt *incc; >> int in_size, ret; >> >> +ipu_set_vdi_skip(priv->ipu, 0x0); >> + >> infmt = &priv->format_mbus[VDIC_SINK_PAD_IDMAC]; >> incc = priv->cc[VDIC_SINK_PAD_IDMAC]; >> >> > >
Re: [PATCH] media: staging/imx: Handle CSI->VDIC->PRPVF pipeline
On 05/07/2018 11:55 AM, Hans Verkuil wrote: > On 07/04/18 15:05, Marek Vasut wrote: >> In case the PRPVF is not connected directly to CSI, the PRPVF subdev >> driver won't find the CSI subdev and will not configure the CSI input >> mux. This is not noticable on the IPU1-CSI0 interface with parallel >> camera, since the mux is set "correctly" by default and the parallel >> camera will work just fine. This is however noticable on IPU2-CSI1, >> where the mux is not set to the correct position by default and the >> pipeline will fail. >> >> Add similar code to what is in PRPVF to VDIC driver, so that the VDIC >> can locate the CSI subdev and configure the mux correctly if the CSI >> is connected to the VDIC. Make the PRPVF driver configure the CSI mux >> only in case it's connected directly to CSI and not in case it is >> connected to VDIC. >> >> Signed-off-by: Marek Vasut >> Cc: Philipp Zabel >> Cc: Steve Longerbeam > > Same here, I cannot merge with out Acks since I don't know the details > of the imx hardware. I'm marking this patch as Obsoleted since there has been no activity for a long time. Regards, Hans > > Regards, > > Hans > >> --- >> drivers/staging/media/imx/imx-ic-prp.c | 6 ++ >> drivers/staging/media/imx/imx-media-vdic.c | 24 >> 2 files changed, 26 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/staging/media/imx/imx-ic-prp.c >> b/drivers/staging/media/imx/imx-ic-prp.c >> index 98923fc844ce..84fa66dae21a 100644 >> --- a/drivers/staging/media/imx/imx-ic-prp.c >> +++ b/drivers/staging/media/imx/imx-ic-prp.c >> @@ -72,14 +72,12 @@ static inline struct prp_priv *sd_to_priv(struct >> v4l2_subdev *sd) >> static int prp_start(struct prp_priv *priv) >> { >> struct imx_ic_priv *ic_priv = priv->ic_priv; >> -bool src_is_vdic; >> >> priv->ipu = priv->md->ipu[ic_priv->ipu_id]; >> >> /* set IC to receive from CSI or VDI depending on source */ >> -src_is_vdic = !!(priv->src_sd->grp_id & IMX_MEDIA_GRP_ID_VDIC); >> - >> -ipu_set_ic_src_mux(priv->ipu, priv->csi_id, src_is_vdic); >> +if (!(priv->src_sd->grp_id & IMX_MEDIA_GRP_ID_VDIC)) >> +ipu_set_ic_src_mux(priv->ipu, priv->csi_id, false); >> >> return 0; >> } >> diff --git a/drivers/staging/media/imx/imx-media-vdic.c >> b/drivers/staging/media/imx/imx-media-vdic.c >> index b538bbebedc5..e660911e7024 100644 >> --- a/drivers/staging/media/imx/imx-media-vdic.c >> +++ b/drivers/staging/media/imx/imx-media-vdic.c >> @@ -117,6 +117,9 @@ struct vdic_priv { >> >> bool csi_direct; /* using direct CSI->VDIC->IC pipeline */ >> >> +/* the CSI id at link validate */ >> +int csi_id; >> + >> /* motion select control */ >> struct v4l2_ctrl_handler ctrl_hdlr; >> enum ipu_motion_sel motion; >> @@ -388,6 +391,9 @@ static int vdic_start(struct vdic_priv *priv) >> if (ret) >> return ret; >> >> +/* set IC to receive from CSI or VDI depending on source */ >> +ipu_set_ic_src_mux(priv->ipu, priv->csi_id, true); >> + >> /* >> * init the VDIC. >> * >> @@ -778,6 +784,7 @@ static int vdic_link_validate(struct v4l2_subdev *sd, >>struct v4l2_subdev_format *sink_fmt) >> { >> struct vdic_priv *priv = v4l2_get_subdevdata(sd); >> +struct imx_media_subdev *csi; >> int ret; >> >> ret = v4l2_subdev_link_validate_default(sd, link, >> @@ -785,6 +792,23 @@ static int vdic_link_validate(struct v4l2_subdev *sd, >> if (ret) >> return ret; >> >> +csi = imx_media_find_upstream_subdev(priv->md, priv->src, >> + IMX_MEDIA_GRP_ID_CSI); >> +if (!IS_ERR(csi)) { >> +switch (csi->sd->grp_id) { >> +case IMX_MEDIA_GRP_ID_CSI0: >> +priv->csi_id = 0; >> +break; >> +case IMX_MEDIA_GRP_ID_CSI1: >> +priv->csi_id = 1; >> +break; >> +default: >> +ret = -EINVAL; >> +} >> +} else { >> +priv->csi_id = 0; >> +} >> + >> mutex_lock(&priv->lock); >> >> if (priv->csi_direct && priv->motion != HIGH_MOTION) { >> > >
Re: [PATCH v2 02/14] media: v4l2: taint pads with the signal types for consumer devices
Hi Mauro, I love your patch! Perhaps something to improve: [auto build test WARNING on linuxtv-media/master] [also build test WARNING on v4.19-rc4 next-20180913] [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/Mauro-Carvalho-Chehab/Better-handle-pads-for-tuning-decoder-part-of-the-devices/20180916-233739 base: git://linuxtv.org/media_tree.git master reproduce: make htmldocs All warnings (new ones prefixed by >>): include/net/mac80211.h:977: warning: Function parameter or member 'status.ampdu_len' not described in 'ieee80211_tx_info' include/net/mac80211.h:977: warning: Function parameter or member 'status.antenna' not described in 'ieee80211_tx_info' include/net/mac80211.h:977: warning: Function parameter or member 'status.tx_time' not described in 'ieee80211_tx_info' include/net/mac80211.h:977: warning: Function parameter or member 'status.is_valid_ack_signal' not described in 'ieee80211_tx_info' include/net/mac80211.h:977: warning: Function parameter or member 'status.status_driver_data' not described in 'ieee80211_tx_info' include/net/mac80211.h:977: warning: Function parameter or member 'driver_rates' not described in 'ieee80211_tx_info' include/net/mac80211.h:977: warning: Function parameter or member 'pad' not described in 'ieee80211_tx_info' include/net/mac80211.h:977: warning: Function parameter or member 'rate_driver_data' not described in 'ieee80211_tx_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'rx_stats_avg' not described in 'sta_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'rx_stats_avg.signal' not described in 'sta_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'rx_stats_avg.chain_signal' not described in 'sta_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.filtered' not described in 'sta_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.retry_failed' not described in 'sta_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.retry_count' not described in 'sta_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.lost_packets' not described in 'sta_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.last_tdls_pkt_time' not described in 'sta_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.msdu_retries' not described in 'sta_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.msdu_failed' not described in 'sta_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.last_ack' not described in 'sta_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.last_ack_signal' not described in 'sta_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.ack_signal_filled' not described in 'sta_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'status_stats.avg_ack_signal' not described in 'sta_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'tx_stats.packets' not described in 'sta_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'tx_stats.bytes' not described in 'sta_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'tx_stats.last_rate' not described in 'sta_info' net/mac80211/sta_info.h:588: warning: Function parameter or member 'tx_stats.msdu' not described in 'sta_info' include/linux/mod_devicetable.h:763: warning: Function parameter or member 'driver_data' not described in 'typec_device_id' kernel/sched/fair.c:3371: warning: Function parameter or member 'flags' not described in 'attach_entity_load_avg' arch/x86/include/asm/atomic.h:84: warning: Excess function parameter 'i' description in 'arch_atomic_sub_and_test' arch/x86/include/asm/atomic.h:84: warning: Excess function parameter 'v' description in 'arch_atomic_sub_and_test' arch/x86/include/asm/atomic.h:96: warning: Excess function parameter 'v' description in 'arch_atomic_inc' arch/x86/include/asm/atomic.h:109: warning: Excess function parameter 'v' description in 'arch_atomic_dec' arch/x86/include/asm/atomic.h:124: warning: Excess function parameter 'v' description in 'arch_atomic_dec_and_test' arch/x86/include/asm/atomic.h:138: warning: Excess function parameter 'v' description in 'arch_atomic_inc_and_test' arch/x86/include/asm/atomic.h:153: warning: Excess function parameter 'i' description in 'arch_atomic_add_negative' arch/x86/include/asm/atomic.h:153: warning: Excess function parameter 'v' description in 'arch_atomic_add_negative' include/linux/dma-buf.h:304: warning: Functio
[GIT PULL for 4.20] Ov5640 fixes
Hi Mauro, Here are a bunch of ov5640 fixes and improvements from Jacopo and Hugues. Please pull. The following changes since commit 78cf8c842c111df656c63b5d04997ea4e40ef26a: media: drxj: fix spelling mistake in fall-through annotations (2018-09-12 11:21:52 -0400) are available in the git repository at: ssh://linuxtv.org/git/sailus/media_tree.git tags/for-4.20-5-0 for you to fetch changes up to dc56f982b811f79f66f1d82c9eba519c9aefc649: media: ov5640: fix restore of last mode set (2018-09-16 01:59:25 +0300) ov5640 patches Hugues Fruchet (5): media: ov5640: fix exposure regression media: ov5640: fix auto gain & exposure when changing mode media: ov5640: fix wrong binning value in exposure calculation media: ov5640: fix auto controls values when switching to manual mode media: ov5640: fix restore of last mode set Jacopo Mondi (2): media: ov5640: Re-work MIPI startup sequence media: ov5640: Fix timings setup code drivers/media/i2c/ov5640.c | 275 - 1 file changed, 172 insertions(+), 103 deletions(-) -- Sakari Ailus e-mail: sakari.ai...@iki.fi
[GIT PULL for 4.20] Sensor driver patches for 4.20
Hi Mauro, Here are cleanups for imx274 as well as more or less random fixes for ov2680 and sr030pc30 drivers. Included are patches that add a function in the V4L2 framework to name I²C sensors in case the framework-provided name is not appropriate. The function is used in the smiapp driver now. Please pull. The following changes since commit 78cf8c842c111df656c63b5d04997ea4e40ef26a: media: drxj: fix spelling mistake in fall-through annotations (2018-09-12 11:21:52 -0400) are available in the git repository at: ssh://linuxtv.org/git/sailus/media_tree.git tags/for-4.20-3-0 for you to fetch changes up to 63c9f5d7a8e1c2b01625370db0591c9b673d38a7: media: ov2680: rename ov2680_v4l2_init() to ov2680_v4l2_register() (2018-09-16 01:44:43 +0300) imx274 cleanups and random sensor driver stuff Dan Carpenter (1): media: sr030pc30: remove NULL in sr030pc30_base_config() Javier Martinez Canillas (2): media: ov2680: don't register the v4l2 subdevice before checking chip ID media: ov2680: rename ov2680_v4l2_init() to ov2680_v4l2_register() Luca Ceresoli (7): media: imx274: rename IMX274_DEFAULT_MODE to IMX274_DEFAULT_BINNING media: imx274: rearrange sensor startup register tables media: imx274: don't hard-code the subdev name to DRIVER_NAME media: imx274: rename frmfmt and format to "mode" media: imx274: fix error in function docs media: imx274: add helper to read multibyte registers media: imx274: switch to SPDX license identifier Sakari Ailus (3): v4l: subdev: Add a function to set an I²C sub-device's name smiapp: Use v4l2_i2c_subdev_set_name v4l: sr030pc30: Remove redundant setting of sub-device name drivers/media/i2c/imx274.c | 165 ++--- drivers/media/i2c/ov2680.c | 16 +--- drivers/media/i2c/smiapp/smiapp-core.c | 10 +- drivers/media/i2c/sr030pc30.c | 3 +- drivers/media/v4l2-core/v4l2-common.c | 18 +++- include/media/v4l2-common.h| 12 +++ 6 files changed, 108 insertions(+), 116 deletions(-) -- Sakari Ailus e-mail: sakari.ai...@iki.fi
[GIT PULL for 4.20] Small lens driver fixes
Hi Mauro, Here are two patches for assing maintainers for dw9714 and dw9807 and a small cleanup for the dw9807-vcm driver. Please pull. The following changes since commit 78cf8c842c111df656c63b5d04997ea4e40ef26a: media: drxj: fix spelling mistake in fall-through annotations (2018-09-12 11:21:52 -0400) are available in the git repository at: ssh://linuxtv.org/git/sailus/media_tree.git tags/for-4.20-2-0 for you to fetch changes up to 7e5b31af58cbc946574c36ca4923d5bb7fe01efd: dw9807-vcm: Remove redundant pm_runtime_set_suspended in remove (2018-09-16 01:43:47 +0300) some lens driver patches Sakari Ailus (2): dt-bindings: dw9714, dw9807-vcm: Add files to MAINTAINERS, rename files dw9807-vcm: Remove redundant pm_runtime_set_suspended in remove .../bindings/media/i2c/{dongwoon,dw9807.txt => dongwoon,dw9807-vcm.txt} | 0 MAINTAINERS | 2 ++ drivers/media/i2c/dw9807-vcm.c | 1 - 3 files changed, 2 insertions(+), 1 deletion(-) rename Documentation/devicetree/bindings/media/i2c/{dongwoon,dw9807.txt => dongwoon,dw9807-vcm.txt} (100%) -- Sakari Ailus e-mail: sakari.ai...@iki.fi
Re: [PATCH v5] vb2: check for sane values from queue_setup
On 09/17/2018 10:36 AM, Johan Fjeldtvedt wrote: > Warn and return error from the reqbufs ioctl when driver sets 0 number > of planes or 0 as plane sizes, as these values don't make any sense. > Checking this here stops obviously wrong values from propagating > further and causing various problems that are hard to trace back to > either of these values being 0. > > Signed-off-by: Johan Fjeldtvedt FYI: next time when you post a new version of a patch don't forget to add any Acked-by's or Reviewed-by's that others added to previous versions. I'll add Sakari's Acked-by, so no need for a v6 :-) Regards, Hans > --- > drivers/media/common/videobuf2/videobuf2-core.c | 9 + > 1 file changed, 9 insertions(+) > > diff --git a/drivers/media/common/videobuf2/videobuf2-core.c > b/drivers/media/common/videobuf2/videobuf2-core.c > index f32ec7342ef0..14cedf42e907 100644 > --- a/drivers/media/common/videobuf2/videobuf2-core.c > +++ b/drivers/media/common/videobuf2/videobuf2-core.c > @@ -661,6 +661,7 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory > memory, > { > unsigned int num_buffers, allocated_buffers, num_planes = 0; > unsigned plane_sizes[VB2_MAX_PLANES] = { }; > + unsigned int i; > int ret; > > if (q->streaming) { > @@ -718,6 +719,14 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum > vb2_memory memory, > if (ret) > return ret; > > + /* Check that driver has set sane values */ > + if (WARN_ON(!num_planes)) > + return -EINVAL; > + > + for (i = 0; i < num_planes; i++) > + if (WARN_ON(!plane_sizes[i])) > + return -EINVAL; > + > /* Finally, allocate buffers and video memory */ > allocated_buffers = > __vb2_queue_alloc(q, memory, num_buffers, num_planes, > plane_sizes); >
[PATCH v5] vb2: check for sane values from queue_setup
Warn and return error from the reqbufs ioctl when driver sets 0 number of planes or 0 as plane sizes, as these values don't make any sense. Checking this here stops obviously wrong values from propagating further and causing various problems that are hard to trace back to either of these values being 0. Signed-off-by: Johan Fjeldtvedt --- drivers/media/common/videobuf2/videobuf2-core.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c index f32ec7342ef0..14cedf42e907 100644 --- a/drivers/media/common/videobuf2/videobuf2-core.c +++ b/drivers/media/common/videobuf2/videobuf2-core.c @@ -661,6 +661,7 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory, { unsigned int num_buffers, allocated_buffers, num_planes = 0; unsigned plane_sizes[VB2_MAX_PLANES] = { }; + unsigned int i; int ret; if (q->streaming) { @@ -718,6 +719,14 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory, if (ret) return ret; + /* Check that driver has set sane values */ + if (WARN_ON(!num_planes)) + return -EINVAL; + + for (i = 0; i < num_planes; i++) + if (WARN_ON(!plane_sizes[i])) + return -EINVAL; + /* Finally, allocate buffers and video memory */ allocated_buffers = __vb2_queue_alloc(q, memory, num_buffers, num_planes, plane_sizes); -- 2.17.1
Re: [PATCH v3 0/5] Fix OV5640 exposure & gain
Hi Sakari, thanks for handling this On Sun, Sep 16, 2018 at 02:02:30AM +0300, Sakari Ailus wrote: > Hi Jacopo, Hugues, > > On Fri, Sep 14, 2018 at 06:07:12PM +0200, jacopo mondi wrote: > > Hi Sakari, > > > > On Tue, Sep 11, 2018 at 03:48:16PM +0200, Hugues Fruchet wrote: > > > This patch serie fixes some problems around exposure & gain in OV5640 > > > driver. > > > > As you offered to collect this series and my CSI-2 fixes I have just > > re-sent, you might be interested in this branch: > > > > git://jmondi.org/linux > > engicam-imx6q/media-master/ov5640/csi2_init_v4_exposure_v3 > > > > I have there re-based this series on top of mine, which is in turn > > based on latest media master, where this series do not apply as-is > > afaict. > > > > I have added to Hugues' patches my reviewed-by and tested-by tags. > > If you prefer to I can send you a pull request, or if you want to have > > a chance to review the whole patch list please refer to the above > > branch. > > > > Let me know if I can help speeding up the inclusion of these two > > series as they fix two real issues of MIPI CSI-2 capture operations > > for this sensor. > > I've pushed the patches here: > > https://git.linuxtv.org/sailus/media_tree.git/log/?h=for-4.20-5> > > There was a merge commit and a few extra patches in your tree; I threw them > out. :-) Yeah, those are a few patches I need for my testing platform... Forgot to remove them, hope you didn't spend too much time on this. > > I also edited the commit messages slightly (format; no change in content) > --- the patches are as-is. I'll still check they look right before sending > a pull request, likely on Monday. Thanks, let me now if I can help. Cheers j > > -- > Regards, > > Sakari Ailus > sakari.ai...@linux.intel.com signature.asc Description: PGP signature