media fixes for v6.10-rc3

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE+QmuaPwR3wnBdVwACF8+vY7k4RUFAmZi4D8ACgkQCF8+vY7k
 4RXFYxAAnyyNn2GxGkc9tBbUMUC9O2GV8TYMDNcaUoD94dWQ4oMCH3ExdxjDAKEP
 +fR+ytKwbmb7/og0X5o0MTyJD4ttRkiAJwMNSoF+2Da8+KJhrHQOx9NL8Kpg3J/B
 ZsKtzEyVmxWx7+FwSA50hv1g0GdEtOS7F0fxgZYwt0tpZyYorW46DthqipA7N8Yl
 S50bV9rWy1n3Tt8XqVKqmZd0e77FpR8p6D899mLFxm3Q0NPkjtvmescamsmWpkzG
 r+KKeXqPOSCSPa/zRq+JMYXIeIXaK7akW9FQY+XWmP2nwWuwFb1EQXtlRVuatLK7
 P6PggXMzq1wP0+rGizooAFV79gaMb/HP00v9qGeaEdr3R502wLeRSbbQsnfL3ENe
 oaZ01ckms/dAYH8ph2trwS2ViUnfICiuV684VHVQJGZEsV74mVL5YyNmWftnRaJz
 xhtDptaTp0aICC36sqRg9CixU/ATPPuLoDpphgEQ/DAcEJphrSzXHZcZub1gAnMY
 RIECNp6YnLh7YwwRRaxgLE+n3xnppelyArKWbG498dOl/T5ccUvbKbfLWq9YDaPY
 JG3CZveYDr9FMCOQZuEROSMTFFpoyInBRUSUlROskRNp/+rPdkX3UrsQmvH+9+cb
 OspJZEkIPiFJZOfUP+PaUz24hpwSViABjeERHHVFmShZqXIG+zk=
 =4Zki
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2024-06-08 09:57:09 -07:00
commit 1e7ccdd325
6 changed files with 56 additions and 40 deletions

View File

@ -582,7 +582,7 @@ depending on the hardware. In all cases, however, only routes that have the
Devices generating the streams may allow enabling and disabling some of the
routes or have a fixed routing configuration. If the routes can be disabled, not
declaring the routes (or declaring them without
``VIDIOC_SUBDEV_STREAM_FL_ACTIVE`` flag set) in ``VIDIOC_SUBDEV_S_ROUTING`` will
``V4L2_SUBDEV_STREAM_FL_ACTIVE`` flag set) in ``VIDIOC_SUBDEV_S_ROUTING`` will
disable the routes. ``VIDIOC_SUBDEV_S_ROUTING`` will still return such routes
back to the user in the routes array, with the ``V4L2_SUBDEV_STREAM_FL_ACTIVE``
flag unset.

View File

