[git:media_stage/master] media: bttv: remove crop info from bttv_buffer
This is an automatic generated email to let you know that the following patch were queued: Subject: media: bttv: remove crop info from bttv_buffer Author: Deborah Brouwer Date:Fri Jul 14 19:16:05 2023 -0700 Instead of storing the cropping parameters in each bttv buffer separately, just use the global bttv crop because it won't change per buffer. Signed-off-by: Deborah Brouwer Signed-off-by: Hans Verkuil drivers/media/pci/bt8xx/bttv-driver.c | 10 +- drivers/media/pci/bt8xx/bttv-risc.c | 12 ++-- drivers/media/pci/bt8xx/bttvp.h | 1 - 3 files changed, 11 insertions(+), 12 deletions(-) --- diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c index f32050849691..15825fedb4e0 100644 --- a/drivers/media/pci/bt8xx/bttv-driver.c +++ b/drivers/media/pci/bt8xx/bttv-driver.c @@ -1554,15 +1554,15 @@ static int bttv_prepare_buffer(struct videobuf_queue *q,struct bttv *btv, if (buf->vb.width != width || buf->vb.height != height || buf->vb.field != field || btv->tvnorm != norm || btv->fmt != fmt || - buf->crop.top != c.rect.top || - buf->crop.left != c.rect.left || - buf->crop.width != c.rect.width || - buf->crop.height != c.rect.height) { + btv->crop[!!btv->do_crop].rect.top != c.rect.top || + btv->crop[!!btv->do_crop].rect.left != c.rect.left || + btv->crop[!!btv->do_crop].rect.width != c.rect.width || + btv->crop[!!btv->do_crop].rect.height != c.rect.height) { buf->vb.width = width; buf->vb.height = height; buf->vb.field = field; btv->tvnorm= norm; - buf->crop = c.rect; + btv->crop[!!btv->do_crop].rect = c.rect; redo_dma_risc = 1; } diff --git a/drivers/media/pci/bt8xx/bttv-risc.c b/drivers/media/pci/bt8xx/bttv-risc.c index 0a296dc1a7a5..e9bc6bcc7333 100644 --- a/drivers/media/pci/bt8xx/bttv-risc.c +++ b/drivers/media/pci/bt8xx/bttv-risc.c @@ -620,7 +620,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf) bttv_calc_geo(btv,>geo,buf->vb.width,buf->vb.height, V4L2_FIELD_HAS_BOTH(buf->vb.field), - tvnorm,>crop); + tvnorm, >crop[!!btv->do_crop].rect); switch (buf->vb.field) { case V4L2_FIELD_TOP: @@ -674,7 +674,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf) case V4L2_FIELD_TOP: bttv_calc_geo(btv,>geo,buf->vb.width, buf->vb.height,/* both_fields */ 0, - tvnorm,>crop); + tvnorm, >crop[!!btv->do_crop].rect); bttv_risc_planar(btv, >top, dma->sglist, 0,buf->vb.width,0,buf->vb.height, uoffset, voffset, btv->fmt->hshift, @@ -683,7 +683,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf) case V4L2_FIELD_BOTTOM: bttv_calc_geo(btv,>geo,buf->vb.width, buf->vb.height,0, - tvnorm,>crop); + tvnorm, >crop[!!btv->do_crop].rect); bttv_risc_planar(btv, >bottom, dma->sglist, 0,buf->vb.width,0,buf->vb.height, uoffset, voffset, btv->fmt->hshift, @@ -692,7 +692,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf) case V4L2_FIELD_INTERLACED: bttv_calc_geo(btv,>geo,buf->vb.width, buf->vb.height,1, - tvnorm,>crop); + tvnorm, >crop[!!btv->do_crop].rect); lines= buf->vb.height >> 1; ypadding = buf->vb.width; cpadding = buf->vb.width >> btv->fmt->hshift; @@ -715,7 +715,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf) case V4L2_FIELD_SEQ_TB: bttv_calc_geo(btv,>geo,buf->vb.width, buf->vb.height,1, - tvnorm,>crop); + tvnorm, >crop[!!btv->do_crop].rect); lines= buf->vb.height >> 1; ypadding = buf->vb.width; cpadding = buf->vb.width >> btv->fmt->hshift; @@ -746,7 +746,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf) /* build risc code */ buf->vb.field = V4L2_FIELD_SEQ_TB;
[git:media_stage/master] media: i2c: ds90ub953: Fix use of uninitialized variables
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: ds90ub953: Fix use of uninitialized variables Author: Tomi Valkeinen Date:Thu Aug 3 14:15:46 2023 +0200 smatch reports some uninitialized variables: drivers/media/i2c/ds90ub953.c:655 ub953_log_status() error: uninitialized symbol 'gpio_local_data'. drivers/media/i2c/ds90ub953.c:655 ub953_log_status() error: uninitialized symbol 'gpio_input_ctrl'. drivers/media/i2c/ds90ub953.c:655 ub953_log_status() error: uninitialized symbol 'gpio_pin_sts'. These are used only for printing debug information, and the use of an uninitialized variable only happens if an i2c transaction has failed, which will print an error. Thus, fix the errors just by initializing the variables to 0. Closes: https://lore.kernel.org/all/8d6daeb1-b62a-bbb2-b840-8759c84f2...@xs4all.nl/ Fixes: 6363db1c9d45 ("media: i2c: add DS90UB953 driver") Reported-by: Hans Verkuil Signed-off-by: Tomi Valkeinen Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ds90ub953.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c index d56c1dda89b3..dc394e22a42c 100644 --- a/drivers/media/i2c/ds90ub953.c +++ b/drivers/media/i2c/ds90ub953.c @@ -606,9 +606,9 @@ static int ub953_log_status(struct v4l2_subdev *sd) u8 v = 0, v1 = 0, v2 = 0; unsigned int i; char id[UB953_REG_FPD3_RX_ID_LEN]; - u8 gpio_local_data; - u8 gpio_input_ctrl; - u8 gpio_pin_sts; + u8 gpio_local_data = 0; + u8 gpio_input_ctrl = 0; + u8 gpio_pin_sts = 0; for (i = 0; i < sizeof(id); i++) ub953_read(priv, UB953_REG_FPD3_RX_ID(i), [i]); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: bttv: copy vbi_fmt from bttv_fh
This is an automatic generated email to let you know that the following patch were queued: Subject: media: bttv: copy vbi_fmt from bttv_fh Author: Deborah Brouwer Date:Fri Jul 14 19:16:01 2023 -0700 In preparation for the vb2 conversion, copy the vbi format from struct bttv_fh and add it to the main struct bttv. Use vbi format from struct bttv wherever it will be needed after the vb2 conversion which stops using separate bttv file handles altogether. To avoid changing more code than necessary, just leave the vbi format in separate file handles wherever it will be subsequently removed by vb2. Signed-off-by: Deborah Brouwer Signed-off-by: Hans Verkuil drivers/media/pci/bt8xx/bttv-driver.c | 6 -- drivers/media/pci/bt8xx/bttv-vbi.c| 13 +++-- drivers/media/pci/bt8xx/bttvp.h | 1 + 3 files changed, 12 insertions(+), 8 deletions(-) --- diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c index 7e7658a7ed40..f9a6f671277f 100644 --- a/drivers/media/pci/bt8xx/bttv-driver.c +++ b/drivers/media/pci/bt8xx/bttv-driver.c @@ -672,12 +672,12 @@ int check_alloc_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bit) Claim scan lines crop[].rect.top to bottom. */ btv->crop_start = top; } else if (bit & VBI_RESOURCES) { - __s32 end = fh->vbi_fmt.end; + __s32 end = btv->vbi_fmt.end; if (end > btv->crop_start) goto fail; - /* Claim scan lines above fh->vbi_fmt.end. */ + /* Claim scan lines above btv->vbi_fmt.end. */ btv->vbi_end = end; } @@ -3637,6 +3637,8 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) btv->width = 320; btv->height = 240; btv->input = 0; + btv->tvnorm = 0; /* Index into bttv_tvnorms[] i.e. PAL. */ + bttv_vbi_fmt_reset(>vbi_fmt, btv->tvnorm); v4l2_ctrl_new_std(hdl, _ctrl_ops, V4L2_CID_BRIGHTNESS, 0, 0xff00, 0x100, 32768); diff --git a/drivers/media/pci/bt8xx/bttv-vbi.c b/drivers/media/pci/bt8xx/bttv-vbi.c index 0b05309d1fb7..4e7fd9a78ace 100644 --- a/drivers/media/pci/bt8xx/bttv-vbi.c +++ b/drivers/media/pci/bt8xx/bttv-vbi.c @@ -350,6 +350,9 @@ int bttv_s_fmt_vbi_cap(struct file *file, void *f, struct v4l2_format *frt) fh->vbi_fmt.fmt= frt->fmt.vbi; fh->vbi_fmt.tvnorm = tvnorm; fh->vbi_fmt.end= end; + btv->vbi_fmt.fmt = frt->fmt.vbi; + btv->vbi_fmt.tvnorm = tvnorm; + btv->vbi_fmt.end = end; mutex_unlock(>vbi.vb_lock); @@ -364,15 +367,14 @@ int bttv_s_fmt_vbi_cap(struct file *file, void *f, struct v4l2_format *frt) int bttv_g_fmt_vbi_cap(struct file *file, void *f, struct v4l2_format *frt) { - struct bttv_fh *fh = f; const struct bttv_tvnorm *tvnorm; struct bttv *btv = video_drvdata(file); - frt->fmt.vbi = fh->vbi_fmt.fmt; + frt->fmt.vbi = btv->vbi_fmt.fmt; tvnorm = _tvnorms[btv->tvnorm]; - if (tvnorm != fh->vbi_fmt.tvnorm) { + if (tvnorm != btv->vbi_fmt.tvnorm) { __s32 max_end; unsigned int i; @@ -388,9 +390,8 @@ int bttv_g_fmt_vbi_cap(struct file *file, void *f, struct v4l2_format *frt) for (i = 0; i < 2; ++i) { __s32 new_start; - new_start = frt->fmt.vbi.start[i] - + tvnorm->vbistart[i] - - fh->vbi_fmt.tvnorm->vbistart[i]; + new_start = frt->fmt.vbi.start[i] + tvnorm->vbistart[i] + - btv->vbi_fmt.tvnorm->vbistart[i]; frt->fmt.vbi.start[i] = min(new_start, max_end - 1); frt->fmt.vbi.count[i] = diff --git a/drivers/media/pci/bt8xx/bttvp.h b/drivers/media/pci/bt8xx/bttvp.h index 7f02dd5866d7..a36817dfaaec 100644 --- a/drivers/media/pci/bt8xx/bttvp.h +++ b/drivers/media/pci/bt8xx/bttvp.h @@ -452,6 +452,7 @@ struct bttv { const struct bttv_format *fmt; int width; int height; + struct bttv_vbi_fmt vbi_fmt; /* used to make dvb-bt8xx autoloadable */ struct work_struct request_module_wk; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: bttv: radio use v4l2_fh instead of bttv_fh
This is an automatic generated email to let you know that the following patch were queued: Subject: media: bttv: radio use v4l2_fh instead of bttv_fh Author: Deborah Brouwer Date:Fri Jul 14 19:15:59 2023 -0700 Use a v4l2_fh when opening a radio device instead of a bttv_fh and manage it with v4l2_fh_open() and v4l2_fh_release() and v4l2_ctrl_poll(). This eliminates bttv_fh from the radio in preparation for vb2 conversion which stops using separate bttv file handles altogether. Signed-off-by: Deborah Brouwer Signed-off-by: Hans Verkuil drivers/media/pci/bt8xx/bttv-driver.c | 37 ++- 1 file changed, 10 insertions(+), 27 deletions(-) --- diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c index 6e19d3d35ffb..e59f40dfccc3 100644 --- a/drivers/media/pci/bt8xx/bttv-driver.c +++ b/drivers/media/pci/bt8xx/bttv-driver.c @@ -2740,45 +2740,34 @@ static int radio_open(struct file *file) { struct video_device *vdev = video_devdata(file); struct bttv *btv = video_drvdata(file); - struct bttv_fh *fh; + int ret = v4l2_fh_open(file); - dprintk("open dev=%s\n", video_device_node_name(vdev)); + if (ret) + return ret; + dprintk("open dev=%s\n", video_device_node_name(vdev)); dprintk("%d: open called (radio)\n", btv->c.nr); - /* allocate per filehandle data */ - fh = kmalloc(sizeof(*fh), GFP_KERNEL); - if (unlikely(!fh)) - return -ENOMEM; - file->private_data = fh; - *fh = btv->init; - v4l2_fh_init(>fh, vdev); - btv->radio_user++; audio_mute(btv, btv->mute); - v4l2_fh_add(>fh); - return 0; } static int radio_release(struct file *file) { - struct bttv_fh *fh = file->private_data; struct bttv *btv = video_drvdata(file); struct saa6588_command cmd; - file->private_data = NULL; - v4l2_fh_del(>fh); - v4l2_fh_exit(>fh); - kfree(fh); - btv->radio_user--; bttv_call_all(btv, core, command, SAA6588_CMD_CLOSE, ); if (btv->radio_user == 0) btv->has_radio_tuner = 0; + + v4l2_fh_release(file); + return 0; } @@ -2858,23 +2847,17 @@ static ssize_t radio_read(struct file *file, char __user *data, static __poll_t radio_poll(struct file *file, poll_table *wait) { - struct bttv_fh *fh = file->private_data; struct bttv *btv = video_drvdata(file); - __poll_t req_events = poll_requested_events(wait); struct saa6588_command cmd; - __poll_t res = 0; + __poll_t rc = v4l2_ctrl_poll(file, wait); - if (v4l2_event_pending(>fh)) - res = EPOLLPRI; - else if (req_events & EPOLLPRI) - poll_wait(file, >fh.wait, wait); radio_enable(btv); cmd.instance = file; cmd.event_list = wait; - cmd.poll_mask = res; + cmd.poll_mask = 0; bttv_call_all(btv, core, command, SAA6588_CMD_POLL, ); - return cmd.poll_mask; + return rc | cmd.poll_mask; } static const struct v4l2_file_operations radio_fops = ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: bttv: replace BUG with WARN_ON
This is an automatic generated email to let you know that the following patch were queued: Subject: media: bttv: replace BUG with WARN_ON Author: Deborah Brouwer Date:Fri Jul 14 19:15:58 2023 -0700 Both BUG and BUG_ON are replaced with WARN_ON wherever they would still be present after the vb2 conversion. WARN_ON is sufficient in these cases. Signed-off-by: Deborah Brouwer Signed-off-by: Hans Verkuil drivers/media/pci/bt8xx/bttv-driver.c | 10 +- drivers/media/pci/bt8xx/bttv-risc.c | 8 drivers/media/pci/bt8xx/bttv-vbi.c| 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) --- diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c index 0d5fdb8479d5..6e19d3d35ffb 100644 --- a/drivers/media/pci/bt8xx/bttv-driver.c +++ b/drivers/media/pci/bt8xx/bttv-driver.c @@ -,8 +,8 @@ set_tvnorm(struct bttv *btv, unsigned int norm) const struct bttv_tvnorm *tvnorm; v4l2_std_id id; - BUG_ON(norm >= BTTV_TVNORMS); - BUG_ON(btv->tvnorm >= BTTV_TVNORMS); + WARN_ON(norm >= BTTV_TVNORMS); + WARN_ON(btv->tvnorm >= BTTV_TVNORMS); tvnorm = _tvnorms[norm]; @@ -1910,8 +1910,8 @@ limit_scaled_size_lock (struct bttv_fh * fh, __s32 max_height; int rc; - BUG_ON((int) width_mask >= 0 || - width_bias >= (unsigned int) -width_mask); + WARN_ON((int)width_mask >= 0 || + width_bias >= (unsigned int)(-width_mask)); /* Make sure tvnorm, vbi_end and the current cropping parameters remain consistent until we're done. */ @@ -2026,7 +2026,7 @@ static int bttv_resource(struct bttv_fh *fh) res = RESOURCE_VBI; break; default: - BUG(); + WARN_ON(1); } return res; } diff --git a/drivers/media/pci/bt8xx/bttv-risc.c b/drivers/media/pci/bt8xx/bttv-risc.c index 4fa4b9da9634..fae8b10de7a9 100644 --- a/drivers/media/pci/bt8xx/bttv-risc.c +++ b/drivers/media/pci/bt8xx/bttv-risc.c @@ -106,7 +106,7 @@ bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc, /* save pointer to jmp instruction address */ risc->jmp = rp; - BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size); + WARN_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size); return 0; } @@ -227,7 +227,7 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc, /* save pointer to jmp instruction address */ risc->jmp = rp; - BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size); + WARN_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size); return 0; } @@ -646,7 +646,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf) bpf,bpl,0,0,buf->vb.height >> 1); break; default: - BUG(); + WARN_ON(1); } } @@ -737,7 +737,7 @@ bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf) 0); break; default: - BUG(); + WARN_ON(1); } } diff --git a/drivers/media/pci/bt8xx/bttv-vbi.c b/drivers/media/pci/bt8xx/bttv-vbi.c index 24b28a05bfd9..0b05309d1fb7 100644 --- a/drivers/media/pci/bt8xx/bttv-vbi.c +++ b/drivers/media/pci/bt8xx/bttv-vbi.c @@ -250,7 +250,7 @@ static int try_fmt(struct v4l2_vbi_format *f, const struct bttv_tvnorm *tvnorm, if (min_start > max_start) return -EBUSY; - BUG_ON(max_start >= max_end); + WARN_ON(max_start >= max_end); f->sampling_rate= tvnorm->Fsc; f->samples_per_line = VBI_BPL; @@ -430,8 +430,8 @@ void bttv_vbi_fmt_reset(struct bttv_vbi_fmt *f, unsigned int norm) real_count = ((tvnorm->cropcap.defrect.top >> 1) - tvnorm->vbistart[0]); - BUG_ON(real_samples_per_line > VBI_BPL); - BUG_ON(real_count > VBI_DEFLINES); + WARN_ON(real_samples_per_line > VBI_BPL); + WARN_ON(real_count > VBI_DEFLINES); f->tvnorm = tvnorm; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ipu-bridge: Add link-frequency to OV2680 ipu_supported_sensors[] entry
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ipu-bridge: Add link-frequency to OV2680 ipu_supported_sensors[] entry Author: Hans de Goede Date:Thu Aug 3 11:33:46 2023 +0200 Now that the ov2680 driver verifies the bus-cfg from the endpoint fwnode the link-frequency must be set for things to work. Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu-bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index 5000d7a1d688..1bde8b6e0b11 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -49,7 +49,7 @@ static const struct ipu_sensor_config ipu_supported_sensors[] = { /* Omnivision OV7251 */ IPU_SENSOR_CONFIG("INT347E", 1, 31920), /* Omnivision OV2680 */ - IPU_SENSOR_CONFIG("OVTI2680", 0), + IPU_SENSOR_CONFIG("OVTI2680", 1, 33120), /* Omnivision ov8856 */ IPU_SENSOR_CONFIG("OVTI8856", 3, 18000, 36000, 72000), /* Omnivision ov2740 */ ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: bttv: move do_crop flag out of bttv_fh
This is an automatic generated email to let you know that the following patch were queued: Subject: media: bttv: move do_crop flag out of bttv_fh Author: Deborah Brouwer Date:Fri Jul 14 19:16:02 2023 -0700 The do_crop flag indicates whether a cropping rectangle has been set. Instead of storing this flag separately in each file handle, move do_crop to struct bttv in preparation for vb2 conversion which stops using separate bttv file handles. Signed-off-by: Deborah Brouwer Signed-off-by: Hans Verkuil drivers/media/pci/bt8xx/bttv-driver.c | 24 +--- drivers/media/pci/bt8xx/bttvp.h | 5 ++--- 2 files changed, 11 insertions(+), 18 deletions(-) --- diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c index f9a6f671277f..af295ce3e9f0 100644 --- a/drivers/media/pci/bt8xx/bttv-driver.c +++ b/drivers/media/pci/bt8xx/bttv-driver.c @@ -663,7 +663,7 @@ int check_alloc_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bit) if ((bit & VIDEO_RESOURCES) && 0 == (btv->resources & VIDEO_RESOURCES)) { /* Do crop - use current, don't - use default parameters. */ - __s32 top = btv->crop[!!fh->do_crop].rect.top; + __s32 top = btv->crop[!!btv->do_crop].rect.top; if (btv->vbi_end > top) goto fail; @@ -1493,7 +1493,6 @@ static int bttv_prepare_buffer(struct videobuf_queue *q,struct bttv *btv, unsigned int width, unsigned int height, enum v4l2_field field) { - struct bttv_fh *fh = q->priv_data; int redo_dma_risc = 0; struct bttv_crop c; int norm; @@ -1523,7 +1522,7 @@ static int bttv_prepare_buffer(struct videobuf_queue *q,struct bttv *btv, c.rect = bttv_tvnorms[norm].cropcap.defrect; } else { norm = btv->tvnorm; - c = btv->crop[!!fh->do_crop]; + c = btv->crop[!!btv->do_crop]; if (width < c.min_scaled_width || width > c.max_scaled_width || @@ -1919,9 +1918,9 @@ limit_scaled_size_lock (struct bttv_fh * fh, b = _tvnorms[btv->tvnorm].cropcap.bounds; /* Do crop - use current, don't - use default parameters. */ - c = >crop[!!fh->do_crop]; + c = >crop[!!btv->do_crop]; - if (fh->do_crop + if (btv->do_crop && adjust_size && adjust_crop && !locked_btres(btv, VIDEO_RESOURCES)) { @@ -2121,7 +2120,7 @@ static int bttv_try_fmt_vid_cap(struct file *file, void *priv, } fallthrough; default: /* FIELD_ANY case */ - height2 = btv->crop[!!fh->do_crop].rect.height >> 1; + height2 = btv->crop[!!btv->do_crop].rect.height >> 1; field = (f->fmt.pix.height > height2) ? V4L2_FIELD_INTERLACED : V4L2_FIELD_BOTTOM; @@ -2360,7 +2359,6 @@ static int bttv_g_pixelaspect(struct file *file, void *priv, static int bttv_g_selection(struct file *file, void *f, struct v4l2_selection *sel) { - struct bttv_fh *fh = f; struct bttv *btv = video_drvdata(file); if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) @@ -2368,12 +2366,7 @@ static int bttv_g_selection(struct file *file, void *f, struct v4l2_selection *s switch (sel->target) { case V4L2_SEL_TGT_CROP: - /* -* No fh->do_crop = 1; because btv->crop[1] may be -* inconsistent with fh->width or fh->height and apps -* do not expect a change here. -*/ - sel->r = btv->crop[!!fh->do_crop].rect; + sel->r = btv->crop[!!btv->do_crop].rect; break; case V4L2_SEL_TGT_CROP_DEFAULT: sel->r = bttv_tvnorms[btv->tvnorm].cropcap.defrect; @@ -2447,7 +2440,7 @@ static int bttv_s_selection(struct file *file, void *f, struct v4l2_selection *s btv->crop[1] = c; - fh->do_crop = 1; + btv->do_crop = 1; if (btv->width < c.min_scaled_width) btv->width = c.min_scaled_width; @@ -2610,7 +2603,7 @@ static int bttv_open(struct file *file) current video standard, and VIDIOC_S_FMT will not implicitly change the cropping parameters until VIDIOC_S_SELECTION has been called. */ - fh->do_crop = !reset_crop; /* module parameter */ + btv->do_crop = !reset_crop; /* module parameter */ /* Likewise there should be one global set of VBI capture parameters, but for compatibility with V4L apps and earlier @@ -3639,6 +3632,7 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) btv->input = 0; btv->tvnorm = 0; /* Index into bttv_tvnorms[] i.e. PAL. */ bttv_vbi_fmt_reset(>vbi_fmt, btv->tvnorm); +
[git:media_stage/master] media: bttv: refactor bttv_set_dma()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: bttv: refactor bttv_set_dma() Author: Deborah Brouwer Date:Fri Jul 14 19:16:07 2023 -0700 Break bttv_set_dma() into several smaller, separate functions so it is easier to read the risc and dma code. Replace numeric values with descriptive macros. Also remove the unused field btv->cap_ctl. Signed-off-by: Deborah Brouwer Signed-off-by: Hans Verkuil drivers/media/pci/bt8xx/bttv-risc.c | 111 +++- drivers/media/pci/bt8xx/bttvp.h | 1 - 2 files changed, 71 insertions(+), 41 deletions(-) --- diff --git a/drivers/media/pci/bt8xx/bttv-risc.c b/drivers/media/pci/bt8xx/bttv-risc.c index 97248e340a28..3e0dac56de54 100644 --- a/drivers/media/pci/bt8xx/bttv-risc.c +++ b/drivers/media/pci/bt8xx/bttv-risc.c @@ -360,21 +360,80 @@ bttv_apply_geo(struct bttv *btv, struct bttv_geometry *geo, int odd) /* -- */ /* risc group / risc main loop / dma management */ -void -bttv_set_dma(struct bttv *btv, int override) +static void bttv_set_risc_status(struct bttv *btv) { - unsigned long cmd; - int capctl; + unsigned long cmd = BT848_RISC_JUMP; + /* +* The value of btv->loop_irq sets or resets the RISC_STATUS for video +* and/or vbi by setting the value of bits [23:16] in the first dword +* of the JUMP instruction: +* video risc: set (1) and reset (~1) +* vbi risc: set(4) and reset (~4) +*/ + if (btv->loop_irq) { + cmd |= BT848_RISC_IRQ; + cmd |= (btv->loop_irq & 0x0f) << 16; + cmd |= (~btv->loop_irq & 0x0f) << 20; + } + btv->main.cpu[RISC_SLOT_LOOP] = cpu_to_le32(cmd); +} + +static void bttv_set_irq_timer(struct bttv *btv) +{ + if (btv->curr.frame_irq || btv->loop_irq || btv->cvbi) + mod_timer(>timeout, jiffies + BTTV_TIMEOUT); + else + del_timer(>timeout); +} + +static int bttv_set_capture_control(struct bttv *btv, int start_capture) +{ + int capctl = 0; + + if (btv->curr.top || btv->curr.bottom) + capctl = BT848_CAP_CTL_CAPTURE_ODD | +BT848_CAP_CTL_CAPTURE_EVEN; + + if (btv->cvbi) + capctl |= BT848_CAP_CTL_CAPTURE_VBI_ODD | + BT848_CAP_CTL_CAPTURE_VBI_EVEN; + + capctl |= start_capture; + + btaor(capctl, ~0x0f, BT848_CAP_CTL); + + return capctl; +} + +static void bttv_start_dma(struct bttv *btv) +{ + if (btv->dma_on) + return; + btwrite(btv->main.dma, BT848_RISC_STRT_ADD); + btor(0x3, BT848_GPIO_DMA_CTL); + btv->dma_on = 1; +} + +static void bttv_stop_dma(struct bttv *btv) +{ + if (!btv->dma_on) + return; + btand(~0x3, BT848_GPIO_DMA_CTL); + btv->dma_on = 0; +} + +void bttv_set_dma(struct bttv *btv, int start_capture) +{ + int capctl = 0; - btv->cap_ctl = 0; - if (NULL != btv->curr.top) btv->cap_ctl |= 0x02; - if (NULL != btv->curr.bottom) btv->cap_ctl |= 0x01; - if (NULL != btv->cvbi) btv->cap_ctl |= 0x0c; + bttv_set_risc_status(btv); + bttv_set_irq_timer(btv); + capctl = bttv_set_capture_control(btv, start_capture); - capctl = 0; - capctl |= (btv->cap_ctl & 0x03) ? 0x03 : 0x00; /* capture */ - capctl |= (btv->cap_ctl & 0x0c) ? 0x0c : 0x00; /* vbi data */ - capctl |= override; + if (capctl) + bttv_start_dma(btv); + else + bttv_stop_dma(btv); d2printk("%d: capctl=%x lirq=%d top=%08llx/%08llx even=%08llx/%08llx\n", btv->c.nr,capctl,btv->loop_irq, @@ -382,34 +441,6 @@ bttv_set_dma(struct bttv *btv, int override) btv->curr.top ? (unsigned long long)btv->curr.top->top.dma : 0, btv->cvbi ? (unsigned long long)btv->cvbi->bottom.dma : 0, btv->curr.bottom ? (unsigned long long)btv->curr.bottom->bottom.dma : 0); - - cmd = BT848_RISC_JUMP; - if (btv->loop_irq) { - cmd |= BT848_RISC_IRQ; - cmd |= (btv->loop_irq & 0x0f) << 16; - cmd |= (~btv->loop_irq & 0x0f) << 20; - } - if (btv->curr.frame_irq || btv->loop_irq || btv->cvbi) { - mod_timer(>timeout, jiffies+BTTV_TIMEOUT); - } else { - del_timer(>timeout); - } - btv->main.cpu[RISC_SLOT_LOOP] = cpu_to_le32(cmd); - - btaor(capctl, ~0x0f, BT848_CAP_CTL); - if (capctl) { - if (btv->dma_on) - return; - btwrite(btv->main.dma, BT848_RISC_STRT_ADD); - btor(3, BT848_GPIO_DMA_CTL); - btv->dma_on = 1; - } else { - if (!btv->dma_on) - return;
[git:media_stage/master] media: davinci: vpif_capture: fix error return code in vpif_probe()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: davinci: vpif_capture: fix error return code in vpif_probe() Author: Yang Yingliang Date:Thu Aug 3 04:18:35 2023 +0200 Set error return code, when get platform data failed. Fixes: b4a4547371b9 ("media: davinci: Init async notifier after registering V4L2 device") Signed-off-by: Yang Yingliang Reviewed-by: Lad Prabhakar Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/ti/davinci/vpif_capture.c | 1 + 1 file changed, 1 insertion(+) --- diff --git a/drivers/media/platform/ti/davinci/vpif_capture.c b/drivers/media/platform/ti/davinci/vpif_capture.c index bf5330b6fcd5..99fae8830c41 100644 --- a/drivers/media/platform/ti/davinci/vpif_capture.c +++ b/drivers/media/platform/ti/davinci/vpif_capture.c @@ -1644,6 +1644,7 @@ static __init int vpif_probe(struct platform_device *pdev) pdev->dev.platform_data = vpif_capture_get_pdata(pdev, _obj.v4l2_dev); if (!pdev->dev.platform_data) { + err = -EINVAL; dev_warn(>dev, "Missing platform data. Giving up.\n"); goto vpif_unregister; } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: atomisp: csi2-bridge: Add dev_name() to acpi_handle_info() logging
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atomisp: csi2-bridge: Add dev_name() to acpi_handle_info() logging Author: Hans de Goede Date:Wed Jul 5 23:30:09 2023 +0200 acpi_handle_info() uses the ACPI path to the handle as prefix for messages e.g. : "\_SB_.I2C2.CAM8". This makes it hard for users to figure out which csi2-bridge messages belong to which sensor since the actual sensor drivers uses the ACPI device name (typically "HID:00") for logging. Extend the acpi_handle_info() (and err and warn) logging to also log the device name to make it easier to match csi2-bridge messages with sensor driver log messages. Suggested-by: Sakari Ailus Signed-off-by: Hans de Goede Reviewed-by: Andy Shevchenko Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab .../media/atomisp/pci/atomisp_csi2_bridge.c| 51 ++ 1 file changed, 34 insertions(+), 17 deletions(-) --- diff --git a/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c b/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c index df625ac2c779..e362cc9ba985 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c +++ b/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c @@ -131,7 +131,8 @@ static char *gmin_cfg_get_dsm(struct acpi_device *adev, const char *key) if (!val) break; - acpi_handle_info(adev->handle, "Using DSM entry %s=%s\n", key, val); + acpi_handle_info(adev->handle, "%s: Using DSM entry %s=%s\n", +dev_name(>dev), key, val); break; } } @@ -156,7 +157,8 @@ static char *gmin_cfg_get_dmi_override(struct acpi_device *adev, const char *key if (strcmp(key, gv->key)) continue; - acpi_handle_info(adev->handle, "Using DMI entry %s=%s\n", key, gv->val); + acpi_handle_info(adev->handle, "%s: Using DMI entry %s=%s\n", +dev_name(>dev), key, gv->val); return kstrdup(gv->val, GFP_KERNEL); } @@ -192,7 +194,8 @@ static int gmin_cfg_get_int(struct acpi_device *adev, const char *key, int defau return int_val; out_use_default: - acpi_handle_info(adev->handle, "Using default %s=%d\n", key, default_val); + acpi_handle_info(adev->handle, "%s: Using default %s=%d\n", +dev_name(>dev), key, default_val); return default_val; } @@ -235,7 +238,8 @@ static int atomisp_csi2_get_pmc_clk_nr_from_acpi_pr0(struct acpi_device *adev) ACPI_FREE(buffer.pointer); if (ret < 0) - acpi_handle_warn(adev->handle, "Could not find PMC clk in _PR0\n"); + acpi_handle_warn(adev->handle, "%s: Could not find PMC clk in _PR0\n", +dev_name(>dev)); return ret; } @@ -254,7 +258,8 @@ static int atomisp_csi2_set_pmc_clk_freq(struct acpi_device *adev, int clock_num clk = clk_get(NULL, name); if (IS_ERR(clk)) { ret = PTR_ERR(clk); - acpi_handle_err(adev->handle, "Error getting clk %s:%d\n", name, ret); + acpi_handle_err(adev->handle, "%s: Error getting clk %s: %d\n", + dev_name(>dev), name, ret); return ret; } @@ -268,7 +273,8 @@ static int atomisp_csi2_set_pmc_clk_freq(struct acpi_device *adev, int clock_num if (!ret) ret = clk_set_rate(clk, PMC_CLK_RATE_19_2MHZ); if (ret) - acpi_handle_err(adev->handle, "Error setting clk-rate for %s:%d\n", name, ret); + acpi_handle_err(adev->handle, "%s: Error setting clk-rate for %s: %d\n", + dev_name(>dev), name, ret); clk_put(clk); return ret; @@ -317,7 +323,8 @@ static int atomisp_csi2_handle_acpi_gpio_res(struct acpi_resource *ares, void *_ if (i == data->settings_count) { acpi_handle_warn(data->adev->handle, -"Could not find DSM GPIO settings for pin %u\n", pin); +"%s: Could not find DSM GPIO settings for pin %u\n", +dev_name(>adev->dev), pin); return 1; } @@ -329,7 +336,8 @@ static int atomisp_csi2_handle_acpi_gpio_res(struct acpi_resource *ares, void *_ name = "powerdown-gpios"; break; default: - acpi_handle_warn(data->adev->handle, "Unknown GPIO type 0x%02lx
[git:media_stage/master] media: camif-core: Do not check for 0 return after calling platform_get_irq()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: camif-core: Do not check for 0 return after calling platform_get_irq() Author: Ruan Jinjie Date:Thu Aug 3 04:46:44 2023 +0200 It is not possible for platform_get_irq() to return 0. Use the return value from platform_get_irq(). Signed-off-by: Ruan Jinjie Reviewed-by: Andrzej Pietrasiewicz Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/samsung/s3c-camif/camif-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- diff --git a/drivers/media/platform/samsung/s3c-camif/camif-core.c b/drivers/media/platform/samsung/s3c-camif/camif-core.c index afe1fcc37354..e4529f666e20 100644 --- a/drivers/media/platform/samsung/s3c-camif/camif-core.c +++ b/drivers/media/platform/samsung/s3c-camif/camif-core.c @@ -381,8 +381,8 @@ static int camif_request_irqs(struct platform_device *pdev, init_waitqueue_head(>irq_queue); irq = platform_get_irq(pdev, i); - if (irq <= 0) - return -ENXIO; + if (irq < 0) + return irq; ret = devm_request_irq(>dev, irq, s3c_camif_irq_handler, 0, dev_name(>dev), vp); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: verisilicon: Do not check for 0 return after calling platform_get_irq()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: verisilicon: Do not check for 0 return after calling platform_get_irq() Author: Ruan Jinjie Date:Thu Aug 3 04:46:45 2023 +0200 It is not possible for platform_get_irq() or platform_get_irq_byname() to return 0. Use the return value from platform_get_irq() or platform_get_irq_byname(). Signed-off-by: Ruan Jinjie Reviewed-by: Andrzej Pietrasiewicz Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/verisilicon/hantro_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c index 35ca71b19def..423fc85d79ee 100644 --- a/drivers/media/platform/verisilicon/hantro_drv.c +++ b/drivers/media/platform/verisilicon/hantro_drv.c @@ -1085,8 +1085,8 @@ static int hantro_probe(struct platform_device *pdev) irq_name = "default"; irq = platform_get_irq(vpu->pdev, 0); } - if (irq <= 0) - return -ENXIO; + if (irq < 0) + return irq; ret = devm_request_irq(vpu->dev, irq, vpu->variant->irqs[i].handler, 0, ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: i2c: Add driver for DW9719 VCM
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: Add driver for DW9719 VCM Author: Daniel Scally Date:Sat Jul 8 16:52:14 2023 +0200 Add a driver for the DW9719 VCM. The driver creates a v4l2 subdevice and registers a control to set the desired focus. Reviewed-by: Andy Shevchenko Signed-off-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/Kconfig| 1 + drivers/media/pci/intel/Makefile | 1 + drivers/media/pci/intel/ivsc/Kconfig | 12 + drivers/media/pci/intel/ivsc/Makefile | 6 + drivers/media/pci/intel/ivsc/mei_csi.c | 825 + 5 files changed, 845 insertions(+) --- diff --git a/drivers/media/pci/intel/Kconfig b/drivers/media/pci/intel/Kconfig index 51b18fce6a1d..e113902fa806 100644 --- a/drivers/media/pci/intel/Kconfig +++ b/drivers/media/pci/intel/Kconfig @@ -8,3 +8,4 @@ config IPU_BRIDGE dependencies, this is selected by each driver that needs it. source "drivers/media/pci/intel/ipu3/Kconfig" +source "drivers/media/pci/intel/ivsc/Kconfig" diff --git a/drivers/media/pci/intel/Makefile b/drivers/media/pci/intel/Makefile index 951191a7e401..f199a97e1d78 100644 --- a/drivers/media/pci/intel/Makefile +++ b/drivers/media/pci/intel/Makefile @@ -4,3 +4,4 @@ # obj-$(CONFIG_IPU_BRIDGE) += ipu-bridge.o obj-y += ipu3/ +obj-y += ivsc/ diff --git a/drivers/media/pci/intel/ivsc/Kconfig b/drivers/media/pci/intel/ivsc/Kconfig new file mode 100644 index ..9535ac10f4f7 --- /dev/null +++ b/drivers/media/pci/intel/ivsc/Kconfig @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-only +# Copyright (C) 2023, Intel Corporation. All rights reserved. + +config INTEL_VSC + tristate "Intel Visual Sensing Controller" + depends on INTEL_MEI + help + This adds support for Intel Visual Sensing Controller (IVSC). + + Enables the IVSC firmware services required for controlling + camera sensor ownership and CSI-2 link through Image Processing + Unit(IPU) driver of Intel. diff --git a/drivers/media/pci/intel/ivsc/Makefile b/drivers/media/pci/intel/ivsc/Makefile new file mode 100644 index ..cbd194a26f03 --- /dev/null +++ b/drivers/media/pci/intel/ivsc/Makefile @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2023, Intel Corporation. All rights reserved. + +obj-$(CONFIG_INTEL_VSC) += ivsc-csi.o +ivsc-csi-y += mei_csi.o diff --git a/drivers/media/pci/intel/ivsc/mei_csi.c b/drivers/media/pci/intel/ivsc/mei_csi.c new file mode 100644 index ..00ba611e0f68 --- /dev/null +++ b/drivers/media/pci/intel/ivsc/mei_csi.c @@ -0,0 +1,825 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2023 Intel Corporation. All rights reserved. + * Intel Visual Sensing Controller CSI Linux driver + */ + +/* + * To set ownership of CSI-2 link and to configure CSI-2 link, there + * are specific commands, which are sent via MEI protocol. The send + * command function uses "completion" as a synchronization mechanism. + * The response for command is received via a mei callback which wakes + * up the caller. There can be only one outstanding command at a time. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define MEI_CSI_DRIVER_NAME "ivsc_csi" +#define MEI_CSI_ENTITY_NAME "Intel IVSC CSI" + +#define MEI_CSI_LINK_FREQ_400MHZ 4ULL + +/* the 5s used here is based on experiment */ +#define CSI_CMD_TIMEOUT (5 * HZ) +/* to setup CSI-2 link an extra delay needed and determined experimentally */ +#define CSI_FW_READY_DELAY_MS 100 +/* link frequency unit is 100kHz */ +#define CSI_LINK_FREQ(x) ((u32)(div_u64(x, 100 * HZ_PER_KHZ))) + +/* + * identify the command id supported by firmware + * IPC, as well as the privacy notification id + * used when processing privacy event. + */ +enum csi_cmd_id { + /* used to set csi ownership */ + CSI_SET_OWNER = 0, + + /* used to configure CSI-2 link */ + CSI_SET_CONF = 2, + + /* privacy notification id used when privacy state changes */ + CSI_PRIVACY_NOTIF = 6, +}; + +/* CSI-2 link ownership definition */ +enum csi_link_owner { + CSI_LINK_IVSC, + CSI_LINK_HOST, +}; + +/* privacy status definition */ +enum ivsc_privacy_status { + CSI_PRIVACY_OFF, + CSI_PRIVACY_ON, + CSI_PRIVACY_MAX, +}; + +enum csi_pads { + CSI_PAD_SOURCE, + CSI_PAD_SINK, + CSI_NUM_PADS +}; + +/* configuration of the CSI-2 link between host and IVSC */ +struct csi_link_cfg { + /* number of data lanes used on the CSI-2 link */ + u32 nr_of_lanes; + + /* frequency of the CSI-2 link */ + u32 link_freq; + +
[git:media_stage/master] media: pci: intel: ivsc: Add ACE submodule
This is an automatic generated email to let you know that the following patch were queued: Subject: media: pci: intel: ivsc: Add ACE submodule Author: Wentong Wu Date:Sat Jul 29 13:52:54 2023 +0200 ACE is a submodule of IVSC which controls camera sensor's ownership, belonging to host or IVSC. When IVSC owns camera sensor, it is for algorithm computing. When host wants to control camera sensor, ACE module needs to be informed of ownership with defined interface. The interface is via MEI. There is a separate MEI UUID, which this driver uses to enumerate. To switch ownership of camera sensor between IVSC and host, the caller specifies the defined ownership information which will be sent to firmware by sending MEI command. Device link(device_link_add) is used to set the right camera sensor ownership before accessing the sensor via I2C. With DL_FLAG_PM_RUNTIME and DL_FLAG_RPM_ACTIVE, the supplier device will be PM runtime resumed before the consumer(camera sensor). So use runtime PM callbacks to transfer the ownership between host and IVSC. Signed-off-by: Wentong Wu Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ivsc/Makefile | 3 + drivers/media/pci/intel/ivsc/mei_ace.c | 579 + 2 files changed, 582 insertions(+) --- diff --git a/drivers/media/pci/intel/ivsc/Makefile b/drivers/media/pci/intel/ivsc/Makefile index cbd194a26f03..00fad29a6e6e 100644 --- a/drivers/media/pci/intel/ivsc/Makefile +++ b/drivers/media/pci/intel/ivsc/Makefile @@ -4,3 +4,6 @@ obj-$(CONFIG_INTEL_VSC) += ivsc-csi.o ivsc-csi-y += mei_csi.o + +obj-$(CONFIG_INTEL_VSC) += ivsc-ace.o +ivsc-ace-y += mei_ace.o diff --git a/drivers/media/pci/intel/ivsc/mei_ace.c b/drivers/media/pci/intel/ivsc/mei_ace.c new file mode 100644 index ..a0491f307831 --- /dev/null +++ b/drivers/media/pci/intel/ivsc/mei_ace.c @@ -0,0 +1,579 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2023 Intel Corporation. All rights reserved. + * Intel Visual Sensing Controller ACE Linux driver + */ + +/* + * To set ownership of camera sensor, there is specific command, which + * is sent via MEI protocol. That's a two-step scheme where the firmware + * first acks receipt of the command and later responses the command was + * executed. The command sending function uses "completion" as the + * synchronization mechanism. The notification for command is received + * via a mei callback which wakes up the caller. There can be only one + * outstanding command at a time. + * + * The power line of camera sensor is directly connected to IVSC instead + * of host, when camera sensor ownership is switched to host, sensor is + * already powered up by firmware. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#defineMEI_ACE_DRIVER_NAME "ivsc_ace" + +/* indicating driver message */ +#defineACE_DRV_MSG 1 +/* indicating set command */ +#defineACE_CMD_SET 4 +/* command timeout determined experimentally */ +#defineACE_CMD_TIMEOUT (5 * HZ) +/* indicating the first command block */ +#defineACE_CMD_INIT_BLOCK 1 +/* indicating the last command block */ +#defineACE_CMD_FINAL_BLOCK 1 +/* size of camera status notification content */ +#defineACE_CAMERA_STATUS_SIZE 5 + +/* UUID used to get firmware id */ +#define ACE_GET_FW_ID_UUID UUID_LE(0x6167DCFB, 0x72F1, 0x4584, 0xBF, \ + 0xE3, 0x84, 0x17, 0x71, 0xAA, 0x79, 0x0B) + +/* UUID used to get csi device */ +#define MEI_CSI_UUID UUID_LE(0x92335FCF, 0x3203, 0x4472, \ +0xAF, 0x93, 0x7b, 0x44, 0x53, 0xAC, 0x29, 0xDA) + +/* identify firmware event type */ +enum ace_event_type { + /* firmware ready */ + ACE_FW_READY = 0x8, + + /* command response */ + ACE_CMD_RESPONSE = 0x10, +}; + +/* identify camera sensor ownership */ +enum ace_camera_owner { + ACE_CAMERA_IVSC, + ACE_CAMERA_HOST, +}; + +/* identify the command id supported by firmware IPC */ +enum ace_cmd_id { + /* used to switch camera sensor to host */ + ACE_SWITCH_CAMERA_TO_HOST = 0x13, + + /* used to switch camera sensor to IVSC */ + ACE_SWITCH_CAMERA_TO_IVSC = 0x14, + + /* used to get firmware id */ + ACE_GET_FW_ID = 0x1A, +}; + +/* ACE command header structure */ +struct ace_cmd_hdr { + u32 firmware_id : 16; + u32 instance_id : 8; + u32 type : 5; + u32 rsp : 1; + u32 msg_tgt : 1; + u32 _hw_rsvd_1 : 1; + u32 param_size : 20; + u32 cmd_id : 8; + u32 final_block : 1; + u32 init_block : 1; + u32 _hw_rsvd_2 : 2; +} __packed; + +/* ACE command parameter structure */ +union ace_cmd_param { + uuid_le uuid; + u32 param; +}; + +/* ACE command structure */ +struct ace_cmd { +
[git:media_stage/master] media: atomisp: csi2-bridge: Add support for VCM I2C-client instantiation
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atomisp: csi2-bridge: Add support for VCM I2C-client instantiation Author: Hans de Goede Date:Wed Jul 5 23:30:10 2023 +0200 Fill sensor->vcm_type and call intel_cio2_bridge_instantiate_vcm() from the v4l2-async bound op so that an I2C-client will be instatiated for the VCM. Note unfortunately on atomisp the _DSM to get the VCM type sometimes returns a VCM even though there is none. Since VCMs are typically only used together with certain sensors, work around this by adding a vcm field to atomisp_sensor_config and only check for a VCM when that is set. Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab .../media/atomisp/pci/atomisp_csi2_bridge.c| 44 +- 1 file changed, 42 insertions(+), 2 deletions(-) --- diff --git a/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c b/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c index e362cc9ba985..03940c11505f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c +++ b/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c @@ -66,15 +66,25 @@ static const guid_t atomisp_dsm_guid = GUID_INIT(0xdc2f6c4f, 0x045b, 0x4f1d, 0x97, 0xb9, 0x88, 0x2a, 0x68, 0x60, 0xa4, 0xbe); +/* + * 75c9a639-5c8a-4a00-9f48-a9c3b5da789f + * This _DSM GUID returns a string giving the VCM type e.g. "AD5823". + */ +static const guid_t vcm_dsm_guid = + GUID_INIT(0x75c9a639, 0x5c8a, 0x4a00, + 0x9f, 0x48, 0xa9, 0xc3, 0xb5, 0xda, 0x78, 0x9f); + struct atomisp_sensor_config { int lanes; + bool vcm; }; -#define ATOMISP_SENSOR_CONFIG(_HID, _LANES)\ +#define ATOMISP_SENSOR_CONFIG(_HID, _LANES, _VCM) \ { \ .id = _HID, \ .driver_data = (long)&((const struct atomisp_sensor_config) { \ .lanes = _LANES,\ + .vcm = _VCM,\ }) \ } @@ -490,8 +500,28 @@ static int atomisp_csi2_add_gpio_mappings(struct acpi_device *adev) return ret; } +static char *atomisp_csi2_get_vcm_type(struct acpi_device *adev) +{ + union acpi_object *obj; + char *vcm_type; + + obj = acpi_evaluate_dsm_typed(adev->handle, _dsm_guid, 0, 0, + NULL, ACPI_TYPE_STRING); + if (!obj) + return NULL; + + vcm_type = kstrdup(obj->string.pointer, GFP_KERNEL); + ACPI_FREE(obj); + + if (!vcm_type) + return NULL; + + string_lower(vcm_type, vcm_type); + return vcm_type; +} + static const struct acpi_device_id atomisp_sensor_configs[] = { - ATOMISP_SENSOR_CONFIG("INT33BE", 2),/* OV5693 */ + ATOMISP_SENSOR_CONFIG("INT33BE", 2, true), /* OV5693 */ {} }; @@ -500,6 +530,7 @@ static int atomisp_csi2_parse_sensor_fwnode(struct acpi_device *adev, { const struct acpi_device_id *id; int ret, clock_num; + bool vcm = false; int lanes = 1; id = acpi_match_acpi_device(atomisp_sensor_configs, adev); @@ -508,6 +539,7 @@ static int atomisp_csi2_parse_sensor_fwnode(struct acpi_device *adev, (struct atomisp_sensor_config *)id->driver_data; lanes = cfg->lanes; + vcm = cfg->vcm; } /* @@ -545,6 +577,9 @@ static int atomisp_csi2_parse_sensor_fwnode(struct acpi_device *adev, sensor->orientation = (sensor->link == 1) ? V4L2_FWNODE_ORIENTATION_BACK : V4L2_FWNODE_ORIENTATION_FRONT; + if (vcm) + sensor->vcm_type = atomisp_csi2_get_vcm_type(adev); + return 0; } @@ -583,6 +618,7 @@ static int atomisp_notifier_bound(struct v4l2_async_notifier *notifier, { struct atomisp_device *isp = notifier_to_atomisp(notifier); struct sensor_async_subdev *s_asd = to_sensor_asd(asd); + int ret; if (s_asd->port >= ATOMISP_CAMERA_NR_PORTS) { dev_err(isp->dev, "port %d not supported\n", s_asd->port); @@ -594,6 +630,10 @@ static int atomisp_notifier_bound(struct v4l2_async_notifier *notifier, return -EBUSY; } + ret = ipu_bridge_instantiate_vcm(sd->dev); + if (ret) + return ret; + isp->sensor_subdevs[s_asd->port] = sd; return 0; } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: pci: intel: Add IVSC support for IPU bridge driver
This is an automatic generated email to let you know that the following patch were queued: Subject: media: pci: intel: Add IVSC support for IPU bridge driver Author: Wentong Wu Date:Thu Aug 3 07:38:14 2023 +0200 Previously on ACPI platforms, sensors that are intended to be connected to an IPU device for use with the ipu3-cio2 driver lacking the necessary connection information in firmware. IPU bridge driver is to connect sensors to IPU device via software nodes. Currently IVSC located between IPU device and sensors is available in existing commercial platforms from multiple OEMs. But the connection information between them in firmware is also not enough to build V4L2 connection graph. This patch parses the connection properties from the SSDB buffer in DSDT and build the connection using software nodes. IVSC driver is based on MEI framework (previously known as HECI), it has two MEI clients, MEI CSI and MEI ACE. Both clients are used to communicate messages with IVSC firmware. Linux abstracts MEI client as a device, whose bus type is MEI. And the device is addressed by a GUID/UUID which is part of the device name of MEI client. After figured out MEI CSI via the UUID composed device name, this patch setup the connection between MEI CSI and IPU, and the connection between MEI CSI and sensor via software nodes. Signed-off-by: Wentong Wu Reviewed-by: Andy Shevchenko Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu-bridge.c | 263 ++- include/media/ipu-bridge.h | 19 ++- 2 files changed, 278 insertions(+), 4 deletions(-) --- diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index 940457940057..5000d7a1d688 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -4,6 +4,8 @@ #include #include #include +#include +#include #include #include #include @@ -12,6 +14,23 @@ #include #include +/* + * 92335fcf-3203-4472-af93-7b4453ac29da + * + * Used to build MEI CSI device name to lookup MEI CSI device by + * device_find_child_by_name(). + */ +#define MEI_CSI_UUID \ + UUID_LE(0x92335FCF, 0x3203, 0x4472, \ + 0xAF, 0x93, 0x7B, 0x44, 0x53, 0xAC, 0x29, 0xDA) + +/* + * IVSC device name + * + * Used to match IVSC device by ipu_bridge_match_ivsc_dev() + */ +#define IVSC_DEV_NAME "intel_vsc" + /* * Extend this array with ACPI Hardware IDs of devices known to be working * plus the number of link-frequencies expected by their drivers, along with @@ -65,6 +84,91 @@ static const char * const ipu_vcm_types[] = { "lc898212axb", }; +/* + * Used to figure out IVSC acpi device by ipu_bridge_get_ivsc_acpi_dev() + * instead of device and driver match to probe IVSC device. + */ +static const struct acpi_device_id ivsc_acpi_ids[] = { + { "INTC1059" }, + { "INTC1095" }, + { "INTC100A" }, + { "INTC10CF" }, +}; + +static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adev) +{ + acpi_handle handle = acpi_device_handle(adev); + struct acpi_device *consumer, *ivsc_adev; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(ivsc_acpi_ids); i++) { + const struct acpi_device_id *acpi_id = _acpi_ids[i]; + + for_each_acpi_dev_match(ivsc_adev, acpi_id->id, NULL, -1) + /* camera sensor depends on IVSC in DSDT if exist */ + for_each_acpi_consumer_dev(ivsc_adev, consumer) + if (consumer->handle == handle) + return ivsc_adev; + } + + return NULL; +} + +static int ipu_bridge_match_ivsc_dev(struct device *dev, const void *adev) +{ + if (ACPI_COMPANION(dev) != adev) + return 0; + + if (!sysfs_streq(dev_name(dev), IVSC_DEV_NAME)) + return 0; + + return 1; +} + +static struct device *ipu_bridge_get_ivsc_csi_dev(struct acpi_device *adev) +{ + struct device *dev, *csi_dev; + uuid_le uuid = MEI_CSI_UUID; + char name[64]; + + /* IVSC device on platform bus */ + dev = bus_find_device(_bus_type, NULL, adev, + ipu_bridge_match_ivsc_dev); + if (dev) { + snprintf(name, sizeof(name), "%s-%pUl", dev_name(dev), ); + + csi_dev = device_find_child_by_name(dev, name); + + put_device(dev); + + return csi_dev; + } + + return NULL; +} + +static int ipu_bridge_check_ivsc_dev(struct ipu_sensor *sensor, +struct acpi_device *sensor_adev) +{ + struct acpi_device *adev; + struct device *csi_dev; + + adev = ipu_bridge_get_ivsc_acpi_dev(sensor_adev);
[git:media_stage/master] media: i2c: Add driver for DW9719 VCM
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: Add driver for DW9719 VCM Author: Daniel Scally Date:Sat Jul 8 16:52:14 2023 +0200 Add a driver for the DW9719 VCM. The driver creates a v4l2 subdevice and registers a control to set the desired focus. Reviewed-by: Andy Shevchenko Signed-off-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab MAINTAINERS| 7 + drivers/media/i2c/Kconfig | 12 ++ drivers/media/i2c/Makefile | 1 + drivers/media/i2c/dw9719.c | 350 + 4 files changed, 370 insertions(+) --- diff --git a/MAINTAINERS b/MAINTAINERS index e1d9320e31b2..48e5e71afb13 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6243,6 +6243,13 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/dongwoon,dw9714.yaml F: drivers/media/i2c/dw9714.c +DONGWOON DW9719 LENS VOICE COIL DRIVER +M: Daniel Scally +L: linux-me...@vger.kernel.org +S: Maintained +T: git git://linuxtv.org/media_tree.git +F: drivers/media/i2c/dw9719.c + DONGWOON DW9768 LENS VOICE COIL DRIVER L: linux-me...@vger.kernel.org S: Orphan diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 07cdf9590a14..aa55582a2cd0 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -652,6 +652,18 @@ config VIDEO_DW9714 capability. This is designed for linear control of voice coil motors, controlled via I2C serial interface. +config VIDEO_DW9719 + tristate "DW9719 lens voice coil support" + depends on I2C && VIDEO_DEV + select MEDIA_CONTROLLER + select VIDEO_V4L2_SUBDEV_API + select V4L2_ASYNC + select V4L2_CCI_I2C + help + This is a driver for the DW9719 camera lens voice coil. + This is designed for linear control of voice coil motors, + controlled via I2C serial interface. + config VIDEO_DW9768 tristate "DW9768 lens voice coil support" depends on I2C && VIDEO_DEV diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 19033114b6d3..80b00d39b48f 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -32,6 +32,7 @@ obj-$(CONFIG_VIDEO_DS90UB913) += ds90ub913.o obj-$(CONFIG_VIDEO_DS90UB953) += ds90ub953.o obj-$(CONFIG_VIDEO_DS90UB960) += ds90ub960.o obj-$(CONFIG_VIDEO_DW9714) += dw9714.o +obj-$(CONFIG_VIDEO_DW9719) += dw9719.o obj-$(CONFIG_VIDEO_DW9768) += dw9768.o obj-$(CONFIG_VIDEO_DW9807_VCM) += dw9807-vcm.o obj-$(CONFIG_VIDEO_ET8EK8) += et8ek8/ diff --git a/drivers/media/i2c/dw9719.c b/drivers/media/i2c/dw9719.c new file mode 100644 index ..c626ed845928 --- /dev/null +++ b/drivers/media/i2c/dw9719.c @@ -0,0 +1,350 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (c) 2012 Intel Corporation + +/* + * Based on linux/modules/camera/drivers/media/i2c/imx/dw9719.c in this repo: + * https://github.com/ZenfoneArea/android_kernel_asus_zenfone5 + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define DW9719_MAX_FOCUS_POS 1023 +#define DW9719_CTRL_STEPS 16 +#define DW9719_CTRL_DELAY_US 1000 + +#define DW9719_INFOCCI_REG8(0) +#define DW9719_ID 0xF1 + +#define DW9719_CONTROL CCI_REG8(2) +#define DW9719_ENABLE_RINGING 0x02 + +#define DW9719_VCM_CURRENT CCI_REG16(3) + +#define DW9719_MODECCI_REG8(6) +#define DW9719_MODE_SAC_SHIFT 4 +#define DW9719_MODE_SAC3 4 + +#define DW9719_VCM_FREQCCI_REG8(7) +#define DW9719_DEFAULT_VCM_FREQ0x60 + +#define to_dw9719_device(x) container_of(x, struct dw9719_device, sd) + +struct dw9719_device { + struct v4l2_subdev sd; + struct device *dev; + struct regmap *regmap; + struct regulator *regulator; + u32 sac_mode; + u32 vcm_freq; + + struct dw9719_v4l2_ctrls { + struct v4l2_ctrl_handler handler; + struct v4l2_ctrl *focus; + } ctrls; +}; + +static int dw9719_detect(struct dw9719_device *dw9719) +{ + int ret; + u64 val; + + ret = cci_read(dw9719->regmap, DW9719_INFO, , NULL); + if (ret < 0) + return ret; + + if (val != DW9719_ID) { + dev_err(dw9719->dev, "Failed to detect correct id\n"); + return -ENXIO; + } + + return 0; +} + +static int dw9719_power_down(struct dw9719_device *dw9719) +{ + return regulator_disable(dw9719->regulator); +} + +static int dw9719_power_up(struct dw9719_device *dw9719) +{ + int ret; + + ret = regulator_enable(dw9719->regulator); + if (ret) +
[git:media_stage/master] media: ov2680: Fix ov2680_bayer_order()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Fix ov2680_bayer_order() Author: Hans de Goede Date:Thu Aug 3 11:33:17 2023 +0200 The index into ov2680_hv_flip_bayer_order[] should be 0-3, but ov2680_bayer_order() was using 0 + BIT(2) + (BIT(2) << 1) as max index, while the intention was to use: 0 + 1 + 2 as max index. Fix the index calculation in ov2680_bayer_order(), while at it also just use the ctrl values rather then reading them back using a slow i2c-read transaction. This also allows making the function void, since there now are no more i2c-reads to error check. Note the check for the ctrls being NULL is there to allow adding an ov2680_fill_format() helper later, which will call ov2680_set_bayer_order() during probe() before the ctrls are created. [Sakari Ailus: Change all users of ov2680_set_bayer_order() here] Fixes: 3ee47cad3e69 ("media: ov2680: Add Omnivision OV2680 sensor driver") Reviewed-by: Daniel Scally Acked-by: Rui Miguel Silva Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 33 ++--- 1 file changed, 14 insertions(+), 19 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 3a737a1607a4..f05fbba72c7c 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -315,26 +315,17 @@ static void ov2680_power_down(struct ov2680_dev *sensor) usleep_range(5000, 1); } -static int ov2680_bayer_order(struct ov2680_dev *sensor) +static void ov2680_set_bayer_order(struct ov2680_dev *sensor) { - u32 format1; - u32 format2; - u32 hv_flip; - int ret; - - ret = ov2680_read_reg(sensor, OV2680_REG_FORMAT1, ); - if (ret < 0) - return ret; + int hv_flip = 0; - ret = ov2680_read_reg(sensor, OV2680_REG_FORMAT2, ); - if (ret < 0) - return ret; + if (sensor->ctrls.vflip && sensor->ctrls.vflip->val) + hv_flip += 1; - hv_flip = (format2 & BIT(2) << 1) | (format1 & BIT(2)); + if (sensor->ctrls.hflip && sensor->ctrls.hflip->val) + hv_flip += 2; sensor->fmt.code = ov2680_hv_flip_bayer_order[hv_flip]; - - return 0; } static int ov2680_vflip_enable(struct ov2680_dev *sensor) @@ -345,7 +336,8 @@ static int ov2680_vflip_enable(struct ov2680_dev *sensor) if (ret < 0) return ret; - return ov2680_bayer_order(sensor); + ov2680_set_bayer_order(sensor); + return 0; } static int ov2680_vflip_disable(struct ov2680_dev *sensor) @@ -356,7 +348,8 @@ static int ov2680_vflip_disable(struct ov2680_dev *sensor) if (ret < 0) return ret; - return ov2680_bayer_order(sensor); + ov2680_set_bayer_order(sensor); + return 0; } static int ov2680_hflip_enable(struct ov2680_dev *sensor) @@ -367,7 +360,8 @@ static int ov2680_hflip_enable(struct ov2680_dev *sensor) if (ret < 0) return ret; - return ov2680_bayer_order(sensor); + ov2680_set_bayer_order(sensor); + return 0; } static int ov2680_hflip_disable(struct ov2680_dev *sensor) @@ -378,7 +372,8 @@ static int ov2680_hflip_disable(struct ov2680_dev *sensor) if (ret < 0) return ret; - return ov2680_bayer_order(sensor); + ov2680_set_bayer_order(sensor); + return 0; } static int ov2680_test_pattern_set(struct ov2680_dev *sensor, int value) ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov5640: Enable MIPI interface in ov5640_set_power_mipi()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov5640: Enable MIPI interface in ov5640_set_power_mipi() Author: Marek Vasut Date:Wed Aug 2 16:47:25 2023 +0200 Set OV5640_REG_IO_MIPI_CTRL00 bit 2 to 1 instead of 0, since 1 means MIPI CSI2 interface, while 0 means CPI parallel interface. In the ov5640_set_power_mipi() the interface should obviously be set to MIPI CSI2 since this functions is used to power up the sensor when operated in MIPI CSI2 mode. The sensor should not be in CPI mode in that case. This fixes a corner case where capturing the first frame on i.MX8MN with CSI/ISI resulted in corrupted frame. Fixes: aa4bb8b8838f ("media: ov5640: Re-work MIPI startup sequence") Reviewed-by: Jacopo Mondi Tested-by: Jacopo Mondi # [Test on imx6q] Signed-off-by: Marek Vasut Tested-by: Jai Luthra # [Test on bplay, sk-am62] Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov5640.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index 2260dbb27d86..434d8c99e23d 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -2542,9 +2542,9 @@ static int ov5640_set_power_mipi(struct ov5640_dev *sensor, bool on) *"ov5640_set_stream_mipi()") * [4] = 0 : Power up MIPI HS Tx * [3] = 0 : Power up MIPI LS Rx -* [2] = 0 : MIPI interface disabled +* [2] = 1 : MIPI interface enabled */ - ret = ov5640_write_reg(sensor, OV5640_REG_IO_MIPI_CTRL00, 0x40); + ret = ov5640_write_reg(sensor, OV5640_REG_IO_MIPI_CTRL00, 0x44); if (ret) return ret; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: i2c: ds90ub960: Fix PLL config for 1200 MHz CSI rate
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: ds90ub960: Fix PLL config for 1200 MHz CSI rate Author: Tomi Valkeinen Date:Thu Aug 3 14:15:47 2023 +0200 smatch reports: drivers/media/i2c/ds90ub960.c:1788 ub960_init_tx_ports() error: uninitialized symbol 'pll_div'. This is caused by 'pll_div' not being set for 1200 MHz CSI rate. Set the 'pll_div' correctly. Closes: https://lore.kernel.org/all/8d6daeb1-b62a-bbb2-b840-8759c84f2...@xs4all.nl/ Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver") Reported-by: Hans Verkuil Signed-off-by: Tomi Valkeinen Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ds90ub960.c | 1 + 1 file changed, 1 insertion(+) --- diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index f619c23e084a..8ba5750f5a23 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -1771,6 +1771,7 @@ static int ub960_init_tx_ports(struct ub960_data *priv) break; case MHZ(1200): speed_select = 1; + pll_div = 0x18; break; case MHZ(800): speed_select = 2; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov5640: Fix initial RESETB state and annotate timings
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov5640: Fix initial RESETB state and annotate timings Author: Marek Vasut Date:Tue Jul 25 00:21:16 2023 +0200 The initial state of RESETB input signal of OV5640 should be asserted, i.e. the sensor should be in reset. This is not the case, make it so. Since the subsequent assertion of RESETB signal is no longer necessary and the timing of the power sequencing could be slightly adjusted, add annotations to the delays which match OV5640 datasheet rev. 2.03, both: figure 2-3 power up timing with internal DVDD figure 2-4 power up timing with external DVDD source The 5..10ms delay between PWDN assertion and RESETB assertion is not even documented in the power sequencing diagram, and with this reset fix, it is no longer even necessary. Fixes: 19a81c1426c1 ("[media] add Omnivision OV5640 sensor driver") Reported-by: Jacopo Mondi Signed-off-by: Marek Vasut Reviewed-by: Jacopo Mondi Tested-by: Jai Luthra Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov5640.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) --- diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index 434d8c99e23d..5fe85aa2d2ec 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -2452,16 +2452,13 @@ static void ov5640_power(struct ov5640_dev *sensor, bool enable) static void ov5640_powerup_sequence(struct ov5640_dev *sensor) { if (sensor->pwdn_gpio) { - gpiod_set_value_cansleep(sensor->reset_gpio, 0); + gpiod_set_value_cansleep(sensor->reset_gpio, 1); /* camera power cycle */ ov5640_power(sensor, false); - usleep_range(5000, 1); + usleep_range(5000, 1); /* t2 */ ov5640_power(sensor, true); - usleep_range(5000, 1); - - gpiod_set_value_cansleep(sensor->reset_gpio, 1); - usleep_range(1000, 2000); + usleep_range(1000, 2000); /* t3 */ gpiod_set_value_cansleep(sensor->reset_gpio, 0); } else { @@ -2469,7 +2466,7 @@ static void ov5640_powerup_sequence(struct ov5640_dev *sensor) ov5640_write_reg(sensor, OV5640_REG_SYS_CTRL0, OV5640_REG_SYS_CTRL0_SW_RST); } - usleep_range(2, 25000); + usleep_range(2, 25000); /* t4 */ /* * software standby: allows registers programming; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: platform: ti: fix the return value handle for platform_get_irq()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: platform: ti: fix the return value handle for platform_get_irq() Author: Ruan Jinjie Date:Mon Jul 31 14:02:12 2023 +0200 There is no possible for platform_get_irq() to return 0, and the return value of platform_get_irq() is more sensible to show the error reason. Signed-off-by: Ruan Jinjie Reviewed-by: Laurent Pinchart Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/ti/am437x/am437x-vpfe.c | 4 +--- drivers/media/platform/ti/omap3isp/isp.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) --- diff --git a/drivers/media/platform/ti/am437x/am437x-vpfe.c b/drivers/media/platform/ti/am437x/am437x-vpfe.c index 319ec5ea0527..63092013d476 100644 --- a/drivers/media/platform/ti/am437x/am437x-vpfe.c +++ b/drivers/media/platform/ti/am437x/am437x-vpfe.c @@ -2426,10 +2426,8 @@ static int vpfe_probe(struct platform_device *pdev) } ret = platform_get_irq(pdev, 0); - if (ret <= 0) { - ret = -ENODEV; + if (ret < 0) goto probe_out_cleanup; - } vpfe->irq = ret; ret = devm_request_irq(vpfe->pdev, vpfe->irq, vpfe_isr, 0, diff --git a/drivers/media/platform/ti/omap3isp/isp.c b/drivers/media/platform/ti/omap3isp/isp.c index 52c480437ed2..1cda23244c7b 100644 --- a/drivers/media/platform/ti/omap3isp/isp.c +++ b/drivers/media/platform/ti/omap3isp/isp.c @@ -2392,10 +2392,8 @@ static int isp_probe(struct platform_device *pdev) /* Interrupt */ ret = platform_get_irq(pdev, 0); - if (ret <= 0) { - ret = -ENODEV; + if (ret < 0) goto error_iommu; - } isp->irq_num = ret; if (devm_request_irq(isp->dev, isp->irq_num, isp_isr, IRQF_SHARED, ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Remove auto-gain and auto-exposure controls
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Remove auto-gain and auto-exposure controls Author: Hans de Goede Date:Thu Aug 3 11:33:16 2023 +0200 Quoting the OV2680 datasheet: "3.2 exposure and gain control In the OV2680, the exposure time and gain are set manually from an external controller. The OV2680 supports manual gain and exposure control only for normal applications, no auto mode." And indeed testing with the atomisp_ov2680 fork of ov2680.c has shown that auto-exposure and auto-gain do not work. Note that the code setting the auto-exposure flag was broken, callers of ov2680_exposure_set() were directly passing !!ctrls->auto_exp->val as "bool auto_exp" value, but ctrls->auto_exp is a menu control with: enum v4l2_exposure_auto_type { V4L2_EXPOSURE_AUTO = 0, V4L2_EXPOSURE_MANUAL = 1, ... So instead of passing !!ctrls->auto_exp->val they should have been passing ctrls->auto_exp->val == V4L2_EXPOSURE_AUTO, iow the passed value was inverted of what it should have been. Also remove ov2680_g_volatile_ctrl() since without auto support the gain and exposure controls are not volatile. This also fixes the control values not being properly applied in ov2680_mode_set(). The 800x600 mode register-list also sets gain, exposure and vflip overriding the last set ctrl values. ov2680_mode_set() does call ov2680_gain_set() and ov2680_exposure_set() but did this before writing the mode register-list, so these values would still be overridden by the mode register-list. Add a v4l2_ctrl_handler_setup() call after writing the mode register-list to restore all ctrl values. Also remove the ctrls->gain->is_new check from ov2680_gain_set() so that the gain always gets restored properly. Last since ov2680_mode_set() now calls v4l2_ctrl_handler_setup(), remove the v4l2_ctrl_handler_setup() call after ov2680_mode_restore() since ov2680_mode_restore() calls ov2680_mode_set(). Fixes: 3ee47cad3e69 ("media: ov2680: Add Omnivision OV2680 sensor driver") Reviewed-by: Daniel Scally Acked-by: Rui Miguel Silva Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 161 + 1 file changed, 17 insertions(+), 144 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 0541b7c8e77b..3a737a1607a4 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -85,15 +85,8 @@ struct ov2680_mode_info { struct ov2680_ctrls { struct v4l2_ctrl_handler handler; - struct { - struct v4l2_ctrl *auto_exp; - struct v4l2_ctrl *exposure; - }; - struct { - struct v4l2_ctrl *auto_gain; - struct v4l2_ctrl *gain; - }; - + struct v4l2_ctrl *exposure; + struct v4l2_ctrl *gain; struct v4l2_ctrl *hflip; struct v4l2_ctrl *vflip; struct v4l2_ctrl *test_pattern; @@ -143,6 +136,7 @@ static const struct reg_value ov2680_setting_30fps_QUXGA_800_600[] = { {0x380e, 0x02}, {0x380f, 0x84}, {0x3811, 0x04}, {0x3813, 0x04}, {0x3814, 0x31}, {0x3815, 0x31}, {0x3820, 0xc0}, {0x4008, 0x00}, {0x4009, 0x03}, {0x4837, 0x1e}, {0x3501, 0x4e}, {0x3502, 0xe0}, + {0x3503, 0x03}, }; static const struct reg_value ov2680_setting_30fps_720P_1280_720[] = { @@ -405,69 +399,15 @@ static int ov2680_test_pattern_set(struct ov2680_dev *sensor, int value) return 0; } -static int ov2680_gain_set(struct ov2680_dev *sensor, bool auto_gain) -{ - struct ov2680_ctrls *ctrls = >ctrls; - u32 gain; - int ret; - - ret = ov2680_mod_reg(sensor, OV2680_REG_R_MANUAL, BIT(1), -auto_gain ? 0 : BIT(1)); - if (ret < 0) - return ret; - - if (auto_gain || !ctrls->gain->is_new) - return 0; - - gain = ctrls->gain->val; - - ret = ov2680_write_reg16(sensor, OV2680_REG_GAIN_PK, gain); - - return 0; -} - -static int ov2680_gain_get(struct ov2680_dev *sensor) -{ - u32 gain; - int ret; - - ret = ov2680_read_reg16(sensor, OV2680_REG_GAIN_PK, ); - if (ret) - return ret; - - return gain; -} - -static int ov2680_exposure_set(struct ov2680_dev *sensor, bool auto_exp) +static int ov2680_gain_set(struct ov2680_dev *sensor, u32 gain) { - struct ov2680_ctrls *ctrls = >ctrls; - u32 exp; - int ret; - - ret = ov2680_mod_reg(sensor, OV2680_REG_R_MANUAL, BIT(0), -auto_exp ? 0 : BIT(0)); - if (ret < 0) - return ret; - - if (auto_exp || !ctrls->exposure->is_new) - return 0; - - exp = (u32)ctrls->exposure->val; - exp <<= 4; - - return ov2
[git:media_stage/master] media: ov2680: Fix vflip / hflip set functions
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Fix vflip / hflip set functions Author: Hans de Goede Date:Thu Aug 3 11:33:18 2023 +0200 ov2680_vflip_disable() / ov2680_hflip_disable() pass BIT(0) instead of 0 as value to ov2680_mod_reg(). While fixing this also: 1. Stop having separate enable/disable functions for hflip / vflip 2. Move the is_streaming check, which is unique to hflip / vflip into the ov2680_set_?flip() functions. for a nice code cleanup. Fixes: 3ee47cad3e69 ("media: ov2680: Add Omnivision OV2680 sensor driver") Reviewed-by: Daniel Scally Acked-by: Rui Miguel Silva Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 50 +++--- 1 file changed, 12 insertions(+), 38 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index f05fbba72c7c..74024ba968b4 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -328,23 +328,15 @@ static void ov2680_set_bayer_order(struct ov2680_dev *sensor) sensor->fmt.code = ov2680_hv_flip_bayer_order[hv_flip]; } -static int ov2680_vflip_enable(struct ov2680_dev *sensor) +static int ov2680_set_vflip(struct ov2680_dev *sensor, s32 val) { int ret; - ret = ov2680_mod_reg(sensor, OV2680_REG_FORMAT1, BIT(2), BIT(2)); - if (ret < 0) - return ret; - - ov2680_set_bayer_order(sensor); - return 0; -} - -static int ov2680_vflip_disable(struct ov2680_dev *sensor) -{ - int ret; + if (sensor->is_streaming) + return -EBUSY; - ret = ov2680_mod_reg(sensor, OV2680_REG_FORMAT1, BIT(2), BIT(0)); + ret = ov2680_mod_reg(sensor, OV2680_REG_FORMAT1, +BIT(2), val ? BIT(2) : 0); if (ret < 0) return ret; @@ -352,23 +344,15 @@ static int ov2680_vflip_disable(struct ov2680_dev *sensor) return 0; } -static int ov2680_hflip_enable(struct ov2680_dev *sensor) +static int ov2680_set_hflip(struct ov2680_dev *sensor, s32 val) { int ret; - ret = ov2680_mod_reg(sensor, OV2680_REG_FORMAT2, BIT(2), BIT(2)); - if (ret < 0) - return ret; - - ov2680_set_bayer_order(sensor); - return 0; -} - -static int ov2680_hflip_disable(struct ov2680_dev *sensor) -{ - int ret; + if (sensor->is_streaming) + return -EBUSY; - ret = ov2680_mod_reg(sensor, OV2680_REG_FORMAT2, BIT(2), BIT(0)); + ret = ov2680_mod_reg(sensor, OV2680_REG_FORMAT2, +BIT(2), val ? BIT(2) : 0); if (ret < 0) return ret; @@ -722,19 +706,9 @@ static int ov2680_s_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_EXPOSURE: return ov2680_exposure_set(sensor, ctrl->val); case V4L2_CID_VFLIP: - if (sensor->is_streaming) - return -EBUSY; - if (ctrl->val) - return ov2680_vflip_enable(sensor); - else - return ov2680_vflip_disable(sensor); + return ov2680_set_vflip(sensor, ctrl->val); case V4L2_CID_HFLIP: - if (sensor->is_streaming) - return -EBUSY; - if (ctrl->val) - return ov2680_hflip_enable(sensor); - else - return ov2680_hflip_disable(sensor); + return ov2680_set_hflip(sensor, ctrl->val); case V4L2_CID_TEST_PATTERN: return ov2680_test_pattern_set(sensor, ctrl->val); default: ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Add ov2680_fill_format() helper function
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Add ov2680_fill_format() helper function Author: Hans de Goede Date:Thu Aug 3 11:33:21 2023 +0200 Add a ov2680_fill_format() helper function and use this everywhere were a v4l2_mbus_framefmt struct needs to be filled in so that the driver always fills it consistently. This is a preparation patch for fixing ov2680_set_fmt() which == V4L2_SUBDEV_FORMAT_TRY calls not properly filling in the passed in v4l2_mbus_framefmt struct. Note that for ov2680_init_cfg() this now simply always fills the try_fmt struct of the passed in sd_state. This is correct because ov2680_init_cfg() is never called with a NULL sd_state so the old sd_state check is not necessary. Fixes: 3ee47cad3e69 ("media: ov2680: Add Omnivision OV2680 sensor driver") Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 49 +- 1 file changed, 27 insertions(+), 22 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index e6e14743ba1e..f2eb8d85a7e4 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -54,6 +54,9 @@ #define OV2680_WIDTH_MAX 1600 #define OV2680_HEIGHT_MAX 1200 +#define OV2680_DEFAULT_WIDTH 800 +#define OV2680_DEFAULT_HEIGHT 600 + enum ov2680_mode_id { OV2680_MODE_QUXGA_800_600, OV2680_MODE_720P_1280_720, @@ -315,7 +318,8 @@ static void ov2680_power_down(struct ov2680_dev *sensor) usleep_range(5000, 1); } -static void ov2680_set_bayer_order(struct ov2680_dev *sensor) +static void ov2680_set_bayer_order(struct ov2680_dev *sensor, + struct v4l2_mbus_framefmt *fmt) { int hv_flip = 0; @@ -325,7 +329,19 @@ static void ov2680_set_bayer_order(struct ov2680_dev *sensor) if (sensor->ctrls.hflip && sensor->ctrls.hflip->val) hv_flip += 2; - sensor->fmt.code = ov2680_hv_flip_bayer_order[hv_flip]; + fmt->code = ov2680_hv_flip_bayer_order[hv_flip]; +} + +static void ov2680_fill_format(struct ov2680_dev *sensor, + struct v4l2_mbus_framefmt *fmt, + unsigned int width, unsigned int height) +{ + memset(fmt, 0, sizeof(*fmt)); + fmt->width = width; + fmt->height = height; + fmt->field = V4L2_FIELD_NONE; + fmt->colorspace = V4L2_COLORSPACE_SRGB; + ov2680_set_bayer_order(sensor, fmt); } static int ov2680_set_vflip(struct ov2680_dev *sensor, s32 val) @@ -340,7 +356,7 @@ static int ov2680_set_vflip(struct ov2680_dev *sensor, s32 val) if (ret < 0) return ret; - ov2680_set_bayer_order(sensor); + ov2680_set_bayer_order(sensor, >fmt); return 0; } @@ -356,7 +372,7 @@ static int ov2680_set_hflip(struct ov2680_dev *sensor, s32 val) if (ret < 0) return ret; - ov2680_set_bayer_order(sensor); + ov2680_set_bayer_order(sensor, >fmt); return 0; } @@ -614,10 +630,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, goto unlock; } - fmt->width = mode->width; - fmt->height = mode->height; - fmt->code = sensor->fmt.code; - fmt->colorspace = sensor->fmt.colorspace; + ov2680_fill_format(sensor, fmt, mode->width, mode->height); sensor->current_mode = mode; sensor->fmt = format->format; @@ -632,16 +645,11 @@ unlock: static int ov2680_init_cfg(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state) { - struct v4l2_subdev_format fmt = { - .which = sd_state ? V4L2_SUBDEV_FORMAT_TRY - : V4L2_SUBDEV_FORMAT_ACTIVE, - .format = { - .width = 800, - .height = 600, - } - }; + struct ov2680_dev *sensor = to_ov2680_dev(sd); - return ov2680_set_fmt(sd, sd_state, ); + ov2680_fill_format(sensor, _state->pads[0].try_fmt, + OV2680_DEFAULT_WIDTH, OV2680_DEFAULT_HEIGHT); + return 0; } static int ov2680_enum_frame_size(struct v4l2_subdev *sd, @@ -740,11 +748,8 @@ static int ov2680_mode_init(struct ov2680_dev *sensor) const struct ov2680_mode_info *init_mode; /* set initial mode */ - sensor->fmt.code = MEDIA_BUS_FMT_SBGGR10_1X10; - sensor->fmt.width = 800; - sensor->fmt.height = 600; - sensor->fmt.field = V4L2_FIELD_NONE; - sensor->fmt.colorspace = V4L2_COLORSPACE_SRGB; + ov2680_fill_format(sensor, >fmt, +
[git:media_stage/master] media: Documentation: Fix [GS]_ROUTING documentation
This is an automatic generated email to let you know that the following patch were queued: Subject: media: Documentation: Fix [GS]_ROUTING documentation Author: Tomi Valkeinen Date:Thu Jul 20 10:08:28 2023 +0200 Add mention that successful VIDIOC_SUBDEV_G_ROUTING call will update 'num_routes' and remove mention about non-existing streams, which is incorrect. Fixes: ea73eda50813 ("media: Documentation: Add GS_ROUTING documentation") Signed-off-by: Tomi Valkeinen Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Documentation/userspace-api/media/v4l/vidioc-subdev-g-routing.rst | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) --- diff --git a/Documentation/userspace-api/media/v4l/vidioc-subdev-g-routing.rst b/Documentation/userspace-api/media/v4l/vidioc-subdev-g-routing.rst index 2d6e3bbdd040..72677a280cd6 100644 --- a/Documentation/userspace-api/media/v4l/vidioc-subdev-g-routing.rst +++ b/Documentation/userspace-api/media/v4l/vidioc-subdev-g-routing.rst @@ -58,6 +58,9 @@ the subdevice exposes, drivers return the ENOSPC error code and adjust the value of the ``num_routes`` field. Application should then reserve enough memory for all the route entries and call ``VIDIOC_SUBDEV_G_ROUTING`` again. +On a successful ``VIDIOC_SUBDEV_G_ROUTING`` call the driver updates the +``num_routes`` field to reflect the actual number of routes returned. + .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}| .. c:type:: v4l2_subdev_routing @@ -138,9 +141,7 @@ ENOSPC EINVAL The sink or source pad identifiers reference a non-existing pad, or reference - pads of different types (ie. the sink_pad identifiers refers to a source pad) - or the sink or source stream identifiers reference a non-existing stream on - the sink or source pad. + pads of different types (ie. the sink_pad identifiers refers to a source pad). E2BIG The application provided ``num_routes`` for ``VIDIOC_SUBDEV_S_ROUTING`` is ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Remove VIDEO_V4L2_SUBDEV_API ifdef-s
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Remove VIDEO_V4L2_SUBDEV_API ifdef-s Author: Hans de Goede Date:Thu Aug 3 11:33:19 2023 +0200 VIDEO_V4L2_SUBDEV_API is now automatically selected in Kconfig for all sensor drivers. Remove the ifdef CONFIG_VIDEO_V4L2_SUBDEV_API checks. This is a preparation patch for fixing ov2680_set_fmt() which == V4L2_SUBDEV_FORMAT_TRY calls not properly filling in the passed in v4l2_mbus_framefmt struct. Fixes: 3ee47cad3e69 ("media: ov2680: Add Omnivision OV2680 sensor driver") Reviewed-by: Daniel Scally Acked-by: Rui Miguel Silva Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 16 ++-- 1 file changed, 2 insertions(+), 14 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 74024ba968b4..5c1f5dd4824a 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -562,7 +562,6 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd, { struct ov2680_dev *sensor = to_ov2680_dev(sd); struct v4l2_mbus_framefmt *fmt = NULL; - int ret = 0; if (format->pad != 0) return -EINVAL; @@ -570,22 +569,17 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd, mutex_lock(>lock); if (format->which == V4L2_SUBDEV_FORMAT_TRY) { -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API fmt = v4l2_subdev_get_try_format(>sd, sd_state, format->pad); -#else - ret = -EINVAL; -#endif } else { fmt = >fmt; } - if (fmt) - format->format = *fmt; + format->format = *fmt; mutex_unlock(>lock); - return ret; + return 0; } static int ov2680_set_fmt(struct v4l2_subdev *sd, @@ -594,9 +588,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, { struct ov2680_dev *sensor = to_ov2680_dev(sd); struct v4l2_mbus_framefmt *fmt = >format; -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API struct v4l2_mbus_framefmt *try_fmt; -#endif const struct ov2680_mode_info *mode; int ret = 0; @@ -619,10 +611,8 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, } if (format->which == V4L2_SUBDEV_FORMAT_TRY) { -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API try_fmt = v4l2_subdev_get_try_format(sd, sd_state, 0); format->format = *try_fmt; -#endif goto unlock; } @@ -780,9 +770,7 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor) v4l2_i2c_subdev_init(>sd, sensor->i2c_client, _subdev_ops); -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API sensor->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE; -#endif sensor->pad.flags = MEDIA_PAD_FL_SOURCE; sensor->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Add support for 19.2 MHz clock
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Add support for 19.2 MHz clock Author: Hans de Goede Date:Thu Aug 3 11:33:30 2023 +0200 Most x86/ACPI boards use the ov2680 with a 19.2 MHz xvclk, rather then the expected 24MHz, add support for this. Compensate for the lower clk by setting a higher PLL multiplier of 69 when using 19.2 MHz vs the default multiplier of 55 for a 24MHz xvclk. Acked-by: Rui Miguel Silva Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 41 ++--- 1 file changed, 34 insertions(+), 7 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 42be7b094d5d..a8c257f3bcd6 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -27,14 +27,13 @@ #include #include -#define OV2680_XVCLK_VALUE 2400 - #define OV2680_CHIP_ID 0x2680 #define OV2680_REG_STREAM_CTRL CCI_REG8(0x0100) #define OV2680_REG_SOFT_RESET CCI_REG8(0x0103) #define OV2680_REG_CHIP_ID CCI_REG16(0x300a) +#define OV2680_REG_PLL_MULTIPLIER CCI_REG16(0x3081) #define OV2680_REG_EXPOSURE_PK CCI_REG24(0x3500) #define OV2680_REG_R_MANUALCCI_REG8(0x3503) @@ -69,6 +68,21 @@ static const char * const ov2680_supply_name[] = { #define OV2680_NUM_SUPPLIES ARRAY_SIZE(ov2680_supply_name) +enum { + OV2680_19_2_MHZ, + OV2680_24_MHZ, +}; + +static const unsigned long ov2680_xvclk_freqs[] = { + [OV2680_19_2_MHZ] = 1920, + [OV2680_24_MHZ] = 2400, +}; + +static const u8 ov2680_pll_multipliers[] = { + [OV2680_19_2_MHZ] = 69, + [OV2680_24_MHZ] = 55, +}; + struct ov2680_mode_info { const char *name; enum ov2680_mode_id id; @@ -95,6 +109,7 @@ struct ov2680_dev { struct media_padpad; struct clk *xvclk; u32 xvclk_freq; + u8 pll_mult; struct regulator_bulk_data supplies[OV2680_NUM_SUPPLIES]; struct gpio_desc*pwdn_gpio; @@ -284,6 +299,11 @@ static int ov2680_stream_enable(struct ov2680_dev *sensor) { int ret; + ret = cci_write(sensor->regmap, OV2680_REG_PLL_MULTIPLIER, + sensor->pll_mult, NULL); + if (ret < 0) + return ret; + ret = regmap_multi_reg_write(sensor->regmap, ov2680_mode_init_data.reg_data, ov2680_mode_init_data.reg_data_size); @@ -699,7 +719,7 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) struct device *dev = sensor->dev; struct gpio_desc *gpio; unsigned int rate = 0; - int ret; + int i, ret; /* * The pin we want is named XSHUTDN in the datasheet. Linux sensor @@ -747,12 +767,19 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) } sensor->xvclk_freq = rate ?: clk_get_rate(sensor->xvclk); - if (sensor->xvclk_freq != OV2680_XVCLK_VALUE) { - dev_err(dev, "wrong xvclk frequency %d HZ, expected: %d Hz\n", - sensor->xvclk_freq, OV2680_XVCLK_VALUE); - return -EINVAL; + + for (i = 0; i < ARRAY_SIZE(ov2680_xvclk_freqs); i++) { + if (sensor->xvclk_freq == ov2680_xvclk_freqs[i]) + break; } + if (i == ARRAY_SIZE(ov2680_xvclk_freqs)) + return dev_err_probe(dev, -EINVAL, +"unsupported xvclk frequency %d Hz\n", +sensor->xvclk_freq); + + sensor->pll_mult = ov2680_pll_multipliers[i]; + return 0; } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Add support for more clk setups
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Add support for more clk setups Author: Hans de Goede Date:Thu Aug 3 11:33:29 2023 +0200 On ACPI systems the following 2 scenarios are possible: 1. The xvclk is fully controlled by ACPI powermanagement, so there is no "xvclk" for the driver to get (since it is abstracted away). In this case there will be a "clock-frequency" device property to tell the driver the xvclk rate. 2. There is a xvclk modelled in the clk framework for the driver, but the clk-generator may not be set to the right frequency yet. In this case there will also be a "clock-frequency" device property and the driver is expected to set the rate of the xvclk through this frequency through the clk framework. Handle both these scenarios by switching to devm_clk_get_optional() and checking for a "clock-frequency" device property. This is modelled after how the same issue was fixed for the ov8865 in commit 73dcffeb2ff9 ("media: i2c: Support 19.2MHz input clock in ov8865"). Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Reviewed-by: Tommaso Merciai Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 26 -- 1 file changed, 24 insertions(+), 2 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index cf84701a6a5a..42be7b094d5d 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -698,6 +698,7 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) { struct device *dev = sensor->dev; struct gpio_desc *gpio; + unsigned int rate = 0; int ret; /* @@ -718,13 +719,34 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) sensor->pwdn_gpio = gpio; - sensor->xvclk = devm_clk_get(dev, "xvclk"); + sensor->xvclk = devm_clk_get_optional(dev, "xvclk"); if (IS_ERR(sensor->xvclk)) { dev_err(dev, "xvclk clock missing or invalid\n"); return PTR_ERR(sensor->xvclk); } - sensor->xvclk_freq = clk_get_rate(sensor->xvclk); + /* +* We could have either a 24MHz or 19.2MHz clock rate from either DT or +* ACPI... but we also need to support the weird IPU3 case which will +* have an external clock AND a clock-frequency property. Check for the +* clock-frequency property and if found, set that rate if we managed +* to acquire a clock. This should cover the ACPI case. If the system +* uses devicetree then the configured rate should already be set, so +* we can just read it. +*/ + ret = fwnode_property_read_u32(dev_fwnode(dev), "clock-frequency", + ); + if (ret && !sensor->xvclk) + return dev_err_probe(dev, ret, "invalid clock config\n"); + + if (!ret && sensor->xvclk) { + ret = clk_set_rate(sensor->xvclk, rate); + if (ret) + return dev_err_probe(dev, ret, +"failed to set clock rate\n"); + } + + sensor->xvclk_freq = rate ?: clk_get_rate(sensor->xvclk); if (sensor->xvclk_freq != OV2680_XVCLK_VALUE) { dev_err(dev, "wrong xvclk frequency %d HZ, expected: %d Hz\n", sensor->xvclk_freq, OV2680_XVCLK_VALUE); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: i2c: ds90ub913: Fix use of uninitialized variables
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: ds90ub913: Fix use of uninitialized variables Author: Tomi Valkeinen Date:Thu Aug 3 14:15:45 2023 +0200 smatch reports some uninitialized variables: drivers/media/i2c/ds90ub913.c:481 ub913_log_status() error: uninitialized symbol 'v1'. drivers/media/i2c/ds90ub913.c:481 ub913_log_status() error: uninitialized symbol 'v2'. These are used only for printing debug information, and the use of an uninitialized variable only happens if an i2c transaction has failed, which will print an error. Thus, fix the errors just by initializing the variables to 0. Closes: https://lore.kernel.org/all/8d6daeb1-b62a-bbb2-b840-8759c84f2...@xs4all.nl/ Fixes: c158d0d4ff15 ("media: i2c: add DS90UB913 driver") Reported-by: Hans Verkuil Signed-off-by: Tomi Valkeinen Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ds90ub913.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/i2c/ds90ub913.c b/drivers/media/i2c/ds90ub913.c index 85b664e33482..4bfa3b3cf619 100644 --- a/drivers/media/i2c/ds90ub913.c +++ b/drivers/media/i2c/ds90ub913.c @@ -471,7 +471,7 @@ static int ub913_log_status(struct v4l2_subdev *sd) { struct ub913_data *priv = sd_to_ub913(sd); struct device *dev = >client->dev; - u8 v = 0, v1, v2; + u8 v = 0, v1 = 0, v2 = 0; ub913_read(priv, UB913_REG_MODE_SEL, ); dev_info(dev, "MODE_SEL %#02x\n", v); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Don't take the lock for try_fmt calls
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Don't take the lock for try_fmt calls Author: Hans de Goede Date:Thu Aug 3 11:33:20 2023 +0200 On ov2680_set_fmt() calls with format->which == V4L2_SUBDEV_FORMAT_TRY, ov2680_set_fmt() does not talk to the sensor. So in this case there is no need to lock the sensor->lock mutex or to check that the sensor is streaming. Fixes: 3ee47cad3e69 ("media: ov2680: Add Omnivision OV2680 sensor driver") Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 5c1f5dd4824a..e6e14743ba1e 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -595,24 +595,22 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, if (format->pad != 0) return -EINVAL; - mutex_lock(>lock); - - if (sensor->is_streaming) { - ret = -EBUSY; - goto unlock; - } - mode = v4l2_find_nearest_size(ov2680_mode_data, ARRAY_SIZE(ov2680_mode_data), width, height, fmt->width, fmt->height); - if (!mode) { - ret = -EINVAL; - goto unlock; - } + if (!mode) + return -EINVAL; if (format->which == V4L2_SUBDEV_FORMAT_TRY) { try_fmt = v4l2_subdev_get_try_format(sd, sd_state, 0); format->format = *try_fmt; + return 0; + } + + mutex_lock(>lock); + + if (sensor->is_streaming) { + ret = -EBUSY; goto unlock; } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Fix ov2680_enum_frame_interval()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Fix ov2680_enum_frame_interval() Author: Hans de Goede Date:Thu Aug 3 11:33:33 2023 +0200 Fix and simplify ov2680_enum_frame_interval(), the index is not an index into ov2680_mode_data[], so using OV2680_MODE_MAX is wrong. Instead it is an index indexing the different framerates for the resolution specified in fie->width, fie->height. Note validating fie->which is not necessary this is already done by the v4l2-core. Acked-by: Rui Miguel Silva Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 25 + 1 file changed, 17 insertions(+), 8 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 0adfacc70735..a83efd449993 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -527,21 +527,30 @@ static int ov2680_enum_frame_size(struct v4l2_subdev *sd, return 0; } +static bool ov2680_valid_frame_size(struct v4l2_subdev_frame_interval_enum *fie) +{ + int i; + + for (i = 0; i < OV2680_MODE_MAX; i++) { + if (fie->width == ov2680_mode_data[i].width && + fie->height == ov2680_mode_data[i].height) + return true; + } + + return false; +} + static int ov2680_enum_frame_interval(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_frame_interval_enum *fie) { - struct v4l2_fract tpf; + struct ov2680_dev *sensor = to_ov2680_dev(sd); - if (fie->index >= OV2680_MODE_MAX || fie->width > OV2680_WIDTH_MAX || - fie->height > OV2680_HEIGHT_MAX || - fie->which > V4L2_SUBDEV_FORMAT_ACTIVE) + /* Only 1 framerate */ + if (fie->index || !ov2680_valid_frame_size(fie)) return -EINVAL; - tpf.denominator = OV2680_FRAME_RATE; - tpf.numerator = 1; - - fie->interval = tpf; + fie->interval = sensor->frame_interval; return 0; } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Make setting the mode algorithm based
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Make setting the mode algorithm based Author: Hans de Goede Date:Thu Aug 3 11:33:36 2023 +0200 Instead of using a long fixed register settings list for each resolution, calculate the register settings based on the requested width + height. This is based on atomisp-ov2680 commit 0611888592df ("media: atomisp: ov2680: Make setting the modes algorithm based"). This will allow future enhancements like adding hblank and vblank controls and adding selection support. This also adds properly programming the ISP window and setting the manual ISP window control bit in register 0x5708, this is necessary for the hflip and vflip conrols to work properly. Acked-by: Rui Miguel Silva Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 334 + 1 file changed, 157 insertions(+), 177 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 76f97d053e45..012b95f90c1d 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -38,27 +38,48 @@ #define OV2680_REG_EXPOSURE_PK CCI_REG24(0x3500) #define OV2680_REG_R_MANUALCCI_REG8(0x3503) #define OV2680_REG_GAIN_PK CCI_REG16(0x350a) + +#define OV2680_REG_SENSOR_CTRL_0A CCI_REG8(0x370a) + +#define OV2680_REG_HORIZONTAL_STARTCCI_REG16(0x3800) +#define OV2680_REG_VERTICAL_START CCI_REG16(0x3802) +#define OV2680_REG_HORIZONTAL_END CCI_REG16(0x3804) +#define OV2680_REG_VERTICAL_ENDCCI_REG16(0x3806) +#define OV2680_REG_HORIZONTAL_OUTPUT_SIZE CCI_REG16(0x3808) +#define OV2680_REG_VERTICAL_OUTPUT_SIZECCI_REG16(0x380a) #define OV2680_REG_TIMING_HTS CCI_REG16(0x380c) #define OV2680_REG_TIMING_VTS CCI_REG16(0x380e) +#define OV2680_REG_ISP_X_WIN CCI_REG16(0x3810) +#define OV2680_REG_ISP_Y_WIN CCI_REG16(0x3812) +#define OV2680_REG_X_INC CCI_REG8(0x3814) +#define OV2680_REG_Y_INC CCI_REG8(0x3815) #define OV2680_REG_FORMAT1 CCI_REG8(0x3820) #define OV2680_REG_FORMAT2 CCI_REG8(0x3821) #define OV2680_REG_ISP_CTRL00 CCI_REG8(0x5080) +#define OV2680_REG_X_WIN CCI_REG16(0x5704) +#define OV2680_REG_Y_WIN CCI_REG16(0x5706) + #define OV2680_FRAME_RATE 30 -#define OV2680_WIDTH_MAX 1600 -#define OV2680_HEIGHT_MAX 1200 +#define OV2680_NATIVE_WIDTH1616 +#define OV2680_NATIVE_HEIGHT 1216 +#define OV2680_ACTIVE_WIDTH1600 +#define OV2680_ACTIVE_HEIGHT 1200 + +/* 66MHz pixel clock: 66MHz / 1704 * 1294 = 30fps */ +#define OV2680_PIXELS_PER_LINE 1704 +#define OV2680_LINES_PER_FRAME 1294 + +/* If possible send 16 extra rows / lines to the ISP as padding */ +#define OV2680_END_MARGIN 16 #define OV2680_DEFAULT_WIDTH 800 #define OV2680_DEFAULT_HEIGHT 600 -enum ov2680_mode_id { - OV2680_MODE_QUXGA_800_600, - OV2680_MODE_720P_1280_720, - OV2680_MODE_UXGA_1600_1200, - OV2680_MODE_MAX, -}; +/* For enum_frame_size() full-size + binned-/quarter-size */ +#define OV2680_FRAME_SIZES 2 static const char * const ov2680_supply_name[] = { "DOVDD", @@ -83,15 +104,6 @@ static const u8 ov2680_pll_multipliers[] = { [OV2680_24_MHZ] = 55, }; -struct ov2680_mode_info { - const char *name; - enum ov2680_mode_id id; - u32 width; - u32 height; - const struct reg_sequence *reg_data; - u32 reg_data_size; -}; - struct ov2680_ctrls { struct v4l2_ctrl_handler handler; struct v4l2_ctrl *exposure; @@ -104,6 +116,15 @@ struct ov2680_ctrls { struct ov2680_mode { struct v4l2_mbus_framefmt fmt; struct v4l2_fract frame_interval; + boolbinning; + u16 h_start; + u16 v_start; + u16 h_end; + u16 v_end; + u16 h_output_size; + u16 v_output_size; + u16 hts; + u16 vts; }; struct ov2680_dev { @@ -124,8 +145,6 @@ struct ov2680_dev { struct ov2680_ctrls ctrls; struct ov2680_mode mode; - - const struct ov2680_mode_info *current_mode;
[git:media_stage/master] media: ov2680: Fix regulators being left enabled on ov2680_power_on() errors
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Fix regulators being left enabled on ov2680_power_on() errors Author: Hans de Goede Date:Thu Aug 3 11:33:23 2023 +0200 When the ov2680_power_on() "sensor soft reset failed" path is hit during probe() the WARN() about putting an enabled regulator at drivers/regulator/core.c:2398 triggers 3 times (once for each regulator), filling dmesg with backtraces. Fix this by properly disabling the regulators on ov2680_power_on() errors. Fixes: 3ee47cad3e69 ("media: ov2680: Add Omnivision OV2680 sensor driver") Reviewed-by: Daniel Scally Acked-by: Rui Miguel Silva Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index e3652b5394c4..1f923acbbc07 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -475,7 +475,7 @@ static int ov2680_power_on(struct ov2680_dev *sensor) ret = ov2680_write_reg(sensor, OV2680_REG_SOFT_RESET, 0x01); if (ret != 0) { dev_err(dev, "sensor soft reset failed\n"); - return ret; + goto err_disable_regulators; } usleep_range(1000, 2000); } else { @@ -485,7 +485,7 @@ static int ov2680_power_on(struct ov2680_dev *sensor) ret = clk_prepare_enable(sensor->xvclk); if (ret < 0) - return ret; + goto err_disable_regulators; sensor->is_enabled = true; @@ -495,6 +495,10 @@ static int ov2680_power_on(struct ov2680_dev *sensor) ov2680_stream_disable(sensor); return 0; + +err_disable_regulators: + regulator_bulk_disable(OV2680_NUM_SUPPLIES, sensor->supplies); + return ret; } static int ov2680_s_power(struct v4l2_subdev *sd, int on) ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Add ov2680_mode struct
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Add ov2680_mode struct Author: Hans de Goede Date:Thu Aug 3 11:33:35 2023 +0200 Add an ov2680_mode struct to group together mode related state. For now this only contains the v4l2_mbus_framefmt and the frame_interval. This is a preparation patch for moving to calculating the per mode settings, which will store more info in the new ov2680_mode struct. Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 30 +- 1 file changed, 17 insertions(+), 13 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index e7d2e555e1c6..76f97d053e45 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -101,6 +101,11 @@ struct ov2680_ctrls { struct v4l2_ctrl *test_pattern; }; +struct ov2680_mode { + struct v4l2_mbus_framefmt fmt; + struct v4l2_fract frame_interval; +}; + struct ov2680_dev { struct device *dev; struct regmap *regmap; @@ -118,8 +123,7 @@ struct ov2680_dev { boolis_streaming; struct ov2680_ctrls ctrls; - struct v4l2_mbus_framefmt fmt; - struct v4l2_fract frame_interval; + struct ov2680_mode mode; const struct ov2680_mode_info *current_mode; }; @@ -338,7 +342,7 @@ static int ov2680_set_vflip(struct ov2680_dev *sensor, s32 val) if (ret < 0) return ret; - ov2680_set_bayer_order(sensor, >fmt); + ov2680_set_bayer_order(sensor, >mode.fmt); return 0; } @@ -354,7 +358,7 @@ static int ov2680_set_hflip(struct ov2680_dev *sensor, s32 val) if (ret < 0) return ret; - ov2680_set_bayer_order(sensor, >fmt); + ov2680_set_bayer_order(sensor, >mode.fmt); return 0; } @@ -467,7 +471,7 @@ static int ov2680_s_g_frame_interval(struct v4l2_subdev *sd, struct ov2680_dev *sensor = to_ov2680_dev(sd); mutex_lock(>lock); - fi->interval = sensor->frame_interval; + fi->interval = sensor->mode.frame_interval; mutex_unlock(>lock); return 0; @@ -515,7 +519,7 @@ static int ov2680_enum_mbus_code(struct v4l2_subdev *sd, if (code->pad != 0 || code->index != 0) return -EINVAL; - code->code = sensor->fmt.code; + code->code = sensor->mode.fmt.code; return 0; } @@ -536,7 +540,7 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd, fmt = v4l2_subdev_get_try_format(>sd, sd_state, format->pad); } else { - fmt = >fmt; + fmt = >mode.fmt; } format->format = *fmt; @@ -582,7 +586,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, } sensor->current_mode = mode; - sensor->fmt = format->format; + sensor->mode.fmt = format->format; unlock: mutex_unlock(>lock); @@ -640,7 +644,7 @@ static int ov2680_enum_frame_interval(struct v4l2_subdev *sd, if (fie->index || !ov2680_valid_frame_size(fie)) return -EINVAL; - fie->interval = sensor->frame_interval; + fie->interval = sensor->mode.frame_interval; return 0; } @@ -653,7 +657,7 @@ static int ov2680_s_ctrl(struct v4l2_ctrl *ctrl) /* Only apply changes to the controls if the device is powered up */ if (!pm_runtime_get_if_in_use(sensor->sd.dev)) { - ov2680_set_bayer_order(sensor, >fmt); + ov2680_set_bayer_order(sensor, >mode.fmt); return 0; } @@ -711,11 +715,11 @@ static int ov2680_mode_init(struct ov2680_dev *sensor) const struct ov2680_mode_info *init_mode; /* set initial mode */ - ov2680_fill_format(sensor, >fmt, + ov2680_fill_format(sensor, >mode.fmt, OV2680_DEFAULT_WIDTH, OV2680_DEFAULT_HEIGHT); - sensor->frame_interval.denominator = OV2680_FRAME_RATE; - sensor->frame_interval.numerator = 1; + sensor->mode.frame_interval.denominator = OV2680_FRAME_RATE; + sensor->mode.frame_interval.numerator = 1; init_mode = _mode_init_data; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Add a bunch of register tweaks
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Add a bunch of register tweaks Author: Hans de Goede Date:Thu Aug 3 11:33:40 2023 +0200 Usually when developing a sensor driver with help from the vendor the vendor will provide a bunch of register tweaks for optimal performance of the sensor. The atomisp-ov2680.c driver was (presumably) developed by Intel with help from OmniVision and indeed contains a bunch of register tweaks. Add these register tweaks to the "main" ov2680.c driver. Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 53 ++ 1 file changed, 53 insertions(+) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index b251265594b0..e6c99c14da8f 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -180,18 +180,71 @@ static const int ov2680_hv_flip_bayer_order[] = { }; static const struct reg_sequence ov2680_global_setting[] = { + /* MIPI PHY, 0x10 -> 0x1c enable bp_c_hs_en_lat and bp_d_hs_en_lat */ + {0x3016, 0x1c}, + /* R MANUAL set exposure and gain to manual (hw does not do auto) */ {0x3503, 0x03}, + /* Analog control register tweaks */ + {0x3603, 0x39}, /* Reset value 0x99 */ + {0x3604, 0x24}, /* Reset value 0x74 */ + {0x3621, 0x37}, /* Reset value 0x44 */ + + /* Sensor control register tweaks */ + {0x3701, 0x64}, /* Reset value 0x61 */ + {0x3705, 0x3c}, /* Reset value 0x21 */ + {0x370c, 0x50}, /* Reset value 0x10 */ + {0x370d, 0xc0}, /* Reset value 0x00 */ + {0x3718, 0x88}, /* Reset value 0x80 */ + + /* PSRAM tweaks */ + {0x3781, 0x80}, /* Reset value 0x00 */ + {0x3784, 0x0c}, /* Reset value 0x00, based on OV2680_R1A_AM10.ovt */ + {0x3789, 0x60}, /* Reset value 0x50 */ + + /* BLC CTRL00 0x01 -> 0x81 set avg_weight to 8 */ + {0x4000, 0x81}, + /* Set black level compensation range to 0 - 3 (default 0 - 11) */ {0x4008, 0x00}, {0x4009, 0x03}, + /* VFIFO R2 0x00 -> 0x02 set Frame reset enable */ + {0x4602, 0x02}, + + /* MIPI ctrl CLK PREPARE MIN change from 0x26 (38) -> 0x36 (54) */ + {0x481f, 0x36}, + + /* MIPI ctrl CLK LPX P MIN change from 0x32 (50) -> 0x36 (54) */ + {0x4825, 0x36}, + + /* R ISP CTRL2 0x20 -> 0x30, set sof_sel bit */ + {0x5002, 0x30}, + /* * Window CONTROL 0x00 -> 0x01, enable manual window control, * this is necessary for full size flip and mirror support. */ {0x5708, 0x01}, + + /* +* DPC CTRL0 0x14 -> 0x3e, set enable_tail, enable_3x3_cluster +* and enable_general_tail bits based OV2680_R1A_AM10.ovt. +*/ + {0x5780, 0x3e}, + + /* DPC MORE CONNECTION CASE THRE 0x0c (12) -> 0x02 (2) */ + {0x5788, 0x02}, + + /* DPC GAIN LIST1 0x0f (15) -> 0x08 (8) */ + {0x578e, 0x08}, + + /* DPC GAIN LIST2 0x3f (63) -> 0x0c (12) */ + {0x578f, 0x0c}, + + /* DPC THRE RATIO 0x04 (4) -> 0x00 (0) */ + {0x5792, 0x00}, }; static struct ov2680_dev *to_ov2680_dev(struct v4l2_subdev *sd) ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Fix ov2680_set_fmt() which == V4L2_SUBDEV_FORMAT_TRY not working
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Fix ov2680_set_fmt() which == V4L2_SUBDEV_FORMAT_TRY not working Author: Hans de Goede Date:Thu Aug 3 11:33:22 2023 +0200 ov2680_set_fmt() which == V4L2_SUBDEV_FORMAT_TRY was getting the try_fmt v4l2_mbus_framefmt struct from the passed in sd_state and then storing the contents of that into the return by reference format->format struct. While the right thing to do would be filling format->format based on the just looked up mode and then store the results of that in sd_state->pads[0].try_fmt . Before the previous change introducing ov2680_fill_format() this resulted in ov2680_set_fmt() which == V4L2_SUBDEV_FORMAT_TRY always returning the zero-ed out sd_state->pads[0].try_fmt in format->format breaking callers using this. After the introduction of ov2680_fill_format() which at least initializes sd_state->pads[0].try_fmt properly, format->format is now always being filled with the default 800x600 mode set by ov2680_init_cfg() independent of the actual requested mode. Move the filling of format->format with ov2680_fill_format() to before the if (which == V4L2_SUBDEV_FORMAT_TRY) and then store the filled in format->format in sd_state->pads[0].try_fmt to fix this. Note this removes the fmt local variable because IMHO having a local variable which points to a sub-struct of one of the function arguments just leads to confusion when reading the code. Fixes: 3ee47cad3e69 ("media: ov2680: Add Omnivision OV2680 sensor driver") Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index f2eb8d85a7e4..e3652b5394c4 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -603,7 +603,6 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_format *format) { struct ov2680_dev *sensor = to_ov2680_dev(sd); - struct v4l2_mbus_framefmt *fmt = >format; struct v4l2_mbus_framefmt *try_fmt; const struct ov2680_mode_info *mode; int ret = 0; @@ -612,14 +611,18 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, return -EINVAL; mode = v4l2_find_nearest_size(ov2680_mode_data, - ARRAY_SIZE(ov2680_mode_data), width, - height, fmt->width, fmt->height); + ARRAY_SIZE(ov2680_mode_data), + width, height, + format->format.width, + format->format.height); if (!mode) return -EINVAL; + ov2680_fill_format(sensor, >format, mode->width, mode->height); + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { try_fmt = v4l2_subdev_get_try_format(sd, sd_state, 0); - format->format = *try_fmt; + *try_fmt = format->format; return 0; } @@ -630,8 +633,6 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, goto unlock; } - ov2680_fill_format(sensor, fmt, mode->width, mode->height); - sensor->current_mode = mode; sensor->fmt = format->format; sensor->mode_pending_changes = true; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Convert to new CCI register access helpers
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Convert to new CCI register access helpers Author: Hans de Goede Date:Thu Aug 3 11:33:24 2023 +0200 Use the new comon CCI register access helpers to replace the private register access helpers in the ov2680 driver. Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/Kconfig | 1 + drivers/media/i2c/ov2680.c | 224 - 2 files changed, 58 insertions(+), 167 deletions(-) --- diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index aa55582a2cd0..74ff833ff48c 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -332,6 +332,7 @@ config VIDEO_OV2659 config VIDEO_OV2680 tristate "OmniVision OV2680 sensor support" + select V4L2_CCI_I2C help This is a Video4Linux2 sensor driver for the OmniVision OV2680 camera. diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 1f923acbbc07..02ac5b5e6583 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -10,49 +10,45 @@ * */ -#include #include #include #include +#include #include #include #include #include -#include +#include #include +#include #include #include #include -#define OV2680_XVCLK_VALUE 2400 +#define OV2680_XVCLK_VALUE 2400 -#define OV2680_CHIP_ID 0x2680 +#define OV2680_CHIP_ID 0x2680 -#define OV2680_REG_STREAM_CTRL 0x0100 -#define OV2680_REG_SOFT_RESET 0x0103 +#define OV2680_REG_STREAM_CTRL CCI_REG8(0x0100) +#define OV2680_REG_SOFT_RESET CCI_REG8(0x0103) -#define OV2680_REG_CHIP_ID_HIGH0x300a -#define OV2680_REG_CHIP_ID_LOW 0x300b +#define OV2680_REG_CHIP_ID CCI_REG16(0x300a) -#define OV2680_REG_R_MANUAL0x3503 -#define OV2680_REG_GAIN_PK 0x350a -#define OV2680_REG_EXPOSURE_PK_HIGH0x3500 -#define OV2680_REG_TIMING_HTS 0x380c -#define OV2680_REG_TIMING_VTS 0x380e -#define OV2680_REG_FORMAT1 0x3820 -#define OV2680_REG_FORMAT2 0x3821 +#define OV2680_REG_EXPOSURE_PK CCI_REG24(0x3500) +#define OV2680_REG_R_MANUALCCI_REG8(0x3503) +#define OV2680_REG_GAIN_PK CCI_REG16(0x350a) +#define OV2680_REG_TIMING_HTS CCI_REG16(0x380c) +#define OV2680_REG_TIMING_VTS CCI_REG16(0x380e) +#define OV2680_REG_FORMAT1 CCI_REG8(0x3820) +#define OV2680_REG_FORMAT2 CCI_REG8(0x3821) -#define OV2680_REG_ISP_CTRL00 0x5080 +#define OV2680_REG_ISP_CTRL00 CCI_REG8(0x5080) -#define OV2680_FRAME_RATE 30 +#define OV2680_FRAME_RATE 30 -#define OV2680_REG_VALUE_8BIT 1 -#define OV2680_REG_VALUE_16BIT 2 -#define OV2680_REG_VALUE_24BIT 3 - -#define OV2680_WIDTH_MAX 1600 -#define OV2680_HEIGHT_MAX 1200 +#define OV2680_WIDTH_MAX 1600 +#define OV2680_HEIGHT_MAX 1200 #define OV2680_DEFAULT_WIDTH 800 #define OV2680_DEFAULT_HEIGHT 600 @@ -64,11 +60,6 @@ enum ov2680_mode_id { OV2680_MODE_MAX, }; -struct reg_value { - u16 reg_addr; - u8 val; -}; - static const char * const ov2680_supply_name[] = { "DOVDD", "DVDD", @@ -82,7 +73,7 @@ struct ov2680_mode_info { enum ov2680_mode_id id; u32 width; u32 height; - const struct reg_value *reg_data; + const struct reg_sequence *reg_data; u32 reg_data_size; }; @@ -97,6 +88,7 @@ struct ov2680_ctrls { struct ov2680_dev { struct i2c_client *i2c_client; + struct regmap *regmap; struct v4l2_subdev sd; struct media_padpad; @@ -133,7 +125,7 @@ static const int ov2680_hv_flip_bayer_order[] = { MEDIA_BUS_FMT_SRGGB10_1X10, }; -static const struct reg_value ov2680_setting_30fps_QUXGA_800_600[] = { +static const struct reg_sequence ov2680_setting_30fps_QUXGA_800_600[] = { {0x3086, 0x01}, {0x370a, 0x23}, {0x3808, 0x03}, {0x3809, 0x20}, {0x380a, 0x02}, {0x380b, 0x58}, {0x380c, 0x06}, {0x380d, 0xac}, {0x380e, 0x02}, {0x380f, 0x84}, {0x3811, 0x04}, {0x3813, 0x04}, @@ -142,14 +134,14 @@ static const struct reg_value ov2680_setting_30fps_QUXGA_800_600[] = { {0x3503, 0x03}, }; -static const struct reg_value ov2680_setting_30fps_720P_1280_720[] = { +static const struct reg_sequence ov2680_setting_30fps_720P_1280_720[] = {
[git:media_stage/master] media: ov2680: Check for "powerdown" GPIO con-id before checking for "reset" GPIO con-id
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Check for "powerdown" GPIO con-id before checking for "reset" GPIO con-id Author: Hans de Goede Date:Thu Aug 3 11:33:27 2023 +0200 The datasheet of the OV2680 labels the single GPIO to put the sensor in powersaving mode as XSHUTDN aka shutdown, _not_ reset. This is important because some boards have standardized sensor connectors which allow connecting various sensor modules. These connectors have both reset and powerdown signals and the powerdown signal is routed to the OV2680's XSHUTDN pin. On x86/ACPI multiple Bay Trail, Cherry Trail, Sky Lake and Kaby Lake models have an OV2680 connected to the ISP2 / IPU3. On these devices the GPIOS are not described in DT instead the GPIOs are described with an Intel specific DSM which labels them as either powerdown or reset. Often this DSM returns both reset and powerdown pins even though the OV2680 has only 1 such pin. For the ov2680 driver to work on these devices it must use the GPIO with "powerdown" as con-id, matching the XSHUTDN name from the datasheet. As for why "powerdown" vs say "shutdown" the ACPI DSM -> con-id mapping code is shared, so we must use standardized names and currently all of the following sensor drivers already use "powerdown": adv7180, gc0310, isl7998x, ov02a10, ov2659, ov5640, ov5648, ov5670, ov5693, ov7670, ov772x, ov7740, ov8858, ov8865 and ov9650 . Where as the hi846 driver is the lonely standout using "shutdown". Try the "powerdown" con-id first to make things work, falling back to "reset" to keep existing DT setups working. Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 29 - 1 file changed, 20 insertions(+), 9 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index bc0ca2927370..b912ae7a63da 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -97,7 +97,7 @@ struct ov2680_dev { u32 xvclk_freq; struct regulator_bulk_data supplies[OV2680_NUM_SUPPLIES]; - struct gpio_desc*reset_gpio; + struct gpio_desc*pwdn_gpio; struct mutexlock; /* protect members */ boolis_enabled; @@ -180,19 +180,19 @@ static inline struct v4l2_subdev *ctrl_to_sd(struct v4l2_ctrl *ctrl) static void ov2680_power_up(struct ov2680_dev *sensor) { - if (!sensor->reset_gpio) + if (!sensor->pwdn_gpio) return; - gpiod_set_value(sensor->reset_gpio, 0); + gpiod_set_value(sensor->pwdn_gpio, 0); usleep_range(5000, 1); } static void ov2680_power_down(struct ov2680_dev *sensor) { - if (!sensor->reset_gpio) + if (!sensor->pwdn_gpio) return; - gpiod_set_value(sensor->reset_gpio, 1); + gpiod_set_value(sensor->pwdn_gpio, 1); usleep_range(5000, 1); } @@ -336,7 +336,7 @@ static int ov2680_power_on(struct ov2680_dev *sensor) return ret; } - if (!sensor->reset_gpio) { + if (!sensor->pwdn_gpio) { ret = cci_write(sensor->regmap, OV2680_REG_SOFT_RESET, 0x01, NULL); if (ret != 0) { @@ -697,16 +697,27 @@ static int ov2680_check_id(struct ov2680_dev *sensor) static int ov2680_parse_dt(struct ov2680_dev *sensor) { struct device *dev = sensor->dev; + struct gpio_desc *gpio; int ret; - sensor->reset_gpio = devm_gpiod_get_optional(dev, "reset", -GPIOD_OUT_HIGH); - ret = PTR_ERR_OR_ZERO(sensor->reset_gpio); + /* +* The pin we want is named XSHUTDN in the datasheet. Linux sensor +* drivers have standardized on using "powerdown" as con-id name +* for powerdown or shutdown pins. Older DTB files use "reset", +* so fallback to that if there is no "powerdown" pin. +*/ + gpio = devm_gpiod_get_optional(dev, "powerdown", GPIOD_OUT_HIGH); + if (!gpio) + gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); + + ret = PTR_ERR_OR_ZERO(gpio); if (ret < 0) { dev_dbg(dev, "error while getting reset gpio: %d\n", ret); return ret; } + sensor->pwdn_gpio = gpio; + sensor->xvclk = devm_clk_get(dev, "xvclk"); if (IS_ERR(sensor->xvclk)) { dev_err(dev, "xvclk clock missing or invalid\n"); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Store dev instead of i2c_client in ov2680_dev
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Store dev instead of i2c_client in ov2680_dev Author: Hans de Goede Date:Thu Aug 3 11:33:25 2023 +0200 Now that the cci_* register access helpers are used access to the i2c_client after probe() is no longer necessary. Directly store a struct device *dev pointing to >dev inside ov2680_dev to make the code simpler. Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 30 +++--- 1 file changed, 11 insertions(+), 19 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 02ac5b5e6583..9c5f4ac592d8 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -87,7 +87,7 @@ struct ov2680_ctrls { }; struct ov2680_dev { - struct i2c_client *i2c_client; + struct device *dev; struct regmap *regmap; struct v4l2_subdev sd; @@ -172,11 +172,6 @@ static struct ov2680_dev *to_ov2680_dev(struct v4l2_subdev *sd) return container_of(sd, struct ov2680_dev, sd); } -static struct device *ov2680_to_dev(struct ov2680_dev *sensor) -{ - return >i2c_client->dev; -} - static inline struct v4l2_subdev *ctrl_to_sd(struct v4l2_ctrl *ctrl) { return _of(ctrl->handler, struct ov2680_dev, @@ -344,7 +339,6 @@ static int ov2680_power_off(struct ov2680_dev *sensor) static int ov2680_power_on(struct ov2680_dev *sensor) { - struct device *dev = ov2680_to_dev(sensor); int ret; if (sensor->is_enabled) @@ -352,7 +346,7 @@ static int ov2680_power_on(struct ov2680_dev *sensor) ret = regulator_bulk_enable(OV2680_NUM_SUPPLIES, sensor->supplies); if (ret < 0) { - dev_err(dev, "failed to enable regulators: %d\n", ret); + dev_err(sensor->dev, "failed to enable regulators: %d\n", ret); return ret; } @@ -360,7 +354,7 @@ static int ov2680_power_on(struct ov2680_dev *sensor) ret = cci_write(sensor->regmap, OV2680_REG_SOFT_RESET, 0x01, NULL); if (ret != 0) { - dev_err(dev, "sensor soft reset failed\n"); + dev_err(sensor->dev, "sensor soft reset failed\n"); goto err_disable_regulators; } usleep_range(1000, 2000); @@ -656,13 +650,13 @@ static int ov2680_mode_init(struct ov2680_dev *sensor) static int ov2680_v4l2_register(struct ov2680_dev *sensor) { + struct i2c_client *client = to_i2c_client(sensor->dev); const struct v4l2_ctrl_ops *ops = _ctrl_ops; struct ov2680_ctrls *ctrls = >ctrls; struct v4l2_ctrl_handler *hdl = >handler; int ret = 0; - v4l2_i2c_subdev_init(>sd, sensor->i2c_client, -_subdev_ops); + v4l2_i2c_subdev_init(>sd, client, _subdev_ops); sensor->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE; sensor->pad.flags = MEDIA_PAD_FL_SOURCE; @@ -719,14 +713,12 @@ static int ov2680_get_regulators(struct ov2680_dev *sensor) for (i = 0; i < OV2680_NUM_SUPPLIES; i++) sensor->supplies[i].supply = ov2680_supply_name[i]; - return devm_regulator_bulk_get(>i2c_client->dev, - OV2680_NUM_SUPPLIES, - sensor->supplies); + return devm_regulator_bulk_get(sensor->dev, + OV2680_NUM_SUPPLIES, sensor->supplies); } static int ov2680_check_id(struct ov2680_dev *sensor) { - struct device *dev = ov2680_to_dev(sensor); u64 chip_id; int ret; @@ -734,12 +726,12 @@ static int ov2680_check_id(struct ov2680_dev *sensor) ret = cci_read(sensor->regmap, OV2680_REG_CHIP_ID, _id, NULL); if (ret < 0) { - dev_err(dev, "failed to read chip id\n"); + dev_err(sensor->dev, "failed to read chip id\n"); return -ENODEV; } if (chip_id != OV2680_CHIP_ID) { - dev_err(dev, "chip id: 0x%04llx does not match expected 0x%04x\n", + dev_err(sensor->dev, "chip id: 0x%04llx does not match expected 0x%04x\n", chip_id, OV2680_CHIP_ID); return -ENODEV; } @@ -749,7 +741,7 @@ static int ov2680_check_id(struct ov2680_dev *sensor) static int ov2680_parse_dt(struct ov2680_dev *sensor) { - struct device *dev = ov2680_to_dev(sensor); + struct device *dev = sensor->dev; int ret; sen
[git:media_stage/master] media: ov2680: Add link-freq and pixel-rate controls
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Add link-freq and pixel-rate controls Author: Hans de Goede Date:Thu Aug 3 11:33:43 2023 +0200 Add read-only link-freq and pixel-rate controls. This is necessary for the sensor to work with the ipu3-cio2 driver and for libcamera. Acked-by: Rui Miguel Silva Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 24 1 file changed, 24 insertions(+) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 1f59013e440c..83ec034b5307 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -75,6 +75,12 @@ #define OV2680_MIN_CROP_WIDTH 2 #define OV2680_MIN_CROP_HEIGHT 2 +/* Fixed pre-div of 1/2 */ +#define OV2680_PLL_PREDIV0 2 + +/* Pre-div configurable through reg 0x3080, left at its default of 0x02 : 1/2 */ +#define OV2680_PLL_PREDIV 2 + /* 66MHz pixel clock: 66MHz / 1704 * 1294 = 30fps */ #define OV2680_PIXELS_PER_LINE 1704 #define OV2680_LINES_PER_FRAME 1294 @@ -121,6 +127,8 @@ struct ov2680_ctrls { struct v4l2_ctrl *hflip; struct v4l2_ctrl *vflip; struct v4l2_ctrl *test_pattern; + struct v4l2_ctrl *link_freq; + struct v4l2_ctrl *pixel_rate; }; struct ov2680_mode { @@ -147,6 +155,8 @@ struct ov2680_dev { struct clk *xvclk; u32 xvclk_freq; u8 pll_mult; + s64 link_freq[1]; + u64 pixel_rate; struct regulator_bulk_data supplies[OV2680_NUM_SUPPLIES]; struct gpio_desc*pwdn_gpio; @@ -931,6 +941,12 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor) ctrls->gain = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_ANALOGUE_GAIN, 0, 1023, 1, 250); + ctrls->link_freq = v4l2_ctrl_new_int_menu(hdl, NULL, V4L2_CID_LINK_FREQ, + 0, 0, sensor->link_freq); + ctrls->pixel_rate = v4l2_ctrl_new_std(hdl, NULL, V4L2_CID_PIXEL_RATE, + 0, sensor->pixel_rate, + 1, sensor->pixel_rate); + if (hdl->error) { ret = hdl->error; goto cleanup_entity; @@ -938,6 +954,7 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor) ctrls->vflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT; ctrls->hflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT; + ctrls->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY; sensor->sd.ctrl_handler = hdl; @@ -1067,6 +1084,13 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) sensor->pll_mult = ov2680_pll_multipliers[i]; + sensor->link_freq[0] = sensor->xvclk_freq / OV2680_PLL_PREDIV0 / + OV2680_PLL_PREDIV * sensor->pll_mult; + + /* CSI-2 is double data rate, bus-format is 10 bpp */ + sensor->pixel_rate = sensor->link_freq[0] * 2; + do_div(sensor->pixel_rate, 10); + return 0; } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Add runtime-pm support
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Add runtime-pm support Author: Hans de Goede Date:Thu Aug 3 11:33:26 2023 +0200 Remove the obsolete s_power() callback and instead use runtime-pm + autosuspend, powering-on the sensor on s_stream(1) and releasing the runtime-pm reference on s_stream(0). This also removes the need for ov2680_mode_restore() instead ov2680_stream_enable() now takes care of all sensor initalization after power-on. This is a preparation patch for adding ACPI support. Note this also removes putting the clock lane into LP-11 state from ov2680_power_on() since now streaming will start immediately after powering on the sensor there is no need to put the clock lane in a low power state. Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 134 + 1 file changed, 61 insertions(+), 73 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 9c5f4ac592d8..bc0ca2927370 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -99,7 +100,6 @@ struct ov2680_dev { struct gpio_desc*reset_gpio; struct mutexlock; /* protect members */ - boolmode_pending_changes; boolis_enabled; boolis_streaming; @@ -282,19 +282,15 @@ static int ov2680_exposure_set(struct ov2680_dev *sensor, u32 exp) } static int ov2680_stream_enable(struct ov2680_dev *sensor) -{ - return cci_write(sensor->regmap, OV2680_REG_STREAM_CTRL, 1, NULL); -} - -static int ov2680_stream_disable(struct ov2680_dev *sensor) -{ - return cci_write(sensor->regmap, OV2680_REG_STREAM_CTRL, 0, NULL); -} - -static int ov2680_mode_set(struct ov2680_dev *sensor) { int ret; + ret = regmap_multi_reg_write(sensor->regmap, +ov2680_mode_init_data.reg_data, +ov2680_mode_init_data.reg_data_size); + if (ret < 0) + return ret; + ret = regmap_multi_reg_write(sensor->regmap, sensor->current_mode->reg_data, sensor->current_mode->reg_data_size); @@ -306,22 +302,12 @@ static int ov2680_mode_set(struct ov2680_dev *sensor) if (ret < 0) return ret; - sensor->mode_pending_changes = false; - - return 0; + return cci_write(sensor->regmap, OV2680_REG_STREAM_CTRL, 1, NULL); } -static int ov2680_mode_restore(struct ov2680_dev *sensor) +static int ov2680_stream_disable(struct ov2680_dev *sensor) { - int ret; - - ret = regmap_multi_reg_write(sensor->regmap, -ov2680_mode_init_data.reg_data, -ov2680_mode_init_data.reg_data_size); - if (ret < 0) - return ret; - - return ov2680_mode_set(sensor); + return cci_write(sensor->regmap, OV2680_REG_STREAM_CTRL, 0, NULL); } static int ov2680_power_off(struct ov2680_dev *sensor) @@ -369,11 +355,6 @@ static int ov2680_power_on(struct ov2680_dev *sensor) sensor->is_enabled = true; - /* Set clock lane into LP-11 state */ - ov2680_stream_enable(sensor); - usleep_range(1000, 2000); - ov2680_stream_disable(sensor); - return 0; err_disable_regulators: @@ -381,26 +362,6 @@ err_disable_regulators: return ret; } -static int ov2680_s_power(struct v4l2_subdev *sd, int on) -{ - struct ov2680_dev *sensor = to_ov2680_dev(sd); - int ret = 0; - - mutex_lock(>lock); - - if (on) - ret = ov2680_power_on(sensor); - else - ret = ov2680_power_off(sensor); - - if (on && ret == 0) - ret = ov2680_mode_restore(sensor); - - mutex_unlock(>lock); - - return ret; -} - static int ov2680_s_g_frame_interval(struct v4l2_subdev *sd, struct v4l2_subdev_frame_interval *fi) { @@ -423,16 +384,20 @@ static int ov2680_s_stream(struct v4l2_subdev *sd, int enable) if (sensor->is_streaming == !!enable) goto unlock; - if (enable && sensor->mode_pending_changes) { - ret = ov2680_mode_set(sensor); + if (enable) { + ret = pm_runtime_resume_and_get(sensor->sd.dev); if (ret < 0) goto unlock; - } - if (enable) ret = ov2680_stream_enable(sensor); - else +
[git:media_stage/master] media: ov2680: Drop is_enabled flag
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Drop is_enabled flag Author: Hans de Goede Date:Thu Aug 3 11:33:28 2023 +0200 With runtime-pm it is guaranteed that ov2680_power_on() and ov2680_power_off() will always be called in a balanced way; and the is_enabled check in ov2680_s_ctrl() can be replaced by checking the runtime-suspend state. So there is no more need for the is_enabled flag, remove it. While at it also make sure that flip control changes while suspended still lead to the bayer-order getting updated so that get_fmt returns the correct bayer-order. Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index b912ae7a63da..cf84701a6a5a 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -100,7 +100,6 @@ struct ov2680_dev { struct gpio_desc*pwdn_gpio; struct mutexlock; /* protect members */ - boolis_enabled; boolis_streaming; struct ov2680_ctrls ctrls; @@ -312,14 +311,9 @@ static int ov2680_stream_disable(struct ov2680_dev *sensor) static int ov2680_power_off(struct ov2680_dev *sensor) { - if (!sensor->is_enabled) - return 0; - clk_disable_unprepare(sensor->xvclk); ov2680_power_down(sensor); regulator_bulk_disable(OV2680_NUM_SUPPLIES, sensor->supplies); - sensor->is_enabled = false; - return 0; } @@ -327,9 +321,6 @@ static int ov2680_power_on(struct ov2680_dev *sensor) { int ret; - if (sensor->is_enabled) - return 0; - ret = regulator_bulk_enable(OV2680_NUM_SUPPLIES, sensor->supplies); if (ret < 0) { dev_err(sensor->dev, "failed to enable regulators: %d\n", ret); @@ -353,8 +344,6 @@ static int ov2680_power_on(struct ov2680_dev *sensor) if (ret < 0) goto err_disable_regulators; - sensor->is_enabled = true; - return 0; err_disable_regulators: @@ -541,26 +530,37 @@ static int ov2680_s_ctrl(struct v4l2_ctrl *ctrl) { struct v4l2_subdev *sd = ctrl_to_sd(ctrl); struct ov2680_dev *sensor = to_ov2680_dev(sd); + int ret; - if (!sensor->is_enabled) + /* Only apply changes to the controls if the device is powered up */ + if (!pm_runtime_get_if_in_use(sensor->sd.dev)) { + ov2680_set_bayer_order(sensor, >fmt); return 0; + } switch (ctrl->id) { case V4L2_CID_GAIN: - return ov2680_gain_set(sensor, ctrl->val); + ret = ov2680_gain_set(sensor, ctrl->val); + break; case V4L2_CID_EXPOSURE: - return ov2680_exposure_set(sensor, ctrl->val); + ret = ov2680_exposure_set(sensor, ctrl->val); + break; case V4L2_CID_VFLIP: - return ov2680_set_vflip(sensor, ctrl->val); + ret = ov2680_set_vflip(sensor, ctrl->val); + break; case V4L2_CID_HFLIP: - return ov2680_set_hflip(sensor, ctrl->val); + ret = ov2680_set_hflip(sensor, ctrl->val); + break; case V4L2_CID_TEST_PATTERN: - return ov2680_test_pattern_set(sensor, ctrl->val); + ret = ov2680_test_pattern_set(sensor, ctrl->val); + break; default: + ret = -EINVAL; break; } - return -EINVAL; + pm_runtime_put(sensor->sd.dev); + return ret; } static const struct v4l2_ctrl_ops ov2680_ctrl_ops = { ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: MAINTAINERS: Add Hans de Goede as OV2680 sensor driver maintainer
This is an automatic generated email to let you know that the following patch were queued: Subject: media: MAINTAINERS: Add Hans de Goede as OV2680 sensor driver maintainer Author: Hans de Goede Date:Thu Aug 3 11:33:45 2023 +0200 Add myself as OV2680 sensor driver maintainer. Reviewed-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab MAINTAINERS | 1 + 1 file changed, 1 insertion(+) --- diff --git a/MAINTAINERS b/MAINTAINERS index 48e5e71afb13..9005cf3ce401 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15608,6 +15608,7 @@ F: drivers/media/i2c/ov13b10.c OMNIVISION OV2680 SENSOR DRIVER M: Rui Miguel Silva +M: Hans de Goede L: linux-me...@vger.kernel.org S: Maintained T: git git://linuxtv.org/media_tree.git ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Wait for endpoint fwnode before continuing with probe()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Wait for endpoint fwnode before continuing with probe() Author: Hans de Goede Date:Thu Aug 3 11:33:31 2023 +0200 Defer probe() until the endpoint fwnode is available. This is necessary on ACPI platforms where the bridge code creating the fwnodes may also e.g. set the "clock-frequency" device property and add GPIO mappings. Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index a8c257f3bcd6..d4664581b49b 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -717,10 +717,22 @@ static int ov2680_check_id(struct ov2680_dev *sensor) static int ov2680_parse_dt(struct ov2680_dev *sensor) { struct device *dev = sensor->dev; + struct fwnode_handle *ep_fwnode; struct gpio_desc *gpio; unsigned int rate = 0; int i, ret; + /* +* Sometimes the fwnode graph is initialized by the bridge driver. +* Bridge drivers doing this may also add GPIO mappings, wait for this. +*/ + ep_fwnode = fwnode_graph_get_next_endpoint(dev_fwnode(dev), NULL); + if (!ep_fwnode) + return dev_err_probe(dev, -EPROBE_DEFER, +"waiting for fwnode graph endpoint\n"); + + fwnode_handle_put(ep_fwnode); + /* * The pin we want is named XSHUTDN in the datasheet. Linux sensor * drivers have standardized on using "powerdown" as con-id name @@ -801,7 +813,7 @@ static int ov2680_probe(struct i2c_client *client) ret = ov2680_parse_dt(sensor); if (ret < 0) - return -EINVAL; + return ret; ret = ov2680_mode_init(sensor); if (ret < 0) ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Annotate the per mode register setting lists
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Annotate the per mode register setting lists Author: Hans de Goede Date:Thu Aug 3 11:33:34 2023 +0200 Annotate the per mode register setting lists. This is a preparation patch for moving to calculating the per mode settings, allowing to set any mode through cropping. The annotations make it easier to see which registers are mode dependent and which are fixed. Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 118 +++-- 1 file changed, 104 insertions(+), 14 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index a83efd449993..e7d2e555e1c6 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -140,27 +140,117 @@ static const int ov2680_hv_flip_bayer_order[] = { }; static const struct reg_sequence ov2680_setting_30fps_QUXGA_800_600[] = { - {0x3086, 0x01}, {0x370a, 0x23}, {0x3808, 0x03}, {0x3809, 0x20}, - {0x380a, 0x02}, {0x380b, 0x58}, {0x380c, 0x06}, {0x380d, 0xac}, - {0x380e, 0x02}, {0x380f, 0x84}, {0x3811, 0x04}, {0x3813, 0x04}, - {0x3814, 0x31}, {0x3815, 0x31}, {0x3820, 0xc0}, {0x4008, 0x00}, - {0x4009, 0x03}, {0x4837, 0x1e}, {0x3501, 0x4e}, {0x3502, 0xe0}, + /* Set PLL SP DIV to 1 for binning mode */ + {0x3086, 0x01}, + + /* Sensor control register 0x0a to 0x23 for binning mode */ + {0x370a, 0x23}, + + /* Set X and Y output size to 800x600 */ + {0x3808, 0x03}, + {0x3809, 0x20}, + {0x380a, 0x02}, + {0x380b, 0x58}, + + /* Set HTS + VTS to 1708x644 */ + {0x380c, 0x06}, + {0x380d, 0xac}, + {0x380e, 0x02}, + {0x380f, 0x84}, + + /* Set ISP WIN X and Y start to 4x4 */ + {0x3811, 0x04}, + {0x3813, 0x04}, + + /* Set X INC and Y INC for binning */ + {0x3814, 0x31}, + {0x3815, 0x31}, + + /* Initialize FORMAT1 to default/reset value (vflip disabled) */ + {0x3820, 0xc0}, + + /* Set black level compensation range to 0 - 3 (default 0 - 11) */ + {0x4008, 0x00}, + {0x4009, 0x03}, + + /* Set MIPI pclk period to 0x1e (default/reset is 0x18) */ + {0x4837, 0x1e}, + + /* Initialize exposure to 0x4ee (overridden by the ctrl, drop this */ + {0x3501, 0x4e}, + {0x3502, 0xe0}, + + /* R MANUAL set exposure and gain to manual (hw does not do auto) */ {0x3503, 0x03}, }; static const struct reg_sequence ov2680_setting_30fps_720P_1280_720[] = { - {0x3086, 0x00}, {0x3808, 0x05}, {0x3809, 0x00}, {0x380a, 0x02}, - {0x380b, 0xd0}, {0x380c, 0x06}, {0x380d, 0xa8}, {0x380e, 0x05}, - {0x380f, 0x0e}, {0x3811, 0x08}, {0x3813, 0x06}, {0x3814, 0x11}, - {0x3815, 0x11}, {0x3820, 0xc0}, {0x4008, 0x00}, + /* Set PLL SP DIV to 0 for not binning mode */ + {0x3086, 0x00}, + + /* Set X and Y output size to 1280x720 */ + {0x3808, 0x05}, + {0x3809, 0x00}, + {0x380a, 0x02}, + {0x380b, 0xd0}, + + /* Set HTS + VTS to 1704x1294 */ + {0x380c, 0x06}, + {0x380d, 0xa8}, + {0x380e, 0x05}, + {0x380f, 0x0e}, + + /* Set ISP WIN X and Y start to 8x6 */ + {0x3811, 0x08}, + {0x3813, 0x06}, + + /* Set X INC and Y INC for non binning */ + {0x3814, 0x11}, + {0x3815, 0x11}, + + /* Initialize FORMAT1 to default/reset value (vflip disabled) */ + {0x3820, 0xc0}, + + /* Set backlight compensation range start to 0 */ + {0x4008, 0x00}, }; static const struct reg_sequence ov2680_setting_30fps_UXGA_1600_1200[] = { - {0x3086, 0x00}, {0x3501, 0x4e}, {0x3502, 0xe0}, {0x3808, 0x06}, - {0x3809, 0x40}, {0x380a, 0x04}, {0x380b, 0xb0}, {0x380c, 0x06}, - {0x380d, 0xa8}, {0x380e, 0x05}, {0x380f, 0x0e}, {0x3811, 0x00}, - {0x3813, 0x00}, {0x3814, 0x11}, {0x3815, 0x11}, {0x3820, 0xc0}, - {0x4008, 0x00}, {0x4837, 0x18} + /* Set PLL SP DIV to 0 for not binning mode */ + {0x3086, 0x00}, + + /* Initialize exposure to 0x4ee (overridden by the ctrl, drop this */ + {0x3501, 0x4e}, + {0x3502, 0xe0}, + + /* Set X and Y output size to 1600x1200 */ + {0x3808, 0x06}, + {0x3809, 0x40}, + {0x380a, 0x04}, + {0x380b, 0xb0}, + + /* Set HTS + VTS to 1704x1294 */ + {0x380c, 0x06}, + {0x380d, 0xa8}, + {0x380e, 0x05}, + {0x380f, 0x0e}, + + /* Set ISP WIN X and Y start to 0x0 */ + {0x3811, 0x00}, + {0x3813, 0x00}, + + /* Set X INC and Y INC for non binning */ + {0x3814, 0x11}, + {0x3815, 0x11}, + + /* Initialize FORMAT1 to default/reset value (vflip disabled) */ + {0x3820, 0xc0}, + + /* Set backlight
[git:media_stage/master] media: ov2680: Add support for ACPI enumeration
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Add support for ACPI enumeration Author: Hans de Goede Date:Thu Aug 3 11:33:32 2023 +0200 Add an acpi_match_table now that all the other bits necessary for ACPI support are in place. The OVTI prefix used for the ACPI-HID is used for various OmniVision sensors on many generations x86 tablets and laptops. The OVTI2680 HID specifically is used on multiple models spanning at least 4 different Intel CPU models (2 ISP2, 2 IPU3). Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Reviewed-by: Andy Shevchenko Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 7 +++ 1 file changed, 7 insertions(+) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index d4664581b49b..0adfacc70735 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -932,11 +932,18 @@ static const struct of_device_id ov2680_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, ov2680_dt_ids); +static const struct acpi_device_id ov2680_acpi_ids[] = { + { "OVTI2680" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(acpi, ov2680_acpi_ids); + static struct i2c_driver ov2680_i2c_driver = { .driver = { .name = "ov2680", .pm = pm_sleep_ptr(_pm_ops), .of_match_table = ov2680_dt_ids, + .acpi_match_table = ov2680_acpi_ids, }, .probe = ov2680_probe, .remove = ov2680_remove, ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Fix exposure and gain ctrls range and default value
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Fix exposure and gain ctrls range and default value Author: Hans de Goede Date:Thu Aug 3 11:33:39 2023 +0200 The exposure control's max effective value is VTS - 8, set the control range to match this. Thas means that if/when a future commit makes VTS configurable as a control itself the exposure range needs to be updated dynamically to match the VTS value. The gain control goes from 0 - 1023, higher values wrap around to the lowest gain setting. The gain control, controls an analog gain so use V4L2_CID_ANALOGUE_GAIN for it instead of V4L2_CID_GAIN. Also stop setting 0 as default for both controls this leads to a totally black picture which is no good. This is esp. important for tests of the sensor driver without (userspace driven) auto exposure / gain. Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index ecd99e6669bd..b251265594b0 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -81,6 +81,9 @@ /* If possible send 16 extra rows / lines to the ISP as padding */ #define OV2680_END_MARGIN 16 +/* Max exposure time is VTS - 8 */ +#define OV2680_INTEGRATION_TIME_MARGIN 8 + #define OV2680_DEFAULT_WIDTH 800 #define OV2680_DEFAULT_HEIGHT 600 @@ -779,7 +782,7 @@ static int ov2680_s_ctrl(struct v4l2_ctrl *ctrl) } switch (ctrl->id) { - case V4L2_CID_GAIN: + case V4L2_CID_ANALOGUE_GAIN: ret = ov2680_gain_set(sensor, ctrl->val); break; case V4L2_CID_EXPOSURE: @@ -849,6 +852,7 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor) const struct v4l2_ctrl_ops *ops = _ctrl_ops; struct ov2680_ctrls *ctrls = >ctrls; struct v4l2_ctrl_handler *hdl = >handler; + int exp_max = OV2680_LINES_PER_FRAME - OV2680_INTEGRATION_TIME_MARGIN; int ret = 0; v4l2_i2c_subdev_init(>sd, client, _subdev_ops); @@ -874,9 +878,10 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor) 0, 0, test_pattern_menu); ctrls->exposure = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_EXPOSURE, - 0, 32767, 1, 0); + 0, exp_max, 1, exp_max); - ctrls->gain = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_GAIN, 0, 2047, 1, 0); + ctrls->gain = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_ANALOGUE_GAIN, + 0, 1023, 1, 250); if (hdl->error) { ret = hdl->error; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Add an __ov2680_get_pad_format() helper function
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Add an __ov2680_get_pad_format() helper function Author: Hans de Goede Date:Thu Aug 3 11:33:37 2023 +0200 Add an __ov2680_get_pad_format() helper function. This is a preparation patch for adding selections support. Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 26 -- 1 file changed, 16 insertions(+), 10 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 012b95f90c1d..87c4c5ea47c9 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -220,6 +220,18 @@ static void ov2680_set_bayer_order(struct ov2680_dev *sensor, fmt->code = ov2680_hv_flip_bayer_order[hv_flip]; } +static struct v4l2_mbus_framefmt * +__ov2680_get_pad_format(struct ov2680_dev *sensor, + struct v4l2_subdev_state *state, + unsigned int pad, + enum v4l2_subdev_format_whence which) +{ + if (which == V4L2_SUBDEV_FORMAT_TRY) + return v4l2_subdev_get_try_format(>sd, state, pad); + + return >mode.fmt; +} + static void ov2680_fill_format(struct ov2680_dev *sensor, struct v4l2_mbus_framefmt *fmt, unsigned int width, unsigned int height) @@ -508,22 +520,16 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_format *format) { struct ov2680_dev *sensor = to_ov2680_dev(sd); - struct v4l2_mbus_framefmt *fmt = NULL; + struct v4l2_mbus_framefmt *fmt; if (format->pad != 0) return -EINVAL; - mutex_lock(>lock); - - if (format->which == V4L2_SUBDEV_FORMAT_TRY) { - fmt = v4l2_subdev_get_try_format(>sd, sd_state, -format->pad); - } else { - fmt = >mode.fmt; - } + fmt = __ov2680_get_pad_format(sensor, sd_state, format->pad, + format->which); + mutex_lock(>lock); format->format = *fmt; - mutex_unlock(>lock); return 0; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Implement selection support
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Implement selection support Author: Hans de Goede Date:Thu Aug 3 11:33:38 2023 +0200 Implement selection support. Modelled after ov5693 selection support, but allow setting sizes smaller than crop-size through set_fmt() since that was already allowed. Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 153 + 1 file changed, 141 insertions(+), 12 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 87c4c5ea47c9..ecd99e6669bd 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -65,8 +65,14 @@ #define OV2680_NATIVE_WIDTH1616 #define OV2680_NATIVE_HEIGHT 1216 +#define OV2680_NATIVE_START_LEFT 0 +#define OV2680_NATIVE_START_TOP0 #define OV2680_ACTIVE_WIDTH1600 #define OV2680_ACTIVE_HEIGHT 1200 +#define OV2680_ACTIVE_START_LEFT 8 +#define OV2680_ACTIVE_START_TOP8 +#define OV2680_MIN_CROP_WIDTH 2 +#define OV2680_MIN_CROP_HEIGHT 2 /* 66MHz pixel clock: 66MHz / 1704 * 1294 = 30fps */ #define OV2680_PIXELS_PER_LINE 1704 @@ -114,6 +120,7 @@ struct ov2680_ctrls { }; struct ov2680_mode { + struct v4l2_rectcrop; struct v4l2_mbus_framefmt fmt; struct v4l2_fract frame_interval; boolbinning; @@ -147,6 +154,13 @@ struct ov2680_dev { struct ov2680_mode mode; }; +static const struct v4l2_rect ov2680_default_crop = { + .left = OV2680_ACTIVE_START_LEFT, + .top = OV2680_ACTIVE_START_TOP, + .width = OV2680_ACTIVE_WIDTH, + .height = OV2680_ACTIVE_HEIGHT, +}; + static const char * const test_pattern_menu[] = { "Disabled", "Color Bars", @@ -232,6 +246,18 @@ __ov2680_get_pad_format(struct ov2680_dev *sensor, return >mode.fmt; } +static struct v4l2_rect * +__ov2680_get_pad_crop(struct ov2680_dev *sensor, + struct v4l2_subdev_state *state, + unsigned int pad, + enum v4l2_subdev_format_whence which) +{ + if (which == V4L2_SUBDEV_FORMAT_TRY) + return v4l2_subdev_get_try_crop(>sd, state, pad); + + return >mode.crop; +} + static void ov2680_fill_format(struct ov2680_dev *sensor, struct v4l2_mbus_framefmt *fmt, unsigned int width, unsigned int height) @@ -251,8 +277,8 @@ static void ov2680_calc_mode(struct ov2680_dev *sensor) int orig_width = width; int orig_height = height; - if (width <= (OV2680_NATIVE_WIDTH / 2) && - height <= (OV2680_NATIVE_HEIGHT / 2)) { + if (width <= (sensor->mode.crop.width / 2) && + height <= (sensor->mode.crop.height / 2)) { sensor->mode.binning = true; width *= 2; height *= 2; @@ -260,8 +286,10 @@ static void ov2680_calc_mode(struct ov2680_dev *sensor) sensor->mode.binning = false; } - sensor->mode.h_start = ((OV2680_NATIVE_WIDTH - width) / 2) & ~1; - sensor->mode.v_start = ((OV2680_NATIVE_HEIGHT - height) / 2) & ~1; + sensor->mode.h_start = (sensor->mode.crop.left + + (sensor->mode.crop.width - width) / 2) & ~1; + sensor->mode.v_start = (sensor->mode.crop.top + + (sensor->mode.crop.height - height) / 2) & ~1; sensor->mode.h_end = min(sensor->mode.h_start + width + OV2680_END_MARGIN - 1, OV2680_NATIVE_WIDTH - 1); @@ -541,16 +569,21 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, { struct ov2680_dev *sensor = to_ov2680_dev(sd); struct v4l2_mbus_framefmt *try_fmt; + const struct v4l2_rect *crop; unsigned int width, height; int ret = 0; if (format->pad != 0) return -EINVAL; - width = min_t(unsigned int, ALIGN(format->format.width, 2), - OV2680_NATIVE_WIDTH); - height = min_t(unsigned int, ALIGN(format->format.height, 2), - OV2680_NATIVE_HEIGHT); + crop = __ov2680_get_pad_crop(sensor, sd_state, format->pad, +format->which); + + /* Limit set_fmt max size to crop width / height */ + width = clamp_val(ALIGN(format->format.width, 2), + OV2680_MIN_CROP_WID
[git:media_stage/master] media: ov2680: Read and log sensor revision during probe
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Read and log sensor revision during probe Author: Hans de Goede Date:Thu Aug 3 11:33:42 2023 +0200 Read and log sensor revision during probe. Since this means that the driver will now already log a message on successful probe drop the "ov2680 init correctly" log message. Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index c09a0e7f7787..1f59013e440c 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -33,6 +33,7 @@ #define OV2680_REG_SOFT_RESET CCI_REG8(0x0103) #define OV2680_REG_CHIP_ID CCI_REG16(0x300a) +#define OV2680_REG_SC_CMMN_SUB_ID CCI_REG8(0x302a) #define OV2680_REG_PLL_MULTIPLIER CCI_REG16(0x3081) #define OV2680_REG_EXPOSURE_PK CCI_REG24(0x3500) @@ -966,13 +967,14 @@ static int ov2680_get_regulators(struct ov2680_dev *sensor) static int ov2680_check_id(struct ov2680_dev *sensor) { - u64 chip_id; - int ret; + u64 chip_id, rev; + int ret = 0; - ret = cci_read(sensor->regmap, OV2680_REG_CHIP_ID, _id, NULL); + cci_read(sensor->regmap, OV2680_REG_CHIP_ID, _id, ); + cci_read(sensor->regmap, OV2680_REG_SC_CMMN_SUB_ID, , ); if (ret < 0) { dev_err(sensor->dev, "failed to read chip id\n"); - return -ENODEV; + return ret; } if (chip_id != OV2680_CHIP_ID) { @@ -981,6 +983,9 @@ static int ov2680_check_id(struct ov2680_dev *sensor) return -ENODEV; } + dev_info(sensor->dev, "sensor_revision id = 0x%llx, rev= %lld\n", +chip_id, rev & 0x0f); + return 0; } @@ -1121,8 +1126,6 @@ static int ov2680_probe(struct i2c_client *client) pm_runtime_use_autosuspend(>dev); pm_runtime_put_autosuspend(>dev); - dev_info(dev, "ov2680 init correctly\n"); - return 0; err_pm_runtime: ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ov2680: Add bus-cfg / endpoint property verification
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Add bus-cfg / endpoint property verification Author: Hans de Goede Date:Thu Aug 3 11:33:44 2023 +0200 Verify that the number of CSI lanes and link-frequency specified in the endpoint fwnode are correct. Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 60 -- 1 file changed, 47 insertions(+), 13 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index 83ec034b5307..72bab0ff8a36 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #define OV2680_CHIP_ID 0x2680 @@ -1008,6 +1009,9 @@ static int ov2680_check_id(struct ov2680_dev *sensor) static int ov2680_parse_dt(struct ov2680_dev *sensor) { + struct v4l2_fwnode_endpoint bus_cfg = { + .bus_type = V4L2_MBUS_CSI2_DPHY, + }; struct device *dev = sensor->dev; struct fwnode_handle *ep_fwnode; struct gpio_desc *gpio; @@ -1023,7 +1027,10 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) return dev_err_probe(dev, -EPROBE_DEFER, "waiting for fwnode graph endpoint\n"); + ret = v4l2_fwnode_endpoint_alloc_parse(ep_fwnode, _cfg); fwnode_handle_put(ep_fwnode); + if (ret) + return ret; /* * The pin we want is named XSHUTDN in the datasheet. Linux sensor @@ -1038,15 +1045,16 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) ret = PTR_ERR_OR_ZERO(gpio); if (ret < 0) { dev_dbg(dev, "error while getting reset gpio: %d\n", ret); - return ret; + goto out_free_bus_cfg; } sensor->pwdn_gpio = gpio; sensor->xvclk = devm_clk_get_optional(dev, "xvclk"); if (IS_ERR(sensor->xvclk)) { - dev_err(dev, "xvclk clock missing or invalid\n"); - return PTR_ERR(sensor->xvclk); + ret = dev_err_probe(dev, PTR_ERR(sensor->xvclk), + "xvclk clock missing or invalid\n"); + goto out_free_bus_cfg; } /* @@ -1060,14 +1068,17 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) */ ret = fwnode_property_read_u32(dev_fwnode(dev), "clock-frequency", ); - if (ret && !sensor->xvclk) - return dev_err_probe(dev, ret, "invalid clock config\n"); + if (ret && !sensor->xvclk) { + dev_err_probe(dev, ret, "invalid clock config\n"); + goto out_free_bus_cfg; + } if (!ret && sensor->xvclk) { ret = clk_set_rate(sensor->xvclk, rate); - if (ret) - return dev_err_probe(dev, ret, -"failed to set clock rate\n"); + if (ret) { + dev_err_probe(dev, ret, "failed to set clock rate\n"); + goto out_free_bus_cfg; + } } sensor->xvclk_freq = rate ?: clk_get_rate(sensor->xvclk); @@ -1077,10 +1088,12 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) break; } - if (i == ARRAY_SIZE(ov2680_xvclk_freqs)) - return dev_err_probe(dev, -EINVAL, -"unsupported xvclk frequency %d Hz\n", -sensor->xvclk_freq); + if (i == ARRAY_SIZE(ov2680_xvclk_freqs)) { + ret = dev_err_probe(dev, -EINVAL, + "unsupported xvclk frequency %d Hz\n", + sensor->xvclk_freq); + goto out_free_bus_cfg; + } sensor->pll_mult = ov2680_pll_multipliers[i]; @@ -1091,7 +1104,28 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor) sensor->pixel_rate = sensor->link_freq[0] * 2; do_div(sensor->pixel_rate, 10); - return 0; + /* Verify bus cfg */ + if (bus_cfg.bus.mipi_csi2.num_data_lanes != 1) { + ret = dev_err_probe(dev, -EINVAL, + "only a 1-lane CSI2 config is supported"); + goto out_free_bus_cfg; + } + + for (i = 0; i < bus_cfg.nr_of_link_frequencies; i++) + if (bus_cfg.link_frequencies[i] == sensor->link_freq[0]) + break; + + if (bus_cfg.nr_of_link_frequencies == 0 || + bus
[git:media_stage/master] media: i2c: ccs: Check rules is non-NULL
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: ccs: Check rules is non-NULL Author: Sakari Ailus Date:Sat Jul 29 20:59:25 2023 +0200 Fix the following smatch warning: drivers/media/i2c/ccs/ccs-data.c:524 ccs_data_parse_rules() warn: address of NULL pointer 'rules' The CCS static data rule parser does not check an if rule has been obtained before checking for other rule types (which depend on the if rule). In practice this means parsing invalid CCS static data could lead to dereferencing a NULL pointer. Reported-by: Hans Verkuil Fixes: a6b396f410b1 ("media: ccs: Add CCS static data parser library") Cc: sta...@vger.kernel.org # for 5.11 and up Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ccs/ccs-data.c | 101 ++- 1 file changed, 56 insertions(+), 45 deletions(-) --- diff --git a/drivers/media/i2c/ccs/ccs-data.c b/drivers/media/i2c/ccs/ccs-data.c index 45f2b2f55ec5..08400edf77ce 100644 --- a/drivers/media/i2c/ccs/ccs-data.c +++ b/drivers/media/i2c/ccs/ccs-data.c @@ -464,8 +464,7 @@ static int ccs_data_parse_rules(struct bin_container *bin, rule_payload = __rule_type + 1; rule_plen2 = rule_plen - sizeof(*__rule_type); - switch (*__rule_type) { - case CCS_DATA_BLOCK_RULE_ID_IF: { + if (*__rule_type == CCS_DATA_BLOCK_RULE_ID_IF) { const struct __ccs_data_block_rule_if *__if_rules = rule_payload; const size_t __num_if_rules = @@ -514,49 +513,61 @@ static int ccs_data_parse_rules(struct bin_container *bin, rules->if_rules = if_rule; rules->num_if_rules = __num_if_rules; } - break; - } - case CCS_DATA_BLOCK_RULE_ID_READ_ONLY_REGS: - rval = ccs_data_parse_reg_rules(bin, >read_only_regs, - >num_read_only_regs, - rule_payload, - rule_payload + rule_plen2, - dev); - if (rval) - return rval; - break; - case CCS_DATA_BLOCK_RULE_ID_FFD: - rval = ccs_data_parse_ffd(bin, >frame_format, - rule_payload, - rule_payload + rule_plen2, - dev); - if (rval) - return rval; - break; - case CCS_DATA_BLOCK_RULE_ID_MSR: - rval = ccs_data_parse_reg_rules(bin, - >manufacturer_regs, - >num_manufacturer_regs, - rule_payload, - rule_payload + rule_plen2, - dev); - if (rval) - return rval; - break; - case CCS_DATA_BLOCK_RULE_ID_PDAF_READOUT: - rval = ccs_data_parse_pdaf_readout(bin, - >pdaf_readout, - rule_payload, - rule_payload + rule_plen2, - dev); - if (rval) - return rval; - break; - default: - dev_dbg(dev, - "Don't know how to handle rule type %u!\n", - *__rule_type); - return -EINVAL; + } else { + /* Check there was an if rule before any other rules */ + if (bin->base && !rules) + return -EINVAL; + + switch (*__rule_type) { + case CCS_DATA_BLOCK_RULE_ID_READ_ONLY_REGS: + rval = ccs_data_parse_reg_rules(bin, + rules ? + >read_only_regs : NULL, + rules ? +
[git:media_stage/master] media: ov2680: Drop unnecessary pad checks
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov2680: Drop unnecessary pad checks Author: Hans de Goede Date:Thu Aug 3 11:33:41 2023 +0200 Drop unnecessary pad checks in enum_mbus_code, get_fmt, set_fmt this is already checked by check_pad() from drivers/media/v4l2-core/v4l2-subdev.c. Acked-by: Rui Miguel Silva Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ov2680.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) --- diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c index e6c99c14da8f..c09a0e7f7787 100644 --- a/drivers/media/i2c/ov2680.c +++ b/drivers/media/i2c/ov2680.c @@ -591,7 +591,7 @@ static int ov2680_enum_mbus_code(struct v4l2_subdev *sd, { struct ov2680_dev *sensor = to_ov2680_dev(sd); - if (code->pad != 0 || code->index != 0) + if (code->index != 0) return -EINVAL; code->code = sensor->mode.fmt.code; @@ -606,9 +606,6 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd, struct ov2680_dev *sensor = to_ov2680_dev(sd); struct v4l2_mbus_framefmt *fmt; - if (format->pad != 0) - return -EINVAL; - fmt = __ov2680_get_pad_format(sensor, sd_state, format->pad, format->which); @@ -629,9 +626,6 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, unsigned int width, height; int ret = 0; - if (format->pad != 0) - return -EINVAL; - crop = __ov2680_get_pad_crop(sensor, sd_state, format->pad, format->which); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: atomisp: Drop atomisp-ov2680 sensor driver
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atomisp: Drop atomisp-ov2680 sensor driver Author: Hans de Goede Date:Thu Aug 3 11:33:47 2023 +0200 After recent improvements to atomisp and the standard ov2680 sensor driver, the atomisp driver now works fine with the standard ov2680 driver. Drop the no longer necessary atomisp specific atomisp-ov2680 sensor driver. Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/atomisp/i2c/Kconfig | 13 - drivers/staging/media/atomisp/i2c/Makefile | 1 - drivers/staging/media/atomisp/i2c/atomisp-ov2680.c | 828 - drivers/staging/media/atomisp/i2c/ov2680.h | 173 - 4 files changed, 1015 deletions(-) --- diff --git a/drivers/staging/media/atomisp/i2c/Kconfig b/drivers/staging/media/atomisp/i2c/Kconfig index e34646d7dadc..2d4165cda2f1 100644 --- a/drivers/staging/media/atomisp/i2c/Kconfig +++ b/drivers/staging/media/atomisp/i2c/Kconfig @@ -57,19 +57,6 @@ config VIDEO_ATOMISP_GC0310 This is a Video4Linux2 sensor-level driver for the Galaxycore GC0310 0.3MP sensor. -config VIDEO_ATOMISP_OV2680 - tristate "Omnivision OV2680 sensor support" - depends on ACPI - depends on I2C && VIDEO_DEV - select V4L2_CCI_I2C - help - This is a Video4Linux2 sensor-level driver for the Omnivision - OV2680 raw camera. - - ov2680 is a 2M raw sensor. - - It currently only works with the atomisp driver. - config VIDEO_ATOMISP_OV5693 tristate "Omnivision ov5693 sensor support" depends on ACPI diff --git a/drivers/staging/media/atomisp/i2c/Makefile b/drivers/staging/media/atomisp/i2c/Makefile index 8d022986e199..fc55af5f3422 100644 --- a/drivers/staging/media/atomisp/i2c/Makefile +++ b/drivers/staging/media/atomisp/i2c/Makefile @@ -7,7 +7,6 @@ obj-$(CONFIG_VIDEO_ATOMISP_OV5693) += ov5693/ obj-$(CONFIG_VIDEO_ATOMISP_MT9M114)+= atomisp-mt9m114.o obj-$(CONFIG_VIDEO_ATOMISP_GC2235) += atomisp-gc2235.o obj-$(CONFIG_VIDEO_ATOMISP_OV2722) += atomisp-ov2722.o -obj-$(CONFIG_VIDEO_ATOMISP_OV2680) += atomisp-ov2680.o obj-$(CONFIG_VIDEO_ATOMISP_GC0310) += atomisp-gc0310.o obj-$(CONFIG_VIDEO_ATOMISP_MSRLIST_HELPER) += atomisp-libmsrlisthelper.o diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c deleted file mode 100644 index f933a65ac8d4.. diff --git a/drivers/staging/media/atomisp/i2c/ov2680.h b/drivers/staging/media/atomisp/i2c/ov2680.h deleted file mode 100644 index 7815522724f7.. ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: i2c: ds90ub953: Fix use of uninitialized variables
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: ds90ub953: Fix use of uninitialized variables Author: Tomi Valkeinen Date:Thu Aug 3 14:15:46 2023 +0200 smatch reports some uninitialized variables: drivers/media/i2c/ds90ub953.c:655 ub953_log_status() error: uninitialized symbol 'gpio_local_data'. drivers/media/i2c/ds90ub953.c:655 ub953_log_status() error: uninitialized symbol 'gpio_input_ctrl'. drivers/media/i2c/ds90ub953.c:655 ub953_log_status() error: uninitialized symbol 'gpio_pin_sts'. These are used only for printing debug information, and the use of an uninitialized variable only happens if an i2c transaction has failed, which will print an error. Thus, fix the errors just by initializing the variables to 0. Closes: https://lore.kernel.org/all/8d6daeb1-b62a-bbb2-b840-8759c84f2...@xs4all.nl/ Fixes: 6363db1c9d45 ("media: i2c: add DS90UB953 driver") Reported-by: Hans Verkuil Signed-off-by: Tomi Valkeinen Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/ds90ub953.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c index d56c1dda89b3..dc394e22a42c 100644 --- a/drivers/media/i2c/ds90ub953.c +++ b/drivers/media/i2c/ds90ub953.c @@ -606,9 +606,9 @@ static int ub953_log_status(struct v4l2_subdev *sd) u8 v = 0, v1 = 0, v2 = 0; unsigned int i; char id[UB953_REG_FPD3_RX_ID_LEN]; - u8 gpio_local_data; - u8 gpio_input_ctrl; - u8 gpio_pin_sts; + u8 gpio_local_data = 0; + u8 gpio_input_ctrl = 0; + u8 gpio_pin_sts = 0; for (i = 0; i < sizeof(id); i++) ub953_read(priv, UB953_REG_FPD3_RX_ID(i), [i]); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ipu-bridge: Add link-frequency to OV2680 ipu_supported_sensors[] entry
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ipu-bridge: Add link-frequency to OV2680 ipu_supported_sensors[] entry Author: Hans de Goede Date:Thu Aug 3 11:33:46 2023 +0200 Now that the ov2680 driver verifies the bus-cfg from the endpoint fwnode the link-frequency must be set for things to work. Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu-bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index 5000d7a1d688..1bde8b6e0b11 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -49,7 +49,7 @@ static const struct ipu_sensor_config ipu_supported_sensors[] = { /* Omnivision OV7251 */ IPU_SENSOR_CONFIG("INT347E", 1, 31920), /* Omnivision OV2680 */ - IPU_SENSOR_CONFIG("OVTI2680", 0), + IPU_SENSOR_CONFIG("OVTI2680", 1, 33120), /* Omnivision ov8856 */ IPU_SENSOR_CONFIG("OVTI8856", 3, 18000, 36000, 72000), /* Omnivision ov2740 */ ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: subdev: Constify v4l2_subdev_set_routing_with_fmt() param
This is an automatic generated email to let you know that the following patch were queued: Subject: media: subdev: Constify v4l2_subdev_set_routing_with_fmt() param Author: Tomi Valkeinen Date:Mon Jun 19 13:27:06 2023 +0200 The routing parameter of v4l2_subdev_set_routing_with_fmt() is missing 'const'. Add it. Signed-off-by: Tomi Valkeinen Reviewed-by: Jacopo Mondi Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/v4l2-core/v4l2-subdev.c | 2 +- include/media/v4l2-subdev.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index c720c9ea899e..ec35e5a90cdf 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -1602,7 +1602,7 @@ EXPORT_SYMBOL_GPL(__v4l2_subdev_next_active_route); int v4l2_subdev_set_routing_with_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_state *state, -struct v4l2_subdev_krouting *routing, +const struct v4l2_subdev_krouting *routing, const struct v4l2_mbus_framefmt *fmt) { struct v4l2_subdev_stream_configs *stream_configs; diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index a012741cc876..d9fca929c10b 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -1535,7 +1535,7 @@ __v4l2_subdev_next_active_route(const struct v4l2_subdev_krouting *routing, */ int v4l2_subdev_set_routing_with_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_state *state, -struct v4l2_subdev_krouting *routing, +const struct v4l2_subdev_krouting *routing, const struct v4l2_mbus_framefmt *fmt); /** ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: i2c: Remove common dependencies from sensor drivers
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: Remove common dependencies from sensor drivers Author: Sakari Ailus Date:Fri Jun 30 15:58:55 2023 +0200 As selecting V4L2_FWNODE, MEDIA_CONTROLLER and VIDEO_V4L2_SUBDEV_API are now selected by the top level menu, they can be dropped from the individual drivers. Also dropped selecting V4L2_ASYNC for a single driver as this is already implied by V4L2_FWNODE. Similarly, the I2C dependency is now also in the top level menu, so remove it, as well as VIDEO_DEV which isn't needed by camera sensor drivers. Signed-off-by: Sakari Ailus Reviewed-by: Hans de Goede Reviewed-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/Kconfig| 223 ++- drivers/media/i2c/ccs/Kconfig| 5 +- drivers/media/i2c/et8ek8/Kconfig | 4 - 3 files changed, 10 insertions(+), 222 deletions(-) --- diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index eef5e872a824..d059935614a8 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -43,10 +43,6 @@ config VIDEO_CCS_PLL config VIDEO_AR0521 tristate "ON Semiconductor AR0521 sensor support" - depends on I2C && VIDEO_DEV - select MEDIA_CONTROLLER - select VIDEO_V4L2_SUBDEV_API - select V4L2_FWNODE help This is a Video4Linux2 sensor driver for the ON Semiconductor AR0521 camera. @@ -56,10 +52,6 @@ config VIDEO_AR0521 config VIDEO_HI556 tristate "Hynix Hi-556 sensor support" - depends on I2C && VIDEO_DEV - select MEDIA_CONTROLLER - select VIDEO_V4L2_SUBDEV_API - select V4L2_FWNODE help This is a Video4Linux2 sensor driver for the Hynix Hi-556 camera. @@ -69,10 +61,6 @@ config VIDEO_HI556 config VIDEO_HI846 tristate "Hynix Hi-846 sensor support" - depends on I2C && VIDEO_DEV - select MEDIA_CONTROLLER - select VIDEO_V4L2_SUBDEV_API - select V4L2_FWNODE help This is a Video4Linux2 sensor driver for the Hynix Hi-846 camera. @@ -82,10 +70,6 @@ config VIDEO_HI846 config VIDEO_HI847 tristate "Hynix Hi-847 sensor support" -depends on I2C && VIDEO_DEV -select MEDIA_CONTROLLER -select VIDEO_V4L2_SUBDEV_API -select V4L2_FWNODE help This is a Video4Linux2 sensor driver for the Hynix Hi-847 camera. @@ -95,10 +79,6 @@ config VIDEO_HI847 config VIDEO_IMX208 tristate "Sony IMX208 sensor support" - depends on I2C && VIDEO_DEV - depends on MEDIA_CAMERA_SUPPORT - select MEDIA_CONTROLLER - select VIDEO_V4L2_SUBDEV_API help This is a Video4Linux2 sensor driver for the Sony IMX208 camera. @@ -108,10 +88,7 @@ config VIDEO_IMX208 config VIDEO_IMX214 tristate "Sony IMX214 sensor support" - depends on GPIOLIB && I2C && VIDEO_DEV - select V4L2_FWNODE - select MEDIA_CONTROLLER - select VIDEO_V4L2_SUBDEV_API + depends on GPIOLIB select REGMAP_I2C help This is a Video4Linux2 sensor driver for the Sony @@ -122,10 +99,6 @@ config VIDEO_IMX214 config VIDEO_IMX219 tristate "Sony IMX219 sensor support" - depends on I2C && VIDEO_DEV - select MEDIA_CONTROLLER - select VIDEO_V4L2_SUBDEV_API - select V4L2_FWNODE help This is a Video4Linux2 sensor driver for the Sony IMX219 camera. @@ -135,9 +108,6 @@ config VIDEO_IMX219 config VIDEO_IMX258 tristate "Sony IMX258 sensor support" - depends on I2C && VIDEO_DEV - select MEDIA_CONTROLLER - select VIDEO_V4L2_SUBDEV_API help This is a Video4Linux2 sensor driver for the Sony IMX258 camera. @@ -147,9 +117,6 @@ config VIDEO_IMX258 config VIDEO_IMX274 tristate "Sony IMX274 sensor support" - depends on I2C && VIDEO_DEV - select MEDIA_CONTROLLER - select VIDEO_V4L2_SUBDEV_API select REGMAP_I2C help This is a V4L2 sensor driver for the Sony IMX274 @@ -157,11 +124,7 @@ config VIDEO_IMX274 config VIDEO_IMX290 tristate "Sony IMX290 sensor support" - depends on I2C && VIDEO_DEV - select MEDIA_CONTROLLER - select VIDEO_V4L2_SUBDEV_API select REGMAP_I2C - select V4L2_FWNODE help This is a Video4Linux2 sensor driver for the Sony IMX290 camera sensor. @@ -171,10 +134,6 @@ config VIDEO_IMX290 config VIDEO_IMX296 tristate "Sony IMX296 sensor support" - depends on I2C && VIDEO_DEV - select MEDIA_CONTROLLER -
[git:media_stage/master] media: ov5693: Convert to new CCI register access helpers
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ov5693: Convert to new CCI register access helpers Author: Hans de Goede Date:Tue Jun 27 14:51:05 2023 +0200 Use the new comon CCI register access helpers to replace the private register access helpers in the ov5693 driver. [Sakari Ailus: Squashed the patch to address a merge issue in Kconfig] Reviewed-by: Laurent Pinchart Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/Kconfig | 1 + drivers/media/i2c/ov5693.c | 587 ++--- 2 files changed, 230 insertions(+), 358 deletions(-) --- diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index d059935614a8..f212c344b4b6 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -425,6 +425,7 @@ config VIDEO_OV5675 config VIDEO_OV5693 tristate "OmniVision OV5693 sensor support" + select V4L2_CCI_I2C help This is a Video4Linux2 sensor driver for the OmniVision OV5693 camera. diff --git a/drivers/media/i2c/ov5693.c b/drivers/media/i2c/ov5693.c index 7f9212cce239..488ee6d9d301 100644 --- a/drivers/media/i2c/ov5693.c +++ b/drivers/media/i2c/ov5693.c @@ -12,7 +12,6 @@ * Jake Day */ -#include #include #include #include @@ -23,36 +22,32 @@ #include #include #include + +#include #include #include #include -#define OV5693_REG_8BIT(n) ((1 << 16) | (n)) -#define OV5693_REG_16BIT(n)((2 << 16) | (n)) -#define OV5693_REG_24BIT(n)((3 << 16) | (n)) -#define OV5693_REG_SIZE_SHIFT 16 -#define OV5693_REG_ADDR_MASK 0x - /* System Control */ -#define OV5693_SW_RESET_REGOV5693_REG_8BIT(0x0103) -#define OV5693_SW_STREAM_REG OV5693_REG_8BIT(0x0100) +#define OV5693_SW_RESET_REGCCI_REG8(0x0103) +#define OV5693_SW_STREAM_REG CCI_REG8(0x0100) #define OV5693_START_STREAMING 0x01 #define OV5693_STOP_STREAMING 0x00 #define OV5693_SW_RESET0x01 -#define OV5693_REG_CHIP_ID OV5693_REG_16BIT(0x300a) +#define OV5693_REG_CHIP_ID CCI_REG16(0x300a) /* Yes, this is right. The datasheet for the OV5693 gives its ID as 0x5690 */ #define OV5693_CHIP_ID 0x5690 /* Exposure */ -#define OV5693_EXPOSURE_CTRL_REG OV5693_REG_24BIT(0x3500) +#define OV5693_EXPOSURE_CTRL_REG CCI_REG24(0x3500) #define OV5693_EXPOSURE_CTRL_MASK GENMASK(19, 4) #define OV5693_INTEGRATION_TIME_MARGIN 8 #define OV5693_EXPOSURE_MIN1 #define OV5693_EXPOSURE_STEP 1 /* Analogue Gain */ -#define OV5693_GAIN_CTRL_REG OV5693_REG_16BIT(0x350a) +#define OV5693_GAIN_CTRL_REG CCI_REG16(0x350a) #define OV5693_GAIN_CTRL_MASK GENMASK(10, 4) #define OV5693_GAIN_MIN1 #define OV5693_GAIN_MAX127 @@ -60,9 +55,9 @@ #define OV5693_GAIN_STEP 1 /* Digital Gain */ -#define OV5693_MWB_RED_GAIN_REGOV5693_REG_16BIT(0x3400) -#define OV5693_MWB_GREEN_GAIN_REG OV5693_REG_16BIT(0x3402) -#define OV5693_MWB_BLUE_GAIN_REG OV5693_REG_16BIT(0x3404) +#define OV5693_MWB_RED_GAIN_REGCCI_REG16(0x3400) +#define OV5693_MWB_GREEN_GAIN_REG CCI_REG16(0x3402) +#define OV5693_MWB_BLUE_GAIN_REG CCI_REG16(0x3404) #define OV5693_MWB_GAIN_MASK GENMASK(11, 0) #define OV5693_MWB_GAIN_MAX0x0fff #define OV5693_DIGITAL_GAIN_MIN1 @@ -71,36 +66,36 @@ #define OV5693_DIGITAL_GAIN_STEP 1 /* Timing and Format */ -#define OV5693_CROP_START_X_REGOV5693_REG_16BIT(0x3800) -#define OV5693_CROP_START_Y_REGOV5693_REG_16BIT(0x3802) -#define OV5693_CROP_END_X_REG OV5693_REG_16BIT(0x3804) -#define OV5693_CROP_END_Y_REG OV5693_REG_16BIT(0x3806) -#define OV5693_OUTPUT_SIZE_X_REG OV5693_REG_16BIT(0x3808) -#define OV5693_OUTPUT_SIZE_Y_REG OV5693_REG_16BIT(0x380a) - -#define OV5693_TIMING_HTS_REG OV5693_REG_16BIT(0x380c) +#define OV5693_CROP_START_X_REGCCI_REG16(0x3800) +#define OV5693_CROP_START_Y_REGCCI_REG16(0x3802) +#define OV5693_CROP_END_X_REG CCI_REG16(0x3804) +#define OV5693_CROP_END_Y_REG CCI_REG16(0x3806) +#define OV5693_OUTPUT_SIZE_X_REG CCI_REG16(0x3808) +#define OV5693_OUTPUT_SIZE_Y_REG
[git:media_stage/master] media: MAINTAINERS: Add entry for V4L2 async and fwnode frameworks
This is an automatic generated email to let you know that the following patch were queued: Subject: media: MAINTAINERS: Add entry for V4L2 async and fwnode frameworks Author: Sakari Ailus Date:Fri Jun 30 12:31:21 2023 +0200 Add an entry for V4L2 async and fwnode frameworks, with myself as the maintainer. Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab MAINTAINERS | 10 ++ 1 file changed, 10 insertions(+) --- diff --git a/MAINTAINERS b/MAINTAINERS index 0dae72a07d0d..52a7c026f398 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -22282,6 +22282,16 @@ L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) S: Maintained F: drivers/clk/ux500/ +V4L2 ASYNC AND FWNODE FRAMEWORKS +M: Sakari Ailus +L: linux-me...@vger.kernel.org +S: Maintained +T: git git://linuxtv.org/media_tree.git +F: drivers/media/v4l2-core/v4l2-async.c +F: drivers/media/v4l2-core/v4l2-fwnode.c +F: include/media/v4l2-async.h +F: include/media/v4l2-fwnode.h + V4L2 SENSOR AND LENS DRIVERS M: Sakari Ailus L: linux-me...@vger.kernel.org ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: subdev: Drop implicit zeroing of stream field
This is an automatic generated email to let you know that the following patch were queued: Subject: media: subdev: Drop implicit zeroing of stream field Author: Tomi Valkeinen Date:Mon Jun 19 13:27:05 2023 +0200 Now that the kernel drivers have been fixed to initialize the stream field, and we have the client capability which the userspace uses to say it has initialized the stream field, we can drop the implicit zeroing of the stream field in the various check functions. Signed-off-by: Tomi Valkeinen Reviewed-by: Jacopo Mondi Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/v4l2-core/v4l2-subdev.c | 15 --- 1 file changed, 15 deletions(-) --- diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 217b8019fb9b..c720c9ea899e 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -200,9 +200,6 @@ static inline int check_format(struct v4l2_subdev *sd, if (!format) return -EINVAL; - if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) - format->stream = 0; - return check_which(format->which) ? : check_pad(sd, format->pad) ? : check_state(sd, state, format->which, format->pad, format->stream); } @@ -230,9 +227,6 @@ static int call_enum_mbus_code(struct v4l2_subdev *sd, if (!code) return -EINVAL; - if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) - code->stream = 0; - return check_which(code->which) ? : check_pad(sd, code->pad) ? : check_state(sd, state, code->which, code->pad, code->stream) ? : sd->ops->pad->enum_mbus_code(sd, state, code); @@ -245,9 +239,6 @@ static int call_enum_frame_size(struct v4l2_subdev *sd, if (!fse) return -EINVAL; - if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) - fse->stream = 0; - return check_which(fse->which) ? : check_pad(sd, fse->pad) ? : check_state(sd, state, fse->which, fse->pad, fse->stream) ? : sd->ops->pad->enum_frame_size(sd, state, fse); @@ -283,9 +274,6 @@ static int call_enum_frame_interval(struct v4l2_subdev *sd, if (!fie) return -EINVAL; - if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) - fie->stream = 0; - return check_which(fie->which) ? : check_pad(sd, fie->pad) ? : check_state(sd, state, fie->which, fie->pad, fie->stream) ? : sd->ops->pad->enum_frame_interval(sd, state, fie); @@ -298,9 +286,6 @@ static inline int check_selection(struct v4l2_subdev *sd, if (!sel) return -EINVAL; - if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) - sel->stream = 0; - return check_which(sel->which) ? : check_pad(sd, sel->pad) ? : check_state(sd, state, sel->which, sel->pad, sel->stream); } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: subdev: Add debug prints to enable/disable_streams
This is an automatic generated email to let you know that the following patch were queued: Subject: media: subdev: Add debug prints to enable/disable_streams Author: Tomi Valkeinen Date:Mon Jun 19 13:27:07 2023 +0200 It is often useful to see when streaming for a device is being enabled or disabled. Add debug prints for this to v4l2_subdev_enable_streams() and v4l2_subdev_disable_streams(). Signed-off-by: Tomi Valkeinen Reviewed-by: Jacopo Mondi Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/v4l2-core/v4l2-subdev.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) --- diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index ec35e5a90cdf..b92348ad61f6 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -1989,11 +1989,16 @@ int v4l2_subdev_enable_streams(struct v4l2_subdev *sd, u32 pad, goto done; } + dev_dbg(dev, "enable streams %u:%#llx\n", pad, streams_mask); + /* Call the .enable_streams() operation. */ ret = v4l2_subdev_call(sd, pad, enable_streams, state, pad, streams_mask); - if (ret) + if (ret) { + dev_dbg(dev, "enable streams %u:%#llx failed: %d\n", pad, + streams_mask, ret); goto done; + } /* Mark the streams as enabled. */ for (i = 0; i < state->stream_configs.num_configs; ++i) { @@ -2101,11 +2106,16 @@ int v4l2_subdev_disable_streams(struct v4l2_subdev *sd, u32 pad, goto done; } + dev_dbg(dev, "disable streams %u:%#llx\n", pad, streams_mask); + /* Call the .disable_streams() operation. */ ret = v4l2_subdev_call(sd, pad, disable_streams, state, pad, streams_mask); - if (ret) + if (ret) { + dev_dbg(dev, "disable streams %u:%#llx failed: %d\n", pad, + streams_mask, ret); goto done; + } /* Mark the streams as disabled. */ for (i = 0; i < state->stream_configs.num_configs; ++i) { ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ipu-bridge: Store dev pointer in struct ipu_bridge
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ipu-bridge: Store dev pointer in struct ipu_bridge Author: Hans de Goede Date:Wed Jul 5 23:29:58 2023 +0200 Store the dev pointer in struct ipu_bridge instead of passing it around 3 levels deep. This takes up slightly more memory but further patches in this series add more data which needs to be passed around making passing everything as arguments cumbersome and those further patches also add data to struct ipu_bridge. To be consistent with these upcoming patches also add the dev pointer to struct ipu_bridge. Reviewed-by: Andy Shevchenko Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu-bridge.c | 15 +++ drivers/media/pci/intel/ipu-bridge.h | 1 + 2 files changed, 8 insertions(+), 8 deletions(-) --- diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index 8f6f88f0ec95..df3b5b52e661 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -286,8 +286,7 @@ static void ipu_bridge_unregister_sensors(struct ipu_bridge *bridge) } static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg, -struct ipu_bridge *bridge, -struct device *dev) +struct ipu_bridge *bridge) { struct fwnode_handle *fwnode, *primary; struct ipu_sensor *sensor; @@ -301,7 +300,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg, if (bridge->n_sensors >= IPU_MAX_PORTS) { acpi_dev_put(adev); - dev_err(dev, "Exceeded available IPU ports\n"); + dev_err(bridge->dev, "Exceeded available IPU ports\n"); return -EINVAL; } @@ -361,7 +360,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg, ipu_bridge_instantiate_vcm_i2c_client(sensor); - dev_info(dev, "Found supported sensor %s\n", + dev_info(bridge->dev, "Found supported sensor %s\n", acpi_dev_name(adev)); bridge->n_sensors++; @@ -378,8 +377,7 @@ err_put_adev: return ret; } -static int ipu_bridge_connect_sensors(struct ipu_bridge *bridge, - struct device *dev) +static int ipu_bridge_connect_sensors(struct ipu_bridge *bridge) { unsigned int i; int ret; @@ -388,7 +386,7 @@ static int ipu_bridge_connect_sensors(struct ipu_bridge *bridge, const struct ipu_sensor_config *cfg = _supported_sensors[i]; - ret = ipu_bridge_connect_sensor(cfg, bridge, dev); + ret = ipu_bridge_connect_sensor(cfg, bridge); if (ret) goto err_unregister_sensors; } @@ -451,6 +449,7 @@ int ipu_bridge_init(struct device *dev) strscpy(bridge->ipu_node_name, IPU_HID, sizeof(bridge->ipu_node_name)); bridge->ipu_hid_node.name = bridge->ipu_node_name; + bridge->dev = dev; ret = software_node_register(>ipu_hid_node); if (ret < 0) { @@ -468,7 +467,7 @@ int ipu_bridge_init(struct device *dev) for (i = 0; i < IPU_MAX_LANES; i++) bridge->data_lanes[i] = i + 1; - ret = ipu_bridge_connect_sensors(bridge, dev); + ret = ipu_bridge_connect_sensors(bridge); if (ret || bridge->n_sensors == 0) goto err_unregister_ipu; diff --git a/drivers/media/pci/intel/ipu-bridge.h b/drivers/media/pci/intel/ipu-bridge.h index 8c1437f252d2..6cb68e3344dc 100644 --- a/drivers/media/pci/intel/ipu-bridge.h +++ b/drivers/media/pci/intel/ipu-bridge.h @@ -136,6 +136,7 @@ struct ipu_sensor { }; struct ipu_bridge { + struct device *dev; char ipu_node_name[ACPI_ID_LEN]; struct software_node ipu_hid_node; u32 data_lanes[4]; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: atomisp: csi2-bridge: Switch to new common ipu_bridge_init()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atomisp: csi2-bridge: Switch to new common ipu_bridge_init() Author: Hans de Goede Date:Wed Jul 5 23:30:08 2023 +0200 Remove the duplicate IPU ACPI bridge code and use the new shared ipu_bridge_init() functionality. Note this will also use / assume v4l2-async device instantiation for ov5693 sensors on atomisp devices since ipu_supported_sensors[] already contains a match for this. This is fine since recent atomisp improvements allow the atomisp code to work with generic v4l2 sensor drivers and using an unmodified drivers/media/i2c/ov5693.c has been successfully tested on an Acer Iconia W4 820 tablet with an ISP2400 + OV5693 sensor. Reviewed-by: Andy Shevchenko Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/atomisp/Kconfig | 3 + drivers/staging/media/atomisp/pci/atomisp_csi2.h | 67 - .../media/atomisp/pci/atomisp_csi2_bridge.c| 333 - drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 1 + 4 files changed, 63 insertions(+), 341 deletions(-) --- diff --git a/drivers/staging/media/atomisp/Kconfig b/drivers/staging/media/atomisp/Kconfig index e9b168ba97bf..5d8917160d41 100644 --- a/drivers/staging/media/atomisp/Kconfig +++ b/drivers/staging/media/atomisp/Kconfig @@ -12,9 +12,12 @@ menuconfig INTEL_ATOMISP config VIDEO_ATOMISP tristate "Intel Atom Image Signal Processor Driver" depends on VIDEO_DEV && INTEL_ATOMISP + depends on MEDIA_PCI_SUPPORT depends on PMIC_OPREGION + depends on I2C select V4L2_FWNODE select IOSF_MBI + select IPU_BRIDGE select VIDEOBUF2_VMALLOC select VIDEO_V4L2_SUBDEV_API help diff --git a/drivers/staging/media/atomisp/pci/atomisp_csi2.h b/drivers/staging/media/atomisp/pci/atomisp_csi2.h index 16ddb3ab2963..8a112acba1e0 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_csi2.h +++ b/drivers/staging/media/atomisp/pci/atomisp_csi2.h @@ -30,9 +30,6 @@ #define CSI2_PAD_SOURCE1 #define CSI2_PADS_NUM 2 -#define CSI2_MAX_LANES 4 -#define CSI2_MAX_LINK_FREQS3 - #define CSI2_MAX_ACPI_GPIOS2u struct acpi_device; @@ -55,70 +52,6 @@ struct atomisp_csi2_acpi_gpio_parsing_data { unsigned int map_count; }; -enum atomisp_csi2_sensor_swnodes { - SWNODE_SENSOR, - SWNODE_SENSOR_PORT, - SWNODE_SENSOR_ENDPOINT, - SWNODE_CSI2_PORT, - SWNODE_CSI2_ENDPOINT, - SWNODE_COUNT -}; - -struct atomisp_csi2_property_names { - char clock_frequency[16]; - char rotation[9]; - char bus_type[9]; - char data_lanes[11]; - char remote_endpoint[16]; - char link_frequencies[17]; -}; - -struct atomisp_csi2_node_names { - char port[7]; - char endpoint[11]; - char remote_port[7]; -}; - -struct atomisp_csi2_sensor_config { - const char *hid; - int lanes; - int nr_link_freqs; - u64 link_freqs[CSI2_MAX_LINK_FREQS]; -}; - -struct atomisp_csi2_sensor { - /* Append port in "-%u" format as suffix of HID */ - char name[ACPI_ID_LEN + 4]; - struct acpi_device *adev; - int port; - int lanes; - - /* SWNODE_COUNT + 1 for terminating NULL */ - const struct software_node *group[SWNODE_COUNT + 1]; - struct software_node swnodes[SWNODE_COUNT]; - struct atomisp_csi2_node_names node_names; - struct atomisp_csi2_property_names prop_names; - /* "clock-frequency", "rotation" + terminating entry */ - struct property_entry dev_properties[3]; - /* "bus-type", "data-lanes", "remote-endpoint" + "link-freq" + terminating entry */ - struct property_entry ep_properties[5]; - /* "data-lanes", "remote-endpoint" + terminating entry */ - struct property_entry csi2_properties[3]; - struct software_node_ref_args local_ref[1]; - struct software_node_ref_args remote_ref[1]; - struct software_node_ref_args vcm_ref[1]; - /* GPIO mappings storage */ - struct atomisp_csi2_acpi_gpio_map gpio_map; -}; - -struct atomisp_csi2_bridge { - struct software_node csi2_node; - char csi2_node_name[14]; - u32 data_lanes[CSI2_MAX_LANES]; - unsigned int n_sensors; - struct atomisp_csi2_sensor sensors[ATOMISP_CAMERA_NR_PORTS]; -}; - struct atomisp_mipi_csi2_device { struct v4l2_subdev subdev; struct media_pad pads[CSI2_PADS_NUM]; diff --git a/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c b/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c index 46d9f31986c9..df625ac2c779 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_csi2_bridge.c +++ b/drivers/stag
[git:media_stage/master] media: Add MIPI CCI register access helper functions
This is an automatic generated email to let you know that the following patch were queued: Subject: media: Add MIPI CCI register access helper functions Author: Hans de Goede Date:Tue Jun 27 14:51:04 2023 +0200 The CSI2 specification specifies a standard method to access camera sensor registers called "Camera Control Interface (CCI)". This uses either 8 or 16 bit (big-endian wire order) register addresses and supports 8, 16, 24 or 32 bit (big-endian wire order) register widths. Currently a lot of Linux camera sensor drivers all have their own custom helpers for this, often copy and pasted from other drivers. Add a set of generic helpers for this so that all sensor drivers can switch to a single common implementation. These helpers take an extra optional "int *err" function parameter, this can be used to chain a bunch of register accesses together with only a single error check at the end, rather than needing to error check each individual register access. The first failing call will set the contents of err to a non 0 value and all other calls will then become no-ops. Link: https://lore.kernel.org/linux-media/59aefa7f-7bf9-6736-6040-39551329c...@redhat.com/ Reviewed-by: Andy Shevchenko Tested-by: Tommaso Merciai Reviewed-by: Tommaso Merciai Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Documentation/driver-api/media/v4l2-cci.rst | 5 + Documentation/driver-api/media/v4l2-core.rst | 1 + drivers/media/v4l2-core/Kconfig | 9 ++ drivers/media/v4l2-core/Makefile | 1 + drivers/media/v4l2-core/v4l2-cci.c | 166 +++ include/media/v4l2-cci.h | 125 6 files changed, 307 insertions(+) --- diff --git a/Documentation/driver-api/media/v4l2-cci.rst b/Documentation/driver-api/media/v4l2-cci.rst new file mode 100644 index ..dd297a40ed20 --- /dev/null +++ b/Documentation/driver-api/media/v4l2-cci.rst @@ -0,0 +1,5 @@ +.. SPDX-License-Identifier: GPL-2.0 + +V4L2 CCI kAPI +^ +.. kernel-doc:: include/media/v4l2-cci.h diff --git a/Documentation/driver-api/media/v4l2-core.rst b/Documentation/driver-api/media/v4l2-core.rst index 1a8c4a5f256b..239045ecc8f4 100644 --- a/Documentation/driver-api/media/v4l2-core.rst +++ b/Documentation/driver-api/media/v4l2-core.rst @@ -22,6 +22,7 @@ Video4Linux devices v4l2-mem2mem v4l2-async v4l2-fwnode +v4l2-cci v4l2-rect v4l2-tuner v4l2-common diff --git a/drivers/media/v4l2-core/Kconfig b/drivers/media/v4l2-core/Kconfig index 348559bc2468..f77ebd688cde 100644 --- a/drivers/media/v4l2-core/Kconfig +++ b/drivers/media/v4l2-core/Kconfig @@ -74,6 +74,15 @@ config V4L2_FWNODE config V4L2_ASYNC tristate +config V4L2_CCI + tristate + +config V4L2_CCI_I2C + tristate + depends on I2C + select REGMAP_I2C + select V4L2_CCI + # Used by drivers that need Videobuf modules config VIDEOBUF_GEN tristate diff --git a/drivers/media/v4l2-core/Makefile b/drivers/media/v4l2-core/Makefile index 41d91bd10cf2..be2551705755 100644 --- a/drivers/media/v4l2-core/Makefile +++ b/drivers/media/v4l2-core/Makefile @@ -25,6 +25,7 @@ videodev-$(CONFIG_VIDEO_V4L2_I2C) += v4l2-i2c.o # (e. g. LC_ALL=C sort Makefile) obj-$(CONFIG_V4L2_ASYNC) += v4l2-async.o +obj-$(CONFIG_V4L2_CCI) += v4l2-cci.o obj-$(CONFIG_V4L2_FLASH_LED_CLASS) += v4l2-flash-led-class.o obj-$(CONFIG_V4L2_FWNODE) += v4l2-fwnode.o obj-$(CONFIG_V4L2_H264) += v4l2-h264.o diff --git a/drivers/media/v4l2-core/v4l2-cci.c b/drivers/media/v4l2-core/v4l2-cci.c new file mode 100644 index ..bc2dbec019b0 --- /dev/null +++ b/drivers/media/v4l2-core/v4l2-cci.c @@ -0,0 +1,166 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * MIPI Camera Control Interface (CCI) register access helpers. + * + * Copyright (C) 2023 Hans de Goede + */ + +#include +#include +#include +#include +#include +#include + +#include + +#include + +int cci_read(struct regmap *map, u32 reg, u64 *val, int *err) +{ + unsigned int len; + u8 buf[8]; + int ret; + + if (err && *err) + return *err; + + len = FIELD_GET(CCI_REG_WIDTH_MASK, reg); + reg = FIELD_GET(CCI_REG_ADDR_MASK, reg); + + ret = regmap_bulk_read(map, reg, buf, len); + if (ret) { + dev_err(regmap_get_device(map), "Error reading reg 0x%4x: %d\n", + reg, ret); + goto out; + } + + switch (len) { + case 1: + *val = buf[0]; + break; + case 2: + *val = get_unaligned_be16(buf); + break; + case 3: + *val = get_unaligned_be24(buf); + break; + case 4: + *val = get_unaligned_be32(buf); + break; + case 8: + *val = get_unaligned_be64(buf);
[git:media_stage/master] media: imx290: Convert to new CCI register access helpers
This is an automatic generated email to let you know that the following patch were queued: Subject: media: imx290: Convert to new CCI register access helpers Author: Hans de Goede Date:Tue Jun 27 14:51:06 2023 +0200 Use the new comon CCI register access helpers to replace the private register access helpers in the imx290 driver. [Sakari Ailus: Squashed the patch to address a merge issue in Kconfig] Reviewed-by: Laurent Pinchart Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/Kconfig | 1 + drivers/media/i2c/imx290.c | 360 +++-- 2 files changed, 150 insertions(+), 211 deletions(-) --- diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index f212c344b4b6..07cdf9590a14 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -125,6 +125,7 @@ config VIDEO_IMX274 config VIDEO_IMX290 tristate "Sony IMX290 sensor support" select REGMAP_I2C + select V4L2_CCI_I2C help This is a Video4Linux2 sensor driver for the Sony IMX290 camera sensor. diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c index 8fe02220b25f..29098612813c 100644 --- a/drivers/media/i2c/imx290.c +++ b/drivers/media/i2c/imx290.c @@ -21,91 +21,86 @@ #include #include +#include #include #include #include #include #include -#define IMX290_REG_SIZE_SHIFT 16 -#define IMX290_REG_ADDR_MASK 0x -#define IMX290_REG_8BIT(n) ((1U << IMX290_REG_SIZE_SHIFT) | (n)) -#define IMX290_REG_16BIT(n)((2U << IMX290_REG_SIZE_SHIFT) | (n)) -#define IMX290_REG_24BIT(n)((3U << IMX290_REG_SIZE_SHIFT) | (n)) - -#define IMX290_STANDBY IMX290_REG_8BIT(0x3000) -#define IMX290_REGHOLD IMX290_REG_8BIT(0x3001) -#define IMX290_XMSTA IMX290_REG_8BIT(0x3002) -#define IMX290_ADBIT IMX290_REG_8BIT(0x3005) +#define IMX290_STANDBY CCI_REG8(0x3000) +#define IMX290_REGHOLD CCI_REG8(0x3001) +#define IMX290_XMSTA CCI_REG8(0x3002) +#define IMX290_ADBIT CCI_REG8(0x3005) #define IMX290_ADBIT_10BIT (0 << 0) #define IMX290_ADBIT_12BIT (1 << 0) -#define IMX290_CTRL_07 IMX290_REG_8BIT(0x3007) +#define IMX290_CTRL_07 CCI_REG8(0x3007) #define IMX290_VREVERSEBIT(0) #define IMX290_HREVERSEBIT(1) #define IMX290_WINMODE_1080P (0 << 4) #define IMX290_WINMODE_720P(1 << 4) #define IMX290_WINMODE_CROP(4 << 4) -#define IMX290_FR_FDG_SEL IMX290_REG_8BIT(0x3009) -#define IMX290_BLKLEVEL IMX290_REG_16BIT(0x300a) -#define IMX290_GAINIMX290_REG_8BIT(0x3014) -#define IMX290_VMAXIMX290_REG_24BIT(0x3018) +#define IMX290_FR_FDG_SEL CCI_REG8(0x3009) +#define IMX290_BLKLEVEL CCI_REG16(0x300a) +#define IMX290_GAINCCI_REG8(0x3014) +#define IMX290_VMAXCCI_REG24(0x3018) #define IMX290_VMAX_MAX0x3 -#define IMX290_HMAXIMX290_REG_16BIT(0x301c) +#define IMX290_HMAXCCI_REG16(0x301c) #define IMX290_HMAX_MAX0x -#define IMX290_SHS1IMX290_REG_24BIT(0x3020) -#define IMX290_WINWV_OB IMX290_REG_8BIT(0x303a) -#define IMX290_WINPV IMX290_REG_16BIT(0x303c) -#define IMX290_WINWV IMX290_REG_16BIT(0x303e) -#define IMX290_WINPH IMX290_REG_16BIT(0x3040) -#define IMX290_WINWH IMX290_REG_16BIT(0x3042) -#define IMX290_OUT_CTRL IMX290_REG_8BIT(0x3046) +#define IMX290_SHS1CCI_REG24(0x3020) +#define IMX290_WINWV_OBCCI_REG8(0x303a) +#define IMX290_WINPV CCI_REG16(0x303c) +#define IMX290_WINWV CCI_REG16(0x303e) +#define IMX290_WINPH
[git:media_stage/master] media: atomisp: ov2680: Convert to new CCI register access helpers
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atomisp: ov2680: Convert to new CCI register access helpers Author: Hans de Goede Date:Tue Jun 27 14:51:07 2023 +0200 Use the new comon CCI register access helpers to replace the private register access helpers in the ov2680 driver. While at it also switch to using the same register address defines as the standard drivers/media/i2c/ov2680.c driver to make merging the 2 drivers simpler. Reviewed-by: Laurent Pinchart Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/staging/media/atomisp/i2c/Kconfig | 1 + drivers/staging/media/atomisp/i2c/atomisp-ov2680.c | 247 ++--- drivers/staging/media/atomisp/i2c/ov2680.h | 86 +-- 3 files changed, 119 insertions(+), 215 deletions(-) --- diff --git a/drivers/staging/media/atomisp/i2c/Kconfig b/drivers/staging/media/atomisp/i2c/Kconfig index e726101b24e4..e34646d7dadc 100644 --- a/drivers/staging/media/atomisp/i2c/Kconfig +++ b/drivers/staging/media/atomisp/i2c/Kconfig @@ -61,6 +61,7 @@ config VIDEO_ATOMISP_OV2680 tristate "Omnivision OV2680 sensor support" depends on ACPI depends on I2C && VIDEO_DEV + select V4L2_CCI_I2C help This is a Video4Linux2 sensor-level driver for the Omnivision OV2680 raw camera. diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c index 4cc2839937af..f933a65ac8d4 100644 --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c @@ -23,13 +23,50 @@ #include #include #include +#include #include -#include #include #include "ov2680.h" +#define OV2680_CHIP_ID 0x2680 + +#define OV2680_REG_STREAM_CTRL CCI_REG8(0x0100) +#define OV2680_REG_SOFT_RESET CCI_REG8(0x0103) + +#define OV2680_REG_CHIP_ID CCI_REG16(0x300a) +#define OV2680_REG_SC_CMMN_SUB_ID CCI_REG8(0x302a) + +#define OV2680_REG_EXPOSURE_PK CCI_REG24(0x3500) +#define OV2680_REG_R_MANUALCCI_REG8(0x3503) +#define OV2680_REG_GAIN_PK CCI_REG16(0x350a) + +#define OV2680_REG_SENSOR_CTRL_0A CCI_REG8(0x370a) + +#define OV2680_REG_HORIZONTAL_STARTCCI_REG16(0x3800) +#define OV2680_REG_VERTICAL_START CCI_REG16(0x3802) +#define OV2680_REG_HORIZONTAL_END CCI_REG16(0x3804) +#define OV2680_REG_VERTICAL_ENDCCI_REG16(0x3806) +#define OV2680_REG_HORIZONTAL_OUTPUT_SIZE CCI_REG16(0x3808) +#define OV2680_REG_VERTICAL_OUTPUT_SIZECCI_REG16(0x380a) +#define OV2680_REG_TIMING_HTS CCI_REG16(0x380c) +#define OV2680_REG_TIMING_VTS CCI_REG16(0x380e) +#define OV2680_REG_ISP_X_WIN CCI_REG16(0x3810) +#define OV2680_REG_ISP_Y_WIN CCI_REG16(0x3812) +#define OV2680_REG_X_INC CCI_REG8(0x3814) +#define OV2680_REG_Y_INC CCI_REG8(0x3815) +#define OV2680_REG_FORMAT1 CCI_REG8(0x3820) +#define OV2680_REG_FORMAT2 CCI_REG8(0x3821) + +#define OV2680_REG_ISP_CTRL00 CCI_REG8(0x5080) + +#define OV2680_REG_X_WIN CCI_REG16(0x5704) +#define OV2680_REG_Y_WIN CCI_REG16(0x5706) + +#define OV2680_FRAME_RATE 30 +#define OV2680_INTEGRATION_TIME_MARGIN 8 + static const struct v4l2_rect ov2680_default_crop = { .left = OV2680_ACTIVE_START_LEFT, .top = OV2680_ACTIVE_START_TOP, @@ -37,21 +74,6 @@ static const struct v4l2_rect ov2680_default_crop = { .height = OV2680_ACTIVE_HEIGHT, }; -static int ov2680_write_reg_array(struct i2c_client *client, - const struct ov2680_reg *reglist) -{ - const struct ov2680_reg *next = reglist; - int ret; - - for (; next->reg != 0; next++) { - ret = ov_write_reg8(client, next->reg, next->val); - if (ret) - return ret; - } - - return 0; -} - static void ov2680_set_bayer_order(struct ov2680_dev *sensor, struct v4l2_mbus_framefmt *fmt) { static const int ov2680_hv_flip_bayer_order[] = { @@ -78,7 +100,8 @@ static int ov2680_set_vflip(struct ov2680_dev *sensor, s32 val) if (sensor->is_streaming) return -EBUSY; - ret = ov_update_reg(sensor->client, OV2680_REG_FORMAT1, BIT(2), val ? BIT(2) : 0); + ret = cci_update_bits(sensor->regmap, OV2680_REG_FORMAT1, BIT(2), + val ? BIT(2) : 0, NULL); if (ret < 0) return ret; @@ -93,7 +116,8 @@ static int ov2
[git:media_stage/master] media: ipu-bridge: Do not use on stack memory for software_node.name field
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ipu-bridge: Do not use on stack memory for software_node.name field Author: Hans de Goede Date:Wed Jul 5 23:29:54 2023 +0200 Commit 567f97bd381f ("media: ipu3-cio2: support multiple sensors and VCMs with same HID") introduced an on stack vcm_name and then uses this for the name field of the software_node struct used for the vcm. But the software_node struct is much longer lived then the current stack-frame, so this is no good. Instead extend the ipu_node_names struct with an extra field to store the vcm software_node name and use that. Note this also changes the length of the allocated buffer from ACPI_ID_LEN + 4 to 16. the name is filled with "-%u" where ipu_vcm_types[x] is not an ACPI_ID. The maximum length of the strings in the ipu_vcm_types[] array is 11 + 5 bytes for "-255\0" means 16 bytes are needed in the worst case scenario. Fixes: 567f97bd381f ("media: ipu3-cio2: support multiple sensors and VCMs with same HID") Cc: Bingbu Cao Reviewed-by: Andy Shevchenko Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu-bridge.c | 7 +++ drivers/media/pci/intel/ipu-bridge.h | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) --- diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index c23c1ee30ad9..ad1f78be3aa7 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -220,7 +220,6 @@ static void ipu_bridge_create_connection_swnodes(struct ipu_bridge *bridge, struct ipu_sensor *sensor) { struct software_node *nodes = sensor->swnodes; - char vcm_name[ACPI_ID_LEN + 4]; ipu_bridge_init_swnode_names(sensor); @@ -240,10 +239,10 @@ static void ipu_bridge_create_connection_swnodes(struct ipu_bridge *bridge, sensor->ipu_properties); if (sensor->ssdb.vcmtype) { /* append ssdb.link to distinguish VCM nodes with same HID */ - snprintf(vcm_name, sizeof(vcm_name), "%s-%u", -ipu_vcm_types[sensor->ssdb.vcmtype - 1], + snprintf(sensor->node_names.vcm, sizeof(sensor->node_names.vcm), +"%s-%u", ipu_vcm_types[sensor->ssdb.vcmtype - 1], sensor->ssdb.link); - nodes[SWNODE_VCM] = NODE_VCM(vcm_name); + nodes[SWNODE_VCM] = NODE_VCM(sensor->node_names.vcm); } ipu_bridge_init_swnode_group(sensor); diff --git a/drivers/media/pci/intel/ipu-bridge.h b/drivers/media/pci/intel/ipu-bridge.h index 8cb733c03e2f..6cce712a0f34 100644 --- a/drivers/media/pci/intel/ipu-bridge.h +++ b/drivers/media/pci/intel/ipu-bridge.h @@ -103,6 +103,7 @@ struct ipu_node_names { char port[7]; char endpoint[11]; char remote_port[7]; + char vcm[16]; }; struct ipu_sensor_config { ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: MAINTAINERS: Split sensors and lens drivers, add documentation
This is an automatic generated email to let you know that the following patch were queued: Subject: media: MAINTAINERS: Split sensors and lens drivers, add documentation Author: Sakari Ailus Date:Fri Jun 30 12:59:41 2023 +0200 Split lens drivers from camera sensor into a new section. This makes it easier to maintain the list. Also add documentation related files under the camera sensor entry. Add the word "CAMERA" to the subject as well since there are many other kinds of sensors. Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab MAINTAINERS | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) --- diff --git a/MAINTAINERS b/MAINTAINERS index 52a7c026f398..e1d9320e31b2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -22292,10 +22292,20 @@ F:drivers/media/v4l2-core/v4l2-fwnode.c F: include/media/v4l2-async.h F: include/media/v4l2-fwnode.h -V4L2 SENSOR AND LENS DRIVERS +V4L2 LENS DRIVERS M: Sakari Ailus L: linux-me...@vger.kernel.org S: Maintained +F: drivers/media/i2c/ak* +F: drivers/media/i2c/dw* +F: drivers/media/i2c/lm* + +V4L2 CAMERA SENSOR DRIVERS +M: Sakari Ailus +L: linux-me...@vger.kernel.org +S: Maintained +F: Documentation/driver-api/media/camera-sensor.rst +F: Documentation/driver-api/media/tx-rx.rst F: drivers/media/i2c/ar* F: drivers/media/i2c/hi* F: drivers/media/i2c/imx* @@ -22304,9 +22314,6 @@ F: drivers/media/i2c/og* F: drivers/media/i2c/ov* F: drivers/media/i2c/s5* F: drivers/media/i2c/st-vgxy61.c -F: drivers/media/i2c/dw* -F: drivers/media/i2c/ak* -F: drivers/media/i2c/lm* VF610 NAND DRIVER M: Stefan Agner ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: rcar-csi2: Add support for C-PHY on R-Car V4H
This is an automatic generated email to let you know that the following patch were queued: Subject: media: rcar-csi2: Add support for C-PHY on R-Car V4H Author: Niklas Söderlund Date:Sat Jul 15 22:12:39 2023 +0200 Add support for C-PHY on R-Car V4H. While the V4H supports both D-PHY and C-PHY this patch only adds support for the C-PHY mode due to lack of documentation and hardware to test on. The V4H is the first Gen4 device that is enabled in the rcar-csi2 driver. There is much overlap with the Gen3 driver, the primary difference is in how the receiver is started. The V4H have a much larger register space and some addresses overlap with Gen3. [Sakari Ailus: Use div_u64() to divide a 64-bit integer.] Signed-off-by: Niklas Söderlund Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab .../media/platform/renesas/rcar-vin/rcar-csi2.c| 291 + 1 file changed, 291 insertions(+) --- diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-csi2.c b/drivers/media/platform/renesas/rcar-vin/rcar-csi2.c index f536b6359146..f6326df0b09b 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-csi2.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-csi2.c @@ -132,6 +132,111 @@ struct rcar_csi2; #define PHYFRX_FORCERX_MODE_1 BIT(1) #define PHYFRX_FORCERX_MODE_0 BIT(0) +/* V4H BASE registers */ +#define V4H_N_LANES_REG0x0004 +#define V4H_CSI2_RESETN_REG0x0008 +#define V4H_PHY_MODE_REG 0x001c +#define V4H_PHY_SHUTDOWNZ_REG 0x0040 +#define V4H_DPHY_RSTZ_REG 0x0044 +#define V4H_FLDC_REG 0x0804 +#define V4H_FLDD_REG 0x0808 +#define V4H_IDIC_REG 0x0810 +#define V4H_PHY_EN_REG 0x2000 + +#define V4H_ST_PHYST_REG 0x2814 +#define V4H_ST_PHYST_ST_PHY_READY BIT(31) +#define V4H_ST_PHYST_ST_STOPSTATE_3BIT(3) +#define V4H_ST_PHYST_ST_STOPSTATE_2BIT(2) +#define V4H_ST_PHYST_ST_STOPSTATE_1BIT(1) +#define V4H_ST_PHYST_ST_STOPSTATE_0BIT(0) + +/* V4H PPI registers */ +#define V4H_PPI_STARTUP_RW_COMMON_DPHY_REG(n) (0x21800 + ((n) * 2)) /* n = 0 - 9 */ +#define V4H_PPI_STARTUP_RW_COMMON_STARTUP_1_1_REG 0x21822 +#define V4H_PPI_CALIBCTRL_RW_COMMON_BG_0_REG 0x2184c +#define V4H_PPI_RW_LPDCOCAL_TIMEBASE_REG 0x21c02 +#define V4H_PPI_RW_LPDCOCAL_NREF_REG 0x21c04 +#define V4H_PPI_RW_LPDCOCAL_NREF_RANGE_REG 0x21c06 +#define V4H_PPI_RW_LPDCOCAL_TWAIT_CONFIG_REG 0x21c0a +#define V4H_PPI_RW_LPDCOCAL_VT_CONFIG_REG 0x21c0c +#define V4H_PPI_RW_LPDCOCAL_COARSE_CFG_REG 0x21c10 +#define V4H_PPI_RW_COMMON_CFG_REG 0x21c6c +#define V4H_PPI_RW_TERMCAL_CFG_0_REG 0x21c80 +#define V4H_PPI_RW_OFFSETCAL_CFG_0_REG 0x21ca0 + +/* V4H CORE registers */ +#define V4H_CORE_DIG_IOCTRL_RW_AFE_LANE0_CTRL_2_REG(n) (0x22040 + ((n) * 2)) /* n = 0 - 15 */ +#define V4H_CORE_DIG_IOCTRL_RW_AFE_LANE1_CTRL_2_REG(n) (0x22440 + ((n) * 2)) /* n = 0 - 15 */ +#define V4H_CORE_DIG_IOCTRL_RW_AFE_LANE2_CTRL_2_REG(n) (0x22840 + ((n) * 2)) /* n = 0 - 15 */ +#define V4H_CORE_DIG_IOCTRL_RW_AFE_LANE3_CTRL_2_REG(n) (0x22c40 + ((n) * 2)) /* n = 0 - 15 */ +#define V4H_CORE_DIG_IOCTRL_RW_AFE_LANE4_CTRL_2_REG(n) (0x23040 + ((n) * 2)) /* n = 0 - 15 */ +#define V4H_CORE_DIG_IOCTRL_RW_AFE_CB_CTRL_2_REG(n)(0x23840 + ((n) * 2)) /* n = 0 - 11 */ +#define V4H_CORE_DIG_RW_COMMON_REG(n) (0x23880 + ((n) * 2)) /* n = 0 - 15 */ +#define V4H_CORE_DIG_ANACTRL_RW_COMMON_ANACTRL_REG(n) (0x239e0 + ((n) * 2)) /* n = 0 - 3 */ +#define V4H_CORE_DIG_CLANE_1_RW_CFG_0_REG 0x2a400 +#define V4H_CORE_DIG_CLANE_1_RW_HS_TX_6_REG0x2a60c + +/* V4H C-PHY */ +#define V4H_CORE_DIG_RW_TRIO0_REG(n) (0x22100 + ((n) * 2)) /* n = 0 - 3 */ +#define V4H_CORE_DIG_RW_TRIO1_REG(n) (0x22500 + ((n) * 2)) /* n = 0 - 3 */ +#define V4H_CORE_DIG_RW_TRIO2_REG(n) (0x22900 + ((n) * 2)) /* n = 0 - 3 */ +#define V4H_CORE_DIG_CLANE_0_RW_LP_0_REG 0x2a080 +#define V4H_CORE_DIG_CLANE_0_RW_HS_RX_REG(n) (0x2a100 + ((n) * 2)) /* n = 0 - 6 */ +#define V4H_CORE_DIG_CLANE_1_RW_LP_0_REG 0x2a480 +#define V4H_CORE_DIG_CLANE_1_RW_HS_RX_REG(n) (0x2a500 + ((n) * 2)) /* n = 0 - 6 */ +#define V4H_CORE_DIG_CLANE_2_RW_LP_0_REG 0x2a880 +#define V4H_CORE_DIG_CLANE_2_RW_HS_RX_REG(n) (0x2a900 + ((n) * 2)) /* n = 0 - 6 */ + +struct rcsi2_cphy_setting { + u16 msps; + u16 rx2; + u16 trio0; + u16 trio1; + u16 trio2
[git:media_stage/master] media: v4l: async: Avoid a goto in loop implementation
This is an automatic generated email to let you know that the following patch were queued: Subject: media: v4l: async: Avoid a goto in loop implementation Author: Sakari Ailus Date:Sat Jul 29 13:52:14 2023 +0200 Replace a goto-based loop by a while loop. Suggested-by: Mauro Carvalho Chehab Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/v4l2-core/v4l2-async.c | 24 ++-- 1 file changed, 10 insertions(+), 14 deletions(-) --- diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index f465a0964adf..091e8cf4114b 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -820,20 +820,16 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd) if (!v4l2_dev) continue; -again: - asc = v4l2_async_find_match(notifier, sd); - if (!asc) - continue; - - ret = v4l2_async_match_notify(notifier, v4l2_dev, sd, asc); - if (ret) - goto err_unbind; - - ret = v4l2_async_nf_try_complete(notifier); - if (ret) - goto err_unbind; - - goto again; + while ((asc = v4l2_async_find_match(notifier, sd))) { + ret = v4l2_async_match_notify(notifier, v4l2_dev, sd, + asc); + if (ret) + goto err_unbind; + + ret = v4l2_async_nf_try_complete(notifier); + if (ret) + goto err_unbind; + } } /* None matched, wait for hot-plugging */ ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: i2c: imx219: Rename mbus codes array
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: imx219: Rename mbus codes array Author: Jean-Michel Hautbois Date:Mon Jul 10 17:51:57 2023 +0200 The imx219 is using the name "codes" for the mbus formats array. The name is too generic and not easy to read and follow in the code. Change it to imx219_mbus_formats. Signed-off-by: Jean-Michel Hautbois Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi Reviewed-by: Tommaso Merciai Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/imx219.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) --- diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index d737d5e9a4a6..ac6b0e7a838d 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -345,7 +345,7 @@ static const char * const imx219_supply_name[] = { * - v flip * - h flips */ -static const u32 codes[] = { +static const u32 imx219_mbus_formats[] = { MEDIA_BUS_FMT_SRGGB10_1X10, MEDIA_BUS_FMT_SGRBG10_1X10, MEDIA_BUS_FMT_SGBRG10_1X10, @@ -578,17 +578,17 @@ static u32 imx219_get_format_code(struct imx219 *imx219, u32 code) lockdep_assert_held(>mutex); - for (i = 0; i < ARRAY_SIZE(codes); i++) - if (codes[i] == code) + for (i = 0; i < ARRAY_SIZE(imx219_mbus_formats); i++) + if (imx219_mbus_formats[i] == code) break; - if (i >= ARRAY_SIZE(codes)) + if (i >= ARRAY_SIZE(imx219_mbus_formats)) i = 0; i = (i & ~3) | (imx219->vflip->val ? 2 : 0) | (imx219->hflip->val ? 1 : 0); - return codes[i]; + return imx219_mbus_formats[i]; } static void imx219_set_default_format(struct imx219 *imx219) @@ -731,11 +731,11 @@ static int imx219_enum_mbus_code(struct v4l2_subdev *sd, { struct imx219 *imx219 = to_imx219(sd); - if (code->index >= (ARRAY_SIZE(codes) / 4)) + if (code->index >= (ARRAY_SIZE(imx219_mbus_formats) / 4)) return -EINVAL; mutex_lock(>mutex); - code->code = imx219_get_format_code(imx219, codes[code->index * 4]); + code->code = imx219_get_format_code(imx219, imx219_mbus_formats[code->index * 4]); mutex_unlock(>mutex); return 0; @@ -831,14 +831,14 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd, mutex_lock(>mutex); - for (i = 0; i < ARRAY_SIZE(codes); i++) - if (codes[i] == fmt->format.code) + for (i = 0; i < ARRAY_SIZE(imx219_mbus_formats); i++) + if (imx219_mbus_formats[i] == fmt->format.code) break; - if (i >= ARRAY_SIZE(codes)) + if (i >= ARRAY_SIZE(imx219_mbus_formats)) i = 0; /* Bayer order varies with flips */ - fmt->format.code = imx219_get_format_code(imx219, codes[i]); + fmt->format.code = imx219_get_format_code(imx219, imx219_mbus_formats[i]); mode = v4l2_find_nearest_size(supported_modes, ARRAY_SIZE(supported_modes), ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ipu-bridge: Fix null pointer deref on SSDB/PLD parsing warnings
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ipu-bridge: Fix null pointer deref on SSDB/PLD parsing warnings Author: Hans de Goede Date:Wed Jul 5 23:29:53 2023 +0200 When ipu_bridge_parse_rotation() and ipu_bridge_parse_orientation() run sensor->adev is not set yet. So if either of the dev_warn() calls about unknown values are hit this will lead to a NULL pointer deref. Set sensor->adev earlier, with a borrowed ref to avoid making unrolling on errors harder, to fix this. Fixes: 485aa3df0dff ("media: ipu3-cio2: Parse sensor orientation and rotation") Cc: Fabian Wüthrich Signed-off-by: Hans de Goede Reviewed-by: Daniel Scally Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu-bridge.c | 5 + 1 file changed, 5 insertions(+) --- diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index bd67c3e990ea..c23c1ee30ad9 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -308,6 +308,11 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg, } sensor = >sensors[bridge->n_sensors]; + /* +* Borrow our adev ref to the sensor for now, on success +* acpi_dev_get(adev) is done further below. +*/ + sensor->adev = adev; ret = ipu_bridge_read_acpi_buffer(adev, "SSDB", >ssdb, ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: i2c: imx219: Complete default format initialization
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: imx219: Complete default format initialization Author: Jacopo Mondi Date:Mon Jul 10 17:51:59 2023 +0200 Complete the default format initialization in init_cfg() filling in the fields for the colorspace configuration copied from imx219_set_default_format(). Signed-off-by: Jacopo Mondi Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/imx219.c | 6 ++ 1 file changed, 6 insertions(+) --- diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index 45b219321d98..cd43a897391c 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -714,6 +714,12 @@ static int imx219_init_cfg(struct v4l2_subdev *sd, format->code = imx219_get_format_code(imx219, MEDIA_BUS_FMT_SRGGB10_1X10); format->field = V4L2_FIELD_NONE; + format->colorspace = V4L2_COLORSPACE_SRGB; + format->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(format->colorspace); + format->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(true, +format->colorspace, +format->ycbcr_enc); + format->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(format->colorspace); /* Initialize crop rectangle. */ crop = v4l2_subdev_get_pad_crop(sd, state, 0); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: i2c: imx219: Switch from open to init_cfg
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: imx219: Switch from open to init_cfg Author: Jean-Michel Hautbois Date:Mon Jul 10 17:51:58 2023 +0200 Use the init_cfg pad level operation instead of the internal subdev open operation to set default formats on the pads. Signed-off-by: Jean-Michel Hautbois Signed-off-by: Jacopo Mondi Reviewed-by: Dave Stevenson Reviewed-by: Laurent Pinchart Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/imx219.c | 63 +++--- 1 file changed, 31 insertions(+), 32 deletions(-) --- diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index ac6b0e7a838d..45b219321d98 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -608,34 +608,6 @@ static void imx219_set_default_format(struct imx219 *imx219) fmt->field = V4L2_FIELD_NONE; } -static int imx219_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) -{ - struct imx219 *imx219 = to_imx219(sd); - struct v4l2_mbus_framefmt *try_fmt = - v4l2_subdev_get_try_format(sd, fh->state, 0); - struct v4l2_rect *try_crop; - - mutex_lock(>mutex); - - /* Initialize try_fmt */ - try_fmt->width = supported_modes[0].width; - try_fmt->height = supported_modes[0].height; - try_fmt->code = imx219_get_format_code(imx219, - MEDIA_BUS_FMT_SRGGB10_1X10); - try_fmt->field = V4L2_FIELD_NONE; - - /* Initialize try_crop rectangle. */ - try_crop = v4l2_subdev_get_try_crop(sd, fh->state, 0); - try_crop->top = IMX219_PIXEL_ARRAY_TOP; - try_crop->left = IMX219_PIXEL_ARRAY_LEFT; - try_crop->width = IMX219_PIXEL_ARRAY_WIDTH; - try_crop->height = IMX219_PIXEL_ARRAY_HEIGHT; - - mutex_unlock(>mutex); - - return 0; -} - static int imx219_set_ctrl(struct v4l2_ctrl *ctrl) { struct imx219 *imx219 = @@ -725,6 +697,36 @@ static const struct v4l2_ctrl_ops imx219_ctrl_ops = { .s_ctrl = imx219_set_ctrl, }; +static int imx219_init_cfg(struct v4l2_subdev *sd, + struct v4l2_subdev_state *state) +{ + struct imx219 *imx219 = to_imx219(sd); + struct v4l2_mbus_framefmt *format; + struct v4l2_rect *crop; + + /* imx219_get_format_code() wants mutex locked. */ + mutex_lock(>mutex); + + /* Initialize try_fmt */ + format = v4l2_subdev_get_pad_format(sd, state, 0); + format->width = supported_modes[0].width; + format->height = supported_modes[0].height; + format->code = imx219_get_format_code(imx219, + MEDIA_BUS_FMT_SRGGB10_1X10); + format->field = V4L2_FIELD_NONE; + + /* Initialize crop rectangle. */ + crop = v4l2_subdev_get_pad_crop(sd, state, 0); + crop->top = IMX219_PIXEL_ARRAY_TOP; + crop->left = IMX219_PIXEL_ARRAY_LEFT; + crop->width = IMX219_PIXEL_ARRAY_WIDTH; + crop->height = IMX219_PIXEL_ARRAY_HEIGHT; + + mutex_unlock(>mutex); + + return 0; +} + static int imx219_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_mbus_code_enum *code) @@ -1235,6 +1237,7 @@ static const struct v4l2_subdev_video_ops imx219_video_ops = { }; static const struct v4l2_subdev_pad_ops imx219_pad_ops = { + .init_cfg = imx219_init_cfg, .enum_mbus_code = imx219_enum_mbus_code, .get_fmt = imx219_get_pad_format, .set_fmt = imx219_set_pad_format, @@ -1248,9 +1251,6 @@ static const struct v4l2_subdev_ops imx219_subdev_ops = { .pad = _pad_ops, }; -static const struct v4l2_subdev_internal_ops imx219_internal_ops = { - .open = imx219_open, -}; static unsigned long imx219_get_pixel_rate(struct imx219 *imx219) { @@ -1509,7 +1509,6 @@ static int imx219_probe(struct i2c_client *client) goto error_power_off; /* Initialize subdev */ - imx219->sd.internal_ops = _internal_ops; imx219->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; imx219->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ipu-bridge: Move initialization of node_names.vcm to ipu_bridge_init_swnode_names()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ipu-bridge: Move initialization of node_names.vcm to ipu_bridge_init_swnode_names() Author: Hans de Goede Date:Wed Jul 5 23:29:55 2023 +0200 Move initialization of node_names.vcm to ipu_bridge_init_swnode_names() where it belongs. And make the initialization of nodes[SWNODE_VCM] unconditional, ipu_bridge_init_swnode_group() takes care of not registering it when there is no VCM. Reviewed-by: Andy Shevchenko Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu-bridge.c | 16 +++- drivers/media/pci/intel/ipu-bridge.h | 4 ++-- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) --- diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index d1bc7035eeea..8f6f88f0ec95 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -4,7 +4,6 @@ #include #include #include -#include #include #include @@ -288,7 +287,7 @@ static void ipu_bridge_unregister_sensors(struct ipu_bridge *bridge) static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg, struct ipu_bridge *bridge, -struct pci_dev *ipu) +struct device *dev) { struct fwnode_handle *fwnode, *primary; struct ipu_sensor *sensor; @@ -302,7 +301,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg, if (bridge->n_sensors >= IPU_MAX_PORTS) { acpi_dev_put(adev); - dev_err(>dev, "Exceeded available IPU ports\n"); + dev_err(dev, "Exceeded available IPU ports\n"); return -EINVAL; } @@ -362,7 +361,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg, ipu_bridge_instantiate_vcm_i2c_client(sensor); - dev_info(>dev, "Found supported sensor %s\n", + dev_info(dev, "Found supported sensor %s\n", acpi_dev_name(adev)); bridge->n_sensors++; @@ -380,7 +379,7 @@ err_put_adev: } static int ipu_bridge_connect_sensors(struct ipu_bridge *bridge, - struct pci_dev *ipu) + struct device *dev) { unsigned int i; int ret; @@ -389,7 +388,7 @@ static int ipu_bridge_connect_sensors(struct ipu_bridge *bridge, const struct ipu_sensor_config *cfg = _supported_sensors[i]; - ret = ipu_bridge_connect_sensor(cfg, bridge, ipu); + ret = ipu_bridge_connect_sensor(cfg, bridge, dev); if (ret) goto err_unregister_sensors; } @@ -435,9 +434,8 @@ static int ipu_bridge_sensors_are_ready(void) return ready; } -int ipu_bridge_init(struct pci_dev *ipu) +int ipu_bridge_init(struct device *dev) { - struct device *dev = >dev; struct fwnode_handle *fwnode; struct ipu_bridge *bridge; unsigned int i; @@ -470,7 +468,7 @@ int ipu_bridge_init(struct pci_dev *ipu) for (i = 0; i < IPU_MAX_LANES; i++) bridge->data_lanes[i] = i + 1; - ret = ipu_bridge_connect_sensors(bridge, ipu); + ret = ipu_bridge_connect_sensors(bridge, dev); if (ret || bridge->n_sensors == 0) goto err_unregister_ipu; diff --git a/drivers/media/pci/intel/ipu-bridge.h b/drivers/media/pci/intel/ipu-bridge.h index 6cce712a0f34..8c1437f252d2 100644 --- a/drivers/media/pci/intel/ipu-bridge.h +++ b/drivers/media/pci/intel/ipu-bridge.h @@ -144,9 +144,9 @@ struct ipu_bridge { }; #if IS_ENABLED(CONFIG_IPU_BRIDGE) -int ipu_bridge_init(struct pci_dev *ipu); +int ipu_bridge_init(struct device *dev); #else -static inline int ipu_bridge_init(struct pci_dev *ipu) { return 0; } +static inline int ipu_bridge_init(struct device *dev) { return 0; } #endif #endif diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c index 8df0304c991e..3cadf94256c0 100644 --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c @@ -1725,7 +1725,7 @@ static int cio2_pci_probe(struct pci_dev *pci_dev, return -EINVAL; } - r = ipu_bridge_init(pci_dev); + r = ipu_bridge_init(dev); if (r) return r; } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: i2c: imx219: Use subdev active state
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: imx219: Use subdev active state Author: Jacopo Mondi Date:Mon Jul 10 17:52:01 2023 +0200 Port the imx219 sensor driver to use the subdev active state. Move all the format configuration to the subdevice state and simplify the format handling, locking and initialization. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/imx219.c | 179 - 1 file changed, 48 insertions(+), 131 deletions(-) --- diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index 6963e24e1bc2..73e06583d651 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -460,8 +460,6 @@ struct imx219 { struct v4l2_subdev sd; struct media_pad pad; - struct v4l2_mbus_framefmt fmt; - struct clk *xclk; /* system clock to IMX219 */ u32 xclk_freq; @@ -481,12 +479,6 @@ struct imx219 { /* Current mode */ const struct imx219_mode *mode; - /* -* Mutex for serialized access: -* Protect sensor module set pad format and start/stop streaming safely. -*/ - struct mutex mutex; - /* Streaming on/off */ bool streaming; @@ -576,8 +568,6 @@ static u32 imx219_get_format_code(struct imx219 *imx219, u32 code) { unsigned int i; - lockdep_assert_held(>mutex); - for (i = 0; i < ARRAY_SIZE(imx219_mbus_formats); i++) if (imx219_mbus_formats[i] == code) break; @@ -591,20 +581,6 @@ static u32 imx219_get_format_code(struct imx219 *imx219, u32 code) return imx219_mbus_formats[i]; } -static void imx219_set_default_format(struct imx219 *imx219) -{ - struct v4l2_mbus_framefmt *fmt; - - fmt = >fmt; - fmt->code = MEDIA_BUS_FMT_SRGGB10_1X10; - fmt->colorspace = V4L2_COLORSPACE_RAW; - fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE; - fmt->width = supported_modes[0].width; - fmt->height = supported_modes[0].height; - fmt->field = V4L2_FIELD_NONE; - fmt->xfer_func = V4L2_XFER_FUNC_NONE; -} - static int imx219_set_ctrl(struct v4l2_ctrl *ctrl) { struct imx219 *imx219 = @@ -701,9 +677,6 @@ static int imx219_init_cfg(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *format; struct v4l2_rect *crop; - /* imx219_get_format_code() wants mutex locked. */ - mutex_lock(>mutex); - /* Initialize try_fmt */ format = v4l2_subdev_get_pad_format(sd, state, 0); format->width = supported_modes[0].width; @@ -723,8 +696,6 @@ static int imx219_init_cfg(struct v4l2_subdev *sd, crop->width = IMX219_PIXEL_ARRAY_WIDTH; crop->height = IMX219_PIXEL_ARRAY_HEIGHT; - mutex_unlock(>mutex); - return 0; } @@ -737,9 +708,7 @@ static int imx219_enum_mbus_code(struct v4l2_subdev *sd, if (code->index >= (ARRAY_SIZE(imx219_mbus_formats) / 4)) return -EINVAL; - mutex_lock(>mutex); code->code = imx219_get_format_code(imx219, imx219_mbus_formats[code->index * 4]); - mutex_unlock(>mutex); return 0; } @@ -754,9 +723,7 @@ static int imx219_enum_frame_size(struct v4l2_subdev *sd, if (fse->index >= ARRAY_SIZE(supported_modes)) return -EINVAL; - mutex_lock(>mutex); code = imx219_get_format_code(imx219, fse->code); - mutex_unlock(>mutex); if (fse->code != code) return -EINVAL; @@ -785,52 +752,16 @@ static void imx219_update_pad_format(struct imx219 *imx219, imx219_reset_colorspace(>format); } -static int __imx219_get_pad_format(struct imx219 *imx219, - struct v4l2_subdev_state *sd_state, - struct v4l2_subdev_format *fmt) -{ - if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { - struct v4l2_mbus_framefmt *try_fmt = - v4l2_subdev_get_try_format(>sd, sd_state, - fmt->pad); - /* update the code which could change due to vflip or hflip: */ - try_fmt->code = imx219_get_format_code(imx219, try_fmt->code); - fmt->format = *try_fmt; - } else { - imx219_update_pad_format(imx219, imx219->mode, fmt); - fmt->format.code = imx219_get_format_code(imx219, - imx219->fmt.code); - } - - return 0; -} - -static int imx219_get_pad_format(struct v4l2_subdev *sd, -struct v4l2_subdev_state *sd_state, -struct v4l2_sub
[git:media_stage/master] media: ipu-bridge: Move ipu-bridge.h to include/media/
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ipu-bridge: Move ipu-bridge.h to include/media/ Author: Hans de Goede Date:Wed Jul 5 23:30:03 2023 +0200 Move ipu-bridge.h to include/media/, so that it can also be used by the atomisp code. Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu-bridge.c| 4 ++-- drivers/media/pci/intel/ipu3/ipu3-cio2.c| 3 ++- {drivers/media/pci/intel => include/media}/ipu-bridge.h | 0 3 files changed, 4 insertions(+), 3 deletions(-) --- diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index c9e7563ac458..994f2c0939b0 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -5,9 +5,9 @@ #include #include #include -#include -#include "ipu-bridge.h" +#include +#include /* * Extend this array with ACPI Hardware IDs of devices known to be working diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c index a74eb4091f4f..9f25d7653c73 100644 --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c @@ -22,6 +22,8 @@ #include #include #include + +#include #include #include #include @@ -29,7 +31,6 @@ #include #include -#include "../ipu-bridge.h" #include "ipu3-cio2.h" struct ipu3_cio2_fmt { diff --git a/drivers/media/pci/intel/ipu-bridge.h b/include/media/ipu-bridge.h similarity index 100% rename from drivers/media/pci/intel/ipu-bridge.h rename to include/media/ipu-bridge.h ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: i2c: Add a camera sensor top level menu
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: Add a camera sensor top level menu Author: Sakari Ailus Date:Thu Jun 15 10:29:07 2023 +0200 Select V4L2_FWNODE and VIDEO_V4L2_SUBDEV_API for all sensor drivers. This also adds the options to drivers that don't specifically need them, these are still seldom used drivers using old APIs. The upside is that these should now all compile --- many drivers have had missing dependencies. The "menu" is replaced by selectable "menuconfig" to select the needed V4L2_FWNODE and VIDEO_V4L2_SUBDEV_API options. Also select MEDIA_CONTROLLER which VIDEO_V4L2_SUBDEV_API effectively depends on, and add the I2C dependency to the menu. Reported-by: Hans de Goede Signed-off-by: Sakari Ailus Reviewed-by: Hans de Goede Reviewed-by: Laurent Pinchart Cc: sta...@vger.kernel.org # for >= 6.1 Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/Kconfig | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) --- diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 694afb85acb9..eef5e872a824 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -25,8 +25,15 @@ config VIDEO_IR_I2C # V4L2 I2C drivers that are related with Camera support # -menu "Camera sensor devices" - visible if MEDIA_CAMERA_SUPPORT +menuconfig VIDEO_CAMERA_SENSOR + bool "Camera sensor devices" + depends on MEDIA_CAMERA_SUPPORT && I2C + select MEDIA_CONTROLLER + select V4L2_FWNODE + select VIDEO_V4L2_SUBDEV_API + default y + +if VIDEO_CAMERA_SENSOR config VIDEO_APTINA_PLL tristate @@ -810,7 +817,7 @@ config VIDEO_ST_VGXY61 source "drivers/media/i2c/ccs/Kconfig" source "drivers/media/i2c/et8ek8/Kconfig" -endmenu +endif menu "Lens drivers" visible if MEDIA_CAMERA_SUPPORT ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ipu-bridge: Add a ipu_bridge_parse_ssdb() helper function
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ipu-bridge: Add a ipu_bridge_parse_ssdb() helper function Author: Hans de Goede Date:Wed Jul 5 23:30:00 2023 +0200 The code to go from ACPI sensor info to a fwnode-tree with connector nodes and endpoint properties is 99% the same for the atomisp2 and the IPU3. The main difference is that atomisp2 devices do not have a SSDB table with various info. Abstract out the parsing of the sensor's ACPI fwnode into a helper function and store the parsed results, rather then the raw SSDB in struct ipu_sensor. This is a preparation patch for making the ipu-bridge code more generic so that it can be shared with the atomisp driver. Reviewed-by: Andy Shevchenko Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu-bridge.c | 96 +++- drivers/media/pci/intel/ipu-bridge.h | 8 ++- 2 files changed, 59 insertions(+), 45 deletions(-) --- diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index 7443f53868dc..a752e938979a 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -97,17 +97,18 @@ out_free_buff: return ret; } -static u32 ipu_bridge_parse_rotation(struct ipu_sensor *sensor) +static u32 ipu_bridge_parse_rotation(struct acpi_device *adev, +struct ipu_sensor_ssdb *ssdb) { - switch (sensor->ssdb.degree) { + switch (ssdb->degree) { case IPU_SENSOR_ROTATION_NORMAL: return 0; case IPU_SENSOR_ROTATION_INVERTED: return 180; default: - dev_warn(>adev->dev, + dev_warn(>dev, "Unknown rotation %d. Assume 0 degree rotation\n", -sensor->ssdb.degree); +ssdb->degree); return 0; } } @@ -147,17 +148,43 @@ static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct acpi_dev return orientation; } +static int ipu_bridge_parse_ssdb(struct acpi_device *adev, +struct ipu_sensor *sensor) +{ + struct ipu_sensor_ssdb ssdb = {}; + int ret; + + ret = ipu_bridge_read_acpi_buffer(adev, "SSDB", , sizeof(ssdb)); + if (ret) + return ret; + + if (ssdb.vcmtype > ARRAY_SIZE(ipu_vcm_types)) { + dev_warn(>dev, "Unknown VCM type %d\n", ssdb.vcmtype); + ssdb.vcmtype = 0; + } + + if (ssdb.lanes > IPU_MAX_LANES) { + dev_err(>dev, "Number of lanes in SSDB is invalid\n"); + return -EINVAL; + } + + sensor->link = ssdb.link; + sensor->lanes = ssdb.lanes; + sensor->mclkspeed = ssdb.mclkspeed; + sensor->rotation = ipu_bridge_parse_rotation(adev, ); + sensor->orientation = ipu_bridge_parse_orientation(adev); + + if (ssdb.vcmtype) + sensor->vcm_type = ipu_vcm_types[ssdb.vcmtype - 1]; + + return 0; +} + static void ipu_bridge_create_fwnode_properties( struct ipu_sensor *sensor, struct ipu_bridge *bridge, const struct ipu_sensor_config *cfg) { - u32 rotation; - enum v4l2_fwnode_orientation orientation; - - rotation = ipu_bridge_parse_rotation(sensor); - orientation = ipu_bridge_parse_orientation(sensor->adev); - sensor->prop_names = prop_names; sensor->local_ref[0] = SOFTWARE_NODE_REFERENCE(>swnodes[SWNODE_IPU_ENDPOINT]); @@ -165,14 +192,14 @@ static void ipu_bridge_create_fwnode_properties( sensor->dev_properties[0] = PROPERTY_ENTRY_U32( sensor->prop_names.clock_frequency, - sensor->ssdb.mclkspeed); + sensor->mclkspeed); sensor->dev_properties[1] = PROPERTY_ENTRY_U32( sensor->prop_names.rotation, - rotation); + sensor->rotation); sensor->dev_properties[2] = PROPERTY_ENTRY_U32( sensor->prop_names.orientation, - orientation); - if (sensor->ssdb.vcmtype) { + sensor->orientation); + if (sensor->vcm_type) { sensor->vcm_ref[0] = SOFTWARE_NODE_REFERENCE(>swnodes[SWNODE_VCM]); sensor->dev_properties[3] = @@ -184,8 +211,7 @@ static void ipu_bridge_create_fwnode_properties( V4L2_FWNODE_BUS_TYP
[git:media_stage/master] media: ipu-bridge: Add GalaxyCore GC0310 to ipu_supported_sensors[]
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ipu-bridge: Add GalaxyCore GC0310 to ipu_supported_sensors[] Author: Hans de Goede Date:Wed Jul 5 23:30:04 2023 +0200 The GalaxyCore GC0310 is used together with the atomisp on various devices, add it to ipu_supported_sensors[]. Reviewed-by: Andy Shevchenko Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu-bridge.c | 2 ++ 1 file changed, 2 insertions(+) --- diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index 994f2c0939b0..eb3d1bab6a83 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -36,6 +36,8 @@ static const struct ipu_sensor_config ipu_supported_sensors[] = { IPU_SENSOR_CONFIG("INT3537", 1, 43700), /* Omnivision ov13b10 */ IPU_SENSOR_CONFIG("OVTIDB10", 1, 56000), + /* GalaxyCore GC0310 */ + IPU_SENSOR_CONFIG("INT0310", 0), }; static const struct ipu_property_names prop_names = { ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ipu-bridge: Add a parse_sensor_fwnode callback to ipu_bridge_init()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ipu-bridge: Add a parse_sensor_fwnode callback to ipu_bridge_init() Author: Hans de Goede Date:Wed Jul 5 23:30:02 2023 +0200 Add a parse_sensor_fwnode() callback to ipu_bridge_init(), so that ipu_bridge_init() can be used with other sensor fwnode parse functions then just ipu_bridge_parse_ssdb(). This will allow the ipu3-bridge code to also be used by the atomisp driver. Signed-off-by: Hans de Goede Reviewed-by: Andy Shevchenko Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu-bridge.c | 10 ++ drivers/media/pci/intel/ipu-bridge.h | 11 +-- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) --- diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index 31cf9f98b4bc..c9e7563ac458 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -148,8 +148,7 @@ static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct acpi_dev return orientation; } -static int ipu_bridge_parse_ssdb(struct acpi_device *adev, -struct ipu_sensor *sensor) +int ipu_bridge_parse_ssdb(struct acpi_device *adev, struct ipu_sensor *sensor) { struct ipu_sensor_ssdb ssdb = {}; int ret; @@ -179,6 +178,7 @@ static int ipu_bridge_parse_ssdb(struct acpi_device *adev, return 0; } +EXPORT_SYMBOL_NS_GPL(ipu_bridge_parse_ssdb, INTEL_IPU_BRIDGE); static void ipu_bridge_create_fwnode_properties( struct ipu_sensor *sensor, @@ -343,7 +343,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg, sensor = >sensors[bridge->n_sensors]; - ret = ipu_bridge_parse_ssdb(adev, sensor); + ret = bridge->parse_sensor_fwnode(adev, sensor); if (ret) goto err_put_adev; @@ -441,7 +441,8 @@ static int ipu_bridge_sensors_are_ready(void) return ready; } -int ipu_bridge_init(struct device *dev) +int ipu_bridge_init(struct device *dev, + ipu_parse_sensor_fwnode_t parse_sensor_fwnode) { struct fwnode_handle *fwnode; struct ipu_bridge *bridge; @@ -459,6 +460,7 @@ int ipu_bridge_init(struct device *dev) sizeof(bridge->ipu_node_name)); bridge->ipu_hid_node.name = bridge->ipu_node_name; bridge->dev = dev; + bridge->parse_sensor_fwnode = parse_sensor_fwnode; ret = software_node_register(>ipu_hid_node); if (ret < 0) { diff --git a/drivers/media/pci/intel/ipu-bridge.h b/drivers/media/pci/intel/ipu-bridge.h index a8b89c4b95bc..7d84b22b2111 100644 --- a/drivers/media/pci/intel/ipu-bridge.h +++ b/drivers/media/pci/intel/ipu-bridge.h @@ -140,8 +140,12 @@ struct ipu_sensor { struct software_node_ref_args vcm_ref[1]; }; +typedef int (*ipu_parse_sensor_fwnode_t)(struct acpi_device *adev, +struct ipu_sensor *sensor); + struct ipu_bridge { struct device *dev; + ipu_parse_sensor_fwnode_t parse_sensor_fwnode; char ipu_node_name[ACPI_ID_LEN]; struct software_node ipu_hid_node; u32 data_lanes[4]; @@ -150,9 +154,12 @@ struct ipu_bridge { }; #if IS_ENABLED(CONFIG_IPU_BRIDGE) -int ipu_bridge_init(struct device *dev); +int ipu_bridge_init(struct device *dev, + ipu_parse_sensor_fwnode_t parse_sensor_fwnode); +int ipu_bridge_parse_ssdb(struct acpi_device *adev, struct ipu_sensor *sensor); #else -static inline int ipu_bridge_init(struct device *dev) { return 0; } +/* Use a define to avoid the @parse_sensor_fwnode argument getting evaluated */ +#define ipu_bridge_init(dev, parse_sensor_fwnode) (0) #endif #endif diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c index 3cadf94256c0..a74eb4091f4f 100644 --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c @@ -1725,7 +1725,7 @@ static int cio2_pci_probe(struct pci_dev *pci_dev, return -EINVAL; } - r = ipu_bridge_init(dev); + r = ipu_bridge_init(dev, ipu_bridge_parse_ssdb); if (r) return r; } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ipu-bridge: Move initialization of node_names.vcm to ipu_bridge_init_swnode_names()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ipu-bridge: Move initialization of node_names.vcm to ipu_bridge_init_swnode_names() Author: Hans de Goede Date:Wed Jul 5 23:29:55 2023 +0200 Move initialization of node_names.vcm to ipu_bridge_init_swnode_names() where it belongs. And make the initialization of nodes[SWNODE_VCM] unconditional, ipu_bridge_init_swnode_group() takes care of not registering it when there is no VCM. Reviewed-by: Andy Shevchenko Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu-bridge.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) --- diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index ad1f78be3aa7..d1bc7035eeea 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -201,6 +201,12 @@ static void ipu_bridge_init_swnode_names(struct ipu_sensor *sensor) snprintf(sensor->node_names.endpoint, sizeof(sensor->node_names.endpoint), SWNODE_GRAPH_ENDPOINT_NAME_FMT, 0); /* And endpoint 0 */ + if (sensor->ssdb.vcmtype) { + /* append ssdb.link to distinguish nodes with same model VCM */ + snprintf(sensor->node_names.vcm, sizeof(sensor->node_names.vcm), +"%s-%u", ipu_vcm_types[sensor->ssdb.vcmtype - 1], +sensor->ssdb.link); + } } static void ipu_bridge_init_swnode_group(struct ipu_sensor *sensor) @@ -237,13 +243,7 @@ static void ipu_bridge_create_connection_swnodes(struct ipu_bridge *bridge, sensor->node_names.endpoint, [SWNODE_IPU_PORT], sensor->ipu_properties); - if (sensor->ssdb.vcmtype) { - /* append ssdb.link to distinguish VCM nodes with same HID */ - snprintf(sensor->node_names.vcm, sizeof(sensor->node_names.vcm), -"%s-%u", ipu_vcm_types[sensor->ssdb.vcmtype - 1], -sensor->ssdb.link); - nodes[SWNODE_VCM] = NODE_VCM(sensor->node_names.vcm); - } + nodes[SWNODE_VCM] = NODE_VCM(sensor->node_names.vcm); ipu_bridge_init_swnode_group(sensor); } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: i2c: imx219: Simplify code handling in s_fmt
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: imx219: Simplify code handling in s_fmt Author: Jacopo Mondi Date:Mon Jul 10 17:52:03 2023 +0200 The imx219_set_pad_format() function adjusts the media bus code provided through the v4l2_subdev_format parameter to a media bus code known to be supported by the sensor. The same exact operation is performed by the imx219_get_format_code() function which called by imx219_update_pad_format(), which is in the imx219_set_pad_format() call path. Remove the duplicated operation and simplify imx219_set_pad_format(). Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/imx219.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) --- diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index 4f214f10846c..a1136fdfbed2 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -750,21 +750,13 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd, const struct imx219_mode *mode; int exposure_max, exposure_def, hblank; struct v4l2_mbus_framefmt *format; - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(imx219_mbus_formats); i++) - if (imx219_mbus_formats[i] == fmt->format.code) - break; - if (i >= ARRAY_SIZE(imx219_mbus_formats)) - i = 0; mode = v4l2_find_nearest_size(supported_modes, ARRAY_SIZE(supported_modes), width, height, fmt->format.width, fmt->format.height); - imx219_update_pad_format(imx219, mode, >format, -imx219_mbus_formats[i]); + imx219_update_pad_format(imx219, mode, >format, fmt->format.code); format = v4l2_subdev_get_pad_format(sd, sd_state, 0); if (imx219->mode == mode && format->code == fmt->format.code) ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: i2c: imx219: Simplify format assignment
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: imx219: Simplify format assignment Author: Jacopo Mondi Date:Mon Jul 10 17:52:02 2023 +0200 The set_fmt and init_cfg functions both fills a v4l2_mbus_framefmt instance, passing in the mode and the media bus code. While set_fmt uses function helpers, init_cfg open-codes the assignments. Simplify the format initialization by moving it to a common helper. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/imx219.c | 48 +- 1 file changed, 18 insertions(+), 30 deletions(-) --- diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index 73e06583d651..4f214f10846c 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -670,6 +670,20 @@ static const struct v4l2_ctrl_ops imx219_ctrl_ops = { .s_ctrl = imx219_set_ctrl, }; +static void imx219_update_pad_format(struct imx219 *imx219, +const struct imx219_mode *mode, +struct v4l2_mbus_framefmt *fmt, u32 code) +{ + /* Bayer order varies with flips */ + fmt->code = imx219_get_format_code(imx219, code); + fmt->width = mode->width; + fmt->height = mode->height; + fmt->field = V4L2_FIELD_NONE; + fmt->colorspace = V4L2_COLORSPACE_RAW; + fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE; + fmt->xfer_func = V4L2_XFER_FUNC_NONE; +} + static int imx219_init_cfg(struct v4l2_subdev *sd, struct v4l2_subdev_state *state) { @@ -679,15 +693,8 @@ static int imx219_init_cfg(struct v4l2_subdev *sd, /* Initialize try_fmt */ format = v4l2_subdev_get_pad_format(sd, state, 0); - format->width = supported_modes[0].width; - format->height = supported_modes[0].height; - format->code = imx219_get_format_code(imx219, - MEDIA_BUS_FMT_SRGGB10_1X10); - format->field = V4L2_FIELD_NONE; - format->colorspace = V4L2_COLORSPACE_RAW; - format->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(format->colorspace); - format->quantization = V4L2_QUANTIZATION_FULL_RANGE; - format->xfer_func = V4L2_XFER_FUNC_NONE; + imx219_update_pad_format(imx219, _modes[0], format, +MEDIA_BUS_FMT_SRGGB10_1X10); /* Initialize crop rectangle. */ crop = v4l2_subdev_get_pad_crop(sd, state, 0); @@ -735,23 +742,6 @@ static int imx219_enum_frame_size(struct v4l2_subdev *sd, return 0; } -static void imx219_reset_colorspace(struct v4l2_mbus_framefmt *fmt) -{ - fmt->colorspace = V4L2_COLORSPACE_RAW; - fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE; - fmt->xfer_func = V4L2_XFER_FUNC_NONE; -} - -static void imx219_update_pad_format(struct imx219 *imx219, -const struct imx219_mode *mode, -struct v4l2_subdev_format *fmt) -{ - fmt->format.width = mode->width; - fmt->format.height = mode->height; - fmt->format.field = V4L2_FIELD_NONE; - imx219_reset_colorspace(>format); -} - static int imx219_set_pad_format(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_format *fmt) @@ -768,15 +758,13 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd, if (i >= ARRAY_SIZE(imx219_mbus_formats)) i = 0; - /* Bayer order varies with flips */ - fmt->format.code = imx219_get_format_code(imx219, imx219_mbus_formats[i]); - mode = v4l2_find_nearest_size(supported_modes, ARRAY_SIZE(supported_modes), width, height, fmt->format.width, fmt->format.height); - imx219_update_pad_format(imx219, mode, fmt); + imx219_update_pad_format(imx219, mode, >format, +imx219_mbus_formats[i]); format = v4l2_subdev_get_pad_format(sd, sd_state, 0); if (imx219->mode == mode && format->code == fmt->format.code) ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ipu-bridge: Drop early setting of sensor->adev
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ipu-bridge: Drop early setting of sensor->adev Author: Hans de Goede Date:Wed Jul 5 23:30:01 2023 +0200 sensor->adev is no longer dereferenced before it is permanently set by: sensor->adev = acpi_dev_get(adev); So the early assignment with a borrowed reference can be dropped. Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu-bridge.c | 5 - 1 file changed, 5 deletions(-) --- diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index a752e938979a..31cf9f98b4bc 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -342,11 +342,6 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg, } sensor = >sensors[bridge->n_sensors]; - /* -* Borrow our adev ref to the sensor for now, on success -* acpi_dev_get(adev) is done further below. -*/ - sensor->adev = adev; ret = ipu_bridge_parse_ssdb(adev, sensor); if (ret) ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ipu-bridge: Only keep PLD around while parsing
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ipu-bridge: Only keep PLD around while parsing Author: Hans de Goede Date:Wed Jul 5 23:29:59 2023 +0200 There is no need to keep a reference to the PLD struct around, it is only used once the get the sensor orientation. Make ipu_bridge_parse_orientation() also get + put the PLD. This is a preparation patch for making the ipu-bridge code more generic so that it can be shared with the atomisp driver. Reviewed-by: Andy Shevchenko Reviewed-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu-bridge.c | 48 drivers/media/pci/intel/ipu-bridge.h | 1 - 2 files changed, 27 insertions(+), 22 deletions(-) --- diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index df3b5b52e661..7443f53868dc 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -112,23 +112,39 @@ static u32 ipu_bridge_parse_rotation(struct ipu_sensor *sensor) } } -static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct ipu_sensor *sensor) +static enum v4l2_fwnode_orientation ipu_bridge_parse_orientation(struct acpi_device *adev) { - switch (sensor->pld->panel) { + enum v4l2_fwnode_orientation orientation; + struct acpi_pld_info *pld; + acpi_status status; + + status = acpi_get_physical_device_location(adev->handle, ); + if (ACPI_FAILURE(status)) { + dev_warn(>dev, "_PLD call failed, using default orientation\n"); + return V4L2_FWNODE_ORIENTATION_EXTERNAL; + } + + switch (pld->panel) { case ACPI_PLD_PANEL_FRONT: - return V4L2_FWNODE_ORIENTATION_FRONT; + orientation = V4L2_FWNODE_ORIENTATION_FRONT; + break; case ACPI_PLD_PANEL_BACK: - return V4L2_FWNODE_ORIENTATION_BACK; + orientation = V4L2_FWNODE_ORIENTATION_BACK; + break; case ACPI_PLD_PANEL_TOP: case ACPI_PLD_PANEL_LEFT: case ACPI_PLD_PANEL_RIGHT: case ACPI_PLD_PANEL_UNKNOWN: - return V4L2_FWNODE_ORIENTATION_EXTERNAL; + orientation = V4L2_FWNODE_ORIENTATION_EXTERNAL; + break; default: - dev_warn(>adev->dev, "Unknown _PLD panel value %d\n", -sensor->pld->panel); - return V4L2_FWNODE_ORIENTATION_EXTERNAL; + dev_warn(>dev, "Unknown _PLD panel val %d\n", pld->panel); + orientation = V4L2_FWNODE_ORIENTATION_EXTERNAL; + break; } + + ACPI_FREE(pld); + return orientation; } static void ipu_bridge_create_fwnode_properties( @@ -140,7 +156,7 @@ static void ipu_bridge_create_fwnode_properties( enum v4l2_fwnode_orientation orientation; rotation = ipu_bridge_parse_rotation(sensor); - orientation = ipu_bridge_parse_orientation(sensor); + orientation = ipu_bridge_parse_orientation(sensor->adev); sensor->prop_names = prop_names; @@ -279,7 +295,6 @@ static void ipu_bridge_unregister_sensors(struct ipu_bridge *bridge) for (i = 0; i < bridge->n_sensors; i++) { sensor = >sensors[i]; software_node_unregister_node_group(sensor->group); - ACPI_FREE(sensor->pld); acpi_dev_put(sensor->adev); i2c_unregister_device(sensor->vcm_i2c_client); } @@ -291,7 +306,6 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg, struct fwnode_handle *fwnode, *primary; struct ipu_sensor *sensor; struct acpi_device *adev; - acpi_status status; int ret; for_each_acpi_dev_match(adev, cfg->hid, NULL, -1) { @@ -326,17 +340,11 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg, sensor->ssdb.vcmtype = 0; } - status = acpi_get_physical_device_location(adev->handle, >pld); - if (ACPI_FAILURE(status)) { - ret = -ENODEV; - goto err_put_adev; - } - if (sensor->ssdb.lanes > IPU_MAX_LANES) { dev_err(>dev, "Number of lanes in SSDB is invalid\n"); ret = -EINVAL; - goto err_free_pld; + goto err_put_adev; } ipu_bridge_create_fwnode_properties(sensor, bridge, cfg); @@ -344,7 +352,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg, r
[git:media_stage/master] media: Remove ov_16bit_addr_reg_helpers.h
This is an automatic generated email to let you know that the following patch were queued: Subject: media: Remove ov_16bit_addr_reg_helpers.h Author: Hans de Goede Date:Tue Jun 27 14:51:08 2023 +0200 The helpers in this header are not used anywhere anymore, they have been superseded by the new CCI register access helpers. Reviewed-by: Laurent Pinchart Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab include/media/ov_16bit_addr_reg_helpers.h | 92 --- 1 file changed, 92 deletions(-) --- diff --git a/include/media/ov_16bit_addr_reg_helpers.h b/include/media/ov_16bit_addr_reg_helpers.h deleted file mode 100644 index 1c60a50bd795.. ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: i2c: imx219: Fix colorspace info
This is an automatic generated email to let you know that the following patch were queued: Subject: media: i2c: imx219: Fix colorspace info Author: Jacopo Mondi Date:Mon Jul 10 17:52:00 2023 +0200 The IMX219 is a RAW sensor. Fix the colorspace configuration by using V4L2_COLORSPACE_RAW and adjust the quantization and transfer function values. Drop ycbcr_enc as it doesn't apply to RAW sensors. Signed-off-by: Jacopo Mondi Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/i2c/imx219.c | 26 +- 1 file changed, 9 insertions(+), 17 deletions(-) --- diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index cd43a897391c..6963e24e1bc2 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -597,15 +597,12 @@ static void imx219_set_default_format(struct imx219 *imx219) fmt = >fmt; fmt->code = MEDIA_BUS_FMT_SRGGB10_1X10; - fmt->colorspace = V4L2_COLORSPACE_SRGB; - fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(fmt->colorspace); - fmt->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(true, - fmt->colorspace, - fmt->ycbcr_enc); - fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(fmt->colorspace); + fmt->colorspace = V4L2_COLORSPACE_RAW; + fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE; fmt->width = supported_modes[0].width; fmt->height = supported_modes[0].height; fmt->field = V4L2_FIELD_NONE; + fmt->xfer_func = V4L2_XFER_FUNC_NONE; } static int imx219_set_ctrl(struct v4l2_ctrl *ctrl) @@ -714,12 +711,10 @@ static int imx219_init_cfg(struct v4l2_subdev *sd, format->code = imx219_get_format_code(imx219, MEDIA_BUS_FMT_SRGGB10_1X10); format->field = V4L2_FIELD_NONE; - format->colorspace = V4L2_COLORSPACE_SRGB; + format->colorspace = V4L2_COLORSPACE_RAW; format->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(format->colorspace); - format->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(true, -format->colorspace, -format->ycbcr_enc); - format->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(format->colorspace); + format->quantization = V4L2_QUANTIZATION_FULL_RANGE; + format->xfer_func = V4L2_XFER_FUNC_NONE; /* Initialize crop rectangle. */ crop = v4l2_subdev_get_pad_crop(sd, state, 0); @@ -775,12 +770,9 @@ static int imx219_enum_frame_size(struct v4l2_subdev *sd, static void imx219_reset_colorspace(struct v4l2_mbus_framefmt *fmt) { - fmt->colorspace = V4L2_COLORSPACE_SRGB; - fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(fmt->colorspace); - fmt->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(true, - fmt->colorspace, - fmt->ycbcr_enc); - fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(fmt->colorspace); + fmt->colorspace = V4L2_COLORSPACE_RAW; + fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE; + fmt->xfer_func = V4L2_XFER_FUNC_NONE; } static void imx219_update_pad_format(struct imx219 *imx219, ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ipu-bridge: Add a runtime-pm device-link between VCM and sensor
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ipu-bridge: Add a runtime-pm device-link between VCM and sensor Author: Hans de Goede Date:Wed Jul 5 23:30:05 2023 +0200 In most cases when a VCM is used there is a single integrated module with the sensor + VCM + lens. This means that the sensor and VCM often share regulators and possibly also something like a powerdown pin. In the ACPI tables this is modelled as a single ACPI device with multiple I2cSerialBus resources. On atomisp devices the regulators and clks are modelled as ACPI power-resources, which are controlled by the (ACPI) power state of the sensor. So the sensor must be in D0 power state for the VCM to work. To make this work add a device-link with DL_FLAG_PM_RUNTIME flag so that the sensor will automatically be runtime-resumed whenever the VCM is runtime-resumed. This requires the probing of the VCM and thus the creation of the VCM I2C-client to be delayed till after the sensor driver has bound. Move the instantiation of the VCM I2C-client to the v4l2_async_notifier bound op, so that it is done after the sensor driver has bound; and add code to add the device-link. This fixes the problem with the shared ACPI power-resources on atomisp2 and this avoids the need for VCM related workarounds on IPU3 / IPU6. E.g. until now the dw9719 driver needed to get and control a Vsio (V sensor IO) regulator since that needs to be enabled to enable I2C pass-through on the PMIC on the sensor module. So the driver was controlling this regulator even though the actual dw9719 chip has no Vsio pin / power-plane. This also removes the need for ipu_bridge_init() to return -EPROBE_DEFER since the VCM is now instantiated later. Reviewed-by: Andy Shevchenko Reviewed-by: Daniel Scally Tested-by: Daniel Scally Signed-off-by: Hans de Goede Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/ipu-bridge.c | 161 --- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 5 + include/media/ipu-bridge.h | 5 +- 3 files changed, 110 insertions(+), 61 deletions(-) --- diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index eb3d1bab6a83..940457940057 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -4,7 +4,10 @@ #include #include #include +#include #include +#include +#include #include #include @@ -289,28 +292,110 @@ static void ipu_bridge_create_connection_swnodes(struct ipu_bridge *bridge, ipu_bridge_init_swnode_group(sensor); } -static void ipu_bridge_instantiate_vcm_i2c_client(struct ipu_sensor *sensor) -{ - struct i2c_board_info board_info = { }; +/* + * The actual instantiation must be done from a workqueue to avoid + * a deadlock on taking list_lock from v4l2-async twice. + */ +struct ipu_bridge_instantiate_vcm_work_data { + struct work_struct work; + struct device *sensor; char name[16]; + struct i2c_board_info board_info; +}; + +static void ipu_bridge_instantiate_vcm_work(struct work_struct *work) +{ + struct ipu_bridge_instantiate_vcm_work_data *data = + container_of(work, struct ipu_bridge_instantiate_vcm_work_data, +work); + struct acpi_device *adev = ACPI_COMPANION(data->sensor); + struct i2c_client *vcm_client; + bool put_fwnode = true; + int ret; + + /* +* The client may get probed before the device_link gets added below +* make sure the sensor is powered-up during probe. +*/ + ret = pm_runtime_get_sync(data->sensor); + if (ret < 0) { + dev_err(data->sensor, "Error %d runtime-resuming sensor, cannot instantiate VCM\n", + ret); + goto out_pm_put; + } + + /* +* Note the client is created only once and then kept around +* even after a rmmod, just like the software-nodes. +*/ + vcm_client = i2c_acpi_new_device_by_fwnode(acpi_fwnode_handle(adev), + 1, >board_info); + if (IS_ERR(vcm_client)) { + dev_err(data->sensor, "Error instantiating VCM client: %ld\n", + PTR_ERR(vcm_client)); + goto out_pm_put; + } + + device_link_add(_client->dev, data->sensor, DL_FLAG_PM_RUNTIME); + + dev_info(data->sensor, "Instantiated %s VCM\n", data->board_info.type); + put_fwnode = false; /* Ownership has passed to the i2c-client */ + +out_pm_put: + pm_runtime_put(data->sensor); + put_device(data->sensor); + if (put_fwnode) + fwnode_handle_put(data->board_info.fwnode); + kfree(data); +} + +int ipu_bridge_instantiate_vcm(struct device *sensor) +{ +
[git:media_stage/fixes] media: imx: imx7-media-csi: Fix applying format constraints
This is an automatic generated email to let you know that the following patch were queued: Subject: media: imx: imx7-media-csi: Fix applying format constraints Author: Fabio Estevam Date:Tue Jul 25 21:14:45 2023 +0200 v4l_bound_align_image() aligns to a multiple of 2 to the power of walign, not to walign. Depending on the pixel format, this causes the image width to be aligned to 16 or 256 pixels instead of 4 or 8 as required by the hardware. Fix it by rounding and clamping the width and height manually. Closes: https://lore.kernel.org/linux-media/CAJ+vNU0BOVLTL17ofgHwtexbpuMYwH_aGUC==exabuthhiv...@mail.gmail.com Reported-by: Tim Harvey Fixes: 6f482c4729d9 ("media: imx: imx7-media-csi: Get rid of superfluous call to imx7_csi_mbus_fmt_to_pix_fmt") Co-developed-by: Alexander Stein Signed-off-by: Alexander Stein Signed-off-by: Fabio Estevam Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/nxp/imx7-media-csi.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) --- diff --git a/drivers/media/platform/nxp/imx7-media-csi.c b/drivers/media/platform/nxp/imx7-media-csi.c index 0bd2613b9320..791bde67f439 100644 --- a/drivers/media/platform/nxp/imx7-media-csi.c +++ b/drivers/media/platform/nxp/imx7-media-csi.c @@ -9,7 +9,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -1137,8 +1139,9 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt, * TODO: Implement configurable stride support. */ walign = 8 * 8 / cc->bpp; - v4l_bound_align_image(>width, 1, 0x, walign, - >height, 1, 0x, 1, 0); + pixfmt->width = clamp(round_up(pixfmt->width, walign), walign, + round_down(65535U, walign)); + pixfmt->height = clamp(pixfmt->height, 1U, 65535U); pixfmt->bytesperline = pixfmt->width * cc->bpp / 8; pixfmt->sizeimage = pixfmt->bytesperline * pixfmt->height; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
Re: [Intel-gfx] [PATCH 0/4] Invalidate TLB cache for all GT's
On 8/1/23 16:19, Andi Shyti wrote: Hi, This series revisits a once-trendy topic: TLB invalidation support for multi-gt. It's a theme that's been passed around and reshaped by several of us. I've filtered out most of the original changes from this series, initially sent by Mauro [1]. His ideas were inspired by some changes from Chris, who in turn was inspired by a change from me[2], all of which stemmed from offline talks by Chris (it's like a game of inspiration tag!). What I've done is simply rebase and refactor the patches, focusing solely on the changes needed for multi-gt TLB invalidation in MMIO memory. The result is a leaner, more targeted proposal. Series look good to me. Feel free to add my R-B to the patches I didn't sign already. Reviewed-by: Mauro Carvalho Chehab Other patches from the original series might follow. Thanks, Andi [1] https://patchwork.freedesktop.org/series/106293/ [2] https://patchwork.freedesktop.org/series/103831/ Andi Shyti (2): i915/drm/gt: Move the gt defines in the gt directory drm/i915: Remove unnecessary include Chris Wilson (2): drm/i915/gt: Move TLB invalidation to its own file drm/i915: Invalidate the TLBs on each GT drivers/gpu/drm/i915/Makefile | 1 + .../gpu/drm/i915/gem/i915_gem_object_types.h | 4 +- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 15 +- drivers/gpu/drm/i915/gt/intel_gt.c| 140 +-- drivers/gpu/drm/i915/gt/intel_gt.h| 12 -- drivers/gpu/drm/i915/gt/intel_gt_defines.h| 11 ++ drivers/gpu/drm/i915/gt/intel_ppgtt.c | 4 +- drivers/gpu/drm/i915/gt/intel_tlb.c | 159 ++ drivers/gpu/drm/i915/gt/intel_tlb.h | 29 drivers/gpu/drm/i915/gt/selftest_tlb.c| 3 +- drivers/gpu/drm/i915/i915_drv.h | 1 - drivers/gpu/drm/i915/i915_vma.c | 15 +- 12 files changed, 231 insertions(+), 163 deletions(-) create mode 100644 drivers/gpu/drm/i915/gt/intel_gt_defines.h create mode 100644 drivers/gpu/drm/i915/gt/intel_tlb.c create mode 100644 drivers/gpu/drm/i915/gt/intel_tlb.h
Re: [PATCH 0/4] Invalidate TLB cache for all GT's
On 8/1/23 16:19, Andi Shyti wrote: Hi, This series revisits a once-trendy topic: TLB invalidation support for multi-gt. It's a theme that's been passed around and reshaped by several of us. I've filtered out most of the original changes from this series, initially sent by Mauro [1]. His ideas were inspired by some changes from Chris, who in turn was inspired by a change from me[2], all of which stemmed from offline talks by Chris (it's like a game of inspiration tag!). What I've done is simply rebase and refactor the patches, focusing solely on the changes needed for multi-gt TLB invalidation in MMIO memory. The result is a leaner, more targeted proposal. Series look good to me. Feel free to add my R-B to the patches I didn't sign already. Reviewed-by: Mauro Carvalho Chehab Other patches from the original series might follow. Thanks, Andi [1] https://patchwork.freedesktop.org/series/106293/ [2] https://patchwork.freedesktop.org/series/103831/ Andi Shyti (2): i915/drm/gt: Move the gt defines in the gt directory drm/i915: Remove unnecessary include Chris Wilson (2): drm/i915/gt: Move TLB invalidation to its own file drm/i915: Invalidate the TLBs on each GT drivers/gpu/drm/i915/Makefile | 1 + .../gpu/drm/i915/gem/i915_gem_object_types.h | 4 +- drivers/gpu/drm/i915/gem/i915_gem_pages.c | 15 +- drivers/gpu/drm/i915/gt/intel_gt.c| 140 +-- drivers/gpu/drm/i915/gt/intel_gt.h| 12 -- drivers/gpu/drm/i915/gt/intel_gt_defines.h| 11 ++ drivers/gpu/drm/i915/gt/intel_ppgtt.c | 4 +- drivers/gpu/drm/i915/gt/intel_tlb.c | 159 ++ drivers/gpu/drm/i915/gt/intel_tlb.h | 29 drivers/gpu/drm/i915/gt/selftest_tlb.c| 3 +- drivers/gpu/drm/i915/i915_drv.h | 1 - drivers/gpu/drm/i915/i915_vma.c | 15 +- 12 files changed, 231 insertions(+), 163 deletions(-) create mode 100644 drivers/gpu/drm/i915/gt/intel_gt_defines.h create mode 100644 drivers/gpu/drm/i915/gt/intel_tlb.c create mode 100644 drivers/gpu/drm/i915/gt/intel_tlb.h
[git:media_stage/master] media: go7007: Remove redundant if statement
This is an automatic generated email to let you know that the following patch were queued: Subject: media: go7007: Remove redundant if statement Author: Colin Ian King Date:Thu Jul 27 19:40:07 2023 +0200 The if statement that compares msgs[i].len != 3 is always false because it is in a code block where msg[i].len is equal to 3. The check is redundant and can be removed. As detected by cppcheck static analysis: drivers/media/usb/go7007/go7007-i2c.c:168:20: warning: Opposite inner 'if' condition leads to a dead code block. [oppositeInnerCondition] Link: https://lore.kernel.org/linux-media/20230727174007.635572-1-colin.i.k...@gmail.com Fixes: 866b8695d67e ("Staging: add the go7007 video driver") Signed-off-by: Colin Ian King Signed-off-by: Mauro Carvalho Chehab drivers/media/usb/go7007/go7007-i2c.c | 2 -- 1 file changed, 2 deletions(-) --- diff --git a/drivers/media/usb/go7007/go7007-i2c.c b/drivers/media/usb/go7007/go7007-i2c.c index 38339dd2f83f..2880370e45c8 100644 --- a/drivers/media/usb/go7007/go7007-i2c.c +++ b/drivers/media/usb/go7007/go7007-i2c.c @@ -165,8 +165,6 @@ static int go7007_i2c_master_xfer(struct i2c_adapter *adapter, } else if (msgs[i].len == 3) { if (msgs[i].flags & I2C_M_RD) return -EIO; - if (msgs[i].len != 3) - return -EIO; if (go7007_i2c_xfer(go, msgs[i].addr, 0, (msgs[i].buf[0] << 8) | msgs[i].buf[1], 0x01, [i].buf[2]) < 0) ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: ipu3-cio2: allow ipu_bridge to be a module again
This is an automatic generated email to let you know that the following patch were queued: Subject: media: ipu3-cio2: allow ipu_bridge to be a module again Author: Arnd BergmannArnd Bergmann Date:Thu Jul 27 14:22:58 2023 +0200 This code was previously part of the VIDEO_IPU3_CIO2 driver, which could be built-in or a loadable module, but after the move it turned into a builtin-only driver. This fails to link when the I2C subsystem is a module: x86_64-linux-ld: drivers/media/pci/intel/ipu-bridge.o: in function `ipu_bridge_unregister_sensors': ipu-bridge.c:(.text+0x50): undefined reference to `i2c_unregister_device' x86_64-linux-ld: drivers/media/pci/intel/ipu-bridge.o: in function `ipu_bridge_init': ipu-bridge.c:(.text+0x9c9): undefined reference to `i2c_acpi_new_device_by_fwnode' In general, drivers should not have to be built-in, so change the option to a tristate with the corresponding dependency. This in turn opens a new problem with the dependency, as the IPU bridge can be a loadable module while the ipu3 driver itself is built-in, producing a new link failure: 86_64-linux-ld: drivers/media/pci/intel/ipu3/ipu3-cio2.o: in function `cio2_pci_probe': ipu3-cio2.c:(.text+0x197e): undefined reference to `ipu_bridge_init' In order to fix this, restore the old Kconfig option that controlled the ipu bridge driver before it was split out, but make it select a hidden symbol that now corresponds to the bridge driver. When other drivers get added that share ipu-bridge, this should cover all corner cases, and allow any combination of them to be built-in or modular. Link: https://lore.kernel.org/linux-media/20230727122331.2421453-1-a...@kernel.org Fixes: 881ca25978c6 ("media: ipu3-cio2: rename cio2 bridge to ipu bridge and move out of ipu3")' Signed-off-by: Arnd Bergmann Reviewed-by: Andy Shevchenko Signed-off-by: Mauro Carvalho Chehab drivers/media/pci/intel/Kconfig | 21 + drivers/media/pci/intel/ipu-bridge.c | 3 +++ drivers/media/pci/intel/ipu3/Kconfig | 20 3 files changed, 28 insertions(+), 16 deletions(-) --- diff --git a/drivers/media/pci/intel/Kconfig b/drivers/media/pci/intel/Kconfig index 64a29b0b7033..51b18fce6a1d 100644 --- a/drivers/media/pci/intel/Kconfig +++ b/drivers/media/pci/intel/Kconfig @@ -1,21 +1,10 @@ # SPDX-License-Identifier: GPL-2.0-only config IPU_BRIDGE - bool "Intel IPU Sensors Bridge" - depends on VIDEO_IPU3_CIO2 && ACPI - depends on I2C + tristate + depends on I2C && ACPI help - This extension provides an API for the Intel IPU driver to create - connections to cameras that are hidden in the SSDB buffer in ACPI. - It can be used to enable support for cameras in detachable / hybrid - devices that ship with Windows. - - Say Y here if your device is a detachable / hybrid laptop that comes - with Windows installed by the OEM, for example: - - - Microsoft Surface models (except Surface Pro 3) - - The Lenovo Miix line (for example the 510, 520, 710 and 720) - - Dell 7285 - - If in doubt, say N here. + This is a helper module for the IPU bridge, which can be + used by ipu3 and other drivers. In order to handle module + dependencies, this is selected by each driver that needs it. source "drivers/media/pci/intel/ipu3/Kconfig" diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index 62daa8c1f6b1..bd67c3e990ea 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -493,3 +493,6 @@ err_free_bridge: return ret; } EXPORT_SYMBOL_NS_GPL(ipu_bridge_init, INTEL_IPU_BRIDGE); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Intel IPU Sensors Bridge driver"); diff --git a/drivers/media/pci/intel/ipu3/Kconfig b/drivers/media/pci/intel/ipu3/Kconfig index 9be06ee81ff0..0951545eab21 100644 --- a/drivers/media/pci/intel/ipu3/Kconfig +++ b/drivers/media/pci/intel/ipu3/Kconfig @@ -8,6 +8,7 @@ config VIDEO_IPU3_CIO2 select VIDEO_V4L2_SUBDEV_API select V4L2_FWNODE select VIDEOBUF2_DMA_SG + select IPU_BRIDGE if CIO2_BRIDGE help This is the Intel IPU3 CIO2 CSI-2 receiver unit, found in Intel @@ -17,3 +18,22 @@ config VIDEO_IPU3_CIO2 Say Y or M here if you have a Skylake/Kaby Lake SoC with MIPI CSI-2 connected camera. The module will be called ipu3-cio2. + +config CIO2_BRIDGE + bool "IPU3 CIO2 Sensors Bridge" + depends on VIDEO_IPU3_CIO2 && ACPI + depends on I2C + help + This extension provides an API for the ipu3-cio2 driver to create + connections to cameras that are hidden in the SSDB buffer in ACPI. + It can be used to enable support for cameras in detachable / hybrid + d
[git:media_stage/master] media: v4l: fwnode: Remove unneeded forward declaration
This is an automatic generated email to let you know that the following patch were queued: Subject: media: v4l: fwnode: Remove unneeded forward declaration Author: Sakari Ailus Date:Tue Jun 13 18:33:58 2023 +0200 Remove an unneeded declaration for struct fwnode_handle. Signed-off-by: Sakari Ailus Tested-by: Lad Prabhakar # Renesas RZ/G2L SMARC Signed-off-by: Mauro Carvalho Chehab include/media/v4l2-fwnode.h | 2 -- 1 file changed, 2 deletions(-) --- diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h index a9a89035e282..f7c57c776589 100644 --- a/include/media/v4l2-fwnode.h +++ b/include/media/v4l2-fwnode.h @@ -21,8 +21,6 @@ #include -struct fwnode_handle; - /** * struct v4l2_fwnode_endpoint - the endpoint data structure * @base: fwnode endpoint of the v4l2_fwnode ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: atmel-isi: Remote unneeeded forward declaration
This is an automatic generated email to let you know that the following patch were queued: Subject: media: atmel-isi: Remote unneeeded forward declaration Author: Sakari Ailus Date:Tue Jun 13 18:34:44 2023 +0200 Remove an unneeded forward declaration for struct v4l2_async_subdev. Signed-off-by: Sakari Ailus Tested-by: Lad Prabhakar # Renesas RZ/G2L SMARC Signed-off-by: Mauro Carvalho Chehab drivers/media/platform/atmel/atmel-isi.h | 2 -- 1 file changed, 2 deletions(-) --- diff --git a/drivers/media/platform/atmel/atmel-isi.h b/drivers/media/platform/atmel/atmel-isi.h index 7ad3895a2c87..ef38eddef5fc 100644 --- a/drivers/media/platform/atmel/atmel-isi.h +++ b/drivers/media/platform/atmel/atmel-isi.h @@ -121,8 +121,6 @@ #define ISI_DATAWIDTH_80x01 #define ISI_DATAWIDTH_10 0x02 -struct v4l2_async_subdev; - struct isi_platform_data { u8 has_emb_sync; u8 hsync_act_low; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:media_stage/master] media: v4l: async: Drop v4l2_async_nf_parse_fwnode_endpoints()
This is an automatic generated email to let you know that the following patch were queued: Subject: media: v4l: async: Drop v4l2_async_nf_parse_fwnode_endpoints() Author: Jacopo Mondi Date:Tue Apr 18 11:52:07 2023 +0200 The v4l2_async_nf_parse_fwnode_endpoints() function, part of v4l2-fwnode.c, was a helper meant to register one async sub-dev for each fwnode endpoint of a device. The function is marked as deprecated in the documentation and is actually not used anywhere anymore. Drop it and remove the helper function v4l2_async_nf_fwnode_parse_endpoint() from v4l2-fwnode.c. This change allows to make the helper function __v4l2_async_nf_add_connection() visibility private to v4l2-async.c so that there is no risk drivers can mistakenly use it. [Sakari Ailus: Small fixups on top.] Signed-off-by: Jacopo Mondi Signed-off-by: Sakari Ailus Tested-by: Philipp Zabel # imx6qp Tested-by: Niklas Söderlund # rcar + adv746x Reviewed-by: Laurent Pinchart Tested-by: Aishwarya Kothari # Apalis i.MX6Q with TC358743 Tested-by: Lad Prabhakar # Renesas RZ/G2L SMARC Signed-off-by: Mauro Carvalho Chehab drivers/media/v4l2-core/v4l2-async.c | 6 +-- drivers/media/v4l2-core/v4l2-fwnode.c | 97 --- include/media/v4l2-async.h| 34 ++-- include/media/v4l2-fwnode.h | 68 4 files changed, 7 insertions(+), 198 deletions(-) --- diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index b16b5f4cb91e..7831bc879290 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -662,8 +662,9 @@ void v4l2_async_nf_cleanup(struct v4l2_async_notifier *notifier) } EXPORT_SYMBOL_GPL(v4l2_async_nf_cleanup); -int __v4l2_async_nf_add_subdev(struct v4l2_async_notifier *notifier, - struct v4l2_async_subdev *asd) + +static int __v4l2_async_nf_add_subdev(struct v4l2_async_notifier *notifier, + struct v4l2_async_subdev *asd) { int ret; @@ -679,7 +680,6 @@ unlock: mutex_unlock(_lock); return ret; } -EXPORT_SYMBOL_GPL(__v4l2_async_nf_add_subdev); struct v4l2_async_subdev * __v4l2_async_nf_add_fwnode(struct v4l2_async_notifier *notifier, diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index 4fa9225aa3d9..d818f88d2b49 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -808,103 +808,6 @@ int v4l2_fwnode_device_parse(struct device *dev, } EXPORT_SYMBOL_GPL(v4l2_fwnode_device_parse); -static int -v4l2_async_nf_fwnode_parse_endpoint(struct device *dev, - struct v4l2_async_notifier *notifier, - struct fwnode_handle *endpoint, - unsigned int asd_struct_size, - parse_endpoint_func parse_endpoint) -{ - struct v4l2_fwnode_endpoint vep = { .bus_type = 0 }; - struct v4l2_async_subdev *asd; - int ret; - - asd = kzalloc(asd_struct_size, GFP_KERNEL); - if (!asd) - return -ENOMEM; - - asd->match_type = V4L2_ASYNC_MATCH_FWNODE; - asd->match.fwnode = - fwnode_graph_get_remote_port_parent(endpoint); - if (!asd->match.fwnode) { - dev_dbg(dev, "no remote endpoint found\n"); - ret = -ENOTCONN; - goto out_err; - } - - ret = v4l2_fwnode_endpoint_alloc_parse(endpoint, ); - if (ret) { - dev_warn(dev, "unable to parse V4L2 fwnode endpoint (%d)\n", -ret); - goto out_err; - } - - ret = parse_endpoint ? parse_endpoint(dev, , asd) : 0; - if (ret == -ENOTCONN) - dev_dbg(dev, "ignoring port@%u/endpoint@%u\n", vep.base.port, - vep.base.id); - else if (ret < 0) - dev_warn(dev, -"driver could not parse port@%u/endpoint@%u (%d)\n", -vep.base.port, vep.base.id, ret); - v4l2_fwnode_endpoint_free(); - if (ret < 0) - goto out_err; - - ret = __v4l2_async_nf_add_subdev(notifier, asd); - if (ret < 0) { - /* not an error if asd already exists */ - if (ret == -EEXIST) - ret = 0; - goto out_err; - } - - return 0; - -out_err: - fwnode_handle_put(asd->match.fwnode); - kfree(asd); - - return ret == -ENOTCONN ? 0 : ret; -} - -int -v4l2_async_nf_parse_fwnode_endpoints(struct device *dev, -struct v4l2_async_notifier *notifier, -size_t asd_struct_size, -parse_endpoint_func parse_endpoint)
[git:media_stage/master] media: cec-gpio: specify IRQF_NO_AUTOEN when requesting irq
This is an automatic generated email to let you know that the following patch were queued: Subject: media: cec-gpio: specify IRQF_NO_AUTOEN when requesting irq Author: Hans Verkuil Date:Fri Jul 7 13:26:38 2023 +0200 Use IRQF_NO_AUTOEN rather than manually disabling the requested interrupt. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab drivers/media/cec/platform/cec-gpio/cec-gpio.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- diff --git a/drivers/media/cec/platform/cec-gpio/cec-gpio.c b/drivers/media/cec/platform/cec-gpio/cec-gpio.c index ff34490fd869..6413c0e8abcd 100644 --- a/drivers/media/cec/platform/cec-gpio/cec-gpio.c +++ b/drivers/media/cec/platform/cec-gpio/cec-gpio.c @@ -215,13 +215,11 @@ static int cec_gpio_probe(struct platform_device *pdev) return PTR_ERR(cec->adap); ret = devm_request_irq(dev, cec->cec_irq, cec_gpio_irq_handler, - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_NO_AUTOEN, cec->adap->name, cec); if (ret) goto del_adap; - cec_gpio_disable_irq(cec->adap); - if (cec->hpd_gpio) { cec->hpd_irq = gpiod_to_irq(cec->hpd_gpio); ret = devm_request_threaded_irq(dev, cec->hpd_irq, ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits