Skip to content
Snippets Groups Projects
Select Git revision
  • 6e15cda270a060cf87c6c643a1cc3da65ffb242d
  • ex400 default
  • airoha-for-upstream
  • airoha-for-upstream-en7523
  • iop-mediatek-20250604
  • ubi-fastmap
  • add-dtb-rescan
  • agnau-blorgoda
  • agnau-scratch
  • mediatek-20250604
  • iop-mediatek-20250304
  • iop-mediatek-20250304-loc
  • agnau-mtk-back
  • iop-mediatek-20250304-back
  • iop-mediatek-20220630
  • jani-multi-dtb
  • jani-multi-dtb-spl
  • mediatek-20220630
  • iop-mediatek-20220606
  • jani-env-update-mtk
  • jani-env-update-mtk-txt
  • jani-iop-20220606
  • v2025.10-rc4
  • v2025.10-rc3
  • v2025.10-rc2
  • v2025.10-rc1
  • v2025.07
  • v2025.07-rc5
  • v2025.07-rc4
  • v2025.07-rc3
  • v2025.07-rc2
  • v2025.07-rc1
  • v2025.04
  • v2025.04-rc5
  • v2025.04-rc4
  • v2025.04-rc3
  • v2025.04-rc2
  • v2025.04-rc1
  • v2025.01
  • v2025.01-rc6
  • v2025.01-rc5
  • v2025.01-rc4
42 results

README.gpio

Blame
  • user avatar
    Patrick Delaunay authored and Tom Rini committed
    Update the binding file for gpio, it is just an alignment
    with kernel v5.3.
    The U-Boot code example for gpio-hog (not directly linked
    to binding) is moved in a new file doc/README.gpio.
    [commit 21676b706e99 ("gpio: fixes for gpio-hog support")
    & 'commit 4762a9988ede ("gpio: add gpio-hog support")']
    
    Signed-off-by: default avatarPatrick Delaunay <patrick.delaunay@st.com>
    Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
    6a0388c5
    History
    README.gpio 1.10 KiB
    
    GPIO hog (CONFIG_GPIO_HOG)
    --------
    
    All the GPIO hog are initialized in gpio_hog_probe_all() function called in
    board_r.c just before board_late_init() but you can also acces directly to
    the gpio with gpio_hog_lookup_name().
    
    
    Example, for the device tree:
    
            tca6416@20 {
                    compatible = "ti,tca6416";
                    reg = <0x20>;
                    #gpio-cells = <2>;
                    gpio-controller;
    
                    env_reset {
                            gpio-hog;
                            input;
                            gpios = <6 GPIO_ACTIVE_LOW>;
                    };
                    boot_rescue {
                            gpio-hog;
                            input;
                            line-name = "foo-bar-gpio";
                            gpios = <7 GPIO_ACTIVE_LOW>;
                    };
            };
    
    You can than access the gpio in your board code with:
    
    	struct gpio_desc *desc;
    	int ret;
    
    	ret = gpio_hog_lookup_name("boot_rescue", &desc);
    	if (ret)
    		return;
    	if (dm_gpio_get_value(desc) == 1)
    		printf("\nBooting into Rescue System\n");
    	else if (dm_gpio_get_value(desc) == 0)
    		printf("\nBoot normal\n");