Skip to content

Commit 1e7ccdd

Browse files
committed
Merge tag 'media/v6.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media fixes from Mauro Carvalho Chehab: - fixes for the new ipu6 driver (and related fixes to mei csi driver) - fix a double debugfs remove logic at mgb4 driver - a documentation fix * tag 'media/v6.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: media: intel/ipu6: add csi2 port sanity check in notifier bound media: intel/ipu6: update the maximum supported csi2 port number to 6 media: mei: csi: Warn less verbosely of a missing device fwnode media: mei: csi: Put the IPU device reference media: intel/ipu6: fix the buffer flags caused by wrong parentheses media: intel/ipu6: Fix an error handling path in isys_probe() media: intel/ipu6: Move isys_remove() close to isys_probe() media: intel/ipu6: Fix some redundant resources freeing in ipu6_pci_remove() media: Documentation: v4l: Fix ACTIVE route flag media: mgb4: Fix double debugfs remove
2 parents 36714d6 + ffb9072 commit 1e7ccdd

File tree

6 files changed

+56
-40
lines changed

6 files changed

+56
-40
lines changed

Documentation/userspace-api/media/v4l/dev-subdev.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ depending on the hardware. In all cases, however, only routes that have the
582582
Devices generating the streams may allow enabling and disabling some of the
583583
routes or have a fixed routing configuration. If the routes can be disabled, not
584584
declaring the routes (or declaring them without
585-
``VIDIOC_SUBDEV_STREAM_FL_ACTIVE`` flag set) in ``VIDIOC_SUBDEV_S_ROUTING`` will
585+
``V4L2_SUBDEV_STREAM_FL_ACTIVE`` flag set) in ``VIDIOC_SUBDEV_S_ROUTING`` will
586586
disable the routes. ``VIDIOC_SUBDEV_S_ROUTING`` will still return such routes
587587
back to the user in the routes array, with the ``V4L2_SUBDEV_STREAM_FL_ACTIVE``
588588
flag unset.

