Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2012-16 Advanced Micro Devices, Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  *
0022  * Authors: AMD
0023  *
0024  */
0025 
0026 #ifndef __DAL_GPIO_H__
0027 #define __DAL_GPIO_H__
0028 
0029 #include "gpio_types.h"
0030 
0031 
0032 union gpio_hw_container {
0033     struct hw_ddc *ddc;
0034     struct hw_generic *generic;
0035     struct hw_hpd *hpd;
0036 };
0037 
0038 struct gpio {
0039     struct gpio_service *service;
0040     struct hw_gpio_pin *pin;
0041     enum gpio_id id;
0042     uint32_t en;
0043 
0044     union gpio_hw_container hw_container;
0045     enum gpio_mode mode;
0046 
0047     /* when GPIO comes from VBIOS, it has defined output state */
0048     enum gpio_pin_output_state output_state;
0049 };
0050 
0051 #if 0
0052 struct gpio_funcs {
0053 
0054     struct hw_gpio_pin *(*create_ddc_data)(
0055         struct dc_context *ctx,
0056         enum gpio_id id,
0057         uint32_t en);
0058     struct hw_gpio_pin *(*create_ddc_clock)(
0059         struct dc_context *ctx,
0060         enum gpio_id id,
0061         uint32_t en);
0062     struct hw_gpio_pin *(*create_generic)(
0063         struct dc_context *ctx,
0064         enum gpio_id id,
0065         uint32_t en);
0066     struct hw_gpio_pin *(*create_hpd)(
0067         struct dc_context *ctx,
0068         enum gpio_id id,
0069         uint32_t en);
0070     struct hw_gpio_pin *(*create_gpio_pad)(
0071         struct dc_context *ctx,
0072         enum gpio_id id,
0073         uint32_t en);
0074     struct hw_gpio_pin *(*create_sync)(
0075         struct dc_context *ctx,
0076         enum gpio_id id,
0077         uint32_t en);
0078     struct hw_gpio_pin *(*create_gsl)(
0079         struct dc_context *ctx,
0080         enum gpio_id id,
0081         uint32_t en);
0082 
0083     /* HW translation */
0084     bool (*offset_to_id)(
0085         uint32_t offset,
0086         uint32_t mask,
0087         enum gpio_id *id,
0088         uint32_t *en);
0089     bool (*id_to_offset)(
0090         enum gpio_id id,
0091         uint32_t en,
0092         struct gpio_pin_info *info);
0093 };
0094 #endif
0095 
0096 #endif  /* __DAL_GPIO__ */