Rajakumar Govindaram | 7d2b977 | 2017-07-19 15:16:12 -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 | #include <linux/io.h> |
| 14 | #include <linux/of.h> |
| 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/dma-buf.h> |
| 17 | #include <media/cam_defs.h> |
| 18 | #include <media/cam_jpeg.h> |
| 19 | |
| 20 | #include "jpeg_dma_soc.h" |
| 21 | #include "cam_soc_util.h" |
| 22 | #include "cam_debug_util.h" |
| 23 | |
| 24 | int cam_jpeg_dma_init_soc_resources(struct cam_hw_soc_info *soc_info, |
| 25 | irq_handler_t jpeg_dma_irq_handler, void *irq_data) |
| 26 | { |
| 27 | int rc; |
| 28 | |
| 29 | rc = cam_soc_util_get_dt_properties(soc_info); |
| 30 | if (rc) |
| 31 | return rc; |
| 32 | |
| 33 | rc = cam_soc_util_request_platform_resource(soc_info, |
| 34 | jpeg_dma_irq_handler, |
| 35 | irq_data); |
| 36 | if (rc) |
| 37 | CAM_ERR(CAM_JPEG, "init soc failed %d", rc); |
| 38 | |
| 39 | return rc; |
| 40 | } |
| 41 | |
| 42 | int cam_jpeg_dma_enable_soc_resources(struct cam_hw_soc_info *soc_info) |
| 43 | { |
| 44 | int rc; |
| 45 | |
| 46 | rc = cam_soc_util_enable_platform_resource(soc_info, true, |
| 47 | CAM_SVS_VOTE, true); |
| 48 | if (rc) |
| 49 | CAM_ERR(CAM_JPEG, "enable platform failed %d", rc); |
| 50 | |
| 51 | return rc; |
| 52 | } |
| 53 | |
| 54 | int cam_jpeg_dma_disable_soc_resources(struct cam_hw_soc_info *soc_info) |
| 55 | { |
| 56 | int rc; |
| 57 | |
Rajakumar Govindaram | 2264d15 | 2017-09-11 10:53:31 -0700 | [diff] [blame] | 58 | rc = cam_soc_util_disable_platform_resource(soc_info, true, true); |
Rajakumar Govindaram | 7d2b977 | 2017-07-19 15:16:12 -0700 | [diff] [blame] | 59 | if (rc) |
| 60 | CAM_ERR(CAM_JPEG, "disable platform failed %d", rc); |
| 61 | |
| 62 | return rc; |
| 63 | } |