4 * Qualcomm MSM Camera Subsystem - Core
6 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
7 * Copyright (C) 2015-2017 Linaro Ltd.
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.
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.
18 #ifndef QC_MSM_CAMSS_H
19 #define QC_MSM_CAMSS_H
21 #include <linux/types.h>
22 #include <media/v4l2-async.h>
23 #include <media/v4l2-device.h>
24 #include <media/v4l2-subdev.h>
25 #include <media/media-device.h>
26 #include <media/media-entity.h>
27 #include <linux/device.h>
29 #include "camss-csid.h"
30 #include "camss-csiphy.h"
31 #include "camss-ispif.h"
32 #include "camss-vfe.h"
34 #define CAMSS_CSID_NUM 2
35 #define CAMSS_CSIPHY_NUM 2
37 #define to_camss(ptr_module) \
38 container_of(ptr_module, struct camss, ptr_module)
40 #define to_device(ptr_module) \
41 (to_camss(ptr_module)->dev)
43 #define module_pointer(ptr_module, index) \
44 ((const struct ptr_module##_device (*)[]) &(ptr_module[-(index)]))
46 #define to_camss_index(ptr_module, index) \
47 container_of(module_pointer(ptr_module, index), \
48 struct camss, ptr_module)
50 #define to_device_index(ptr_module, index) \
51 (to_camss_index(ptr_module, index)->dev)
53 #define CAMSS_RES_MAX 15
56 char *regulator
[CAMSS_RES_MAX
];
57 char *clock
[CAMSS_RES_MAX
];
58 u32 clock_rate
[CAMSS_RES_MAX
][CAMSS_RES_MAX
];
59 char *reg
[CAMSS_RES_MAX
];
60 char *interrupt
[CAMSS_RES_MAX
];
63 struct resources_ispif
{
64 char *clock
[CAMSS_RES_MAX
];
65 char *clock_for_reset
[CAMSS_RES_MAX
];
66 char *reg
[CAMSS_RES_MAX
];
71 struct v4l2_device v4l2_dev
;
72 struct v4l2_async_notifier notifier
;
73 struct media_device media_dev
;
75 struct csiphy_device csiphy
[CAMSS_CSIPHY_NUM
];
76 struct csid_device csid
[CAMSS_CSID_NUM
];
77 struct ispif_device ispif
;
78 struct vfe_device vfe
;
82 struct camss_camera_interface
{
84 struct csiphy_csi2_cfg csi2
;
87 struct camss_async_subdev
{
88 struct camss_camera_interface interface
;
89 struct v4l2_async_subdev asd
;
99 void camss_add_clock_margin(u64
*rate
);
100 int camss_enable_clocks(int nclocks
, struct camss_clock
*clock
,
102 void camss_disable_clocks(int nclocks
, struct camss_clock
*clock
);
103 int camss_get_pixel_clock(struct media_entity
*entity
, u32
*pixel_clock
);
104 void camss_delete(struct camss
*camss
);
106 #endif /* QC_MSM_CAMSS_H */