{intrc =0, rs;intret =0;structleds_dev *leds = dev_get_drvdata(&pdev->dev); rs= gpio_get_value(1110);if(rs) { printk("leds no probe");return0; } leds= devm_kzalloc(&pdev->dev,sizeof(*leds), GFP_KERNEL);if(IS_ERR(leds)) { pr_err("%s: can't alloc memery for leds...
pin_get_name(pctldev, grp->pins[i]); // 引脚组或引脚名称为引脚组中的引脚名称 new_map[i].data.configs.configs = grp->data[i].configs; // 配置信息数组为引脚组中该引脚的配置信息 new_map[i].data.configs.num_configs = grp->data[i].nconfigs; // 配置信息数量为引脚组中该引脚的配置...
pinctrl_bind_pins(dev); if(dev->bus->probe) { ret= dev->bus->probe(dev); }else if (drv->probe) { ret= drv->probe(dev); } pinctrl_bind_pins(dev)的调用过程如下: pinctrl_bind_pins(dev); dev->pins->p= devm_pinctrl_get(dev); dev->pins->default_state= pinctrl_lookup_state(de...
}//到现在,离注册需要的条件就剩function和group的填充了,其实它们不是pinctrl子系统要求的,//但是回调函数的实现依赖这些,因此需要解析设备树信息来填充它们,后面会详细分析该函数ret =samsung_pinctrl_parse_dt(pdev, drvdata);if(ret)returnret;//一切准备好后,就注册了drvdata->pctl_dev =pinctrl_register(ct...
msm_pinctrl_get_drvdata(dd,pdev); //解析pinctrl.dtsi,保存到dd msm_pinctrl_dt_parse_pintype(node,dd); msm_pinctrl_dt_parse_pins(node,dd); msm_register_gpiochip(dd); //定义gpio_request()、gpio_free() gc->request= msm_pinctrl_request_gpio; ...
platform_set_drvdata(pdev,pctl); returnpinctrl_register_mappings(nuc970_pinmap,ARRAY_SIZE(nuc970_pinmap)); } 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. platform平台驱动设备的注册流程都是类似,具体注册流程可参考:点击打开链接,而arch_initcall(...)系统接口函数将注册该驱动,函数路径...
static int horizon_gpio_set_direction(struct pinctrl_dev *pctldev, int pin, bool input, int output_val) { struct horizon_pinctrl *ipctl = pinctrl_dev_get_drvdata(pctldev); struct pinctrl_gpio_range *gpio_range; unsigned int val, gpio, gpio_port; ...
void*drv_data; }; 2.引脚的控制操作,用来获取某组引脚,解析设备树节点创建映射 pinctrl_ops { int(*get_groups_count) (structpinctrl_dev *pctldev);//获取group的个数 constchar*(*get_group_name) (structpinctrl_dev *pctldev, unsignedselector);//获取group的名称 ...
(&pdev->dev,sizeof(*pctl), GFP_KERNEL);1213platform_set_drvdata(pdev, pctl);1415 res = platform_get_resource(pdev, IORESOURCE_MEM,0);16 pctl->membase = devm_ioremap_resource(&pdev->dev, res);//返回设备的MEM资源的虚拟地址171819 pctl->dev = &pdev->dev;20 pctl->desc =desc;...
(&pdev->dev,sizeof(*pctl), GFP_KERNEL);1213platform_set_drvdata(pdev, pctl);1415res = platform_get_resource(pdev, IORESOURCE_MEM,0);16pctl->membase = devm_ioremap_resource(&pdev->dev, res);//返回设备的MEM资源的虚拟地址171819pctl->dev = &pdev->dev;20pctl->desc =desc;2122pctl-...