Lines Matching +full:bus +full:- +full:width

1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2013-2015 Ideas on Board
6 * Copyright (C) 2013-2015 Xilinx, Inc.
18 #include <dt-bindings/media/xilinx-vip.h>
20 #include "xilinx-vip.h"
22 /* -----------------------------------------------------------------------------
48 * xvip_get_format_by_code - Retrieve format information for a media bus code
49 * @code: the format media bus code
52 * given V4L2 media bus format @code, or ERR_PTR if no corresponding format can
62 if (format->code == code) in xvip_get_format_by_code()
66 return ERR_PTR(-EINVAL); in xvip_get_format_by_code()
71 * xvip_get_format_by_fourcc - Retrieve format information for a 4CC
85 if (format->fourcc == fourcc) in xvip_get_format_by_fourcc()
94 * xvip_of_get_format - Parse a device tree node and return format information
97 * Read the xlnx,video-format, xlnx,video-width and xlnx,cfa-pattern properties
102 * format name and width, or ERR_PTR if no corresponding format can be found.
109 u32 width; in xvip_of_get_format() local
112 ret = of_property_read_u32(node, "xlnx,video-format", &vf_code); in xvip_of_get_format()
116 ret = of_property_read_u32(node, "xlnx,video-width", &width); in xvip_of_get_format()
121 of_property_read_string(node, "xlnx,cfa-pattern", &pattern); in xvip_of_get_format()
126 if (format->vf_code != vf_code || format->width != width) in xvip_of_get_format()
130 strcmp(pattern, format->pattern)) in xvip_of_get_format()
136 return ERR_PTR(-EINVAL); in xvip_of_get_format()
141 * xvip_set_format_size - Set the media bus frame format size
142 * @format: V4L2 frame format on media bus
143 * @fmt: media bus format
145 * Set the media bus frame format size. The width / height from the subdevice
146 * format are set to the given media bus format. The new format size is stored
147 * in @format. The width and height are clamped using default min / max values.
152 format->width = clamp_t(unsigned int, fmt->format.width, in xvip_set_format_size()
154 format->height = clamp_t(unsigned int, fmt->format.height, in xvip_set_format_size()
160 * xvip_clr_or_set - Clear or set the register with a bitmask
187 * xvip_clr_and_set - Clear and set the register with a bitmask
209 struct platform_device *pdev = to_platform_device(xvip->dev); in xvip_init_resources()
211 xvip->iomem = devm_platform_ioremap_resource(pdev, 0); in xvip_init_resources()
212 if (IS_ERR(xvip->iomem)) in xvip_init_resources()
213 return PTR_ERR(xvip->iomem); in xvip_init_resources()
215 xvip->clk = devm_clk_get(xvip->dev, NULL); in xvip_init_resources()
216 if (IS_ERR(xvip->clk)) in xvip_init_resources()
217 return PTR_ERR(xvip->clk); in xvip_init_resources()
219 clk_prepare_enable(xvip->clk); in xvip_init_resources()
226 clk_disable_unprepare(xvip->clk); in xvip_cleanup_resources()
230 /* -----------------------------------------------------------------------------
235 * xvip_enum_mbus_code - Enumerate the media format code
238 * @code: returning media bus code
240 * Enumerate the media bus code of the subdevice. Return the corresponding
245 * Return: 0 if the media bus code is found, or -EINVAL if the format index
257 if (code->which == V4L2_SUBDEV_FORMAT_ACTIVE) in xvip_enum_mbus_code()
258 return -EINVAL; in xvip_enum_mbus_code()
260 if (code->index) in xvip_enum_mbus_code()
261 return -EINVAL; in xvip_enum_mbus_code()
263 format = v4l2_subdev_state_get_format(sd_state, code->pad); in xvip_enum_mbus_code()
265 code->code = format->code; in xvip_enum_mbus_code()
272 * xvip_enum_frame_size - Enumerate the media bus frame size
275 * @fse: returning media bus frame size
277 * This function is a drop-in implementation of the subdev enum_frame_size pad
283 * Return: 0 if the media bus frame size is found, or -EINVAL
295 if (fse->which == V4L2_SUBDEV_FORMAT_ACTIVE) in xvip_enum_frame_size()
296 return -EINVAL; in xvip_enum_frame_size()
298 format = v4l2_subdev_state_get_format(sd_state, fse->pad); in xvip_enum_frame_size()
300 if (fse->index || fse->code != format->code) in xvip_enum_frame_size()
301 return -EINVAL; in xvip_enum_frame_size()
303 if (fse->pad == XVIP_PAD_SINK) { in xvip_enum_frame_size()
304 fse->min_width = XVIP_MIN_WIDTH; in xvip_enum_frame_size()
305 fse->max_width = XVIP_MAX_WIDTH; in xvip_enum_frame_size()
306 fse->min_height = XVIP_MIN_HEIGHT; in xvip_enum_frame_size()
307 fse->max_height = XVIP_MAX_HEIGHT; in xvip_enum_frame_size()
312 fse->min_width = format->width; in xvip_enum_frame_size()
313 fse->max_width = format->width; in xvip_enum_frame_size()
314 fse->min_height = format->height; in xvip_enum_frame_size()
315 fse->max_height = format->height; in xvip_enum_frame_size()