1 /*
2 *
3 * SPDX-License-Identifier: GPL-2.0
4 *
5 * Copyright (C) 2011-2018 ARM or its affiliates
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 *
18 */
19
20 #include "acamera_firmware_config.h"
21 #include "system_log.h"
22 #include "system_hw_io.h"
23
24 //debug log names for level
25 const char *const log_level_name[SYSTEM_LOG_LEVEL_MAX] = {"DEBUG", "INFO", "NOTICE", "WARNING", "ERR", "CRIT"};
26 //debug log names for modules
27 const char *const log_module_name[SYSTEM_LOG_MODULE_MAX] = FSM_NAMES;
28
29 static uint32_t irq_dbg = 0;
30
system_irq_status(uint32_t irq_mask)31 void system_irq_status( uint32_t irq_mask )
32 {
33 irq_dbg = irq_mask;
34 }
35
isp_dbg_read(struct device * dev,struct device_attribute * attr,char * buf)36 static ssize_t isp_dbg_read(
37 struct device *dev,
38 struct device_attribute *attr,
39 char *buf)
40 {
41 ssize_t ret = 0;
42
43 uint32_t active_size = system_hw_read_32(0x98);
44 uint32_t isp_start = system_hw_read_32(0xa0);
45 uint32_t frame_count = system_hw_read_32(0x70);
46 uint32_t bypass_stitch = system_hw_read_32(0x18EAC) & (1 << 5);
47 uint32_t ping_pong = system_hw_read_32(0x24) & 7;
48
49 ret = sprintf(buf, "\t\tactive size: %x\t\tisp start:%x\t\tframe count:%x\t\tbypass stitch:%x\n \
50 irq status:%x\t\t\tframe start:%x\t\tmulti ctx err:%x\t\t\tbroken frame:%x\n \
51 isp watchdog:%x\t\t\tframe collision:%x\tdma err:%x\t\t\tpingpong:%x\n",\
52 active_size, isp_start, frame_count, bypass_stitch, \
53 irq_dbg, irq_dbg & (0x01),irq_dbg & (1 << 2), irq_dbg & (1 << 3),\
54 irq_dbg & (1 << 19),irq_dbg & (1 << 20),irq_dbg & (1 << 22),ping_pong);
55
56 irq_dbg = 0;
57
58 return ret;
59 }
60
isp_dbg_write(struct device * dev,struct device_attribute * attr,char const * buf,size_t size)61 static ssize_t isp_dbg_write(
62 struct device *dev, struct device_attribute *attr,
63 char const *buf, size_t size)
64 {
65 ssize_t ret = size;
66
67 return ret;
68 }
69
70 static DEVICE_ATTR(isp_dbg, S_IRUGO | S_IWUSR, isp_dbg_read, isp_dbg_write);
71
system_dbg_create(struct device * dev)72 void system_dbg_create( struct device *dev )
73 {
74 device_create_file(dev, &dev_attr_isp_dbg);
75 }
76
system_dbg_remove(struct device * dev)77 void system_dbg_remove( struct device *dev )
78 {
79 device_remove_file(dev, &dev_attr_isp_dbg);
80 }
81
82