mirror of
https://github.com/torvalds/linux.git
synced 2026-05-05 15:02:40 -04:00
Unfortunately the tooling doesn't check documents placed before funciton prototypes. Such comments frequently become outdated, miss several params, etc. Move documentation for the functions to be placed before the actual function body, allowing 'make W=1' to actually check these comments and report an error. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Patchwork: https://patchwork.freedesktop.org/patch/622690/ Link: https://lore.kernel.org/r/20241102-dpu-docs-rework-v1-1-d735853fd6db@linaro.org
104 lines
2.5 KiB
C
104 lines
2.5 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
|
|
*/
|
|
|
|
#include <drm/drm_managed.h>
|
|
|
|
#include "dpu_hwio.h"
|
|
#include "dpu_hw_catalog.h"
|
|
#include "dpu_hw_lm.h"
|
|
#include "dpu_hw_dspp.h"
|
|
#include "dpu_kms.h"
|
|
|
|
|
|
/* DSPP_PCC */
|
|
#define PCC_EN BIT(0)
|
|
#define PCC_DIS 0
|
|
#define PCC_RED_R_OFF 0x10
|
|
#define PCC_RED_G_OFF 0x1C
|
|
#define PCC_RED_B_OFF 0x28
|
|
#define PCC_GREEN_R_OFF 0x14
|
|
#define PCC_GREEN_G_OFF 0x20
|
|
#define PCC_GREEN_B_OFF 0x2C
|
|
#define PCC_BLUE_R_OFF 0x18
|
|
#define PCC_BLUE_G_OFF 0x24
|
|
#define PCC_BLUE_B_OFF 0x30
|
|
|
|
static void dpu_setup_dspp_pcc(struct dpu_hw_dspp *ctx,
|
|
struct dpu_hw_pcc_cfg *cfg)
|
|
{
|
|
|
|
u32 base;
|
|
|
|
if (!ctx) {
|
|
DRM_ERROR("invalid ctx %pK\n", ctx);
|
|
return;
|
|
}
|
|
|
|
base = ctx->cap->sblk->pcc.base;
|
|
|
|
if (!base) {
|
|
DRM_ERROR("invalid ctx %pK pcc base 0x%x\n", ctx, base);
|
|
return;
|
|
}
|
|
|
|
if (!cfg) {
|
|
DRM_DEBUG_DRIVER("disable pcc feature\n");
|
|
DPU_REG_WRITE(&ctx->hw, base, PCC_DIS);
|
|
return;
|
|
}
|
|
|
|
DPU_REG_WRITE(&ctx->hw, base + PCC_RED_R_OFF, cfg->r.r);
|
|
DPU_REG_WRITE(&ctx->hw, base + PCC_RED_G_OFF, cfg->r.g);
|
|
DPU_REG_WRITE(&ctx->hw, base + PCC_RED_B_OFF, cfg->r.b);
|
|
|
|
DPU_REG_WRITE(&ctx->hw, base + PCC_GREEN_R_OFF, cfg->g.r);
|
|
DPU_REG_WRITE(&ctx->hw, base + PCC_GREEN_G_OFF, cfg->g.g);
|
|
DPU_REG_WRITE(&ctx->hw, base + PCC_GREEN_B_OFF, cfg->g.b);
|
|
|
|
DPU_REG_WRITE(&ctx->hw, base + PCC_BLUE_R_OFF, cfg->b.r);
|
|
DPU_REG_WRITE(&ctx->hw, base + PCC_BLUE_G_OFF, cfg->b.g);
|
|
DPU_REG_WRITE(&ctx->hw, base + PCC_BLUE_B_OFF, cfg->b.b);
|
|
|
|
DPU_REG_WRITE(&ctx->hw, base, PCC_EN);
|
|
}
|
|
|
|
static void _setup_dspp_ops(struct dpu_hw_dspp *c,
|
|
unsigned long features)
|
|
{
|
|
if (test_bit(DPU_DSPP_PCC, &features))
|
|
c->ops.setup_pcc = dpu_setup_dspp_pcc;
|
|
}
|
|
|
|
/**
|
|
* dpu_hw_dspp_init() - Initializes the DSPP hw driver object.
|
|
* should be called once before accessing every DSPP.
|
|
* @dev: Corresponding device for devres management
|
|
* @cfg: DSPP catalog entry for which driver object is required
|
|
* @addr: Mapped register io address of MDP
|
|
* Return: pointer to structure or ERR_PTR
|
|
*/
|
|
struct dpu_hw_dspp *dpu_hw_dspp_init(struct drm_device *dev,
|
|
const struct dpu_dspp_cfg *cfg,
|
|
void __iomem *addr)
|
|
{
|
|
struct dpu_hw_dspp *c;
|
|
|
|
if (!addr)
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
c = drmm_kzalloc(dev, sizeof(*c), GFP_KERNEL);
|
|
if (!c)
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
c->hw.blk_addr = addr + cfg->base;
|
|
c->hw.log_mask = DPU_DBG_MASK_DSPP;
|
|
|
|
/* Assign ops */
|
|
c->idx = cfg->id;
|
|
c->cap = cfg;
|
|
_setup_dspp_ops(c, c->cap->features);
|
|
|
|
return c;
|
|
}
|