Lines Matching +full:mdio +full:- +full:mux

1 // SPDX-License-Identifier: GPL-2.0+
2 /* MDIO bus multiplexer using kernel multiplexer subsystem
7 #include <linux/mdio-mux.h>
9 #include <linux/mux/consumer.h>
19 * mdio_mux_multiplexer_switch_fn - This function is called by the mdio-mux
20 * layer when it thinks the mdio bus
22 * @current_child: current value of the mux register.
23 * @desired_child: value of the 'reg' property of the target child MDIO node.
27 * The first time this function is called, current_child == -1.
28 * If current_child == desired_child, then the mux is already set to the
44 if (s->do_deselect) in mdio_mux_multiplexer_switch_fn()
45 ret = mux_control_deselect(s->muxc); in mdio_mux_multiplexer_switch_fn()
47 dev_err(&pdev->dev, "mux_control_deselect failed in %s: %d\n", in mdio_mux_multiplexer_switch_fn()
52 ret = mux_control_select(s->muxc, desired_child); in mdio_mux_multiplexer_switch_fn()
54 dev_dbg(&pdev->dev, "%s %d -> %d\n", __func__, current_child, in mdio_mux_multiplexer_switch_fn()
56 s->do_deselect = true; in mdio_mux_multiplexer_switch_fn()
58 s->do_deselect = false; in mdio_mux_multiplexer_switch_fn()
66 struct device *dev = &pdev->dev; in mdio_mux_multiplexer_probe()
70 s = devm_kzalloc(&pdev->dev, sizeof(*s), GFP_KERNEL); in mdio_mux_multiplexer_probe()
72 return -ENOMEM; in mdio_mux_multiplexer_probe()
74 s->muxc = devm_mux_control_get(dev, NULL); in mdio_mux_multiplexer_probe()
75 if (IS_ERR(s->muxc)) in mdio_mux_multiplexer_probe()
76 return dev_err_probe(&pdev->dev, PTR_ERR(s->muxc), in mdio_mux_multiplexer_probe()
77 "Failed to get mux\n"); in mdio_mux_multiplexer_probe()
81 ret = mdio_mux_init(&pdev->dev, pdev->dev.of_node, in mdio_mux_multiplexer_probe()
82 mdio_mux_multiplexer_switch_fn, &s->mux_handle, in mdio_mux_multiplexer_probe()
92 mdio_mux_uninit(s->mux_handle); in mdio_mux_multiplexer_remove()
94 if (s->do_deselect) in mdio_mux_multiplexer_remove()
95 mux_control_deselect(s->muxc); in mdio_mux_multiplexer_remove()
99 { .compatible = "mdio-mux-multiplexer", },
106 .name = "mdio-mux-multiplexer",
115 MODULE_DESCRIPTION("MDIO bus multiplexer using kernel multiplexer subsystem");