Harsh Shah | a1af882 | 2017-05-11 22:06:36 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2017, The Linux Foundation. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #ifndef _CAM_VFE_SOC_H_ |
| 14 | #define _CAM_VFE_SOC_H_ |
| 15 | |
| 16 | #include "cam_soc_util.h" |
| 17 | #include "cam_isp_hw.h" |
| 18 | |
Senthil Kumar Rajagopal | a8e0c49 | 2017-09-05 16:21:49 +0530 | [diff] [blame] | 19 | #define CAM_VFE_DSP_CLK_NAME "ife_dsp_clk" |
| 20 | |
Harsh Shah | a1af882 | 2017-05-11 22:06:36 -0700 | [diff] [blame] | 21 | /* |
| 22 | * struct cam_vfe_soc_private: |
| 23 | * |
| 24 | * @Brief: Private SOC data specific to VFE HW Driver |
| 25 | * |
| 26 | * @cpas_handle: Handle returned on registering with CPAS driver. |
| 27 | * This handle is used for all further interface |
| 28 | * with CPAS. |
| 29 | */ |
| 30 | struct cam_vfe_soc_private { |
Senthil Kumar Rajagopal | a8e0c49 | 2017-09-05 16:21:49 +0530 | [diff] [blame] | 31 | uint32_t cpas_handle; |
| 32 | struct clk *dsp_clk; |
| 33 | int32_t dsp_clk_index; |
| 34 | int32_t dsp_clk_rate; |
Harsh Shah | a1af882 | 2017-05-11 22:06:36 -0700 | [diff] [blame] | 35 | }; |
| 36 | |
| 37 | /* |
| 38 | * cam_vfe_init_soc_resources() |
| 39 | * |
| 40 | * @Brief: Initialize SOC resources including private data |
| 41 | * |
| 42 | * @soc_info: Device soc information |
| 43 | * @handler: Irq handler function pointer |
| 44 | * @irq_data: Irq handler function Callback data |
| 45 | * |
| 46 | * @Return: 0: Success |
| 47 | * Non-zero: Failure |
| 48 | */ |
| 49 | int cam_vfe_init_soc_resources(struct cam_hw_soc_info *soc_info, |
| 50 | irq_handler_t vfe_irq_handler, void *irq_data); |
| 51 | |
| 52 | /* |
Harsh Shah | 545df9a | 2017-06-16 16:43:17 -0700 | [diff] [blame] | 53 | * cam_vfe_deinit_soc_resources() |
| 54 | * |
| 55 | * @Brief: Deinitialize SOC resources including private data |
| 56 | * |
| 57 | * @soc_info: Device soc information |
| 58 | * |
| 59 | * @Return: 0: Success |
| 60 | * Non-zero: Failure |
| 61 | */ |
| 62 | int cam_vfe_deinit_soc_resources(struct cam_hw_soc_info *soc_info); |
| 63 | |
| 64 | /* |
Harsh Shah | a1af882 | 2017-05-11 22:06:36 -0700 | [diff] [blame] | 65 | * cam_vfe_enable_soc_resources() |
| 66 | * |
| 67 | * @brief: Enable regulator, irq resources, start CPAS |
| 68 | * |
| 69 | * @soc_info: Device soc information |
| 70 | * |
| 71 | * @Return: 0: Success |
| 72 | * Non-zero: Failure |
| 73 | */ |
| 74 | int cam_vfe_enable_soc_resources(struct cam_hw_soc_info *soc_info); |
| 75 | |
| 76 | /* |
| 77 | * cam_vfe_disable_soc_resources() |
| 78 | * |
| 79 | * @brief: Disable regulator, irq resources, stop CPAS |
| 80 | * |
| 81 | * @soc_info: Device soc information |
| 82 | * |
| 83 | * @Return: 0: Success |
| 84 | * Non-zero: Failure |
| 85 | */ |
| 86 | int cam_vfe_disable_soc_resources(struct cam_hw_soc_info *soc_info); |
| 87 | |
Senthil Kumar Rajagopal | a8e0c49 | 2017-09-05 16:21:49 +0530 | [diff] [blame] | 88 | /* |
| 89 | * cam_vfe_soc_enable_clk() |
| 90 | * |
| 91 | * @brief: Enable clock with given name |
| 92 | * |
| 93 | * @soc_info: Device soc information |
| 94 | * @clk_name: Name of clock to enable |
| 95 | * |
| 96 | * @Return: 0: Success |
| 97 | * Non-zero: Failure |
| 98 | */ |
| 99 | int cam_vfe_soc_enable_clk(struct cam_hw_soc_info *soc_info, |
| 100 | const char *clk_name); |
| 101 | |
| 102 | /* |
| 103 | * cam_vfe_soc_disable_dsp_clk() |
| 104 | * |
| 105 | * @brief: Disable clock with given name |
| 106 | * |
| 107 | * @soc_info: Device soc information |
| 108 | * @clk_name: Name of clock to enable |
| 109 | * |
| 110 | * @Return: 0: Success |
| 111 | * Non-zero: Failure |
| 112 | */ |
| 113 | int cam_vfe_soc_disable_clk(struct cam_hw_soc_info *soc_info, |
| 114 | const char *clk_name); |
| 115 | |
Harsh Shah | a1af882 | 2017-05-11 22:06:36 -0700 | [diff] [blame] | 116 | #endif /* _CAM_VFE_SOC_H_ */ |