From patchwork Thu Dec 16 12:25:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12696462 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 B1E81C433EF for ; Thu, 16 Dec 2021 12:55:22 +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=RUnhSAJocYk8u+ vCGvc4/NpEZvEw1w60kmgEbcPB/QUmvsmrFne6g2GCRvi3ib8fG7lm8x7tQ/1gXTv4oyR+eADpUBk H10+I5It1ipj1o0/qGtIZvNZX+WptRaHUIJmAak29i0ec1t3zq9Rsj5peadKLMe4Z9ATjKacn2y7d q/HIUpMzTglETSoVmvZcHWUAodz3PxWbZnACGQcAZ+j/9vxktRMZ2rq848Zxz384i5lEqr34/9Jhe +o8zL3yQV33dRQZF6r+bV3GRtT5qrMdCU0NjvjaGfn20CNSBf0oD/t9xe9kr+R4wJq30r/+9AN0Bh zBFejj/knZVEIGxpHbyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxqGN-005YTO-80; Thu, 16 Dec 2021 12:53:36 +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 1mxppb-005Q3b-MF for linux-arm-kernel@lists.infradead.org; Thu, 16 Dec 2021 12:25:57 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 0BA575805C9; Thu, 16 Dec 2021 07:25:55 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 16 Dec 2021 07:25:55 -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=GChqi+D8cj4gCtS9IhMGdER0Zo9Kp 3kCnbrN4osG7pFZzDsXzqhaY971aXRRCMl/vYHiZ6rQiwg/HMu18eKFWBXSlJP3g r9nHvdkPq8BzzCIuXHeSSCzLLR/u6ZsdjhEtFWMm+SZls7QbcubbOFrw5HLYeJOL GN3xJWNQgaLxaG317tTaM2d6D7vunPbkuoROGmBt3DrOcI1g98RM9egtOzOYcoFL FKcl9QSVWl3ABgXyKSDr9eueilLld7Y122iZenlgO83Cx9T+6Rc4gG01v4LPWu5L Fi+1vOz4XkVA3DT71fhCDdz4SnNoF4xnaEInQ09hBselts5VLMmNgSvnw== 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=VS9mYzdG glPWYoGDjXw91bOZe+zh3xvXJGYaW1OwjSwFHEzBCb+DjH+uv2RuiBfBnHDT9nxu LdIyEZ2kWMek6yQXgjKTd3UZsRymywB7MRcf+3OJlmFEjOv+EkHpJwUY0yS4jMmP QAiq4wdQy0hFCUXRhz6C4bOYKReARdsozwfb78fp/EWNqwTegORJV2eSVmoP+8Ia 3jT2mslW4MCGpM65dRkL1jCImiW+MZr+mRUbRmk5DPpqFkUWj8S5nuFABqpkw339 Z453VaFfk5OoItF8PyIkZsfUaKy7s0rG9F4gXTBpQt9K/jF1YMDewjPlKCRBqEdz LLo9Jl1OvMDLKA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrleeggdegudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeetlhhishhtrghirhcuhfhrrghntghishcuoegrlhhishhtrghi rhesrghlihhsthgrihhrvdefrdhmvgeqnecuggftrfgrthhtvghrnhepheffjeetteetke ffhfdvgefhgeevvddvueejheehfeevfedufeegiedtheeujeelnecuffhomhgrihhnpehr vghmrghrkhgrsghlvgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlihhsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Dec 2021 07:25:49 -0500 (EST) From: Alistair Francis To: kernel@pengutronix.de, lgirdwood@gmail.com, robh+dt@kernel.org, lee.jones@linaro.org, broonie@kernel.org Cc: linux-imx@nxp.com, devicetree@vger.kernel.org, s.hauer@pengutronix.de, linux-arm-kernel@lists.infradead.org, andreas@kemnade.info, linux-hwmon@vger.kernel.org, alistair23@gmail.com, amitk@kernel.org, shawnguo@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, rui.zhang@intel.com, Alistair Francis Subject: [PATCH v17 3/8] mfd: simple-mfd-i2c: Enable support for the silergy, sy7636a Date: Thu, 16 Dec 2021 22:25:20 +1000 Message-Id: <20211216122525.136139-4-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211216122525.136139-1-alistair@alistair23.me> References: <20211216122525.136139-1-alistair@alistair23.me> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211216_042555_848550_0BE07B98 X-CRM114-Status: GOOD ( 13.45 ) 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 */