From f4095abc8be294699f0141236e83529acfed0372 Mon Sep 17 00:00:00 2001 From: sunxuejiao Date: Wed, 13 Oct 2021 03:37:42 +0000 Subject: [PATCH 1/3] =?UTF-8?q?ci=E6=B5=8B=E8=AF=95=EF=BC=8C=E8=AF=AF?= =?UTF-8?q?=E5=90=88=E5=85=A5=20Signed-off-by:=20sunxuejiao=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/sensor/driver/accel/sensor_accel_driver.c | 1 + 1 file changed, 1 insertion(+) diff --git a/model/sensor/driver/accel/sensor_accel_driver.c b/model/sensor/driver/accel/sensor_accel_driver.c index 7f9a88370..cd0a548b0 100644 --- a/model/sensor/driver/accel/sensor_accel_driver.c +++ b/model/sensor/driver/accel/sensor_accel_driver.c @@ -6,6 +6,7 @@ * See the LICENSE file in the root of this repository for complete details. */ + #include "sensor_accel_driver.h" #include #include "hdf_base.h" -- Gitee From 6006648a68d014d1585518afe344410854c69a5b Mon Sep 17 00:00:00 2001 From: sunxuejiao Date: Mon, 18 Oct 2021 09:15:43 +0000 Subject: [PATCH 2/3] =?UTF-8?q?ci=E6=B5=8B=E8=AF=95=EF=BC=8C=E5=8B=BF?= =?UTF-8?q?=E5=90=88=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit f4095abc8be294699f0141236e83529acfed0372 --- model/misc/vibrator/driver/chipset/vibrator_linear_driver.c | 1 + 1 file changed, 1 insertion(+) diff --git a/model/misc/vibrator/driver/chipset/vibrator_linear_driver.c b/model/misc/vibrator/driver/chipset/vibrator_linear_driver.c index b6959fca1..2e8eb28e4 100644 --- a/model/misc/vibrator/driver/chipset/vibrator_linear_driver.c +++ b/model/misc/vibrator/driver/chipset/vibrator_linear_driver.c @@ -24,6 +24,7 @@ static struct VibratorLinearDriverData *GetLinearVibratorData(void) return g_linearVibratorData; } + static int32_t StartLinearVibrator() { int32_t ret; -- Gitee From af84681b0b55018f225fa5ff68695e9d93ba2e7c Mon Sep 17 00:00:00 2001 From: sunxuejiao Date: Mon, 18 Oct 2021 09:18:32 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20mode?= =?UTF-8?q?l/misc/vibrator/driver/chipset/vibrator=5Flinear=5Fdriver.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../driver/chipset/vibrator_linear_driver.c | 189 ------------------ 1 file changed, 189 deletions(-) delete mode 100644 model/misc/vibrator/driver/chipset/vibrator_linear_driver.c diff --git a/model/misc/vibrator/driver/chipset/vibrator_linear_driver.c b/model/misc/vibrator/driver/chipset/vibrator_linear_driver.c deleted file mode 100644 index 2e8eb28e4..000000000 --- a/model/misc/vibrator/driver/chipset/vibrator_linear_driver.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * 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. - * See the LICENSE file in the root of this repository for complete details. - */ - -#include "vibrator_linear_driver.h" -#include -#include "device_resource_if.h" -#include "gpio_if.h" -#include "hdf_base.h" -#include "hdf_device_desc.h" -#include "osal_mem.h" -#include "vibrator_driver.h" -#include "vibrator_driver_type.h" - -#define HDF_LOG_TAG vibrator_linear_driver_c - -struct VibratorLinearDriverData *g_linearVibratorData = NULL; -static struct VibratorLinearDriverData *GetLinearVibratorData(void) -{ - return g_linearVibratorData; -} - - -static int32_t StartLinearVibrator() -{ - int32_t ret; - struct VibratorLinearDriverData *drvData = GetLinearVibratorData(); - CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(drvData, HDF_FAILURE); - - if (drvData->busType != VIBRATOR_BUS_GPIO) { - HDF_LOGE("%s: vibrator bus type not gpio", __func__); - return HDF_FAILURE; - } - - ret = GpioWrite(drvData->gpioNum, GPIO_VAL_LOW); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: pull gpio%d to %d level failed", __func__, drvData->gpioNum, GPIO_VAL_LOW); - return ret; - } - return HDF_SUCCESS; -} - -static int32_t StartEffectLinearVibrator(uint32_t effectType) -{ - (void)effectType; - HDF_LOGE("%s: vibrator set build-in effect no support!", __func__); - return HDF_SUCCESS; -} - -static int32_t StopLinearVibrator() -{ - int32_t ret; - struct VibratorLinearDriverData *drvData = GetLinearVibratorData(); - CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(drvData, HDF_FAILURE); - - if (drvData->busType != VIBRATOR_BUS_GPIO) { - HDF_LOGE("%s: vibrator bus type not gpio", __func__); - return HDF_FAILURE; - } - - ret = GpioWrite(drvData->gpioNum, GPIO_VAL_HIGH); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%s: pull gpio%d to %d level failed", __func__, drvData->gpioNum, GPIO_VAL_HIGH); - return ret; - } - return HDF_SUCCESS; -} - -static int32_t DispatchLinearVibrator(struct HdfDeviceIoClient *client, - int32_t cmd, struct HdfSBuf *data, struct HdfSBuf *reply) -{ - (void)client; - (void)cmd; - (void)data; - (void)reply; - - return HDF_SUCCESS; -} - -int32_t BindLinearVibratorDriver(struct HdfDeviceObject *device) -{ - struct VibratorLinearDriverData *drvData = NULL; - - CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(device, HDF_FAILURE); - - drvData = (struct VibratorLinearDriverData *)OsalMemCalloc(sizeof(*drvData)); - CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(drvData, HDF_ERR_MALLOC_FAIL); - - drvData->ioService.Dispatch = DispatchLinearVibrator; - drvData->device = device; - device->service = &drvData->ioService; - g_linearVibratorData = drvData; - - return HDF_SUCCESS; -} - -static int32_t ParserLinearConfig(const struct DeviceResourceNode *node, struct VibratorLinearDriverData *drvData) -{ - int32_t ret; - struct DeviceResourceIface *parser = NULL; - const struct DeviceResourceNode *configNode = NULL; - - CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(node, HDF_FAILURE); - CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(drvData, HDF_FAILURE); - - parser = DeviceResourceGetIfaceInstance(HDF_CONFIG_SOURCE); - CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(parser, HDF_ERR_INVALID_PARAM); - CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(parser->GetChildNode, HDF_ERR_INVALID_PARAM); - - configNode = parser->GetChildNode(node, "vibratorChipConfig"); - ret = parser->GetUint32(configNode, "busType", &drvData->busType, 0); - CHECK_VIBRATOR_PARSER_RESULT_RETURN_VALUE(ret, "busType"); - if (drvData->busType == VIBRATOR_BUS_GPIO) { - ret = parser->GetUint32(configNode, "gpioNum", &drvData->gpioNum, 0); - CHECK_VIBRATOR_PARSER_RESULT_RETURN_VALUE(ret, "gpioNum"); - } - - ret = parser->GetUint32(configNode, "startReg", &drvData->startReg, 0); - CHECK_VIBRATOR_PARSER_RESULT_RETURN_VALUE(ret, "startReg"); - ret = parser->GetUint32(configNode, "stopReg", &drvData->stopReg, 0); - CHECK_VIBRATOR_PARSER_RESULT_RETURN_VALUE(ret, "stopReg"); - ret = parser->GetUint32(configNode, "startMask", &drvData->mask, 0); - CHECK_VIBRATOR_PARSER_RESULT_RETURN_VALUE(ret, "startMask"); - - return HDF_SUCCESS; -} - -int32_t InitLinearVibratorDriver(struct HdfDeviceObject *device) -{ - static struct VibratorOps ops; - struct VibratorLinearDriverData *drvData = NULL; - - CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(device, HDF_FAILURE); - - drvData = (struct VibratorLinearDriverData *)device->service; - CHECK_VIBRATOR_NULL_PTR_RETURN_VALUE(drvData, HDF_FAILURE); - - ops.Start = StartLinearVibrator; - ops.StartEffect = StartEffectLinearVibrator; - ops.Stop = StopLinearVibrator; - - if (RegisterVibrator(&ops) != HDF_SUCCESS) { - HDF_LOGE("%s: register vibrator ops fail", __func__); - return HDF_FAILURE; - } - - if (ParserLinearConfig(device->property, drvData) != HDF_SUCCESS) { - HDF_LOGE("%s: parser vibrator cfg fail", __func__); - return HDF_FAILURE; - } - - if (GpioSetDir(drvData->gpioNum, GPIO_DIR_OUT) != HDF_SUCCESS) { - HDF_LOGE("%s: set vibrator gpio fail", __func__); - return HDF_FAILURE; - } - return HDF_SUCCESS; -} - -void ReleaseLinearVibratorDriver(struct HdfDeviceObject *device) -{ - struct VibratorLinearDriverData *drvData = NULL; - - if (device == NULL) { - HDF_LOGE("%s: Device is null", __func__); - return; - } - drvData = (struct VibratorLinearDriverData *)device->service; - if (drvData == NULL) { - HDF_LOGE("%s: DrvData pointer is null", __func__); - return; - } - - (void)OsalMemFree(drvData); - g_linearVibratorData = NULL; -} - -struct HdfDriverEntry g_linearVibratorDriverEntry = { - .moduleVersion = 1, - .moduleName = "HDF_LINEAR_VIBRATOR", - .Bind = BindLinearVibratorDriver, - .Init = InitLinearVibratorDriver, - .Release = ReleaseLinearVibratorDriver, -}; - -HDF_INIT(g_linearVibratorDriverEntry); -- Gitee