18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Tegra host1x Channel
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2010-2013, NVIDIA Corporation.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __HOST1X_CHANNEL_H
98c2ecf20Sopenharmony_ci#define __HOST1X_CHANNEL_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/io.h>
128c2ecf20Sopenharmony_ci#include <linux/kref.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include "cdma.h"
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_cistruct host1x;
178c2ecf20Sopenharmony_cistruct host1x_channel;
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_cistruct host1x_channel_list {
208c2ecf20Sopenharmony_ci	struct host1x_channel *channels;
218c2ecf20Sopenharmony_ci	unsigned long *allocated_channels;
228c2ecf20Sopenharmony_ci};
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cistruct host1x_channel {
258c2ecf20Sopenharmony_ci	struct kref refcount;
268c2ecf20Sopenharmony_ci	unsigned int id;
278c2ecf20Sopenharmony_ci	struct mutex submitlock;
288c2ecf20Sopenharmony_ci	void __iomem *regs;
298c2ecf20Sopenharmony_ci	struct host1x_client *client;
308c2ecf20Sopenharmony_ci	struct device *dev;
318c2ecf20Sopenharmony_ci	struct host1x_cdma cdma;
328c2ecf20Sopenharmony_ci};
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/* channel list operations */
358c2ecf20Sopenharmony_ciint host1x_channel_list_init(struct host1x_channel_list *chlist,
368c2ecf20Sopenharmony_ci			     unsigned int num_channels);
378c2ecf20Sopenharmony_civoid host1x_channel_list_free(struct host1x_channel_list *chlist);
388c2ecf20Sopenharmony_cistruct host1x_channel *host1x_channel_get_index(struct host1x *host,
398c2ecf20Sopenharmony_ci						unsigned int index);
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#endif
42