Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp13761900rwb; Sun, 27 Nov 2022 10:52:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf5sSjtpxHEIi6PiKuL1rA9Qdxag+beZIxXyiF/rhKUXktfS0TDhFcaE4QDirYgMOXLhEguB X-Received: by 2002:a05:6402:4011:b0:461:96ba:b9c with SMTP id d17-20020a056402401100b0046196ba0b9cmr45127210eda.353.1669575143846; Sun, 27 Nov 2022 10:52:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669575143; cv=none; d=google.com; s=arc-20160816; b=XEy+4bPp3gd4eYv+48cq/ZaHkgMMQk/fGVJzAsmrPlMcPdvICTj5ahfcOzogvi4U1X 8ti9699JFXk9bX7bkOWcn1jjJdToeHwGwvAVZZvuxZJTWGNuDPbQfNtD2kHJX+QQusEJ gxXzdKjpVvJXlijuQXF68GOyLDoBb77qUTMelRi3dg53hE6Q6yMKqy9axPkmD6EwJOab d7JAzuccTb1Bebqr0KOULIiZ4ugsEbaENRGNojnuZoOqlxPo1xbMD/9WhuIfHfO243wC nxn+snghnVk1BARLwgvF1Ri5FUgATu/Q1Xc63kwZPjRHWX6BP2TJmVIfK3te2liKxQnK NfUw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SXx0cfDGf4zqnICsNky1w2M79w0a2NmEGAvIq2j1/rc=; b=sylo340Yhd6oFaEoyP92it9znSPCNg0XLJ8uwW3ypE4zvexH1Y04ojTQoLzQ11xXLI IgWOIZGddWKZyduHpEHk/X3+hI1I8BoqxJyddnYqthjTGo6o5xoOUhmfWHnTM5eveinP 1KoSelp7AJv7DM5uxWlDz9uwr/RXkPyDKXtOJ6EROfrj5OI+i6kAIDkiScWcx7APw1Bf Dybhmm/yyUl7wcu8QuYVRaXjPaVclzTOkjYgagAhfOqXgoeE3rHoCC+hmaPBJ3lh0RyC ET7UcAfvhdEdAXa17vjXid0SeREopEoUgB/5YKFTmDsSJkd5pT5sZKTs6x0P5NBxWri8 MMhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UPvEvWlC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020a056402090c00b004612915d1a0si8736641edz.507.2022.11.27.10.52.02; Sun, 27 Nov 2022 10:52:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UPvEvWlC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229585AbiK0SY1 (ORCPT + 84 others); Sun, 27 Nov 2022 13:24:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229607AbiK0SYS (ORCPT ); Sun, 27 Nov 2022 13:24:18 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04B396364 for ; Sun, 27 Nov 2022 10:23:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669573398; 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: in-reply-to:in-reply-to:references:references; bh=SXx0cfDGf4zqnICsNky1w2M79w0a2NmEGAvIq2j1/rc=; b=UPvEvWlCjWDSXLBXr66FFzaNz7r3vaKeJRHzhEXKed6XHrQF702G0bzejShIImUSGZ1P15 kW+wnoQmp5feC8ZSjC8Yy15h1e8HEa4kMw1d2018YCLd/nY1vz2yuaUiaDQBUxGydDWABN zJ1xJ+18CETE9s59+CWrfbnBerdOJ30= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-389-0vOp5uyqNIKVlk_6Fu1Avg-1; Sun, 27 Nov 2022 13:23:12 -0500 X-MC-Unique: 0vOp5uyqNIKVlk_6Fu1Avg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BADAE811E67; Sun, 27 Nov 2022 18:23:11 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.192.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7ACC49BB61; Sun, 27 Nov 2022 18:23:10 +0000 (UTC) From: Hans de Goede To: Wolfram Sang , Lee Jones , MyungJoo Ham , Chanwoo Choi Cc: Hans de Goede , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] i2c: cht-wc: Add charger-chip info for the Lenovo Yoga Tab 3 YT3-X90F Date: Sun, 27 Nov 2022 19:22:56 +0100 Message-Id: <20221127182257.104410-3-hdegoede@redhat.com> In-Reply-To: <20221127182257.104410-1-hdegoede@redhat.com> References: <20221127182257.104410-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On x86 devices with a CHT Whiskey Cove PMIC the driver for the I2C bus coming from the PMIC is responsible for instantiating the i2c_client for the charger chip. Add the necessary i2c_board_info for this. Signed-off-by: Hans de Goede --- drivers/i2c/busses/i2c-cht-wc.c | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c index 190abdc46dd3..2b2c3d090089 100644 --- a/drivers/i2c/busses/i2c-cht-wc.c +++ b/drivers/i2c/busses/i2c-cht-wc.c @@ -380,6 +380,49 @@ static struct i2c_board_info lenovo_yogabook1_board_info = { .platform_data = &bq2589x_pdata, }; +/********** Lenovo Yogabook YT3-X90F charger settings **********/ +static const char * const lenovo_yt3_bq25892_1_suppliers[] = { "cht_wcove_pwrsrc" }; + +/* + * bq25892 charger settings for the round li-ion cells in the hinge, + * this is the main / biggest battery. + */ +static const struct property_entry lenovo_yt3_bq25892_1_props[] = { + PROPERTY_ENTRY_STRING_ARRAY("supplied-from", lenovo_yt3_bq25892_1_suppliers), + PROPERTY_ENTRY_STRING("linux,secondary-charger-name", "bq25890-charger-0"), + PROPERTY_ENTRY_U32("linux,iinlim-percentage", 60), + PROPERTY_ENTRY_U32("linux,pump-express-vbus-max", 12000000), + PROPERTY_ENTRY_BOOL("linux,skip-reset"), + /* + * The firmware sets everything to the defaults, leading to a low(ish) + * charge-current and battery-voltage of 2048mA resp 4.2V. Use the + * Android values instead of "linux,read-back-settings" to fix this. + */ + PROPERTY_ENTRY_U32("ti,charge-current", 3072000), + PROPERTY_ENTRY_U32("ti,battery-regulation-voltage", 4352000), + PROPERTY_ENTRY_U32("ti,termination-current", 128000), + PROPERTY_ENTRY_U32("ti,precharge-current", 128000), + PROPERTY_ENTRY_U32("ti,minimum-sys-voltage", 3700000), + PROPERTY_ENTRY_BOOL("ti,use-ilim-pin"), + /* Set 5V boost current-limit to 1.2A (MAX/POR values are 2.45A/1.4A) */ + PROPERTY_ENTRY_U32("ti,boost-voltage", 4998000), + PROPERTY_ENTRY_U32("ti,boost-max-current", 1200000), + { } +}; + +static const struct software_node lenovo_yt3_bq25892_1_node = { + .properties = lenovo_yt3_bq25892_1_props, +}; + +/* bq25892 charger for the round li-ion cells in the hinge */ +static struct i2c_board_info lenovo_yoga_tab3_board_info = { + .type = "bq25892", + .addr = 0x6b, + .dev_name = "bq25892_1", + .swnode = &lenovo_yt3_bq25892_1_node, + .platform_data = &bq2589x_pdata, +}; + static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev) { struct intel_soc_pmic *pmic = dev_get_drvdata(pdev->dev.parent); @@ -459,6 +502,9 @@ static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev) case INTEL_CHT_WC_LENOVO_YOGABOOK1: board_info = &lenovo_yogabook1_board_info; break; + case INTEL_CHT_WC_LENOVO_YT3_X90: + board_info = &lenovo_yoga_tab3_board_info; + break; default: dev_warn(&pdev->dev, "Unknown model, not instantiating charger device\n"); break; -- 2.38.1