/home/ysy/linux/IMX6ULL/linux/linux-imx-rel_imx_4.1.15_2.1.0_ga/include/linux/gpio/consumer.h
staticinlineintgpiod_get_direction(conststructgpio_desc*desc){/* GPIO can never have been requested */WARN_ON(1);return-ENOSYS;}staticinlineintgpiod_direction_input(structgpio_desc*desc){/* GPIO can never have been requested */WARN_ON(1);return-ENOSYS;}staticinlineintgpiod_direction_output(structgpio_desc*desc,int value){/* GPIO can never have been requested */WARN_ON(1);return-ENOSYS;}staticinlineintgpiod_direction_output_raw(structgpio_desc*desc,int value){/* GPIO can never have been requested */WARN_ON(1);return-ENOSYS;}staticinlineintgpiod_get_value(conststructgpio_desc*desc){/* GPIO can never have been requested */WARN_ON(1);return0;}staticinlinevoidgpiod_set_value(structgpio_desc*desc,int value){/* GPIO can never have been requested */WARN_ON(1);}
/home/ysy/linux/IMX6ULL/linux/linux-imx-rel_imx_4.1.15_2.1.0_ga/include/linux/of_gpio.h
enumof_gpio_flags{
OF_GPIO_ACTIVE_LOW =0x1,};staticinlineintof_gpio_named_count(structdevice_node*np,constchar* propname){returnof_count_phandle_with_args(np, propname,"#gpio-cells");}/**
* of_gpio_count() - Count GPIOs for a device
* @np: device node to count GPIOs for
*
* Same as of_gpio_named_count, but hard coded to use the 'gpios' property
*/staticinlineintof_gpio_count(structdevice_node*np){returnof_gpio_named_count(np,"gpios");}staticinlineintof_get_gpio_flags(structdevice_node*np,int index,enumof_gpio_flags*flags){returnof_get_named_gpio_flags(np,"gpios", index, flags);}/**
* of_get_named_gpio() - Get a GPIO number to use with GPIO API
* @np: device node to get GPIO from
* @propname: Name of property containing gpio specifier(s)
* @index: index of the GPIO
*
* Returns GPIO number to use with Linux generic GPIO API, or one of the errno
* value on the error condition.
*/staticinlineintof_get_named_gpio(structdevice_node*np,constchar*propname,int index){returnof_get_named_gpio_flags(np, propname, index,NULL);}/**
* of_get_gpio() - Get a GPIO number to use with GPIO API
* @np: device node to get GPIO from
* @index: index of the GPIO
*
* Returns GPIO number to use with Linux generic GPIO API, or one of the errno
* value on the error condition.
*/staticinlineintof_get_gpio(structdevice_node*np,int index){returnof_get_gpio_flags(np, index,NULL);}/home/ysy/linux/IMX6ULL/linux/linux-imx-rel_imx_4.1.15_2.1.0_ga/drivers/gpio/gpiolib-of.c
intof_get_named_gpio_flags(structdevice_node*np,constchar*list_name,int index,enumof_gpio_flags*flags){structgpio_desc*desc;
desc =of_get_named_gpiod_flags(np, list_name, index, flags);if(IS_ERR(desc))returnPTR_ERR(desc);elsereturndesc_to_gpio(desc);}EXPORT_SYMBOL(of_get_named_gpio_flags);
intplatform_get_irq(structplatform_device*dev,unsignedint num){#ifdefCONFIG_SPARC/* sparc does not have irqs represented as IORESOURCE_IRQ resources */if(!dev || num >= dev->archdata.num_irqs)return-ENXIO;return dev->archdata.irqs[num];#elsestructresource*r;if(IS_ENABLED(CONFIG_OF_IRQ)&& dev->dev.of_node){int ret;
ret =of_irq_get(dev->dev.of_node, num);if(ret >=0|| ret ==-EPROBE_DEFER)return ret;}
r =platform_get_resource(dev, IORESOURCE_IRQ, num);/*
* The resources may pass trigger flags to the irqs that need
* to be set up. It so happens that the trigger flags for
* IORESOURCE_BITS correspond 1-to-1 to the IRQF_TRIGGER*
* settings.
*/if(r && r->flags & IORESOURCE_BITS)irqd_set_trigger_type(irq_get_irq_data(r->start),
r->flags & IORESOURCE_BITS);return r ? r->start :-ENXIO;#endif}EXPORT_SYMBOL_GPL(platform_get_irq);