aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-10-11media: i2c: tc358746: check fmt validityHans Verkuil1-1/+5
Check if the format was really found. Fixes smatch warning: drivers/media/i2c/tc358746.c:790 tc358746_set_fmt() error: 'fmt' dereferencing possible ERR_PTR() Signed-off-by: Hans Verkuil <[email protected]> CC: Sakari Ailus <[email protected]> Reviewed-by: Sakari Ailus <[email protected]>
2023-10-11staging: media: atomisp: drop check for reentrant .s_stream()Hans Verkuil1-6/+0
The subdev .s_stream() operation shall not be called to start streaming on an already started subdev, or stop streaming on a stopped subdev. Remove the check that guards against that condition. Also fixes a smatch warning: drivers/staging/media/atomisp/i2c/atomisp-gc0310.c:446 gc0310_s_stream() warn: missing error code 'ret' Signed-off-by: Hans Verkuil <[email protected]> CC: Hans de Goede <[email protected]> Reviewed-by: Hans de Goede <[email protected]>
2023-10-07media: imon: fix access to invalid resource for the second interfaceTakashi Iwai1-0/+6
imon driver probes two USB interfaces, and at the probe of the second interface, the driver assumes blindly that the first interface got bound with the same imon driver. It's usually true, but it's still possible that the first interface is bound with another driver via a malformed descriptor. Then it may lead to a memory corruption, as spotted by syzkaller; imon driver accesses the data from drvdata as struct imon_context object although it's a completely different one that was assigned by another driver. This patch adds a sanity check -- whether the first interface is really bound with the imon driver or not -- for avoiding the problem above at the probe time. Reported-by: [email protected] Closes: https://lore.kernel.org/all/[email protected]/ Tested-by: Ricardo B. Marliere <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Sean Young <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: rc: keymaps: add missing MODULE_DESCRIPTION to keymapsHans Verkuil133-0/+133
When building the modules 'modpost' warns about missing MODULE_DESCRIPTION. Since almost none of the rc keymap modules have this, it produces a lot of warnings. As a first step to fixing all media modules, add this line to all keymaps. The description should be a human-readable string describing the remote or the remote controller that the keymap can be used with. Note that keymaps/rc-cec.c is actually compiled into the rc-core, so that is the sole keymap source that didn't need this. Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Sean Young <[email protected]>
2023-10-07media: Documentation: Split camera sensor documentationSakari Ailus4-93/+147
Split camera sensor documentation into user and kernel portions. This should make it easier for the user space developers to find the relevant documentation. Also add a list of exemplary drivers and add imx219 driver to it, besides those that were already mentioned. Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Reviewed-by: Jacopo Mondi <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: Add MIPI CSI-2 generic long packet type definitionSakari Ailus1-0/+1
Add a definition for MIPI CSI-2 generic long packet types. The generic long packet types are numbered from 1 to 4. Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: mc: Check pad flag validitySakari Ailus1-1/+14
Check the validity of pad flags on entity init. Exactly one of the flags must be set. Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: v4l: subdev: Print debug information on frame descriptorSakari Ailus1-1/+30
Print debug level information on returned frame descriptors. Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: v4l: subdev: Clear frame descriptor before get_frame_descSakari Ailus5-8/+9
Clear frame descriptor before calling transmitter's get_frame_desc() op. Also remove the corresponding memset() calls from drivers. Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: ov2740: Return -EPROBE_DEFER if no endpoint is foundSakari Ailus1-1/+1
With ipu bridge, endpoints may only be created when ipu bridge has initialised. This may happen after the sensor driver has first probed. Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: ov2740: Use sub-device active stateSakari Ailus1-67/+42
Use sub-device active state. Rely on control handler lock to serialise access to the active state. Also clean up locking on s_stream handler. Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: ov2740: Enable runtime PM before registering the async subdevSakari Ailus1-6/+8
Enable runtime PM before registering the async subdev as the driver UAPI may become accessible immediately after the registration. Runtime PM needs to be enabled by that time. Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: ccs: Drop re-entrant s_stream supportSakari Ailus1-3/+0
The s_stream is called to enable and to disable streaming on a sub-device. The caller may only call it to change the state, enabling streaming is not allowed when it is already disabled, and similarly for disabling streaming. Remove the check from the CCS driver. Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: ccs: Partially revert "media: i2c: Use pm_runtime_resume_and_get()"Sakari Ailus1-3/+3
ccs_pm_get_init() depends on the return values > 0 of pm_runtime_get_sync(), thus it can't use pm_runtime_resume_and_get(). There's even a comment in the driver on this, a few lines above the code. Fixes: aa0adb399d09 ("media: i2c: Use pm_runtime_resume_and_get()") Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: ccs: Use sub-device active stateSakari Ailus2-186/+104
Make use of sub-device active state. In most cases the effect on need for acquiring the mutex is non-existent as access to the driver's core data structure still needs to be serialised. This still removes a lot of code as the code paths for active and try state are the same in many cases. Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: ccs: Obtain media bus formats before initialising up sub-devicesSakari Ailus1-6/+6
The available mbus codes will soon be needed earlier, at the time sub-devices are initialisaed. This is due to calling init_cfg() op via the v4l2_subdev_init_finalize(). Move ccs_get_mbus_formats() before ccs_init_subdev() calls. Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: ccs: Move media_entity_pads_init to init from registerSakari Ailus1-39/+36
The media entity will soon need to be initialised before the sub-device init finalisation that allocates memory for sub-device state. Do that now. Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: ccs: Rename ccs_create_subdev as ccs_init_subdevSakari Ailus1-9/+9
The ccs_create_subdev() function initialises a sub-device in the CCS driver, including CCS specific needs. Rename it as ccs_init_subdev() as it better reflects what the function does. Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: ccs: Switch to init_cfgSakari Ailus1-11/+6
Use init_cfg() instead of manually setting up defaults in file handle open. Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: ccs: Correct error handling in ccs_register_subdevSakari Ailus1-3/+10
ccs_register_subdev() did not clean up the media entity in error case, do that now. Also switch to goto based error handling. Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: ccs: Correctly initialise try compose rectangleSakari Ailus1-1/+1
Initialise the try sink compose rectangle size to the sink compose rectangle for binner and scaler sub-devices. This was missed due to the faulty condition that lead to the compose rectangles to be initialised for the pixel array sub-device where it is not relevant. Fixes: ccfc97bdb5ae ("[media] smiapp: Add driver") Cc: [email protected] Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: ccs: Fix driver quirk struct documentationSakari Ailus1-3/+1
Fix documentation for struct ccs_quirk, a device specific struct for managing deviations from the standard. The flags field was drifted away from where it should have been. Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: Documentation: Align numbered list, make it a proper ReSTSakari Ailus1-25/+24
Align lines for numbered list so that Sphinx produces an uniform output for all list entries. Also indent paragraphs of such list entries for consistency. Also use ReST numbered list syntax for the entries. Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Move variables to inner scopeLaurent Pinchart1-1/+4
The exposure_max, exposure_def and hblank variables are only used in an inner scope in the imx219_set_pad_format() function. Move them to that scope to keep them closer to their usage and improve readability. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Name all subdev state variables 'state'Laurent Pinchart1-7/+7
Subdev state variables are named with a mix of 'state' and 'sd_state' through the driver. To improve consistency, name them all 'state'. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Calculate crop rectangle dynamicallyLaurent Pinchart1-30/+15
Calculate the crop rectangle size and location dynamically when setting the format, instead of storing it in the imx219_mode structure. This removes duplicated information from the mode, to guarantee consistency. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Jacopo Mondi <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Separate horizontal and vertical binningLaurent Pinchart1-12/+27
The IMX219 has distinct binning registers for the horizontal and vertical directions. Calculate their value and write them separately. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Jacopo Mondi <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Implement .init_cfg() using .set_fmt()Laurent Pinchart1-22/+18
Instead of duplicating the logical implemented in the .set_fmt() operation in .init_cfg(), call .set_fmt() directly. This centralizes the format and crop rectangle calculations in a single place. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Remove unneeded gotoLaurent Pinchart1-10/+2
Simplify the imx219_set_stream() by removing an unneeded goto statement, and its corresponding error label. The natural flow of the function is correct. While at it, drop a useless comment. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Group functions by purposeLaurent Pinchart1-283/+298
Move functions around to group them by purpose, in order to improve readability. No functional change is intended. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Drop IMX219_VTS_* macrosLaurent Pinchart1-8/+4
The IMX219_VTS_* macros define default VTS values for the modes supported by the driver. They are used in a single place, and hinder readability compared to using the value directly as a decimal number. Drop them. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Reviewed-by: Jacopo Mondi <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Don't store the current mode in the imx219 structureLaurent Pinchart1-13/+7
The mode field of the imx219 structure is only used in imx219_init_controls(), after the probe function sets it to point to the default mode. Use the default mode directly when initializing controls, and drop the mode field from the imx219 structure. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Jacopo Mondi <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Access height from active format in imx219_set_ctrlLaurent Pinchart1-2/+7
Use the active format height instead of the mode height in imx219_set_ctrl(). This prepares for dropping the mode field from the imx219 structure. The state is retrieved using v4l2_subdev_get_locked_active_state() as the subdev active state and the control handler share the same lock. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Jacopo Mondi <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Infer binning settings from format and cropLaurent Pinchart1-8/+1
Compare the format and crop rectangle dimensions to infer binning settings, instead of storing the binning mode in the imx219_mode structure. This removes duplicate information from the mode. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Jacopo Mondi <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Use active crop rectangle to configure registersLaurent Pinchart1-11/+11
Configure the crop-related registers from the values stored in the active crop rectangle instead of the mode structure. This removes usage of the mode from the imx219_set_framefmt(). No functional change is intended. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Jacopo Mondi <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Initialize ycbcr_encLaurent Pinchart1-0/+1
While the ycbcr_enc field doesn't apply to raw formats, leaving it uninitialized makes the driver behave in a less deterministic way. Fix it by picking the default value for the colorspace. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Merge format and binning setting functionsLaurent Pinchart1-33/+10
The imx219_set_binning() function sets registers based on the bpp value, which is computed in imx219_set_framefmt(). As both functions are called from the same place consecutively, and set registers based on the selected mode, merge them together to simplify the code. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Set mode registers programmaticallyLaurent Pinchart1-98/+36
Replace the per-mode register arrays with code that sets the same register values using the mode definitions. This avoids duplicating information in two different places. The error check for invalid formats in imx219_set_framefmt() is dropped as the format is guaranteed to be valid. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Fix test pattern window for 640x480 modeLaurent Pinchart1-2/+2
The 640x480 mode specifies incorrect values for the TP_WINDOW_WIDTH and TP_WINDOW_HEIGHT registers, which likely got copied from the 1640x1232 mode. They should be identical to the X_OUTPUT_SIZE and Y_OUTPUT_SIZE registers as for all the other modes, to avoid cropping the test pattern. Fix them. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Drop IMX219_REG_CSI_LANE_MODE from common regs arrayLaurent Pinchart1-1/+0
The IMX219_REG_CSI_LANE_MODE is configured twice, once with a hardcoded value in the imx219_common_regs registers array, and once with the value appropriate for the system in imx219_configure_lanes(). The latter is enough, drop the former. Fixes: ceddfd4493b3 ("media: i2c: imx219: Support four-lane operation") Suggested-by: Dave Stevenson <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Replace register addresses with macrosLaurent Pinchart1-88/+81
Define macros for all the known registers used in the register arrays, and use them to replace the numerical addresses. This improves readability. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Drop unused macrosLaurent Pinchart1-10/+0
Drop a handful of macros that are not used and don't provide any value. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: imx219: Convert to CCI register access helpersLaurent Pinchart2-294/+220
Use the new common CCI register access helpers to replace the private register access helpers in the imx219 driver. This simplifies the driver by reducing the amount of code. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Dave Stevenson <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c: Add driver for onsemi MT9M114 camera sensorLaurent Pinchart4-0/+2493
The MT9M114 is a CMOS camera sensor that combines a 1296x976 pixel array with a 10-bit dynamic range together with an internal ISP. The driver exposes two subdevs, one for the pixel array and one for the ISP (named IFP for Image Flow Processor). Major supported features are - Full configuration of analog crop and binning in the pixel array - Full configuration of scaling in the ISP - Automatic exposure and white balance - Manual exposure and analog gain - Horizontal and vertical flip Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Jacopo Mondi <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: dt-bindings: media: i2c: Add MT9M114 camera sensor bindingLaurent Pinchart2-0/+121
Add device tree binding for the onsemi MT9M114 CMOS camera sensor. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: i2c/hi556: add a new mode 1296x722 settingsBingbu Cao1-1/+63
Add a new mode - 16:9 resolution 1296x722 for hi556. Signed-off-by: Bingbu Cao <[email protected]> Signed-off-by: Qingwu Zhang <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: imx334: Orphan the driverSakari Ailus1-3/+1
The current maintainers won't be looking after this driver anymore. Mark it orphan. Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: imx335: Orphan the driverSakari Ailus1-3/+1
The current maintainers won't be looking after this driver anymore. Mark it orphan. Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: imx412: Orphan the driverSakari Ailus1-3/+1
The current maintainers won't be looking after this driver anymore. Mark it orphan. Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: ov9282: Assign maintenance to DaveSakari Ailus1-2/+1
The current maintainers won't be looking after this driver anymore. Dave offered to take over the driver, assign maintenance to him. Signed-off-by: Sakari Ailus <[email protected]> Acked-by: Dave Stevenson <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>