From patchwork Thu Dec 28 09:39:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karel Balej X-Patchwork-Id: 183668 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp1900512dyb; Thu, 28 Dec 2023 02:03:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IG0jgy7BIQPbINyAsZAzq+cyyJ8lSIhD0YeY/BlZsLatLOTO6giPI/T6ephnMM+SfiJpBGb X-Received: by 2002:a05:620a:4ee:b0:77e:fba3:a204 with SMTP id b14-20020a05620a04ee00b0077efba3a204mr11601846qkh.94.1703757795903; Thu, 28 Dec 2023 02:03:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703757795; cv=none; d=google.com; s=arc-20160816; b=XNDOP5Z+Cwf1IvYQupJAqaGJAhLeSfCm1V6ht3OZWfKGBLt2lKPwOfRDIFagg23fEV ye9tYrE3mridxELIh7RhIdq0i6r9KhNc0qW7nl/miqnYgLySRBsQPtwPkNo3rLUBba+M y7c2F2qFTPdRiitXQX0FuthuBfHqhTmk/9MBC7mWSnqmtL/GVyNQ6APeZPTSYFS0ZK5U xDtESXcJZiKbjpQDO4qYy6mskqkdHWIwF85A+2YYjdK/598rIp5KsFYHaSwal7NVrUYi vjUGaiu0rqh/0X9anmi6NPwpMUpr/26ojf/n8qo71aFPP8A6qKcDJ1jL4D/r94uydYqe 7f0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bsD+Ig67rpZi8IXpGlEIkzXED2wjBoY8yOB7Th2FEqM=; fh=jTCjoJ+Y+apFiqJqgoUFlazJ2LdeNccwdUnBdvX3V30=; b=hh1vFTag+I5pa9/8tXs+TE1vdxOqSa6GCLBCYiWzrats+trT10sT2oM5FSnelNFO5x 0tN2/TXgtlalh/D3Ie3fmB2/nMfq+USYclm53sAZ1VVXR2edEmyMy4JMVC5RnznF/lLY ohOD56wELM2b/zRM3DMZZH8bX35F9lYpSzsCF+99oMLDj6667xePk0L9Qv0UEZTIjnlF o5hyOx/RRXpfVF/4L2wZu2FaKC98la9RAITRa4UoeOlYiv1HTYLFHtgkgDANgE/YcVsW lo1gDdpDZKa+3El+y8y4nkh8L6Yvp7Yu0LIBrcavYUh8bKRDm1246I+SgzGmHDFajwaF vpmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gimli.ms.mff.cuni.cz header.s=gen1 header.b=OdeYDjZG; spf=pass (google.com: domain of linux-kernel+bounces-12552-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12552-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gimli.ms.mff.cuni.cz Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id bn2-20020a05620a2ac200b0078166136e7fsi2197169qkb.598.2023.12.28.02.03.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 02:03:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12552-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gimli.ms.mff.cuni.cz header.s=gen1 header.b=OdeYDjZG; spf=pass (google.com: domain of linux-kernel+bounces-12552-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12552-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gimli.ms.mff.cuni.cz Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id AFC981C231B7 for ; Thu, 28 Dec 2023 10:03:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 33F0D79C6; Thu, 28 Dec 2023 10:02:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=gimli.ms.mff.cuni.cz header.i=@gimli.ms.mff.cuni.cz header.b="OdeYDjZG" X-Original-To: linux-kernel@vger.kernel.org Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4F876FAD; Thu, 28 Dec 2023 10:02:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gimli.ms.mff.cuni.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gimli.ms.mff.cuni.cz Received: from gimli.ms.mff.cuni.cz (gimli.ms.mff.cuni.cz [195.113.20.176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by nikam.ms.mff.cuni.cz (Postfix) with ESMTPS id D5FCC28C558; Thu, 28 Dec 2023 11:02:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gimli.ms.mff.cuni.cz; s=gen1; t=1703757747; 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=bsD+Ig67rpZi8IXpGlEIkzXED2wjBoY8yOB7Th2FEqM=; b=OdeYDjZGY5quFqORPPXshpQaLVLAyOjxSWI/DIIBTr8Llsx2Kn/q7yNVRLH9AJNxKLs0ch B3PK3el9M1wK4pu3bX8ikixmfJqiYohnPrFYZ6GYYdYimUyhCDLSQl2NKZYsCGeVDS3ICr cXN635as2m9Aw8WM63evuFFTCR7lASY= Received: from localhost (internet5.mraknet.com [185.200.108.250]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: karelb) by gimli.ms.mff.cuni.cz (Postfix) with ESMTPSA id B29D54423CE; Thu, 28 Dec 2023 11:02:27 +0100 (CET) From: Karel Balej To: Karel Balej , Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Duje_Mihanovi=C4=87?= , ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org Subject: [RFC PATCH 2/5] mfd: 88pm88x: initialize the regulators regmaps Date: Thu, 28 Dec 2023 10:39:11 +0100 Message-ID: <20231228100208.2932-3-karelb@gimli.ms.mff.cuni.cz> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231228100208.2932-1-karelb@gimli.ms.mff.cuni.cz> References: <20231228100208.2932-1-karelb@gimli.ms.mff.cuni.cz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786519534732771847 X-GMAIL-MSGID: 1786519534732771847 From: Karel Balej The regulators registers are accessed via a different I2C address than the already implemented functionality. Initialize the new regmap for the regulator driver to use. For 88PM886 the buck regmap is the same as LDO regmap, however this is not the case for 88PM880. Signed-off-by: Karel Balej --- drivers/mfd/88pm88x.c | 33 +++++++++++++++++++++++++++++++++ include/linux/mfd/88pm88x.h | 4 ++++ 2 files changed, 37 insertions(+) diff --git a/drivers/mfd/88pm88x.c b/drivers/mfd/88pm88x.c index 3424d88a58f6..69a8e39d43b3 100644 --- a/drivers/mfd/88pm88x.c +++ b/drivers/mfd/88pm88x.c @@ -98,6 +98,35 @@ static int pm88x_power_off_handler(struct sys_off_data *data) return NOTIFY_DONE; } +static int pm88x_initialize_subregmaps(struct pm88x_chip *chip) +{ + struct i2c_client *page; + struct regmap *regmap; + int ret; + + /* LDO page */ + page = devm_i2c_new_dummy_device(&chip->client->dev, chip->client->adapter, + chip->client->addr + PM88X_PAGE_OFFSET_LDO); + if (IS_ERR(page)) { + ret = PTR_ERR(page); + dev_err(&chip->client->dev, "Failed to initialize LDO client: %d\n", + ret); + return ret; + } + regmap = devm_regmap_init_i2c(page, &pm88x_i2c_regmap); + if (IS_ERR(regmap)) { + ret = PTR_ERR(regmap); + dev_err(&chip->client->dev, "Failed to initialize LDO regmap: %d\n", + ret); + return ret; + } + chip->regmaps[PM88X_REGMAP_LDO] = regmap; + /* buck regmap is the same as LDO */ + chip->regmaps[PM88X_REGMAP_BUCK] = regmap; + + return 0; +} + static int pm88x_setup_irq(struct pm88x_chip *chip) { int ret; @@ -155,6 +184,10 @@ static int pm88x_probe(struct i2c_client *client) return -EINVAL; } + ret = pm88x_initialize_subregmaps(chip); + if (ret) + return ret; + ret = pm88x_setup_irq(chip); if (ret) return ret; diff --git a/include/linux/mfd/88pm88x.h b/include/linux/mfd/88pm88x.h index 9a335f6b9c07..703e6104c1d8 100644 --- a/include/linux/mfd/88pm88x.h +++ b/include/linux/mfd/88pm88x.h @@ -39,8 +39,12 @@ #define PM88X_REG_AON_CTRL2 0xe2 +#define PM88X_PAGE_OFFSET_LDO 1 + enum pm88x_regmap_index { PM88X_REGMAP_BASE, + PM88X_REGMAP_LDO, + PM88X_REGMAP_BUCK, PM88X_REGMAP_NR };