summaryrefslogtreecommitdiff
path: root/drivers/media/platform/cadence
AgeCommit message (Collapse)Author
2021-02-06media: v4l2-async: Improve v4l2_async_notifier_add_*_subdev() APILaurent Pinchart
The functions that add an async subdev to an async subdev notifier take as an argument the size of the container structure they need to allocate. This is error prone, as passing an invalid size will not be caught by the compiler. Wrap those functions in macros that take a container type instead of a size, and cast the returned pointer to the desired type. The compiler will catch mistakes if the incorrect type is passed to the macro, as the assignment types won't match. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Helen Koike <helen.koike@collabora.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> (core+ti-cal) Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-06media: cadence: Use v4l2_async_notifier_add_fwnode_remote_subdevEzequiel Garcia
The use of v4l2_async_notifier_add_subdev will be discouraged. Drivers are instead encouraged to use a helper such as v4l2_async_notifier_add_fwnode_remote_subdev. This fixes a misuse of the API, as v4l2_async_notifier_add_subdev should get a kmalloc'ed struct v4l2_async_subdev, removing some boilerplate code while at it. Use the appropriate helper v4l2_async_notifier_add_fwnode_remote_subdev, which handles the needed setup, instead of open-coding it. Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Reviewed-by: Helen Koike <helen.koike@collabora.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-04-14media: Kconfig files: use select for V4L2 subdevs and MCMauro Carvalho Chehab
There are lots of drivers that only work when the media controller and/or the V4L2 subdev APIs are present. Right now, someone need to first enable those APIs before using those drivers. Well, ideally, drivers, should, instead *optionally* depend on it, in order for PC camera drivers to be able to use them, but nowadays most drivers are UVC cameras, with don't require a sensor driver. So, be it. Let's instead make them select the MEDIA_CONTROLLER and the SUBDEV API, in order to make easier for people to be able of enabling them. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2019-10-10media: v4l: cadence: Fix how unsued lanes are handled in 'csi2rx_start()'Christophe JAILLET
The 2nd parameter of 'find_first_zero_bit()' is a number of bits, not of bytes. So use 'csi2rx->max_lanes' instead of 'sizeof(lanes_used)'. Fixes: 1fc3b37f34f6 ("media: v4l: cadence: Add Cadence MIPI-CSI2 RX driver") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-07-25media: Add support for Cadence CSI2TX 2.1Jan Kotas
This patch adds support for CSI2TX v2.1 version of the controller. Signed-off-by: Jan Kotas <jank@cadence.com> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-07-25media: Fix Lane mapping in Cadence CSI2TXJan Kotas
This patch fixes mapping of lanes in DPHY_CFG register of the controller. In the register, bit 0 means first data lane. In Linux we currently assume lane 0 is clock. Signed-off-by: Jan Kotas <jank@cadence.com> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-07-25media: Add lane checks for Cadence CSI2TXJan Kotas
This patch adds lane checks for CSI2TX, to prevent clock lane being used as a data lane. Signed-off-by: Jan Kotas <jank@cadence.com> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-05-21treewide: Add SPDX license identifier - Makefile/KconfigThomas Gleixner
Add SPDX license identifiers to all Make/Kconfig files which: - Have no license information of any form These files fall under the project license, GPL v2 only. The resulting SPDX license identifier is: GPL-2.0-only Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-04media: v4l: fwnode: Initialise the V4L2 fwnode endpoints to zeroSakari Ailus
Initialise the V4L2 fwnode endpoints to zero in all drivers using v4l2_fwnode_endpoint_parse(). This prepares for setting default endpoint flags as well as the bus type. Setting bus type to zero will continue to guess the bus among the guessable set (parallel, Bt.656 and CSI-2 D-PHY). Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com> Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-04media: v4l: mediabus: Recognise CSI-2 D-PHY and C-PHYSakari Ailus
The CSI-2 bus may use either D-PHY or C-PHY. Make this visible in media bus enum. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com> Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-10-04media: platform: Switch to v4l2_async_notifier_add_subdevSteve Longerbeam
Switch all media platform drivers to call v4l2_async_notifier_add_subdev() to add asd's to a notifier, in place of referencing the notifier->subdevs[] array. These drivers also must now call v4l2_async_notifier_init() before adding asd's to their notifiers. There may still be cases where a platform driver maintains a list of asd's that is a duplicate of the notifier asd_list, in which case its possible the platform driver list can be removed, and can reference the notifier asd_list instead. One example of where a duplicate list has been removed in this patch is xilinx-vipp.c. If there are such cases remaining, those drivers should be optimized to remove the duplicate platform driver asd lists. None of the changes to the platform drivers in this patch have been tested. Verify that the async subdevices needed by the platform are bound at load time, and that the driver unloads and reloads correctly with no memory leaking of asd objects. Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-06-27media: v4l: cadence: add VIDEO_V4L2 dependencyArnd Bergmann
The cadence media drivers can be built-in while the v4l2 core is a loadable module. This is a mistake and leads to link errors: drivers/media/v4l2-core/v4l2-fwnode.o: In function `v4l2_async_register_subdev_sensor_common': v4l2-fwnode.c:(.text+0x12f0): undefined reference to `v4l2_async_subdev_notifier_register' v4l2-fwnode.c:(.text+0x1304): undefined reference to `v4l2_async_register_subdev' v4l2-fwnode.c:(.text+0x1318): undefined reference to `v4l2_async_notifier_unregister' v4l2-fwnode.c:(.text+0x1338): undefined reference to `v4l2_async_notifier_cleanup' cdns-csi2rx.c:(.text+0x9f8): undefined reference to `v4l2_subdev_init' cdns-csi2rx.c:(.text+0xa78): undefined reference to `v4l2_async_register_subdev' drivers/media/platform/cadence/cdns-csi2tx.o: In function `csi2tx_remove': cdns-csi2tx.c:(.text+0x88): undefined reference to `v4l2_async_unregister_subdev' drivers/media/platform/cadence/cdns-csi2tx.o: In function `csi2tx_probe': cdns-csi2tx.c:(.text+0x884): undefined reference to `v4l2_subdev_init' cdns-csi2tx.c:(.text+0xa9c): undefined reference to `v4l2_async_register_subdev' An explicit Kconfig dependency on VIDEO_V4L2 avoids the problem. Fixes: 1fc3b37f34f6 ("media: v4l: cadence: Add Cadence MIPI-CSI2 RX driver") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-06-27media: v4l: cadence: include linux/slab.hArnd Bergmann
I ran into a randconfig build error with the new driver: drivers/media/platform/cadence/cdns-csi2tx.c: In function 'csi2tx_probe': drivers/media/platform/cadence/cdns-csi2tx.c:477:11: error: implicit declaration of function 'kzalloc'; did you mean 'd_alloc'? [-Werror=implicit-function-declaration] kzalloc() is declared in linux/slab.h, so let's include this to make it build in all configurations. Fixes: 84b477e6d4bc ("media: v4l: cadence: Add Cadence MIPI-CSI2 TX driver") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-17media: v4l: cadence: Add Cadence MIPI-CSI2 TX driverMaxime Ripard
The Cadence MIPI-CSI2 TX controller is an hardware block meant to be used as a bridge between pixel interfaces and a CSI-2 bus. It supports operating with an internal or external D-PHY, with up to 4 lanes, or without any D-PHY. The current code only supports the latter case. While the virtual channel input on the pixel interface can be directly mapped to CSI2, the datatype input is actually a selection signal (3-bits) mapping to a table of up to 8 preconfigured datatypes/formats (programmed at start-up) The block supports up to 8 input datatypes. Acked-by: Benoit Parrot <bparrot@ti.com> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-17media: cadence: csi2rx: Fix csi2rx_start error handlingSakari Ailus
The clocks enabled by csi2rx_start function are intended to be disabled in an error path but there are two issues: 1) the loop condition is always true and 2) the first clock disabled is the the one enabling of which failed. Fix these two bugs by changing the loop condition as well as only disabling the clocks that were actually enabled. Reported-by: Mauro Chehab <mchehab@kernel.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-16media: v4l: cadence: Add Cadence MIPI-CSI2 RX driverMaxime Ripard
The Cadence CSI-2 RX Controller is an hardware block meant to be used as a bridge between a CSI-2 bus and pixel grabbers. It supports operating with internal or external D-PHY, with up to 4 lanes, or without any D-PHY. The current code only supports the latter case. It also support dynamic mapping of the CSI-2 virtual channels to the associated pixel grabbers, but that isn't allowed at the moment either. Acked-by: Benoit Parrot <bparrot@ti.com> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>