#include <linux/bitmap.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/host1x.h>
#include <linux/lcm.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_graph.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <media/v4l2-dv-timings.h>
#include <media/v4l2-event.h>
#include <media/v4l2-fh.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-ioctl.h>
#include <media/videobuf2-dma-contig.h>
#include <soc/tegra/pmc.h>
#include "vi.h"
#include "video.h"
#define MAX_CID_CONTROLS …
struct tegra_vi_graph_entity { … };
static inline struct tegra_vi *
host1x_client_to_vi(struct host1x_client *client)
{ … }
static inline struct tegra_channel_buffer *
to_tegra_channel_buffer(struct vb2_v4l2_buffer *vb)
{ … }
static inline struct tegra_vi_graph_entity *
to_tegra_vi_graph_entity(struct v4l2_async_connection *asd)
{ … }
static int tegra_get_format_idx_by_code(struct tegra_vi *vi,
unsigned int code,
unsigned int offset)
{ … }
static u32 tegra_get_format_fourcc_by_idx(struct tegra_vi *vi,
unsigned int index)
{ … }
static const struct tegra_video_format *
tegra_get_format_by_fourcc(struct tegra_vi *vi, u32 fourcc)
{ … }
static int tegra_channel_queue_setup(struct vb2_queue *vq,
unsigned int *nbuffers,
unsigned int *nplanes,
unsigned int sizes[],
struct device *alloc_devs[])
{ … }
static int tegra_channel_buffer_prepare(struct vb2_buffer *vb)
{ … }
static void tegra_channel_buffer_queue(struct vb2_buffer *vb)
{ … }
struct v4l2_subdev *
tegra_channel_get_remote_csi_subdev(struct tegra_vi_channel *chan)
{ … }
struct v4l2_subdev *
tegra_channel_get_remote_source_subdev(struct tegra_vi_channel *chan)
{ … }
static int tegra_channel_enable_stream(struct tegra_vi_channel *chan)
{ … }
static int tegra_channel_disable_stream(struct tegra_vi_channel *chan)
{ … }
int tegra_channel_set_stream(struct tegra_vi_channel *chan, bool on)
{ … }
void tegra_channel_release_buffers(struct tegra_vi_channel *chan,
enum vb2_buffer_state state)
{ … }
static int tegra_channel_start_streaming(struct vb2_queue *vq, u32 count)
{ … }
static void tegra_channel_stop_streaming(struct vb2_queue *vq)
{ … }
static const struct vb2_ops tegra_channel_queue_qops = …;
static int tegra_channel_querycap(struct file *file, void *fh,
struct v4l2_capability *cap)
{ … }
static int tegra_channel_g_parm(struct file *file, void *fh,
struct v4l2_streamparm *a)
{ … }
static int tegra_channel_s_parm(struct file *file, void *fh,
struct v4l2_streamparm *a)
{ … }
static int tegra_channel_enum_framesizes(struct file *file, void *fh,
struct v4l2_frmsizeenum *sizes)
{ … }
static int tegra_channel_enum_frameintervals(struct file *file, void *fh,
struct v4l2_frmivalenum *ivals)
{ … }
static int tegra_channel_enum_format(struct file *file, void *fh,
struct v4l2_fmtdesc *f)
{ … }
static int tegra_channel_get_format(struct file *file, void *fh,
struct v4l2_format *format)
{ … }
static int __tegra_channel_try_format(struct tegra_vi_channel *chan,
struct v4l2_pix_format *pix)
{ … }
static int tegra_channel_try_format(struct file *file, void *fh,
struct v4l2_format *format)
{ … }
static void tegra_channel_update_gangports(struct tegra_vi_channel *chan)
{ … }
static int tegra_channel_set_format(struct file *file, void *fh,
struct v4l2_format *format)
{ … }
static int tegra_channel_set_subdev_active_fmt(struct tegra_vi_channel *chan)
{ … }
static int
tegra_channel_subscribe_event(struct v4l2_fh *fh,
const struct v4l2_event_subscription *sub)
{ … }
static int tegra_channel_g_selection(struct file *file, void *priv,
struct v4l2_selection *sel)
{ … }
static int tegra_channel_s_selection(struct file *file, void *fh,
struct v4l2_selection *sel)
{ … }
static int tegra_channel_g_edid(struct file *file, void *fh,
struct v4l2_edid *edid)
{ … }
static int tegra_channel_s_edid(struct file *file, void *fh,
struct v4l2_edid *edid)
{ … }
static int tegra_channel_g_dv_timings(struct file *file, void *fh,
struct v4l2_dv_timings *timings)
{ … }
static int tegra_channel_s_dv_timings(struct file *file, void *fh,
struct v4l2_dv_timings *timings)
{ … }
static int tegra_channel_query_dv_timings(struct file *file, void *fh,
struct v4l2_dv_timings *timings)
{ … }
static int tegra_channel_enum_dv_timings(struct file *file, void *fh,
struct v4l2_enum_dv_timings *timings)
{ … }
static int tegra_channel_dv_timings_cap(struct file *file, void *fh,
struct v4l2_dv_timings_cap *cap)
{ … }
static int tegra_channel_log_status(struct file *file, void *fh)
{ … }
static int tegra_channel_enum_input(struct file *file, void *fh,
struct v4l2_input *inp)
{ … }
static int tegra_channel_g_input(struct file *file, void *priv,
unsigned int *i)
{ … }
static int tegra_channel_s_input(struct file *file, void *priv,
unsigned int input)
{ … }
static const struct v4l2_ioctl_ops tegra_channel_ioctl_ops = …;
static const struct v4l2_file_operations tegra_channel_fops = …;
static int vi_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static const struct v4l2_ctrl_ops vi_ctrl_ops = …;
#if IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG)
static const char *const vi_pattern_strings[] = {
"Black/White Direct Mode",
"Color Patch Mode",
};
#else
static const struct v4l2_ctrl_config syncpt_timeout_ctrl = …;
#endif
static int tegra_channel_setup_ctrl_handler(struct tegra_vi_channel *chan)
{ … }
static void vi_tpg_fmts_bitmap_init(struct tegra_vi_channel *chan)
{ … }
static int vi_fmts_bitmap_init(struct tegra_vi_channel *chan)
{ … }
static void tegra_channel_cleanup(struct tegra_vi_channel *chan)
{ … }
void tegra_channels_cleanup(struct tegra_vi *vi)
{ … }
static int tegra_channel_init(struct tegra_vi_channel *chan)
{ … }
static int tegra_vi_channel_alloc(struct tegra_vi *vi, unsigned int port_num,
struct device_node *node, unsigned int lanes)
{ … }
static int tegra_vi_tpg_channels_alloc(struct tegra_vi *vi)
{ … }
static int tegra_vi_channels_alloc(struct tegra_vi *vi)
{ … }
static int tegra_vi_channels_init(struct tegra_vi *vi)
{ … }
void tegra_v4l2_nodes_cleanup_tpg(struct tegra_video_device *vid)
{ … }
int tegra_v4l2_nodes_setup_tpg(struct tegra_video_device *vid)
{ … }
static int __maybe_unused vi_runtime_resume(struct device *dev)
{ … }
static int __maybe_unused vi_runtime_suspend(struct device *dev)
{ … }
static struct tegra_vi_graph_entity *
tegra_vi_graph_find_entity(struct list_head *list,
const struct fwnode_handle *fwnode)
{ … }
static int tegra_vi_graph_build(struct tegra_vi_channel *chan,
struct tegra_vi_graph_entity *entity)
{ … }
static int tegra_vi_graph_notify_complete(struct v4l2_async_notifier *notifier)
{ … }
static int tegra_vi_graph_notify_bound(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *subdev,
struct v4l2_async_connection *asd)
{ … }
static const struct v4l2_async_notifier_operations tegra_vi_async_ops = …;
static int tegra_vi_graph_parse_one(struct tegra_vi_channel *chan,
struct fwnode_handle *fwnode)
{ … }
static int tegra_vi_graph_init(struct tegra_vi *vi)
{ … }
static void tegra_vi_graph_cleanup(struct tegra_vi *vi)
{ … }
static int tegra_vi_init(struct host1x_client *client)
{ … }
static int tegra_vi_exit(struct host1x_client *client)
{ … }
static const struct host1x_client_ops vi_client_ops = …;
static int tegra_vi_probe(struct platform_device *pdev)
{ … }
static void tegra_vi_remove(struct platform_device *pdev)
{ … }
static const struct of_device_id tegra_vi_of_id_table[] = …;
MODULE_DEVICE_TABLE(of, tegra_vi_of_id_table);
static const struct dev_pm_ops tegra_vi_pm_ops = …;
struct platform_driver tegra_vi_driver = …;