Lines Matching +full:adc +full:- +full:use +full:- +full:res
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
7 * Redistribution and use in source and binary forms, with or without
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
133 { "allwinner,sun8i-a33-codec", 1},
140 { -1, 0 }
145 struct resource *res[2]; member
152 #define CODEC_LOCK(sc) mtx_lock(&(sc)->mtx)
153 #define CODEC_UNLOCK(sc) mtx_unlock(&(sc)->mtx)
154 #define CODEC_READ(sc, reg) bus_read_4((sc)->res[0], (reg))
155 #define CODEC_WRITE(sc, reg, val) bus_write_4((sc)->res[0], (reg), (val))
167 if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) in sun8i_codec_probe()
184 sc->dev = dev; in sun8i_codec_attach()
187 mtx_init(&sc->mtx, device_get_nameunit(dev), NULL, MTX_DEF); in sun8i_codec_attach()
189 if (bus_alloc_resources(dev, sun8i_codec_spec, sc->res) != 0) { in sun8i_codec_attach()
195 error = clk_get_by_ofw_name(dev, 0, "mod", &sc->clk_mod); in sun8i_codec_attach()
201 error = clk_get_by_ofw_name(dev, 0, "bus", &sc->clk_gate); in sun8i_codec_attach()
207 error = clk_enable(sc->clk_gate); in sun8i_codec_attach()
234 /* Set AIF1 to 16-bit */ in sun8i_codec_attach()
246 /* Enable AIF1 ADC timelot 0 */ in sun8i_codec_attach()
260 /* ADC mixer source select */ in sun8i_codec_attach()
270 if (gpio_pin_get_by_ofw_property(dev, node, "allwinner,pa-gpios", in sun8i_codec_attach()
293 if (sc->clk_gate) in sun8i_codec_detach()
294 clk_release(sc->clk_gate); in sun8i_codec_detach()
296 if (sc->clk_mod) in sun8i_codec_detach()
297 clk_release(sc->clk_mod); in sun8i_codec_detach()
299 if (sc->intrhand != NULL) in sun8i_codec_detach()
300 bus_teardown_intr(sc->dev, sc->res[1], sc->intrhand); in sun8i_codec_detach()
302 bus_release_resources(dev, sun8i_codec_spec, sc->res); in sun8i_codec_detach()
303 mtx_destroy(&sc->mtx); in sun8i_codec_detach()