Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9D1ACC7618E for ; Fri, 21 Apr 2023 07:05:55 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E99F586173; Fri, 21 Apr 2023 09:05:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cKXPTDd8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E93A38615C; Fri, 21 Apr 2023 09:05:22 +0200 (CEST) Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A30948615C for ; Fri, 21 Apr 2023 09:05:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=clamor95@gmail.com Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3f0a80b686eso9056125e9.1 for ; Fri, 21 Apr 2023 00:05:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682060719; x=1684652719; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1xt5lfRtcIxoKAcOOwzu31zlTAo5u/iKhOZS+nxF4bE=; b=cKXPTDd8hlhEs+sbdAWJBwK/qltOmpm+/Jh1pORlzoxYM14CPl15Z/Jjo7B/3ALko+ y75FEavl8sQF4TPg/7sGswGWG4FAfOzoO8fdbXZXGkIXVtuOdkjGA1zJomToZbMLBmpE 72F84OufSZqCKaTREJIKS1EjwwdqXfBpbo+PVtwLrtGOtsatWDrnQjW23zE0mHfAQcYz LYCaagZUUQa5/k7gNv58mYWmh5gqAnF6jaJYlGyMwf/EoiwDdtzcCf0jsyORS9EuOJ4+ N59OuXTmW7uQT+1KdvU6jbd3zBD8c62OtOBX0gI1h8fjkSgAhyI0LPzemsEloJ18x9lM edRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682060719; x=1684652719; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1xt5lfRtcIxoKAcOOwzu31zlTAo5u/iKhOZS+nxF4bE=; b=b265gE6bzW01CS3Pnyv2hy+k2NqmgcfNpdrSEisGfTOERS51l0VGfA3ppjGAOsoWny fmhXuPvvxRdMrEF5ilhfJ0LHYID0PjW8WH5EWpchaZFZ9p26BpM7pdONImN8UQ7sHgbn coN5NKSCWrFbEvQFq5t8zFf9zeFwjZuwECHObWqMdFznVPI11iJQHyF98MIHaT3YQEzx yse/7VHL9ekYB1f6+2eX4h1oJTJ69KlhEXdmddyCoxx1rwh+N8ass8kt/uVFSVNqAMtQ eNfuygQcz/BmUeZhNDlgyUDkWn+51kZiqfOPd7zsqJ6RkrA4jKiQKNRB7g1iiHalEHOi hiUQ== X-Gm-Message-State: AAQBX9cRJ42MOrKg0uvFlfh+6SUXkuX27tOFAz4OTi8AhLaCJrPp2SMO lVFilcMaJla7fBh5yVmkhAE= X-Google-Smtp-Source: AKy350aOCFxQE9vLi2z2bElnAT7HnlbXi1lDwYv/8aMSX1RS30jxjBglW8smQe0ysjB9LFanUipXJg== X-Received: by 2002:a05:6000:1819:b0:300:2067:f5d8 with SMTP id m25-20020a056000181900b003002067f5d8mr3359811wrh.65.1682060718972; Fri, 21 Apr 2023 00:05:18 -0700 (PDT) Received: from xeon.. ([188.163.112.59]) by smtp.gmail.com with ESMTPSA id p6-20020adfe606000000b002ff1751ec79sm3700367wrm.65.2023.04.21.00.05.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Apr 2023 00:05:18 -0700 (PDT) From: Svyatoslav Ryhel To: Simon Glass , Svyatoslav Ryhel Cc: u-boot@lists.denx.de Subject: [PATCH v3 2/3] test: Add tests for the extcon Date: Fri, 21 Apr 2023 10:05:03 +0300 Message-Id: <20230421070504.26035-3-clamor95@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230421070504.26035-1-clamor95@gmail.com> References: <20230421070504.26035-1-clamor95@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Provide tests to the simple extcon device. Signed-off-by: Svyatoslav Ryhel --- arch/sandbox/dts/test.dts | 4 ++++ drivers/extcon/Kconfig | 7 +++++++ drivers/extcon/Makefile | 1 + drivers/extcon/extcon-sandbox.c | 17 +++++++++++++++++ test/dm/Makefile | 1 + test/dm/extcon.c | 21 +++++++++++++++++++++ 6 files changed, 51 insertions(+) create mode 100644 drivers/extcon/extcon-sandbox.c create mode 100644 test/dm/extcon.c diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 7c1ee71cb7..731b48459d 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -1802,6 +1802,10 @@ compatible = "u-boot,fwu-mdata-gpt"; fwu-mdata-store = <&mmc0>; }; + + extcon { + compatible = "sandbox,extcon"; + }; }; #include "sandbox_pmic.dtsi" diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig index 8a50250d21..6fd3d2b97b 100644 --- a/drivers/extcon/Kconfig +++ b/drivers/extcon/Kconfig @@ -12,4 +12,11 @@ config EXTCON and to host USB ports. Many of 30-pin connectors including PDMI are also good examples. +config EXTCON_SANDBOX + bool "Sandbox extcon" + depends on EXTCON + help + Enable extcon support for sandbox. This is an emulation of a real + extcon. Currectly all configuration is done in the probe. + endmenu diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile index 2510e91c07..c4223d97d1 100644 --- a/drivers/extcon/Makefile +++ b/drivers/extcon/Makefile @@ -3,3 +3,4 @@ # Copyright (C) 2023 Svyatoslav Ryhel obj-$(CONFIG_EXTCON) += extcon-uclass.o +obj-$(CONFIG_EXTCON_SANDBOX) += extcon-sandbox.o diff --git a/drivers/extcon/extcon-sandbox.c b/drivers/extcon/extcon-sandbox.c new file mode 100644 index 0000000000..ab6a6c1cfd --- /dev/null +++ b/drivers/extcon/extcon-sandbox.c @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2022 Svyatoslav Ryhel + */ + +#include + +static const struct udevice_id sandbox_extcon_ids[] = { + { .compatible = "sandbox,extcon" }, + { /* sentinel */ } +}; + +U_BOOT_DRIVER(extcon_sandbox) = { + .name = "extcon_sandbox", + .id = UCLASS_EXTCON, + .of_match = sandbox_extcon_ids, +}; diff --git a/test/dm/Makefile b/test/dm/Makefile index e15bdbf04b..5ada659974 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -44,6 +44,7 @@ obj-$(CONFIG_DM_DSA) += dsa.o obj-$(CONFIG_ECDSA_VERIFY) += ecdsa.o obj-$(CONFIG_EFI_MEDIA_SANDBOX) += efi_media.o obj-$(CONFIG_DM_ETH) += eth.o +obj-$(CONFIG_EXTCON) += extcon.o ifneq ($(CONFIG_EFI_PARTITION),) obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fastboot.o endif diff --git a/test/dm/extcon.c b/test/dm/extcon.c new file mode 100644 index 0000000000..6a4e22bfdc --- /dev/null +++ b/test/dm/extcon.c @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2023 Svyatoslav Ryhel + */ + +#include +#include +#include +#include +#include + +static int dm_test_extcon(struct unit_test_state *uts) +{ + struct udevice *dev; + + ut_assertok(uclass_get_device_by_name(UCLASS_EXTCON, "extcon", &dev)); + + return 0; +} + +DM_TEST(dm_test_extcon, UT_TESTF_SCAN_FDT); -- 2.37.2