From patchwork Wed Jan 17 20:33:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 10171011 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 B6B90603B5 for ; Wed, 17 Jan 2018 20:33:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A960F207A7 for ; Wed, 17 Jan 2018 20:33:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E2B121BED; Wed, 17 Jan 2018 20:33:18 +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, UNPARSEABLE_RELAY 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 2F16B207A7 for ; Wed, 17 Jan 2018 20:33:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753225AbeAQUdQ (ORCPT ); Wed, 17 Jan 2018 15:33:16 -0500 Received: from eddie.linux-mips.org ([148.251.95.138]:33078 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754564AbeAQUdE (ORCPT ); Wed, 17 Jan 2018 15:33:04 -0500 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23994692AbeAQUdDnk2TE (ORCPT ); Wed, 17 Jan 2018 21:33:03 +0100 Date: Wed, 17 Jan 2018 21:33:02 +0100 From: Ladislav Michl To: linux-pm@vger.kernel.org Cc: Sebastian Reichel , Mike Looijmans Subject: [PATCH 5/5] power: supply: gpio-charger: LM3658 support Message-ID: <20180117203302.GF8774@lenoch> References: <20180117202701.GA8774@lenoch> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180117202701.GA8774@lenoch> User-Agent: Mutt/1.9.2 (2017-12-15) 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 Just a proof of concept... Signed-off-by: Ladislav Michl --- drivers/power/supply/gpio-charger.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/power/supply/gpio-charger.c b/drivers/power/supply/gpio-charger.c index 463e0abe975b..1628ac1e84d1 100644 --- a/drivers/power/supply/gpio-charger.c +++ b/drivers/power/supply/gpio-charger.c @@ -441,6 +441,21 @@ struct gpio_charger_mapping chrg_fault_mapping[] = { }, }; +struct gpio_charger_mapping stat12_mapping[] = { + { + POWER_SUPPLY_PROP_STATUS, + POWER_SUPPLY_STATUS_NOT_CHARGING, + MAP(0x03, + { 0x01, POWER_SUPPLY_STATUS_CHARGING }, + { 0x02, POWER_SUPPLY_STATUS_FULL }), + }, { + POWER_SUPPLY_PROP_HEALTH, + POWER_SUPPLY_HEALTH_GOOD, + MAP(0x03, + { 0x03, POWER_SUPPLY_HEALTH_DEAD }), + }, +}; + static const struct gpio_charger_config ltc3651_cfg = { MAPPING(chrg_fault_mapping), { @@ -451,12 +466,25 @@ static const struct gpio_charger_config ltc3651_cfg = { }, }; +static const struct gpio_charger_config lm3658_cfg = { + MAPPING(stat12_mapping), + { + { "ti,stat1", 0 }, + { "ti,stat2", 0 }, + { NULL, 0 }, + }, +}; + static const struct of_device_id gpio_charger_match[] = { { .compatible = "gpio-charger" }, { .compatible = "lltc,ltc3651-charger", .data = (void *) <c3651_cfg, }, + { + .compatible = "ti,lm3658", + .data = (void *) &lm3658_cfg, + }, { } }; MODULE_DEVICE_TABLE(of, gpio_charger_match);