From patchwork Mon Mar 5 18:07:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 10259449 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 CE09D6037E for ; Mon, 5 Mar 2018 18:07:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD15F289ED for ; Mon, 5 Mar 2018 18:07:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1E17289F8; Mon, 5 Mar 2018 18:07:41 +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 313BB289ED for ; Mon, 5 Mar 2018 18:07:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751935AbeCESHk (ORCPT ); Mon, 5 Mar 2018 13:07:40 -0500 Received: from eddie.linux-mips.org ([148.251.95.138]:57702 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751874AbeCESHk (ORCPT ); Mon, 5 Mar 2018 13:07:40 -0500 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23994674AbeCESHjMSAgn (ORCPT ); Mon, 5 Mar 2018 19:07:39 +0100 Date: Mon, 5 Mar 2018 19:07:33 +0100 From: Ladislav Michl To: linux-pm@vger.kernel.org Cc: Sebastian Reichel , Mike Looijmans Subject: [PATCH v2 6/6] power: supply: gpio-charger: LM3658 support Message-ID: <20180305180733.GG5533@lenoch> References: <20180305180325.GA5533@lenoch> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180305180325.GA5533@lenoch> User-Agent: Mutt/1.9.4 (2018-02-28) 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 --- Changelog: - v2: Rebased on top of another round of cleanup patches 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 1a7975fd4278..ed4097a15bec 100644 --- a/drivers/power/supply/gpio-charger.c +++ b/drivers/power/supply/gpio-charger.c @@ -430,6 +430,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), { @@ -440,12 +455,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);