From patchwork Mon Jan 24 12:10:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair X-Patchwork-Id: 537476 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B62AC43217 for ; Mon, 24 Jan 2022 12:10:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238401AbiAXMKf (ORCPT ); Mon, 24 Jan 2022 07:10:35 -0500 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:37711 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238388AbiAXMK0 (ORCPT ); Mon, 24 Jan 2022 07:10:26 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 5965B58035C; Mon, 24 Jan 2022 07:10:24 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 24 Jan 2022 07:10:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; bh=dIamJe71dG+Zox +zSJ91KvmhrQ+mqndeaCChM+4h6+0=; b=WDYQKVYH+ZiKUwKq8iAnWtalF2X8JA 1oHvo9ex0o/zEHl710TxdhfaPhj9zpQTNFDf6rnCSOxejGqKJs8yIt5mVwnSMiEX FgqG8k8/UjJIhXc5JwmV57gYBASt18F0FAMh8rPO0/AxM2rl6nwa0/uZVGV3a0sO 9m6ax5igUoGBuBmK8sCGVCERiB5W03BT7dycn8dHdsBQELaYbsoDhVEHTTpvCQix X/6ZeWCQxYvszf6WfZ0N39SIZ6ZAz1GDsjlPGD4Uy9QUWVF3qTeYUqQItRm5zQSU rA/EcKDsAea3eTuSRHz/mWkelID9ycSgXke5Cq8tH4M9yR1DThpHm4Ow== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=dIamJe 71dG+Zox+zSJ91KvmhrQ+mqndeaCChM+4h6+0=; b=iCDmk0rcRelouNrStnu2YI U54JakfTuK/+vTEUVtRYWyO9c9PDNDW6k4mvr0RhzTgboFlKTmODFcVQxpiCjH2E fqAMPm0k2fDCoM7OCQZhCZRdinYqldw195wck8tew4Z4zWQiAnqKTDh7Wx7BJqO6 zwR3zI5eQr1LnNvwcWhT/m0kp76dyCRLATvgQbnOS0PnNBGS3/OlUbOX7fwCYK3+ ri8uga8asxncW/B8uWvWFOAG1dOn1BrnI47PYoKBhlSjWev3Va2ytwrW7sga9l6V pIOO4+/V9IHD7BunTz9ytdJRo7oCx5sK7htF9KrqIr4HWbQFnI6e7DpBZAaBEqVg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrvdeigdefkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomheptehlihhsthgr ihhrucfhrhgrnhgtihhsuceorghlihhsthgrihhrsegrlhhishhtrghirhdvfedrmhgvqe enucggtffrrghtthgvrhhnpefftdfhgfeggfelgfekjefhkeeigfelleefhfethfehfeet leeggeeggfefffdvtdenucffohhmrghinhepuggvvhhitggvthhrvggvrdhorhhgnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 24 Jan 2022 07:10:18 -0500 (EST) From: Alistair Francis To: broonie@kernel.org, robh+dt@kernel.org, kernel@pengutronix.de, lgirdwood@gmail.com, lee.jones@linaro.org Cc: linux-pm@vger.kernel.org, linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-imx@nxp.com, rui.zhang@intel.com, alistair23@gmail.com, amitk@kernel.org, linux-arm-kernel@lists.infradead.org, andreas@kemnade.info, s.hauer@pengutronix.de, linux-kernel@vger.kernel.org, shawnguo@kernel.org, Alistair Francis , Rob Herring Subject: [PATCH v18 1/8] dt-bindings: mfd: Initial commit of silergy,sy7636a.yaml Date: Mon, 24 Jan 2022 22:10:02 +1000 Message-Id: <20220124121009.108649-2-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220124121009.108649-1-alistair@alistair23.me> References: <20220124121009.108649-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Initial support for the Silergy SY7636A Power Management chip and regulator. Signed-off-by: Alistair Francis Reviewed-by: Rob Herring Acked-for-MFD-by: Lee Jones --- .../bindings/mfd/silergy,sy7636a.yaml | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/silergy,sy7636a.yaml diff --git a/Documentation/devicetree/bindings/mfd/silergy,sy7636a.yaml b/Documentation/devicetree/bindings/mfd/silergy,sy7636a.yaml new file mode 100644 index 000000000000..6de74c701635 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/silergy,sy7636a.yaml @@ -0,0 +1,82 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/silergy,sy7636a.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: silergy sy7636a PMIC + +maintainers: + - Alistair Francis + +properties: + compatible: + const: silergy,sy7636a + + reg: + description: + I2C device address. + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + '#thermal-sensor-cells': + const: 0 + + epd-pwr-good-gpios: + description: + Specifying the power good GPIOs. + maxItems: 1 + + regulators: + type: object + + properties: + compatible: + const: silergy,sy7636a-regulator + + vcom: + type: object + $ref: /schemas/regulator/regulator.yaml# + description: + The regulator for the compenstation voltage. Enabling/disabling this + enables/disables the entire device. + properties: + regulator-name: + const: vcom + + additionalProperties: false + +required: + - compatible + - reg + - '#thermal-sensor-cells' + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + pmic@62 { + compatible = "silergy,sy7636a"; + reg = <0x62>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_epdpmic>; + #thermal-sensor-cells = <0>; + + regulators { + reg_epdpmic: vcom { + regulator-name = "vcom"; + regulator-boot-on; + }; + }; + }; + }; +... From patchwork Mon Jan 24 12:10:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair X-Patchwork-Id: 537475 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B467C433F5 for ; Mon, 24 Jan 2022 12:10:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238448AbiAXMKs (ORCPT ); Mon, 24 Jan 2022 07:10:48 -0500 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:35445 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238472AbiAXMKi (ORCPT ); Mon, 24 Jan 2022 07:10:38 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 49142580355; Mon, 24 Jan 2022 07:10:37 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 24 Jan 2022 07:10:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; bh=iCdKz1fAS9RSqr 6MdMDps0wFHMwgQu8juRHJqY1g5io=; b=tC9OKnSnl/fhfkdwHftdcxVStMD3qw 0AqfNaq2gXfJuefS/XgoWGknnXkjt2IevzUl6TneM6B6jQeZVQ88BUHlgEK+Ka1t jxGjqXu27D5JNd8jlVcPqBRY2suN1JwzLRb41SHQOvuLwPAF0VQsDtcZ3japcdJ7 0r1qt3CnPlsQknHzLTUl84b6YIAdv6Ro+4b1eVex9YSAsqgmsxwUxTZ7chSnpL0z MGlfMEXkkgQxluOS8vgwcXQOQNx9MUnVC6OmFK5CTLML4eIyA8rWeQe81ExS+l8H i49gSPhdWc2xvRs32FriNF/AmxJ7YF6vYyGxI3SWFq6wFwmeNuRlzzBA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=iCdKz1 fAS9RSqr6MdMDps0wFHMwgQu8juRHJqY1g5io=; b=MjhIC3VlaI5jQlDUqsjtsa DJZxRG5NWiZ1tzlaP5ZY3KrKe1SM60m/1uFbav9DhGuEKETLOdX9hfsUQVdSU1lo yzpFNAr674IPCPQiyzjKczaGUK9u8SRz7l6VUCwhaHfn8DCOPs8V2G584JO6j31z 5Aor3pq65XacT7pKzjabb27LNuvo1K+Bttb4op1CqdonYX1ZSQlJ3Xi7ozhT9eRb cPrgNwtUAFJEjakDBF+uqON9G2h4S2bfhE2bXoG/8I2tIcLNmsJa5BIC5FiPnlwp psNXjeAx+eV5xVnrQQGI+57SUcNKxFPkUggYWEwPm0Kz8cotf/SgnG2FkPQRlC9Q == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrvdeigdefjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeetlhhishhtrghirhcuhfhrrghntghishcuoegrlhhishhtrghi rhesrghlihhsthgrihhrvdefrdhmvgeqnecuggftrfgrthhtvghrnhepheffjeetteetke ffhfdvgefhgeevvddvueejheehfeevfedufeegiedtheeujeelnecuffhomhgrihhnpehr vghmrghrkhgrsghlvgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlihhsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 24 Jan 2022 07:10:30 -0500 (EST) From: Alistair Francis To: broonie@kernel.org, robh+dt@kernel.org, kernel@pengutronix.de, lgirdwood@gmail.com, lee.jones@linaro.org Cc: linux-pm@vger.kernel.org, linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-imx@nxp.com, rui.zhang@intel.com, alistair23@gmail.com, amitk@kernel.org, linux-arm-kernel@lists.infradead.org, andreas@kemnade.info, s.hauer@pengutronix.de, linux-kernel@vger.kernel.org, shawnguo@kernel.org, Alistair Francis Subject: [PATCH v18 3/8] mfd: simple-mfd-i2c: Enable support for the silergy,sy7636a Date: Mon, 24 Jan 2022 22:10:04 +1000 Message-Id: <20220124121009.108649-4-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220124121009.108649-1-alistair@alistair23.me> References: <20220124121009.108649-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@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 | 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 */ From patchwork Mon Jan 24 12:10:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair X-Patchwork-Id: 537474 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1897C4332F for ; Mon, 24 Jan 2022 12:11:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238548AbiAXMLC (ORCPT ); Mon, 24 Jan 2022 07:11:02 -0500 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:33381 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239089AbiAXMKv (ORCPT ); Mon, 24 Jan 2022 07:10:51 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 7E41C5800C6; Mon, 24 Jan 2022 07:10:50 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 24 Jan 2022 07:10:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; bh=CIetouW3Bv/ITY QwDW70ifSsbnf+csJT+kKRfO1FjHg=; b=K4OvP8x6lYz3KZ4HKpNRLCzupVqB62 oFoR5Uq9MEI1An+Pw+HEZJWeB0Dq4wRjytPCesv/fPsbf8vBSU2m0941wiEPhLbX 3sXlhx1Ki6dB5K2dpzYykmV7IYMKnQYFl8pg4eucA3b0+BrOps8ZoitYSc7RBEMr l4oWrtu0dIQs7qBXqQvhoYiAaz9WJQZKDlv4Q3khbi/OVneFCsnXzanx2uXecbn+ lo0g6n7xcIPOT3Ae2dyO49OEZ7s3MefkNMrByLXTKJktZv2dhqh/FzfBtTEgu+sX WmH4hgraMu89ozjqJGUYREOoM/VAt8bQusHvU3T31jRAStzKi0AVJK2w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=CIetou W3Bv/ITYQwDW70ifSsbnf+csJT+kKRfO1FjHg=; b=IxBojMH28Gdt021hq9FJMP bCead0ALTM3Vib3cLGS7fvTutwjRDkl5ejMdMPtUPSA/mnGJ+tOr7gg0m4ke+nkI S3bPMydsrf/7TKcHxhj9nbWfENt5Kgixv0dcU7R0iT493n0qY0BVeSDbW1Iat1nY vrso02rmTEaRQGAnM6maSKNnLj7Mxxt+WYXkc7ePc6XkzFXi903nKVsAGduGFxeQ fBFbe40+apdoD4dUcL2XGy91HNadPBJp1GhAVVzu0hrS2uFq+n22dKMBISF12qF6 oiQNtpUdCdIeuI88PhILY4HF0JxFoGBjQRq2lbgOi7LRVHIvxeYtw/Vm5uEYuYOQ == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrvdeigdefkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeetlhhishhtrghirhcuhfhrrghntghishcuoegrlhhishhtrghi rhesrghlihhsthgrihhrvdefrdhmvgeqnecuggftrfgrthhtvghrnhepheffjeetteetke ffhfdvgefhgeevvddvueejheehfeevfedufeegiedtheeujeelnecuffhomhgrihhnpehr vghmrghrkhgrsghlvgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlihhsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 24 Jan 2022 07:10:44 -0500 (EST) From: Alistair Francis To: broonie@kernel.org, robh+dt@kernel.org, kernel@pengutronix.de, lgirdwood@gmail.com, lee.jones@linaro.org Cc: linux-pm@vger.kernel.org, linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-imx@nxp.com, rui.zhang@intel.com, alistair23@gmail.com, amitk@kernel.org, linux-arm-kernel@lists.infradead.org, andreas@kemnade.info, s.hauer@pengutronix.de, linux-kernel@vger.kernel.org, shawnguo@kernel.org, Alistair Francis , Guenter Roeck Subject: [PATCH v18 5/8] hwmon: sy7636a: Add temperature driver for sy7636a Date: Mon, 24 Jan 2022 22:10:06 +1000 Message-Id: <20220124121009.108649-6-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220124121009.108649-1-alistair@alistair23.me> References: <20220124121009.108649-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This is a multi-function device to interface with the sy7636a EPD PMIC chip from Silergy. Signed-off-by: Alistair Francis Acked-by: Guenter Roeck --- Documentation/hwmon/index.rst | 1 + Documentation/hwmon/sy7636a-hwmon.rst | 26 +++++++ drivers/hwmon/Kconfig | 9 +++ drivers/hwmon/Makefile | 1 + drivers/hwmon/sy7636a-hwmon.c | 106 ++++++++++++++++++++++++++ 5 files changed, 143 insertions(+) create mode 100644 Documentation/hwmon/sy7636a-hwmon.rst create mode 100644 drivers/hwmon/sy7636a-hwmon.c diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst index df20022c741f..6e0906ef5d25 100644 --- a/Documentation/hwmon/index.rst +++ b/Documentation/hwmon/index.rst @@ -185,6 +185,7 @@ Hardware Monitoring Kernel Drivers smsc47m1 sparx5-temp stpddc60 + sy7636a-hwmon tc654 tc74 thmc50 diff --git a/Documentation/hwmon/sy7636a-hwmon.rst b/Documentation/hwmon/sy7636a-hwmon.rst new file mode 100644 index 000000000000..5612079397d5 --- /dev/null +++ b/Documentation/hwmon/sy7636a-hwmon.rst @@ -0,0 +1,26 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +Kernel driver sy7636a-hwmon +========================= + +Supported chips: + + * Silergy SY7636A PMIC + + +Description +----------- + +This driver adds hardware temperature reading support for +the Silergy SY7636A PMIC. + +The following sensors are supported + + * Temperature + - SoC on-die temperature in milli-degree C + +sysfs-Interface +--------------- + +temp0_input + - SoC on-die temperature (milli-degree C) diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 8df25f1079ba..aa5785e657a4 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -1672,6 +1672,15 @@ config SENSORS_SIS5595 This driver can also be built as a module. If so, the module will be called sis5595. +config SENSORS_SY7636A + tristate "Silergy SY7636A" + help + If you say yes here you get support for the thermistor readout of + the Silergy SY7636A PMIC. + + This driver can also be built as a module. If so, the module + will be called sy7636a-hwmon. + config SENSORS_DME1737 tristate "SMSC DME1737, SCH311x and compatibles" depends on I2C && !PPC diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 185f946d698b..fe54a3dfdb03 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -186,6 +186,7 @@ obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o obj-$(CONFIG_SENSORS_SPARX5) += sparx5-temp.o obj-$(CONFIG_SENSORS_STTS751) += stts751.o +obj-$(CONFIG_SENSORS_SY7636A) += sy7636a-hwmon.o obj-$(CONFIG_SENSORS_AMC6821) += amc6821.o obj-$(CONFIG_SENSORS_TC74) += tc74.o obj-$(CONFIG_SENSORS_THMC50) += thmc50.o diff --git a/drivers/hwmon/sy7636a-hwmon.c b/drivers/hwmon/sy7636a-hwmon.c new file mode 100644 index 000000000000..6dd9c2a0f0e0 --- /dev/null +++ b/drivers/hwmon/sy7636a-hwmon.c @@ -0,0 +1,106 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Functions to access SY3686A power management chip temperature + * + * Copyright (C) 2021 reMarkable AS - http://www.remarkable.com/ + * + * Authors: Lars Ivar Miljeteig + * Alistair Francis + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +static int sy7636a_read(struct device *dev, enum hwmon_sensor_types type, + u32 attr, int channel, long *temp) +{ + struct regmap *regmap = dev_get_drvdata(dev); + int ret, reg_val; + + ret = regmap_read(regmap, + SY7636A_REG_TERMISTOR_READOUT, ®_val); + if (ret) + return ret; + + *temp = reg_val * 1000; + + return 0; +} + +static umode_t sy7636a_is_visible(const void *data, + enum hwmon_sensor_types type, + u32 attr, int channel) +{ + if (type != hwmon_temp) + return 0; + + if (attr != hwmon_temp_input) + return 0; + + return 0444; +} + +static const struct hwmon_ops sy7636a_hwmon_ops = { + .is_visible = sy7636a_is_visible, + .read = sy7636a_read, +}; + +static const struct hwmon_channel_info *sy7636a_info[] = { + HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ), + HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT), + NULL +}; + +static const struct hwmon_chip_info sy7636a_chip_info = { + .ops = &sy7636a_hwmon_ops, + .info = sy7636a_info, +}; + +static int sy7636a_sensor_probe(struct platform_device *pdev) +{ + struct regmap *regmap = dev_get_regmap(pdev->dev.parent, NULL); + struct regulator *regulator; + struct device *hwmon_dev; + int err; + + if (!regmap) + return -EPROBE_DEFER; + + regulator = devm_regulator_get(&pdev->dev, "vcom"); + if (IS_ERR(regulator)) + return PTR_ERR(regulator); + + err = regulator_enable(regulator); + if (err) + return err; + + hwmon_dev = devm_hwmon_device_register_with_info(&pdev->dev, + "sy7636a_temperature", regmap, + &sy7636a_chip_info, NULL); + + if (IS_ERR(hwmon_dev)) { + err = PTR_ERR(hwmon_dev); + dev_err(&pdev->dev, "Unable to register hwmon device, returned %d\n", err); + return err; + } + + return 0; +} + +static struct platform_driver sy7636a_sensor_driver = { + .probe = sy7636a_sensor_probe, + .driver = { + .name = "sy7636a-temperature", + }, +}; +module_platform_driver(sy7636a_sensor_driver); + +MODULE_DESCRIPTION("SY7636A sensor driver"); +MODULE_LICENSE("GPL"); From patchwork Mon Jan 24 12:10:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair X-Patchwork-Id: 537473 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD706C433FE for ; Mon, 24 Jan 2022 12:11:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239235AbiAXMLN (ORCPT ); Mon, 24 Jan 2022 07:11:13 -0500 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:48091 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238507AbiAXMLD (ORCPT ); Mon, 24 Jan 2022 07:11:03 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 1AF045800C6; Mon, 24 Jan 2022 07:11:03 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 24 Jan 2022 07:11:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; bh=cz/W+o1QaYv6KI uV4GCrT7jbxJ0xS3lwdZjaIKs47tY=; b=zkKju1Exn64yUuWCtIhztzVSDwhS23 Q6eBc7UO3MhoRDh4c+jxoCNJRn+qJzBEZ5f/7auA2uDjcJG4uK+I2KCuEvrriaLJ 6aN/clPy41yd42vTXH1HUBIotWkfNm6GSP5ORAr3/0ddjDIVA+AxYbRV81QcVdDN eDqlDRXEbvEsimJqQ67bBPml50iCX+3PZUYSQ0lXZWDzuaB0WZuH7e8JbwyA5aNc aUSFiPO4QM9ALp7ONFWDqFAL93dSQdgRrDEZKlDfLNgKMCAiYNyr+NB5X/F1B912 OeUt31qo0Cvjrc8FuwH50O5Io/wfSW6outHV76Srobe1XG/Hdmz8sM2A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=cz/W+o 1QaYv6KIuV4GCrT7jbxJ0xS3lwdZjaIKs47tY=; b=F+eMxLXY17mxzbLPbfbNT2 q8DzLgrNG6/CG/HpNbrdxNdzuf5KrDxYbojqyfogGf0aMFvrKmgxJi/erLaCdjOT d2Y+i+pXrH0ddb2qG5RbQYsw+e+QK6BXcss/sx6bY8WH1Dw/pZoMxkgb3Nn8RMAz j9zirzcft7L9bp9Ly+fX0uzNVXzYw2Rye6WwGznD8+qUssjy1GwTHLYTMGIRx52n TgOlAWgPJPUWX28/9R2V58iB0Lwrvkm26A+lwjA3xN7FBnnY6s8Ze58OwGMw7F+a mm60YR/A/BZA5iGK1YKkmMTKDa8cr2J5Z2MsIyVHgmk3EgsLAbP2kkchw0q7vV+Q == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrvdeigdefjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeetlhhishhtrghirhcuhfhrrghntghishcuoegrlhhishhtrghi rhesrghlihhsthgrihhrvdefrdhmvgeqnecuggftrfgrthhtvghrnhepgeegtdetjeekge eguefgheeuvedugedvteejveeiudegvddtkeffkeehtdetudfhnecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlihhsthgrihhrsegrlhhish htrghirhdvfedrmhgv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 24 Jan 2022 07:10:57 -0500 (EST) From: Alistair Francis To: broonie@kernel.org, robh+dt@kernel.org, kernel@pengutronix.de, lgirdwood@gmail.com, lee.jones@linaro.org Cc: linux-pm@vger.kernel.org, linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-imx@nxp.com, rui.zhang@intel.com, alistair23@gmail.com, amitk@kernel.org, linux-arm-kernel@lists.infradead.org, andreas@kemnade.info, s.hauer@pengutronix.de, linux-kernel@vger.kernel.org, shawnguo@kernel.org, Alistair Francis Subject: [PATCH v18 7/8] ARM: dts: imx7d-remarkable2: Enable silergy,sy7636a Date: Mon, 24 Jan 2022 22:10:08 +1000 Message-Id: <20220124121009.108649-8-alistair@alistair23.me> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220124121009.108649-1-alistair@alistair23.me> References: <20220124121009.108649-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Enable the silergy,sy7636a and silergy,sy7636a-regulator on the reMarkable2. Signed-off-by: Alistair Francis --- arch/arm/boot/dts/imx7d-remarkable2.dts | 62 +++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/arch/arm/boot/dts/imx7d-remarkable2.dts b/arch/arm/boot/dts/imx7d-remarkable2.dts index a2a91bfdd98e..99ac0d242936 100644 --- a/arch/arm/boot/dts/imx7d-remarkable2.dts +++ b/arch/arm/boot/dts/imx7d-remarkable2.dts @@ -22,6 +22,27 @@ memory@80000000 { reg = <0x80000000 0x40000000>; }; + thermal-zones { + epd-thermal { + thermal-sensors = <&epd_pmic>; + polling-delay-passive = <30000>; + polling-delay = <30000>; + trips { + trip0 { + temperature = <49000>; + hysteresis = <2000>; + type = "passive"; + }; + + trip1 { + temperature = <50000>; + hysteresis = <2000>; + type = "critical"; + }; + }; + }; + }; + reg_brcm: regulator-brcm { compatible = "regulator-fixed"; regulator-name = "brcm_reg"; @@ -84,6 +105,33 @@ wacom_digitizer: digitizer@9 { }; }; +&i2c4 { + clock-frequency = <100000>; + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&pinctrl_i2c4>; + pinctrl-1 = <&pinctrl_i2c4>; + status = "okay"; + + epd_pmic: sy7636a@62 { + compatible = "silergy,sy7636a"; + reg = <0x62>; + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_epdpmic>; + #address-cells = <1>; + #size-cells = <0>; + #thermal-sensor-cells = <0>; + + epd-pwr-good-gpios = <&gpio6 21 GPIO_ACTIVE_HIGH>; + regulators { + reg_epdpmic: vcom { + regulator-name = "vcom"; + regulator-boot-on; + }; + }; + }; +}; + &snvs_pwrkey { status = "okay"; }; @@ -177,6 +225,13 @@ MX7D_PAD_SAI1_TX_BCLK__GPIO6_IO13 0x14 >; }; + pinctrl_epdpmic: epdpmicgrp { + fsl,pins = < + MX7D_PAD_SAI2_RX_DATA__GPIO6_IO21 0x00000074 + MX7D_PAD_ENET1_RGMII_TXC__GPIO7_IO11 0x00000014 + >; + }; + pinctrl_i2c1: i2c1grp { fsl,pins = < MX7D_PAD_I2C1_SDA__I2C1_SDA 0x4000007f @@ -184,6 +239,13 @@ MX7D_PAD_I2C1_SCL__I2C1_SCL 0x4000007f >; }; + pinctrl_i2c4: i2c4grp { + fsl,pins = < + MX7D_PAD_I2C4_SDA__I2C4_SDA 0x4000007f + MX7D_PAD_I2C4_SCL__I2C4_SCL 0x4000007f + >; + }; + pinctrl_uart1: uart1grp { fsl,pins = < MX7D_PAD_UART1_TX_DATA__UART1_DCE_TX 0x79