Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2103823lqt; Mon, 22 Apr 2024 01:11:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUgUfBlXRA9Q/4axGa6+yicBbhOxpDJxIb8v8AODDxMoD/tzH5FuXdLemGxgGdrZRsk0XxpQPf8rAt5pSKhBiSB+6QnuZyzB4/PezJg8w== X-Google-Smtp-Source: AGHT+IHHbCMO8C+ek/q/P0XoBTm2bLKvunLR41jBePO64Ssxj0aFe+ZFd2JWOESVH+EpxPR9iAkV X-Received: by 2002:a0c:d64a:0:b0:6a0:61de:c6bf with SMTP id e10-20020a0cd64a000000b006a061dec6bfmr9342847qvj.53.1713773474074; Mon, 22 Apr 2024 01:11:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713773474; cv=pass; d=google.com; s=arc-20160816; b=x5mPUrf0nZHdBylUH/9hofy8Wot42Ny0Kn55cG1C3FhJpQStgvLgswFKWQpLB6MpYb Dm5VP7ZDIvz16gEuIKVV3AcUyR2IRpPRmmtvyVz4iTEMFXANhFP4Ylkl9G9F2oi5k6cS VIz0yoDyocWXdA7s9YDsJMtrd7O0/af5wc9AcTAnCymILQPaaEeozwnkxWHMT885GVXs 6D5jK/bknN6CqVgI+rk51oJ8kWqiRdME1ZixlSuM2ZqFptfYTcat9jbM+L0p272imDD2 db4XpWM0UKJaR/2Sd8fBRzQ7nyiyozePJViq09T1mbIl2hRZx+ycAuTSWBCSFJEO56Ry 2FvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=p9QX8CooDHp78Imo/EPyC0WcDTvF78Bq5sAeBhgkAFM=; fh=TlAmWiahk277G0Rs5SBsbi8we6dipdQpv2mpgw/2CtY=; b=W1ZwdpPnp6rri2Sp2MSJVIrja6N5rVKf0DLNqCxyvOCpCNc+3S9felQULuskU2IT7/ Hmd9lxA+jm1qKpBvfrlVBENZQw9PLrso2m4QAIh4rcxcWGE35xL/+U7rjQe5X+JL9crR evPK41FLTo8pbZ8R9/GCtpP0CY+7pZSERcELTGs/7qRz3JtWkfxNFq/GA1FsO5S4HZd9 Mc3b/blcrUVeAhIZJ/ohNkbvqH7hpX7xragPJtqtuKOQtO17i6UVTzM1RQ3imNeS0Ww8 ccv3ehOvM+6K0wwpi25bvuzs1uTgGFRAFgrd86fB+yOhpyK1FSXZoPJQznumZhdFA9Wn +VFw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=eZU3Z+wU; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-152942-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152942-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id m2-20020ad45dc2000000b006a085bb4a4esi251721qvh.87.2024.04.22.01.11.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 01:11:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-152942-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=eZU3Z+wU; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-152942-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152942-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id BA1CE1C2199C for ; Mon, 22 Apr 2024 08:11:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 344744F217; Mon, 22 Apr 2024 08:11:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="eZU3Z+wU" Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CF1C4DA11 for ; Mon, 22 Apr 2024 08:11:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713773465; cv=none; b=jpvRA7E5qZqp/HH+enPIi+tAGWcUChv/STZpBJ5ZGzTY13Tw/IbFn/fDcaJQ7c+TqQ6l0A3rcuDIMKY8G8GAoBaFqe+2M94Eae8uqCHFCXpqJJnsYhOgzvzKHbGQV8koEphZ4CQ1gUTFq0mBV1EXzZ1jzwnT/b0T0xXUthPXNQ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713773465; c=relaxed/simple; bh=e9GKbiHtBRjjqYKrxUrMGm5SH2rgrO2zZWgczq/P31k=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=G2CBXMTwVfeoE2PQqLqWj5wymBZxpTMD1K4hiFhn8jl/xY0L+BlKUiPLdalxLTYmFQmWDj2TH3EAJLR8HYSzzINbBXI1AKJiZa7DTh1VBYAbamHkZ/iuiBor0n5aaNKHkEM+xpDQNBZ64JhybJfBHl90QfRiXXHgE9fJ2OvnqgY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=eZU3Z+wU; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a55e17f5d8dso27901366b.1 for ; Mon, 22 Apr 2024 01:11:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713773461; x=1714378261; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=p9QX8CooDHp78Imo/EPyC0WcDTvF78Bq5sAeBhgkAFM=; b=eZU3Z+wUST+x1NdU+N9jwhw5DEPr7jaBRmYNKmbnPqO77XLTo1tVwVXCu9IZdhhPiR tV0nYJvyiDZIhUiwQyy0iiqHi7t546xJPPixTXJob4MnyEVoo03ksp9hyEX2fBD4wyPf +Pra6zyvHPHTKTgPmLoqQ5EDYNqrzMA8/FTq0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713773461; x=1714378261; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p9QX8CooDHp78Imo/EPyC0WcDTvF78Bq5sAeBhgkAFM=; b=hphhVCLYYAYD+nG5OXSYXBSkTH60y+6M8bHPQtbR6gpPZy/xsR5WwzvN0kOY070HeR 85NJiTKObrk97vl7qsOr1Y7I3VZnQHxnrhHv+/4zSlv4idvHfrov/7HCisib7PlLt7nc BRlTw1Vkrcm0UTmTU3IsoVfIVhFUfsi91OHQNV0ISV4DJbHauoagUnV0jyiq4t+jAJTN wfG73GpvN1b69zVbwnfVZwBC1mMPJDoJbkTwmbssI8Hw//ATesKWL1VSWnjJAkdQYoXK 1HF5GxVYiq9II4w3Z6LVDJFKSaf1NoneDh1PCZrxUDKoFWbxqH1fDmP/rW2OrR44OlJc E+wQ== X-Forwarded-Encrypted: i=1; AJvYcCWIQ3/6Xh7A71YjpuGBM3g8Nf/tm8fUwcECxyjAlr7NzCMJyVdd2gEx2laEkpDAjyvo3Cv4lBZQ7q8oSA9mbRis4SXTesekfck/wyk0 X-Gm-Message-State: AOJu0YzfHf6SmJU1ujKFteQ/17Ao+RDxeOOyJSbaZiSNPmPBPZIob4yr 0W/ZuTBfFbyOjduX+3mkVjiUlQR8RdK/hT53162JC5WyR6svJxinbt5/XcKbA743IHuv5MH1PEg = X-Received: by 2002:a17:907:2d9f:b0:a56:cb24:fbb9 with SMTP id gt31-20020a1709072d9f00b00a56cb24fbb9mr374370ejc.20.1713773461025; Mon, 22 Apr 2024 01:11:01 -0700 (PDT) Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com. [209.85.218.43]) by smtp.gmail.com with ESMTPSA id t8-20020a170906a10800b00a4e253c8735sm5456829ejy.52.2024.04.22.01.11.00 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Apr 2024 01:11:00 -0700 (PDT) Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a4702457ccbso454722866b.3 for ; Mon, 22 Apr 2024 01:11:00 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCWIZDvUafywQQrEnKnkAv6KA9BfK+OO9Ox0M153V1anEpHVaAF/Imleh20k9Vjr1IK3/3gItu5Mq4WRLRnPu2k6+Vhvw7YXC/ZdBORs X-Received: by 2002:a17:907:9624:b0:a52:2a36:38bf with SMTP id gb36-20020a170907962400b00a522a3638bfmr6898017ejc.55.1713773460150; Mon, 22 Apr 2024 01:11:00 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240418-sbs-time-empty-now-error-v3-1-f286e29e3fca@collabora.com> In-Reply-To: From: Hsin-Te Yuan Date: Mon, 22 Apr 2024 16:10:23 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] power: supply: sbs-battery: Handle unsupported PROP_TIME_TO_EMPTY_NOW To: =?UTF-8?B?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= Cc: Sebastian Reichel , kernel@collabora.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Pin-yen Lin , Hsin-Te Yuan Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Apr 20, 2024 at 12:03=E2=80=AFAM N=C3=ADcolas F. R. A. Prado wrote: > > On Thu, Apr 18, 2024 at 01:34:23PM -0400, N=C3=ADcolas F. R. A. Prado wro= te: > > Despite the RunTimeToEmpty() (0x11) function being defined in the SBS > > specification as required, it seems that not all batteries implement it= . > > On platforms with such batteries, reading the property will cause an > > error to be printed: > > > > power_supply sbs-8-000b: driver failed to report `time_to_empty_now' pr= operty: -5 > > > > This not only pollutes the log, distracting from real problems on the > > device, but also prevents the uevent file from being read since it > > contains all properties, including the faulty one. > > > > The following table summarizes the findings for a handful of platforms: > > > > Platform Status Manufacturer Model > > -----------------------------------------------------------------------= - > > mt8186-corsola-steelix-sku131072 OK BYD L22B3PG= 0 > > mt8195-cherry-tomato-r2 NOT OK PANASON AP16L5J > > mt8192-asurada-spherion-r0 NOT OK PANASON AP15O5L > > mt8183-kukui-jacuzzi-juniper-sku16 NOT OK LGC KT0 AP16L8J > > mt8173-elm-hana OK Sunwoda L18D3PG= 1 > > sc7180-trogdor-lazor-limozeen-nots-r5 NOT OK Murata AP18C4K > > sc7180-trogdor-kingoftown NOT OK 333-AC-0D-A GG02047= XL > > rk3399-gru-kevin OK SDI 4352D51 > > > > Detect if this is one of the quirky batteries during presence update, s= o > > that hot-plugging works as expected, and if so report -ENODATA for > > POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW, which removes it from uevent and > > prevents throwing errors. > > > > Signed-off-by: N=C3=ADcolas F. R. A. Prado > > --- > > Hi, > > I'm coming back with more information after some more testing has been do= ne. > > Most importantly, in the meantime, a parallel investigation uncovered tha= t the > time_to_empty_now issue was actually in the EC firmware: > https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/54657= 47 > > So the other faulty properties (which I'll mention below) could also be d= ue to > the EC firmware. These are the EC firmware version for the platforms with > additional issues: > * RW version: juniper_v2.0.2509-9101a0730 > * RW version: lazor_v2.0.6519-9923041f79 > > Hsin-Te, do you have information on whether it's an EC issue in this case= as > well? > > The following table shows all the faulty properties per platform: > > Platform Manufacturer Model Faulty pr= operties > -------------------------------------------------------------------------= -------- > mt8186-corsola-steelix-sku131072 BYD L22B3PG0 - > mt8195-cherry-tomato-r2 PANASON AP16L5J time_to_e= mpty_now > mt8192-asurada-spherion-r0 PANASON AP15O5L time_to_e= mpty_now > mt8183-kukui-jacuzzi-juniper-sku16 LGC KT0 AP16L8J time_to_e= mpty_now > capacity_= error_margin > constant_= charge_current_max > constant_= charge_voltage_max > current_a= vg > technolog= y > manufactu= re_year > manufactu= re_month > manufactu= re_day > SPEC_INFO > mt8173-elm-hana Sunwoda L18D3PG1 - > sc7180-trogdor-lazor-limozeen-nots-r5 Murata AP18C4K time_to_e= mpty_now > capacity_= error_margin > constant_= charge_current_max > constant_= charge_voltage_max > current_a= vg > sc7180-trogdor-kingoftown 333-AC-0D-A GG02047XL time_to_e= mpty_now > rk3399-gru-kevin SDI 4352D51 - > > If it turns out to not be an EC issue for the properties other than the > time_to_empty_now, then quirks will need to be added for them. As for SPE= C_INFO > it's fine to keep it the way it is, as it already fails gracefully by fal= ling > back to disabled PEC. However it does mean sbs_update_quirks() would need= to be > moved up in sbs_update_presence(), or it will never run when SPEC_INFO fa= ils. > > Also, the battery vendor for limozeen is actually "Murata ", with a trail= ing > space... > > While at it, I also tested whether PEC was broken on all platforms (which= have > the SBS battery behind the EC I2C tunnel) to see if it could have any rel= ation > with the faulty properties: > > PEC > Platform Manufacturer Model Status > ------------------------------------------------------------------------ > mt8186-corsola-steelix-sku131072 BYD L22B3PG0 NOT SUPPO= RTED > mt8195-cherry-tomato-r2 PANASON AP16L5J NOT SUPPO= RTED > mt8192-asurada-spherion-r0 PANASON AP15O5L NOT SUPPO= RTED > mt8183-kukui-jacuzzi-juniper-sku16 LGC KT0 AP16L8J NOT SUPPO= RTED > mt8173-elm-hana Sunwoda L18D3PG1 BROKEN > sc7180-trogdor-lazor-limozeen-nots-r5 Murata AP18C4K NOT SUPPO= RTED > sc7180-trogdor-kingoftown 333-AC-0D-A GG02047XL NOT SUPPO= RTED > rk3399-gru-kevin SDI 4352D51 BROKEN > > Where on the platforms marked BROKEN all properties would fail like so: > power_supply sbs-9-000b: driver failed to report `status' property: -74 > > Those platforms indeed had PEC enabled: > <6>[ 18.109211] sbs-battery 9-000b: PEC: enabled > > and I verified the reported SBS version was SBS_VERSION_1_1_WITH_PEC. > > Meanwhile, all the other platforms, marked NOT SUPPORTED, didn't actually= have > PEC enabled: > <6>[ 14.563070] sbs-battery 8-000b: PEC: disabled > > which I verified was due to version SBS_VERSION_1_0 being reported (excep= t for > jacuzzi, which fails to report a version). > > So all platforms that had batteries that support PEC, have broken PEC, bu= t most > don't support it. In any case there doesn't seem to be a correlation with= the > properties that the batteries support, so it looks to be an orthogonal is= sue. > > Thanks, > N=C3=ADcolas It looks like the firmware version of juniper is too old. Could you update the firmware and test it again? Also, Could you provide the error you get from lazor? Regards, Hsin-Te