1#- 2# Copyright (c) 2016 Landon Fuller <landon@landonf.org> 3# Copyright (c) 2017 The FreeBSD Foundation 4# All rights reserved. 5# 6# Portions of this software were developed by Landon Fuller 7# under sponsorship from the FreeBSD Foundation. 8# 9# Redistribution and use in source and binary forms, with or without 10# modification, are permitted provided that the following conditions 11# are met: 12# 1. Redistributions of source code must retain the above copyright 13# notice, this list of conditions and the following disclaimer. 14# 2. Redistributions in binary form must reproduce the above copyright 15# notice, this list of conditions and the following disclaimer in the 16# documentation and/or other materials provided with the distribution. 17# 18# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21# IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 22# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 27# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28# 29# $FreeBSD$ 30 31#include <sys/types.h> 32#include <sys/bus.h> 33 34#include <dev/bhnd/bhnd.h> 35 36INTERFACE bhnd_pwrctl; 37 38# 39# bhnd(4) PWRCTL interface. 40# 41 42HEADER { 43 #include <dev/bhnd/bhnd.h> 44}; 45 46/** 47 * Request that @p clock (or a faster clock) be enabled on behalf of 48 * @p child. 49 * 50 * @param dev PWRCTL device. 51 * @param child The requesting bhnd(4) device. 52 * @param clock Clock requested. 53 * 54 * @retval 0 success 55 * @retval ENODEV If an unsupported clock was requested. 56 */ 57METHOD int request_clock { 58 device_t dev; 59 device_t child; 60 bhnd_clock clock; 61}; 62 63/** 64 * Return the transition latency required for @p clock in microseconds, if 65 * known. 66 * 67 * The BHND_CLOCK_HT latency value is suitable for use as the D11 core's 68 * 'fastpwrup_dly' value. 69 * 70 * @param dev PWRCTL device. 71 * @param clock The clock to be queried for transition latency. 72 * @param[out] latency On success, the transition latency of @p clock in 73 * microseconds. 74 * 75 * @retval 0 success 76 * @retval ENODEV If the transition latency for @p clock is not available. 77 */ 78METHOD int get_clock_latency { 79 device_t dev; 80 bhnd_clock clock; 81 u_int *latency; 82}; 83 84/** 85 * Return the frequency for @p clock in Hz, if known. 86 * 87 * @param dev PWRCTL device. 88 * @param clock The clock to be queried. 89 * @param[out] freq On success, the frequency of @p clock in Hz. 90 * 91 * @retval 0 success 92 * @retval ENODEV If the frequency for @p clock is not available. 93 */ 94METHOD int get_clock_freq { 95 device_t dev; 96 bhnd_clock clock; 97 u_int *freq; 98}; 99