18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) Icenowy Zheng <icenowy@aosc.io> 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Based on sun4i_layer.h, which is: 68c2ecf20Sopenharmony_ci * Copyright (C) 2015 Free Electrons 78c2ecf20Sopenharmony_ci * Copyright (C) 2015 NextThing Co 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * Maxime Ripard <maxime.ripard@free-electrons.com> 108c2ecf20Sopenharmony_ci */ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#ifndef _SUN8I_UI_LAYER_H_ 138c2ecf20Sopenharmony_ci#define _SUN8I_UI_LAYER_H_ 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#include <drm/drm_plane.h> 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#define SUN8I_MIXER_CHAN_UI_LAYER_ATTR(base, layer) \ 188c2ecf20Sopenharmony_ci ((base) + 0x20 * (layer) + 0x0) 198c2ecf20Sopenharmony_ci#define SUN8I_MIXER_CHAN_UI_LAYER_SIZE(base, layer) \ 208c2ecf20Sopenharmony_ci ((base) + 0x20 * (layer) + 0x4) 218c2ecf20Sopenharmony_ci#define SUN8I_MIXER_CHAN_UI_LAYER_COORD(base, layer) \ 228c2ecf20Sopenharmony_ci ((base) + 0x20 * (layer) + 0x8) 238c2ecf20Sopenharmony_ci#define SUN8I_MIXER_CHAN_UI_LAYER_PITCH(base, layer) \ 248c2ecf20Sopenharmony_ci ((base) + 0x20 * (layer) + 0xc) 258c2ecf20Sopenharmony_ci#define SUN8I_MIXER_CHAN_UI_LAYER_TOP_LADDR(base, layer) \ 268c2ecf20Sopenharmony_ci ((base) + 0x20 * (layer) + 0x10) 278c2ecf20Sopenharmony_ci#define SUN8I_MIXER_CHAN_UI_LAYER_BOT_LADDR(base, layer) \ 288c2ecf20Sopenharmony_ci ((base) + 0x20 * (layer) + 0x14) 298c2ecf20Sopenharmony_ci#define SUN8I_MIXER_CHAN_UI_LAYER_FCOLOR(base, layer) \ 308c2ecf20Sopenharmony_ci ((base) + 0x20 * (layer) + 0x18) 318c2ecf20Sopenharmony_ci#define SUN8I_MIXER_CHAN_UI_TOP_HADDR(base) \ 328c2ecf20Sopenharmony_ci ((base) + 0x80) 338c2ecf20Sopenharmony_ci#define SUN8I_MIXER_CHAN_UI_BOT_HADDR(base) \ 348c2ecf20Sopenharmony_ci ((base) + 0x84) 358c2ecf20Sopenharmony_ci#define SUN8I_MIXER_CHAN_UI_OVL_SIZE(base) \ 368c2ecf20Sopenharmony_ci ((base) + 0x88) 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_EN BIT(0) 398c2ecf20Sopenharmony_ci#define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MODE_MASK GENMASK(2, 1) 408c2ecf20Sopenharmony_ci#define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_MASK GENMASK(12, 8) 418c2ecf20Sopenharmony_ci#define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_OFFSET 8 428c2ecf20Sopenharmony_ci#define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MASK GENMASK(31, 24) 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_cistruct sun8i_mixer; 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_cistruct sun8i_ui_layer { 478c2ecf20Sopenharmony_ci struct drm_plane plane; 488c2ecf20Sopenharmony_ci struct sun8i_mixer *mixer; 498c2ecf20Sopenharmony_ci int channel; 508c2ecf20Sopenharmony_ci int overlay; 518c2ecf20Sopenharmony_ci}; 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_cistatic inline struct sun8i_ui_layer * 548c2ecf20Sopenharmony_ciplane_to_sun8i_ui_layer(struct drm_plane *plane) 558c2ecf20Sopenharmony_ci{ 568c2ecf20Sopenharmony_ci return container_of(plane, struct sun8i_ui_layer, plane); 578c2ecf20Sopenharmony_ci} 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_cistruct sun8i_ui_layer *sun8i_ui_layer_init_one(struct drm_device *drm, 608c2ecf20Sopenharmony_ci struct sun8i_mixer *mixer, 618c2ecf20Sopenharmony_ci int index); 628c2ecf20Sopenharmony_ci#endif /* _SUN8I_UI_LAYER_H_ */ 63