Lines Matching refs:sdev

260 	struct simpledrm_device *sdev = simpledrm_device_of_dev(res);  in simpledrm_device_release_clocks()  local
263 for (i = 0; i < sdev->clk_count; ++i) { in simpledrm_device_release_clocks()
264 if (sdev->clks[i]) { in simpledrm_device_release_clocks()
265 clk_disable_unprepare(sdev->clks[i]); in simpledrm_device_release_clocks()
266 clk_put(sdev->clks[i]); in simpledrm_device_release_clocks()
271 static int simpledrm_device_init_clocks(struct simpledrm_device *sdev) in simpledrm_device_init_clocks() argument
273 struct drm_device *dev = &sdev->dev; in simpledrm_device_init_clocks()
274 struct platform_device *pdev = sdev->pdev; in simpledrm_device_init_clocks()
283 sdev->clk_count = of_clk_get_parent_count(of_node); in simpledrm_device_init_clocks()
284 if (!sdev->clk_count) in simpledrm_device_init_clocks()
287 sdev->clks = drmm_kzalloc(dev, sdev->clk_count * sizeof(sdev->clks[0]), in simpledrm_device_init_clocks()
289 if (!sdev->clks) in simpledrm_device_init_clocks()
292 for (i = 0; i < sdev->clk_count; ++i) { in simpledrm_device_init_clocks()
308 sdev->clks[i] = clock; in simpledrm_device_init_clocks()
313 sdev); in simpledrm_device_init_clocks()
318 if (sdev->clks[i]) { in simpledrm_device_init_clocks()
319 clk_disable_unprepare(sdev->clks[i]); in simpledrm_device_init_clocks()
320 clk_put(sdev->clks[i]); in simpledrm_device_init_clocks()
326 static int simpledrm_device_init_clocks(struct simpledrm_device *sdev) in simpledrm_device_init_clocks() argument
358 struct simpledrm_device *sdev = simpledrm_device_of_dev(res); in simpledrm_device_release_regulators() local
361 for (i = 0; i < sdev->regulator_count; ++i) { in simpledrm_device_release_regulators()
362 if (sdev->regulators[i]) { in simpledrm_device_release_regulators()
363 regulator_disable(sdev->regulators[i]); in simpledrm_device_release_regulators()
364 regulator_put(sdev->regulators[i]); in simpledrm_device_release_regulators()
369 static int simpledrm_device_init_regulators(struct simpledrm_device *sdev) in simpledrm_device_init_regulators() argument
371 struct drm_device *dev = &sdev->dev; in simpledrm_device_init_regulators()
372 struct platform_device *pdev = sdev->pdev; in simpledrm_device_init_regulators()
393 sdev->regulators = drmm_kzalloc(dev, in simpledrm_device_init_regulators()
394 count * sizeof(sdev->regulators[0]), in simpledrm_device_init_regulators()
396 if (!sdev->regulators) in simpledrm_device_init_regulators()
427 sdev->regulators[i++] = regulator; in simpledrm_device_init_regulators()
429 sdev->regulator_count = i; in simpledrm_device_init_regulators()
433 sdev); in simpledrm_device_init_regulators()
438 if (sdev->regulators[i]) { in simpledrm_device_init_regulators()
439 regulator_disable(sdev->regulators[i]); in simpledrm_device_init_regulators()
440 regulator_put(sdev->regulators[i]); in simpledrm_device_init_regulators()
446 static int simpledrm_device_init_regulators(struct simpledrm_device *sdev) in simpledrm_device_init_regulators() argument
467 static int simpledrm_device_init_fb(struct simpledrm_device *sdev) in simpledrm_device_init_fb() argument
471 struct drm_device *dev = &sdev->dev; in simpledrm_device_init_fb()
472 struct platform_device *pdev = sdev->pdev; in simpledrm_device_init_fb()
507 sdev->mode = simpledrm_mode(width, height); in simpledrm_device_init_fb()
508 sdev->format = format; in simpledrm_device_init_fb()
509 sdev->pitch = stride; in simpledrm_device_init_fb()
512 DRM_MODE_ARG(&sdev->mode)); in simpledrm_device_init_fb()
524 static int simpledrm_device_init_mm(struct simpledrm_device *sdev) in simpledrm_device_init_mm() argument
526 struct drm_device *dev = &sdev->dev; in simpledrm_device_init_mm()
527 struct platform_device *pdev = sdev->pdev; in simpledrm_device_init_mm()
548 sdev->mem = mem; in simpledrm_device_init_mm()
549 sdev->screen_base = screen_base; in simpledrm_device_init_mm()
584 struct simpledrm_device *sdev = simpledrm_device_of_dev(connector->dev); in simpledrm_connector_helper_get_modes() local
587 mode = drm_mode_duplicate(connector->dev, &sdev->mode); in simpledrm_connector_helper_get_modes()
621 struct simpledrm_device *sdev = simpledrm_device_of_dev(pipe->crtc.dev); in simpledrm_simple_display_pipe_mode_valid() local
623 if (mode->hdisplay != sdev->mode.hdisplay && in simpledrm_simple_display_pipe_mode_valid()
624 mode->vdisplay != sdev->mode.vdisplay) in simpledrm_simple_display_pipe_mode_valid()
626 else if (mode->hdisplay != sdev->mode.hdisplay) in simpledrm_simple_display_pipe_mode_valid()
628 else if (mode->vdisplay != sdev->mode.vdisplay) in simpledrm_simple_display_pipe_mode_valid()
639 struct simpledrm_device *sdev = simpledrm_device_of_dev(pipe->crtc.dev); in simpledrm_simple_display_pipe_enable() local
643 struct drm_device *dev = &sdev->dev; in simpledrm_simple_display_pipe_enable()
652 drm_fb_blit_dstclip(sdev->screen_base, sdev->pitch, in simpledrm_simple_display_pipe_enable()
653 sdev->format->format, vmap, fb); in simpledrm_simple_display_pipe_enable()
660 struct simpledrm_device *sdev = simpledrm_device_of_dev(pipe->crtc.dev); in simpledrm_simple_display_pipe_disable() local
661 struct drm_device *dev = &sdev->dev; in simpledrm_simple_display_pipe_disable()
668 memset_io(sdev->screen_base, 0, sdev->pitch * sdev->mode.vdisplay); in simpledrm_simple_display_pipe_disable()
677 struct simpledrm_device *sdev = simpledrm_device_of_dev(pipe->crtc.dev); in simpledrm_simple_display_pipe_update() local
682 struct drm_device *dev = &sdev->dev; in simpledrm_simple_display_pipe_update()
695 drm_fb_blit_rect_dstclip(sdev->screen_base, sdev->pitch, in simpledrm_simple_display_pipe_update()
696 sdev->format->format, vmap, fb, &clip); in simpledrm_simple_display_pipe_update()
716 static const uint32_t *simpledrm_device_formats(struct simpledrm_device *sdev, in simpledrm_device_formats() argument
719 struct drm_device *dev = &sdev->dev; in simpledrm_device_formats()
722 if (sdev->nformats) in simpledrm_device_formats()
726 sdev->formats[0] = sdev->format->format; in simpledrm_device_formats()
727 sdev->nformats = 1; in simpledrm_device_formats()
731 if (simpledrm_default_formats[i] == sdev->format->format) in simpledrm_device_formats()
733 sdev->formats[sdev->nformats] = simpledrm_default_formats[i]; in simpledrm_device_formats()
734 sdev->nformats++; in simpledrm_device_formats()
744 if (drm_WARN_ONCE(dev, i != sdev->nformats, in simpledrm_device_formats()
746 &sdev->format->format)) { in simpledrm_device_formats()
747 sdev->nformats = 1; in simpledrm_device_formats()
751 *nformats_out = sdev->nformats; in simpledrm_device_formats()
752 return sdev->formats; in simpledrm_device_formats()
755 static int simpledrm_device_init_modeset(struct simpledrm_device *sdev) in simpledrm_device_init_modeset() argument
757 struct drm_device *dev = &sdev->dev; in simpledrm_device_init_modeset()
758 struct drm_display_mode *mode = &sdev->mode; in simpledrm_device_init_modeset()
759 struct drm_connector *connector = &sdev->connector; in simpledrm_device_init_modeset()
760 struct drm_simple_display_pipe *pipe = &sdev->pipe; in simpledrm_device_init_modeset()
774 dev->mode_config.preferred_depth = sdev->format->cpp[0] * 8; in simpledrm_device_init_modeset()
783 formats = simpledrm_device_formats(sdev, &nformats); in simpledrm_device_init_modeset()
803 struct simpledrm_device *sdev; in simpledrm_device_create() local
806 sdev = devm_drm_dev_alloc(&pdev->dev, drv, struct simpledrm_device, in simpledrm_device_create()
808 if (IS_ERR(sdev)) in simpledrm_device_create()
809 return ERR_CAST(sdev); in simpledrm_device_create()
810 sdev->pdev = pdev; in simpledrm_device_create()
811 platform_set_drvdata(pdev, sdev); in simpledrm_device_create()
813 ret = simpledrm_device_init_clocks(sdev); in simpledrm_device_create()
816 ret = simpledrm_device_init_regulators(sdev); in simpledrm_device_create()
819 ret = simpledrm_device_init_fb(sdev); in simpledrm_device_create()
822 ret = simpledrm_device_init_mm(sdev); in simpledrm_device_create()
825 ret = simpledrm_device_init_modeset(sdev); in simpledrm_device_create()
829 return sdev; in simpledrm_device_create()
855 struct simpledrm_device *sdev; in simpledrm_probe() local
859 sdev = simpledrm_device_create(&simpledrm_driver, pdev); in simpledrm_probe()
860 if (IS_ERR(sdev)) in simpledrm_probe()
861 return PTR_ERR(sdev); in simpledrm_probe()
862 dev = &sdev->dev; in simpledrm_probe()
875 struct simpledrm_device *sdev = platform_get_drvdata(pdev); in simpledrm_remove() local
876 struct drm_device *dev = &sdev->dev; in simpledrm_remove()