diff options
author | Shuah Khan <shuahkh@osg.samsung.com> | 2016-10-06 18:00:50 -0400 |
---|---|---|
committer | Shuah Khan <shuahkh@osg.samsung.com> | 2016-10-10 09:12:02 -0400 |
commit | 184892925118d924aa9304b466946ae18c029932 (patch) | |
tree | 59b5e82d76e4095c8ab3b47055f9277cdabb303a /samples | |
parent | a67cd5482f37a255b9990ddb942aa7009dcba12f (diff) |
samples: move blackfin gptimers-example from Documentation
Move blackfin gptimers-example to samples and remove it from Documentation
Makefile. Update samples Kconfig and Makefile to build gptimers-example.
blackfin is the last CONFIG_BUILD_DOCSRC target in Documentation/Makefile.
Hence this patch also includes changes to remove CONFIG_BUILD_DOCSRC from
Makefile and lib/Kconfig.debug and updates VIDEO_PCI_SKELETON dependency
on BUILD_DOCSRC.
Documentation/Makefile is not deleted to avoid braking make htmldocs and
make distclean.
Acked-by: Michal Marek <mmarek@suse.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reported-by: Valentin Rothberg <valentinrothberg@gmail.com>
Reported-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Diffstat (limited to 'samples')
-rw-r--r-- | samples/Kconfig | 6 | ||||
-rw-r--r-- | samples/Makefile | 2 | ||||
-rw-r--r-- | samples/blackfin/Makefile | 1 | ||||
-rw-r--r-- | samples/blackfin/gptimers-example.c | 91 |
4 files changed, 99 insertions, 1 deletions
diff --git a/samples/Kconfig b/samples/Kconfig index 85c405fcccb0..a6d2a43bbf2e 100644 --- a/samples/Kconfig +++ b/samples/Kconfig | |||
@@ -99,4 +99,10 @@ config SAMPLE_SECCOMP | |||
99 | Build samples of seccomp filters using various methods of | 99 | Build samples of seccomp filters using various methods of |
100 | BPF filter construction. | 100 | BPF filter construction. |
101 | 101 | ||
102 | config SAMPLE_BLACKFIN_GPTIMERS | ||
103 | tristate "Build blackfin gptimers sample code -- loadable modules only" | ||
104 | depends on BLACKFIN && BFIN_GPTIMERS && m | ||
105 | help | ||
106 | Build samples of blackfin gptimers sample module. | ||
107 | |||
102 | endif # SAMPLES | 108 | endif # SAMPLES |
diff --git a/samples/Makefile b/samples/Makefile index 1a20169d85ac..e17d66d77f09 100644 --- a/samples/Makefile +++ b/samples/Makefile | |||
@@ -2,4 +2,4 @@ | |||
2 | 2 | ||
3 | obj-$(CONFIG_SAMPLES) += kobject/ kprobes/ trace_events/ livepatch/ \ | 3 | obj-$(CONFIG_SAMPLES) += kobject/ kprobes/ trace_events/ livepatch/ \ |
4 | hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \ | 4 | hw_breakpoint/ kfifo/ kdb/ hidraw/ rpmsg/ seccomp/ \ |
5 | configfs/ connector/ v4l/ trace_printk/ | 5 | configfs/ connector/ v4l/ trace_printk/ blackfin/ |
diff --git a/samples/blackfin/Makefile b/samples/blackfin/Makefile new file mode 100644 index 000000000000..89b86cfd83a2 --- /dev/null +++ b/samples/blackfin/Makefile | |||
@@ -0,0 +1 @@ | |||
obj-$(CONFIG_SAMPLE_BLACKFIN_GPTIMERS) += gptimers-example.o | |||
diff --git a/samples/blackfin/gptimers-example.c b/samples/blackfin/gptimers-example.c new file mode 100644 index 000000000000..283eba993d9d --- /dev/null +++ b/samples/blackfin/gptimers-example.c | |||
@@ -0,0 +1,91 @@ | |||
1 | /* | ||
2 | * Simple gptimers example | ||
3 | * http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:gptimers | ||
4 | * | ||
5 | * Copyright 2007-2009 Analog Devices Inc. | ||
6 | * | ||
7 | * Licensed under the GPL-2 or later. | ||
8 | */ | ||
9 | |||
10 | #include <linux/interrupt.h> | ||
11 | #include <linux/module.h> | ||
12 | |||
13 | #include <asm/gptimers.h> | ||
14 | #include <asm/portmux.h> | ||
15 | |||
16 | /* ... random driver includes ... */ | ||
17 | |||
18 | #define DRIVER_NAME "gptimer_example" | ||
19 | |||
20 | #ifdef IRQ_TIMER5 | ||
21 | #define SAMPLE_IRQ_TIMER IRQ_TIMER5 | ||
22 | #else | ||
23 | #define SAMPLE_IRQ_TIMER IRQ_TIMER2 | ||
24 | #endif | ||
25 | |||
26 | struct gptimer_data { | ||
27 | uint32_t period, width; | ||
28 | }; | ||
29 | static struct gptimer_data data; | ||
30 | |||
31 | /* ... random driver state ... */ | ||
32 | |||
33 | static irqreturn_t gptimer_example_irq(int irq, void *dev_id) | ||
34 | { | ||
35 | struct gptimer_data *data = dev_id; | ||
36 | |||
37 | /* make sure it was our timer which caused the interrupt */ | ||
38 | if (!get_gptimer_intr(TIMER5_id)) | ||
39 | return IRQ_NONE; | ||
40 | |||
41 | /* read the width/period values that were captured for the waveform */ | ||
42 | data->width = get_gptimer_pwidth(TIMER5_id); | ||
43 | data->period = get_gptimer_period(TIMER5_id); | ||
44 | |||
45 | /* acknowledge the interrupt */ | ||
46 | clear_gptimer_intr(TIMER5_id); | ||
47 | |||
48 | /* tell the upper layers we took care of things */ | ||
49 | return IRQ_HANDLED; | ||
50 | } | ||
51 | |||
52 | /* ... random driver code ... */ | ||
53 | |||
54 | static int __init gptimer_example_init(void) | ||
55 | { | ||
56 | int ret; | ||
57 | |||
58 | /* grab the peripheral pins */ | ||
59 | ret = peripheral_request(P_TMR5, DRIVER_NAME); | ||
60 | if (ret) { | ||
61 | printk(KERN_NOTICE DRIVER_NAME ": peripheral request failed\n"); | ||
62 | return ret; | ||
63 | } | ||
64 | |||
65 | /* grab the IRQ for the timer */ | ||
66 | ret = request_irq(SAMPLE_IRQ_TIMER, gptimer_example_irq, | ||
67 | IRQF_SHARED, DRIVER_NAME, &data); | ||
68 | if (ret) { | ||
69 | printk(KERN_NOTICE DRIVER_NAME ": IRQ request failed\n"); | ||
70 | peripheral_free(P_TMR5); | ||
71 | return ret; | ||
72 | } | ||
73 | |||
74 | /* setup the timer and enable it */ | ||
75 | set_gptimer_config(TIMER5_id, | ||
76 | WDTH_CAP | PULSE_HI | PERIOD_CNT | IRQ_ENA); | ||
77 | enable_gptimers(TIMER5bit); | ||
78 | |||
79 | return 0; | ||
80 | } | ||
81 | module_init(gptimer_example_init); | ||
82 | |||
83 | static void __exit gptimer_example_exit(void) | ||
84 | { | ||
85 | disable_gptimers(TIMER5bit); | ||
86 | free_irq(SAMPLE_IRQ_TIMER, &data); | ||
87 | peripheral_free(P_TMR5); | ||
88 | } | ||
89 | module_exit(gptimer_example_exit); | ||
90 | |||
91 | MODULE_LICENSE("BSD"); | ||