cregit-Linux how code gets into the kernel

Release 4.12 drivers/gpu/drm/sun4i/sun4i_crtc.c

/*
 * Copyright (C) 2015 Free Electrons
 * Copyright (C) 2015 NextThing Co
 *
 * Maxime Ripard <maxime.ripard@free-electrons.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 */

#include <drm/drmP.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_modes.h>

#include <linux/clk-provider.h>
#include <linux/ioport.h>
#include <linux/of_address.h>
#include <linux/of_graph.h>
#include <linux/of_irq.h>
#include <linux/regmap.h>

#include <video/videomode.h>

#include "sun4i_backend.h"
#include "sun4i_crtc.h"
#include "sun4i_drv.h"
#include "sun4i_layer.h"
#include "sun4i_tcon.h"


static void sun4i_crtc_atomic_begin(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); struct drm_device *dev = crtc->dev; unsigned long flags; if (crtc->state->event) { WARN_ON(drm_crtc_vblank_get(crtc) != 0); spin_lock_irqsave(&dev->event_lock, flags); scrtc->event = crtc->state->event; spin_unlock_irqrestore(&dev->event_lock, flags); crtc->state->event = NULL; } }

Contributors

PersonTokensPropCommitsCommitProp
Maxime Ripard97100.00%1100.00%
Total97100.00%1100.00%


static void sun4i_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); struct drm_pending_vblank_event *event = crtc->state->event; DRM_DEBUG_DRIVER("Committing plane changes\n"); sun4i_backend_commit(scrtc->backend); if (event) { crtc->state->event = NULL; spin_lock_irq(&crtc->dev->event_lock); if (drm_crtc_vblank_get(crtc) == 0) drm_crtc_arm_vblank_event(crtc, event); else drm_crtc_send_vblank_event(crtc, event); spin_unlock_irq(&crtc->dev->event_lock); } }

Contributors

PersonTokensPropCommitsCommitProp
Daniel Vetter6863.55%133.33%
Maxime Ripard3835.51%133.33%
Chen-Yu Tsai10.93%133.33%
Total107100.00%3100.00%


static void sun4i_crtc_disable(struct drm_crtc *crtc) { struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); DRM_DEBUG_DRIVER("Disabling the CRTC\n"); sun4i_tcon_disable(scrtc->tcon); if (crtc->state->event && !crtc->state->active) { spin_lock_irq(&crtc->dev->event_lock); drm_crtc_send_vblank_event(crtc, crtc->state->event); spin_unlock_irq(&crtc->dev->event_lock); crtc->state->event = NULL; } }

Contributors

PersonTokensPropCommitsCommitProp
Maxime Ripard8898.88%266.67%
Chen-Yu Tsai11.12%133.33%
Total89100.00%3100.00%


static void sun4i_crtc_enable(struct drm_crtc *crtc) { struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); DRM_DEBUG_DRIVER("Enabling the CRTC\n"); sun4i_tcon_enable(scrtc->tcon); }

Contributors

PersonTokensPropCommitsCommitProp
Maxime Ripard3296.97%150.00%
Chen-Yu Tsai13.03%150.00%
Total33100.00%2100.00%

static const struct drm_crtc_helper_funcs sun4i_crtc_helper_funcs = { .atomic_begin = sun4i_crtc_atomic_begin, .atomic_flush = sun4i_crtc_atomic_flush, .disable = sun4i_crtc_disable, .enable = sun4i_crtc_enable, };
static int sun4i_crtc_enable_vblank(struct drm_crtc *crtc) { struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); DRM_DEBUG_DRIVER("Enabling VBLANK on crtc %p\n", crtc); sun4i_tcon_enable_vblank(scrtc->tcon, true); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Shawn Guo3997.50%150.00%
Chen-Yu Tsai12.50%150.00%
Total40100.00%2100.00%


static void sun4i_crtc_disable_vblank(struct drm_crtc *crtc) { struct sun4i_crtc *scrtc = drm_crtc_to_sun4i_crtc(crtc); DRM_DEBUG_DRIVER("Disabling VBLANK on crtc %p\n", crtc); sun4i_tcon_enable_vblank(scrtc->tcon, false); }

Contributors

PersonTokensPropCommitsCommitProp
Shawn Guo3697.30%150.00%
Chen-Yu Tsai12.70%150.00%
Total37100.00%2100.00%

static const struct drm_crtc_funcs sun4i_crtc_funcs = { .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, .destroy = drm_crtc_cleanup, .page_flip = drm_atomic_helper_page_flip, .reset = drm_atomic_helper_crtc_reset, .set_config = drm_atomic_helper_set_config, .enable_vblank = sun4i_crtc_enable_vblank, .disable_vblank = sun4i_crtc_disable_vblank, };
struct sun4i_crtc *sun4i_crtc_init(struct drm_device *drm, struct sun4i_backend *backend, struct sun4i_tcon *tcon) { struct sun4i_crtc *scrtc; struct drm_plane *primary = NULL, *cursor = NULL; int ret, i; scrtc = devm_kzalloc(drm->dev, sizeof(*scrtc), GFP_KERNEL); if (!scrtc) return ERR_PTR(-ENOMEM); scrtc->backend = backend; scrtc->tcon = tcon; /* Create our layers */ scrtc->layers = sun4i_layers_init(drm, scrtc->backend); if (IS_ERR(scrtc->layers)) { dev_err(drm->dev, "Couldn't create the planes\n"); return NULL; } /* find primary and cursor planes for drm_crtc_init_with_planes */ for (i = 0; scrtc->layers[i]; i++) { struct sun4i_layer *layer = scrtc->layers[i]; switch (layer->plane.type) { case DRM_PLANE_TYPE_PRIMARY: primary = &layer->plane; break; case DRM_PLANE_TYPE_CURSOR: cursor = &layer->plane; break; default: break; } } ret = drm_crtc_init_with_planes(drm, &scrtc->crtc, primary, cursor, &sun4i_crtc_funcs, NULL); if (ret) { dev_err(drm->dev, "Couldn't init DRM CRTC\n"); return ERR_PTR(ret); } drm_crtc_helper_add(&scrtc->crtc, &sun4i_crtc_helper_funcs); /* Set crtc.port to output port node of the tcon */ scrtc->crtc.port = of_graph_get_port_by_id(scrtc->tcon->dev->of_node, 1); /* Set possible_crtcs to this crtc for overlay planes */ for (i = 0; scrtc->layers[i]; i++) { uint32_t possible_crtcs = BIT(drm_crtc_index(&scrtc->crtc)); struct sun4i_layer *layer = scrtc->layers[i]; if (layer->plane.type == DRM_PLANE_TYPE_OVERLAY) layer->plane.possible_crtcs = possible_crtcs; } return scrtc; }

Contributors

PersonTokensPropCommitsCommitProp
Chen-Yu Tsai22769.63%990.00%
Maxime Ripard9930.37%110.00%
Total326100.00%10100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Maxime Ripard46654.38%215.38%
Chen-Yu Tsai23827.77%969.23%
Shawn Guo859.92%17.69%
Daniel Vetter687.93%17.69%
Total857100.00%13100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.