Lines Matching +full:control +full:- +full:parent

1 // SPDX-License-Identifier: GPL-2.0-only
11 #include <linux/i2c-mux.h>
18 struct mux_control *control; member
28 ret = mux_control_select(mux->control, chan); in i2c_mux_select()
29 mux->do_not_deselect = ret < 0; in i2c_mux_select()
38 if (mux->do_not_deselect) in i2c_mux_deselect()
41 return mux_control_deselect(mux->control); in i2c_mux_deselect()
46 struct device_node *np = dev->of_node; in mux_parent_adapter()
48 struct i2c_adapter *parent; in mux_parent_adapter() local
50 parent_np = of_parse_phandle(np, "i2c-parent", 0); in mux_parent_adapter()
52 dev_err(dev, "Cannot parse i2c-parent\n"); in mux_parent_adapter()
53 return ERR_PTR(-ENODEV); in mux_parent_adapter()
55 parent = of_find_i2c_adapter_by_node(parent_np); in mux_parent_adapter()
57 if (!parent) in mux_parent_adapter()
58 return ERR_PTR(-EPROBE_DEFER); in mux_parent_adapter()
60 return parent; in mux_parent_adapter()
64 { .compatible = "i2c-mux", },
71 struct device *dev = &pdev->dev; in i2c_mux_probe()
72 struct device_node *np = dev->of_node; in i2c_mux_probe()
76 struct i2c_adapter *parent; in i2c_mux_probe() local
81 return -ENODEV; in i2c_mux_probe()
85 return -ENOMEM; in i2c_mux_probe()
87 mux->control = devm_mux_control_get(dev, NULL); in i2c_mux_probe()
88 if (IS_ERR(mux->control)) in i2c_mux_probe()
89 return dev_err_probe(dev, PTR_ERR(mux->control), in i2c_mux_probe()
90 "failed to get control-mux\n"); in i2c_mux_probe()
92 parent = mux_parent_adapter(dev); in i2c_mux_probe()
93 if (IS_ERR(parent)) in i2c_mux_probe()
94 return dev_err_probe(dev, PTR_ERR(parent), in i2c_mux_probe()
95 "failed to get i2c-parent adapter\n"); in i2c_mux_probe()
99 muxc = i2c_mux_alloc(parent, dev, children, 0, 0, in i2c_mux_probe()
102 ret = -ENOMEM; in i2c_mux_probe()
105 muxc->priv = mux; in i2c_mux_probe()
109 muxc->mux_locked = of_property_read_bool(np, "mux-locked"); in i2c_mux_probe()
121 if (chan >= mux_control_states(mux->control)) { in i2c_mux_probe()
123 ret = -EINVAL; in i2c_mux_probe()
132 dev_info(dev, "%d-port mux on %s adapter\n", children, parent->name); in i2c_mux_probe()
139 i2c_put_adapter(parent); in i2c_mux_probe()
149 i2c_put_adapter(muxc->parent); in i2c_mux_remove()
158 .name = "i2c-mux-gpmux",