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 07ABEC77B61 for ; Tue, 25 Apr 2023 07:58:07 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F315786236; Tue, 25 Apr 2023 09:57:46 +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="ZbUSh4FS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5853E8619E; Tue, 25 Apr 2023 09:57:37 +0200 (CEST) Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) (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 74DE886247 for ; Tue, 25 Apr 2023 09:57:32 +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-x32e.google.com with SMTP id 5b1f17b1804b1-3f19ab99540so30769605e9.2 for ; Tue, 25 Apr 2023 00:57:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682409452; x=1685001452; 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=b1YoGoghmeu2tk0+iGjT5VhLFBG6026lrXDEx4cwG1o=; b=ZbUSh4FSlAEKqWtXCh3k0PWaV26Kr1M1t2ZjHYK69tN2VULuZREU4Gg7klmV7khSrv j+CIkw5M/in0hC4AS9DKHJ8fqKI+0xdgmQy7DMqdHIOnYK1o3sM4KS1ZK8E2Yx4RNxb3 uDO5ldbfwjf3tHiXjhA8Yfl0yzk/3JHMrmaFKHbHIMbiuz2i7DdhqNP81nwyyPek+Aj+ sCKE/G6BTKsPiyDSNEU/LjXr5wu2YzkRyyCBSP+bTGHqKq3Aen+jQ15gJyyIO+eU2HQI FVAMxK8pL3Emp9tkJwoqQLCNuclGy8BKOsmHss/+5Et6bvDPxdR2Ksw7pcCvMWxSBySt KNhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682409452; x=1685001452; 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=b1YoGoghmeu2tk0+iGjT5VhLFBG6026lrXDEx4cwG1o=; b=VdXltYI+1LRP0gMFWaZnfgnAAvUhmpwtLLuHQs4lVi9pbg09DobJHpaYWOAL6oO5TP JZCpErPV7TfUubaNM3BPvePsHq39g02hNhLTMmqrglzc7o2wr+8r9sbqQt3vKpaYUvdz IC5wtUr6z2q1QGwjnDqFkZQCpI9cTPnO36tzTxXa2gMMxu0aaHOWNmWpbaB+V372fKJW tlWrPw/Dpy4HWMRlDw6fV/QQ+8wwuanV0By2Ge66tDyZF6WknfpJ6FFgF9mYtVEWXYKQ FPMT4bshVIxBaiX+qehi1hLn5ZJx9KZfymGwfDBfIn5c2Gv2XwIxZWuqpJC+yqpRk7/K /ipg== X-Gm-Message-State: AAQBX9d02CxqgbH8o22vv96Jhv2aqiWKOYISapsviNUqAGhVGf+XK+eO 1ZgHV9OIv2fCP5prW6afJSuqXJLfltPlpw== X-Google-Smtp-Source: AKy350YFdtwlIx5bkujE6YXnJfPGQUvqvFulblTkCOGnbdy6FYL5PW2vF51DRZ+qpO1xJ1S63ShxeA== X-Received: by 2002:a1c:ed01:0:b0:3f1:8c59:4713 with SMTP id l1-20020a1ced01000000b003f18c594713mr10009441wmh.12.1682409451889; Tue, 25 Apr 2023 00:57:31 -0700 (PDT) Received: from xeon.. ([188.163.112.59]) by smtp.gmail.com with ESMTPSA id k3-20020a7bc403000000b003f1745c7df3sm14218004wmi.23.2023.04.25.00.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 00:57:31 -0700 (PDT) From: Svyatoslav Ryhel To: Simon Glass , Svyatoslav Ryhel Cc: u-boot@lists.denx.de Subject: [PATCH v4 2/3] test: Add tests for the extcon Date: Tue, 25 Apr 2023 10:57:21 +0300 Message-Id: <20230425075722.49186-3-clamor95@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230425075722.49186-1-clamor95@gmail.com> References: <20230425075722.49186-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 Reviewed-by: Simon Glass --- 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.39.2