disable IMQ on 2.6.28 as well -- people should use IFB..
[openwrt/svn-archive/archive.git] / target / linux / s3c24xx / patches / 0077-introduce-fiq-hdq.patch.patch
1 From 46f0b99a7b0e52e8dee4cdfe2e3599814f0388ed Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Fri, 25 Jul 2008 23:06:00 +0100
4 Subject: [PATCH] introduce-fiq-hdq.patch
5
6 This adds a platform driver and device which performs HDQ
7 battery protocol using a single GPIO pin which is set
8 through platform data.
9
10 HDQ has some hard latency requirements which can't
11 be met if interrupts are enabled, so normally using
12 a GPIO for this will require blocking out all other
13 interrupts and processes for several milliseconds
14 per register being read or written.
15
16 This HDQ protocol engine is a FSM implemented inside the
17 the FIQ ISR and regulated by timer interrupts happening
18 at 20us intervals. The path through the FSM on any
19 "clock" is very short and should be over with in ~
20 1us. Because FIQ has guaranteed latencies of <1us,
21 it means we can service the HDQ protocol without
22 blocking interrupts or any other process other than
23 the caller that is waiting for the result. It's pretty
24 cool performance from 1 GPIO ;-)
25
26 Due to it being hard to do locking from the FIQ ISR
27 the code simply sleeps 10ms or whatever the scheduler
28 gives it and checks if the transfer took place yet.
29
30 This platform driver doesn't have any knowledge about
31 the device it is talking to, it just knows it is a
32 HDQ device. It exports three functions for read, write
33 and confirming HDQ is initialized. It also exports two
34 /sys nodes that are usable by humans, one dumps the whole
35 127 register HDQ register space
36
37 # cat /sys/devices/platform/gta02-hdq.0/hdq/dump
38 00 44 55 00 00 00 ba 04 a2 0d 50 00 00 00 00 00
39 00 00 9a 1a 00 00 ff ff ff ff 29 00 00 00 80 2b
40 00 00 00 00 00 00 ff ff 00 00 00 00 00 32 af 06
41 a0 d8 37 4e 00 00 00 00 00 00 00 34 2e 03 b4 e7
42 00 00 06 00 41 00 4c 02 00 00 00 00 00 00 00 00
43 83 02 00 00 94 09 59 b9 a5 0d 7f 21 00 00 7a ff
44 df ff 62 ff a7 04 2e 05 00 00 00 01 00 07 00 00
45 2a 78 36 67 7b b5 1b a9 af 19 38 89 63 57 42 7c
46 #
47
48 and the other allows to set one register
49
50 # echo 2 170 > /sys/devices/platform/gta02-hdq.0/hdq/write
51
52 writes 0xAA into register 2.
53
54 Signed-off-by: Andy Green <andy@openmoko.com>
55 ---
56 defconfig-2.6.24 | 1 +
57 drivers/power/Kconfig | 8 ++++++++
58 2 files changed, 9 insertions(+), 0 deletions(-)
59
60 diff --git a/defconfig-2.6.24 b/defconfig-2.6.24
61 index 833e15e..6d750a5 100644
62 --- a/defconfig-2.6.24
63 +++ b/defconfig-2.6.24
64 @@ -1825,3 +1825,4 @@ CONFIG_TEXTSEARCH_FSM=m
65 CONFIG_PLIST=y
66 CONFIG_HAS_IOMEM=y
67 CONFIG_HAS_DMA=y
68 +CONFIG_GTA02_HDQ=y
69 diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
70 index feb8b0a..5ace872 100644
71 --- a/drivers/power/Kconfig
72 +++ b/drivers/power/Kconfig
73 @@ -63,3 +63,11 @@ config GTA02_HDQ
74 at least BATTERY_BQ27000_HDQ as well
75
76 endif # POWER_SUPPLY
77 +
78 +config GTA02_HDQ
79 + tristate "Neo Freerunner HDQ"
80 + depends on MACH_NEO1973_GTA02 && FIQ && S3C2440_C_FIQ
81 + help
82 + Say Y to enable support for communicating with an HDQ battery
83 + on the Neo Freerunner. You probably want to select
84 + at least BATTERY_BQ27000_HDQ as well
85 --
86 1.5.6.3
87