From patchwork Sun Jan 17 04:25:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair X-Patchwork-Id: 365270 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.7 required=3.0 tests=BAYES_00, DATE_IN_PAST_12_24, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6616C433E0 for ; Sun, 17 Jan 2021 23:44:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 70943206ED for ; Sun, 17 Jan 2021 23:44:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730408AbhAQXo3 (ORCPT ); Sun, 17 Jan 2021 18:44:29 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:52879 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730243AbhAQXoW (ORCPT ); Sun, 17 Jan 2021 18:44:22 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id D4B6F5C0105; Sun, 17 Jan 2021 18:43:35 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sun, 17 Jan 2021 18:43:35 -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=fm3; bh=b4mHUeOWPcqjn 2WqMnHXiZEBOckEPH0BrsMpO0y3Ab4=; b=oiVpP549gZWdl3ZdhwziXBBCI4AVb JUQ71rQ2WFq+D3RVQI/fhRg9NWW0LxKGDEbl8qkPRYYv5gbOBdxr0GixZfuWrUlx QYc8stzJZMDwlOQEj4s8fY1oaE1+s2UDP/H4/LwL8ERzncNuKuodN66ZE7a/WISZ 4zWBPddsjQQSBhtGh5seR6HKCUphW5Lwz2fneff4xU9jCmw8b+O4kORg5myR9hKV 1rO/quCfeTwgQnM3UREDMjPZIe4yheYXYUR9WL9tzfStYW9yL7Kh452SczzVzAmF jUYdq53+xzMzhUtg85wqgRex/FNv2TbSP5l5u4TOxfKsrmghp5XDHHQjQ== 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=b4mHUeOWPcqjn2WqMnHXiZEBOckEPH0BrsMpO0y3Ab4=; b=nFaEM5iz n8hOOSDXqmgprCSv/IAGzhUF27ONUoTHhc+l8sfw0kpTD9xbK7c0QA1jkvHa8q+c fV7v6sUofXpc85p8UyY/hsEbZyAzLdg3cStoSqIpWinpKTFdOTO57Wv1fvCbm7a3 ZTJoI+tTufTjMSMi/+HHj/dY8+2HYYyMHv0PMD0FrpVA5RRZHP4t9/NKTtRNxS62 VbE6x0zz6m5aqS4tir8U0fJU/DSrrWU9EkRrJgscSxQtiEBBTqnitNltFZn0eDmW rxwpdSm9qDkcalYNQ6tNkREGrc/Cqmqvt2oNtlNrE7rxc5wjAno5smRtyxHC8lI/ ikY3tH/yG0rQyg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrtdejgdduvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeetlhhishhtrghirhcuhfhrrghntghishcuoegrlhhishhtrghi rhesrghlihhsthgrihhrvdefrdhmvgeqnecuggftrfgrthhtvghrnhepheffjeetteetke ffhfdvgefhgeevvddvueejheehfeevfedufeegiedtheeujeelnecuffhomhgrihhnpehr vghmrghrkhgrsghlvgdrtghomhenucfkphepjeefrdelfedrkeegrddvtdeknecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlihhsthgrihhr segrlhhishhtrghirhdvfedrmhgv X-ME-Proxy: Received: from ThinkpadX1Yoga3.localdomain (c-73-93-84-208.hsd1.ca.comcast.net [73.93.84.208]) by mail.messagingengine.com (Postfix) with ESMTPA id AF2BC24005C; Sun, 17 Jan 2021 18:43:34 -0500 (EST) From: Alistair Francis To: lee.jones@linaro.org, robh+dt@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, linux-imx@nxp.com, kernel@pengutronix.de Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alistair23@gmail.com, Alistair Francis Subject: [PATCH 2/6] mfd: Initial commit of sy7636a Date: Sat, 16 Jan 2021 20:25:35 -0800 Message-Id: <20210117042539.1609-2-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210117042539.1609-1-alistair@alistair23.me> References: <20210117042539.1609-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Initial support for the Silergy SY7636A Power Management chip driver. Signed-off-by: Alistair Francis --- drivers/mfd/Kconfig | 10 ++ drivers/mfd/Makefile | 2 + drivers/mfd/sy7636a.c | 252 ++++++++++++++++++++++++++++++++++++ include/linux/mfd/sy7636a.h | 50 +++++++ 4 files changed, 314 insertions(+) create mode 100644 drivers/mfd/sy7636a.c create mode 100644 include/linux/mfd/sy7636a.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index bdfce7b15621..c8c62d92433c 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -1360,6 +1360,16 @@ config MFD_SYSCON Select this option to enable accessing system control registers via regmap. +config MFD_SY7636A + tristate "Silergy SY7636A Power Management chip driver" + select MFD_CORE + select REGMAP_I2C + select REGMAP_IRQ + depends on I2C=y + help + Select this option to enable support for the Silergy SY7636A + Power Management chip driver. + config MFD_DAVINCI_VOICECODEC tristate select MFD_CORE diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 14fdb188af02..1fa1e635f506 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -265,6 +265,8 @@ obj-$(CONFIG_MFD_ROHM_BD718XX) += rohm-bd718x7.o obj-$(CONFIG_MFD_STMFX) += stmfx.o obj-$(CONFIG_MFD_KHADAS_MCU) += khadas-mcu.o +obj-$(CONFIG_MFD_SY7636A) += sy7636a.o + obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.o obj-$(CONFIG_MFD_SIMPLE_MFD_I2C) += simple-mfd-i2c.o obj-$(CONFIG_MFD_INTEL_M10_BMC) += intel-m10-bmc.o diff --git a/drivers/mfd/sy7636a.c b/drivers/mfd/sy7636a.c new file mode 100644 index 000000000000..39aac965d854 --- /dev/null +++ b/drivers/mfd/sy7636a.c @@ -0,0 +1,252 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * MFD driver for SY7636A chip + * + * Copyright (C) 2019 reMarkable AS - http://www.remarkable.com/ + * + * Author: Lars Ivar Miljeteig + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Based on the lp87565 driver by Keerthy + */ + +#include +#include +#include +#include +#include +#include + +#include + +static const struct regmap_config sy7636a_regmap_config = { + .reg_bits = 8, + .val_bits = 8, +}; + +static const struct mfd_cell sy7636a_cells[] = { + { .name = "sy7636a-regulator", }, + { .name = "sy7636a-temperature", }, + { .name = "sy7636a-thermal", }, +}; + +static const struct of_device_id of_sy7636a_match_table[] = { + { .compatible = "silergy,sy7636a", }, + {} +}; +MODULE_DEVICE_TABLE(of, of_sy7636a_match_table); + +static const char * const states[] = { + "no fault event", + "UVP at VP rail", + "UVP at VN rail", + "UVP at VPOS rail", + "UVP at VNEG rail", + "UVP at VDDH rail", + "UVP at VEE rail", + "SCP at VP rail", + "SCP at VN rail", + "SCP at VPOS rail", + "SCP at VNEG rail", + "SCP at VDDH rail", + "SCP at VEE rail", + "SCP at V COM rail", + "UVLO", + "Thermal shutdown", +}; + +int get_vcom_voltage_mv(struct regmap *regmap) +{ + int ret; + unsigned int val, val_h; + + ret = regmap_read(regmap, SY7636A_REG_VCOM_ADJUST_CTRL_L, &val); + if (ret) + return ret; + + ret = regmap_read(regmap, SY7636A_REG_VCOM_ADJUST_CTRL_H, &val_h); + if (ret) + return ret; + + val |= (val_h << 8); + + return (val & 0x1FF) * 10; +} + +int set_vcom_voltage_mv(struct regmap *regmap, unsigned int vcom) +{ + int ret; + unsigned int val; + + if (vcom < 0 || vcom > 5000) + return -EINVAL; + + val = (unsigned int)(vcom / 10) & 0x1ff; + + ret = regmap_write(regmap, SY7636A_REG_VCOM_ADJUST_CTRL_L, val); + if (ret) + return ret; + + ret = regmap_write(regmap, SY7636A_REG_VCOM_ADJUST_CTRL_H, val >> 8); + if (ret) + return ret; + + return 0; +} + +static ssize_t state_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + int ret; + unsigned int val; + struct sy7636a *sy7636a = dev_get_drvdata(dev); + + ret = regmap_read(sy7636a->regmap, SY7636A_REG_FAULT_FLAG, &val); + if (ret) { + dev_err(sy7636a->dev, "Failed to read from device\n"); + return ret; + } + + val = val >> 1; + + if (val >= ARRAY_SIZE(states)) { + dev_err(sy7636a->dev, "Unexpected value read from device: %u\n", val); + return -EINVAL; + } + + return snprintf(buf, PAGE_SIZE, "%s\n", states[val]); +} +static DEVICE_ATTR(state, 0444, state_show, NULL); + +static ssize_t power_good_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + int ret; + unsigned int val; + struct sy7636a *sy7636a = dev_get_drvdata(dev); + + ret = regmap_read(sy7636a->regmap, SY7636A_REG_FAULT_FLAG, &val); + if (ret) { + dev_err(sy7636a->dev, "Failed to read from device\n"); + return ret; + } + + val &= 0x01; + + return snprintf(buf, PAGE_SIZE, "%s\n", val ? "ON" : "OFF"); +} +static DEVICE_ATTR(power_good, 0444, power_good_show, NULL); + +static ssize_t vcom_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + int ret; + struct sy7636a *sy7636a = dev_get_drvdata(dev); + + ret = get_vcom_voltage_mv(sy7636a->regmap); + if (ret < 0) + return ret; + + return snprintf(buf, PAGE_SIZE, "%d\n", -ret); +} + +static ssize_t vcom_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) +{ + int ret; + int vcom; + struct sy7636a *sy7636a = dev_get_drvdata(dev); + + ret = kstrtoint(buf, 0, &vcom); + if (ret) + return ret; + + if (vcom > 0 || vcom < -5000) + return -EINVAL; + + ret = set_vcom_voltage_mv(sy7636a->regmap, (unsigned int)(-vcom)); + if (ret) + return ret; + + return count; +} +static DEVICE_ATTR(vcom, 0644, vcom_show, vcom_store); + +static struct attribute *sy7636a_sysfs_attrs[] = { + &dev_attr_state.attr, + &dev_attr_power_good.attr, + &dev_attr_vcom.attr, + NULL, +}; + +static const struct attribute_group sy7636a_sysfs_attr_group = { + .attrs = sy7636a_sysfs_attrs, +}; + +static int sy7636a_probe(struct i2c_client *client, + const struct i2c_device_id *ids) +{ + struct sy7636a *sy7636a; + int ret; + + sy7636a = devm_kzalloc(&client->dev, sizeof(struct sy7636a), GFP_KERNEL); + if (sy7636a == NULL) + return -ENOMEM; + + sy7636a->dev = &client->dev; + + sy7636a->regmap = devm_regmap_init_i2c(client, &sy7636a_regmap_config); + if (IS_ERR(sy7636a->regmap)) { + ret = PTR_ERR(sy7636a->regmap); + dev_err(sy7636a->dev, + "Failed to initialize register map: %d\n", ret); + return ret; + } + + i2c_set_clientdata(client, sy7636a); + + ret = sysfs_create_group(&client->dev.kobj, &sy7636a_sysfs_attr_group); + if (ret) { + dev_err(sy7636a->dev, "Failed to create sysfs attributes\n"); + return ret; + } + + ret = devm_mfd_add_devices(sy7636a->dev, PLATFORM_DEVID_AUTO, + sy7636a_cells, ARRAY_SIZE(sy7636a_cells), + NULL, 0, NULL); + if (ret) { + dev_err(sy7636a->dev, "Failed to add mfd devices\n"); + sysfs_remove_group(&client->dev.kobj, &sy7636a_sysfs_attr_group); + return ret; + } + + return 0; +} + +static const struct i2c_device_id sy7636a_id_table[] = { + { "sy7636a", 0 }, + { }, +}; +MODULE_DEVICE_TABLE(i2c, sy7636a_id_table); + +static struct i2c_driver sy7636a_driver = { + .driver = { + .name = "sy7636a", + .of_match_table = of_sy7636a_match_table, + }, + .probe = sy7636a_probe, + .id_table = sy7636a_id_table, +}; +module_i2c_driver(sy7636a_driver); + +MODULE_AUTHOR("Lars Ivar Miljeteig "); +MODULE_DESCRIPTION("Silergy SY7636A Multi-Function Device Driver"); +MODULE_LICENSE("GPL v2"); diff --git a/include/linux/mfd/sy7636a.h b/include/linux/mfd/sy7636a.h new file mode 100644 index 000000000000..642789c4d0a9 --- /dev/null +++ b/include/linux/mfd/sy7636a.h @@ -0,0 +1,50 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Functions to access SY3686A power management chip. + * + * Copyright (C) 2019 reMarkable AS - http://www.remarkable.com/ + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __LINUX_MFD_SY7636A_H +#define __LINUX_MFD_SY7636A_H + +#include +#include +#include +#include + +#define SY7636A_REG_OPERATION_MODE_CRL 0x00 +#define SY7636A_OPERATION_MODE_CRL_VCOMCTL (1 << 6) +#define SY7636A_OPERATION_MODE_CRL_ONOFF (1 << 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 (1 << 0) +#define SY7636A_REG_TERMISTOR_READOUT 0x08 + +#define SY7636A_REG_MAX 0x08 + +struct sy7636a { + struct device *dev; + struct regmap *regmap; + unsigned int vcom; + struct gpio_desc *pgood_gpio; + struct mutex reglock; +}; + +int get_vcom_voltage_mv(struct regmap *regmap); +int set_vcom_voltage_mv(struct regmap *regmap, unsigned int vcom); + +#endif /* __LINUX_MFD_SY7636A_H */ From patchwork Sun Jan 17 04:25:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair X-Patchwork-Id: 365268 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.7 required=3.0 tests=BAYES_00, DATE_IN_PAST_12_24, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 839DEC433E0 for ; Sun, 17 Jan 2021 23:48:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C3AC206ED for ; Sun, 17 Jan 2021 23:48:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729202AbhAQXsZ (ORCPT ); Sun, 17 Jan 2021 18:48:25 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:56809 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730805AbhAQXoq (ORCPT ); Sun, 17 Jan 2021 18:44:46 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 652195C012A; Sun, 17 Jan 2021 18:43:40 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sun, 17 Jan 2021 18:43:40 -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=fm3; bh=SLYKavH+p5IE7 x0cqUgyM7oHmCtlpp1rjjA40keoC/w=; b=NiytnX/sPp3TQShyzRgrobONVwtTu 0MEz+8o5opYMhvsbgBeRIO56buwuuVICkPS/dJO8t+whelmn3++D2t1JKxcINSdH B4Y/ZWD0d/wME+vURyYPcDjUlSpOygaQU6i/EwBbnjoYyC+Iqu9LTDgVxVyu5c/g HJWzKL5vKB/Vc1Ul9auY1JYjI0h9vaXdw6Mjd/yB3evkmdgEFXhKX9TPeic/ryWm XO+uN768mlSEyDsf8k8gXRi6b2BrotITsv1O9jVTviEIq/RoGd2+rIvW2MCdmDtO S4XMQzl+c1/yKN4R4/R9+jJ7qS1c6aMXNvhBU8V9jc2SZBwq09Yd6w/SA== 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=SLYKavH+p5IE7x0cqUgyM7oHmCtlpp1rjjA40keoC/w=; b=c6EH0w05 RSNV4Nu/vH3aj4mS3MkzsJOQzJiqfo3Ctr8sOjpok5qOEaqaiyr+fpNtoSJhe7a1 7Q8u6yXjtPIE5KKSvlcEnyIkLsAaGRoNkAe8y/p1YBTw5hmAIRTZnioFJdthJhBP ih11IH4ElDWI6RFfVbtHd+nJo38xQ+ZmtoolkLVFY3dNU3d/b2gt2EwgvXQpDgqu i4Uxnpcbggp2T5mCb2/33kp6UZvr3WpcVRo2b61L62AWvRgzNjy0pA3i6qmU4dTk +o92GZ6G8MGjBI9NzWU4y/5X48ZxlT9QbdJOG1CjVSFTBMdlzx8htQu59u8qTkOR jwvjexo4bnWqCQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrtdejgdduvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeetlhhishhtrghirhcuhfhrrghntghishcuoegrlhhishhtrghi rhesrghlihhsthgrihhrvdefrdhmvgeqnecuggftrfgrthhtvghrnhepgeegtdetjeekge eguefgheeuvedugedvteejveeiudegvddtkeffkeehtdetudfhnecukfhppeejfedrleef rdekgedrvddtkeenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfh hrohhmpegrlhhishhtrghirhesrghlihhsthgrihhrvdefrdhmvg X-ME-Proxy: Received: from ThinkpadX1Yoga3.localdomain (c-73-93-84-208.hsd1.ca.comcast.net [73.93.84.208]) by mail.messagingengine.com (Postfix) with ESMTPA id 4C321240057; Sun, 17 Jan 2021 18:43:39 -0500 (EST) From: Alistair Francis To: lee.jones@linaro.org, robh+dt@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, linux-imx@nxp.com, kernel@pengutronix.de Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alistair23@gmail.com, Alistair Francis Subject: [PATCH 5/6] arch/arm: reMarkable2: Enable silergy,sy7636a Date: Sat, 16 Jan 2021 20:25:38 -0800 Message-Id: <20210117042539.1609-5-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210117042539.1609-1-alistair@alistair23.me> References: <20210117042539.1609-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@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 | 61 +++++++++++++++++++++++++ arch/arm/configs/remarkable2_defconfig | 2 + 2 files changed, 63 insertions(+) diff --git a/arch/arm/boot/dts/imx7d-remarkable2.dts b/arch/arm/boot/dts/imx7d-remarkable2.dts index 8052d884a5e5..f419ab704f06 100644 --- a/arch/arm/boot/dts/imx7d-remarkable2.dts +++ b/arch/arm/boot/dts/imx7d-remarkable2.dts @@ -58,6 +58,27 @@ memory { 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_vref_1v8: regulator-vref-1v8 { compatible = "regulator-fixed"; regulator-name = "vref-1v8"; @@ -174,6 +195,32 @@ digitizer: wacom-i2c@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>; + #thermal-sensor-cells = <0>; + + epd-pwr-good-gpios = <&gpio6 21 GPIO_ACTIVE_HIGH>; + regulators { + compatible = "silergy,sy7636a-regulator"; + reg_epdpmic: vcom { + regulator-name = "vcom"; + regulator-boot-on; + }; + }; + }; +}; + &sdma { status = "okay"; }; @@ -277,6 +324,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 @@ -389,6 +443,13 @@ MX7D_PAD_SD1_WP__CCM_CLKO2 0x00000014 >; }; + pinctrl_epdpmic: epdpmicgrp { + fsl,pins = < + MX7D_PAD_SAI2_RX_DATA__GPIO6_IO21 0x00000074 + MX7D_PAD_ENET1_RGMII_TXC__GPIO7_IO11 0x00000014 + >; + }; + pinctrl_wdog: wdoggrp { fsl,pins = < MX7D_PAD_ENET1_COL__WDOG1_WDOG_ANY 0x74 diff --git a/arch/arm/configs/remarkable2_defconfig b/arch/arm/configs/remarkable2_defconfig index 8c9785555cda..6306568772c3 100644 --- a/arch/arm/configs/remarkable2_defconfig +++ b/arch/arm/configs/remarkable2_defconfig @@ -193,6 +193,7 @@ CONFIG_MFD_MC13XXX_SPI=y CONFIG_MFD_MC13XXX_I2C=y CONFIG_MFD_SI476X_CORE=y CONFIG_MFD_STMPE=y +CONFIG_MFD_SY7636A=y CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_REGULATOR_ANATOP=y @@ -201,6 +202,7 @@ CONFIG_REGULATOR_GPIO=y CONFIG_REGULATOR_MC13783=y CONFIG_REGULATOR_MC13892=y CONFIG_REGULATOR_PFUZE100=y +CONFIG_REGULATOR_SY7636A=y CONFIG_MEDIA_SUPPORT=y CONFIG_MEDIA_USB_SUPPORT=y CONFIG_USB_VIDEO_CLASS=m From patchwork Sun Jan 17 04:25:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair X-Patchwork-Id: 365269 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.7 required=3.0 tests=BAYES_00, DATE_IN_PAST_12_24, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 826B6C433DB for ; Sun, 17 Jan 2021 23:45:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D6E5216FD for ; Sun, 17 Jan 2021 23:45:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730840AbhAQXpW (ORCPT ); Sun, 17 Jan 2021 18:45:22 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:57983 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730826AbhAQXpJ (ORCPT ); Sun, 17 Jan 2021 18:45:09 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 8ECBF5C012E; Sun, 17 Jan 2021 18:43:41 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sun, 17 Jan 2021 18:43:41 -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=fm3; bh=7CZQ3Ynd/Nxtd ggtzJL3Hu3UvMx+xdFKbu8d3vDBITo=; b=ekuIq/Yt0j3Dbom/OQoNBDm/uYetY H7MF6T7Ok8z8p9l45bgxYfA7D5/tzlgHDhlUhKN35Isl9z5EpRvVmTQ4Tyu8EB1H 6Cc9sWM9c8TjEyTq8Fu03JkFbHxKIfpazCGMlXDP90nUHSHknPd8plMiiyufDFd8 EJqouGpEbQtUaBXEXhA0Ncaqv3NeUDWuHqQU7uKpYe3ttzxcSYccqaxTP7EsWo4B x2972SCN6xLqr/qtwbqOe8lS1UpK27xmAnoz0iNMeuEoTMerN8Xuq4wlKWZN/Rc8 h/To0LfveQULOYIAVjjY495trCvgBMCfiGxEDUmunT5bYR9A0gey+CPEQ== 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=7CZQ3Ynd/NxtdggtzJL3Hu3UvMx+xdFKbu8d3vDBITo=; b=eAAL11lY Leghmzotywkt8j/CMQGuNAOi+8f//fLo83x9oW4KhN/0II2NKjunAwrTrquPRanE p42bFXDRMjcPRRG/pN6NrxV8LeYGw24EQGtQVyW+b1kESwtDHrU6XwYPU77Hru3e +wNOkkYgu7jzyMfAkpWTTWkA5eT9klRjlOjTVHcnzQxtQ1+yCfL5M9fkQAQ15viF aTOXHmQ603jl9iAvYDKbtuunFDfHjew1WBpipUdRY+TITV7jdfcPPKq1X+Ff5R2C tKY0YCZo3myhEW5vklpSmRIxXfOzDRyjHjgakFqTNwJTgvlwJwDGQqygS/j7bbtQ 079nUoQRDFuOkg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrtdejgdduvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeetlhhishhtrghirhcuhfhrrghntghishcuoegrlhhishhtrghi rhesrghlihhsthgrihhrvdefrdhmvgeqnecuggftrfgrthhtvghrnhepgeegtdetjeekge eguefgheeuvedugedvteejveeiudegvddtkeffkeehtdetudfhnecukfhppeejfedrleef rdekgedrvddtkeenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfh hrohhmpegrlhhishhtrghirhesrghlihhsthgrihhrvdefrdhmvg X-ME-Proxy: Received: from ThinkpadX1Yoga3.localdomain (c-73-93-84-208.hsd1.ca.comcast.net [73.93.84.208]) by mail.messagingengine.com (Postfix) with ESMTPA id 75DDE240057; Sun, 17 Jan 2021 18:43:40 -0500 (EST) From: Alistair Francis To: lee.jones@linaro.org, robh+dt@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, linux-imx@nxp.com, kernel@pengutronix.de Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, alistair23@gmail.com, Alistair Francis Subject: [PATCH 6/6] arch/arm: reMarkable2: Enable lcdif Date: Sat, 16 Jan 2021 20:25:39 -0800 Message-Id: <20210117042539.1609-6-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210117042539.1609-1-alistair@alistair23.me> References: <20210117042539.1609-1-alistair@alistair23.me> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Connect the dispaly on the reMarkable2. Signed-off-by: Alistair Francis --- arch/arm/boot/dts/imx7d-remarkable2.dts | 70 +++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/arch/arm/boot/dts/imx7d-remarkable2.dts b/arch/arm/boot/dts/imx7d-remarkable2.dts index f419ab704f06..d4e93f7ca7ea 100644 --- a/arch/arm/boot/dts/imx7d-remarkable2.dts +++ b/arch/arm/boot/dts/imx7d-remarkable2.dts @@ -221,6 +221,42 @@ reg_epdpmic: vcom { }; }; +&lcdif { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&pinctrl_lcdif>; + pinctrl-1 = <&pinctrl_lcdif>; + lcd-supply = <®_epdpmic>; + lcd2-supply = <®_sdoe>; + display = <&display0>; + prevent-frying-pan; + status = "okay"; + + display0: display { + bits-per-pixel = <24>; + bus-width = <24>; + + display-timings { + native-mode = <&timing0>; + + timing0: timing0 { + clock-frequency = <40000000>; + hactive = <334>; + vactive = <1405>; + hfront-porch = <1>; + hback-porch = <1>; + hsync-len = <1>; + vback-porch = <1>; + vfront-porch = <1>; + vsync-len = <1>; + hsync-active = <0>; + vsync-active = <0>; + de-active = <1>; + pixelclk-active = <1>; + }; + }; + }; +}; + &sdma { status = "okay"; }; @@ -331,6 +367,40 @@ MX7D_PAD_I2C4_SCL__I2C4_SCL 0x4000007f >; }; + pinctrl_lcdif: lcdifgrp { + fsl,pins = < + MX7D_PAD_LCD_DATA00__LCD_DATA0 0x79 + MX7D_PAD_LCD_DATA01__LCD_DATA1 0x79 + MX7D_PAD_LCD_DATA02__LCD_DATA2 0x79 + MX7D_PAD_LCD_DATA03__LCD_DATA3 0x79 + MX7D_PAD_LCD_DATA04__LCD_DATA4 0x79 + MX7D_PAD_LCD_DATA05__LCD_DATA5 0x79 + MX7D_PAD_LCD_DATA06__LCD_DATA6 0x79 + MX7D_PAD_LCD_DATA07__LCD_DATA7 0x79 + MX7D_PAD_LCD_DATA08__LCD_DATA8 0x79 + MX7D_PAD_LCD_DATA09__LCD_DATA9 0x79 + MX7D_PAD_LCD_DATA10__LCD_DATA10 0x79 + MX7D_PAD_LCD_DATA11__LCD_DATA11 0x79 + MX7D_PAD_LCD_DATA12__LCD_DATA12 0x79 + MX7D_PAD_LCD_DATA13__LCD_DATA13 0x79 + MX7D_PAD_LCD_DATA14__LCD_DATA14 0x79 + MX7D_PAD_LCD_DATA15__LCD_DATA15 0x79 + + MX7D_PAD_LCD_DATA17__LCD_DATA17 0x79 + MX7D_PAD_LCD_DATA18__LCD_DATA18 0x79 + MX7D_PAD_LCD_DATA19__LCD_DATA19 0x79 + MX7D_PAD_LCD_DATA20__LCD_DATA20 0x79 + MX7D_PAD_LCD_DATA21__LCD_DATA21 0x79 + + MX7D_PAD_LCD_DATA23__LCD_DATA23 0x79 + MX7D_PAD_LCD_CLK__LCD_CLK 0x79 + MX7D_PAD_LCD_ENABLE__LCD_ENABLE 0x79 + MX7D_PAD_LCD_VSYNC__LCD_VSYNC 0x79 + MX7D_PAD_LCD_HSYNC__LCD_HSYNC 0x79 + MX7D_PAD_LCD_RESET__LCD_RESET 0x79 + >; + }; + pinctrl_uart1: uart1grp { fsl,pins = < MX7D_PAD_UART1_TX_DATA__UART1_DCE_TX 0x79