From 093501371b86e022f6993197d1fa4c52ae578305 Mon Sep 17 00:00:00 2001 From: YOUR_NAME Date: Tue, 7 Sep 2021 20:45:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E4=BA=8EMIPI=20DSI=E7=9A=84DRM?= =?UTF-8?q?=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: YOUR_NAME --- include/platform/mipi_dsi_if.h | 12 ++++++++++ support/platform/include/mipi_dsi_core.h | 13 +++++++++++ support/platform/src/mipi_dsi_core.c | 29 +++++++++++++++++++++++- support/platform/src/mipi_dsi_if.c | 5 ++++ 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/include/platform/mipi_dsi_if.h b/include/platform/mipi_dsi_if.h index ca6b5d6cb..f3c3e6467 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 58fa709c0..a5ec09412 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 8d75f5b13..51ec6d352 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 a1c482749..afd5d260a 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); +} -- Gitee