aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-07-19media: ti-vpe: cal: Add cal_camerarx_destroy() to cleanup CAMERARXLaurent Pinchart1-6/+30
The cal_camerarx_create() function allocates resources with devm_*, and thus doesn't need any manual cleanup. Those won't hold true for long, as we will need to store resources that have no devm_* allocation variant in cal_camerarx. Furthermore, devm_kzalloc() is the wrong memory allocation API for structures that can be accessed from userspace, as device nodes can be kept open across device removal. Add a cal_camerarx_destroy() function to destroy a CAMERARX instance explicitly, and switch to kzalloc() for memory allocation. Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Unregister video device before cleanupLaurent Pinchart1-1/+1
In cal_remove(), unregister the video devices as the first operation, before cleaning up the V4L2 objects, to avoid use-after-free. This isn't a complete solution yet, as video nodes can be kept open across unregistration. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Add context V4L2 cleanup and unregister functionsLaurent Pinchart1-3/+13
Create cal_ctx_v4l2_unregister() and cal_ctx_v4l2_cleanup() functions to unregister and cleanup the V4L2-related objects from the context, and call them in cal_remove() and in the error path of cal_probe(). Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Split video device initialization and registrationLaurent Pinchart1-28/+42
There's no need to delay most of the video device initialization until the sensor subdevs are bound. Split the initialization and registration, and perform the initialization when creating the context. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Move v4l2_device from cal_ctx to cal_devLaurent Pinchart1-22/+22
The v4l2_device structure is meant to represent the whole device. In the CAL case, this corresponds to the CAL, the CAMERARX instances and the connected sensors. There should thus be a single v4l2_device instance. Replace the per-context instance with a global instance in the cal_dev structure. Don't set the v4l2_device name manually as v4l2_device_register() sets it to a value that is suitable for the driver. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Decouple control handler from v4l2_deviceLaurent Pinchart1-15/+19
To prepare for decoupling the v4l2_device from the cal_ctx, don't set the control handler in the v4l2_device and expect the video node to use it automatically, but set the video node control handler directly. This requires adding the sensor subdev controls to the control handler manually, as that operation was performed on the v4l2_device by v4l2_device_register_subdev(). Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Fix usage of v4l2_fwnode_endpoint_parse()Laurent Pinchart1-5/+4
Letting the v4l2_fwnode_endpoint_parse() function determine the bus type automatically is deprecated. Set the bus type to DPHY manually as the TI CAL only supports DPHY. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Use of_graph_get_endpoint_by_regs() to parse OFLaurent Pinchart1-107/+7
Replace the manual of_get_next_port() and of_get_next_endpoint() implementations and the corresponding logic in the caller with a call to of_graph_get_endpoint_by_regs(). This greatly simplifies OF parsing. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Hardcode virtual channel to 0Laurent Pinchart1-7/+1
Using the endpoint reg value to pass the CSI-2 source virtual channel ID in DT is a hack, isn't documented in the DT bindings, and isn't used in neither upstream DT nor TI official overlays. Hardcode the virtual channel to 0 to simplify reworking the code, proper virtual channel support will be implemented later. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Rename cal_create_instance() to cal_ctx_create()Laurent Pinchart1-2/+2
The cal_create_instance() function creates a CAL context. Rename it to cal_ctx_create() to make its purpose more explicit. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Add comments to cal_probe() to delimitate sectionsLaurent Pinchart1-6/+5
The cal_probe() function is a bit long, add comments to delimitate sections in order to improve readability. The platform_set_drvdata() call is moved to a more logical place as a result. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Inline cal_get_camerarx_regmap() in callerLaurent Pinchart1-43/+32
The cal_get_camerarx_regmap() function is called in a single place. Inline it in its caller, as it results in a clear code flow. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Use syscon_regmap_lookup_by_phandle_args()Laurent Pinchart1-11/+8
Use the syscon_regmap_lookup_by_phandle_args() function to replace manual lookup of the syscon regmap offset. This simplifies the cal_camerarx_init_regmap() implementation. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Split CAMERARX syscon regmap retrieval to a functionLaurent Pinchart1-31/+42
Simplify the cal_probe() function by splitting the CAMERARX syscon regmap retrieval to a separate function. A few local variables are renamed in the process to shorten them (syscon_camerrx_*) or to make them more accurate (parent isn't the parent OF node but the CAL device's own OF node). Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Drop struct cal_dev v4l2_dev fieldLaurent Pinchart1-5/+0
The v4l2_dev field of the cal_dev structure is initialized but never used. Drop it. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Use a loop to create CAMERARX and context instancesLaurent Pinchart1-15/+6
Replace a manually unrolled loop with an explicit for loop to increase readability when creating the CAMERARX and context instances. The explicit NULL initialization of cal->phy[] and cal->ctx[] is removed, as the cal structure is zeroed when allocated. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Use ctx_info() instead of v4l2_info()Laurent Pinchart1-2/+2
Use the context-specific print macro to replace the last usage of the v4l2_* print macros. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Get struct device without going through v4l2_deviceLaurent Pinchart1-1/+1
Instead of retrieving the struct device for the platform device from the v4l2_device, get it from the platform device directly. This prepares for cleanups related to v4l2_device handling. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Use correct device name for bus_infoLaurent Pinchart1-1/+1
The v4l2_capability bus_info field, filled by the VIDIOC_QUERYCAP ioctl handler, specifies the location of the device in the system. For platform devices, V4L2 specifies that the value must be "platform:" followed by the device name. Fix the cal_querycap() function to set the right value. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Rename cal_ctx.csi2_port to cal_ctx.indexLaurent Pinchart1-25/+25
The csi2_port field of the cal_ctx structure holds the context index, and is independent from the CSI-2 port (even if it currently has the same numerical value). Rename it to index to avoid the ambiguity. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Reorganize remaining code in sectionsLaurent Pinchart1-158/+182
Increase readability by reorganizing the remaining code in sections. No functional change is included. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Kieran Bingham <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Create consistent naming for context functionsLaurent Pinchart1-11/+16
Rename all functions related to contexts with a cal_ctx_ prefix to increase readability. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Inline cal_data_get_num_csi2_phy() in its callerLaurent Pinchart1-7/+2
The cal_data_get_num_csi2_phy() function simply returns cal->data->num_csi2_phy, and is not consistently used across the driver, as most accesses to cal->data->num_csi2_phy are open-coded. We could fix those open-coded accesses to use cal_data_get_num_csi2_phy(), but that wouldn't bring much in terms of readability, so inline cal_data_get_num_csi2_phy() in its only caller instead, and drop the function. Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Group CAMERARX-related functions togetherLaurent Pinchart1-167/+166
Group the CAMERARX functions together to make the overall driver structure easier to navigate. This only moves functions around, no functional change is included. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Create consistent naming for CAMERARX functionsLaurent Pinchart1-124/+119
Rename all functions related to CAMERARX with a cal_camerarx_ prefix, and pass them a cal_camerarx pointer. This performs most of the decoupling of the CAMERARX from the context. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Store sensor-related data in cal_camerarxLaurent Pinchart1-29/+30
The sensor is connected to the CAMERARX. Store its pointer, as well as the sensor pixel rate and the endpoint, in the cal_camerarx. This prepares for decoupling the cal_camerarx and cal_ctx. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Add print macros for the cal_camerarx instancesLaurent Pinchart1-0/+7
Prepare for passing the cal_camerarx pointer instead of the cal_ctx pointer to CAMERARX-related functions by adding print macros for cal_camerarx. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Use dev_* print macrosLaurent Pinchart1-7/+11
Use the dev_* print macros instead of the v4l2_* print macros. This prepares for a common print infrastructure that will also support the cal_camerarx instances. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Store instance ID and cal pointer in cal_camerarxLaurent Pinchart1-6/+12
Store a pointer to the cal_dev and the cal_camerarx instance number in the cal_camerarx structure. This prepares for passing a cal_camerarx pointer instead of a cal_ctx pointer to multiple functions that deal with the CAMERARX. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Remove internal phy structure from cal_camerarxLaurent Pinchart1-15/+12
The cal_camerarx structure describes the PHY, there's no need for an internal structure named phy. Removed that level of indirection. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Name all cal_camerarx pointers consistentlyLaurent Pinchart1-51/+51
Name all variables that point to a cal_camerax instance 'phy' instead of 'cc'. The name 'cc' refers to Camera Core, but is not commonly used in the driver or in datasheets. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Name all cal_dev pointers consistentlyLaurent Pinchart1-182/+186
Name all variables pointing to a cal_dev instance 'cal', instead of a combination of 'caldev' and 'dev'. 'caldev' is only used in a few places and could have been renamed to 'dev', but 'dev' is confusing as it's also used for struct device instances. This generates lots of changes, but increases readability. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Rename cal_csi2_phy to cal_camerarx_dataLaurent Pinchart1-17/+16
The cal_csi2_phy contains platform data for the CAMERARX blocks. Rename it to cal_camerarx_data. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Rename cc_data to cal_camerarxLaurent Pinchart1-19/+27
The various data structures that describe the components of the camera access layer (CAL) are named without much consistency. Start cleaning this up by renaming the structure that describes the CAMERARX block, cc_data, to cal_camerarx. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Move function to avoid forward declarationLaurent Pinchart1-50/+48
Move the csi2_phy_config() function to avoid its forward declaration. No functional change is included. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Remove flags field from struct cal_devLaurent Pinchart1-6/+1
The cal_dev flags field is a copy of data->flags. Use the latter and remove the former. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Remove unused structure fieldsLaurent Pinchart1-31/+3
Remove structure fields that are never set, set and never read, or set to a fixed value. This allows removal of a global variable and a macro. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Remove static const cal_regmap_config templateLaurent Pinchart1-13/+6
The global static const cal_regmap_config template is only used in a single location, to initialize 3 fields of a local variable. Two of those fields then get overwritten. Remove the template and set the last remaining field manually. Simplify the code by hardcoding the field values instead of calculating them for a variable that always has the same value. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Constify platform dataLaurent Pinchart1-7/+7
Now that no platform data fields are modified at runtime, make the corresponding structures const. The const qualifier for integer fields is removed as it's not required anymore. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Make structure fields unsigned where applicableLaurent Pinchart1-3/+3
Several structure fields declared as int store positive values only. Make them unsigned. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Rename cal_csi2_phy base_fields to fieldsLaurent Pinchart1-8/+8
The cal_csi2_phy structure has lost its 'fields' field that used to clash with the 'base_fields' field. Rename base_fields to fields. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Store PHY regmap fields in struct cc_dataLaurent Pinchart1-45/+47
The PHY regmap fields are created dynamically at runtime. They don't belong to the platform data that should be constant. Move them to the cc_data structure. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Don't modify cal_csi2_phy base_fieldsLaurent Pinchart1-24/+30
In preparation to constify cal_csi2_phy, avoid modifying the base_fields array at runtime. As the array now only needs to stored two values instead of a full struct reg_field instance, save memory by using a custom structure for the base_fields elements. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Embed base_fields array in struct cal_csi2_phyLaurent Pinchart1-40/+30
The base_fields field of cal_csi2_phy points to a fixed-size array of struct reg_field. This level of indirection isn't needed, embed the array directly in struct cal_csi2_phy. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Make loop indices unsigned where applicableLaurent Pinchart1-11/+11
Many loop indices only take positive values. Make them unsigned. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Turn boolean variable into boolLaurent Pinchart1-2/+3
The found_port variable contains a boolean value, make it a bool. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Remove needless castsLaurent Pinchart1-3/+2
Casting from a void pointer to a struct pointer doesn't require a cast. Remove them. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Remove needless variable initializationLaurent Pinchart1-9/+9
A few local variables are needlessly initialized. Fix them. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Make cal_formats array constLaurent Pinchart1-4/+3
The static cal_formats array contains const data, make it const. This requires turning a few cal_fmt pointers into const pointers. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Reviewed-by: Benoit Parrot <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-07-19media: ti-vpe: cal: Turn reg_(read|write)_field() into inline functionsLaurent Pinchart1-12/+16
Turn the reg_(read|write)_field() macros into inline functions for additional type safety. Use the FIELD_GET() and FIELD_PREP() macros internally instead of reinventing the wheel. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>