/* SPDX-License-Identifier: GPL-2.0-only */ /* * * (C) COPYRIGHT 2013-2016 ARM Limited. All rights reserved. * * ARM Mali DP hardware manipulation routines.
*/
#ifndef __MALIDP_HW_H__ #define __MALIDP_HW_H__
#include <linux/bitops.h> #include"malidp_regs.h"
struct videomode; struct clk;
/* Mali DP IP blocks */ enum {
MALIDP_DE_BLOCK = 0,
MALIDP_SE_BLOCK,
MALIDP_DC_BLOCK
};
/* Mali DP layer IDs */ enum {
DE_VIDEO1 = BIT(0),
DE_GRAPHICS1 = BIT(1),
DE_GRAPHICS2 = BIT(2), /* used only in DP500 */
DE_VIDEO2 = BIT(3),
DE_SMART = BIT(4),
SE_MEMWRITE = BIT(5),
};
enum rotation_features {
ROTATE_NONE, /* does not support rotation at all */
ROTATE_ANY, /* supports rotation on any buffers */
ROTATE_COMPRESSED, /* supports rotation only on compressed buffers */
};
struct malidp_format_id {
u32 format; /* DRM fourcc */
u8 layer; /* bitmask of layers supporting it */
u8 id; /* used internally */
};
#define MALIDP_INVALID_FORMAT_ID 0xff
/* * hide the differences between register maps * by using a common structure to hold the * base register offsets
*/
struct malidp_irq_map {
u32 irq_mask; /* mask of IRQs that can be enabled in the block */
u32 vsync_irq; /* IRQ bit used for signaling during VSYNC */
u32 err_mask; /* mask of bits that represent errors */
};
struct malidp_layer {
u16 id; /* layer ID */
u16 base; /* address offset for the register bank */
u16 ptr; /* address offset for the pointer register */
u16 stride_offset; /* offset to the first stride register. */
s16 yuv2rgb_offset; /* offset to the YUV->RGB matrix entries */
u16 mmu_ctrl_offset; /* offset to the MMU control register */ enum rotation_features rot; /* type of rotation supported */ /* address offset for the AFBC decoder registers */
u16 afbc_decoder_offset;
};
struct malidp_hw_regmap { /* address offset of the DE register bank */ /* is always 0x0000 */ /* address offset of the DE coefficients registers */ const u16 coeffs_base; /* address offset of the SE registers bank */ const u16 se_base; /* address offset of the DC registers bank */ const u16 dc_base;
/* address offset for the output depth register */ const u16 out_depth_base;
/* bitmap with register map features */ const u8 features;
/* list of supported layers */ const u8 n_layers; conststruct malidp_layer *layers;
/* device features */ /* Unlike DP550/650, DP500 has 3 stride registers in its video layer. */ #define MALIDP_DEVICE_LV_HAS_3_STRIDES BIT(0)
struct malidp_hw_device;
/* * Static structure containing hardware specific data and pointers to * functions that behave differently between various versions of the IP.
*/ struct malidp_hw { conststruct malidp_hw_regmap map;
/* * Validate the driver instance against the hardware bits
*/ int (*query_hw)(struct malidp_hw_device *hwdev);
/* * Set the hardware into config mode, ready to accept mode changes
*/ void (*enter_config_mode)(struct malidp_hw_device *hwdev);
/* * Query if hardware is in configuration mode
*/ bool (*in_config_mode)(struct malidp_hw_device *hwdev);
/* * Set/clear configuration valid flag for hardware parameters that can * be changed outside the configuration mode to the given value. * Hardware will use the new settings when config valid is set, * after the end of the current buffer scanout, and will ignore * any new values for those parameters if config valid flag is cleared
*/ void (*set_config_valid)(struct malidp_hw_device *hwdev, u8 value);
/* * Set a new mode in hardware. Requires the hardware to be in * configuration mode before this function is called.
*/ void (*modeset)(struct malidp_hw_device *hwdev, struct videomode *m);
/* * Calculate the required rotation memory given the active area * and the buffer format.
*/ int (*rotmem_required)(struct malidp_hw_device *hwdev, u16 w, u16 h,
u32 fmt, bool has_modifier);
int (*se_set_scaling_coeffs)(struct malidp_hw_device *hwdev, struct malidp_se_config *se_config, struct malidp_se_config *old_config);
long (*se_calc_mclk)(struct malidp_hw_device *hwdev, struct malidp_se_config *se_config, struct videomode *vm); /* * Enable writing to memory the content of the next frame * @param hwdev - malidp_hw_device structure containing the HW description * @param addrs - array of addresses for each plane * @param pitches - array of pitches for each plane * @param num_planes - number of planes to be written * @param w - width of the output frame * @param h - height of the output frame * @param fmt_id - internal format ID of output buffer
*/ int (*enable_memwrite)(struct malidp_hw_device *hwdev, dma_addr_t *addrs,
s32 *pitches, int num_planes, u16 w, u16 h, u32 fmt_id, const s16 *rgb2yuv_coeffs);
/* * Disable the writing to memory of the next frame's content.
*/ void (*disable_memwrite)(struct malidp_hw_device *hwdev);
u8 features;
};
/* Supported variants of the hardware */ enum {
MALIDP_500 = 0,
MALIDP_550,
MALIDP_650, /* keep the next entry last */
MALIDP_MAX_DEVICES
};
malidp_hw_write(hwdev, val, image_enh); for (i = 0; i < ARRAY_SIZE(enhancer_coeffs); ++i)
malidp_hw_write(hwdev, enhancer_coeffs[i], enh_coeffs + i * 4);
}
/* * background color components are defined as 12bits values, * they will be shifted right when stored on hardware that * supports only 8bits per channel
*/ #define MALIDP_BGND_COLOR_R 0x000 #define MALIDP_BGND_COLOR_G 0x000 #define MALIDP_BGND_COLOR_B 0x000
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.