From: lars@metafoo.de (Lars-Peter Clausen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 08/09] ARM: s3c2440: gta02: Request usb pullup pin before using it
Date: Mon, 07 Mar 2011 08:00:34 +0100 [thread overview]
Message-ID: <4D748292.7030302@metafoo.de> (raw)
In-Reply-To: <031101cbdc92$e6c44730$b44cd590$%kim@samsung.com>
On 03/07/2011 07:42 AM, Kukjin Kim wrote:
> Lars-Peter Clausen wrote:
>>
>> On 02/28/2011 11:44 AM, Kukjin Kim wrote:
>>> Lars-Peter Clausen wrote:
>>>>
>>>> On 02/28/2011 07:16 AM, Kukjin Kim wrote:
>>>>> Lars-Peter Clausen wrote:
>>>>>>
>>>>>> Request the gpio pin used to control the usb pullup before using it
> to
>>>>> avoid
>>>>>> a
>>>>>> runtime warning about an auto-requested gpio.
>>>>>>
>>>>>> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
>>>>>> ---
>>>>>> arch/arm/mach-s3c2440/mach-gta02.c | 17 +++++++++++++++--
>>>>>> 1 files changed, 15 insertions(+), 2 deletions(-)
>>>>>>
>>>>>> diff --git a/arch/arm/mach-s3c2440/mach-gta02.c
>>>>> b/arch/arm/mach-s3c2440/mach-
>>>>>> gta02.c
>>>>>> index 1396639..94456fa 100644
>>>>>> --- a/arch/arm/mach-s3c2440/mach-gta02.c
>>>>>> +++ b/arch/arm/mach-s3c2440/mach-gta02.c
>>>>>> @@ -451,11 +451,11 @@ static void gta02_udc_command(enum
>>> s3c2410_udc_cmd_e
>>>>>> cmd)
>>>>>> switch (cmd) {
>>>>>> case S3C2410_UDC_P_ENABLE:
>>>>>> pr_debug("%s S3C2410_UDC_P_ENABLE\n", __func__);
>>>>>> - gpio_direction_output(GTA02_GPIO_USB_PULLUP, 1);
>>>>>> + gpio_set_value(GTA02_GPIO_USB_PULLUP, 1);
>>>>>
>>>>> How about following instead?
>>>>> gpio_request(GTA02_GPIO_USB_PULLUP, "USB_PULLUP");
>>>>> gpio_direction_output(GTA02_GPIO_USB_PULLUP, 1);
>>>>> gpio_free(GTA02_GPIO_USB_PULLUP);
>>>>>
>>>>
>>>> I don't think that is a good idea. This gpio should really be reserved
> for
>>>> the
>>>> udc driver. If it is freed again, it could be requested from someone
> else
>>>> which
>>>> could lead to undefined behaviour.
>>>>
>>> Yes right, but I mean the board designer already knows the usage of
>>> regarding GPIOs on his board.
>>> So why do we really need gpio_request for it?...
>>
>> Well, for one because it's part of the gpio-api. You should not call any
>> other
>> gpio functions on a pin unless you've successfully requested that pin.
>> On the other hand this helps debugging and ensures that the same gpio is
> not
>> used by two drivers accident. For example it is also possible to request
>> gpios
>> from userspace using the gpio sysfs. So by keeping the gpio requested it
> wont
>> be possible to request it from userspace by accident. And the gpio will
> also
>> be
>> listed in the gpio debugfs file, which can be helpful for debugging as
> well.
>>
>> - Lars
>
> Hi Lars,
>
> Ok, will apply :)
> Thanks.
>
> Best regards,
> Kgene.
> --
> Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
> SW Solution Development Team, Samsung Electronics Co., Ltd.
>
Hi Kgene
Actually I've prepared another patch, which I'm was about to send in a few
minutes, which moves the controlling of the pullup pin to the udc driver.
- Lars
next prev parent reply other threads:[~2011-03-07 7:00 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-07 1:51 [PATCH 01/09] ARM: s3c2442: gta02: Fix usage gpio bank j pin definitions Lars-Peter Clausen
2011-02-07 1:51 ` [PATCH 02/09] ARM: s3c2440: gta02: Register PCM device Lars-Peter Clausen
2011-02-28 6:38 ` Kukjin Kim
2011-02-07 1:51 ` [PATCH 03/09] ARM: s3c2440: gta02: Add button support Lars-Peter Clausen
2011-02-28 6:37 ` Kukjin Kim
2011-02-07 1:51 ` [PATCH 04/09] ARM: s3c2440: gta02: Select missing S3C_DEV_USB_HOST Lars-Peter Clausen
2011-02-28 6:31 ` Kukjin Kim
2011-02-07 1:51 ` [PATCH 05/09] ARM: s3c2440: gta02: Fix regulator valid_modes_ops Lars-Peter Clausen
2011-02-28 6:48 ` Kukjin Kim
2011-02-07 1:51 ` [PATCH 06/09] ARM: s3c2440: gta02: Remove state_mem constraints for the pcf50633 regulators Lars-Peter Clausen
2011-02-28 6:26 ` Kukjin Kim
2011-02-28 10:28 ` Lars-Peter Clausen
2011-02-28 10:58 ` Kukjin Kim
2011-02-07 1:51 ` [PATCH 07/09] ARM: s3c2440: gta02: Call regulator_has_full_constraints Lars-Peter Clausen
2011-02-07 11:58 ` Mark Brown
2011-02-08 2:55 ` [PATCH v2 " Lars-Peter Clausen
2011-02-28 6:47 ` Kukjin Kim
2011-02-07 1:52 ` [PATCH 08/09] ARM: s3c2440: gta02: Request usb pullup pin before using it Lars-Peter Clausen
2011-02-28 6:16 ` Kukjin Kim
2011-02-28 10:25 ` Lars-Peter Clausen
2011-02-28 10:44 ` Kukjin Kim
2011-02-28 10:58 ` Lars-Peter Clausen
2011-03-07 6:42 ` Kukjin Kim
2011-03-07 7:00 ` Lars-Peter Clausen [this message]
2011-02-07 1:52 ` [PATCH 09/09] ARM: s3c2440: gta02: Add touchscreen support Lars-Peter Clausen
2011-02-28 6:04 ` Kukjin Kim
2011-02-28 10:44 ` Lars-Peter Clausen
2011-02-28 10:57 ` Kukjin Kim
2011-02-28 11:17 ` [PATCH v2 " Lars-Peter Clausen
2011-02-28 11:56 ` Kukjin Kim
2011-02-18 10:41 ` [PATCH 01/09] ARM: s3c2442: gta02: Fix usage gpio bank j pin definitions Lars-Peter Clausen
2011-02-21 9:58 ` Kukjin Kim
2011-02-28 6:41 ` Kukjin Kim
2011-02-28 10:46 ` Lars-Peter Clausen
2011-02-28 10:49 ` Kukjin Kim
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=4D748292.7030302@metafoo.de \
--to=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).