blob: 63d54fdf7d80173daf60cb5095dcc6011044371d [file] [log] [blame]
Rajakumar Govindaram7d2b9772017-07-19 15:16:12 -07001/* 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
24int 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
42int 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
54int cam_jpeg_dma_disable_soc_resources(struct cam_hw_soc_info *soc_info)
55{
56 int rc;
57
Rajakumar Govindaram2264d152017-09-11 10:53:31 -070058 rc = cam_soc_util_disable_platform_resource(soc_info, true, true);
Rajakumar Govindaram7d2b9772017-07-19 15:16:12 -070059 if (rc)
60 CAM_ERR(CAM_JPEG, "disable platform failed %d", rc);
61
62 return rc;
63}