162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * VRFB Rotation Engine
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2009 Nokia Corporation
662306a36Sopenharmony_ci * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef __OMAP_VRFB_H__
1062306a36Sopenharmony_ci#define __OMAP_VRFB_H__
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#define OMAP_VRFB_LINE_LEN 2048
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_cistruct vrfb {
1562306a36Sopenharmony_ci	u8 context;
1662306a36Sopenharmony_ci	void __iomem *vaddr[4];
1762306a36Sopenharmony_ci	unsigned long paddr[4];
1862306a36Sopenharmony_ci	u16 xres;
1962306a36Sopenharmony_ci	u16 yres;
2062306a36Sopenharmony_ci	u16 xoffset;
2162306a36Sopenharmony_ci	u16 yoffset;
2262306a36Sopenharmony_ci	u8 bytespp;
2362306a36Sopenharmony_ci	bool yuv_mode;
2462306a36Sopenharmony_ci};
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#ifdef CONFIG_OMAP2_VRFB
2762306a36Sopenharmony_ciextern bool omap_vrfb_supported(void);
2862306a36Sopenharmony_ciextern int omap_vrfb_request_ctx(struct vrfb *vrfb);
2962306a36Sopenharmony_ciextern void omap_vrfb_release_ctx(struct vrfb *vrfb);
3062306a36Sopenharmony_ciextern void omap_vrfb_adjust_size(u16 *width, u16 *height,
3162306a36Sopenharmony_ci		u8 bytespp);
3262306a36Sopenharmony_ciextern u32 omap_vrfb_min_phys_size(u16 width, u16 height, u8 bytespp);
3362306a36Sopenharmony_ciextern u16 omap_vrfb_max_height(u32 phys_size, u16 width, u8 bytespp);
3462306a36Sopenharmony_ciextern void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
3562306a36Sopenharmony_ci		u16 width, u16 height,
3662306a36Sopenharmony_ci		unsigned bytespp, bool yuv_mode);
3762306a36Sopenharmony_ciextern int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot);
3862306a36Sopenharmony_ciextern void omap_vrfb_restore_context(void);
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#else
4162306a36Sopenharmony_cistatic inline bool omap_vrfb_supported(void) { return false; }
4262306a36Sopenharmony_cistatic inline int omap_vrfb_request_ctx(struct vrfb *vrfb) { return 0; }
4362306a36Sopenharmony_cistatic inline void omap_vrfb_release_ctx(struct vrfb *vrfb) {}
4462306a36Sopenharmony_cistatic inline void omap_vrfb_adjust_size(u16 *width, u16 *height,
4562306a36Sopenharmony_ci		u8 bytespp) {}
4662306a36Sopenharmony_cistatic inline u32 omap_vrfb_min_phys_size(u16 width, u16 height, u8 bytespp)
4762306a36Sopenharmony_ci		{ return 0; }
4862306a36Sopenharmony_cistatic inline u16 omap_vrfb_max_height(u32 phys_size, u16 width, u8 bytespp)
4962306a36Sopenharmony_ci		{ return 0; }
5062306a36Sopenharmony_cistatic inline void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
5162306a36Sopenharmony_ci		u16 width, u16 height, unsigned bytespp, bool yuv_mode) {}
5262306a36Sopenharmony_cistatic inline int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot)
5362306a36Sopenharmony_ci		{ return 0; }
5462306a36Sopenharmony_cistatic inline void omap_vrfb_restore_context(void) {}
5562306a36Sopenharmony_ci#endif
5662306a36Sopenharmony_ci#endif /* __VRFB_H */
57