Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp662483ybh; Tue, 21 Jul 2020 05:02:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVfb/MhieexrKj5IUEWA8S+uhVOjkhq97P7G8h6IUIt599jqLDfx02zIrNuv9oNZ2y5Knh X-Received: by 2002:a17:906:4015:: with SMTP id v21mr7489201ejj.63.1595332967736; Tue, 21 Jul 2020 05:02:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595332967; cv=none; d=google.com; s=arc-20160816; b=crBdDv6XxEPcScGweXowqyPwfb0r4ifCInys1mcbTkd31We/g5JaP6dcGmcwJsoEfO glwD/1cCPE65P4kmocyP7MoPTgdRfST9rOBXuNnx49mVmWLEJFsvpti2XDzSaQuB1OA9 K8JVFCtjE0TgDy2tHQwEEkhmXeRjhbVHhoFDxo5m3WFrZBSiXCs964w72xh9EGKrb7Og EJcpIwHltst8G/BXAZLRAj9979r/n9byDqzviWhPyUey261BK031k0o17b3pv+Vz8Uh0 fOL1RjrHsnORFoWTRg+dl9RXiR6iDjIjEygQJb6oDLXEPxyn/oxE//8meo44zFACutMg RCwQ== 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=hew2BcXWEOcjagPhVODq61qL2b9HyE3zM/8NmnDkpN9pitt5gld/lf/qog+1hQlp9o tttmJ4W3HOn9d6X9Zle66ZCaWmbyHe/rYQUf+6G+/uN6uh3wJSauKjeIHlPBQcxW3PKe whqLSzhZxN4LgsCUekJIH5rsb8QC1ZnaX5XHD0UCNhCm77MMZERnWYHqus+FDq/rjY29 R9vr4v9gOwPM/eue6UzyQKHJQ4qH/cmWLml9Dt9+/r60J3tNIuuLkwlCAXHBKOkIi7sg kkIUk44ZI0TMMXsN4P06NLMb27emtDnUSs3FivN3TFOY2bpy9LlCH6JWVeQndJKvyzLn 6VSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ieFDISEt; 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 by9si12320651edb.212.2020.07.21.05.02.24; Tue, 21 Jul 2020 05:02:47 -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=ieFDISEt; 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 S1729786AbgGUMB4 (ORCPT + 99 others); Tue, 21 Jul 2020 08:01:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729669AbgGUMBy (ORCPT ); Tue, 21 Jul 2020 08:01:54 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5668C061794; Tue, 21 Jul 2020 05:01:54 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id l63so11831149pge.12; Tue, 21 Jul 2020 05:01:54 -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=ieFDISEtqKig0OJ3+oN8MmNfZPBD0W3R0SYseKuWY3YgtLflbQc2UwdJ7TKXyMiFfT gyrsiJMdwtF344KKFapMHfpyrRrSa/r5LfbNwm7eUcTP2i0nOhh65S/Q5D1r5JkSI4bg BAw+hTw+kfEobtftxfp75uoz7pV8G/nbEVWrfeKILDy7GmcUNaIdzw2p7hl/rtlq4oN3 GHss13r8S6ppwgQpZNR+C1m284aqaTQRbRhl4YAG0dtPBq228kbdj2+GZkhEmwg44Ekq S3ID3IHRogNFmYGh7fuyqhgkt+sbrqZka9rarcjIztCGyACDFEogueeUaz6urxvOjUIz 0mQg== 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=dmXhQJnFlcpDD2CO3WWvpUg45X48Tw4KTI9nMbY86dS+hiuT9eAU3ARio3kbuxPiOg CswxaWPPD7lLmnYhR5QTQfhn+j0al1Y4P/w6AUr0pJUIpULbl2CBKewFobgqLugkBkDa hQqveDvSIJfW4hdGgR1J/F1Xivgbn/lgrrAXmjWYCV+lfNBVw9lprw4OPQUxjHpiszxF UDTzMwMjVE1pI0JkP0bAuVSiYUvFCEC6ZaLywboX3oYCPpIQNvtzxbVsPR2M0dHLNuKq E2vkG1kllVCXkmVHW4+XPOmNzOXD1JY6gaK8HAeKdVaGhv6kPVUC77WLGut71CsQEVHA fTCA== X-Gm-Message-State: AOAM5303RfVOdYum+J82O8LKRcYH9ZKEWqngBWcgVWNQtXTDPDIKzzbo eAEojiLG640isRJ8CEzWVNigHlbTUrGOQA== X-Received: by 2002:a63:be47:: with SMTP id g7mr22173727pgo.7.1595332914295; Tue, 21 Jul 2020 05:01:54 -0700 (PDT) Received: from xiaomi.mioffice.cn ([209.9.72.214]) by smtp.gmail.com with ESMTPSA id t73sm20542041pfc.78.2020.07.21.05.01.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 05:01:53 -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 v7 2/4] power: supply: core: add wireless charger adapter type property Date: Tue, 21 Jul 2020 19:59:40 +0800 Message-Id: <8a46e20d48d34f898b26cccfee562735894b08ae.1595332392.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