Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3855012rdb; Thu, 28 Dec 2023 02:08:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IHh6kKh33ckqwR85U5MGmfsn45inuAbzAiv+/ixN6SM4+sqsu/PaTpTmtlrGURqZn0yd7ph X-Received: by 2002:a17:903:25d4:b0:1d4:3132:bf10 with SMTP id jc20-20020a17090325d400b001d43132bf10mr2979676plb.40.1703758082728; Thu, 28 Dec 2023 02:08:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703758082; cv=none; d=google.com; s=arc-20160816; b=02aNRVoosmU7CDPCiqf1g3s23CLspb59ipO1Z2+09OgyV3IEmFnqeAq3PXALG88R5h gE2vtU+yP1Q6LDgggrI6EMh2OTsH9j2vIg6i97k0I/FEOUOVyirUByHPAL6ZqHFdhZkU qTb93Yok9rNr8stWFxw1w+1XbTMr0ZTA7o4tBdOJ8FyKg4bj3LtRWumT4QlBVqhaQuuV tgqhCklWolX5DHb2AHakrtGAHy+ATxGYFfNoYB6T5spDDNYJCSbxTgCgsuEmI4/QGspW yGc+av+iwSOQIa1EJAon7mSg04ZBUs0udILfaop2Rg1VOX5m2iR1SO/nA6JVKj8jEu2q O2Hw== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12552-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gimli.ms.mff.cuni.cz Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id e8-20020a170902b78800b001d343530462si9516606pls.430.2023.12.28.02.08.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 02:08:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-12552-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-12552-linux.lists.archive=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id F02A3B2397C for ; Thu, 28 Dec 2023 10:03:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 67797747D; Thu, 28 Dec 2023 10:02:33 +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=20Mihanovi=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 Content-Transfer-Encoding: 8bit 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 }; -- 2.43.0