From: "Frank Schäfer" <fschaefer.oss@googlemail.com>
To: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH 1/3] em28xx: give up GPIO register tracking/caching
Date: Sat, 13 Apr 2013 17:33:28 +0200 [thread overview]
Message-ID: <51697AC8.1050807@googlemail.com> (raw)
In-Reply-To: <20130413114144.097a21a1@redhat.com>
Am 13.04.2013 16:41, schrieb Mauro Carvalho Chehab:
> Em Sat, 13 Apr 2013 11:48:39 +0200
> Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:
>
>> The GPIO register tracking/caching code is partially broken, because newer
>> devices provide more than one GPIO register and some of them are even using
>> separate registers for read and write access.
>> Making it work would be too complicated.
>> It is also used nowhere and doesn't make sense in cases where input lines are
>> connected to buttons etc.
>>
>> Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
>> ---
>> drivers/media/usb/em28xx/em28xx-cards.c | 12 ------------
>> drivers/media/usb/em28xx/em28xx-core.c | 27 ++-------------------------
>> drivers/media/usb/em28xx/em28xx.h | 6 ------
>> 3 Dateien geändert, 2 Zeilen hinzugefügt(+), 43 Zeilen entfernt(-)
> ...
>
>
>> @@ -231,14 +215,7 @@ int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val,
>> int oldval;
>> u8 newval;
>>
>> - /* Uses cache for gpo/gpio registers */
>> - if (reg == dev->reg_gpo_num)
>> - oldval = dev->reg_gpo;
>> - else if (reg == dev->reg_gpio_num)
>> - oldval = dev->reg_gpio;
>> - else
>> - oldval = em28xx_read_reg(dev, reg);
>> -
>> + oldval = em28xx_read_reg(dev, reg);
>> if (oldval < 0)
>> return oldval;
> That's plain wrong, as it will break GPIO input.
>
> With GPIO, you can write either 0 or 1 to a GPIO output port. So, your
> code works for output ports.
>
> However, an input port requires an specific value (either 1 or 0 depending
> on the GPIO circuitry). If the wrong value is written there, the input port
> will stop working.
>
> So, you can't simply read a value from a GPIO input and write it. You need
> to shadow the GPIO write values instead.
I don't understand what you mean.
Why can I not read the value of a GPIO input and write it ?
Regards,
Frank
> Regards,
> Mauro
next prev parent reply other threads:[~2013-04-13 15:32 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-13 9:48 [PATCH 0/3] em28xx: clean up end extend the GPIO port handling Frank Schäfer
2013-04-13 9:48 ` [PATCH 1/3] em28xx: give up GPIO register tracking/caching Frank Schäfer
2013-04-13 14:41 ` Mauro Carvalho Chehab
2013-04-13 15:33 ` Frank Schäfer [this message]
2013-04-13 17:04 ` Mauro Carvalho Chehab
2013-04-13 17:46 ` Frank Schäfer
2013-04-13 18:08 ` Mauro Carvalho Chehab
2013-04-14 20:35 ` Frank Schäfer
2013-04-15 12:51 ` Mauro Carvalho Chehab
2013-04-15 14:11 ` Antti Palosaari
2013-04-15 16:26 ` Frank Schäfer
2013-04-15 23:01 ` Mauro Carvalho Chehab
2013-04-23 16:58 ` Frank Schäfer
2013-04-13 18:19 ` Frank Schäfer
2013-04-13 18:41 ` Frank Schäfer
2013-04-13 9:48 ` [PATCH 2/3] em28xx: add register defines for em25xx/em276x/7x/8x GPIO registers Frank Schäfer
2013-04-13 9:48 ` [PATCH 3/3] em28xx: add helper function for handling the GPIO registers of newer devices Frank Schäfer
2013-04-13 13:15 ` [PATCH 0/3] em28xx: clean up end extend the GPIO port handling Antti Palosaari
2013-04-13 14:25 ` Mauro Carvalho Chehab
2013-04-13 14:37 ` Antti Palosaari
2013-04-14 1:32 ` Mauro Carvalho Chehab
2013-04-14 19:32 ` Antti Palosaari
2013-04-15 14:40 ` Mauro Carvalho Chehab
2013-04-13 15:30 ` Frank Schäfer
2013-04-13 15:34 ` Devin Heitmueller
2013-04-13 16:21 ` Antti Palosaari
2013-04-13 16:54 ` Devin Heitmueller
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=51697AC8.1050807@googlemail.com \
--to=fschaefer.oss@googlemail.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@redhat.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;
as well as URLs for NNTP newsgroup(s).