/* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. */ #ifndef FIMC_MDEVICE_H_ #define FIMC_MDEVICE_H_ #include <linux/clk.h> #include <linux/clk-provider.h> #include <linux/platform_device.h> #include <linux/mutex.h> #include <linux/of.h> #include <media/media-device.h> #include <media/media-entity.h> #include <media/v4l2-device.h> #include <media/v4l2-subdev.h> #include <media/drv-intf/exynos-fimc.h> #include "fimc-core.h" #include "fimc-lite.h" #include "mipi-csis.h" #define FIMC_OF_NODE_NAME … #define FIMC_LITE_OF_NODE_NAME … #define FIMC_IS_OF_NODE_NAME … #define CSIS_OF_NODE_NAME … #define FIMC_MAX_SENSORS … #define FIMC_MAX_CAMCLKS … #define DEFAULT_SENSOR_CLK_FREQ … /* LCD/ISP Writeback clocks (PIXELASYNCMx) */ enum { … }; enum fimc_subdev_index { … }; /* * This structure represents a chain of media entities, including a data * source entity (e.g. an image sensor subdevice), a data capture entity * - a video capture device node and any remaining entities. */ struct fimc_pipeline { … }; #define to_fimc_pipeline(_ep) … struct fimc_csis_info { … }; struct fimc_camclk_info { … }; /** * struct fimc_sensor_info - image data source subdev information * @pdata: sensor's attributes passed as media device's platform data * @asd: asynchronous subdev registration data structure * @subdev: image sensor v4l2 subdev * @host: fimc device the sensor is currently linked to * * This data structure applies to image sensor and the writeback subdevs. */ struct fimc_sensor_info { … }; struct cam_clk { … }; #define to_cam_clk(_hw) … /** * struct fimc_md - fimc media device information * @csis: MIPI CSIS subdevs data * @sensor: array of registered sensor subdevs * @num_sensors: actual number of registered sensors * @camclk: external sensor clock information * @wbclk: external writeback clock information * @fimc_lite: array of registered fimc-lite devices * @fimc: array of registered fimc devices * @fimc_is: fimc-is data structure * @use_isp: set to true when FIMC-IS subsystem is used * @pmf: handle to the CAMCLK clock control FIMC helper device * @media_dev: top level media device * @v4l2_dev: top level v4l2_device holding up the subdevs * @pdev: platform device this media device is hooked up into * @clk_provider: CAMCLK clock provider structure * @subdev_notifier: notifier for the subdevs * @user_subdev_api: true if subdevs are not configured by the host driver * @slock: spinlock protecting @sensor array * @pipelines: list of pipelines * @link_setup_graph: graph iterator */ struct fimc_md { … }; static inline struct fimc_sensor_info *source_to_sensor_info(struct fimc_source_info *si) { … } static inline struct fimc_md *entity_to_fimc_mdev(struct media_entity *me) { … } static inline struct fimc_md *notifier_to_fimc_md(struct v4l2_async_notifier *n) { … } static inline void fimc_md_graph_lock(struct exynos_video_entity *ve) { … } static inline void fimc_md_graph_unlock(struct exynos_video_entity *ve) { … } int fimc_md_set_camclk(struct v4l2_subdev *sd, bool on); #ifdef CONFIG_OF static inline bool fimc_md_is_isp_available(struct device_node *node) { … } #else #define fimc_md_is_isp_available … #endif /* CONFIG_OF */ static inline struct v4l2_subdev *__fimc_md_get_subdev( struct exynos_media_pipeline *ep, unsigned int index) { … } #endif