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 D5EFBC6FD18 for ; Tue, 25 Apr 2023 07:57:52 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 04933861E5; Tue, 25 Apr 2023 09:57:45 +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="iBsSeESU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 282D4861A4; Tue, 25 Apr 2023 09:57:37 +0200 (CEST) Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) (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 CCC1386245 for ; Tue, 25 Apr 2023 09:57:31 +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-x32f.google.com with SMTP id 5b1f17b1804b1-3f1958d3a53so39799005e9.0 for ; Tue, 25 Apr 2023 00:57:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682409451; x=1685001451; 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=e36b2RjS0WRQZQYPlBNCD4fyw8Wor9NSCIDsMWK7D84=; b=iBsSeESUPTBZ+bK11a/JMir47OqnI1cv+qK2FwoeHoCNEWU/OOmU1LPRFzz8138Zcl Tr8vmUIawqRizmINbji1hSxIKnTtol1psADk0IBsdR1rQfeg4FlC3iingEmvnrt55C+T VrGlO/clU6HHG3bzCvsbnXlXOU7PAvRHp369KKGAFcprivxFqV1Q+Dy18jJDQd+2lFUs myrVHGq8A/nHjSHaXMT34F3wEGzIlPPOTyVtCowND/+rXuEwHg2xrmCPOPHcYntGbeVU zYn1xACA3n4XLne993BOcn74OhGVPCjk7jwuroDZGgcb+ucLqXxlhz3bRF1FiWIswK6R 4Ewg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682409451; x=1685001451; 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=e36b2RjS0WRQZQYPlBNCD4fyw8Wor9NSCIDsMWK7D84=; b=FKVLNnf7T7rTBZQtCU8fJ5mB21lG+XDqzL37V1LaUlBJhBhYCGxBgRc54uYY0wlZBe viy/OxeQS4mueUZ4zZ+ymOX1Ky4/aoRlwbzIAH9ZvNuSu+RiW2OItAP18Ag4dEEVaYFF qbq4twTUkk6Hd/mIUu3RGRsnHskG3osagBuZWpNwyUoIiu6L2ZJXsv/jY4cLP+1BcYOo Ls8fptPlw24h4eg40mDtAABLY8WZLdBACWtPaku/wuzKe/iKU54zo44hSdtZyZUrjulc DCCbMcuv3tpSh0xUII66FegSqOzbrXbb4F0QS/rsQCtYSxiFxv/MQZ7UIUcxb5R9ASYB PpIw== X-Gm-Message-State: AAQBX9fIapSaneIVJjEuWOdUPcwqVqH+D1/SoA7xpmGX/IsXZC1A6UXH IBJlrJhEyqYnXSz1LPJrvya9okJHWsP1PQ== X-Google-Smtp-Source: AKy350Zbtvj6MoiJPieWLcCIM8YU976WCC2V/2merq16GEvztY+vtcoSfiX0JgB0qKZNOhod+aPINw== X-Received: by 2002:a05:600c:378a:b0:3f1:8992:3618 with SMTP id o10-20020a05600c378a00b003f189923618mr9537899wmr.13.1682409451145; 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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 00:57:30 -0700 (PDT) From: Svyatoslav Ryhel To: Simon Glass , Svyatoslav Ryhel Cc: u-boot@lists.denx.de Subject: [PATCH v4 1/3] dm: extcon: add an uclass for extcon Date: Tue, 25 Apr 2023 10:57:20 +0300 Message-Id: <20230425075722.49186-2-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 Add a new simple uclass for extcon. Currently all setup is done in the probe. Uclass struct and ops are empty for now. Signed-off-by: Svyatoslav Ryhel Reviewed-by: Simon Glass --- drivers/Kconfig | 2 ++ drivers/Makefile | 1 + drivers/extcon/Kconfig | 15 +++++++++++++++ drivers/extcon/Makefile | 5 +++++ drivers/extcon/extcon-uclass.c | 16 ++++++++++++++++ include/dm/uclass-id.h | 1 + include/extcon.h | 19 +++++++++++++++++++ 7 files changed, 59 insertions(+) create mode 100644 drivers/extcon/Kconfig create mode 100644 drivers/extcon/Makefile create mode 100644 drivers/extcon/extcon-uclass.c create mode 100644 include/extcon.h diff --git a/drivers/Kconfig b/drivers/Kconfig index 9101e538b0..75937fbb6d 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -36,6 +36,8 @@ source "drivers/dfu/Kconfig" source "drivers/dma/Kconfig" +source "drivers/extcon/Kconfig" + source "drivers/fastboot/Kconfig" source "drivers/firmware/Kconfig" diff --git a/drivers/Makefile b/drivers/Makefile index 58be410135..ed1e71c4d6 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -9,6 +9,7 @@ obj-$(CONFIG_$(SPL_TPL_)DM) += core/ obj-$(CONFIG_$(SPL_TPL_)DMA) += dma/ obj-$(CONFIG_$(SPL_TPL_)DMA_LEGACY) += dma/ obj-$(CONFIG_$(SPL_TPL_)DFU) += dfu/ +obj-$(CONFIG_$(SPL_TPL_)EXTCON) += extcon/ obj-$(CONFIG_$(SPL_TPL_)GPIO) += gpio/ obj-$(CONFIG_$(SPL_TPL_)DRIVERS_MISC) += misc/ obj-$(CONFIG_$(SPL_TPL_)SYSRESET) += sysreset/ diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig new file mode 100644 index 0000000000..8a50250d21 --- /dev/null +++ b/drivers/extcon/Kconfig @@ -0,0 +1,15 @@ +menu "Extcon Support" + +config EXTCON + bool "External Connector Class (extcon) support" + depends on DM + help + Say Y here to enable external connector class (extcon) support. + This allows monitoring external connectors and supports external + connectors with multiple states; i.e., an extcon that may have + multiple cables attached. For example, an external connector + of a device may be used to connect an HDMI cable and a AC adaptor, + and to host USB ports. Many of 30-pin connectors including PDMI + are also good examples. + +endmenu diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile new file mode 100644 index 0000000000..2510e91c07 --- /dev/null +++ b/drivers/extcon/Makefile @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2023 Svyatoslav Ryhel + +obj-$(CONFIG_EXTCON) += extcon-uclass.o diff --git a/drivers/extcon/extcon-uclass.c b/drivers/extcon/extcon-uclass.c new file mode 100644 index 0000000000..9dd22b5762 --- /dev/null +++ b/drivers/extcon/extcon-uclass.c @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2023 Svyatoslav Ryhel + */ + +#define LOG_CATEGORY UCLASS_EXTCON + +#include +#include +#include + +UCLASS_DRIVER(extcon) = { + .id = UCLASS_EXTCON, + .name = "extcon", + .per_device_plat_auto = sizeof(struct extcon_uc_plat), +}; diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h index 576237b954..94ab46c5ba 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -56,6 +56,7 @@ enum uclass_id { UCLASS_EFI_MEDIA, /* Devices provided by UEFI firmware */ UCLASS_ETH, /* Ethernet device */ UCLASS_ETH_PHY, /* Ethernet PHY device */ + UCLASS_EXTCON, /* External Connector Class */ UCLASS_FIRMWARE, /* Firmware */ UCLASS_FPGA, /* FPGA device */ UCLASS_FUZZING_ENGINE, /* Fuzzing engine */ diff --git a/include/extcon.h b/include/extcon.h new file mode 100644 index 0000000000..d060f5a3c1 --- /dev/null +++ b/include/extcon.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2023 Svyatoslav Ryhel + */ + +#ifndef __EXTCON_H +#define __EXTCON_H + +struct udevice; + +/** + * struct extcon_uc_plat - Platform data the uclass stores about each device + * + * To be filled + */ +struct extcon_uc_plat { +}; + +#endif -- 2.39.2