aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/gcx/gccore/gcmain.h
blob: e2931d479c14f504811544dc436ce809cd7e8089 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
 * gcmain.h
 *
 * Copyright (C) 2010-2011 Vivante Corporation.
 *
 * This package is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#ifndef GCMAIN_H
#define GCMAIN_H

#include <linux/gcx.h>
#include <linux/gccore.h>
#include "gcmmu.h"

#define GC_DEV_NAME	"gccore"


/*******************************************************************************
 * Power management modes.
 */

enum gcpower {
	GCPWR_UNKNOWN,
	GCPWR_ON,
	GCPWR_LOW,
	GCPWR_OFF
};


/*******************************************************************************
 * Driver context.
 */

struct omap_gcx_platform_data;

struct gccorecontext {
	/* GPU IRQ line. */
	int irqline;

	/* Capabilities and characteristics. */
	unsigned int gcmodel;
	unsigned int gcrevision;
	unsigned int gcdate;
	unsigned int gctime;
	union gcfeatures gcfeatures;
	union gcfeatures0 gcfeatures0;
	union gcfeatures1 gcfeatures1;
	union gcfeatures2 gcfeatures2;
	union gcfeatures3 gcfeatures3;

	/* Virtual pointer to the GPU register bank. */
	void *regbase;

	/* Platform driver install flag. */
	bool platdriver;
	struct omap_gcx_platform_data *plat;

	/* Pointers to the gccore and BB2D devices. */
	struct device *device;
	struct device *bb2ddevice;

	/* Current power mode. */
	enum gcpower gcpower;
	GCLOCK_TYPE powerlock;
	GCLOCK_TYPE resetlock;

	/* Current graphics pipe. */
	enum gcpipe gcpipe;

	/* Power mode flags. */
	bool clockenabled;
	int pulseskipping;

	/* MMU and command buffer managers. */
	struct gcmmu gcmmu;
	struct gcqueue gcqueue;

	/* MMU context lists. */
	struct list_head mmuctxlist;
	struct list_head mmuctxvac;
	GCLOCK_TYPE mmucontextlock;

	/* Device frequency scaling. */
	int opp_count;
	unsigned long *opp_freqs;
	unsigned long  cur_freq;
};


/*******************************************************************************
 * Register access.
 */

unsigned int gc_read_reg(unsigned int address);
void gc_write_reg(unsigned int address, unsigned int data);


/*******************************************************************************
 * Power management.
 */

enum gcpower gcpwr_get(void);
void gcpwr_set(struct gccorecontext *gccorecontext, enum gcpower gcpower);
void gcpwr_reset(struct gccorecontext *gccorecontext);
unsigned int gcpwr_get_speed(void);

#endif