/* * Copyright 2012-15 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: AMD *
*/
/* * Pre-requisites: headers required by header of this unit
*/
if (!service->busyness[id]) {
ASSERT_CRITICAL(false); return GPIO_RESULT_OPEN_FAILED;
}
if (is_pin_busy(service, id, en)) {
ASSERT_CRITICAL(false); return GPIO_RESULT_DEVICE_BUSY;
}
switch (id) { case GPIO_ID_DDC_DATA:
*pin = service->factory.funcs->get_ddc_pin(gpio);
service->factory.funcs->define_ddc_registers(*pin, en); break; case GPIO_ID_DDC_CLOCK:
*pin = service->factory.funcs->get_ddc_pin(gpio);
service->factory.funcs->define_ddc_registers(*pin, en); break; case GPIO_ID_GENERIC:
*pin = service->factory.funcs->get_generic_pin(gpio);
service->factory.funcs->define_generic_registers(*pin, en); break; case GPIO_ID_HPD:
*pin = service->factory.funcs->get_hpd_pin(gpio);
service->factory.funcs->define_hpd_registers(*pin, en); break;
//TODO: gsl and sync support? create_sync and create_gsl are NULL case GPIO_ID_SYNC: case GPIO_ID_GSL: break; default:
ASSERT_CRITICAL(false); return GPIO_RESULT_NON_SPECIFIC_ERROR;
}
if (!*pin) {
ASSERT_CRITICAL(false); return GPIO_RESULT_NON_SPECIFIC_ERROR;
}
if (!(*pin)->funcs->open(*pin, mode)) {
ASSERT_CRITICAL(false);
dal_gpio_service_close(service, pin); return GPIO_RESULT_OPEN_FAILED;
}
if (result != GPIO_RESULT_OK) {
BREAK_TO_DEBUGGER(); return result;
}
result = dal_gpio_open_ex(ddc->pin_clock, mode);
if (result != GPIO_RESULT_OK) {
BREAK_TO_DEBUGGER(); goto failure;
}
/* DDC clock and data pins should belong * to the same DDC block id,
* we use the data pin to set the pad mode. */
if (mode == GPIO_MODE_INPUT) /* this is from detect_sink_type,
* we need extra delay there */
config_data.type = GPIO_CONFIG_TYPE_I2C_AUX_DUAL_MODE; else
config_data.type = GPIO_CONFIG_TYPE_DDC;
result = dal_gpio_change_mode(ddc->pin_data, mode);
/* [anaumov] DAL2 code returns GPIO_RESULT_NON_SPECIFIC_ERROR * in case of failures; * set_mode() is so that, in case of failure,
* we must explicitly set original mode */
if (result != GPIO_RESULT_OK) goto failure;
result = dal_gpio_change_mode(ddc->pin_clock, mode);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.