Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1498305ybh; Sun, 19 Jul 2020 22:50:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaGKumnJz9aWJpZsjelbPWznEq5Y+3vxjFLWtxk+bY/Wl8NLT/HnpJsPtQ2yuCcR9Ma0KA X-Received: by 2002:a17:907:72cc:: with SMTP id du12mr17551838ejc.357.1595224216955; Sun, 19 Jul 2020 22:50:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595224216; cv=none; d=google.com; s=arc-20160816; b=pCnsjJryq264ozvAyNaCs830qJxAZBrvNCh3MQ200UIrkRVrPxG/BMylWD05OJ47S4 ANgZuLADmrxoqNDaQQyGrL5aXQoW5TnqL4j8ddv5vDj2Kdk9l9Y/0tqiYH8nkMgwOhAL 5m7xvj0Ka7ttVKBppD4rYluU1Zx+cRi9LIVZZPfIlgySQmV9zTHw/lYPRKKyR3ffKM76 sgPF2N+jhVtqbjqOMw/CzMJb0wO3bHceZMXxunYPCmEU6amvpOq/rictCx576YO18uVo HxWeV1MHgx8UJP3mQqkPXZ837TB4JmhUWcuvA/q5642Oa1jQ18zDAFOQjLUVV2XiwLMJ lQlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rQMYS8GPViemdBCwGtXgr4XomnsVhh0epuBKtBNluTw=; b=EFlq2KX2+Xyk20Or8GiYUqk95XGdDVREIkLXMI1houhYjh/i2f7r3MknvRmxgqCdRW sa4qSixrXKlAa4bYh7ezvd9T8kFkGP5fBrokKF29LPHRMlqUzNmxHrCbmyzsVih2qam1 XZyQuDGWOzGhkDCq0YppikMvA7k/xy+BPtwxOhGfQKakxgJogkHeX50apuZk45PFmh2L 4OC5u5iZvtpvlavKMkK8OLS+E7jmExZItDCAxyv7y9z5aEfNqNOILj+sH1RjAYkOH08P rLb4CoAm5HmyM9jgqpd6puCDE2eFaPqTRtfHEIjRDb7lDnIDez7DqPtJ1F+kP4oJLEym 8iWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VqZtrdcd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bx7si9578342edb.150.2020.07.19.22.49.54; Sun, 19 Jul 2020 22:50:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VqZtrdcd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726801AbgGTFte (ORCPT + 99 others); Mon, 20 Jul 2020 01:49:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726736AbgGTFta (ORCPT ); Mon, 20 Jul 2020 01:49:30 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D532C0619D2; Sun, 19 Jul 2020 22:49:30 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id l6so8161274plt.7; Sun, 19 Jul 2020 22:49:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rQMYS8GPViemdBCwGtXgr4XomnsVhh0epuBKtBNluTw=; b=VqZtrdcdH1uuapafG9v1HWvDr+2QXNSLXJ+y6XjGY3pdPtYxQLhZKiB5TVikE06UlQ ywWMV1EK1SSsPcQ3DlN6KClsnJZ5A/6JNryOjiDG0rFRhJFJk/RiRyXaRKF98W2B82wk teOf896I4ryG1gg7MYbIeFeahrN6ij3ktB2IVXYcf04r4iCG9TD3JeGRvXPSF4fKZvrg 4qhLZKY6KgQI9FAsbmEQo1dGwbU2/60YLnK3FVqi8ljwsbN2LZAnorAt5ZEwAmt0URdm sHzkGb8Ub18nbb4u67oPvQ8iTM1W93hhcwceuXiiGXfymSNehfMkdj4y8kqmZJf2Vjd1 pdBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rQMYS8GPViemdBCwGtXgr4XomnsVhh0epuBKtBNluTw=; b=mUW3958yOvQP8W5LmPi7le+zgtaJOo7vqU+b7vdIrsrjpOMXpL2lGQP1EIEPTToDCl 4B0BrordLY4hKMlOABATGGrP1M7Vuhf1OzctSB8t4Fhe7EzpESopxo+1RN6FJEPXE6KH hz4btq/vYbPi85ZxEc0w44i4eyseLNIGdZHxn5bU672qh1zZHyI0QsG7FCr1VNru3/Sm KFTsVyYvXNfQhqQl7uOgTcflh35oRuwxY/GLhnoMoab1JlMu9P3zDXDEli4X3N3lY11z TcKXFR4uHMV9/bGUXYwSurx1UylU/Y8nZVLV58xxIAIM3+QZoEA4XfDQ+CMm30MrN1FQ 35ZQ== X-Gm-Message-State: AOAM531S3PpWBnU2AfeWQginpDQyPwcQqJPb+8MiDA6LL08URkRQG5ij LO5of4CZYYjLY3v5N4O00R8= X-Received: by 2002:a17:90a:3567:: with SMTP id q94mr22642725pjb.226.1595224169698; Sun, 19 Jul 2020 22:49:29 -0700 (PDT) Received: from xiaomi.mioffice.cn ([209.9.72.214]) by smtp.gmail.com with ESMTPSA id i7sm13627833pgh.58.2020.07.19.22.49.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jul 2020 22:49:29 -0700 (PDT) From: Qiwu Huang To: sre@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, jiangfei1@xiaomi.com, Qiwu Huang Subject: [PATCH v4 2/4] power: supply: core: add wireless charger adapter type property Date: Mon, 20 Jul 2020 13:47:15 +0800 Message-Id: <3ab3a779d94b9eabf703867f7e9d60f8fffa1dd3.1595214246.git.huangqiwu@xiaomi.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qiwu Huang Reports what type of wireless adapter connection is currently active for the supply. for example it can show if ADAPTER_PD capable source is attached. Signed-off-by: Qiwu Huang --- Documentation/ABI/testing/sysfs-class-power | 28 +++++++++++++++++++++ drivers/power/supply/power_supply_sysfs.c | 1 + include/linux/power_supply.h | 19 ++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-class-power b/Documentation/ABI/testing/sysfs-class-power index dd3773dcf16a..03ab449fae8a 100644 --- a/Documentation/ABI/testing/sysfs-class-power +++ b/Documentation/ABI/testing/sysfs-class-power @@ -729,3 +729,31 @@ Contact: Fei Jiang 3: QUICK_CHARGE_TURBE, 4: QUICK_CHARGE_SUPER. +===== Wireless Charger Properties ===== +What: /sys/class/power_supply//tx_adapter +Date: Jul 2020 +Contact: Fei Jiang +Description: + Reports the type of wireless adapter connection is currently active for + the supply, for example it can show if ADAPTER_PD capable source + is attached. Expect common wireless adapter type, also increase by + some vendor private adapter type(ex. ADAPTER_PD_40W). + + Access: Read-Only + Valid values: + 0: ADAPTER_NONE, + 1: ADAPTER_SDP, + 2: ADAPTER_DCP, + 3: ADAPTER_CDP, + 4: ADAPTER_OCP, + 5: ADAPTER_QC2, + 6: ADAPTER_QC3, + 7: ADAPTER_PD, + 8: ADAPTER_AUTH_FAILED, + 9: ADAPTER_PRIVATE_QC3, + 10: ADAPTER_PRIVATE_PD, + 11: ADAPTER_CAR_POWER, + 12: ADAPTER_PRIVATE_PD_40W, + 13: ADAPTER_VOICE_BOX, + 14: ADAPTER_PRIVATE_PD_50W. + diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c index 9554d7907373..f2458e21d02b 100644 --- a/drivers/power/supply/power_supply_sysfs.c +++ b/drivers/power/supply/power_supply_sysfs.c @@ -207,6 +207,7 @@ static struct power_supply_attr power_supply_attrs[] = { POWER_SUPPLY_ATTR(MANUFACTURER), POWER_SUPPLY_ATTR(SERIAL_NUMBER), POWER_SUPPLY_ATTR(QUICK_CHARGE_TYPE), + POWER_SUPPLY_ATTR(TX_ADAPTER), }; static struct attribute * diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index f35c661a2544..0bbdec1630a4 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -168,6 +168,7 @@ enum power_supply_property { POWER_SUPPLY_PROP_MANUFACTURER, POWER_SUPPLY_PROP_SERIAL_NUMBER, POWER_SUPPLY_PROP_QUICK_CHARGE_TYPE, + POWER_SUPPLY_PROP_TX_ADAPTER, }; enum power_supply_type { @@ -207,6 +208,24 @@ enum power_supply_quick_charge_type { QUICK_CHARGE_MAX, }; +enum power_supply_tx_adapter_type { + ADAPTER_NONE = 0, /* Nothing Attached */ + ADAPTER_SDP, /* Standard Downstream Port */ + ADAPTER_CDP, /* Charging Downstream Port */ + ADAPTER_DCP, /* Dedicated Charging Port */ + ADAPTER_OCP, /* Other Charging Port */ + ADAPTER_QC2, /* Qualcomm Charge 2.0 */ + ADAPTER_QC3, /* Qualcomm Charge 3.0 */ + ADAPTER_PD, /* Power Delivery Port */ + ADAPTER_AUTH_FAILED, /* Authenticated Failed Adapter */ + ADAPTER_PRIVATE_QC3, /* Qualcomm Charge 3.0 with Private Protocol */ + ADAPTER_PRIVATE_PD, /* PD Adapter with Private Protocol */ + ADAPTER_CAR_POWER, /* Wireless Car Charger */ + ADAPTER_PRIVATE_PD_40W, /* 40W PD Adapter with Private Protocol */ + ADAPTER_VOICE_BOX, /* Voice Box which Support Wireless Charger */ + ADAPTER_PRIVATE_PD_50W, /* 50W PD Adapter with Private Protocol */ +}; + enum power_supply_notifier_events { PSY_EVENT_PROP_CHANGED, }; -- 2.27.0