Files
system76-coreboot/src/soc/mediatek/common/ddp.c
Patrick Georgi 1c6d8a9cf4 soc: Remove copyright notices
They're listed in AUTHORS and often incorrect anyway, for example:
- What's a "Copyright $year-present"?
- Which incarnation of Google (Inc, LLC, ...) is the current
  copyright holder?
- People sometimes have their editor auto-add themselves to files even
  though they only deleted stuff
- Or they let the editor automatically update the copyright year,
  because why not?
- Who is the copyright holder "The coreboot project Authors"?
- Or "Generated Code"?

Sidestep all these issues by simply not putting these notices in
individual files, let's list all copyright holders in AUTHORS instead
and use the git history to deal with the rest.

Change-Id: I4c110f60b764c97fab2a29f6f04680196f156da5
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/39610
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
2020-03-18 16:44:46 +00:00

81 lines
2.3 KiB
C

/*
* This file is part of the coreboot project.
*
*
* 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; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <device/mmio.h>
#include <edid.h>
#include <stddef.h>
#include <soc/addressmap.h>
#include <soc/ddp.h>
#define RDMA_FIFO_PSEUDO_SIZE(bytes) (((bytes) / 16) << 16)
#define RDMA_OUTPUT_VALID_FIFO_THRESHOLD(bytes) ((bytes) / 16)
void ovl_set_roi(u32 idx, u32 width, u32 height, u32 color)
{
write32(&disp_ovl[idx]->roi_size, height << 16 | width);
write32(&disp_ovl[idx]->roi_bgclr, color);
}
void rdma_start(void)
{
setbits32(&disp_rdma0->global_con, RDMA_ENGINE_EN);
}
void rdma_config(u32 width, u32 height, u32 pixel_clk, u32 fifo_size)
{
u32 threshold;
u32 reg;
clrsetbits32(&disp_rdma0->size_con_0, 0x1FFF, width);
clrsetbits32(&disp_rdma0->size_con_1, 0xFFFFF, height);
/*
* Enable FIFO underflow since DSI and DPI can't be blocked. Set the
* output threshold to 6 microseconds with 7/6 overhead to account for
* blanking, and with a pixel depth of 4 bytes:
*/
threshold = pixel_clk * 4 * 7 / 1000;
if (threshold > fifo_size)
threshold = fifo_size;
reg = RDMA_FIFO_UNDERFLOW_EN | RDMA_FIFO_PSEUDO_SIZE(fifo_size) |
RDMA_OUTPUT_VALID_FIFO_THRESHOLD(threshold);
write32(&disp_rdma0->fifo_con, reg);
}
void color_start(u32 width, u32 height)
{
write32(&disp_color0->width, width);
write32(&disp_color0->height, height);
write32(&disp_color0->cfg_main, COLOR_BYPASS_ALL | COLOR_SEQ_SEL);
write32(&disp_color0->start, BIT(0));
}
void ovl_layer_config(u32 fmt, u32 bpp, u32 width, u32 height)
{
struct disp_ovl_regs *const ovl0 = disp_ovl[0];
write32(&ovl0->layer[0].con, fmt << 12);
write32(&ovl0->layer[0].src_size, height << 16 | width);
write32(&ovl0->layer[0].pitch, (width * bpp) & 0xFFFF);
/* Enable layer */
write32(&ovl0->rdma[0].ctrl, BIT(0));
write32(&ovl0->rdma[0].mem_gmc_setting, RDMA_MEM_GMC);
setbits32(&ovl0->src_con, BIT(0));
}