Commit d0a588bb authored by Genaro Saucedo Tejada's avatar Genaro Saucedo Tejada Committed by Andrew Boie
Browse files

sys_log: replace old debug macros at GPIO drivers



GPIO drivers are now using new system log macros also updated the
Kconfig variable to be a level rather than a bool.

JIRA: ZEP-311

Change-Id: I9a49626d816080cb8081c2dd445bae31f5dbf409
Signed-off-by: default avatarGenaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
parent 4be7d42d
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -25,11 +25,24 @@ menuconfig GPIO

if GPIO

config GPIO_DEBUG
	bool "Debug output for GPIO drivers"
	default n
config SYS_LOG_GPIO_LEVEL
	int
	prompt "GPIO drivers log level"
	default 0
	help
	  Enable the debug output for GPIO drivers
	Sets log level for GPIO drivers

	Levels are:

	- 0 OFF, do not write

	- 1 ERROR, only write SYS_LOG_ERR

	- 2 WARNING, write SYS_LOG_WRN in adition to previous level

	- 3 INFO, write SYS_LOG_INF in adition to previous levels

	- 4 DEBUG, write SYS_LOG_DBG in adition to previous levels

source "drivers/gpio/Kconfig.dw"

+6 −15
Original line number Diff line number Diff line
@@ -28,17 +28,8 @@
#include "gpio_utils.h"
#include "gpio_api_compat.h"

#ifndef CONFIG_GPIO_DEBUG
#define DBG(...)
#else
#if defined(CONFIG_STDOUT_CONSOLE)
#include <stdio.h>
#define DBG printf
#else
#include <misc/printk.h>
#define DBG printk
#endif /* CONFIG_STDOUT_CONSOLE */
#endif /* CONFIG_GPIO_DEBUG */
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_GPIO_LEVEL
#include <misc/sys_log.h>

/* Define GPIO_SCH_LEGACY_IO_PORTS_ACCESS
 * inside soc.h if the GPIO controller
@@ -121,8 +112,8 @@ static void _gpio_pin_config(struct device *dev, uint32_t pin, int flags)
			active_low = 1;
		}

		DBG("Setting up pin %d to active_high %d and active_low %d\n",
		    active_high, active_low);
		SYS_LOG_DBG("Setting up pin %d to active_high %d and "
			    "active_low %d", active_high, active_low);
	}

	/* We store the gtpe/gtne settings. These will be used once
@@ -235,7 +226,7 @@ static void _gpio_sch_manage_callback(struct device *dev)
	/* Start the fiber only when relevant */
	if (!sys_slist_is_empty(&gpio->callbacks) && gpio->cb_enabled) {
		if (!gpio->poll) {
			DBG("Starting SCH GPIO polling fiber\n");
			SYS_LOG_DBG("Starting SCH GPIO polling fiber");
			gpio->poll = 1;
			fiber_start(gpio->polling_stack,
				    GPIO_SCH_POLLING_STACK_SIZE,
@@ -335,7 +326,7 @@ int gpio_sch_init(struct device *dev)

	nano_timer_init(&gpio->poll_timer, NULL);

	DBG("SCH GPIO Intel Driver initialized on device: %p\n", dev);
	SYS_LOG_DBG("SCH GPIO Intel Driver initialized on device: %p", dev);

	return 0;
}