1 From 5be7f629cff94bd67ba7d95c800763a9026708f2 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Wed, 6 Aug 2008 12:16:38 +0100
4 Subject: [PATCH] fix-hdq-probe.patch
6 Signed-off-by: Andy Green <andy@openmoko.com>
8 arch/arm/mach-s3c2440/mach-gta02.c | 9 ++++-----
9 drivers/power/gta02_hdq.c | 22 ++++++++++++++++------
10 2 files changed, 20 insertions(+), 11 deletions(-)
12 diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
13 index be2d901..aeedd42 100644
14 --- a/arch/arm/mach-s3c2440/mach-gta02.c
15 +++ b/arch/arm/mach-s3c2440/mach-gta02.c
17 #include <linux/spi/glamo.h>
18 #include <linux/spi/spi_bitbang.h>
19 #include <linux/mmc/host.h>
20 +#include <linux/version.h>
22 #include <linux/mtd/mtd.h>
23 #include <linux/mtd/nand.h>
24 @@ -111,8 +112,7 @@ static int gta02_charger_active_status;
26 struct fiq_ipc fiq_ipc;
27 EXPORT_SYMBOL(fiq_ipc);
29 -#define DIVISOR_FROM_US(x) ((x) << 1)
30 +#define DIVISOR_FROM_US(x) ((x) << 3)
32 #define FIQ_DIVISOR_VIBRATOR DIVISOR_FROM_US(100)
34 @@ -184,9 +184,9 @@ FIQ_HANDLER_ENTRY(256, 512)
36 hdq_ctr = 50 / HDQ_SAMPLE_PERIOD_US;
38 - hdq_ctr = 120 / HDQ_SAMPLE_PERIOD_US;
39 + hdq_ctr = 140 / HDQ_SAMPLE_PERIOD_US;
40 /* carefully precompute the other phase length */
41 - hdq_ctr2 = (210 - (hdq_ctr * HDQ_SAMPLE_PERIOD_US)) /
42 + hdq_ctr2 = (220 - (hdq_ctr * HDQ_SAMPLE_PERIOD_US)) /
44 hdq_state = HDQB_ADS_LOW;
46 @@ -782,7 +782,6 @@ struct platform_device gta02_hdq_device = {
53 #define GTA02_FLASH_BASE 0x18000000 /* GCS3 */
54 diff --git a/drivers/power/gta02_hdq.c b/drivers/power/gta02_hdq.c
55 index 5a79fd6..6c228b4 100644
56 --- a/drivers/power/gta02_hdq.c
57 +++ b/drivers/power/gta02_hdq.c
58 @@ -40,7 +40,7 @@ int gta02hdq_read(int address)
59 mutex_lock(&fiq_ipc.hdq_lock);
61 fiq_ipc.hdq_ads = address | HDQ_READ;
62 - fiq_ipc.hdq_request_ctr++;
63 + fiq_ipc.hdq_request_ctr = fiq_ipc.hdq_transaction_ctr + 1;
66 * FIQ takes care of it while we block our calling process
67 @@ -53,9 +53,13 @@ int gta02hdq_read(int address)
68 if (fiq_ipc.hdq_request_ctr != fiq_ipc.hdq_transaction_ctr)
71 - if (fiq_ipc.hdq_error)
72 + if (fiq_ipc.hdq_error) {
73 + printk(KERN_ERR "hdq timeout %d, %d / %d\n",
74 + fiq_ipc.hdq_error, fiq_ipc.hdq_request_ctr,
75 + fiq_ipc.hdq_transaction_ctr);
76 goto done; /* didn't see a response in good time */
80 ret = fiq_ipc.hdq_rx_data;
83 @@ -193,12 +197,18 @@ static int __init gta02hdq_probe(struct platform_device *pdev)
85 struct resource *r = platform_get_resource(pdev, 0, 0);
87 - if (!machine_is_neo1973_gta02())
88 + printk(KERN_ERR "gta02hdq driver starting\n");
90 + if (!machine_is_neo1973_gta02()) {
91 + printk(KERN_ERR "gta02hdq_probe only for GTA02\n");
97 + printk(KERN_ERR "gta02hdq_probe missing resource for GPIO\n");
102 platform_set_drvdata(pdev, NULL);
104 mutex_init(&fiq_ipc.hdq_lock);