Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp746602ybk; Wed, 13 May 2020 11:59:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyr0yI/CQMpOApEvtuUdg6Zfot6nKZkkHp8Dq5L7BtsHVWf3IAd7lwJXxPi3EG+UALIldDB X-Received: by 2002:a17:906:7e15:: with SMTP id e21mr476138ejr.106.1589396361433; Wed, 13 May 2020 11:59:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589396361; cv=none; d=google.com; s=arc-20160816; b=z5epIMQfLAnv4D86cTNAI1qXZbaBUYg7gm8Q+KHmM5Lyn8lnqYHyXgFKt9KhaJYRce f2J+ihL9y2JvwXqseyMkLRb/IndwfZb4XBFc/heDoFhpp9wqZ+XrdjLoTBwLNW327ICi 80K9hzG4d5LG5Qt1c/+aMDfJA7zjSb02sBQZKHquTr83jCHvlEJNno4QxQ/2GTwi+NKs alXu5t1v1SfClWrskpy4zM9LlnOX+M0U85dt+jL829pZj8DMv22FXefgVOQvDTzYB/dk MGfEIQHEPNxOcaRzndgBe/VWObR1ctsOKrpN8Fjto8SCPnkCvbUJx0H9IwAqXxWvGnDu ki1Q== 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; bh=ltHbo8QlJ3hJiAHQShPQwPep3UMkzZ+4duXIIdOlmp4=; b=VfZVM6//+cBvRxoQTLH9H7bFfuPa+woleo52HmfyasPliWsUCxduTHgEEN2tcWo7lW 3ALZdf+OvUkz1j5+QchftuGwsu0iCAgmIA21Jyd0G6yJpVkktfBulLoNq9cHXNcc4H2z DowT5YDywjvRERBKbYO2Z6yDid+E0izb84bXc0nGyKpK3dqgUWMpSQML0+M6limh6Zm0 hKFqMbkVg9TZrOmRyqSPJdqeDBD+2EMBOUTc8c3btRNlR1iYjuX+izDoKqndsEGzL0Zs 0jMUBgv5pyBc5E5TEREQCtX6S9sfXThmI/dUJ7edwMqySSubRA+VWmIpNMLKvA9ki1WK 0x1A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i23si300524edg.437.2020.05.13.11.58.57; Wed, 13 May 2020 11:59:21 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390402AbgEMS4g (ORCPT + 99 others); Wed, 13 May 2020 14:56:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2390370AbgEMS4d (ORCPT ); Wed, 13 May 2020 14:56:33 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B186FC061A0C; Wed, 13 May 2020 11:56:33 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id E65ED2A27A9 Received: by jupiter.universe (Postfix, from userid 1000) id 6C7E8480101; Wed, 13 May 2020 20:56:29 +0200 (CEST) From: Sebastian Reichel To: Sebastian Reichel , Rob Herring , Greg Kroah-Hartman , "Rafael J . Wysocki" Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com, Sebastian Reichel Subject: [PATCHv1 03/19] power: supply: core: add manufacture date properties Date: Wed, 13 May 2020 20:55:59 +0200 Message-Id: <20200513185615.508236-4-sebastian.reichel@collabora.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200513185615.508236-1-sebastian.reichel@collabora.com> References: <20200513185615.508236-1-sebastian.reichel@collabora.com> 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 Some smart batteries store their manufacture date, which is useful to identify the battery and/or to know about the cell quality. Signed-off-by: Sebastian Reichel --- Documentation/ABI/testing/sysfs-class-power | 28 +++++++++++++++++++++ drivers/power/supply/power_supply_sysfs.c | 3 +++ include/linux/power_supply.h | 3 +++ 3 files changed, 34 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-class-power b/Documentation/ABI/testing/sysfs-class-power index 2f896555ae23..e6d7348766b2 100644 --- a/Documentation/ABI/testing/sysfs-class-power +++ b/Documentation/ABI/testing/sysfs-class-power @@ -680,3 +680,31 @@ Description: Valid values: - 1: enabled - 0: disabled + +What: /sys/class/power_supply//manufacture_year +Date: January 2020 +Contact: linux-pm@vger.kernel.org +Description: + Reports the year (following Gregorian calendar) when the device has been + manufactured. + + Access: Read + Valid values: Reported as integer + +What: /sys/class/power_supply//manufacture_month +Date: January 2020 +Contact: linux-pm@vger.kernel.org +Description: + Reports the month when the device has been manufactured. + + Access: Read + Valid values: 1-12 + +What: /sys/class/power_supply//manufacture_day +Date: January 2020 +Contact: linux-pm@vger.kernel.org +Description: + Reports the day of month when the device has been manufactured. + + Access: Read + Valid values: 1-31 diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c index e664774a2d1e..78d5382e69f1 100644 --- a/drivers/power/supply/power_supply_sysfs.c +++ b/drivers/power/supply/power_supply_sysfs.c @@ -198,6 +198,9 @@ static struct power_supply_attr power_supply_attrs[] = { POWER_SUPPLY_ATTR(PRECHARGE_CURRENT), POWER_SUPPLY_ATTR(CHARGE_TERM_CURRENT), POWER_SUPPLY_ATTR(CALIBRATE), + POWER_SUPPLY_ATTR(MANUFACTURE_YEAR), + POWER_SUPPLY_ATTR(MANUFACTURE_MONTH), + POWER_SUPPLY_ATTR(MANUFACTURE_DAY), /* Properties of type `const char *' */ POWER_SUPPLY_ATTR(MODEL_NAME), POWER_SUPPLY_ATTR(MANUFACTURER), diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 453a85f25635..63ffe2a0a87b 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -159,6 +159,9 @@ enum power_supply_property { POWER_SUPPLY_PROP_PRECHARGE_CURRENT, POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT, POWER_SUPPLY_PROP_CALIBRATE, + POWER_SUPPLY_PROP_MANUFACTURE_YEAR, + POWER_SUPPLY_PROP_MANUFACTURE_MONTH, + POWER_SUPPLY_PROP_MANUFACTURE_DAY, /* Properties of type `const char *' */ POWER_SUPPLY_PROP_MODEL_NAME, POWER_SUPPLY_PROP_MANUFACTURER, -- 2.26.2