[lkml]   [2011]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH 1/3] gpiolib: Add ability to get GPIO pin direction
    > What is the use-case for alt_func?  From the point of view of a GPIO
    > driver, I don't think it cares if the pin has been dedicated to

    Currently it doesn't.

    However the moment it starts setting input and output itself on requests
    then it does because it may kick the pin out of alt_func mode when you
    merely want to request it so you know which pin to stick into alt_func
    mode, or to find a mapping. The current situation is an "ignorance is
    bliss" one, but making it smarter backfires. We have the same problem
    with unknown state - if I have a set of pins some of whose state is known
    at boot time then I can't now provide a get_direction interface because
    of the lack of states. At the very least we need input/output/godknows
    where the latter means the gpio_request code keeps its nose out.


    is simply the wrong order for a resource.

    The second problem is that in many cases you need to call gpio_request to
    know you have the pin yourself before you can set the direction. That
    means forcing the direction in gpio_request is daft - you force an
    undefined value that cannot yet safely be set in all cases.

    At the moment the lack of alt_func also has some strange effects and you
    end up with code like

    /* Reserve the line for alt_func use for the moment */
    gpio_request(GPIO_FOO, "blah");
    do stuff();

    /* Now available again for its normal GPIO use */

    and that means you can't generalise dynamic access to a shared GPIO pin
    without extra hardcoded knowledge.

    In the case of a fixed pin its easy as you can either a) not register it
    or b) just gpio_request it at boot and whack it in arch code, but if you
    want to go beyond that it gets interesting.


     \ /
      Last update: 2011-02-14 20:33    [W:0.021 / U:4.292 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site