1/* 2 * camss-ispif.h 3 * 4 * Qualcomm MSM Camera Subsystem - ISPIF (ISP Interface) Module 5 * 6 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. 7 * Copyright (C) 2015-2017 Linaro Ltd. 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License version 2 and 11 * only version 2 as published by the Free Software Foundation. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 */ 18#ifndef QC_MSM_CAMSS_ISPIF_H 19#define QC_MSM_CAMSS_ISPIF_H 20 21#include <linux/clk.h> 22#include <media/media-entity.h> 23#include <media/v4l2-device.h> 24#include <media/v4l2-subdev.h> 25 26/* Number of ISPIF lines - same as number of CSID hardware modules */ 27#define MSM_ISPIF_LINE_NUM 2 28 29#define MSM_ISPIF_PAD_SINK 0 30#define MSM_ISPIF_PAD_SRC 1 31#define MSM_ISPIF_PADS_NUM 2 32 33#define MSM_ISPIF_VFE_NUM 1 34 35enum ispif_intf { 36 PIX0, 37 RDI0, 38 PIX1, 39 RDI1, 40 RDI2 41}; 42 43struct ispif_intf_cmd_reg { 44 u32 cmd_0; 45 u32 cmd_1; 46}; 47 48struct ispif_line { 49 u8 id; 50 u8 csid_id; 51 u8 vfe_id; 52 enum ispif_intf interface; 53 struct v4l2_subdev subdev; 54 struct media_pad pads[MSM_ISPIF_PADS_NUM]; 55 struct v4l2_mbus_framefmt fmt[MSM_ISPIF_PADS_NUM]; 56}; 57 58struct ispif_device { 59 void __iomem *base; 60 void __iomem *base_clk_mux; 61 u32 irq; 62 char irq_name[30]; 63 struct camss_clock *clock; 64 int nclocks; 65 struct camss_clock *clock_for_reset; 66 int nclocks_for_reset; 67 struct completion reset_complete; 68 int power_count; 69 struct mutex power_lock; 70 struct ispif_intf_cmd_reg intf_cmd[MSM_ISPIF_VFE_NUM]; 71 struct mutex config_lock; 72 struct ispif_line line[MSM_ISPIF_LINE_NUM]; 73}; 74 75struct resources_ispif; 76 77int msm_ispif_subdev_init(struct ispif_device *ispif, 78 const struct resources_ispif *res); 79 80int msm_ispif_register_entities(struct ispif_device *ispif, 81 struct v4l2_device *v4l2_dev); 82 83void msm_ispif_unregister_entities(struct ispif_device *ispif); 84 85#endif /* QC_MSM_CAMSS_ISPIF_H */ 86