Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp466985ybh; Mon, 20 Jul 2020 23:02:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYNeV8k4zVJqnJjpuZkOSgoQ27sNAepKVafG4Y/xIb66bhMKtYrstOWKuxT8LMsyrRRa7a X-Received: by 2002:a17:906:3e13:: with SMTP id k19mr23464499eji.476.1595311351172; Mon, 20 Jul 2020 23:02:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595311351; cv=none; d=google.com; s=arc-20160816; b=N6O+qrgF/4m8V61ljAlFpBXqc9Jd0ksGZd1MqS83XUjFBKXS8x7xZgMPY7lexw/PV0 VvUqZBDfLK+z6AHGljo0rJIs9Ota1dxfV7q0t6S1pxkOUzTFIPPQmmOaZIExhbdkob+F DdKwUDUFEgRPwtZsHfdEvOEPBnHSor7eilZtmdvoq87AHaM794nHrVCjWG9X7g3F0j0k kYk8WKR+qn/xMZTbl6ES6qPpdaMy39r1wrY54HN+z8Zl02tfpU2dQNuPM8sT6DNQuFAj Q0/m8X/2OKeg1ccXef71B+5Gt4YCMr4uWp52UHrqPN+0iwOnVkxKElZK1rfNTcziNKlo wZTg== 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=oEglXBwLQOY/wf76maJo9jVEEGUkpTJTd012yFX+eg0=; b=rxOGEIcNhPaR8LMROM5oNuyZ+9EeblM1fWE10mp9nDKaI5ICkdHo8+yKtlMg/LYm/q m5Mqc/X/ogjS+sbtEsCCdiCwSCeUrd0H4ELXE/P5SrzgVoQXGGaZF04zwEEYntMS6k1v BPZml1wfwFfokoUP7JNtE6HWEC3ME0e5MQvLdkz1HXZpesOnyugqtESeS2LaxTuQHLjT OWLyStelidzkKNAoMmoMuXZ0ODz2lA0c7M6+IseBtayp3UdukbBYryMFWdIjd0flNKWO iXe6jPh+WXiClMFZRH/u2cU2mVvstGQ5pawATqQM2xax0Ru2lQt7Mtw7yQAqIWtd3JUa Ou+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qenq27cn; 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 d19si11596818ejj.468.2020.07.20.23.02.08; Mon, 20 Jul 2020 23:02:31 -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=qenq27cn; 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 S1728267AbgGUGBv (ORCPT + 99 others); Tue, 21 Jul 2020 02:01:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725294AbgGUGBu (ORCPT ); Tue, 21 Jul 2020 02:01:50 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D04DDC061794; Mon, 20 Jul 2020 23:01:50 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id 207so10226405pfu.3; Mon, 20 Jul 2020 23:01:50 -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=oEglXBwLQOY/wf76maJo9jVEEGUkpTJTd012yFX+eg0=; b=qenq27cns4DoZzOJtgBg1xMlSVQV+H0pYRW1AXZoP7hZQcFTAEKaJKVmVLXZWzear9 3CHrz1YlPnfT9YdSu3mo/JYAdNyl1qApivpe599Uvw2uLMS1C6PDsEkT/ydipedF4YAR 5TJUe7/ACP/YRrYsAI2lD2u8R1rbOoZScgORbLUH9FdUw4+gSnnvsaylVK13s/UPlPRv rTYd2RuwfRt5MJn40SlKe9MlGb5zMzjMtelO6dNANTG4sc+IsYRV4lEUiDJlk9JjdSda C6i1KMma++TL/XE8eKOeNRy8Bd6tQUplToWSvgznvBz1/zvbZqYwre9rSlgjD3zwHuVE gf0A== 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=oEglXBwLQOY/wf76maJo9jVEEGUkpTJTd012yFX+eg0=; b=jAIZpbUab3Glyp0oMyPkbZQ6FpzksiE5qkKW8JduT/K9j/16AG76Svnlm8k3a/rwMq SOLorEwqZ6/GH2d4bPMuDHQeVSGVqHopFmBj2AdkVuhEnwiujKvKTf4JLqVfQioqvizg rYXVggQ9NhIAh76DnOo5Ornqv0NI7tflHMgLfOdmoBUmaKvVB3qm0AhvOJJ5UGxTNWAt lCspIzvYMgNKB4elZzvXlh8oYC1G3d5WynPKMs/9TZnSfHSCc//Jsxhhz28nJ1TstElf UlmVqJnhYxZ78Y9+YPzkXkg1Xj8fhT79ayvhyj7ufK4rINv3dP6ufpAJtm+EimGbTF3k 6T5Q== X-Gm-Message-State: AOAM533sX3cBWHKr8zITEp/23BSGS5KSpWvLjkMLbEw5O+pSfOH4uM/R TeiyudldWe2RKOV84s8Une4= X-Received: by 2002:a62:c584:: with SMTP id j126mr22633598pfg.213.1595311308528; Mon, 20 Jul 2020 23:01:48 -0700 (PDT) Received: from xiaomi.mioffice.cn ([209.9.72.214]) by smtp.gmail.com with ESMTPSA id 129sm18368833pfv.161.2020.07.20.23.01.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2020 23:01:48 -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 v5 1/4] power: supply: core: add quick charge type property Date: Tue, 21 Jul 2020 13:59:34 +0800 Message-Id: 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 the kind of quick charge type based on different adapter power. Signed-off-by: Qiwu Huang --- Documentation/ABI/testing/sysfs-class-power | 21 +++++++++++++++++++++ drivers/power/supply/power_supply_sysfs.c | 1 + include/linux/power_supply.h | 10 ++++++++++ 3 files changed, 32 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-class-power b/Documentation/ABI/testing/sysfs-class-power index 216d61a22f1e..dd3773dcf16a 100644 --- a/Documentation/ABI/testing/sysfs-class-power +++ b/Documentation/ABI/testing/sysfs-class-power @@ -708,3 +708,24 @@ Description: Access: Read Valid values: 1-31 + +What: /sys/class/power_supply//quick_charge_type +Date: Jul 2020 +Contact: Fei Jiang + Description: + Reports the kind of quick charge type based on different adapter power. + Different quick charge type represent different charging power. + QUICK_CHARGE_NORMAL : Charging Power <= 10W + QUICK_CHARGE_FAST : 10W < Charging Power <= 20W + QUICK_CHARGE_FLASH : 20W < Charging Power <= 30W + QUICK_CHARGE_TURBE : 30W < Charging Power <= 50W + QUICK_CHARGE_SUPER : Charging Power > 50W + + Access: Read-Only + Valid values: + 0: QUICK_CHARGE_NORMAL, + 1: QUICK_CHARGE_FAST, + 2: QUICK_CHARGE_FLASH, + 3: QUICK_CHARGE_TURBE, + 4: QUICK_CHARGE_SUPER. + diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c index bc79560229b5..9554d7907373 100644 --- a/drivers/power/supply/power_supply_sysfs.c +++ b/drivers/power/supply/power_supply_sysfs.c @@ -206,6 +206,7 @@ static struct power_supply_attr power_supply_attrs[] = { POWER_SUPPLY_ATTR(MODEL_NAME), POWER_SUPPLY_ATTR(MANUFACTURER), POWER_SUPPLY_ATTR(SERIAL_NUMBER), + POWER_SUPPLY_ATTR(QUICK_CHARGE_TYPE), }; static struct attribute * diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index ac1345a48ad0..f35c661a2544 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -167,6 +167,7 @@ enum power_supply_property { POWER_SUPPLY_PROP_MODEL_NAME, POWER_SUPPLY_PROP_MANUFACTURER, POWER_SUPPLY_PROP_SERIAL_NUMBER, + POWER_SUPPLY_PROP_QUICK_CHARGE_TYPE, }; enum power_supply_type { @@ -197,6 +198,15 @@ enum power_supply_usb_type { POWER_SUPPLY_USB_TYPE_APPLE_BRICK_ID, /* Apple Charging Method */ }; +enum power_supply_quick_charge_type { + QUICK_CHARGE_NORMAL = 0, /* Charging Power <= 10W */ + QUICK_CHARGE_FAST, /* 10W < Charging Power <= 20W */ + QUICK_CHARGE_FLASH, /* 20W < Charging Power <= 30W */ + QUICK_CHARGE_TURBE, /* 30W < Charging Power <= 50W */ + QUICK_CHARGE_SUPER, /* Charging Power > 50W */ + QUICK_CHARGE_MAX, +}; + enum power_supply_notifier_events { PSY_EVENT_PROP_CHANGED, }; -- 2.27.0