@ -301,10 +301,10 @@ static int ipu6_isys_stream_start(struct ipu6_isys_video *av,
out_requeue:
if (bl && bl->nbufs)
ipu6_isys_buffer_list_queue(bl,
(IPU6_ISYS_BUFFER_LIST_FL_INCOMING |
error) ?
IPU6_ISYS_BUFFER_LIST_FL_INCOMING |
(error ?
IPU6_ISYS_BUFFER_LIST_FL_SET_STATE :
0, error ? VB2_BUF_STATE_ERROR :
0), error ? VB2_BUF_STATE_ERROR :
VB2_BUF_STATE_QUEUED);
flush_firmware_streamon_fail(stream);

View File

@ -678,6 +678,12 @@ static int isys_notifier_bound(struct v4l2_async_notifier *notifier,
container_of(asc, struct sensor_async_sd, asc);
int ret;
if (s_asd->csi2.port >= isys->pdata->ipdata->csi2.nports) {
dev_err(&isys->adev->auxdev.dev, "invalid csi2 port %u\n",
s_asd->csi2.port);
return -EINVAL;
}
ret = ipu_bridge_instantiate_vcm(sd->dev);
if (ret) {
dev_err(&isys->adev->auxdev.dev, "instantiate vcm failed\n");
@ -925,39 +931,18 @@ static const struct dev_pm_ops isys_pm_ops = {
.resume = isys_resume,
};
static void isys_remove(struct auxiliary_device *auxdev)
static void free_fw_msg_bufs(struct ipu6_isys *isys)
{
struct ipu6_bus_device *adev = auxdev_to_adev(auxdev);
struct ipu6_isys *isys = dev_get_drvdata(&auxdev->dev);
struct ipu6_device *isp = adev->isp;
struct device *dev = &isys->adev->auxdev.dev;
struct isys_fw_msgs *fwmsg, *safe;
unsigned int i;
list_for_each_entry_safe(fwmsg, safe, &isys->framebuflist, head)
dma_free_attrs(&auxdev->dev, sizeof(struct isys_fw_msgs),
fwmsg, fwmsg->dma_addr, 0);
dma_free_attrs(dev, sizeof(struct isys_fw_msgs), fwmsg,
fwmsg->dma_addr, 0);
list_for_each_entry_safe(fwmsg, safe, &isys->framebuflist_fw, head)
dma_free_attrs(&auxdev->dev, sizeof(struct isys_fw_msgs),
fwmsg, fwmsg->dma_addr, 0);
isys_unregister_devices(isys);
isys_notifier_cleanup(isys);
cpu_latency_qos_remove_request(&isys->pm_qos);
if (!isp->secure_mode) {
ipu6_cpd_free_pkg_dir(adev);
ipu6_buttress_unmap_fw_image(adev, &adev->fw_sgt);
release_firmware(adev->fw);
}
for (i = 0; i < IPU6_ISYS_MAX_STREAMS; i++)
mutex_destroy(&isys->streams[i].mutex);
isys_iwake_watermark_cleanup(isys);
mutex_destroy(&isys->stream_mutex);
mutex_destroy(&isys->mutex);
dma_free_attrs(dev, sizeof(struct isys_fw_msgs), fwmsg,
fwmsg->dma_addr, 0);
}
static int alloc_fw_msg_bufs(struct ipu6_isys *isys, int amount)
@ -1140,12 +1125,14 @@ static int isys_probe(struct auxiliary_device *auxdev,
ret = isys_register_devices(isys);
if (ret)
goto out_remove_pkg_dir_shared_buffer;
goto free_fw_msg_bufs;
ipu6_mmu_hw_cleanup(adev->mmu);
return 0;
free_fw_msg_bufs:
free_fw_msg_bufs(isys);
out_remove_pkg_dir_shared_buffer:
if (!isp->secure_mode)
ipu6_cpd_free_pkg_dir(adev);
@ -1167,6 +1154,34 @@ release_firmware:
return ret;
}
static void isys_remove(struct auxiliary_device *auxdev)
{
struct ipu6_bus_device *adev = auxdev_to_adev(auxdev);
struct ipu6_isys *isys = dev_get_drvdata(&auxdev->dev);
struct ipu6_device *isp = adev->isp;
unsigned int i;
free_fw_msg_bufs(isys);
isys_unregister_devices(isys);
isys_notifier_cleanup(isys);
cpu_latency_qos_remove_request(&isys->pm_qos);
if (!isp->secure_mode) {
ipu6_cpd_free_pkg_dir(adev);
ipu6_buttress_unmap_fw_image(adev, &adev->fw_sgt);
release_firmware(adev->fw);
}
for (i = 0; i < IPU6_ISYS_MAX_STREAMS; i++)
mutex_destroy(&isys->streams[i].mutex);
isys_iwake_watermark_cleanup(isys);
mutex_destroy(&isys->stream_mutex);
mutex_destroy(&isys->mutex);
}
struct fwmsg {
int type;
char *msg;

View File

@ -285,7 +285,7 @@ EXPORT_SYMBOL_NS_GPL(ipu6_configure_spc, INTEL_IPU6);
#define IPU6_ISYS_CSI2_NPORTS 4
#define IPU6SE_ISYS_CSI2_NPORTS 4
#define IPU6_TGL_ISYS_CSI2_NPORTS 8
#define IPU6EP_MTL_ISYS_CSI2_NPORTS 4
#define IPU6EP_MTL_ISYS_CSI2_NPORTS 6
static void ipu6_internal_pdata_init(struct ipu6_device *isp)
{
@ -727,9 +727,6 @@ static void ipu6_pci_remove(struct pci_dev *pdev)
pm_runtime_forbid(&pdev->dev);
pm_runtime_get_noresume(&pdev->dev);
pci_release_regions(pdev);
pci_disable_device(pdev);
release_firmware(isp->cpd_fw);
ipu6_mmu_cleanup(psys_mmu);

View File

@ -677,10 +677,13 @@ static int mei_csi_probe(struct mei_cl_device *cldev,
return -ENODEV;
ret = ipu_bridge_init(&ipu->dev, ipu_bridge_parse_ssdb);
put_device(&ipu->dev);
if (ret < 0)
return ret;
if (WARN_ON(!dev_fwnode(dev)))
if (!dev_fwnode(dev)) {
dev_err(dev, "mei-csi probed without device fwnode!\n");
return -ENXIO;
}
csi = devm_kzalloc(dev, sizeof(struct mei_csi), GFP_KERNEL);
if (!csi)

View File

@ -642,9 +642,6 @@ static void mgb4_remove(struct pci_dev *pdev)
struct mgb4_dev *mgbdev = pci_get_drvdata(pdev);
int i;
#ifdef CONFIG_DEBUG_FS
debugfs_remove_recursive(mgbdev->debugfs);
#endif
#if IS_REACHABLE(CONFIG_HWMON)
hwmon_device_unregister(mgbdev->hwmon_dev);
#endif
@ -659,6 +656,10 @@ static void mgb4_remove(struct pci_dev *pdev)
if (mgbdev->vin[i])
mgb4_vin_free(mgbdev->vin[i]);
#ifdef CONFIG_DEBUG_FS
debugfs_remove_recursive(mgbdev->debugfs);
#endif
device_remove_groups(&mgbdev->pdev->dev, mgb4_pci_groups);
free_spi(mgbdev);
free_i2c(mgbdev);