Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1213098/?format=api
{ "id": 1213098, "url": "http://patchwork.ozlabs.org/api/patches/1213098/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/patch/3fc6a40bbf2ef327273e8100a7ea70190272ed85.1576745635.git.matti.vaittinen@fi.rohmeurope.com/", "project": { "id": 42, "url": "http://patchwork.ozlabs.org/api/projects/42/?format=api", "name": "Linux GPIO development", "link_name": "linux-gpio", "list_id": "linux-gpio.vger.kernel.org", "list_email": "linux-gpio@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<3fc6a40bbf2ef327273e8100a7ea70190272ed85.1576745635.git.matti.vaittinen@fi.rohmeurope.com>", "list_archive_url": null, "date": "2019-12-19T09:53:19", "name": "[v7,09/12] rtc: bd70528: add BD71828 support", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "95e714a712c14b7ffeca46a41ed69a5b544c52f9", "submitter": { "id": 74146, "url": "http://patchwork.ozlabs.org/api/people/74146/?format=api", "name": "Matti Vaittinen", "email": "matti.vaittinen@fi.rohmeurope.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-gpio/patch/3fc6a40bbf2ef327273e8100a7ea70190272ed85.1576745635.git.matti.vaittinen@fi.rohmeurope.com/mbox/", "series": [ { "id": 149534, "url": "http://patchwork.ozlabs.org/api/series/149534/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-gpio/list/?series=149534", "date": "2019-12-19T09:44:08", "name": "Support ROHM BD71828 PMIC", "version": 7, "mbox": "http://patchwork.ozlabs.org/series/149534/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1213098/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1213098/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-gpio-owner@vger.kernel.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org; spf=none (no SPF record)\n\tsmtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67;\n\thelo=vger.kernel.org;\n\tenvelope-from=linux-gpio-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dmarc=none (p=none dis=none)\n\theader.from=fi.rohmeurope.com" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 47dnJD3gLQz9sPc\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 19 Dec 2019 20:53:32 +1100 (AEDT)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1726618AbfLSJxb (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tThu, 19 Dec 2019 04:53:31 -0500", "from mail-lf1-f68.google.com ([209.85.167.68]:36413 \"EHLO\n\tmail-lf1-f68.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1726599AbfLSJxb (ORCPT\n\t<rfc822; linux-gpio@vger.kernel.org>); Thu, 19 Dec 2019 04:53:31 -0500", "by mail-lf1-f68.google.com with SMTP id n12so3895433lfe.3;\n\tThu, 19 Dec 2019 01:53:28 -0800 (PST)", "from localhost.localdomain\n\t(dyt4gctb359myxd0pkwmt-4.rev.dnainternet.fi.\n\t[2001:14bb:430:5140:37cf:5409:8fcc:4495])\n\tby smtp.gmail.com with ESMTPSA id\n\tl5sm1499430lje.1.2019.12.19.01.53.25\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 19 Dec 2019 01:53:26 -0800 (PST)" ], "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:in-reply-to:user-agent;\n\tbh=aWkvcm9AB6rBk26jwl57OtEbYNObyZxSpvdsTT9hj44=;\n\tb=lCzVi+aFs8Zigl+njVWooBdUYyRpb/gWw6DHfi2pF25ZMhNJW20UoqcznlnhJBzY7t\n\tY0h6eYmGzKoo3Z3MAJcoZHy/0X6hdKKO6VZKHcmbOQTJscd/s7HaepONGNHDr4wXUIMN\n\tIRk0P3ug23Cs6p+/cYYnw72O6jdXeT8LXmPsxtL6ruOfLdij0WrCiuuTKoIWVYXA5Cq9\n\tJG3S5z5erz3BVSpWX7HyEMwt9x637ShsCY0Ai0nRpjaCJe8rHY2cWeCfiG+Mk7ZEvSDq\n\t8biObVADiq5CCa92AiU2mZgzU8d7Ct8fv5wefbLhgfW8hF72EpU4mUJNgS5fPnH1Atln\n\tH1RA==", "X-Gm-Message-State": "APjAAAUBMPr+20AJgsR4rO9iJVSBLht9F//p5VqLNFX94YZuG0KcGksA\n\tBKiqhYft9VBVjFWlPrC0mys=", "X-Google-Smtp-Source": "APXvYqx5QKTmudRBesDj8KoSS0v6sahe7Cpi5b9wTu/IXidB0I4rS+IRxe7EBzo/ZLbFQRUfHa6Qnw==", "X-Received": "by 2002:a05:6512:284:: with SMTP id\n\tj4mr4575854lfp.109.1576749207195; \n\tThu, 19 Dec 2019 01:53:27 -0800 (PST)", "Date": "Thu, 19 Dec 2019 11:53:19 +0200", "From": "Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>", "To": "matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com", "Cc": "Jacek Anaszewski <jacek.anaszewski@gmail.com>,\n\tPavel Machek <pavel@ucw.cz>, Dan Murphy <dmurphy@ti.com>,\n\tRob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com>,\n\tLee Jones <lee.jones@linaro.org>,\n\tMichael Turquette <mturquette@baylibre.com>,\n\tStephen Boyd <sboyd@kernel.org>,\n\tLinus Walleij <linus.walleij@linaro.org>,\n\tBartosz Golaszewski <bgolaszewski@baylibre.com>,\n\tLiam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>,\n\tAlessandro Zummo <a.zummo@towertech.it>,\n\tAlexandre Belloni <alexandre.belloni@bootlin.com>,\n\tlinux-leds@vger.kernel.org, devicetree@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,\n\tlinux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org", "Subject": "[PATCH v7 09/12] rtc: bd70528: add BD71828 support", "Message-ID": "<3fc6a40bbf2ef327273e8100a7ea70190272ed85.1576745635.git.matti.vaittinen@fi.rohmeurope.com>", "References": "<cover.1576745635.git.matti.vaittinen@fi.rohmeurope.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=us-ascii", "Content-Disposition": "inline", "In-Reply-To": "<cover.1576745635.git.matti.vaittinen@fi.rohmeurope.com>", "User-Agent": "Mutt/1.12.1 (2019-06-15)", "Sender": "linux-gpio-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-gpio.vger.kernel.org>", "X-Mailing-List": "linux-gpio@vger.kernel.org" }, "content": "ROHM BD71828 PMIC RTC block is from many parts similar to one\non BD70528. Support BD71828 RTC using BD70528 RTC driver and\navoid re-inventing the wheel.\n\nSigned-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>\nAcked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>\n---\n\nChanges since v6:\n - fixed subject by adding missing colon\n\n drivers/rtc/Kconfig | 3 +-\n drivers/rtc/rtc-bd70528.c | 168 ++++++++++++++++++++++++++++---\n include/linux/mfd/rohm-bd70528.h | 13 +--\n include/linux/mfd/rohm-bd71828.h | 4 +-\n include/linux/mfd/rohm-shared.h | 27 +++++\n 5 files changed, 186 insertions(+), 29 deletions(-)\n create mode 100644 include/linux/mfd/rohm-shared.h", "diff": "diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig\nindex d77515d8382c..df7a3843069d 100644\n--- a/drivers/rtc/Kconfig\n+++ b/drivers/rtc/Kconfig\n@@ -498,12 +498,13 @@ config RTC_DRV_M41T80_WDT\n \thelp\n \t If you say Y here you will get support for the\n \t watchdog timer in the ST M41T60 and M41T80 RTC chips series.\n+\n config RTC_DRV_BD70528\n \ttristate \"ROHM BD70528 PMIC RTC\"\n \tdepends on MFD_ROHM_BD70528 && (BD70528_WATCHDOG || !BD70528_WATCHDOG)\n \thelp\n \t If you say Y here you will get support for the RTC\n-\t on ROHM BD70528 Power Management IC.\n+\t block on ROHM BD70528 and BD71828 Power Management IC.\n \n \t This driver can also be built as a module. If so, the module\n \t will be called rtc-bd70528.\ndiff --git a/drivers/rtc/rtc-bd70528.c b/drivers/rtc/rtc-bd70528.c\nindex 627037aa66a8..2ce202040556 100644\n--- a/drivers/rtc/rtc-bd70528.c\n+++ b/drivers/rtc/rtc-bd70528.c\n@@ -6,6 +6,7 @@\n \n #include <linux/bcd.h>\n #include <linux/mfd/rohm-bd70528.h>\n+#include <linux/mfd/rohm-bd71828.h>\n #include <linux/module.h>\n #include <linux/of.h>\n #include <linux/platform_device.h>\n@@ -15,7 +16,7 @@\n /*\n * We read regs RTC_SEC => RTC_YEAR\n * this struct is ordered according to chip registers.\n- * Keep it u8 only to avoid padding issues.\n+ * Keep it u8 only (or packed) to avoid padding issues.\n */\n struct bd70528_rtc_day {\n \tu8 sec;\n@@ -36,6 +37,13 @@ struct bd70528_rtc_wake {\n \tu8 ctrl;\n } __packed;\n \n+struct bd71828_rtc_alm {\n+\tstruct bd70528_rtc_data alm0;\n+\tstruct bd70528_rtc_data alm1;\n+\tu8 alm_mask;\n+\tu8 alm1_mask;\n+} __packed;\n+\n struct bd70528_rtc_alm {\n \tstruct bd70528_rtc_data data;\n \tu8 alm_mask;\n@@ -45,6 +53,8 @@ struct bd70528_rtc_alm {\n struct bd70528_rtc {\n \tstruct rohm_regmap_dev *mfd;\n \tstruct device *dev;\n+\tu8 reg_time_start;\n+\tbool has_rtc_timers;\n };\n \n static int bd70528_set_wake(struct rohm_regmap_dev *bd70528,\n@@ -152,12 +162,18 @@ static int bd70528_set_rtc_based_timers(struct bd70528_rtc *r, int new_state,\n static int bd70528_re_enable_rtc_based_timers(struct bd70528_rtc *r,\n \t\t\t\t\t int old_state)\n {\n+\tif (!r->has_rtc_timers)\n+\t\treturn 0;\n+\n \treturn bd70528_set_rtc_based_timers(r, old_state, NULL);\n }\n \n static int bd70528_disable_rtc_based_timers(struct bd70528_rtc *r,\n \t\t\t\t\t int *old_state)\n {\n+\tif (!r->has_rtc_timers)\n+\t\treturn 0;\n+\n \treturn bd70528_set_rtc_based_timers(r, 0, old_state);\n }\n \n@@ -213,6 +229,36 @@ static inline void rtc2tm(struct bd70528_rtc_data *r, struct rtc_time *t)\n \tt->tm_wday = bcd2bin(r->week & BD70528_MASK_RTC_WEEK);\n }\n \n+static int bd71828_set_alarm(struct device *dev, struct rtc_wkalrm *a)\n+{\n+\tint ret;\n+\tstruct bd71828_rtc_alm alm;\n+\tstruct bd70528_rtc *r = dev_get_drvdata(dev);\n+\tstruct rohm_regmap_dev *bd71828 = r->mfd;\n+\n+\tret = regmap_bulk_read(bd71828->regmap, BD71828_REG_RTC_ALM_START,\n+\t\t\t &alm, sizeof(alm));\n+\tif (ret) {\n+\t\tdev_err(dev, \"Failed to read alarm regs\\n\");\n+\t\treturn ret;\n+\t}\n+\n+\ttm2rtc(&a->time, &alm.alm0);\n+\n+\tif (!a->enabled)\n+\t\talm.alm_mask &= ~BD70528_MASK_ALM_EN;\n+\telse\n+\t\talm.alm_mask |= BD70528_MASK_ALM_EN;\n+\n+\tret = regmap_bulk_write(bd71828->regmap, BD71828_REG_RTC_ALM_START,\n+\t\t\t\t&alm, sizeof(alm));\n+\tif (ret)\n+\t\tdev_err(dev, \"Failed to set alarm time\\n\");\n+\n+\treturn ret;\n+\n+}\n+\n static int bd70528_set_alarm(struct device *dev, struct rtc_wkalrm *a)\n {\n \tstruct bd70528_rtc_wake wake;\n@@ -261,6 +307,30 @@ static int bd70528_set_alarm(struct device *dev, struct rtc_wkalrm *a)\n \treturn ret;\n }\n \n+static int bd71828_read_alarm(struct device *dev, struct rtc_wkalrm *a)\n+{\n+\tint ret;\n+\tstruct bd71828_rtc_alm alm;\n+\tstruct bd70528_rtc *r = dev_get_drvdata(dev);\n+\tstruct rohm_regmap_dev *bd71828 = r->mfd;\n+\n+\tret = regmap_bulk_read(bd71828->regmap, BD71828_REG_RTC_ALM_START,\n+\t\t\t &alm, sizeof(alm));\n+\tif (ret) {\n+\t\tdev_err(dev, \"Failed to read alarm regs\\n\");\n+\t\treturn ret;\n+\t}\n+\n+\trtc2tm(&alm.alm0, &a->time);\n+\ta->time.tm_mday = -1;\n+\ta->time.tm_mon = -1;\n+\ta->time.tm_year = -1;\n+\ta->enabled = !!(alm.alm_mask & BD70528_MASK_ALM_EN);\n+\ta->pending = 0;\n+\n+\treturn 0;\n+}\n+\n static int bd70528_read_alarm(struct device *dev, struct rtc_wkalrm *a)\n {\n \tstruct bd70528_rtc_alm alm;\n@@ -297,7 +367,7 @@ static int bd70528_set_time_locked(struct device *dev, struct rtc_time *t)\n \t\treturn ret;\n \n \ttmpret = regmap_bulk_read(bd70528->regmap,\n-\t\t\t\t BD70528_REG_RTC_START, &rtc_data,\n+\t\t\t\t r->reg_time_start, &rtc_data,\n \t\t\t\t sizeof(rtc_data));\n \tif (tmpret) {\n \t\tdev_err(dev, \"Failed to read RTC time registers\\n\");\n@@ -306,7 +376,7 @@ static int bd70528_set_time_locked(struct device *dev, struct rtc_time *t)\n \ttm2rtc(t, &rtc_data);\n \n \ttmpret = regmap_bulk_write(bd70528->regmap,\n-\t\t\t\t BD70528_REG_RTC_START, &rtc_data,\n+\t\t\t\t r->reg_time_start, &rtc_data,\n \t\t\t\t sizeof(rtc_data));\n \tif (tmpret) {\n \t\tdev_err(dev, \"Failed to set RTC time\\n\");\n@@ -321,6 +391,11 @@ static int bd70528_set_time_locked(struct device *dev, struct rtc_time *t)\n \treturn ret;\n }\n \n+static int bd71828_set_time(struct device *dev, struct rtc_time *t)\n+{\n+\treturn bd70528_set_time_locked(dev, t);\n+}\n+\n static int bd70528_set_time(struct device *dev, struct rtc_time *t)\n {\n \tint ret;\n@@ -341,7 +416,7 @@ static int bd70528_get_time(struct device *dev, struct rtc_time *t)\n \n \t/* read the RTC date and time registers all at once */\n \tret = regmap_bulk_read(bd70528->regmap,\n-\t\t\t BD70528_REG_RTC_START, &rtc_data,\n+\t\t\t r->reg_time_start, &rtc_data,\n \t\t\t sizeof(rtc_data));\n \tif (ret) {\n \t\tdev_err(dev, \"Failed to read RTC time (err %d)\\n\", ret);\n@@ -378,6 +453,23 @@ static int bd70528_alm_enable(struct device *dev, unsigned int enabled)\n \treturn ret;\n }\n \n+static int bd71828_alm_enable(struct device *dev, unsigned int enabled)\n+{\n+\tint ret;\n+\tstruct bd70528_rtc *r = dev_get_drvdata(dev);\n+\tunsigned int enableval = BD70528_MASK_ALM_EN;\n+\n+\tif (!enabled)\n+\t\tenableval = 0;\n+\n+\tret = regmap_update_bits(r->mfd->regmap, BD71828_REG_RTC_ALM0_MASK,\n+\t\t\t\t BD70528_MASK_ALM_EN, enableval);\n+\tif (ret)\n+\t\tdev_err(dev, \"Failed to change alarm state\\n\");\n+\n+\treturn ret;\n+}\n+\n static const struct rtc_class_ops bd70528_rtc_ops = {\n \t.read_time\t\t= bd70528_get_time,\n \t.set_time\t\t= bd70528_set_time,\n@@ -386,6 +478,14 @@ static const struct rtc_class_ops bd70528_rtc_ops = {\n \t.alarm_irq_enable\t= bd70528_alm_enable,\n };\n \n+static const struct rtc_class_ops bd71828_rtc_ops = {\n+\t.read_time\t\t= bd70528_get_time,\n+\t.set_time\t\t= bd71828_set_time,\n+\t.read_alarm\t\t= bd71828_read_alarm,\n+\t.set_alarm\t\t= bd71828_set_alarm,\n+\t.alarm_irq_enable\t= bd71828_alm_enable,\n+};\n+\n static irqreturn_t alm_hndlr(int irq, void *data)\n {\n \tstruct rtc_device *rtc = data;\n@@ -397,11 +497,16 @@ static irqreturn_t alm_hndlr(int irq, void *data)\n static int bd70528_probe(struct platform_device *pdev)\n {\n \tstruct bd70528_rtc *bd_rtc;\n+\tconst struct rtc_class_ops *rtc_ops;\n \tstruct rohm_regmap_dev *mfd;\n+\tconst char *irq_name;\n \tint ret;\n \tstruct rtc_device *rtc;\n \tint irq;\n \tunsigned int hr;\n+\tbool enable_main_irq = false;\n+\tu8 hour_reg;\n+\tenum rohm_chip_type chip = platform_get_device_id(pdev)->driver_data;\n \n \tmfd = dev_get_drvdata(pdev->dev.parent);\n \tif (!mfd) {\n@@ -415,13 +520,36 @@ static int bd70528_probe(struct platform_device *pdev)\n \tbd_rtc->mfd = mfd;\n \tbd_rtc->dev = &pdev->dev;\n \n-\tirq = platform_get_irq_byname(pdev, \"bd70528-rtc-alm\");\n-\tif (irq < 0)\n+\tswitch (chip) {\n+\tcase ROHM_CHIP_TYPE_BD70528:\n+\t\tirq_name = \"bd70528-rtc-alm\";\n+\t\tbd_rtc->has_rtc_timers = true;\n+\t\tbd_rtc->reg_time_start = BD70528_REG_RTC_START;\n+\t\thour_reg = BD70528_REG_RTC_HOUR;\n+\t\tenable_main_irq = true;\n+\t\trtc_ops = &bd70528_rtc_ops;\n+\t\tbreak;\n+\tcase ROHM_CHIP_TYPE_BD71828:\n+\t\tirq_name = \"bd71828-rtc-alm-0\";\n+\t\tbd_rtc->reg_time_start = BD71828_REG_RTC_START;\n+\t\thour_reg = BD71828_REG_RTC_HOUR;\n+\t\trtc_ops = &bd71828_rtc_ops;\n+\t\tbreak;\n+\tdefault:\n+\t\tdev_err(&pdev->dev, \"Unknown chip\\n\");\n+\t\treturn -ENOENT;\n+\t}\n+\n+\tirq = platform_get_irq_byname(pdev, irq_name);\n+\n+\tif (irq < 0) {\n+\t\tdev_err(&pdev->dev, \"Failed to get irq\\n\");\n \t\treturn irq;\n+\t}\n \n \tplatform_set_drvdata(pdev, bd_rtc);\n \n-\tret = regmap_read(mfd->regmap, BD70528_REG_RTC_HOUR, &hr);\n+\tret = regmap_read(mfd->regmap, hour_reg, &hr);\n \n \tif (ret) {\n \t\tdev_err(&pdev->dev, \"Failed to reag RTC clock\\n\");\n@@ -431,10 +559,10 @@ static int bd70528_probe(struct platform_device *pdev)\n \tif (!(hr & BD70528_MASK_RTC_HOUR_24H)) {\n \t\tstruct rtc_time t;\n \n-\t\tret = bd70528_get_time(&pdev->dev, &t);\n+\t\tret = rtc_ops->read_time(&pdev->dev, &t);\n \n \t\tif (!ret)\n-\t\t\tret = bd70528_set_time(&pdev->dev, &t);\n+\t\t\tret = rtc_ops->set_time(&pdev->dev, &t);\n \n \t\tif (ret) {\n \t\t\tdev_err(&pdev->dev,\n@@ -454,7 +582,7 @@ static int bd70528_probe(struct platform_device *pdev)\n \n \trtc->range_min = RTC_TIMESTAMP_BEGIN_2000;\n \trtc->range_max = RTC_TIMESTAMP_END_2099;\n-\trtc->ops = &bd70528_rtc_ops;\n+\trtc->ops = rtc_ops;\n \n \t/* Request alarm IRQ prior to registerig the RTC */\n \tret = devm_request_threaded_irq(&pdev->dev, irq, NULL, &alm_hndlr,\n@@ -468,27 +596,37 @@ static int bd70528_probe(struct platform_device *pdev)\n \t * leave them enabled as irq-controller should disable irqs\n \t * from sub-registers when IRQ is disabled or freed.\n \t */\n-\tret = regmap_update_bits(mfd->regmap,\n+\tif (enable_main_irq) {\n+\t\tret = regmap_update_bits(mfd->regmap,\n \t\t\t\t BD70528_REG_INT_MAIN_MASK,\n \t\t\t\t BD70528_INT_RTC_MASK, 0);\n-\tif (ret) {\n-\t\tdev_err(&pdev->dev, \"Failed to enable RTC interrupts\\n\");\n-\t\treturn ret;\n+\t\tif (ret) {\n+\t\t\tdev_err(&pdev->dev, \"Failed to enable RTC interrupts\\n\");\n+\t\t\treturn ret;\n+\t\t}\n \t}\n \n \treturn rtc_register_device(rtc);\n }\n \n+static const struct platform_device_id bd718x7_rtc_id[] = {\n+\t{ \"bd70528-rtc\", ROHM_CHIP_TYPE_BD70528 },\n+\t{ \"bd71828-rtc\", ROHM_CHIP_TYPE_BD71828 },\n+\t{ },\n+};\n+MODULE_DEVICE_TABLE(platform, bd718x7_rtc_id);\n+\n static struct platform_driver bd70528_rtc = {\n \t.driver = {\n \t\t.name = \"bd70528-rtc\"\n \t},\n \t.probe = bd70528_probe,\n+\t.id_table = bd718x7_rtc_id,\n };\n \n module_platform_driver(bd70528_rtc);\n \n MODULE_AUTHOR(\"Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>\");\n-MODULE_DESCRIPTION(\"BD70528 RTC driver\");\n+MODULE_DESCRIPTION(\"ROHM BD70528 and BD71828 PMIC RTC driver\");\n MODULE_LICENSE(\"GPL\");\n MODULE_ALIAS(\"platform:bd70528-rtc\");\ndiff --git a/include/linux/mfd/rohm-bd70528.h b/include/linux/mfd/rohm-bd70528.h\nindex 2ad2320d0a96..a57af878fd0c 100644\n--- a/include/linux/mfd/rohm-bd70528.h\n+++ b/include/linux/mfd/rohm-bd70528.h\n@@ -7,6 +7,7 @@\n #include <linux/bits.h>\n #include <linux/device.h>\n #include <linux/mfd/rohm-generic.h>\n+#include <linux/mfd/rohm-shared.h>\n #include <linux/regmap.h>\n \n enum {\n@@ -307,17 +308,6 @@ enum {\n \n /* RTC masks to mask out reserved bits */\n \n-#define BD70528_MASK_RTC_SEC\t\t0x7f\n-#define BD70528_MASK_RTC_MINUTE\t\t0x7f\n-#define BD70528_MASK_RTC_HOUR_24H\t0x80\n-#define BD70528_MASK_RTC_HOUR_PM\t0x20\n-#define BD70528_MASK_RTC_HOUR\t\t0x1f\n-#define BD70528_MASK_RTC_DAY\t\t0x3f\n-#define BD70528_MASK_RTC_WEEK\t\t0x07\n-#define BD70528_MASK_RTC_MONTH\t\t0x1f\n-#define BD70528_MASK_RTC_YEAR\t\t0xff\n-#define BD70528_MASK_RTC_COUNT_L\t0x7f\n-\n #define BD70528_MASK_ELAPSED_TIMER_EN\t0x1\n /* Mask second, min and hour fields\n * HW would support ALM irq for over 24h\n@@ -326,7 +316,6 @@ enum {\n * wake-up we limit ALM to 24H and only\n * unmask sec, min and hour\n */\n-#define BD70528_MASK_ALM_EN\t\t0x7\n #define BD70528_MASK_WAKE_EN\t\t0x1\n \n /* WDT masks */\ndiff --git a/include/linux/mfd/rohm-bd71828.h b/include/linux/mfd/rohm-bd71828.h\nindex d013e03f742d..017a4c01cb31 100644\n--- a/include/linux/mfd/rohm-bd71828.h\n+++ b/include/linux/mfd/rohm-bd71828.h\n@@ -5,6 +5,7 @@\n #define __LINUX_MFD_BD71828_H__\n \n #include <linux/mfd/rohm-generic.h>\n+#include <linux/mfd/rohm-shared.h>\n \n /* Regulator IDs */\n enum {\n@@ -160,6 +161,7 @@ enum {\n #define BD71828_REG_RTC_YEAR\t\t0x52\n \n #define BD71828_REG_RTC_ALM0_SEC\t0x53\n+#define BD71828_REG_RTC_ALM_START\tBD71828_REG_RTC_ALM0_SEC\n #define BD71828_REG_RTC_ALM0_MINUTE\t0x54\n #define BD71828_REG_RTC_ALM0_HOUR\t0x55\n #define BD71828_REG_RTC_ALM0_WEEK\t0x56\n@@ -178,6 +180,7 @@ enum {\n #define BD71828_REG_RTC_ALM1_MASK\t0x62\n \n #define BD71828_REG_RTC_ALM2\t\t0x63\n+#define BD71828_REG_RTC_START\t\tBD71828_REG_RTC_SEC\n \n /* Charger/Battey */\n #define BD71828_REG_CHG_STATE\t\t0x65\n@@ -204,7 +207,6 @@ enum {\n #define BD71828_REG_INT_MASK_TEMP\t0xdd\n #define BD71828_REG_INT_MASK_RTC\t0xde\n \n-\n #define BD71828_REG_INT_MAIN\t\t0xdf\n #define BD71828_REG_INT_BUCK\t\t0xe0\n #define BD71828_REG_INT_DCIN1\t\t0xe1\ndiff --git a/include/linux/mfd/rohm-shared.h b/include/linux/mfd/rohm-shared.h\nnew file mode 100644\nindex 000000000000..f16fc3b5000e\n--- /dev/null\n+++ b/include/linux/mfd/rohm-shared.h\n@@ -0,0 +1,27 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/* Copyright (C) 2018 ROHM Semiconductors */\n+\n+\n+#ifndef __LINUX_MFD_ROHM_SHARED_H__\n+#define __LINUX_MFD_ROHM_SHARED_H__\n+\n+/*\n+ * RTC definitions shared between\n+ *\n+ * BD70528\n+ * and BD71828\n+ */\n+\n+\n+#define BD70528_MASK_RTC_SEC\t\t0x7f\n+#define BD70528_MASK_RTC_MINUTE\t0x7f\n+#define BD70528_MASK_RTC_HOUR_24H\t0x80\n+#define BD70528_MASK_RTC_HOUR_PM\t0x20\n+#define BD70528_MASK_RTC_HOUR\t\t0x3f\n+#define BD70528_MASK_RTC_DAY\t\t0x3f\n+#define BD70528_MASK_RTC_WEEK\t\t0x07\n+#define BD70528_MASK_RTC_MONTH\t\t0x1f\n+#define BD70528_MASK_RTC_YEAR\t\t0xff\n+#define BD70528_MASK_ALM_EN\t\t0x7\n+\n+#endif /* __LINUX_MFD_ROHM_SHARED_H__ */\n", "prefixes": [ "v7", "09/12" ] }