blob: f36a722bbc6c13d98be78c849ec2df7ae99156db [file] [log] [blame]
Xo Wang3f87de82016-09-22 11:17:01 -07001/**
2 * Copyright © 2016 Google Inc.
3 * Copyright © 2016 IBM Corporation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef __POWER_GPIO_H__
19#define __POWER_GPIO_H__
20
21#include <stddef.h>
22#include <glib.h>
23#include "gpio.h"
24
25typedef struct PowerGpio {
26 /* Active high pin that is asserted following successful host power up. */
27 GPIO power_good_in;
28 /* Selectable polarity pins enabling host power rails. */
29 size_t num_power_up_outs;
30 GPIO *power_up_outs;
31 /* TRUE for active high */
32 gboolean *power_up_pols;
33 /* Selectable polarity pins holding system complexes in reset. */
34 size_t num_reset_outs;
35 GPIO *reset_outs;
36 /* TRUE for active high */
37 gboolean *reset_pols;
38} PowerGpio;
39
40/* Read system configuration for power GPIOs. */
41gboolean read_power_gpio(GDBusConnection *connection, PowerGpio *power_gpio);
42/* Frees internal buffers. Does not free parameter. Does not close GPIOs. */
43void free_power_gpio(PowerGpio *power_gpio);
44
45#endif