Lines Matching +full:out +full:- +full:masks

1 // SPDX-License-Identifier: GPL-2.0
3 * MMIO register bitfield-controlled multiplexer driver
20 struct regmap_field **fields = mux_chip_priv(mux->chip); in mux_mmio_set()
30 { .compatible = "mmio-mux", },
31 { .compatible = "reg-mux", },
38 struct device *dev = &pdev->dev; in mux_mmio_probe()
39 struct device_node *np = dev->of_node; in mux_mmio_probe()
47 if (of_device_is_compatible(np, "mmio-mux")) { in mux_mmio_probe()
48 regmap = syscon_node_to_regmap(np->parent); in mux_mmio_probe()
52 if (IS_ERR(regmap) && regmap != ERR_PTR(-EPROBE_DEFER)) { in mux_mmio_probe()
53 regmap = dev_get_regmap(dev->parent, NULL); in mux_mmio_probe()
55 regmap = ERR_PTR(-ENODEV); in mux_mmio_probe()
62 ret = of_property_count_u32_elems(np, "mux-reg-masks"); in mux_mmio_probe()
64 ret = -EINVAL; in mux_mmio_probe()
66 dev_err(dev, "mux-reg-masks property missing or invalid: %d\n", in mux_mmio_probe()
80 struct mux_control *mux = &mux_chip->mux[i]; in mux_mmio_probe()
86 ret = of_property_read_u32_index(np, "mux-reg-masks", in mux_mmio_probe()
89 ret = of_property_read_u32_index(np, "mux-reg-masks", in mux_mmio_probe()
92 dev_err(dev, "bitfield %d: failed to read mux-reg-masks property: %d\n", in mux_mmio_probe()
98 field.msb = fls(mask) - 1; in mux_mmio_probe()
99 field.lsb = ffs(mask) - 1; in mux_mmio_probe()
104 return -EINVAL; in mux_mmio_probe()
115 bits = 1 + field.msb - field.lsb; in mux_mmio_probe()
116 mux->states = 1 << bits; in mux_mmio_probe()
118 of_property_read_u32_index(np, "idle-states", i, in mux_mmio_probe()
121 if (idle_state < 0 || idle_state >= mux->states) { in mux_mmio_probe()
122 dev_err(dev, "bitfield: %d: out of range idle state %d\n", in mux_mmio_probe()
124 return -EINVAL; in mux_mmio_probe()
127 mux->idle_state = idle_state; in mux_mmio_probe()
131 mux_chip->ops = &mux_mmio_ops; in mux_mmio_probe()
138 .name = "mmio-mux",
145 MODULE_DESCRIPTION("MMIO register bitfield-controlled multiplexer driver");