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 30#include <sys/types.h> 31#include <sys/bus.h> 32 33#include <dev/bhnd/bhnd.h> 34 35INTERFACE bhnd_pwrctl; 36 37# 38# bhnd(4) PWRCTL interface. 39# 40 41HEADER { 42 #include <dev/bhnd/bhnd.h> 43}; 44 45/** 46 * Request that @p clock (or a faster clock) be enabled on behalf of 47 * @p child. 48 * 49 * @param dev PWRCTL device. 50 * @param child The requesting bhnd(4) device. 51 * @param clock Clock requested. 52 * 53 * @retval 0 success 54 * @retval ENODEV If an unsupported clock was requested. 55 */ 56METHOD int request_clock { 57 device_t dev; 58 device_t child; 59 bhnd_clock clock; 60}; 61 62/** 63 * Return the transition latency required for @p clock in microseconds, if 64 * known. 65 * 66 * The BHND_CLOCK_HT latency value is suitable for use as the D11 core's 67 * 'fastpwrup_dly' value. 68 * 69 * @param dev PWRCTL device. 70 * @param clock The clock to be queried for transition latency. 71 * @param[out] latency On success, the transition latency of @p clock in 72 * microseconds. 73 * 74 * @retval 0 success 75 * @retval ENODEV If the transition latency for @p clock is not available. 76 */ 77METHOD int get_clock_latency { 78 device_t dev; 79 bhnd_clock clock; 80 u_int *latency; 81}; 82 83/** 84 * Return the frequency for @p clock in Hz, if known. 85 * 86 * @param dev PWRCTL device. 87 * @param clock The clock to be queried. 88 * @param[out] freq On success, the frequency of @p clock in Hz. 89 * 90 * @retval 0 success 91 * @retval ENODEV If the frequency for @p clock is not available. 92 */ 93METHOD int get_clock_freq { 94 device_t dev; 95 bhnd_clock clock; 96 u_int *freq; 97}; 98