Lines Matching +full:in2 +full:-
1 // SPDX-License-Identifier: GPL-2.0-only
39 ucontrol->value.enumerated.item[0] = priv->mux; in simple_mux_control_get()
48 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; in simple_mux_control_put()
52 if (ucontrol->value.enumerated.item[0] > e->items) in simple_mux_control_put()
53 return -EINVAL; in simple_mux_control_put()
55 if (priv->mux == ucontrol->value.enumerated.item[0]) in simple_mux_control_put()
58 priv->mux = ucontrol->value.enumerated.item[0]; in simple_mux_control_put()
60 gpiod_set_value_cansleep(priv->gpiod_mux, priv->mux); in simple_mux_control_put()
63 ucontrol->value.enumerated.item[0], in simple_mux_control_put()
72 return priv->mux; in simple_mux_read()
80 SND_SOC_DAPM_INPUT("IN2"),
88 { "MUX", "Input 2", "IN2" }, // see simple_mux_probe()
93 struct device *dev = &pdev->dev; in simple_mux_probe()
94 struct device_node *np = dev->of_node; in simple_mux_probe()
99 return -ENOMEM; in simple_mux_probe()
103 priv->gpiod_mux = devm_gpiod_get(dev, "mux", GPIOD_OUT_LOW); in simple_mux_probe()
104 if (IS_ERR(priv->gpiod_mux)) in simple_mux_probe()
105 return dev_err_probe(dev, PTR_ERR(priv->gpiod_mux), in simple_mux_probe()
109 memcpy(&priv->mux_texts, &simple_mux_texts, sizeof(priv->mux_texts)); in simple_mux_probe()
110 memcpy(&priv->mux_enum, &simple_mux_enum, sizeof(priv->mux_enum)); in simple_mux_probe()
111 memcpy(&priv->mux_mux, &simple_mux_mux, sizeof(priv->mux_mux)); in simple_mux_probe()
112 memcpy(&priv->mux_widgets, &simple_mux_dapm_widgets, sizeof(priv->mux_widgets)); in simple_mux_probe()
113 memcpy(&priv->mux_routes, &simple_mux_dapm_routes, sizeof(priv->mux_routes)); in simple_mux_probe()
115 priv->mux_driver.dapm_widgets = priv->mux_widgets; in simple_mux_probe()
116 priv->mux_driver.num_dapm_widgets = MUX_WIDGET_SIZE; in simple_mux_probe()
117 priv->mux_driver.dapm_routes = priv->mux_routes; in simple_mux_probe()
118 priv->mux_driver.num_dapm_routes = MUX_ROUTE_SIZE; in simple_mux_probe()
119 priv->mux_driver.read = simple_mux_read; in simple_mux_probe()
122 of_property_read_string_array(np, "state-labels", priv->mux_texts, MUX_TEXT_SIZE); in simple_mux_probe()
125 priv->mux_enum.texts = priv->mux_texts; in simple_mux_probe()
126 priv->mux_mux.private_value = (unsigned long)&priv->mux_enum; in simple_mux_probe()
127 priv->mux_widgets[2].kcontrol_news = &priv->mux_mux; in simple_mux_probe()
128 priv->mux_routes[1].control = priv->mux_texts[0]; // "Input 1" in simple_mux_probe()
129 priv->mux_routes[2].control = priv->mux_texts[1]; // "Input 2" in simple_mux_probe()
131 return devm_snd_soc_register_component(dev, &priv->mux_driver, NULL, 0); in simple_mux_probe()
136 { .compatible = "simple-audio-mux", },
144 .name = "simple-mux",