drivers/media/pci/intel/ipu6/ipu6-isys-queue.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,10 @@ static int ipu6_isys_stream_start(struct ipu6_isys_video *av,
301301
out_requeue:
302302
if (bl && bl->nbufs)
303303
ipu6_isys_buffer_list_queue(bl,
304-
(IPU6_ISYS_BUFFER_LIST_FL_INCOMING |
305-
error) ?
304+
IPU6_ISYS_BUFFER_LIST_FL_INCOMING |
305+
(error ?
306306
IPU6_ISYS_BUFFER_LIST_FL_SET_STATE :
307-
0, error ? VB2_BUF_STATE_ERROR :
307+
0), error ? VB2_BUF_STATE_ERROR :
308308
VB2_BUF_STATE_QUEUED);
309309
flush_firmware_streamon_fail(stream);
310310

drivers/media/pci/intel/ipu6/ipu6-isys.c

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,12 @@ static int isys_notifier_bound(struct v4l2_async_notifier *notifier,
678678
container_of(asc, struct sensor_async_sd, asc);
679679
int ret;
680680

681+
if (s_asd->csi2.port >= isys->pdata->ipdata->csi2.nports) {
682+
dev_err(&isys->adev->auxdev.dev, "invalid csi2 port %u\n",
683+
s_asd->csi2.port);
684+
return -EINVAL;
685+
}
686+
681687
ret = ipu_bridge_instantiate_vcm(sd->dev);
682688
if (ret) {
683689
dev_err(&isys->adev->auxdev.dev, "instantiate vcm failed\n");
@@ -925,39 +931,18 @@ static const struct dev_pm_ops isys_pm_ops = {
925931
.resume = isys_resume,
926932
};
927933

928-
static void isys_remove(struct auxiliary_device *auxdev)
934+
static void free_fw_msg_bufs(struct ipu6_isys *isys)
929935
{
930-
struct ipu6_bus_device *adev = auxdev_to_adev(auxdev);
931-
struct ipu6_isys *isys = dev_get_drvdata(&auxdev->dev);
932-
struct ipu6_device *isp = adev->isp;
936+
struct device *dev = &isys->adev->auxdev.dev;
933937
struct isys_fw_msgs *fwmsg, *safe;
934-
unsigned int i;
935938

936939
list_for_each_entry_safe(fwmsg, safe, &isys->framebuflist, head)
937-
dma_free_attrs(&auxdev->dev, sizeof(struct isys_fw_msgs),
938-
fwmsg, fwmsg->dma_addr, 0);
940+
dma_free_attrs(dev, sizeof(struct isys_fw_msgs), fwmsg,
941+
fwmsg->dma_addr, 0);
939942

940943
list_for_each_entry_safe(fwmsg, safe, &isys->framebuflist_fw, head)
941-
dma_free_attrs(&auxdev->dev, sizeof(struct isys_fw_msgs),
942-
fwmsg, fwmsg->dma_addr, 0);
943-
944-
isys_unregister_devices(isys);
945-
isys_notifier_cleanup(isys);
946-
947-
cpu_latency_qos_remove_request(&isys->pm_qos);
948-
949-
if (!isp->secure_mode) {
950-
ipu6_cpd_free_pkg_dir(adev);
951-
ipu6_buttress_unmap_fw_image(adev, &adev->fw_sgt);
952-
release_firmware(adev->fw);
953-
}
954-
955-
for (i = 0; i < IPU6_ISYS_MAX_STREAMS; i++)
956-
mutex_destroy(&isys->streams[i].mutex);
957-
958-
isys_iwake_watermark_cleanup(isys);
959-
mutex_destroy(&isys->stream_mutex);
960-
mutex_destroy(&isys->mutex);
944+
dma_free_attrs(dev, sizeof(struct isys_fw_msgs), fwmsg,
945+
fwmsg->dma_addr, 0);
961946
}
962947

963948
static int alloc_fw_msg_bufs(struct ipu6_isys *isys, int amount)
@@ -1140,12 +1125,14 @@ static int isys_probe(struct auxiliary_device *auxdev,
11401125

11411126
ret = isys_register_devices(isys);
11421127
if (ret)
1143-
goto out_remove_pkg_dir_shared_buffer;
1128+
goto free_fw_msg_bufs;
11441129

11451130
ipu6_mmu_hw_cleanup(adev->mmu);
11461131

11471132
return 0;
11481133

1134+
free_fw_msg_bufs:
1135+
free_fw_msg_bufs(isys);
11491136
out_remove_pkg_dir_shared_buffer:
11501137
if (!isp->secure_mode)
11511138
ipu6_cpd_free_pkg_dir(adev);
@@ -1167,6 +1154,34 @@ static int isys_probe(struct auxiliary_device *auxdev,
11671154
return ret;
11681155
}
11691156

1157+
static void isys_remove(struct auxiliary_device *auxdev)
1158+
{
1159+
struct ipu6_bus_device *adev = auxdev_to_adev(auxdev);
1160+
struct ipu6_isys *isys = dev_get_drvdata(&auxdev->dev);
1161+
struct ipu6_device *isp = adev->isp;
1162+
unsigned int i;
1163+
1164+
free_fw_msg_bufs(isys);
1165+
1166+
isys_unregister_devices(isys);
1167+
isys_notifier_cleanup(isys);
1168+
1169+
cpu_latency_qos_remove_request(&isys->pm_qos);
1170+
1171+
if (!isp->secure_mode) {
1172+
ipu6_cpd_free_pkg_dir(adev);
1173+
ipu6_buttress_unmap_fw_image(adev, &adev->fw_sgt);
1174+
release_firmware(adev->fw);
1175+
}
1176+
1177+
for (i = 0; i < IPU6_ISYS_MAX_STREAMS; i++)
1178+
mutex_destroy(&isys->streams[i].mutex);
1179+
1180+
isys_iwake_watermark_cleanup(isys);
1181+
mutex_destroy(&isys->stream_mutex);
1182+
mutex_destroy(&isys->mutex);
1183+
}
1184+
11701185
struct fwmsg {
11711186
int type;
11721187
char *msg;

drivers/media/pci/intel/ipu6/ipu6.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ EXPORT_SYMBOL_NS_GPL(ipu6_configure_spc, INTEL_IPU6);
285285
#define IPU6_ISYS_CSI2_NPORTS 4
286286
#define IPU6SE_ISYS_CSI2_NPORTS 4
287287
#define IPU6_TGL_ISYS_CSI2_NPORTS 8
288-
#define IPU6EP_MTL_ISYS_CSI2_NPORTS 4
288+
#define IPU6EP_MTL_ISYS_CSI2_NPORTS 6
289289

290290
static void ipu6_internal_pdata_init(struct ipu6_device *isp)
291291
{
@@ -727,9 +727,6 @@ static void ipu6_pci_remove(struct pci_dev *pdev)
727727
pm_runtime_forbid(&pdev->dev);
728728
pm_runtime_get_noresume(&pdev->dev);
729729

730-
pci_release_regions(pdev);
731-
pci_disable_device(pdev);
732-
733730
release_firmware(isp->cpd_fw);
734731

735732
ipu6_mmu_cleanup(psys_mmu);

drivers/media/pci/intel/ivsc/mei_csi.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,10 +677,13 @@ static int mei_csi_probe(struct mei_cl_device *cldev,
677677
return -ENODEV;
678678

679679
ret = ipu_bridge_init(&ipu->dev, ipu_bridge_parse_ssdb);
680+
put_device(&ipu->dev);
680681
if (ret < 0)
681682
return ret;
682-
if (WARN_ON(!dev_fwnode(dev)))
683+
if (!dev_fwnode(dev)) {
684+
dev_err(dev, "mei-csi probed without device fwnode!\n");
683685
return -ENXIO;
686+
}
684687

685688
csi = devm_kzalloc(dev, sizeof(struct mei_csi), GFP_KERNEL);
686689
if (!csi)

drivers/media/pci/mgb4/mgb4_core.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -642,9 +642,6 @@ static void mgb4_remove(struct pci_dev *pdev)
642642
struct mgb4_dev *mgbdev = pci_get_drvdata(pdev);
643643
int i;
644644

645-
#ifdef CONFIG_DEBUG_FS
646-
debugfs_remove_recursive(mgbdev->debugfs);
647-
#endif
648645
#if IS_REACHABLE(CONFIG_HWMON)
649646
hwmon_device_unregister(mgbdev->hwmon_dev);
650647
#endif
@@ -659,6 +656,10 @@ static void mgb4_remove(struct pci_dev *pdev)
659656
if (mgbdev->vin[i])
660657
mgb4_vin_free(mgbdev->vin[i]);
661658

659+
#ifdef CONFIG_DEBUG_FS
660+
debugfs_remove_recursive(mgbdev->debugfs);
661+
#endif
662+
662663
device_remove_groups(&mgbdev->pdev->dev, mgb4_pci_groups);
663664
free_spi(mgbdev);
664665
free_i2c(mgbdev);

0 commit comments

Comments
 (0)