Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7038010imu; Thu, 31 Jan 2019 04:02:27 -0800 (PST) X-Google-Smtp-Source: ALg8bN7LvGbDyIGQdqrYyml63YUt8ItSiwNbREebTTcktFE2808BqMIfAr/A0oIGuFesBtRByuNa X-Received: by 2002:a17:902:4:: with SMTP id 4mr34710967pla.20.1548936147130; Thu, 31 Jan 2019 04:02:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548936147; cv=none; d=google.com; s=arc-20160816; b=jU3oVZpvCZDZog88kzkN/Ac9lrfJCjcm1ge3X5sh0Y9OC8STB9+rj2zGYRQoCDtUb/ 9QJyyFihweD9BuhdqkvOVfo9uAkYamWaK//rNDSs2DC1D/y/AqzQ9By4Jq/vMHphY/5u kX4avUYAJUvBRr7SPstVehAiDR1DpdkrVSrKDXyK0SXx9GXMtlnTJWcslBR07bsx1vuV haQy9T10JjpHeY+RxyPhgFFiLXVmpTgrJTMOpnN0p82O83ib8BAZG+1aJUVrIt30J/DL 2ECN+V74Oi8brE/S4dnVzN72R3RjtpcQd4SQNb4auJyoAhSifjeG36v9cPIqSWXpkWED +OCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=aktuEXmFpPt3GpRO2hx65cug47tIjguGhEFTyNmPzyY=; b=IXapVsQR22UYpIMTXhI4pnwahduknE2ua9hk3/vcMkz/RfQ7sgahbEXLV5WGO+9w4i Ggm2Sn+qHMzb5JMBXtDunpufLGivojKZITYTswQ5csihw5iHqcBDiEjS+j4sLJExzz+S TLTsRe62I7EuKsOClnRtx/An7jAPCRrsQTQ4bphPYM8F6ZBT6k/MAIGfEY5BR5s31DGE aeGsF758/Pgxc40ku5x8bhbZCNew5z6yH6xsTUM+uspw2cAHnw5xXAX7SN5sBXOACAw4 PoE1ZaQ/c86Qpvqwbd2Sydq4477ZrY46SnD/p5QYA/syYCjCozlUkFF5z9SegdspiHza nqqQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y1si4182667plt.356.2019.01.31.04.02.11; Thu, 31 Jan 2019 04:02:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732480AbfAaMCE (ORCPT + 99 others); Thu, 31 Jan 2019 07:02:04 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:39968 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726153AbfAaMCC (ORCPT ); Thu, 31 Jan 2019 07:02:02 -0500 Received: by mail-lj1-f194.google.com with SMTP id n18-v6so2426455lji.7; Thu, 31 Jan 2019 04:01:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=aktuEXmFpPt3GpRO2hx65cug47tIjguGhEFTyNmPzyY=; b=AMAZtDUQwncdSDthjyZ+ydzRpBNk0UFAdnV5Ki7r23JgR8zTgHN67emJVAhGkW5TXS DrGyPz5z9vGQaLuRPViigaKZDByqHIA778aKIjU7lNOXVqlNJkRq5lXEWSax0DH4WZpi jCKY/uJ3k5QVtzhX5DAFg7yRe68eL3R14CgNWW6t7adVt6GV6Oy++K3wBbFaKDSwTwbY jPk3DDp7i2H0adD8dpIiLqIt0IIX8URedOkIDG5xLwY0bmmXSRlYjhr0cJ+1DQcSRT6g /18Pu77q69UQH/s452QWqspR6uuG52vWCfyN0ODtdT531hb4NyYZOrf3tb+1HRrK88W/ UdzQ== X-Gm-Message-State: AJcUukc3KerdmfflbUXQryt8yoqxZ07t+3RL5VE0evpVGEtmg5ker5vs fDoAplq5OJ6Swo5WpSzM8Yg= X-Received: by 2002:a2e:2f15:: with SMTP id v21-v6mr27380030ljv.56.1548936118183; Thu, 31 Jan 2019 04:01:58 -0800 (PST) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id q128-v6sm748661ljq.14.2019.01.31.04.01.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 Jan 2019 04:01:57 -0800 (PST) Date: Thu, 31 Jan 2019 14:01:44 +0200 From: Matti Vaittinen To: mazziesaccount@gmail.com, matti.vaittinen@fi.rohmeurope.com Cc: heikki.haikola@fi.rohmeurope.com, mikko.mutanen@fi.rohmeurope.com, lee.jones@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, broonie@kernel.org, gregkh@linuxfoundation.org, rafael@kernel.org, mturquette@baylibre.com, sboyd@kernel.org, linus.walleij@linaro.org, bgolaszewski@baylibre.com, sre@kernel.org, lgirdwood@gmail.com, a.zummo@towertech.it, alexandre.belloni@bootlin.com, wim@linux-watchdog.org, linux@roeck-us.net, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-pm@vger.kernel.org, linux-rtc@vger.kernel.org, linux-watchdog@vger.kernel.org Subject: [RFC PATCH v4 00/10] support ROHM BD70528 PMIC Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Patch series introducing support for ROHM BD70528 PMIC Please note that patch 1 breaks compilation without patches 2 and 3 ROHM BD70528 is a programmable Power Management IC for battery powered 'ultra low power' systems like the pre-announced NXP i.MX7 ULP. This patch series introduces support for the PMIC. I send this a RFC now as I would like to receive comments from Lee, Mark and Stephen regarding splitting the existing include/linux/mfd/bd718x7.h into ROHM generic and chip specific portions. Benefit is that for example the clk sub-driver does not need to be aware of chip specific structure(s) (struct bd718x7 and struct bd70528) as it only needs to derefernce the generic struct rohm_regmap_dev. Thus same clk subdriver can support both the bd718x7 and bd70528 as long as MFD driver data has this generic structure in the beginning of allocated data. But knowing the bd718x7 driver is already in upstream, it might be good if this change went through single tree, right? RTC block of the bd70528 can support 'wake' irq which wakes PMIC from standby state. Wake irq's can be armed to wake up system up to 24 hours from arming. bd70528 can also generate alarm interrupts which can be armed to occur years after triggering. The RTC driver does always arm both the waker and alarm irqs and does not utilize longer period of alarm interrupts. All the RTC timers are limited to occur within the next 24 hours. Any suggestions on more elegant timer support are welcome =) GPIO portion of bd70528 driver adds I/O support for driving GPIO pins or reading the state. The interrupt functionality is provided by regmap-irq. Current GPIO driver is not aware of whether the pin(s) are used for I/O or interrupts and it is up-to driver user to ensure there is no misconfiguration or "double use". Currently only MFD core, clk, RTC, regulator and GPIO portions are somehow tested. The RFC series also include initial power-supply and watchdog patches in order to provide better overview on chip and to collect initial feedback. Reset and ADC are not supported by this series. Changelog v4: patches 1,2,3,4,5,10 are unchanged from v3 DT-binding fixes suggested by Rob Herring: - drop interrupt-parent - drop clock-frequency - change pmic node name to a generic one RTC: - enable RTC block's irqs before registering rtc GPIO fixes after initial testing: - fix getting GPIO value when direction is output POWER: - Add ASCII art intended to clarify the charger HW state machine Changelog v3: patches 1,2,3,4,5,6,7,8 and 10 are unchanged from v2 RTC fixups suggested by Guenter Roeck: - create bd70528_set_time_locked function in order to simplify error handling and to make mutex lock/unlock path more obvious - don't ignore errors on bd70528_set_time_locked - simplify bd70528_read_alarm enabled condition setting - add __packed to structs where members are mapped to HW registers - remove unnecessary brackets from enable condition in set_wake RTC: fixups suggested by Alessandro Belloni - don't use deprecated devm_rtc_device_register - add alarm_irq_enable callback - add range_min and range_max WDT: - add regmap and mutex pointers to WDT data so that they can be accessed without dereferencing the parent data - remove parent data pointer from WDT data - embed struct watchdog_device into WDT data in order to avoid double allocation. GPIO: - remove unused header as pointed by Linus Walleij POWER: - do not copy the whole MFD data (especially the mutex to avoid all possibilities of accidentally using the copy of a mutex) Changelog v2: Mainly feedback from Guenter Roeck: - patches 1, 2, 3, 4, 5, 9 are unchanged. - mfd: own mutex for each bd70528 instance - embed in struct bd70528 - watchdog: do not copy parent device data - watchdog: fix deadlock caused by double locked mutex - watchdog: set initial timeouts and WDT parent information - watchdog: remove unnecessary ping function from ops - watchdog: and the comment regarding it - watchdog: allocate watchdog struct in order to allow multiple WDG instances - rtc: bd70528 fix the order of mutex unlock and re-enabling RTC based timers - rtc: fix the irq mask register address - power: fix the irq mask register address - regulator/regmap-irq: Drop the patches 1, 8 and 9 from original series as those were already applied by Mark Patch 1: split the bd718x7.h to generic and chip specific portions. (breaks compilation without patch 2 and 3) Patch 2: adapt bd718x7.h changes to bd718x7 regulator driver Patch 3: adapt bd718x7.h changes to bd718x7 clk driver Patch 4: add MFD core support for bd70528 Patch 5: support bd70528 clk using bd718x7 clk driver Patch 6: document DT bindings for BD70528 Patch 7: support BD70528 GPIO block Patch 8: support BD70528 RTC Patch 9: support BD70528 battery charger Patch 10: support BD70528 watchdog This patch series is based on Mark's regulator/for-next branch --- Matti Vaittinen (10): mfd: bd718x7.h split to ROHM common and bd718x7 specific parts regulator: bd718x7 use chip specific and generic data structs clk: bd718x7: use chip specific and generic data structs mfd: bd70528: Support ROHM bd70528 PMIC - core clk: bd718x7: Support ROHM BD70528 clk block devicetree: bindings: Document first ROHM BD70528 bindings gpio: Initial support for ROHM bd70528 GPIO block rtc: bd70528: Initial support for ROHM bd70528 RTC power: supply: Initial support for ROHM BD70528 PMIC charger block watchdog: bd70528: Initial support for ROHM BD70528 watchdog block .../devicetree/bindings/mfd/rohm,bd70528-pmic.txt | 102 +++ drivers/clk/Kconfig | 6 +- drivers/clk/clk-bd718x7.c | 25 +- drivers/gpio/Kconfig | 11 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-bd70528.c | 228 +++++++ drivers/mfd/Kconfig | 17 + drivers/mfd/Makefile | 1 + drivers/mfd/rohm-bd70528.c | 410 ++++++++++++ drivers/mfd/rohm-bd718x7.c | 23 +- drivers/power/supply/Kconfig | 9 + drivers/power/supply/Makefile | 1 + drivers/power/supply/bd70528-charger.c | 738 +++++++++++++++++++++ drivers/regulator/bd718x7-regulator.c | 22 +- drivers/rtc/Kconfig | 8 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-bd70528.c | 500 ++++++++++++++ drivers/watchdog/Kconfig | 12 + drivers/watchdog/Makefile | 1 + drivers/watchdog/bd70528_wdt.c | 187 ++++++ include/linux/mfd/rohm-bd70528.h | 392 +++++++++++ include/linux/mfd/rohm-bd718x7.h | 22 +- include/linux/mfd/rohm-generic.h | 20 + 23 files changed, 2692 insertions(+), 45 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/rohm,bd70528-pmic.txt create mode 100644 drivers/gpio/gpio-bd70528.c create mode 100644 drivers/mfd/rohm-bd70528.c create mode 100644 drivers/power/supply/bd70528-charger.c create mode 100644 drivers/rtc/rtc-bd70528.c create mode 100644 drivers/watchdog/bd70528_wdt.c create mode 100644 include/linux/mfd/rohm-bd70528.h create mode 100644 include/linux/mfd/rohm-generic.h -- 2.14.3 -- Matti Vaittinen, Linux device drivers ROHM Semiconductors, Finland SWDC Kiviharjunlenkki 1E 90220 OULU FINLAND ~~~ "I don't think so," said Rene Descartes. Just then, he vanished ~~~