Lines Matching +full:gpio +full:- +full:out +full:- +full:pol
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 #include <sys/gpio.h>
47 #include <dev/gpio/gpiobusvar.h>
133 { "allwinner,sun8i-a33-codec", 1},
140 { -1, 0 }
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()
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()
312 int fmt, pol, clk; in sun8i_codec_dai_init() local
318 pol = AUDIO_DAI_FORMAT_POLARITY(format); in sun8i_codec_dai_init()
344 if (!AUDIO_DAI_POLARITY_INVERTED_FRAME(pol)) in sun8i_codec_dai_init()
346 if (AUDIO_DAI_POLARITY_INVERTED_BCLK(pol)) in sun8i_codec_dai_init()