Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1554613
| From | Linus Walleij <linus.walleij@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 3/3] power: supply: bq24735-charger: allow chargers to share the ac-detect gpio |
| Date | 2017-01-09 20:00 +0100 |
| Message-ID | <sXNkJ-7O3-11@gated-at.bofh.it> (permalink) |
| References | (2 earlier) <sOl4l-mI-1@gated-at.bofh.it> <sOle1-F7-11@gated-at.bofh.it> <sU06R-1qk-3@gated-at.bofh.it> <sU06R-1qk-1@gated-at.bofh.it> <sXNkK-7O3-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Jan 2, 2017 at 9:31 AM, Peter Rosin <peda@axentia.se> wrote: > On 2016-12-30 08:49, Linus Walleij wrote: >> On Wed, Dec 14, 2016 at 6:41 PM, Peter Rosin <peda@axentia.se> wrote: >>> On 2016-12-14 18:01, Sebastian Reichel wrote: >>>> [of course I forgot to actually add gpio people, let's try again] >>>> >>>> On Wed, Dec 14, 2016 at 05:59:21PM +0100, Sebastian Reichel wrote: >>>>> Hi, >>>>> >>>>> On Wed, Dec 14, 2016 at 12:56:45AM +0100, Peter Rosin wrote: >>>>>> If several parallel bq24735 chargers have their ac-detect gpios wired >>>>>> together (or if only one of the parallel bq24735 chargers have its >>>>>> ac-detect pin wired to a gpio, and the others are assumed to react the >>>>>> same), then all driver instances need to check the same gpio. But the >>>>>> gpio subsystem does not allow sharing gpios, so handle that locally. >>>>> >>>>> Adding GPIO subsystem people to see if they can come up with >>>>> something in the gpiod API for this usecase. >>> >>> Right, I don't like how my new code steps away from gpio descriptors. >> >> The issue of shared gpiods have come up over and over again. >> For example the messy regulator code needs this too. >> >> It is better if we implement something like gpiod_get_shared() >> in the gpiolib of these cases. >> >> Just put a refcount in struct gpio_desc in drivers/gpio/gpiolib.h >> for this case I guess? > > I actually tried that, but ran into atomicy issues with the > FLAG_REQUESTED bit and gave up. Didn't really try all that hard > though, but I simply didn't feel comfortable with going near such > fundamental designs... Oh I see. Well if it is of any help that would make me nervous too. I would just remove the use of FLAG_REQUESTED altogether, redefine the flags in gpiolib.h from 0 and add a struct kref into the struct to deal with the refcounting. That should do it. I think. Yours, Linus Walleij
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [PATCH v2 3/3] power: supply: bq24735-charger: allow chargers to share the ac-detect gpio Linus Walleij <linus.walleij@linaro.org> - 2017-01-09 20:00 +0100
csiph-web