Lines Matching +full:dc +full:- +full:id
1 // SPDX-License-Identifier: GPL-2.0-only
7 * Author: Jean-Jacques Hiblot <[email protected]>
8 * Author: Boris BREZILLON <boris.brezillon@free-electrons.com>
14 #include <linux/mfd/atmel-hlcdc.h>
40 .id = 0,
71 .id = 0,
87 .id = 1,
103 .name = "high-end-overlay",
106 .id = 2,
128 .id = 3,
165 .id = 0,
181 .id = 1,
200 .id = 2,
216 .name = "high-end-overlay",
219 .id = 3,
245 .id = 4,
284 .id = 0,
300 .id = 1,
319 .id = 2,
335 .name = "high-end-overlay",
338 .id = 3,
380 .id = 0,
396 .id = 1,
415 .id = 2,
431 .name = "high-end-overlay",
434 .id = 3,
477 .id = 0,
493 .id = 1,
512 .id = 2,
528 .name = "high-end-overlay",
531 .id = 3,
570 .compatible = "atmel,at91sam9n12-hlcdc",
574 .compatible = "atmel,at91sam9x5-hlcdc",
578 .compatible = "atmel,sama5d2-hlcdc",
582 .compatible = "atmel,sama5d3-hlcdc",
586 .compatible = "atmel,sama5d4-hlcdc",
590 .compatible = "microchip,sam9x60-hlcdc",
594 .compatible = "microchip,sam9x75-xlcdc",
602 atmel_hlcdc_dc_mode_valid(struct atmel_hlcdc_dc *dc, in atmel_hlcdc_dc_mode_valid() argument
605 int vfront_porch = mode->vsync_start - mode->vdisplay; in atmel_hlcdc_dc_mode_valid()
606 int vback_porch = mode->vtotal - mode->vsync_end; in atmel_hlcdc_dc_mode_valid()
607 int vsync_len = mode->vsync_end - mode->vsync_start; in atmel_hlcdc_dc_mode_valid()
608 int hfront_porch = mode->hsync_start - mode->hdisplay; in atmel_hlcdc_dc_mode_valid()
609 int hback_porch = mode->htotal - mode->hsync_end; in atmel_hlcdc_dc_mode_valid()
610 int hsync_len = mode->hsync_end - mode->hsync_start; in atmel_hlcdc_dc_mode_valid()
612 if (hsync_len > dc->desc->max_spw + 1 || hsync_len < 1) in atmel_hlcdc_dc_mode_valid()
615 if (vsync_len > dc->desc->max_spw + 1 || vsync_len < 1) in atmel_hlcdc_dc_mode_valid()
618 if (hfront_porch > dc->desc->max_hpw + 1 || hfront_porch < 1 || in atmel_hlcdc_dc_mode_valid()
619 hback_porch > dc->desc->max_hpw + 1 || hback_porch < 1 || in atmel_hlcdc_dc_mode_valid()
620 mode->hdisplay < 1) in atmel_hlcdc_dc_mode_valid()
623 if (vfront_porch > dc->desc->max_vpw + 1 || vfront_porch < 1 || in atmel_hlcdc_dc_mode_valid()
624 vback_porch > dc->desc->max_vpw || vback_porch < 0 || in atmel_hlcdc_dc_mode_valid()
625 mode->vdisplay < 1) in atmel_hlcdc_dc_mode_valid()
636 if (layer->desc->type == ATMEL_HLCDC_BASE_LAYER || in atmel_hlcdc_layer_irq()
637 layer->desc->type == ATMEL_HLCDC_OVERLAY_LAYER || in atmel_hlcdc_layer_irq()
638 layer->desc->type == ATMEL_HLCDC_CURSOR_LAYER) in atmel_hlcdc_layer_irq()
645 struct atmel_hlcdc_dc *dc = dev->dev_private; in atmel_hlcdc_dc_irq_handler() local
650 regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_IMR, &imr); in atmel_hlcdc_dc_irq_handler()
651 regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr); in atmel_hlcdc_dc_irq_handler()
657 atmel_hlcdc_crtc_irq(dc->crtc); in atmel_hlcdc_dc_irq_handler()
661 atmel_hlcdc_layer_irq(dc->layers[i]); in atmel_hlcdc_dc_irq_handler()
669 struct atmel_hlcdc_dc *dc = dev->dev_private; in atmel_hlcdc_dc_irq_postinstall() local
675 if (dc->layers[i]) in atmel_hlcdc_dc_irq_postinstall()
679 regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, cfg); in atmel_hlcdc_dc_irq_postinstall()
684 struct atmel_hlcdc_dc *dc = dev->dev_private; in atmel_hlcdc_dc_irq_disable() local
687 regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IDR, 0xffffffff); in atmel_hlcdc_dc_irq_disable()
688 regmap_read(dc->hlcdc->regmap, ATMEL_HLCDC_ISR, &isr); in atmel_hlcdc_dc_irq_disable()
697 ret = devm_request_irq(dev->dev, irq, atmel_hlcdc_dc_irq_handler, 0, in atmel_hlcdc_dc_irq_install()
698 dev->driver->name, dev); in atmel_hlcdc_dc_irq_install()
720 struct atmel_hlcdc_dc *dc = dev->dev_private; in atmel_hlcdc_dc_modeset_init() local
727 dev_err(dev->dev, "failed to create HLCDC outputs: %d\n", ret); in atmel_hlcdc_dc_modeset_init()
733 dev_err(dev->dev, "failed to create planes: %d\n", ret); in atmel_hlcdc_dc_modeset_init()
739 dev_err(dev->dev, "failed to create crtc\n"); in atmel_hlcdc_dc_modeset_init()
743 dev->mode_config.min_width = dc->desc->min_width; in atmel_hlcdc_dc_modeset_init()
744 dev->mode_config.min_height = dc->desc->min_height; in atmel_hlcdc_dc_modeset_init()
745 dev->mode_config.max_width = dc->desc->max_width; in atmel_hlcdc_dc_modeset_init()
746 dev->mode_config.max_height = dc->desc->max_height; in atmel_hlcdc_dc_modeset_init()
747 dev->mode_config.funcs = &mode_config_funcs; in atmel_hlcdc_dc_modeset_init()
748 dev->mode_config.async_page_flip = true; in atmel_hlcdc_dc_modeset_init()
755 struct platform_device *pdev = to_platform_device(dev->dev); in atmel_hlcdc_dc_load()
757 struct atmel_hlcdc_dc *dc; in atmel_hlcdc_dc_load() local
760 match = of_match_node(atmel_hlcdc_of_match, dev->dev->parent->of_node); in atmel_hlcdc_dc_load()
762 dev_err(&pdev->dev, "invalid compatible string\n"); in atmel_hlcdc_dc_load()
763 return -ENODEV; in atmel_hlcdc_dc_load()
766 if (!match->data) { in atmel_hlcdc_dc_load()
767 dev_err(&pdev->dev, "invalid hlcdc description\n"); in atmel_hlcdc_dc_load()
768 return -EINVAL; in atmel_hlcdc_dc_load()
771 dc = devm_kzalloc(dev->dev, sizeof(*dc), GFP_KERNEL); in atmel_hlcdc_dc_load()
772 if (!dc) in atmel_hlcdc_dc_load()
773 return -ENOMEM; in atmel_hlcdc_dc_load()
775 dc->desc = match->data; in atmel_hlcdc_dc_load()
776 dc->hlcdc = dev_get_drvdata(dev->dev->parent); in atmel_hlcdc_dc_load()
777 dev->dev_private = dc; in atmel_hlcdc_dc_load()
779 ret = clk_prepare_enable(dc->hlcdc->periph_clk); in atmel_hlcdc_dc_load()
781 dev_err(dev->dev, "failed to enable periph_clk\n"); in atmel_hlcdc_dc_load()
785 pm_runtime_enable(dev->dev); in atmel_hlcdc_dc_load()
789 dev_err(dev->dev, "failed to initialize vblank\n"); in atmel_hlcdc_dc_load()
795 dev_err(dev->dev, "failed to initialize mode setting\n"); in atmel_hlcdc_dc_load()
801 pm_runtime_get_sync(dev->dev); in atmel_hlcdc_dc_load()
802 ret = atmel_hlcdc_dc_irq_install(dev, dc->hlcdc->irq); in atmel_hlcdc_dc_load()
803 pm_runtime_put_sync(dev->dev); in atmel_hlcdc_dc_load()
805 dev_err(dev->dev, "failed to install IRQ handler\n"); in atmel_hlcdc_dc_load()
816 pm_runtime_disable(dev->dev); in atmel_hlcdc_dc_load()
817 clk_disable_unprepare(dc->hlcdc->periph_clk); in atmel_hlcdc_dc_load()
824 struct atmel_hlcdc_dc *dc = dev->dev_private; in atmel_hlcdc_dc_unload() local
830 pm_runtime_get_sync(dev->dev); in atmel_hlcdc_dc_unload()
832 pm_runtime_put_sync(dev->dev); in atmel_hlcdc_dc_unload()
834 dev->dev_private = NULL; in atmel_hlcdc_dc_unload()
836 pm_runtime_disable(dev->dev); in atmel_hlcdc_dc_unload()
837 clk_disable_unprepare(dc->hlcdc->periph_clk); in atmel_hlcdc_dc_unload()
847 .name = "atmel-hlcdc",
858 ddev = drm_dev_alloc(&atmel_hlcdc_dc_driver, &pdev->dev); in atmel_hlcdc_dc_drm_probe()
900 struct atmel_hlcdc_dc *dc = drm_dev->dev_private; in atmel_hlcdc_dc_drm_suspend() local
901 struct regmap *regmap = dc->hlcdc->regmap; in atmel_hlcdc_dc_drm_suspend()
908 dc->suspend.state = state; in atmel_hlcdc_dc_drm_suspend()
910 regmap_read(regmap, ATMEL_HLCDC_IMR, &dc->suspend.imr); in atmel_hlcdc_dc_drm_suspend()
911 regmap_write(regmap, ATMEL_HLCDC_IDR, dc->suspend.imr); in atmel_hlcdc_dc_drm_suspend()
912 clk_disable_unprepare(dc->hlcdc->periph_clk); in atmel_hlcdc_dc_drm_suspend()
920 struct atmel_hlcdc_dc *dc = drm_dev->dev_private; in atmel_hlcdc_dc_drm_resume() local
922 clk_prepare_enable(dc->hlcdc->periph_clk); in atmel_hlcdc_dc_drm_resume()
923 regmap_write(dc->hlcdc->regmap, ATMEL_HLCDC_IER, dc->suspend.imr); in atmel_hlcdc_dc_drm_resume()
925 return drm_atomic_helper_resume(drm_dev, dc->suspend.state); in atmel_hlcdc_dc_drm_resume()
933 { .compatible = "atmel,hlcdc-display-controller" },
942 .name = "atmel-hlcdc-display-controller",
949 MODULE_AUTHOR("Jean-Jacques Hiblot <[email protected]>");
950 MODULE_AUTHOR("Boris Brezillon <boris.brezillon@free-electrons.com>");
953 MODULE_ALIAS("platform:atmel-hlcdc-dc");