/* * Simple gptimers example * http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:gptimers * * Copyright 2007-2009 Analog Devices Inc. * * Licensed under the GPL-2 or later. */ #include #include #include #include /* ... random driver includes ... */ #define DRIVER_NAME "gptimer_example" #ifdef IRQ_TIMER5 #define SAMPLE_IRQ_TIMER IRQ_TIMER5 #else #define SAMPLE_IRQ_TIMER IRQ_TIMER2 #endif struct gptimer_data { uint32_t period, width; }; static struct gptimer_data data; /* ... random driver state ... */ static irqreturn_t gptimer_example_irq(int irq, void *dev_id) { struct gptimer_data *data = dev_id; /* make sure it was our timer which caused the interrupt */ if (!get_gptimer_intr(TIMER5_id)) return IRQ_NONE; /* read the width/period values that were captured for the waveform */ data->width = get_gptimer_pwidth(TIMER5_id); data->period = get_gptimer_period(TIMER5_id); /* acknowledge the interrupt */ clear_gptimer_intr(TIMER5_id); /* tell the upper layers we took care of things */ return IRQ_HANDLED; } /* ... random driver code ... */ static int __init gptimer_example_init(void) { int ret; /* grab the peripheral pins */ ret = peripheral_request(P_TMR5, DRIVER_NAME); if (ret) { printk(KERN_NOTICE DRIVER_NAME ": peripheral request failed\n"); return ret; } /* grab the IRQ for the timer */ ret = request_irq(SAMPLE_IRQ_TIMER, gptimer_example_irq, IRQF_SHARED, DRIVER_NAME, &data); if (ret) { printk(KERN_NOTICE DRIVER_NAME ": IRQ request failed\n"); peripheral_free(P_TMR5); return ret; } /* setup the timer and enable it */ set_gptimer_config(TIMER5_id, WDTH_CAP | PULSE_HI | PERIOD_CNT | IRQ_ENA); enable_gptimers(TIMER5bit); return 0; } module_init(gptimer_example_init); static void __exit gptimer_example_exit(void) { disable_gptimers(TIMER5bit); free_irq(SAMPLE_IRQ_TIMER, &data); peripheral_free(P_TMR5); } module_exit(gptimer_example_exit); MODULE_LICENSE("BSD"); /linux/net-next.git/commit/sound/soc/codecs/da7218.h?h=nds-private-remove&id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>commitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-02-07 16:29:30 -0500
committerDavid S. Miller <davem@davemloft.net>2017-02-07 16:29:30 -0500
commit3efa70d78f218e4c9276b0bac0545e5184c1c47b (patch)
treef4abe2f05e173023d2a262afd4aebb1e89fe6985 /sound/soc/codecs/da7218.h
parent76e0e70e6452b971a69cc9794ff4a6715c11f7f2 (diff)
parent926af6273fc683cd98cd0ce7bf0d04a02eed6742 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
The conflict was an interaction between a bug fix in the netvsc driver in 'net' and an optimization of the RX path in 'net-next'. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'sound/soc/codecs/da7218.h')