media: pisp_be: Use clamp() and define max sizesUse the clamp() function from minmax.h and provide a define for the maxsizes as they will be used in subsequent patches.Reviewed-by: Daniel Scally
media: pisp_be: Use clamp() and define max sizesUse the clamp() function from minmax.h and provide a define for the maxsizes as they will be used in subsequent patches.Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
show more ...
media: pisp_be: Fix pm_runtime underrun in probeDuring the probe() routine, the PiSP BE driver needs to power up theinterface in order to identify and initialize the hardware.The driver resumes
media: pisp_be: Fix pm_runtime underrun in probeDuring the probe() routine, the PiSP BE driver needs to power up theinterface in order to identify and initialize the hardware.The driver resumes the interface by calling thepispbe_runtime_resume() function directly, without goingthrough the pm_runtime helpers, but later suspends it by callingpm_runtime_put_autosuspend().This causes a PM usage count imbalance at probe time, notified by theruntime_pm framework with the below message in the system log: pispbe 1000880000.pisp_be: Runtime PM usage count underflow!Fix this by resuming the interface using the pm runtime helpers insteadof calling the resume function directly and use the pm_runtime frameworkin the probe() error path. While at it, remove manual suspend of theinterface in the remove() function. The driver cannot be unloaded if inuse, so simply disable runtime pm.To simplify the implementation, make the driver depend on PM as theRPI5 platform where the ISP is integrated in uses the PM framework bydefault.Fixes: 12187bd5d4f8 ("media: raspberrypi: Add support for PiSP BE")Cc: stable@vger.kernel.orgTested-by: Naushir Patuck <naush@raspberrypi.com>Reviewed-by: Naushir Patuck <naush@raspberrypi.com>Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
media: pisp_be: Split jobs creation and schedulingCurrently the 'pispbe_schedule()' function does two things:1) Tries to assemble a job by inspecting all the video node queues to make sure all
media: pisp_be: Split jobs creation and schedulingCurrently the 'pispbe_schedule()' function does two things:1) Tries to assemble a job by inspecting all the video node queues to make sure all the required buffers are available2) Submit the job to the hardwareThe pispbe_schedule() function is called at:- video device start_streaming() time- video device qbuf() time- irq handlerAs assembling a job requires inspecting all queues, it is a rathertime consuming operation which is better not run in IRQ context.To avoid executing the time consuming job creation in interruptcontext split the job creation and job scheduling in two distinctoperations. When a well-formed job is created, append it to thenewly introduced 'pispbe->job_queue' where it will be dequeued fromby the scheduling routine.As the per-node 'ready_queue' buffer list is only accessed in vb2 opscallbacks, protected by the node->queue_lock mutex, it is not necessaryto guard it with a dedicated spinlock so drop it. Also use thespin_lock_irq() variant in all functions not called from an IRQ contextwhere the spin_lock_irqsave() version was used.Reviewed-by: Naushir Patuck <naush@raspberrypi.com>Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
media: pisp_be: Remove config validation from schedule()The config parameters buffer is already validated inpisp_be_validate_config() at .buf_prepare() time.However some of the same validations
media: pisp_be: Remove config validation from schedule()The config parameters buffer is already validated inpisp_be_validate_config() at .buf_prepare() time.However some of the same validations are also performed atpispbe_schedule() time. In particular the function checks that:1) config.num_tiles is valid2) At least one of the BAYER or RGB input is enabledThe input config validation is already performed inpisp_be_validate_config() and while job.hw_enables is modified bypispbe_xlate_addrs(), the function only resets the input masks if- there is no input buffer available, but pispbe_prepare_job() fails before calling pispbe_xlate_addrs() in this case- bayer_enable is 0, but in this case rgb_enable is valid as guaranteed by pisp_be_validate_config()- only outputs are reset in rgb_enableFor this reasons there is no need to repeat the check atpispbe_schedule() time.The num_tiles validation can be moved to pisp_be_validate_config() aswell. As num_tiles is a u32 it can'be be < 0, so change the sanitycheck accordingly.Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>Reviewed-by: Naushir Patuck <naush@raspberrypi.com>Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
media: pisp_be: Drop reference to non-existing functionA comment in the pisp_be driver references thepispbe_schedule_internal() function which doesn't exist.Drop it.Reviewed-by: Laurent Pincha
media: pisp_be: Drop reference to non-existing functionA comment in the pisp_be driver references thepispbe_schedule_internal() function which doesn't exist.Drop it.Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>Reviewed-by: Naushir Patuck <naush@raspberrypi.com>Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
media: raspberrypi: cfe: Fix min_reqbufs_allocationThe driver checks if "vq->max_num_buffers + *nbuffers < 3", butvq->max_num_buffers is (by default) 32, so the check is never true. Nordoes the c
media: raspberrypi: cfe: Fix min_reqbufs_allocationThe driver checks if "vq->max_num_buffers + *nbuffers < 3", butvq->max_num_buffers is (by default) 32, so the check is never true. Nordoes the check make sense.The original code in the BSP kernel was "vq->num_buffers + *nbuffers <3", but got mangled along the way to upstream. The intention was to makesure that at least 3 buffers are allocated.Fix this by removing the bad lines and setting q->min_reqbufs_allocationto three.Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl>Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
media: raspberrypi: rp1-cfe: Remove (explicitly) unused headerThe fwnode.h is not supposed to be used by the drivers as ithas the definitions for the core parts for different deviceproperty provi
media: raspberrypi: rp1-cfe: Remove (explicitly) unused headerThe fwnode.h is not supposed to be used by the drivers as ithas the definitions for the core parts for different deviceproperty provider implementations. Drop it.Note, that fwnode API for drivers is provided in property.hwhich is included here.Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
media: platform: rpi1-cfe: drop vb2_ops_wait_prepare/finishSince commit 88785982a19d ("media: vb2: use lock if wait_prepare/finishare NULL") it is no longer needed to set the wait_prepare/finishv
media: platform: rpi1-cfe: drop vb2_ops_wait_prepare/finishSince commit 88785982a19d ("media: vb2: use lock if wait_prepare/finishare NULL") it is no longer needed to set the wait_prepare/finishvb2_ops callbacks as long as the lock field in vb2_queue is set.Since the vb2_ops_wait_prepare/finish callbacks already rely on that field,we can safely drop these callbacks.This simplifies the code and this is a step towards the goal of deletingthese callbacks.Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
media: v4l: Convert the users of v4l2_get_link_freq to call it on a padCall v4l2_get_link_freq() on a pad, instead of a control handler. This waywe can soon convert v4l2_get_link_freq() to be call
media: v4l: Convert the users of v4l2_get_link_freq to call it on a padCall v4l2_get_link_freq() on a pad, instead of a control handler. This waywe can soon convert v4l2_get_link_freq() to be callable only on a pad andremove the compatibility code.Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>Acked-by: Naushir Patuck <naush@raspberrypi.com> # rp1-cfeAcked-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com> # st-mipid02Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
media: raspberrypi: cfe: Fix mapping of dmabuf buffersWhen using buffers from DRM, DMA-API gives a warning about: "mapping sgsegment longer than device claims to support [len=307200] [max=65536]"
media: raspberrypi: cfe: Fix mapping of dmabuf buffersWhen using buffers from DRM, DMA-API gives a warning about: "mapping sgsegment longer than device claims to support [len=307200] [max=65536]"Add a call to vb2_dma_contig_set_max_seg_size() to tell the DMA-APIabout the supported segment size (which is UINT_MAX).Fixes: 6edb685abb2a ("media: raspberrypi: Add support for RP1-CFE")Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
media: raspberrypi: Do some cleanup in probe()If devm_clk_get() fails then we need to free "cfe" before returning.Fixes: 6edb685abb2a ("media: raspberrypi: Add support for RP1-CFE")Signed-off-by
media: raspberrypi: Do some cleanup in probe()If devm_clk_get() fails then we need to free "cfe" before returning.Fixes: 6edb685abb2a ("media: raspberrypi: Add support for RP1-CFE")Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
media: raspberrypi: Remove redundant "no IRQ" messageplatform_get_irq() already provides a error message.This fixes the following cocci error:drivers/media/platform/raspberrypi/rp1-cfe/cfe.c:232
media: raspberrypi: Remove redundant "no IRQ" messageplatform_get_irq() already provides a error message.This fixes the following cocci error:drivers/media/platform/raspberrypi/rp1-cfe/cfe.c:2326:2-9: line 2326 is redundant because platform_get_irq() already prints an errorSigned-off-by: Ricardo Ribalda <ribalda@chromium.org>Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
media: raspberrypi: rp1-cfe: Fix spelling mistake "Orphanded" -> "Orphaned"There is a spelling mistake in a WARN message. Fix it.Signed-off-by: Colin Ian King <colin.i.king@gmail.com>Reviewed-by
media: raspberrypi: rp1-cfe: Fix spelling mistake "Orphanded" -> "Orphaned"There is a spelling mistake in a WARN message. Fix it.Signed-off-by: Colin Ian King <colin.i.king@gmail.com>Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
media: platform: drop vb2_ops_wait_prepare/finishSince commit 88785982a19d ("media: vb2: use lock if wait_prepare/finishare NULL") it is no longer needed to set the wait_prepare/finishvb2_ops cal
media: platform: drop vb2_ops_wait_prepare/finishSince commit 88785982a19d ("media: vb2: use lock if wait_prepare/finishare NULL") it is no longer needed to set the wait_prepare/finishvb2_ops callbacks as long as the lock field in vb2_queue is set.Since the vb2_ops_wait_prepare/finish callbacks already rely on that field,we can safely drop these callbacks.This simplifies the code and this is a step towards the goal of deletingthese callbacks.Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> # for meson-ge2dAcked-by: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
media: raspberrypi: Add support for RP1-CFEAdd support for Raspberry Pi CFE. The CFE is a hardware block thatcontains:- MIPI D-PHY- MIPI CSI-2 receiver- Front End ISP (FE)The driver has been
media: raspberrypi: Add support for RP1-CFEAdd support for Raspberry Pi CFE. The CFE is a hardware block thatcontains:- MIPI D-PHY- MIPI CSI-2 receiver- Front End ISP (FE)The driver has been upported from the Raspberry Pi kernel commit88a681df9623 ("ARM: dts: bcm2712-rpi: Add i2c<n>_pins labels").Co-developed-by: Naushir Patuck <naush@raspberrypi.com>Signed-off-by: Naushir Patuck <naush@raspberrypi.com>Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
media: Switch back to struct platform_driver::remove()After commit 0edb555a65d1 ("platform: Make platform_driver::remove()return void") .remove() is (again) the right callback to implement forpla
media: Switch back to struct platform_driver::remove()After commit 0edb555a65d1 ("platform: Make platform_driver::remove()return void") .remove() is (again) the right callback to implement forplatform drivers.Convert all platform drivers below drivers/media to use .remove(), withthe eventual goal to drop struct platform_driver::remove_new(). As.remove() and .remove_new() have the same prototypes, conversion is doneby just changing the structure member name in the driver initializer.Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
media: pisp_be: add missing wait_prepare/finish opsWithout these ops the v4l2-compliance blocking wait test will fail.These ops are required to ensure that when VIDIOC_DQBUF has towait for buffer
media: pisp_be: add missing wait_prepare/finish opsWithout these ops the v4l2-compliance blocking wait test will fail.These ops are required to ensure that when VIDIOC_DQBUF has towait for buffers to arrive, the queue lock is correctly releasedand retaken. Otherwise the wait for a buffer would block all otherqueue ioctls.Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>Acked-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
media: raspberrypi: VIDEO_RASPBERRYPI_PISP_BE should depend on ARCH_BCM2835Currently, the Raspberry Pi PiSP Backend (BE) ISP is only present on theBroadcom BCM2712-based Raspberry Pi 5. Hence add
media: raspberrypi: VIDEO_RASPBERRYPI_PISP_BE should depend on ARCH_BCM2835Currently, the Raspberry Pi PiSP Backend (BE) ISP is only present on theBroadcom BCM2712-based Raspberry Pi 5. Hence add a dependency onARCH_BCM2835, to prevent asking the user about this driver whenconfiguring a kernel without Broadcom BCM2835 family support. Thedependency can be relaxed if/when the encoder appears on other SoCfamilies.Fixes: 12187bd5d4f8 ("media: raspberrypi: Add support for PiSP BE")Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>Acked-by: FLorian Fainelli <florian.fainelli@broadcom.com>Acked-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
media: raspberrypi: Switch to remove_newThe remove callback's return value is about to change from int to void,this is done by commit 0edb555a65d1 ("platform: Makeplatform_driver::remove() return
media: raspberrypi: Switch to remove_newThe remove callback's return value is about to change from int to void,this is done by commit 0edb555a65d1 ("platform: Makeplatform_driver::remove() return void"). Prepare for merging the patch byswitching the PiSP driver from remove to remove_new callback.Fixes: 12187bd5d4f8 ("media: raspberrypi: Add support for PiSP BE")Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>Acked-by: Naushir Patuck <naush@raspberrypi.com>Acked-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>Reviewed-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
media: raspberrypi: Add support for PiSP BEAdd support for the Raspberry Pi PiSP Back End.The driver has been upported from the Raspberry Pi kernel at revisionf74893f8a0c2 ("drivers: media: pisp
media: raspberrypi: Add support for PiSP BEAdd support for the Raspberry Pi PiSP Back End.The driver has been upported from the Raspberry Pi kernel at revisionf74893f8a0c2 ("drivers: media: pisp_be: Update seqeuence numbers of thebuffers").The ISP documentation is available at:https://datasheets.raspberrypi.com/camera/raspberry-pi-image-signal-processor-specification.pdfSigned-off-by: David Plowman <david.plowman@raspberrypi.com>Signed-off-by: Naushir Patuck <naush@raspberrypi.com>Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.org>Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>[hverkuil: drop dev_err after platform_get_irq to fix a coccinelle check]