From patchwork Sun Apr 30 18:27:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 9706157 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8EC99601D2 for ; Sun, 30 Apr 2017 18:28:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78D242624A for ; Sun, 30 Apr 2017 18:28:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A33826419; Sun, 30 Apr 2017 18:28:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53A192621B for ; Sun, 30 Apr 2017 18:28:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S969106AbdD3S2m (ORCPT ); Sun, 30 Apr 2017 14:28:42 -0400 Received: from gagarine.paulk.fr ([109.190.93.129]:49302 "EHLO gagarine.paulk.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969105AbdD3S2l (ORCPT ); Sun, 30 Apr 2017 14:28:41 -0400 Received: by gagarine.paulk.fr (Postfix, from userid 65534) id C38F620873; Sun, 30 Apr 2017 20:28:39 +0200 (CEST) Received: from localhost.localdomain (collins [192.168.1.129]) by gagarine.paulk.fr (Postfix) with ESMTP id 9C924204E6; Sun, 30 Apr 2017 20:28:30 +0200 (CEST) From: Paul Kocialkowski To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Pali=20Roh=C3=A1r?= , "Andrew F . Davis" , Sebastian Reichel , Chris Lapa , Matt Ranostay , Paul Kocialkowski Subject: [PATCH 1/5] power: supply: bq27xxx: Pass of_node along to allow device-tree supply Date: Sun, 30 Apr 2017 20:27:23 +0200 Message-Id: <20170430182727.24412-1-contact@paulk.fr> X-Mailer: git-send-email 2.12.2 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This passes the of_node from the bq27xxx i2c battery driver to the common code, so that it can be registered and provide external supplies linked with device-tree. Signed-off-by: Paul Kocialkowski --- drivers/power/supply/bq27xxx_battery.c | 5 ++++- drivers/power/supply/bq27xxx_battery_i2c.c | 1 + include/linux/power/bq27xxx_battery.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c index 398801a21b86..6ef95442a918 100644 --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c @@ -1351,7 +1351,10 @@ static void bq27xxx_external_power_changed(struct power_supply *psy) int bq27xxx_battery_setup(struct bq27xxx_device_info *di) { struct power_supply_desc *psy_desc; - struct power_supply_config psy_cfg = { .drv_data = di, }; + struct power_supply_config psy_cfg = {}; + + psy_cfg.drv_data = di; + psy_cfg.of_node = di->of_node; INIT_DELAYED_WORK(&di->work, bq27xxx_battery_poll); mutex_init(&di->lock); diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c index c68fbc3fe50a..38a0422a4192 100644 --- a/drivers/power/supply/bq27xxx_battery_i2c.c +++ b/drivers/power/supply/bq27xxx_battery_i2c.c @@ -96,6 +96,7 @@ static int bq27xxx_battery_i2c_probe(struct i2c_client *client, di->chip = id->driver_data; di->name = name; di->bus.read = bq27xxx_battery_i2c_read; + di->of_node = client->dev.of_node; ret = bq27xxx_battery_setup(di); if (ret) diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h index b312bcef53da..94637b77ecbf 100644 --- a/include/linux/power/bq27xxx_battery.h +++ b/include/linux/power/bq27xxx_battery.h @@ -63,6 +63,7 @@ struct bq27xxx_device_info { const char *name; struct bq27xxx_access_methods bus; struct bq27xxx_reg_cache cache; + struct device_node *of_node; int charge_design_full; unsigned long last_update; struct delayed_work work;