2 #include <mach/board.h>
4 int port_output_init(unsigned int value, int on, char *name)
7 struct port_config port;
9 port = get_port_config(value);
10 ret = gpio_request(port.gpio, name);
13 if(port.io.pull_mode == PULL_MODE_DISABLE)
14 gpio_pull_updown(port.gpio, 0);
15 if(port.io.pull_mode == PULL_MODE_ENABLE)
16 gpio_pull_updown(port.gpio, 1);
17 #ifdef CONFIG_MACH_RK_FAC
18 //gpio_direction_output(port.gpio, (on)? !port.io.active_low: !!port.io.active_low);
20 gpio_direction_output(port.gpio, (on)? !port.io.active_low: !!port.io.active_low);
25 EXPORT_SYMBOL(port_output_init);
26 void port_output_on(unsigned int value)
28 struct port_config port;
30 port = get_port_config(value);
31 gpio_set_value(port.gpio, !port.io.active_low);
33 EXPORT_SYMBOL(port_output_on);
34 void port_output_off(unsigned int value)
36 struct port_config port;
38 port = get_port_config(value);
39 gpio_set_value(port.gpio, !!port.io.active_low);
41 EXPORT_SYMBOL(port_output_off);
42 void port_deinit(unsigned int value)
44 struct port_config port;
46 port = get_port_config(value);
49 EXPORT_SYMBOL(port_deinit);
50 int port_input_init(unsigned int value, char *name)
53 struct port_config port;
55 port = get_port_config(value);
56 ret = gpio_request(port.gpio, name);
59 if(port.io.pull_mode == PULL_MODE_DISABLE)
60 gpio_pull_updown(port.gpio, 0);
61 if(port.io.pull_mode == PULL_MODE_ENABLE)
62 gpio_pull_updown(port.gpio, 1);
63 gpio_direction_input(port.gpio);
67 EXPORT_SYMBOL(port_input_init);
68 int port_get_value(unsigned int value)
70 struct port_config port;
72 port = get_port_config(value);
73 return gpio_get_value(port.gpio);
75 EXPORT_SYMBOL(port_get_value);