Skip to content
Snippets Groups Projects
Commit 8631f697 authored by Tobias Kahlki's avatar Tobias Kahlki
Browse files

driver: Add debug traces

parent 4d9c37b1
No related tags found
No related merge requests found
......@@ -91,6 +91,8 @@ static int request_gpios(struct touch_gpio * gpios)
if (gpio_is_valid(gpios->irq_pin)) {
// request the gpio
error = devm_gpio_request_one(dev, gpios->irq_pin, GPIOF_IN, dev_name(dev));
trace_printk("devm_gpio_request_on error: %d - irq_pin: %d\n", error, gpios->irq_pin);
if (error) {
dev_err(dev, "Failed to request GPIO %d as irq pin, error %d\n", gpios->irq_pin, error);
gpios->irq_pin = -EINVAL;
......@@ -294,10 +296,18 @@ struct touch_gpio * touch_gpio_read_from_dt( struct device *dev, int usage)
}
if( usage & irq_mandatory )
{
trace_printk("irq_pin: %d\n", gpios->irq_pin);
// Read the irq gpio from dt, allow both irq-gpios and irq-gpio
gpios->irq_pin = of_get_named_gpio(np, "irq-gpios", 0);
trace_printk("irq_pin: %d\n", gpios->irq_pin);
if (!gpio_is_valid(gpios->irq_pin)) {
gpios->irq_pin = of_get_named_gpio(np, "irq-gpio", 0);
trace_printk("irq_pin: %d\n", gpios->irq_pin);
if (!gpio_is_valid(gpios->irq_pin)) {
error = gpios->irq_pin;
gpios->irq_pin = -EINVAL;
......@@ -310,6 +320,8 @@ struct touch_gpio * touch_gpio_read_from_dt( struct device *dev, int usage)
};
};
trace_printk("irq_pin: %d\n", gpios->irq_pin);
/* Zusätzlich oder alternativ oder nur
if( 0 == of_property_read_u32_index( np, "interrupts", 1, &i))
p_egalax_i2c_dev->irq_flags = i;
......@@ -320,15 +332,22 @@ struct touch_gpio * touch_gpio_read_from_dt( struct device *dev, int usage)
}
}
trace_printk("irq_flags #1: %d\n", gpios->irq_flags);
if( 0 != of_property_read_u32( np, "irq-flags", &gpios->irq_flags))
{
if(gpios->irq_low_active )
{
trace_printk("Set low trigger\n");
gpios->irq_flags = IRQF_TRIGGER_LOW;
}else{
trace_printk("Set high trigger\n");
gpios->irq_flags = IRQF_TRIGGER_HIGH;
}
}
trace_printk("irq_flags #2: %d\n", gpios->irq_flags);
error = request_gpios(gpios);
dev_dbg(dev, "gpios initialized: IRQ %d, WAKE pin %d, Reset pin %d.\n",
......@@ -349,6 +368,7 @@ EXPORT_SYMBOL(touch_gpio_read_from_dt);
int touch_gpio_get_irq_flags ( const struct touch_gpio * gpios)
{
trace_printk("irq_flags: %d\n", gpios->irq_flags);
return gpios->irq_flags;
}
EXPORT_SYMBOL(touch_gpio_get_irq_flags);
......@@ -368,6 +388,8 @@ void touch_gpio_reset_out ( const struct touch_gpio * gpios, bool state )
if(gpios->reset_low_active)
pin_state=!pin_state;
trace_printk("pin_state: %d\n", pin_state);
gpio_set_value_cansleep(gpios->reset_pin, pin_state);
}
EXPORT_SYMBOL(touch_gpio_reset_out);
......@@ -411,7 +433,8 @@ EXPORT_SYMBOL(touch_gpio_wake_out);
/* Returns true if irq pin is active, false if it is not active */
bool touch_gpio_get_irq_state ( const struct touch_gpio * gpios)
{
int pin_state;
int pin_state, pin_state_out;
if (!gpio_is_valid(gpios->irq_pin)) {
if(!(gpios->usage & irq_optional))
pr_err("irq gpio is invalid\n");
......@@ -421,9 +444,13 @@ bool touch_gpio_get_irq_state ( const struct touch_gpio * gpios)
pin_state = gpio_get_value_cansleep(gpios->irq_pin);
if(gpios->irq_low_active)
pin_state=!pin_state;
pin_state_out=!pin_state;
else
pin_state_out=pin_state;
trace_printk("pin_state: %d / %d\n", pin_state, pin_state_out);
return pin_state==0 ? false : true;
return pin_state_out==0 ? false : true;
}
EXPORT_SYMBOL(touch_gpio_get_irq_state);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment