Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757758AbbGHBSo (ORCPT ); Tue, 7 Jul 2015 21:18:44 -0400 Received: from mail-qg0-f46.google.com ([209.85.192.46]:33283 "EHLO mail-qg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754181AbbGHBSh (ORCPT ); Tue, 7 Jul 2015 21:18:37 -0400 MIME-Version: 1.0 In-Reply-To: <1436271953-24564-1-git-send-email-anda-maria.nicolae@intel.com> References: <1436271953-24564-1-git-send-email-anda-maria.nicolae@intel.com> Date: Wed, 8 Jul 2015 10:18:36 +0900 X-Google-Sender-Auth: TJCTWzFhiLQgEMLhdKTGJGDOF64 Message-ID: Subject: Re: [PATCH v2] power_supply: rt9455_charger: Properly notify userspace about charging events From: Krzysztof Kozlowski To: Anda-Maria Nicolae Cc: sre@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1906 Lines: 42 2015-07-07 21:25 GMT+09:00 Anda-Maria Nicolae : > Charging events this patch refers to are: > - charger is connected to/disconnected from the power source > - battery is reconnected to the charger, after it was absent. > > When the charger is connected to/disconnected from the power source, CHRVPI > interrupt occurs and PWR_RDY bit is either set or cleared. PWR_RDY bit is > updated after 1-2 seconds CHRVPI interrupt has occurred. > power_supply_changed() should be called after PWR_RDY bit is updated. > /sys/class/power_supply/rt9455-charger/online file displays the value of > PWR_RDY bit. > This way, if the userspace is notified that a charging event has occurred > and the userspace reads /sys/class/power_supply/rt9455-charger/online file, > this file is properly updated when the userspace reads it. > This is the reason why power_supply_changed() is called in > rt9455_pwr_rdy_work_callback(), instead of being called in interrupt > handler. > > Since no interrupt is triggered when the battery is reconnected to the > charger, the userspace is never notified that the battery is reconnected. > This is why power_supply_changed() is called in > rt9455_max_charging_time_work_callback(), so that the userspace is notified > that the battery is reconnected. > > Signed-off-by: Anda-Maria Nicolae > --- > > Updates from v1 version: > - I have followed Kzrysztof's suggestion and I have added explanations in > the commit message so that the change is more clear > - Code is the same as in v1 Thanks, FWIW: Reviewed-by: Krzysztof Kozlowski Best regards, Krzysztof -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/