1d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki/* 20c9204d3427015a22fa90b865b6317fed337810bSylwester Nawrocki * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. 3d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * 4d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * This program is free software; you can redistribute it and/or modify 5d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * it under the terms of the GNU General Public License version 2 as 6d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * published by the Free Software Foundation. 7d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki */ 8d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki 9d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki#ifndef FIMC_MDEVICE_H_ 10d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki#define FIMC_MDEVICE_H_ 11d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki 12d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki#include <linux/clk.h> 13d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrocki#include <linux/clk-provider.h> 14d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki#include <linux/platform_device.h> 15d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki#include <linux/mutex.h> 16e781bbe3fecf05ab8f3c05fd0b693bebb5e489d5Sylwester Nawrocki#include <linux/of.h> 174163851f7b997e24602cad8e0eae96d31a252548Sylwester Nawrocki#include <linux/pinctrl/consumer.h> 18d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki#include <media/media-device.h> 19d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki#include <media/media-entity.h> 20d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki#include <media/v4l2-device.h> 21d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki#include <media/v4l2-subdev.h> 2249b2f4c56fbf70ca693d6df1c491f0566d516aeaSylwester Nawrocki#include <media/exynos-fimc.h> 23d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki 24d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki#include "fimc-core.h" 254af813108b880e96a4b8b01e162f950a4aaa2475Sylwester Nawrocki#include "fimc-lite.h" 26d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki#include "mipi-csis.h" 27d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki 28e2985a260e6615503b4fa8e66788708e750c7750Sylwester Nawrocki#define FIMC_OF_NODE_NAME "fimc" 29e2985a260e6615503b4fa8e66788708e750c7750Sylwester Nawrocki#define FIMC_LITE_OF_NODE_NAME "fimc-lite" 30e2985a260e6615503b4fa8e66788708e750c7750Sylwester Nawrocki#define FIMC_IS_OF_NODE_NAME "fimc-is" 31e2985a260e6615503b4fa8e66788708e750c7750Sylwester Nawrocki#define CSIS_OF_NODE_NAME "csis" 32e2985a260e6615503b4fa8e66788708e750c7750Sylwester Nawrocki 334163851f7b997e24602cad8e0eae96d31a252548Sylwester Nawrocki#define PINCTRL_STATE_IDLE "idle" 344163851f7b997e24602cad8e0eae96d31a252548Sylwester Nawrocki 35fa91f1056f17c87bc0fa601f80d1b1a4487fd701Sylwester Nawrocki#define FIMC_MAX_SENSORS 4 36d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki#define FIMC_MAX_CAMCLKS 2 37fa91f1056f17c87bc0fa601f80d1b1a4487fd701Sylwester Nawrocki#define DEFAULT_SENSOR_CLK_FREQ 24000000U 38d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki 39056f4f3036394892ed591932326c11613b6584c1Sylwester Nawrocki/* LCD/ISP Writeback clocks (PIXELASYNCMx) */ 40056f4f3036394892ed591932326c11613b6584c1Sylwester Nawrockienum { 41056f4f3036394892ed591932326c11613b6584c1Sylwester Nawrocki CLK_IDX_WB_A, 42056f4f3036394892ed591932326c11613b6584c1Sylwester Nawrocki CLK_IDX_WB_B, 43056f4f3036394892ed591932326c11613b6584c1Sylwester Nawrocki FIMC_MAX_WBCLKS 44056f4f3036394892ed591932326c11613b6584c1Sylwester Nawrocki}; 45056f4f3036394892ed591932326c11613b6584c1Sylwester Nawrocki 46403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrockienum fimc_subdev_index { 47403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki IDX_SENSOR, 48403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki IDX_CSIS, 49403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki IDX_FLITE, 50403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki IDX_IS_ISP, 51403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki IDX_FIMC, 52403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki IDX_MAX, 53403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki}; 54403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki 55403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki/* 56403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki * This structure represents a chain of media entities, including a data 57403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki * source entity (e.g. an image sensor subdevice), a data capture entity 58403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki * - a video capture device node and any remaining entities. 59403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki */ 60403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrockistruct fimc_pipeline { 61403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki struct exynos_media_pipeline ep; 62403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki struct list_head list; 63403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki struct media_entity *vdev_entity; 64403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki struct v4l2_subdev *subdevs[IDX_MAX]; 65403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki}; 66403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki 67403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki#define to_fimc_pipeline(_ep) container_of(_ep, struct fimc_pipeline, ep) 68403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki 69d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrockistruct fimc_csis_info { 70d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki struct v4l2_subdev *sd; 71d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki int id; 72d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki}; 73d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki 74d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrockistruct fimc_camclk_info { 75d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki struct clk *clock; 76d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki int use_count; 77d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki unsigned long frequency; 78d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki}; 79d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki 80d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki/** 81d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * struct fimc_sensor_info - image data source subdev information 82d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * @pdata: sensor's atrributes passed as media device's platform data 83fa91f1056f17c87bc0fa601f80d1b1a4487fd701Sylwester Nawrocki * @asd: asynchronous subdev registration data structure 84d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * @subdev: image sensor v4l2 subdev 85d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * @host: fimc device the sensor is currently linked to 86d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * 87d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * This data structure applies to image sensor and the writeback subdevs. 88d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki */ 89d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrockistruct fimc_sensor_info { 9056bc911ac3b94c731db3a6de20258827f1a61c20Sylwester Nawrocki struct fimc_source_info pdata; 91fa91f1056f17c87bc0fa601f80d1b1a4487fd701Sylwester Nawrocki struct v4l2_async_subdev asd; 92d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki struct v4l2_subdev *subdev; 93d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki struct fimc_dev *host; 94d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki}; 95d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki 96d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrockistruct cam_clk { 97d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrocki struct clk_hw hw; 98d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrocki struct fimc_md *fmd; 99d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrocki}; 100d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrocki#define to_cam_clk(_hw) container_of(_hw, struct cam_clk, hw) 101d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrocki 102d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki/** 103d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * struct fimc_md - fimc media device information 104d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * @csis: MIPI CSIS subdevs data 105d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * @sensor: array of registered sensor subdevs 106d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * @num_sensors: actual number of registered sensors 107d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * @camclk: external sensor clock information 108d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * @fimc: array of registered fimc devices 109e781bbe3fecf05ab8f3c05fd0b693bebb5e489d5Sylwester Nawrocki * @fimc_is: fimc-is data structure 110056f4f3036394892ed591932326c11613b6584c1Sylwester Nawrocki * @use_isp: set to true when FIMC-IS subsystem is used 1113e20c345a6dac13a1545bd748f9d0a6336856ee7Sylwester Nawrocki * @pmf: handle to the CAMCLK clock control FIMC helper device 112d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * @media_dev: top level media device 113d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * @v4l2_dev: top level v4l2_device holding up the subdevs 114d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * @pdev: platform device this media device is hooked up into 1154163851f7b997e24602cad8e0eae96d31a252548Sylwester Nawrocki * @pinctrl: camera port pinctrl handle 1164163851f7b997e24602cad8e0eae96d31a252548Sylwester Nawrocki * @state_default: pinctrl default state handle 1174163851f7b997e24602cad8e0eae96d31a252548Sylwester Nawrocki * @state_idle: pinctrl idle state handle 118d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrocki * @cam_clk_provider: CAMCLK clock provider structure 119d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * @user_subdev_api: true if subdevs are not configured by the host driver 120d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki * @slock: spinlock protecting @sensor array 121d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki */ 122d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrockistruct fimc_md { 123d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki struct fimc_csis_info csis[CSIS_MAX_ENTITIES]; 124d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki struct fimc_sensor_info sensor[FIMC_MAX_SENSORS]; 125d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki int num_sensors; 126d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki struct fimc_camclk_info camclk[FIMC_MAX_CAMCLKS]; 127056f4f3036394892ed591932326c11613b6584c1Sylwester Nawrocki struct clk *wbclk[FIMC_MAX_WBCLKS]; 1284af813108b880e96a4b8b01e162f950a4aaa2475Sylwester Nawrocki struct fimc_lite *fimc_lite[FIMC_LITE_MAX_DEVS]; 129d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki struct fimc_dev *fimc[FIMC_MAX_DEVS]; 130e781bbe3fecf05ab8f3c05fd0b693bebb5e489d5Sylwester Nawrocki struct fimc_is *fimc_is; 131056f4f3036394892ed591932326c11613b6584c1Sylwester Nawrocki bool use_isp; 1323e20c345a6dac13a1545bd748f9d0a6336856ee7Sylwester Nawrocki struct device *pmf; 133d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki struct media_device media_dev; 134d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki struct v4l2_device v4l2_dev; 135d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki struct platform_device *pdev; 136d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrocki 1374163851f7b997e24602cad8e0eae96d31a252548Sylwester Nawrocki struct fimc_pinctrl { 1384163851f7b997e24602cad8e0eae96d31a252548Sylwester Nawrocki struct pinctrl *pinctrl; 1394163851f7b997e24602cad8e0eae96d31a252548Sylwester Nawrocki struct pinctrl_state *state_default; 1404163851f7b997e24602cad8e0eae96d31a252548Sylwester Nawrocki struct pinctrl_state *state_idle; 1414163851f7b997e24602cad8e0eae96d31a252548Sylwester Nawrocki } pinctl; 142403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki 143d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrocki struct cam_clk_provider { 144d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrocki struct clk *clks[FIMC_MAX_CAMCLKS]; 145d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrocki struct clk_onecell_data clk_data; 146d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrocki struct device_node *of_node; 147d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrocki struct cam_clk camclk[FIMC_MAX_CAMCLKS]; 148d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrocki int num_clocks; 149d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrocki } clk_provider; 150d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrocki 151fa91f1056f17c87bc0fa601f80d1b1a4487fd701Sylwester Nawrocki struct v4l2_async_notifier subdev_notifier; 152fa91f1056f17c87bc0fa601f80d1b1a4487fd701Sylwester Nawrocki struct v4l2_async_subdev *async_subdevs[FIMC_MAX_SENSORS]; 153fa91f1056f17c87bc0fa601f80d1b1a4487fd701Sylwester Nawrocki 154d3f5e0c54f1bfa5f48e92ac45a279fa8cfdc55b7Sylwester Nawrocki bool user_subdev_api; 155d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki spinlock_t slock; 156403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki struct list_head pipelines; 157d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki}; 158d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki 1594c8f0629f53bb198ed00c2c54cf80cc2be95acabSylwester Nawrockistatic inline 1604c8f0629f53bb198ed00c2c54cf80cc2be95acabSylwester Nawrockistruct fimc_sensor_info *source_to_sensor_info(struct fimc_source_info *si) 1614c8f0629f53bb198ed00c2c54cf80cc2be95acabSylwester Nawrocki{ 1624c8f0629f53bb198ed00c2c54cf80cc2be95acabSylwester Nawrocki return container_of(si, struct fimc_sensor_info, pdata); 1634c8f0629f53bb198ed00c2c54cf80cc2be95acabSylwester Nawrocki} 1644c8f0629f53bb198ed00c2c54cf80cc2be95acabSylwester Nawrocki 165d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrockistatic inline struct fimc_md *entity_to_fimc_mdev(struct media_entity *me) 166d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki{ 167d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki return me->parent == NULL ? NULL : 168d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki container_of(me->parent, struct fimc_md, media_dev); 169d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki} 170d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki 171fa91f1056f17c87bc0fa601f80d1b1a4487fd701Sylwester Nawrockistatic inline struct fimc_md *notifier_to_fimc_md(struct v4l2_async_notifier *n) 172fa91f1056f17c87bc0fa601f80d1b1a4487fd701Sylwester Nawrocki{ 173fa91f1056f17c87bc0fa601f80d1b1a4487fd701Sylwester Nawrocki return container_of(n, struct fimc_md, subdev_notifier); 174fa91f1056f17c87bc0fa601f80d1b1a4487fd701Sylwester Nawrocki} 175fa91f1056f17c87bc0fa601f80d1b1a4487fd701Sylwester Nawrocki 176bc7584b0b7a99326d31195f81f7494efe9fe0c0fSylwester Nawrockistatic inline void fimc_md_graph_lock(struct exynos_video_entity *ve) 177d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki{ 178bc7584b0b7a99326d31195f81f7494efe9fe0c0fSylwester Nawrocki mutex_lock(&ve->vdev.entity.parent->graph_mutex); 179d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki} 180d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki 181bc7584b0b7a99326d31195f81f7494efe9fe0c0fSylwester Nawrockistatic inline void fimc_md_graph_unlock(struct exynos_video_entity *ve) 182d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki{ 183bc7584b0b7a99326d31195f81f7494efe9fe0c0fSylwester Nawrocki mutex_unlock(&ve->vdev.entity.parent->graph_mutex); 184d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki} 185d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki 186d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrockiint fimc_md_set_camclk(struct v4l2_subdev *sd, bool on); 187d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki 188e781bbe3fecf05ab8f3c05fd0b693bebb5e489d5Sylwester Nawrocki#ifdef CONFIG_OF 189e781bbe3fecf05ab8f3c05fd0b693bebb5e489d5Sylwester Nawrockistatic inline bool fimc_md_is_isp_available(struct device_node *node) 190e781bbe3fecf05ab8f3c05fd0b693bebb5e489d5Sylwester Nawrocki{ 191e781bbe3fecf05ab8f3c05fd0b693bebb5e489d5Sylwester Nawrocki node = of_get_child_by_name(node, FIMC_IS_OF_NODE_NAME); 192e781bbe3fecf05ab8f3c05fd0b693bebb5e489d5Sylwester Nawrocki return node ? of_device_is_available(node) : false; 193e781bbe3fecf05ab8f3c05fd0b693bebb5e489d5Sylwester Nawrocki} 194e781bbe3fecf05ab8f3c05fd0b693bebb5e489d5Sylwester Nawrocki#else 195e781bbe3fecf05ab8f3c05fd0b693bebb5e489d5Sylwester Nawrocki#define fimc_md_is_isp_available(node) (false) 196e781bbe3fecf05ab8f3c05fd0b693bebb5e489d5Sylwester Nawrocki#endif /* CONFIG_OF */ 197e781bbe3fecf05ab8f3c05fd0b693bebb5e489d5Sylwester Nawrocki 198403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrockistatic inline struct v4l2_subdev *__fimc_md_get_subdev( 199403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki struct exynos_media_pipeline *ep, 200403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki unsigned int index) 201403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki{ 202403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki struct fimc_pipeline *p = to_fimc_pipeline(ep); 203403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki 204403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki if (!p || index >= IDX_MAX) 205403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki return NULL; 206403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki else 207403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki return p->subdevs[index]; 208403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki} 209403dfbec45419c1838e0ea3be16625986ec17cfdSylwester Nawrocki 210d3953223b0905437fef7ce60506b5fdfaf98dda6Sylwester Nawrocki#endif 211