diff --git a/include/platform/mipi_dsi_if.h b/include/platform/mipi_dsi_if.h index ca6b5d6cb2a7601f1da624ae93a05707c1f830a3..f3c3e646764b5a86420cb1b103dcb724bdfc5675 100644 --- a/include/platform/mipi_dsi_if.h +++ b/include/platform/mipi_dsi_if.h @@ -291,6 +291,18 @@ int32_t MipiDsiRx(DevHandle handle, struct DsiCmdDesc *cmd, int32_t readLen, uin */ int32_t MipiDsiAttach(DevHandle handle, uint8_t *name); +/** + * @brief Sets additional parameters for a MIPI DSI device. + * + * @param handle Indicates the MIPI DSI device handle obtained via {@link MipiDsiOpen}. + * @param panelData Indicates the pointer to the additional parameters. + * + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 1.0 + */ +int32_t MipiDsiSetDrvData(DevHandle handle, DevHandle *panelData); + #ifdef __cplusplus #if __cplusplus } diff --git a/support/platform/include/mipi_dsi_core.h b/support/platform/include/mipi_dsi_core.h index 58fa709c06ba7f29e57548c84d4332abf7b74729..a5ec094122a228ba6f516fc83c633767148c543f 100644 --- a/support/platform/include/mipi_dsi_core.h +++ b/support/platform/include/mipi_dsi_core.h @@ -45,6 +45,7 @@ struct MipiDsiCntlrMethod { void (*exitUlps)(struct MipiDsiCntlr *cntlr); int32_t (*powerControl)(struct MipiDsiCntlr *cntlr, uint8_t enable); int32_t (*attach)(struct MipiDsiCntlr *cntlr, uint8_t *name); + int32_t (*setDrvData)(struct MipiDsiCntlr *cntlr, DevHandle *panelData); }; int32_t MipiDsiRegisterCntlr(struct MipiDsiCntlr *cntlr, struct HdfDeviceObject *device); @@ -160,6 +161,18 @@ int32_t MipiDsiCntlrRx(struct MipiDsiCntlr *cntlr, struct DsiCmdDesc *cmd, int32 */ int32_t MipiDsiCntlrAttach(struct MipiDsiCntlr *cntlr, uint8_t *name); +/** + * @brief Sets additional parameters for a MIPI DSI device. + * + * @param cntlr Indicates the MIPI DSI device obtained via {@link MipiDsiOpen}. + * @param panelData Indicates the pointer to the additional parameters. + * + * @return Returns 0 if the operation is successful; returns a negative value otherwise. + * + * @since 1.0 + */ +int32_t MipiDsiCntlrSetDrvData(struct MipiDsiCntlr *cntlr, DevHandle *panelData); + #ifdef __cplusplus #if __cplusplus } diff --git a/support/platform/src/mipi_dsi_core.c b/support/platform/src/mipi_dsi_core.c index 8d75f5b1311358a4726f953ab3526dba8806889c..51ec6d3527d205fe6cecb96c4aaee92c1ff52cfb 100644 --- a/support/platform/src/mipi_dsi_core.c +++ b/support/platform/src/mipi_dsi_core.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * * HDF is dual licensed: you can use it either under the terms of * the GPL, or the BSD license, at your option. @@ -352,3 +352,30 @@ int32_t MipiDsiCntlrAttach(struct MipiDsiCntlr *cntlr, uint8_t *name) return ret; } + +int32_t MipiDsiCntlrSetDrvData(struct MipiDsiCntlr *cntlr, DevHandle *panelData) +{ + int32_t ret; + + if ((cntlr == NULL) || (cntlr->ops == NULL)) { + HDF_LOGE("%s: cntlr or ops is NULL.", __func__); + return HDF_FAILURE; + } + + if (cntlr->ops->setDrvData == NULL) { + HDF_LOGE("%s: setDrvData is NULL.", __func__); + return HDF_ERR_NOT_SUPPORT; + } + + (void)OsalMutexLock(&(cntlr->lock)); + ret = cntlr->ops->setDrvData(cntlr, panelData); + (void)OsalMutexUnlock(&(cntlr->lock)); + + if (ret == HDF_SUCCESS) { + HDF_LOGI("%s: success!", __func__); + } else { + HDF_LOGE("%s: failed!", __func__); + } + + return ret; +} diff --git a/support/platform/src/mipi_dsi_if.c b/support/platform/src/mipi_dsi_if.c index a1c4827494f60a177da331a8af495ea2016d0c16..afd5d260afe25defb36ac0b8dc17c5012e194774 100755 --- a/support/platform/src/mipi_dsi_if.c +++ b/support/platform/src/mipi_dsi_if.c @@ -55,3 +55,8 @@ int32_t MipiDsiAttach(DevHandle handle, uint8_t *name) { return MipiDsiCntlrAttach((struct MipiDsiCntlr *)handle, name); } + +int32_t MipiDsiSetDrvData(DevHandle handle, DevHandle *panelData) +{ + return MipiDsiCntlrSetDrvData((struct MipiDsiCntlr *)handle, panelData); +}