From patchwork Fri Oct 15 12:25:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 12561305 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D89ABC433F5 for ; Fri, 15 Oct 2021 12:28:15 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A429C60E05 for ; Fri, 15 Oct 2021 12:28:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A429C60E05 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=alistair23.me Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=Wj595IHIPizhjIksCLldxDESVR6apLsEtCqJFL1vJsE=; b=EYCBw3SiVSsdvi sFNNC4lfAUeZ+cWPvEKIqQVV4c3FhMIxE5a2dh8smi7xBC9b6MtzOBXEK67BH4utJEdRqa7TeljZY B8D5CMAj0yW7Xu4wK2wnXAm7uljTt/H8lhZcAKfMxNyxNU2pOaPO/Fmp8PH00jkK+giFwr3ZXLMXI Rr61nBFo4nLkgAtnc0fnTqJSLYD8o+iWwglfdzgbKWENLKft66slH0kBqi9GMDxXBKIyRWnbGf9Uw sJx5Z3mLpQtGhJwjdPgdaaX6C9wkat9mIbJFYBBMgD+q24gLgrA+8Cd240UAuf3tkyqP3jOUVeJ1q ogyT8NRQ43MQkfXw/sGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbMIM-006sP6-Qb; Fri, 15 Oct 2021 12:26:43 +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 1mbMI2-006sJi-4B for linux-arm-kernel@lists.infradead.org; Fri, 15 Oct 2021 12:26:23 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 840BC580EC5; Fri, 15 Oct 2021 08:26:21 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 15 Oct 2021 08:26:21 -0400 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=FdDYT5Tp6YL1F JGtwpyXkf35bNWjV4edMJpysgQFfjE=; b=hLppTsDffI86hz6TPn+dR4g3RJoGW H8/ffy1O3qCAV7GlDD1bZTGgIazRagkOUb0dwKcUiCconpTWmr8AIGVxn3EXxJL3 bxKgCp0Tb2qrBfRWrQrn+plov5YqCuarcCjP5Wi3T3L7JNpureLRFY8ja/NblKDN pjLgYDU+dAXJ+0SVWnNGfpcYJyprhEZUACSQMkihX8ISDH70dCchdljKp/ygCP7g J0lMHCBA1SKHx+GXIb/EJs92fS4L9Sof6HWwf+chefvQh9FmZbJpJHwCbCFD90oP S9VVihnHJQNuLJ4bXReAFQzNe5TOIF4MZ9nZ/h2Ag6IfetA6CukrBNWPg== 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=FdDYT5Tp6YL1FJGtwpyXkf35bNWjV4edMJpysgQFfjE=; b=gAFlKV9S 9BSH4pVmNbU2bma0tWxzOedHUlnSX81cn9eV0iX5f3orbK3InqTTtuHtsRumUEPV TUr5y8rz5ZfDtXb/yKvbCfDkFSMIOfPaigyNk31FbumLHU0l/DvsXLbVuD07UYwR 2B3N2VJT2cWeKo+hGdaLF+Y9PC6PESPnKGYjbTSMsb5NgNVKZony3yMcYzqUPwP4 eMOVAPHbtu+sxu9o8cUioqCpO7+lj7vHs/aiDkYmHsRJi4DT7yoDgJROZdri/nlj pnHzUdi2KpU2SGX8Q8wsemtPVY3m/5Xu1fd5D2/U5Eaqi6stuC7umEWMtrxuLSP5 gnVs1dQ0xdYuog== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddugedghedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeehffejteette ekfffhvdeghfegvedvvdeujeehheefveefudefgeeitdehueejleenucffohhmrghinhep rhgvmhgrrhhkrggslhgvrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomheprghlihhsthgrihhrsegrlhhishhtrghirhdvfedrmhgv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 15 Oct 2021 08:26:15 -0400 (EDT) From: Alistair Francis To: lee.jones@linaro.org, robh+dt@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, kernel@pengutronix.de Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, linux-imx@nxp.com, amitk@kernel.org, rui.zhang@intel.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alistair23@gmail.com, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, Alistair Francis Subject: [PATCH v13 3/9] mfd: simple-mfd-i2c: Enable support for the silergy, sy7636a Date: Fri, 15 Oct 2021 22:25:45 +1000 Message-Id: <20211015122551.38951-4-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211015122551.38951-1-alistair@alistair23.me> References: <20211015122551.38951-1-alistair@alistair23.me> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211015_052622_264798_DFA67C62 X-CRM114-Status: GOOD ( 12.93 ) 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 | 12 +++++++++++ include/linux/mfd/sy7636a.h | 41 ++++++++++++++++++++++++++++++++++++ 2 files changed, 53 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..fbc6d6aed6c0 100644 --- a/drivers/mfd/simple-mfd-i2c.c +++ b/drivers/mfd/simple-mfd-i2c.c @@ -62,8 +62,20 @@ 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", }, + { .name = "sy7636a-thermal", }, +}; + +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..15caa54f0432 --- /dev/null +++ b/include/linux/mfd/sy7636a.h @@ -0,0 +1,41 @@ +/* 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 + +#include +#include +#include +#include + +#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 */