linux/drivers/gpu/drm/mcde/mcde_drv.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2018 Linus Walleij <[email protected]>
 * Parts of this file were based on the MCDE driver by Marcus Lorentzon
 * (C) ST-Ericsson SA 2013
 */

/**
 * DOC: ST-Ericsson MCDE Driver
 *
 * The MCDE (short for multi-channel display engine) is a graphics
 * controller found in the Ux500 chipsets, such as NovaThor U8500.
 * It was initially conceptualized by ST Microelectronics for the
 * successor of the Nomadik line, STn8500 but productified in the
 * ST-Ericsson U8500 where is was used for mass-market deployments
 * in Android phones from Samsung and Sony Ericsson.
 *
 * It can do 1080p30 on SDTV CCIR656, DPI-2, DBI-2 or DSI for
 * panels with or without frame buffering and can convert most
 * input formats including most variants of RGB and YUV.
 *
 * The hardware has four display pipes, and the layout is a little
 * bit like this::
 *
 *   Memory     -> Overlay -> Channel -> FIFO -> 8 formatters -> DSI/DPI
 *   External      0..5       0..3       A,B,    6 x DSI         bridge
 *   source 0..9                         C0,C1   2 x DPI
 *
 * FIFOs A and B are for LCD and HDMI while FIFO CO/C1 are for
 * panels with embedded buffer.
 * 6 of the formatters are for DSI, 3 pairs for VID/CMD respectively.
 * 2 of the formatters are for DPI.
 *
 * Behind the formatters are the DSI or DPI ports that route to
 * the external pins of the chip. As there are 3 DSI ports and one
 * DPI port, it is possible to configure up to 4 display pipelines
 * (effectively using channels 0..3) for concurrent use.
 *
 * In the current DRM/KMS setup, we use one external source, one overlay,
 * one FIFO and one formatter which we connect to the simple DMA framebuffer
 * helpers. We then provide a bridge to the DSI port, and on the DSI port
 * bridge we connect hang a panel bridge or other bridge. This may be subject
 * to change as we exploit more of the hardware capabilities.
 *
 * TODO:
 *
 * - Enabled damaged rectangles using drm_plane_enable_fb_damage_clips()
 *   so we can selectively just transmit the damaged area to a
 *   command-only display.
 * - Enable mixing of more planes, possibly at the cost of moving away
 *   from using the simple framebuffer pipeline.
 * - Enable output to bridges such as the AV8100 HDMI encoder from
 *   the DSI bridge.
 */

#include <linux/clk.h>
#include <linux/component.h>
#include <linux/dma-buf.h>
#include <linux/irq.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/delay.h>

#include <drm/drm_atomic_helper.h>
#include <drm/drm_bridge.h>
#include <drm/drm_drv.h>
#include <drm/drm_fb_dma_helper.h>
#include <drm/drm_fbdev_dma.h>
#include <drm/drm_gem.h>
#include <drm/drm_gem_dma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_managed.h>
#include <drm/drm_of.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_panel.h>
#include <drm/drm_vblank.h>

#include "mcde_drm.h"

#define DRIVER_DESC

#define MCDE_PID
#define MCDE_PID_METALFIX_VERSION_SHIFT
#define MCDE_PID_METALFIX_VERSION_MASK
#define MCDE_PID_DEVELOPMENT_VERSION_SHIFT
#define MCDE_PID_DEVELOPMENT_VERSION_MASK
#define MCDE_PID_MINOR_VERSION_SHIFT
#define MCDE_PID_MINOR_VERSION_MASK
#define MCDE_PID_MAJOR_VERSION_SHIFT
#define MCDE_PID_MAJOR_VERSION_MASK

static const struct drm_mode_config_funcs mcde_mode_config_funcs =;

static const struct drm_mode_config_helper_funcs mcde_mode_config_helpers =;

static irqreturn_t mcde_irq(int irq, void *data)
{}

static int mcde_modeset_init(struct drm_device *drm)
{}

DEFINE_DRM_GEM_DMA_FOPS(drm_fops);

static const struct drm_driver mcde_drm_driver =;

static int mcde_drm_bind(struct device *dev)
{}

static void mcde_drm_unbind(struct device *dev)
{}

static const struct component_master_ops mcde_drm_comp_ops =;

static struct platform_driver *const mcde_component_drivers[] =;

static int mcde_probe(struct platform_device *pdev)
{}

static void mcde_remove(struct platform_device *pdev)
{}

static void mcde_shutdown(struct platform_device *pdev)
{}

static const struct of_device_id mcde_of_match[] =;

static struct platform_driver mcde_driver =;

static struct platform_driver *const component_drivers[] =;

static int __init mcde_drm_register(void)
{}

static void __exit mcde_drm_unregister(void)
{}

module_init();
module_exit(mcde_drm_unregister);

MODULE_ALIAS();
MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();