Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp434004pxb; Mon, 25 Oct 2021 11:07:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDjPWEJQM6QWeHdYJtu8RyPxx3etwkqBccuZY35h04EjxudAIwknEGb2BIq2ySOW+ES6yt X-Received: by 2002:a50:fb10:: with SMTP id d16mr26001493edq.378.1635185221882; Mon, 25 Oct 2021 11:07:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635185221; cv=none; d=google.com; s=arc-20160816; b=MN9XWTA668TXVhQvxxcGfh6ZeEq1mQHdPSGOdhD6OKb6mf6YNqBAHlqCfRa295MBDw erUycu1306WnBdw5WsCgZepUJ1KhEZ2xc7oujrW71ieQG0EfD78YpL/i+U299cejGPsa 63UwkmGL9mBjRgRR6dffvhk94RGfj11RHqpqIlopJzgPhgt5BmZtoB1qSx6s1I9aDtbp XeD4Xpa7gj+tymqXnHgSUyVhPpdfTs3hhkCdOgUff/yDg1R5qagzeEYnvtY2TRpRO4gK 3Sv9UKWV9O520iNKEu9U64TE3wkNzdIslfQPxb6yG4UwFvA6tu+pmyVdma4Fxjl7rJ2j +zDA== 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=TwyLn2fm42ciSOETQ39/aupQExQyAWttfUK1Rw0iVuwUk98G2b4oIWIAR/32udo+/H HUSkTJJmrY75vt1nSXvvfJYmvsd18BeM/0D6Dgjs9AYwi8wiP2Ko9clWndx2niZsr97h flGmhaC5oAXlN9kIbPjlgtgPkKSlk3/S/Sl1N85phfNIr7KnpIglzowzDoPO255PYUSu AO9DkZ+323tvEBk571KLFjjjlvGRZ0vixkfEd3oJisqa/sqgFlXF7hZ0Q48DFfUIjy08 8f4A8oyiGlz/aTdzQxwA07WAKSf4e19Tvs8r4H21n3QDMNksVfTV+6IRnMY+6KRBOSkK qhFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alistair23.me header.s=fm2 header.b=ZCxLDnyW; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=fugy0bp1; 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 b1si25932446ejl.25.2021.10.25.11.06.35; Mon, 25 Oct 2021 11:07:01 -0700 (PDT) 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=ZCxLDnyW; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=fugy0bp1; 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 S232963AbhJYK4U (ORCPT + 99 others); Mon, 25 Oct 2021 06:56:20 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:36689 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232951AbhJYK4Q (ORCPT ); Mon, 25 Oct 2021 06:56:16 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id C9D1858045A; Mon, 25 Oct 2021 06:53:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 25 Oct 2021 06:53:53 -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=LuBuJ51kAs683 zqagRQH/JKcv0PkL6c6myFxIpkwVuU=; b=ZCxLDnyWr0Pq9l9Mw18+UvpgAw/M6 OX7+WwBKykBmT7M/QH1mdxNy9pu+ZwZxHsDmS5VHmbOoAcdCbyKUTxVw3qKNLq0S usa5ev/O+JZCsJDm3aKfpij8xa3WJgnPNhmvKKXzOpZk7JTn36RZK1f5rRQ1LvCv grTQce5HfjmjGIAbk8HLEyFdO/pQdQ6RrVNZkr2DEwtE5bbjMILJjg2FttxiasYI t/QejmUdclpBOueSISOFhFF6nWExHgGfaiJamFAg79/qSe8oVoH7EoORna2Z4Tyc TTuXtDIe16VwVfCamwRJdMJSbLLVcx87yJnvj/BxtAwmXeUzykBJoFICg== 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=fugy0bp1 b2e3mPjitpKoZTXVyM3KoeVF/oWhAH07La9tCmNddbnxM2nJG2LTYPC2/GWP5xlI 8bzL8K02ctWebjHh+4cEGATLO8nyO5lqfnb3291vy56iCm3Q/7hmEINtmtWuxi0u 1wjLPEv33fcrOafZRZjT+8TZscRgO+9glGgZWx3rhHDfzpSQSrnzy25xIuQOj/Wq ulKCMgUUxwkN9VvE8ryIfLJx+04u3VKIePqIQOiI1ZTea9WwPTgKcj5pPl4qz0Uw ApwLBXjGViyqSZ6uXdS5mamSkhRGXRagDijb4jaW6loji274eQxfx75acJBy8v04 lsQC/lRNbY7Fag== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvdefhedgfedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeehffejteette ekfffhvdeghfegvedvvdeujeehheefveefudefgeeitdehueejleenucffohhmrghinhep rhgvmhgrrhhkrggslhgvrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomheprghlihhsthgrihhrsegrlhhishhtrghirhdvfedrmhgv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 25 Oct 2021 06:53:43 -0400 (EDT) From: Alistair Francis To: robh+dt@kernel.org, kernel@pengutronix.de, lgirdwood@gmail.com, lee.jones@linaro.org, broonie@kernel.org Cc: s.hauer@pengutronix.de, rui.zhang@intel.com, linux-hwmon@vger.kernel.org, linux-arm-kernel@lists.infradead.org, amitk@kernel.org, shawnguo@kernel.org, alistair23@gmail.com, devicetree@vger.kernel.org, linux-imx@nxp.com, andreas@kemnade.info, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Alistair Francis Subject: [PATCH v14 3/8] mfd: simple-mfd-i2c: Enable support for the silergy,sy7636a Date: Mon, 25 Oct 2021 20:53:04 +1000 Message-Id: <20211025105309.37942-4-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211025105309.37942-1-alistair@alistair23.me> References: <20211025105309.37942-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