aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
Commit message (Expand)AuthorAge
* [NET]: kill gratitious includes of major.hAl Viro2005-04-26
* [TCP]: Trivial tcp_data_queue() cleanupJames Morris2005-04-26
* [NETFILTER]: Drop conntrack reference when packet leaves IPPatrick McHardy2005-04-25
* [NETFILTER]: Fix truncated sequence numbers in FTP helperYasuyuki KOZAKAI2005-04-25
* [TCP]: skb pcount with MTU discoveryDavid S. Miller2005-04-24
* [NETFILTER]: Ignore PSH on SYN/ACK in TCP connection trackingPatrick McHardy2005-04-24
* [NETFILTER]: Fix NAT sequence number adjustmentPatrick McHardy2005-04-24
* [IPSEC]: COW skb header in UDP decapHerbert Xu2005-04-20
* [NET]: skbuff: remove old NET_CALLER macroStephen Hemminger2005-04-20
* Linux-2.6.12-rc2v2.6.12-rc2Linus Torvalds2005-04-16
.git/commit/arch/arm/mach-s3c2410/h1940-bluetooth.c?h=v2.6.33.1&id=7fdc7849d2f9f926cbaec224bbcbacb164b07b23'>7fdc7849d2f9
7fdc7849d2f9



070276d5d049
7fdc7849d2f9
070276d5d049
7fdc7849d2f9

070276d5d049
7fdc7849d2f9
070276d5d049
7fdc7849d2f9

7fdc7849d2f9


1a71e4ade19d
7fdc7849d2f9
1a71e4ade19d

7fdc7849d2f9

1a71e4ade19d


7fdc7849d2f9


1a71e4ade19d


7fdc7849d2f9
070276d5d049







7fdc7849d2f9
7fdc7849d2f9
1a71e4ade19d















7fdc7849d2f9
1a71e4ade19d



7fdc7849d2f9



1a71e4ade19d











7fdc7849d2f9




























1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140

















                                                                             
                       
                         
 


                             


                                        



                                  



                                                                    
                                                       
                           
                                                       

              
                                                       
                           
                                                       

                                                                    


         
                                                      
 

                                 

 


                                                     


                                                             


                           
                                             







                                                                 
 
 















                                                                       
 



                            



                                                       











                                                        




























                                                               
/*
 * arch/arm/mach-s3c2410/h1940-bluetooth.c
 * Copyright (c) Arnaud Patard <arnaud.patard@rtp-net.org>
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file COPYING in the main directory of this archive for
 * more details.
 *
 *	    S3C2410 bluetooth "driver"
 *
 */

#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/delay.h>
#include <linux/string.h>
#include <linux/ctype.h>
#include <linux/leds.h>
#include <linux/gpio.h>
#include <linux/rfkill.h>

#include <mach/regs-gpio.h>
#include <mach/hardware.h>
#include <mach/h1940-latch.h>

#define DRV_NAME              "h1940-bt"

/* Bluetooth control */
static void h1940bt_enable(int on)
{
	if (on) {
		/* Power on the chip */
		h1940_latch_control(0, H1940_LATCH_BLUETOOTH_POWER);
		/* Reset the chip */
		mdelay(10);
		s3c2410_gpio_setpin(S3C2410_GPH(1), 1);
		mdelay(10);
		s3c2410_gpio_setpin(S3C2410_GPH(1), 0);
	}
	else {
		s3c2410_gpio_setpin(S3C2410_GPH(1), 1);
		mdelay(10);
		s3c2410_gpio_setpin(S3C2410_GPH(1), 0);
		mdelay(10);
		h1940_latch_control(H1940_LATCH_BLUETOOTH_POWER, 0);
	}
}

static int h1940bt_set_block(void *data, bool blocked)
{
	h1940bt_enable(!blocked);
	return 0;
}

static const struct rfkill_ops h1940bt_rfkill_ops = {
	.set_block = h1940bt_set_block,
};

static int __init h1940bt_probe(struct platform_device *pdev)
{
	struct rfkill *rfk;
	int ret = 0;

	/* Configures BT serial port GPIOs */
	s3c2410_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0);
	s3c2410_gpio_pullup(S3C2410_GPH(0), 1);
	s3c2410_gpio_cfgpin(S3C2410_GPH(1), S3C2410_GPIO_OUTPUT);
	s3c2410_gpio_pullup(S3C2410_GPH(1), 1);
	s3c2410_gpio_cfgpin(S3C2410_GPH(2), S3C2410_GPH2_TXD0);
	s3c2410_gpio_pullup(S3C2410_GPH(2), 1);
	s3c2410_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0);
	s3c2410_gpio_pullup(S3C2410_GPH(3), 1);


	rfk = rfkill_alloc(DRV_NAME, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
			&h1940bt_rfkill_ops, NULL);
	if (!rfk) {
		ret = -ENOMEM;
		goto err_rfk_alloc;
	}

	rfkill_set_led_trigger_name(rfk, "h1940-bluetooth");

	ret = rfkill_register(rfk);
	if (ret)
		goto err_rfkill;

	platform_set_drvdata(pdev, rfk);

	return 0;

err_rfkill:
	rfkill_destroy(rfk);
err_rfk_alloc:
	return ret;
}

static int h1940bt_remove(struct platform_device *pdev)
{
	struct rfkill *rfk = platform_get_drvdata(pdev);

	platform_set_drvdata(pdev, NULL);

	if (rfk) {
		rfkill_unregister(rfk);
		rfkill_destroy(rfk);
	}
	rfk = NULL;

	h1940bt_enable(0);

	return 0;
}


static struct platform_driver h1940bt_driver = {
	.driver		= {
		.name	= DRV_NAME,
	},
	.probe		= h1940bt_probe,
	.remove		= h1940bt_remove,
};


static int __init h1940bt_init(void)
{
	return platform_driver_register(&h1940bt_driver);
}

static void __exit h1940bt_exit(void)
{
	platform_driver_unregister(&h1940bt_driver);
}

module_init(h1940bt_init);
module_exit(h1940bt_exit);

MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>");
MODULE_DESCRIPTION("Driver for the iPAQ H1940 bluetooth chip");
MODULE_LICENSE("GPL");