Skip to content
Snippets Groups Projects
Commit e8326c31 authored by John Bauman's avatar John Bauman Committed by CQ bot account: commit-bot@chromium.org
Browse files

[aml-gpu][fidl] Add FIDL versions of GPU ioctls

This ioctl is only used to set the clock frequency source on mali on
amlogic. I'll remove the ioctl version once thermd in garnet is
converted.

Test: vkcube on vim2
ZX-2829

Change-Id: I0121c0fdb4a84712cc82ac23ab9dac810fdb3464
parent 7f0bff23
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@
#include <ddk/protocol/platform/bus.h>
#include <ddk/protocol/platform/device.h>
#include <ddk/protocol/platform-device-lib.h>
#include <fuchsia/gpu/clock/c/fidl.h>
#include <hw/reg.h>
#include <stdint.h>
#include <stdio.h>
......@@ -170,11 +171,31 @@ static zx_status_t aml_gpu_ioctl(void* ctx, uint32_t op,
}
}
static zx_status_t aml_gpu_SetFrequencySource(void* ctx, uint32_t clk_source, fidl_txn_t* txn) {
aml_gpu_t* gpu = ctx;
if (clk_source >= MAX_GPU_CLK_FREQ) {
GPU_ERROR("Invalid clock freq source index\n");
return fuchsia_gpu_clock_ClockSetFrequencySource_reply(txn, ZX_ERR_NOT_SUPPORTED);
}
aml_gpu_set_clk_freq_source(gpu, clk_source);
return fuchsia_gpu_clock_ClockSetFrequencySource_reply(txn, ZX_OK);
}
static fuchsia_gpu_clock_Clock_ops_t fidl_ops = {
.SetFrequencySource = aml_gpu_SetFrequencySource
};
static zx_status_t aml_gpu_message(void* ctx, fidl_msg_t* msg, fidl_txn_t* txn) {
return fuchsia_gpu_clock_Clock_dispatch(ctx, txn, msg, &fidl_ops);
}
static zx_protocol_device_t aml_gpu_protocol = {
.version = DEVICE_OPS_VERSION,
.release = aml_gpu_release,
.get_protocol = aml_gpu_get_protocol,
.ioctl = aml_gpu_ioctl,
.message = aml_gpu_message,
};
static zx_status_t aml_gpu_bind(void* ctx, zx_device_t* parent) {
......
......@@ -12,7 +12,7 @@ MODULE_SRCS += \
$(LOCAL_DIR)/aml-gpu.c \
$(LOCAL_DIR)/aml-s905d2g.c \
MODULE_STATIC_LIBS := system/ulib/ddk system/ulib/sync system/dev/lib/amlogic
MODULE_STATIC_LIBS := system/ulib/ddk system/ulib/sync system/dev/lib/amlogic system/ulib/fidl
MODULE_LIBS := system/ulib/driver system/ulib/c system/ulib/zircon
......@@ -23,6 +23,9 @@ MODULE_BANJO_LIBS := \
system/banjo/ddk-protocol-platform-device \
system/banjo/ddk-protocol-scpi \
MODULE_FIDL_LIBS := \
system/fidl/fuchsia-gpu-clock \
MODULE_HEADER_DEPS := \
system/dev/lib/amlogic
......
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.gpu.clock;
using zx;
[Layout = "Simple"]
interface Clock {
1: SetFrequencySource(uint32 source) -> (zx.status s);
};
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
LOCAL_DIR := $(GET_LOCAL_DIR)
MODULE := $(LOCAL_DIR)
MODULE_TYPE := fidl
MODULE_PACKAGE := fidl
MODULE_FIDL_LIBRARY := fuchsia.gpu.clock
MODULE_SRCS += $(LOCAL_DIR)/clock.fidl
include make/module.mk
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment