media: xilinx: tpg: Add controls for TPG

Add controls for TPG. Controls include motion, speed, noise, stuck pixel,
and etc. These controls are exposed to users to configure.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
v3
- Squash the *_OFFSET to *_SHIFT patch into this one
- Squash Use the standard V4L2_CID_TEST_PATTERN contron patch
- Remove the control for bayer phase and drop the subsequent patch for that
- Fix typos, 'Set s' to 'Set'
- Call v4l2_ctrl_handler_setup() in probe()
- Use a loop to register controls
v2
- Define control IDs in .c instead of in the header
- Correct the masking of HOR/VER_SPEED register
- Fix register fields namings
- Remove _MASK/_OFFSET for 1 bit register fields
- Squash 'Remove NULL entry at the end of control menu strings' patch
- Remove 'NULL' entry from the control menu string
- Add comments for controls
- Fix 80 char per line warnings
---
media: xilinx: tpg: Add the default format

The default format is initilized when driver is loaded, and used to initialize
formats when the subdevice node is opened.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
---
v3
- Change the order of this patch
- Change the order of members in struct xtpg_device
- Remove XTPG_DEF_WIDTH/HEIGHT
v2
- This patch is added
---
media: xilinx: tpg: Fix alignments around __xtpg_get_pad_format()

Fix minor alignments around __xtpg_get_pad_format().

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
media: xilinx: tpg: Change 'format' to 'fmt'

Use the name, 'fmt' for struct v4l2_subdev_format. It's more consistent,
and improves the readability.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
v2
- This patch is added
---
media: xilinx: tpg: Fix alignments

Fix minor alignments.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
media: xilinx: tpg: Fix the structure comment

Fix the structure comment to match the structure definition.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
v3
- Fix the v2 change log for adding an empty line
v2
- Don't remove empty lines
- Change the commit message
- Add an empty line
---
media: xilinx: tpg: Use xvip_enum_mbus_code()

Use xvip_enum_mbus_code() instead of own function, xtpg_enum_mbus_code().

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
media: xilinx: tpg: Use xvip_enum_frame_size()

Replace xtpg_enum_frame_size() with xvip_enum_frame_size().

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
media: xilinx: tpg: Use xvip_set_format_size()

Use xvip_set_format_size().

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
v2
- Use xvip_set_format_size() instead of deprecated xvip_set_format()
- Remove XTPG_MIN/MAX_WIDTH/HEIGHT
---
media: xilinx: tpg: Use xvip_start()

Use xvip_start().

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
media: xilinx: tpg: Use xvip_stop()

Use xvip_stop().

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
media: xilinx: tpg: Use xvip_set_frame_size()

Use xvip_set_frame_size().

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
---
v3
- Remove not-needed change in the patch
v2
- Use xvip_set_frame_size()
---
media: xilinx: tpg: Use xvip_print_version()

User xvip_print_version() to print out the version info of TPG.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
v2
- This patch is added
---
media: xilinx: tpg: Add power management functions

Add power management functions using xvip herlpers.

Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
---
v3
- This patch is added
---
media: xilinx: tpg: Remove of_match_ptr()

The OF device ID table is always compiled in, there's no need to use the
of_match_ptr() macro to initialize the struct device of_match_table
field conditionally.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
media: xilinx: tpg: Fix devm_ioremap_resource() return value check

devm_ioremap_resource() returns a negative integer on failure, not a
NULL pointer. Fix the error check.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
media: xilinx: tpg: Make number of pads dynamic

Instantiate two pads or one pad depending on whether the TPG has been
synthesized with or without the AXI stream slave interface. This
replaces the DT passthrough property.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
v3
- Use npads here for v4l2_ctrl_new_std_menu_items()
- Add xtpg_enum_frame_size() as xvip_enum_frame_size() is not usable for this
---
media: xilinx: tpg: Configure the bayer phase

The bayer phase is configurable at runtime and decides the format of
generated pattern. For TPG v5.0, enabling the bayer phase results in
subsampling of the external input, so the bayer phase is enabled only
in the non passthrough mode.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
---
v3
- Make the bayer pattern dynamically configurable
v2
- This patch is added
---
media: xilinx: tpg: Allocate active formats for each pad

When TPG has an input pad, the 2 try formats are stored in the file
handle. So 2 active formats are allocated in struct xtpg_device, and this will
make format handling more consistent, and help to store active formats in
struct xvip_device later as one format per pad will be needed.

Signed-off-by: Hyun Kwon <hyun.kwon@xilinx.com>
---
v3
- This patch is added
---
media: xilinx: tpg: Include the format infomation in 'port' node

Include the format information on each 'port' node in DT. This enables
to have different formats on each pad, and improves readability of
connectivity between IP cores in DTS.

Signed-off-by: Hyun Kwon <hyunk@xilinx.com>
---
v3
- Fix "andimproves" to "and improves" in the commit message
- Move the local vip_format declaration inside the if()
- Fix the comments
v2
- This patch is added
---