From patchwork Thu Dec 2 12:07:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12694512 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AAF24C433EF for ; Thu, 2 Dec 2021 12:13:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rB6ccvs6A+DDokyhi/HoCh1UUitCHvR6q6Sb8cB53H8=; b=LATzsdKG5XXapW O3mhjPbgZiQGxQjD1yOAN2XV7gMV0Pdg8rGmc+byzYvLZUxp1I2M5rJJhxqF/FokoZWJ6kXgYpgXx Z3VYr/2lhkNf5I+ZqqYez+1WC4NZhyp9+bT+AVgmWMYvdPsDYrT+qoKayD99bpp0fB7Gcb3acRAHB 0btPOQMc3uRhbd9m2WSLSF+DmmH0TOw0+XnRaXLunHsH85YimRdcOKf5kgXWbDQi6HX1ubsUv1eqC 7Z57ptlM/0uXd5aPtX1sFXIU9ODwd6ckmnO86NKOGviOJrK22M+4RaDeKj9zHkwWJmwsZGnrGv5ZJ h5OzWwi2n4UMQ+KIl6SQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mskw6-00CBqi-44; Thu, 02 Dec 2021 12:11:39 +0000 Received: from new2-smtp.messagingengine.com ([66.111.4.224]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mskt4-00CAie-8I for linux-arm-kernel@lists.infradead.org; Thu, 02 Dec 2021 12:08:31 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 83EF858032F; Thu, 2 Dec 2021 07:08:29 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 02 Dec 2021 07:08:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=iCdKz1fAS9RSq r6MdMDps0wFHMwgQu8juRHJqY1g5io=; b=NwLVO+RJDjkGrc2KeKaXNOe+m7rop SQWwBCb31Iw0pvd7GP7a7ZjXodsKotr4l5N6jmLxwoxgay4Ye8WvaBJFhjM0bLQt B+RrDGpTNUsP/mMai+slumi2KRi0/mUdnQj1zt7UuK/Nx+SFVfR7WeKBGT5rkuiF FVk0I4OZ9tlsgmwl8RajGs0K2UCYYWkQ49CbFxR1tZk6Kd1An2TM2kRYQZutJP9w kUG+cTmRwxbP8pjZ2m7O+XuTdSmpUa1leBeiH/OB3cCqdnDgcHFIwP5tibfDwZ79 YbyxuiHfM1qCp//ri13fOnZ+kX4EGdzSKxziZ3gYd52HJZHOucZgxmCBA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=iCdKz1fAS9RSqr6MdMDps0wFHMwgQu8juRHJqY1g5io=; b=eylTYX9R 1oZQjgdC+6yoYSVMdCaiNsTpW/v7UZMEgrcIKa2MzYzqCGEDFtsYn0UGxH07188c JslPKQmQTiffva7fN+lFZ+IYmyp4N0JbyC48wHAt1zqxLaSIzH0KKRZ7QnmzpRwO S2J0abt7qClZEqEoLD8VzSxCjD8lrCUlV4njjIEjLgiGYnkVBOLIc1+x12qDa37j joAdCAfTX0Bf990xsBwFCtCBM6swXJidSH9KkRfoN0rqh39STodu8a/CmzPkiTrW xeOQPvLffkuK+Iytvm9o7/Ul2sZik/VAd7z52SOOfbFIhwXz0vl6OOP7AltKhgva 6fUF9J5RvPWLYA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrieehgdefiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeetlhhishhtrghirhcuhfhrrghntghishcuoegrlhhishhtrghi rhesrghlihhsthgrihhrvdefrdhmvgeqnecuggftrfgrthhtvghrnhepheffjeetteetke ffhfdvgefhgeevvddvueejheehfeevfedufeegiedtheeujeelnecuffhomhgrihhnpehr vghmrghrkhgrsghlvgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlihhsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 2 Dec 2021 07:08:23 -0500 (EST) From: Alistair Francis To: kernel@pengutronix.de, robh+dt@kernel.org, lee.jones@linaro.org, lgirdwood@gmail.com, broonie@kernel.org Cc: linux-arm-kernel@lists.infradead.org, alistair23@gmail.com, linux-hwmon@vger.kernel.org, andreas@kemnade.info, s.hauer@pengutronix.de, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, rui.zhang@intel.com, linux-imx@nxp.com, devicetree@vger.kernel.org, amitk@kernel.org, shawnguo@kernel.org, Alistair Francis Subject: [PATCH v16 3/8] mfd: simple-mfd-i2c: Enable support for the silergy, sy7636a Date: Thu, 2 Dec 2021 22:07:53 +1000 Message-Id: <20211202120758.41478-4-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211202120758.41478-1-alistair@alistair23.me> References: <20211202120758.41478-1-alistair@alistair23.me> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211202_040830_416251_75CB72BC X-CRM114-Status: GOOD ( 13.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Signed-off-by: Alistair Francis Acked-for-MFD-by: Lee Jones --- drivers/mfd/simple-mfd-i2c.c | 11 +++++++++++ include/linux/mfd/sy7636a.h | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 include/linux/mfd/sy7636a.h diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c index 51536691ad9d..f4c8fc3ee463 100644 --- a/drivers/mfd/simple-mfd-i2c.c +++ b/drivers/mfd/simple-mfd-i2c.c @@ -62,8 +62,19 @@ static int simple_mfd_i2c_probe(struct i2c_client *i2c) return ret; } +static const struct mfd_cell sy7636a_cells[] = { + { .name = "sy7636a-regulator", }, + { .name = "sy7636a-temperature", }, +}; + +static const struct simple_mfd_data silergy_sy7636a = { + .mfd_cell = sy7636a_cells, + .mfd_cell_size = ARRAY_SIZE(sy7636a_cells), +}; + static const struct of_device_id simple_mfd_i2c_of_match[] = { { .compatible = "kontron,sl28cpld" }, + { .compatible = "silergy,sy7636a", .data = &silergy_sy7636a}, {} }; MODULE_DEVICE_TABLE(of, simple_mfd_i2c_of_match); diff --git a/include/linux/mfd/sy7636a.h b/include/linux/mfd/sy7636a.h new file mode 100644 index 000000000000..22f03b2f851e --- /dev/null +++ b/include/linux/mfd/sy7636a.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Functions to access SY3686A power management chip. + * + * Copyright (C) 2021 reMarkable AS - http://www.remarkable.com/ + */ + +#ifndef __MFD_SY7636A_H +#define __MFD_SY7636A_H + +#define SY7636A_REG_OPERATION_MODE_CRL 0x00 +/* It is set if a gpio is used to control the regulator */ +#define SY7636A_OPERATION_MODE_CRL_VCOMCTL BIT(6) +#define SY7636A_OPERATION_MODE_CRL_ONOFF BIT(7) +#define SY7636A_REG_VCOM_ADJUST_CTRL_L 0x01 +#define SY7636A_REG_VCOM_ADJUST_CTRL_H 0x02 +#define SY7636A_REG_VCOM_ADJUST_CTRL_MASK 0x01ff +#define SY7636A_REG_VLDO_VOLTAGE_ADJULST_CTRL 0x03 +#define SY7636A_REG_POWER_ON_DELAY_TIME 0x06 +#define SY7636A_REG_FAULT_FLAG 0x07 +#define SY7636A_FAULT_FLAG_PG BIT(0) +#define SY7636A_REG_TERMISTOR_READOUT 0x08 + +#define SY7636A_REG_MAX 0x08 + +#define VCOM_ADJUST_CTRL_MASK 0x1ff +// Used to shift the high byte +#define VCOM_ADJUST_CTRL_SHIFT 8 +// Used to scale from VCOM_ADJUST_CTRL to mv +#define VCOM_ADJUST_CTRL_SCAL 10000 + +#define FAULT_FLAG_SHIFT 1 + +#endif /* __LINUX_MFD_SY7636A_H */