1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #include "hdmi_core.h" 10 11 #define HDF_LOG_TAG hdmi_ddc_c 12 HdmiCntlrDdcTransfer(struct HdmiCntlr * cntlr,struct HdmiDdcCfg * ddcCfg)13static int32_t HdmiCntlrDdcTransfer(struct HdmiCntlr *cntlr, struct HdmiDdcCfg *ddcCfg) 14 { 15 int32_t ret; 16 17 if (cntlr == NULL || cntlr->ops == NULL || cntlr->ops->ddcTransfer == NULL) { 18 return HDF_ERR_INVALID_OBJECT; 19 } 20 if (ddcCfg == NULL) { 21 return HDF_ERR_INVALID_PARAM; 22 } 23 HdmiCntlrLock(cntlr); 24 ret = cntlr->ops->ddcTransfer(cntlr, ddcCfg); 25 HdmiCntlrUnlock(cntlr); 26 return ret; 27 } 28 HdmiDdcTransfer(struct HdmiDdc * ddc,struct HdmiDdcCfg * cfg)29int32_t HdmiDdcTransfer(struct HdmiDdc *ddc, struct HdmiDdcCfg *cfg) 30 { 31 int32_t ret; 32 33 if (ddc == NULL || cfg == NULL) { 34 return HDF_ERR_INVALID_PARAM; 35 } 36 37 if (cfg->mode >= HDMI_DDC_MODE_BUTT) { 38 return HDF_ERR_INVALID_PARAM; 39 } 40 41 (void)OsalMutexLock(&(ddc->ddcMutex)); 42 ret = HdmiCntlrDdcTransfer(ddc->priv, cfg); 43 (void)OsalMutexUnlock(&(ddc->ddcMutex)); 44 return ret; 45 } 46