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
47 #include <sys/gpio.h>
152 #define DCU_SFT_LCK_POL 0x114 /* Soft Lock POL */
157 #define DCU_CTRLDESCL(n, m) 0x200 + (0x40 * n) + 0x4 * (m - 1)
202 { -1, 0 }
212 if (!ofw_bus_is_compatible(dev, "fsl,mvf600-dcu4")) in dcu_probe()
241 if ((node = ofw_bus_get_node(sc->dev)) == -1) in get_panel_info()
245 if ((len = OF_getproplen(node, "panel-size")) <= 0) in get_panel_info()
247 OF_getencprop(node, "panel-size", dts_value, len); in get_panel_info()
248 panel->width = dts_value[0]; in get_panel_info()
249 panel->height = dts_value[1]; in get_panel_info()
252 if ((len = OF_getproplen(node, "panel-hsync")) <= 0) in get_panel_info()
254 OF_getencprop(node, "panel-hsync", dts_value, len); in get_panel_info()
255 panel->h_back_porch = dts_value[0]; in get_panel_info()
256 panel->h_pulse_width = dts_value[1]; in get_panel_info()
257 panel->h_front_porch = dts_value[2]; in get_panel_info()
260 if ((len = OF_getproplen(node, "panel-vsync")) <= 0) in get_panel_info()
262 OF_getencprop(node, "panel-vsync", dts_value, len); in get_panel_info()
263 panel->v_back_porch = dts_value[0]; in get_panel_info()
264 panel->v_pulse_width = dts_value[1]; in get_panel_info()
265 panel->v_front_porch = dts_value[2]; in get_panel_info()
268 if ((len = OF_getproplen(node, "panel-clk-div")) <= 0) in get_panel_info()
270 OF_getencprop(node, "panel-clk-div", dts_value, len); in get_panel_info()
271 panel->clk_div = dts_value[0]; in get_panel_info()
274 if ((len = OF_getproplen(node, "panel-backlight-pin")) <= 0) in get_panel_info()
276 OF_getencprop(node, "panel-backlight-pin", dts_value, len); in get_panel_info()
277 panel->backlight_pin = dts_value[0]; in get_panel_info()
289 panel = sc->panel; in dcu_init()
292 reg = ((sc->sc_info.fb_height) << DELTA_Y_S); in dcu_init()
293 reg |= (sc->sc_info.fb_width / 16); in dcu_init()
296 reg = (panel->h_back_porch << BP_H_SHIFT); in dcu_init()
297 reg |= (panel->h_pulse_width << PW_H_SHIFT); in dcu_init()
298 reg |= (panel->h_front_porch << FP_H_SHIFT); in dcu_init()
301 reg = (panel->v_back_porch << BP_V_SHIFT); in dcu_init()
302 reg |= (panel->v_pulse_width << PW_V_SHIFT); in dcu_init()
303 reg |= (panel->v_front_porch << FP_V_SHIFT); in dcu_init()
307 WRITE4(sc, DCU_DIV_RATIO, panel->clk_div); in dcu_init()
335 reg = (sc->sc_info.fb_width | (sc->sc_info.fb_height << 16)); in dcu_init()
338 WRITE4(sc, DCU_CTRLDESCLn_3(0), sc->sc_info.fb_pbase); in dcu_init()
369 sc->dev = dev; in dcu_attach()
371 if (bus_alloc_resources(dev, dcu_spec, sc->res)) { in dcu_attach()
377 sc->bst = rman_get_bustag(sc->res[0]); in dcu_attach()
378 sc->bsh = rman_get_bushandle(sc->res[0]); in dcu_attach()
381 err = bus_setup_intr(dev, sc->res[1], INTR_TYPE_BIO | INTR_MPSAFE, in dcu_attach()
382 NULL, dcu_intr, sc, &sc->ih); in dcu_attach()
393 sc->panel = &panel; in dcu_attach()
398 /* Get the GPIO device, we need this to give power to USB */ in dcu_attach()
399 gpio_dev = devclass_get_device(devclass_find("gpio"), 0); in dcu_attach()
401 device_printf(sc->dev, "Error: failed to get the GPIO dev\n"); in dcu_attach()
410 sc->sc_info.fb_width = panel.width; in dcu_attach()
411 sc->sc_info.fb_height = panel.height; in dcu_attach()
412 sc->sc_info.fb_stride = sc->sc_info.fb_width * 3; in dcu_attach()
413 sc->sc_info.fb_bpp = sc->sc_info.fb_depth = 24; in dcu_attach()
414 sc->sc_info.fb_size = sc->sc_info.fb_height * sc->sc_info.fb_stride; in dcu_attach()
415 sc->sc_info.fb_vbase = (intptr_t)contigmalloc(sc->sc_info.fb_size, in dcu_attach()
417 sc->sc_info.fb_pbase = (intptr_t)vtophys(sc->sc_info.fb_vbase); in dcu_attach()
420 printf("%dx%d [%d]\n", sc->sc_info.fb_width, sc->sc_info.fb_height, in dcu_attach()
421 sc->sc_info.fb_stride); in dcu_attach()
422 printf("pbase == 0x%08x\n", sc->sc_info.fb_pbase); in dcu_attach()
425 memset((int8_t *)sc->sc_info.fb_vbase, 0x0, sc->sc_info.fb_size); in dcu_attach()
429 sc->sc_info.fb_name = device_get_nameunit(dev); in dcu_attach()
432 sc->sc_fbd = device_add_child(dev, "fbd", device_get_unit(dev)); in dcu_attach()
433 if (sc->sc_fbd == NULL) in dcu_attach()
436 if (device_probe_and_attach(sc->sc_fbd) != 0) { in dcu_attach()
437 device_printf(sc->dev, "Failed to attach fbd device\n"); in dcu_attach()
448 return (&sc->sc_info); in dcu4_fb_getinfo()