Lines Matching refs:p

929 static struct pinctrl_state *find_state(struct pinctrl *p,  in find_state()  argument
934 list_for_each_entry(state, &p->states, node) in find_state()
941 static struct pinctrl_state *create_state(struct pinctrl *p, in create_state() argument
953 list_add_tail(&state->node, &p->states); in create_state()
958 static int add_setting(struct pinctrl *p, struct pinctrl_dev *pctldev, in add_setting() argument
965 state = find_state(p, map->name); in add_setting()
967 state = create_state(p, map->name); in add_setting()
994 dev_info(p->dev, "unknown pinctrl device %s in map entry, deferring probe", in add_setting()
1025 struct pinctrl *p; in find_pinctrl() local
1028 list_for_each_entry(p, &pinctrl_list, node) in find_pinctrl()
1029 if (p->dev == dev) { in find_pinctrl()
1031 return p; in find_pinctrl()
1038 static void pinctrl_free(struct pinctrl *p, bool inlist);
1043 struct pinctrl *p; in create_pinctrl() local
1054 p = kzalloc(sizeof(*p), GFP_KERNEL); in create_pinctrl()
1055 if (!p) in create_pinctrl()
1057 p->dev = dev; in create_pinctrl()
1058 INIT_LIST_HEAD(&p->states); in create_pinctrl()
1059 INIT_LIST_HEAD(&p->dt_maps); in create_pinctrl()
1061 ret = pinctrl_dt_to_map(p, pctldev); in create_pinctrl()
1063 kfree(p); in create_pinctrl()
1086 ret = add_setting(p, pctldev, map); in create_pinctrl()
1102 pinctrl_free(p, false); in create_pinctrl()
1110 pinctrl_free(p, false); in create_pinctrl()
1114 kref_init(&p->users); in create_pinctrl()
1118 list_add_tail(&p->node, &pinctrl_list); in create_pinctrl()
1121 return p; in create_pinctrl()
1130 struct pinctrl *p; in pinctrl_get() local
1140 p = find_pinctrl(dev); in pinctrl_get()
1141 if (p) { in pinctrl_get()
1143 kref_get(&p->users); in pinctrl_get()
1144 return p; in pinctrl_get()
1169 static void pinctrl_free(struct pinctrl *p, bool inlist) in pinctrl_free() argument
1175 list_for_each_entry_safe(state, n1, &p->states, node) { in pinctrl_free()
1177 pinctrl_free_setting(state == p->state, setting); in pinctrl_free()
1185 pinctrl_dt_free_maps(p); in pinctrl_free()
1188 list_del(&p->node); in pinctrl_free()
1189 kfree(p); in pinctrl_free()
1199 struct pinctrl *p = container_of(kref, struct pinctrl, users); in pinctrl_release() local
1201 pinctrl_free(p, true); in pinctrl_release()
1208 void pinctrl_put(struct pinctrl *p) in pinctrl_put() argument
1210 kref_put(&p->users, pinctrl_release); in pinctrl_put()
1219 struct pinctrl_state *pinctrl_lookup_state(struct pinctrl *p, in pinctrl_lookup_state() argument
1224 state = find_state(p, name); in pinctrl_lookup_state()
1228 dev_dbg(p->dev, "using pinctrl dummy state (%s)\n", in pinctrl_lookup_state()
1230 state = create_state(p, name); in pinctrl_lookup_state()
1253 static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state) in pinctrl_commit_state() argument
1256 struct pinctrl_state *old_state = READ_ONCE(p->state); in pinctrl_commit_state()
1273 p->state = NULL; in pinctrl_commit_state()
1294 if (p != setting->pctldev->p) in pinctrl_commit_state()
1295 pinctrl_link_add(setting->pctldev, p->dev); in pinctrl_commit_state()
1318 if (p != setting->pctldev->p) in pinctrl_commit_state()
1319 pinctrl_link_add(setting->pctldev, p->dev); in pinctrl_commit_state()
1322 p->state = state; in pinctrl_commit_state()
1327 dev_err(p->dev, "Error applying setting, reverse things back\n"); in pinctrl_commit_state()
1345 pinctrl_select_state(p, old_state); in pinctrl_commit_state()
1355 int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state) in pinctrl_select_state() argument
1357 if (p->state == state) in pinctrl_select_state()
1360 return pinctrl_commit_state(p, state); in pinctrl_select_state()
1378 struct pinctrl **ptr, *p; in devm_pinctrl_get() local
1384 p = pinctrl_get(dev); in devm_pinctrl_get()
1385 if (!IS_ERR(p)) { in devm_pinctrl_get()
1386 *ptr = p; in devm_pinctrl_get()
1392 return p; in devm_pinctrl_get()
1398 struct pinctrl **p = res; in devm_pinctrl_match() local
1400 return *p == data; in devm_pinctrl_match()
1411 void devm_pinctrl_put(struct pinctrl *p) in devm_pinctrl_put() argument
1413 WARN_ON(devres_release(p->dev, devm_pinctrl_release, in devm_pinctrl_put()
1414 devm_pinctrl_match, p)); in devm_pinctrl_put()
1518 if (!IS_ERR(pctldev->p) && !IS_ERR(pctldev->hog_sleep)) in pinctrl_force_sleep()
1519 return pinctrl_commit_state(pctldev->p, pctldev->hog_sleep); in pinctrl_force_sleep()
1530 if (!IS_ERR(pctldev->p) && !IS_ERR(pctldev->hog_default)) in pinctrl_force_default()
1531 return pinctrl_commit_state(pctldev->p, pctldev->hog_default); in pinctrl_force_default()
1555 if (pins->p->state != pins->init_state) in pinctrl_init_done()
1561 ret = pinctrl_select_state(pins->p, pins->default_state); in pinctrl_init_done()
1576 ret = pinctrl_select_state(pins->p, state); in pinctrl_select_bound_state()
1863 struct pinctrl *p; in pinctrl_show() local
1871 list_for_each_entry(p, &pinctrl_list, node) { in pinctrl_show()
1873 dev_name(p->dev), in pinctrl_show()
1874 p->state ? p->state->name : "none"); in pinctrl_show()
1876 list_for_each_entry(state, &p->states, node) { in pinctrl_show()
2085 pctldev->p = create_pinctrl(pctldev->dev, pctldev); in pinctrl_claim_hogs()
2086 if (PTR_ERR(pctldev->p) == -ENODEV) { in pinctrl_claim_hogs()
2092 if (IS_ERR(pctldev->p)) { in pinctrl_claim_hogs()
2094 PTR_ERR(pctldev->p)); in pinctrl_claim_hogs()
2096 return PTR_ERR(pctldev->p); in pinctrl_claim_hogs()
2100 pinctrl_lookup_state(pctldev->p, PINCTRL_STATE_DEFAULT); in pinctrl_claim_hogs()
2105 if (pinctrl_select_state(pctldev->p, in pinctrl_claim_hogs()
2112 pinctrl_lookup_state(pctldev->p, in pinctrl_claim_hogs()
2186 struct pinctrl_dev *p; in pinctrl_register_and_init() local
2188 p = pinctrl_init_controller(pctldesc, dev, driver_data); in pinctrl_register_and_init()
2189 if (IS_ERR(p)) in pinctrl_register_and_init()
2190 return PTR_ERR(p); in pinctrl_register_and_init()
2198 *pctldev = p; in pinctrl_register_and_init()
2221 if (!IS_ERR_OR_NULL(pctldev->p)) in pinctrl_unregister()
2222 pinctrl_put(pctldev->p); in pinctrl_unregister()