From: "Azhar Mr." <shaik.azharuddin@yahoo.co.in>
To: linux-omap-open-source@linux.omap.com
Subject: OSK5912 GPIO
Date: Fri, 16 Nov 2007 11:59:42 +0000 (GMT) [thread overview]
Message-ID: <680885.35310.qm@web7613.mail.in.yahoo.com> (raw)
Hi,
I AM WORKING ON OMAP5912 OSK.
I am writing a keyboard based gpio program to write a value '1' to the free gpio pin when a key was pressed.
For that I modified the gpio-switch.c program. I am using the up arrow
key which is mapped to gpio7. By pressing this key I am able to write
a value '1' to the gpio pin 23.
At the shell prompt I am able to see a logic '1' value at gpio pin 23 with the following message
value of pin # 23 = 1
up (GPIO 7) is now disconnected
But through the Cathode Ray Oscilloscope I am unable to observe the GPIO pin 23 value as 1. There is no change in the Oscilloscope.
Here is my gpio-switch code
#define OMAP_GPIO_SW_POLL_DELAY 10
#define LED_GPIO 23
const struct omap_gpio_switch_config omap_left_switch = {
.name = "left",
.type = OMAP_GPIO_SWITCH_TYPE_CONNECTION,
.gpio = 6,
.flags = OMAP_GPIO_SWITCH_FLAG_INVERTED,
.key_code = KEY_LEFT
};
const struct omap_gpio_switch_config omap_enter_switch = {
.name = "enter",
.type = OMAP_GPIO_SWITCH_TYPE_CONNECTION,
.gpio = 12,
.flags = OMAP_GPIO_SWITCH_FLAG_INVERTED,
.key_code = KEY_ENTER
};
const struct omap_gpio_switch_config omap_up_switch = {
.name = "up",
.type = OMAP_GPIO_SWITCH_TYPE_CONNECTION,
.gpio = 7,
.flags = OMAP_GPIO_SWITCH_FLAG_INVERTED,
.key_code = KEY_UP
};
const struct omap_gpio_switch_config omap_down_switch = {
.name = "down",
.type = OMAP_GPIO_SWITCH_TYPE_CONNECTION,
.gpio = 15,
.flags = OMAP_GPIO_SWITCH_FLAG_INVERTED,
.key_code = KEY_DOWN
};
const struct omap_gpio_switch_config *omap_switches[] = {
&omap_left_switch,
&omap_enter_switch,
&omap_up_switch,
&omap_down_switch,
NULL /* Guard */
};
static void gpio_sw_handler(void *data)
{
struct gpio_switch *sw = data;
int state = gpio_sw_get_state(sw);
if (sw->state == state)
return;
if (sw->type == OMAP_GPIO_SWITCH_TYPE_CONNECTION)
kobject_uevent(&sw->pdev.dev.kobj, KOBJ_CHANGE,
&dev_attr_connection_switch.attr);
else
kobject_uevent(&sw->pdev.dev.kobj, KOBJ_CHANGE,
&dev_attr_cover_switch.attr);
sw->state = state;
input_report_key(&omap_sw_kp_dev, sw->key_code, state);
/*** [START]: code for writing some value to GPIO 17 ***/
if(sw->key_code==KEY_UP)
{
if(led_glow(sw))
printk(KERN_ERR "led_glow:failed ");
}
/*** [END]: code for writing some value to GPIO 17 ***/
static int led_glow(struct gpio_switch *ctrlsw)
{
/* requesting for LED_GPIO */
if(omap_request_gpio(LED_GPIO)<0)
return -1;
/* setting LED_GPIO as output pin */
omap_set_gpio_direction(LED_GPIO,0);
/* writing to LED_GPIO the state of KEY_UP */
omap_set_gpio_dataout(LED_GPIO,ctrlsw->state);
/* printing the value of led_gpio pin */
printk("value of pin # %d = %d\n",LED_GPIO,omap_get_gpio_datain(LED_GPIO));
return 0;
}
please suggest where I had gone wrong.
With Regards
Azharuddin, India
---------------------------------
5, 50, 500, 5000 - Store N number of mails in your inbox. Click here.
next reply other threads:[~2007-11-16 11:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-16 11:59 Azhar Mr. [this message]
2007-11-18 3:12 ` OSK5912 GPIO andrzej zaborowski
-- strict thread matches above, loose matches on Subject: below --
2007-11-20 13:20 Azhar Mr.
2007-11-20 14:03 ` Daniel Stone
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=680885.35310.qm@web7613.mail.in.yahoo.com \
--to=shaik.azharuddin@yahoo.co.in \
--cc=linux-omap-open-source@linux.omap.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox