Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp456332pxh; Wed, 10 Nov 2021 04:34:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJdCJW+IgRJ6PEBy2JcaeWVmbnO2mKGuQo/wYOUy4pfFnwPy4oUnB0qvUY7zj4SeTE3aiI X-Received: by 2002:a17:906:2b12:: with SMTP id a18mr20359887ejg.254.1636547692217; Wed, 10 Nov 2021 04:34:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636547692; cv=none; d=google.com; s=arc-20160816; b=D9V2otVHFeRc4BFIFFFwk8MkKOHQ6OX+9BE4mYGOuBcDup0UN8E3Viw25Cy1XyWvRD XghNjsVQ8eBxSJHPn15VDhCkG/qE60UDGTCjOHq2N/8sOvcSDnHnLNhPDR4Kp56miPl4 UccNSXbHd6QmsSuucKWiiRbR0jibrG8cVDnN7D3ZIA21dIEuHasI9PyDsqAKp+YYEbXn OQdtPKbwXf1DngXdZx9Ov9XnC3WJCIaq07Bo5tN5BWy/pvkuxj6J7iiCAqxB+uFEAZg9 iXYmJLjkR8NzF0Jgu9vKST+RWvFlzNzNhiC1ln49F2Fy5WhwrZBAAoq6n1Hl6G/hR9CI ZC6g== 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:dkim-signature; bh=LuBuJ51kAs683zqagRQH/JKcv0PkL6c6myFxIpkwVuU=; b=m2KWOD7O4lxjToHcfY1qSXNsjmnLwMB8uG0/KGUVFsBDM3eBqEkvMWIuEEG2VR3lT4 yOtVNLwByEoEb/swJB9ZEwcVWEzYShR5tOcafP0lTksTV6mcq/U885NaAkS0VTbbdz4D U4y8lDaIKO8g5otUW5nbiwbvMT40/ruvHpdENVGL6gNHUwbfUq6yiRyJmoMAmh0XDflu HTy52Ar33zc2jI8h5FWGLYDYkek1EuBfzUFtHI/K9xQ0ElMt+lJTi1vbMpnvK45PHyxE r3OwxF63hg7jPanNWpvpnD4C5X9AchRyDA4ZqEAfwyHMDMnabjK0X1aLzOZHmA2qKkBg sjWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alistair23.me header.s=fm2 header.b=WXqqYsLP; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=JXjigXYy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nd7si49199390ejc.595.2021.11.10.04.34.26; Wed, 10 Nov 2021 04:34:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alistair23.me header.s=fm2 header.b=WXqqYsLP; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=JXjigXYy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231768AbhKJMdG (ORCPT + 99 others); Wed, 10 Nov 2021 07:33:06 -0500 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:59709 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231751AbhKJMdE (ORCPT ); Wed, 10 Nov 2021 07:33:04 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id CBBB4580867; Wed, 10 Nov 2021 07:30:16 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 10 Nov 2021 07:30:16 -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=LuBuJ51kAs683 zqagRQH/JKcv0PkL6c6myFxIpkwVuU=; b=WXqqYsLPWMrZFTi+OsHclSw1gfZ93 lKgMeeGpn+t/n5l7QFtDeqOnnEETnyPTSbVFmoliEZ0WVBgB5ZF1GpQ85IsAKuCZ RpG4Ou49VyjMHeJnCt6AG9BgmiG8/+9hU+QEyoglVw5x6V4yGviaaPBSw0Pa/qMC 6OheWgKn3zpLWfuHyiJCDlZrz1pgiJHHK2afUVxWkfOydO5A//lu5jRGhrw/pSpd 6o3TVk/WwYUt1EtZFILw0KnWfzjysj2mf8/5DZdluYV8Y+FCTBOqE5iOuZ80gxjf ubv+h2sXabu1qtmYLhrtQfQLwOUcRdzA5FDh6FsKsHnMwIkLOtt2RfRig== 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=LuBuJ51kAs683zqagRQH/JKcv0PkL6c6myFxIpkwVuU=; b=JXjigXYy 6YiwB1K4VPfRsQO8R3uJoLjF4r1VWJwEJeAAVcWx573qVvoIecA8K8W7NTbafrpa xSK6XWtapGILZM+0+iLPa5kzMvVmsK9MyQSjR/WnFxdWX1feUha5ga8tLPwbGzCz O7p6BbUYQ+r6jsxbVYZrc4wBhJqjJD5Axbb1xHBNs7W07o8616jPcrS9LjbEyI3P yFgi+xyFg1kRoRl4Hoh0ootxhBHreS4dhALw8nhQOSLKWmk/RsHpMIzN7YdxQ1Lc tu2rBJbGRufQwPFJGuMqoWHod63DMR74lRhzIsKbZtH1C6dF8lZKrU/8CewL+gnw vFEvbxJr8pGDrg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrudejgdeflecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeetlhhishhtrghirhcuhfhrrghntghishcuoegrlhhishhtrghi rhesrghlihhsthgrihhrvdefrdhmvgeqnecuggftrfgrthhtvghrnhepheffjeetteetke ffhfdvgefhgeevvddvueejheehfeevfedufeegiedtheeujeelnecuffhomhgrihhnpehr vghmrghrkhgrsghlvgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlihhsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Nov 2021 07:30:10 -0500 (EST) From: Alistair Francis To: lee.jones@linaro.org, broonie@kernel.org, kernel@pengutronix.de, lgirdwood@gmail.com, robh+dt@kernel.org Cc: linux-kernel@vger.kernel.org, rui.zhang@intel.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, s.hauer@pengutronix.de, linux-hwmon@vger.kernel.org, amitk@kernel.org, linux-pm@vger.kernel.org, linux-imx@nxp.com, alistair23@gmail.com, andreas@kemnade.info, shawnguo@kernel.org, Alistair Francis Subject: [PATCH v15 3/8] mfd: simple-mfd-i2c: Enable support for the silergy,sy7636a Date: Wed, 10 Nov 2021 22:29:43 +1000 Message-Id: <20211110122948.188683-4-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211110122948.188683-1-alistair@alistair23.me> References: <20211110122948.188683-1-alistair@alistair23.me> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Alistair Francis Acked-for-MFD-by: Lee Jones --- drivers/mfd/simple-mfd-i2c.c | 11 +++++++++++ include/linux/mfd/sy7636a.h | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 47 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..2797c22dabc2 --- /dev/null +++ b/include/linux/mfd/sy7636a.h @@ -0,0 +1,36 @@ +/* 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 +#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_MIN 0 +#define VCOM_MAX 5000 + +#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 */ -- 2.31.1