Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp2296259pxv; Sat, 17 Jul 2021 09:26:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCAGjJQEoiMUiJiuWRP6RLdZ/JEkieqzojHtmxMzTP6krLFpVBpsXP2SJQyKxzC3Pz0Cn/ X-Received: by 2002:a02:7a50:: with SMTP id z16mr13516517jad.139.1626539188753; Sat, 17 Jul 2021 09:26:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626539188; cv=none; d=google.com; s=arc-20160816; b=sG0jLQhAx8VqZaBumY0oKP4F+wJn7gtlOmlaiSz7hi2wH5F4191sgu74V9o+mD9Mqp D/VsxVk5VvSwAVdG0JcN1sZB3EwpGjjpfpkaFV+bklrgcYahcoD8O567/mrlY4QcNSsr 9175IGRM//KkEgFK7Y51Yw3gf8q4FB6dVRhF/bcWm0CWRc8S+ns7LaoOy+6SSSRZ3Tfc IaDGk30lG5Gb3wsd9IQkvJNVVFWU7Atyhgtkh+638RXjoYrJZWldzeHnd+tZAHbDAkZU r0HFY//lym/OX+JO+7rpG28Hh7we/4wj65mtncEeGqGOArPt3pZUzuCpSmRR6NEoVmux zQjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=2oB+6NPY5L9pS1VZURRcMJ1gd/eP8nj8WXxjwyYGz7o=; b=w2ikZq1RtBhpQbDrU9G6MgEofwUtyrqgY8OTs94LcWJ6h1EuDJW1WRB777fitWRVML 7/v5vvoC5CnF1NtSuPZWJO+L6AnOT21ZQjMjxeb9IdbwxOcoHLAw14IObLLUZaFp8rHt rNoaTgwzAXHv4j0XF91KB67wy4LieHvTSSH8D2AFhClGEhWPDIM0w2xZCGz++WogtWKK DnzbVFLOpmGOUk1KIr6DsCgn3Bn1329BkUgiwE3UtYgoZMSieAa1kj4rc6kPLHz8ULgm 6Md6ulYpl7V3CcGamahWp2sJI1XuxIGyNbcFLwbQqWACnkFfaDrUeCDJUqCfdhayUpG2 4hZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f7JvJdm+; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t3si14761458ile.109.2021.07.17.09.26.14; Sat, 17 Jul 2021 09:26:28 -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=@redhat.com header.s=mimecast20190719 header.b=f7JvJdm+; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230212AbhGQQ2c (ORCPT + 99 others); Sat, 17 Jul 2021 12:28:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29080 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229581AbhGQQ2b (ORCPT ); Sat, 17 Jul 2021 12:28:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626539133; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=2oB+6NPY5L9pS1VZURRcMJ1gd/eP8nj8WXxjwyYGz7o=; b=f7JvJdm+lFPyU8zkbQ+iLtXWjAgpR6wdLFZ+UrRtmyBIwyDXURK3shhGxUM04h1L51sVH/ 3kZr+J33r16AZaPamowjeu7nxdOPInePyv4Doi/HIe72GDj7ACl+C5ru39S+7/7yKnFLh7 sJ8Oq3VBdbXmNnXYL7NrxIU+o7qWVAY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-348-kVKT6bOhPJSAVAOIOVPE8Q-1; Sat, 17 Jul 2021 12:25:32 -0400 X-MC-Unique: kVKT6bOhPJSAVAOIOVPE8Q-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 27146802920; Sat, 17 Jul 2021 16:25:31 +0000 (UTC) Received: from x1.localdomain (ovpn-112-42.ams2.redhat.com [10.36.112.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DFB160C13; Sat, 17 Jul 2021 16:25:29 +0000 (UTC) From: Hans de Goede To: Lee Jones , Chen-Yu Tsai Cc: Hans de Goede , C++ / GCC , linux-kernel@vger.kernel.org Subject: [PATCH] mfd: axp20x: Add supplied-from property to axp288_fuel_gauge cell Date: Sat, 17 Jul 2021 18:25:28 +0200 Message-Id: <20210717162528.272797-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The power-supply framework has the notion of one power-supply device being supplied by another. A typical example of this is a charger charging a battery. A tablet getting plugged in to charge (or plugged out) only results in events seen by the axp288_charger device / MFD cell. Which means that a change udev-event only gets send for the charger power-supply class device, not for the battery (the axp288_fuel_gauge device). The axp288_fuel_gauge does have an external_power_change'd callback which will generate a change udev-event when called. But before this commit this never got called because the power-supply core only calls this when a power-supply class device's supplier changes and the supplier link from axp288_charger to axp288_fuel_gauge was missing. Add a "supplied-from" property to axp288_fuel_gauge cell, pointing to the "axp288_charger" power-supply class device, so that the axp288_fuel_gauge's external_power_change'd callback gets called on axp288_charger state changes. Signed-off-by: Hans de Goede --- drivers/mfd/axp20x.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index d0ac019850d1..8161a5dc68e8 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c @@ -700,6 +700,18 @@ static const struct resource axp288_charger_resources[] = { DEFINE_RES_IRQ(AXP288_IRQ_CBTO), }; +static const char * const axp288_fuel_gauge_suppliers[] = { "axp288_charger" }; + +static const struct property_entry axp288_fuel_gauge_properties[] = { + PROPERTY_ENTRY_STRING_ARRAY("supplied-from", axp288_fuel_gauge_suppliers), + { } +}; + +static const struct software_node axp288_fuel_gauge_sw_node = { + .name = "axp288_fuel_gauge", + .properties = axp288_fuel_gauge_properties, +}; + static const struct mfd_cell axp288_cells[] = { { .name = "axp288_adc", @@ -717,6 +729,7 @@ static const struct mfd_cell axp288_cells[] = { .name = "axp288_fuel_gauge", .num_resources = ARRAY_SIZE(axp288_fuel_gauge_resources), .resources = axp288_fuel_gauge_resources, + .swnode = &axp288_fuel_gauge_sw_node, }, { .name = "axp221-pek", .num_resources = ARRAY_SIZE(axp288_power_button_resources), -- 2.31.1