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

+56 -40
+1 -1
Documentation/userspace-api/media/v4l/dev-subdev.rst
··· 582 Devices generating the streams may allow enabling and disabling some of the 583 routes or have a fixed routing configuration. If the routes can be disabled, not 584 declaring the routes (or declaring them without 585 - ``VIDIOC_SUBDEV_STREAM_FL_ACTIVE`` flag set) in ``VIDIOC_SUBDEV_S_ROUTING`` will 586 disable the routes. ``VIDIOC_SUBDEV_S_ROUTING`` will still return such routes 587 back to the user in the routes array, with the ``V4L2_SUBDEV_STREAM_FL_ACTIVE`` 588 flag unset.
··· 582 Devices generating the streams may allow enabling and disabling some of the 583 routes or have a fixed routing configuration. If the routes can be disabled, not 584 declaring the routes (or declaring them without 585 + ``V4L2_SUBDEV_STREAM_FL_ACTIVE`` flag set) in ``VIDIOC_SUBDEV_S_ROUTING`` will 586 disable the routes. ``VIDIOC_SUBDEV_S_ROUTING`` will still return such routes 587 back to the user in the routes array, with the ``V4L2_SUBDEV_STREAM_FL_ACTIVE`` 588 flag unset.
+3 -3
drivers/media/pci/intel/ipu6/ipu6-isys-queue.c
··· 301 out_requeue: 302 if (bl && bl->nbufs) 303 ipu6_isys_buffer_list_queue(bl, 304 - (IPU6_ISYS_BUFFER_LIST_FL_INCOMING | 305 - error) ? 306 IPU6_ISYS_BUFFER_LIST_FL_SET_STATE : 307 - 0, error ? VB2_BUF_STATE_ERROR : 308 VB2_BUF_STATE_QUEUED); 309 flush_firmware_streamon_fail(stream); 310
··· 301 out_requeue: 302 if (bl && bl->nbufs) 303 ipu6_isys_buffer_list_queue(bl, 304 + IPU6_ISYS_BUFFER_LIST_FL_INCOMING | 305 + (error ? 306 IPU6_ISYS_BUFFER_LIST_FL_SET_STATE : 307 + 0), error ? VB2_BUF_STATE_ERROR : 308 VB2_BUF_STATE_QUEUED); 309 flush_firmware_streamon_fail(stream); 310
+43 -28
drivers/media/pci/intel/ipu6/ipu6-isys.c
··· 678 container_of(asc, struct sensor_async_sd, asc); 679 int ret; 680 681 ret = ipu_bridge_instantiate_vcm(sd->dev); 682 if (ret) { 683 dev_err(&isys->adev->auxdev.dev, "instantiate vcm failed\n"); ··· 931 .resume = isys_resume, 932 }; 933 934 - static void isys_remove(struct auxiliary_device *auxdev) 935 { 936 - struct ipu6_bus_device *adev = auxdev_to_adev(auxdev); 937 - struct ipu6_isys *isys = dev_get_drvdata(&auxdev->dev); 938 - struct ipu6_device *isp = adev->isp; 939 struct isys_fw_msgs *fwmsg, *safe; 940 - unsigned int i; 941 942 list_for_each_entry_safe(fwmsg, safe, &isys->framebuflist, head) 943 - dma_free_attrs(&auxdev->dev, sizeof(struct isys_fw_msgs), 944 - fwmsg, fwmsg->dma_addr, 0); 945 946 list_for_each_entry_safe(fwmsg, safe, &isys->framebuflist_fw, head) 947 - dma_free_attrs(&auxdev->dev, sizeof(struct isys_fw_msgs), 948 - fwmsg, fwmsg->dma_addr, 0); 949 - 950 - isys_unregister_devices(isys); 951 - isys_notifier_cleanup(isys); 952 - 953 - cpu_latency_qos_remove_request(&isys->pm_qos); 954 - 955 - if (!isp->secure_mode) { 956 - ipu6_cpd_free_pkg_dir(adev); 957 - ipu6_buttress_unmap_fw_image(adev, &adev->fw_sgt); 958 - release_firmware(adev->fw); 959 - } 960 - 961 - for (i = 0; i < IPU6_ISYS_MAX_STREAMS; i++) 962 - mutex_destroy(&isys->streams[i].mutex); 963 - 964 - isys_iwake_watermark_cleanup(isys); 965 - mutex_destroy(&isys->stream_mutex); 966 - mutex_destroy(&isys->mutex); 967 } 968 969 static int alloc_fw_msg_bufs(struct ipu6_isys *isys, int amount) ··· 1125 1126 ret = isys_register_devices(isys); 1127 if (ret) 1128 - goto out_remove_pkg_dir_shared_buffer; 1129 1130 ipu6_mmu_hw_cleanup(adev->mmu); 1131 1132 return 0; 1133 1134 out_remove_pkg_dir_shared_buffer: 1135 if (!isp->secure_mode) 1136 ipu6_cpd_free_pkg_dir(adev); ··· 1152 ipu6_mmu_hw_cleanup(adev->mmu); 1153 1154 return ret; 1155 } 1156 1157 struct fwmsg {
··· 678 container_of(asc, struct sensor_async_sd, asc); 679 int ret; 680 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 + 687 ret = ipu_bridge_instantiate_vcm(sd->dev); 688 if (ret) { 689 dev_err(&isys->adev->auxdev.dev, "instantiate vcm failed\n"); ··· 925 .resume = isys_resume, 926 }; 927 928 + static void free_fw_msg_bufs(struct ipu6_isys *isys) 929 { 930 + struct device *dev = &isys->adev->auxdev.dev; 931 struct isys_fw_msgs *fwmsg, *safe; 932 933 list_for_each_entry_safe(fwmsg, safe, &isys->framebuflist, head) 934 + dma_free_attrs(dev, sizeof(struct isys_fw_msgs), fwmsg, 935 + fwmsg->dma_addr, 0); 936 937 list_for_each_entry_safe(fwmsg, safe, &isys->framebuflist_fw, head) 938 + dma_free_attrs(dev, sizeof(struct isys_fw_msgs), fwmsg, 939 + fwmsg->dma_addr, 0); 940 } 941 942 static int alloc_fw_msg_bufs(struct ipu6_isys *isys, int amount) ··· 1140 1141 ret = isys_register_devices(isys); 1142 if (ret) 1143 + goto free_fw_msg_bufs; 1144 1145 ipu6_mmu_hw_cleanup(adev->mmu); 1146 1147 return 0; 1148 1149 + free_fw_msg_bufs: 1150 + free_fw_msg_bufs(isys); 1151 out_remove_pkg_dir_shared_buffer: 1152 if (!isp->secure_mode) 1153 ipu6_cpd_free_pkg_dir(adev); ··· 1165 ipu6_mmu_hw_cleanup(adev->mmu); 1166 1167 return ret; 1168 + } 1169 + 1170 + static void isys_remove(struct auxiliary_device *auxdev) 1171 + { 1172 + struct ipu6_bus_device *adev = auxdev_to_adev(auxdev); 1173 + struct ipu6_isys *isys = dev_get_drvdata(&auxdev->dev); 1174 + struct ipu6_device *isp = adev->isp; 1175 + unsigned int i; 1176 + 1177 + free_fw_msg_bufs(isys); 1178 + 1179 + isys_unregister_devices(isys); 1180 + isys_notifier_cleanup(isys); 1181 + 1182 + cpu_latency_qos_remove_request(&isys->pm_qos); 1183 + 1184 + if (!isp->secure_mode) { 1185 + ipu6_cpd_free_pkg_dir(adev); 1186 + ipu6_buttress_unmap_fw_image(adev, &adev->fw_sgt); 1187 + release_firmware(adev->fw); 1188 + } 1189 + 1190 + for (i = 0; i < IPU6_ISYS_MAX_STREAMS; i++) 1191 + mutex_destroy(&isys->streams[i].mutex); 1192 + 1193 + isys_iwake_watermark_cleanup(isys); 1194 + mutex_destroy(&isys->stream_mutex); 1195 + mutex_destroy(&isys->mutex); 1196 } 1197 1198 struct fwmsg {
+1 -4
drivers/media/pci/intel/ipu6/ipu6.c
··· 285 #define IPU6_ISYS_CSI2_NPORTS 4 286 #define IPU6SE_ISYS_CSI2_NPORTS 4 287 #define IPU6_TGL_ISYS_CSI2_NPORTS 8 288 - #define IPU6EP_MTL_ISYS_CSI2_NPORTS 4 289 290 static void ipu6_internal_pdata_init(struct ipu6_device *isp) 291 { ··· 726 727 pm_runtime_forbid(&pdev->dev); 728 pm_runtime_get_noresume(&pdev->dev); 729 - 730 - pci_release_regions(pdev); 731 - pci_disable_device(pdev); 732 733 release_firmware(isp->cpd_fw); 734
··· 285 #define IPU6_ISYS_CSI2_NPORTS 4 286 #define IPU6SE_ISYS_CSI2_NPORTS 4 287 #define IPU6_TGL_ISYS_CSI2_NPORTS 8 288 + #define IPU6EP_MTL_ISYS_CSI2_NPORTS 6 289 290 static void ipu6_internal_pdata_init(struct ipu6_device *isp) 291 { ··· 726 727 pm_runtime_forbid(&pdev->dev); 728 pm_runtime_get_noresume(&pdev->dev); 729 730 release_firmware(isp->cpd_fw); 731
+4 -1
drivers/media/pci/intel/ivsc/mei_csi.c
··· 677 return -ENODEV; 678 679 ret = ipu_bridge_init(&ipu->dev, ipu_bridge_parse_ssdb); 680 if (ret < 0) 681 return ret; 682 - if (WARN_ON(!dev_fwnode(dev))) 683 return -ENXIO; 684 685 csi = devm_kzalloc(dev, sizeof(struct mei_csi), GFP_KERNEL); 686 if (!csi)
··· 677 return -ENODEV; 678 679 ret = ipu_bridge_init(&ipu->dev, ipu_bridge_parse_ssdb); 680 + put_device(&ipu->dev); 681 if (ret < 0) 682 return ret; 683 + if (!dev_fwnode(dev)) { 684 + dev_err(dev, "mei-csi probed without device fwnode!\n"); 685 return -ENXIO; 686 + } 687 688 csi = devm_kzalloc(dev, sizeof(struct mei_csi), GFP_KERNEL); 689 if (!csi)
+4 -3
drivers/media/pci/mgb4/mgb4_core.c
··· 642 struct mgb4_dev *mgbdev = pci_get_drvdata(pdev); 643 int i; 644 645 - #ifdef CONFIG_DEBUG_FS 646 - debugfs_remove_recursive(mgbdev->debugfs); 647 - #endif 648 #if IS_REACHABLE(CONFIG_HWMON) 649 hwmon_device_unregister(mgbdev->hwmon_dev); 650 #endif ··· 655 for (i = 0; i < MGB4_VIN_DEVICES; i++) 656 if (mgbdev->vin[i]) 657 mgb4_vin_free(mgbdev->vin[i]); 658 659 device_remove_groups(&mgbdev->pdev->dev, mgb4_pci_groups); 660 free_spi(mgbdev);
··· 642 struct mgb4_dev *mgbdev = pci_get_drvdata(pdev); 643 int i; 644 645 #if IS_REACHABLE(CONFIG_HWMON) 646 hwmon_device_unregister(mgbdev->hwmon_dev); 647 #endif ··· 658 for (i = 0; i < MGB4_VIN_DEVICES; i++) 659 if (mgbdev->vin[i]) 660 mgb4_vin_free(mgbdev->vin[i]); 661 + 662 + #ifdef CONFIG_DEBUG_FS 663 + debugfs_remove_recursive(mgbdev->debugfs); 664 + #endif 665 666 device_remove_groups(&mgbdev->pdev->dev, mgb4_pci_groups); 667 free_spi(mgbdev);