Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/811662/?format=api
{ "id": 811662, "url": "http://patchwork.ozlabs.org/api/patches/811662/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pwm/patch/20170908153604.28383-8-romain.izard.pro@gmail.com/", "project": { "id": 38, "url": "http://patchwork.ozlabs.org/api/projects/38/?format=api", "name": "Linux PWM development", "link_name": "linux-pwm", "list_id": "linux-pwm.vger.kernel.org", "list_email": "linux-pwm@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170908153604.28383-8-romain.izard.pro@gmail.com>", "list_archive_url": null, "date": "2017-09-08T15:36:01", "name": "[v1,07/10] iio:adc:at91-sama5d2: Support backup mode", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "43f9f0f54bdc301a1bfe15ca7e09cacf15e5278f", "submitter": { "id": 8236, "url": "http://patchwork.ozlabs.org/api/people/8236/?format=api", "name": "Romain Izard", "email": "romain.izard.pro@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pwm/patch/20170908153604.28383-8-romain.izard.pro@gmail.com/mbox/", "series": [ { "id": 2238, "url": "http://patchwork.ozlabs.org/api/series/2238/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pwm/list/?series=2238", "date": "2017-09-08T15:35:55", "name": "Various patches for SAMA5D2 backup mode", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/2238/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/811662/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/811662/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-pwm-owner@vger.kernel.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-pwm-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"j+4lTOQl\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xphWz013wz9t2V\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 9 Sep 2017 01:46:55 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S932498AbdIHPge (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tFri, 8 Sep 2017 11:36:34 -0400", "from mail-wm0-f68.google.com ([74.125.82.68]:35142 \"EHLO\n\tmail-wm0-f68.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1756582AbdIHPg1 (ORCPT\n\t<rfc822;linux-pwm@vger.kernel.org>); Fri, 8 Sep 2017 11:36:27 -0400", "by mail-wm0-f68.google.com with SMTP id e64so1985769wmi.2;\n\tFri, 08 Sep 2017 08:36:26 -0700 (PDT)", "from localhost.localdomain (146.187.3.109.rev.sfr.net.\n\t[109.3.187.146]) by smtp.gmail.com with ESMTPSA id\n\tp199sm1689224wmb.28.2017.09.08.08.36.23\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 08 Sep 2017 08:36:24 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=leYrW6L0ZAgin3ZE6IBF4T1AHRveuovX/Zppbk5tYX0=;\n\tb=j+4lTOQltgZ+smEkBmKTjvXaLZqAtgLVsu5bj/O6S/VrHeH+Sfr48Wqo3UCJBp4Ah+\n\th3Uau5W4dwdo4ubpSbh5ANhgfzhpn2WFAp5MgiuCtXAJXC8/y/eWfcqJxArUx7gAP4X1\n\tiR4xk4ZyMjg4GBeu5opA1oHrmKpK5/E0EZLKWyTrLUKeRnOPcEeODcjtDeYMXu4Csh9J\n\t9F1nIM7Qa0JUPPt4f8aiEW/rt7wP92dsSfZTIoO/fh33FKUGPYy/XZT+b5Jro7BcWGi9\n\tVSNDXo2HpRa6b7Gt86EU5FHtGrzrr/cESaDiNyVt8jKeETXhqWG6lqQy8MnxRYu1OQ9q\n\tkufg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=leYrW6L0ZAgin3ZE6IBF4T1AHRveuovX/Zppbk5tYX0=;\n\tb=fXBsF79Umqxj4kWSsSSMgj1nUW+nsOmLHb6/C/gAa57hL8GU4182Yl2aVPMwBolf3R\n\tpm/jf+mHeMWVVeHtOD5NVtzbRaLWktJL7vymU2e0Y/XXZyUL9+6VQ23Cf4NMmsP5PwKp\n\txKUiI6mJDDS3sQHHTbnGhJ+4YKUjebIzm2f4l/IxU+2AlOR2njJeCJwPgOPMVqIfhd2n\n\tDB73XY7DOIZKbKbI851V79Lf4eXCfFZQ2ci9feolHo1nOe8NVcQKeNC/l/5DwozAos4V\n\tCCrVkY7CjG3Thd4Hr94uUOG4KAfdPnoqIxglNgGZdiSQT1hGHDsI7orcTlvBf0WQvkND\n\tPXrQ==", "X-Gm-Message-State": "AHPjjUieWjQ/nvHYaO7F9X/aC3WKPsqvN28xylmjPTenwXdyDUGAR7ks\n\tJ3baEnzHhdY6KrcSu3OYIko=", "X-Google-Smtp-Source": "AOwi7QCuZrYWjFlTk6VAnjoV4RNmAdRDCKjWHnUIqtUUP0EBxrSoKQSMpXuCu34A1JUFXlARvJVSoQ==", "X-Received": "by 10.28.15.210 with SMTP id 201mr2181914wmp.10.1504884985380;\n\tFri, 08 Sep 2017 08:36:25 -0700 (PDT)", "From": "Romain Izard <romain.izard.pro@gmail.com>", "To": "Nicolas Ferre <nicolas.ferre@microchip.com>,\n\tBoris Brezillon <boris.brezillon@free-electrons.com>,\n\tMichael Turquette <mturquette@baylibre.com>,\n\tStephen Boyd <sboyd@codeaurora.org>,\n\tLudovic Desroches <ludovic.desroches@microchip.com>,\n\tJonathan Cameron <jic23@kernel.org>, Wenyou Yang <wenyou.yang@atmel.com>,\n\tJosh Wu <rainyfeeling@outlook.com>,\n\tDavid Woodhouse <dwmw2@infradead.org>,\n\tBrian Norris <computersforpeace@gmail.com>,\n\tMarek Vasut <marek.vasut@gmail.com>,\n\tCyrille Pitchen <cyrille.pitchen@wedev4u.fr>,\n\tThierry Reding <thierry.reding@gmail.com>,\n\tRichard Genoud <richard.genoud@gmail.com>,\n\tGreg Kroah-Hartman <gregkh@linuxfoundation.org>,\n\tAlan Stern <stern@rowland.harvard.edu>", "Cc": "linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tlinux-iio@vger.kernel.org, linux-mtd@lists.infradead.org,\n\tlinux-pwm@vger.kernel.org, linux-serial@vger.kernel.org,\n\tlinux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,\n\tRomain Izard <romain.izard.pro@gmail.com>", "Subject": "[PATCH v1 07/10] iio:adc:at91-sama5d2: Support backup mode", "Date": "Fri, 8 Sep 2017 17:36:01 +0200", "Message-Id": "<20170908153604.28383-8-romain.izard.pro@gmail.com>", "X-Mailer": "git-send-email 2.11.0", "In-Reply-To": "<20170908153604.28383-1-romain.izard.pro@gmail.com>", "References": "<20170908153604.28383-1-romain.izard.pro@gmail.com>", "Sender": "linux-pwm-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-pwm.vger.kernel.org>", "X-Mailing-List": "linux-pwm@vger.kernel.org" }, "content": "Support the backup mode for platform suspend, by restoring the hardware\nregisters on resume.\n\nSigned-off-by: Romain Izard <romain.izard.pro@gmail.com>\n---\n drivers/iio/adc/at91-sama5d2_adc.c | 71 ++++++++++++++++++++++++++++++++------\n 1 file changed, 61 insertions(+), 10 deletions(-)", "diff": "diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c\nindex e10dca3ed74b..f9718c863363 100644\n--- a/drivers/iio/adc/at91-sama5d2_adc.c\n+++ b/drivers/iio/adc/at91-sama5d2_adc.c\n@@ -200,6 +200,7 @@ struct at91_adc_state {\n \tu32\t\t\t\tconversion_value;\n \tstruct at91_adc_soc_info\tsoc_info;\n \twait_queue_head_t\t\twq_data_available;\n+\tunsigned int\t\t\tcurrent_rate;\n \t/*\n \t * lock to prevent concurrent 'single conversion' requests through\n \t * sysfs.\n@@ -269,6 +270,8 @@ static void at91_adc_setup_samp_freq(struct at91_adc_state *st, unsigned freq)\n \tmr |= AT91_SAMA5D2_MR_PRESCAL(prescal);\n \tat91_adc_writel(st, AT91_SAMA5D2_MR, mr);\n \n+\tst->current_rate = freq;\n+\n \tdev_dbg(&indio_dev->dev, \"freq: %u, startup: %u, prescal: %u\\n\",\n \t\tfreq, startup, prescal);\n }\n@@ -375,7 +378,9 @@ static int at91_adc_write_raw(struct iio_dev *indio_dev,\n \t val > st->soc_info.max_sample_rate)\n \t\treturn -EINVAL;\n \n+\tmutex_lock(&st->lock);\n \tat91_adc_setup_samp_freq(st, val);\n+\tmutex_unlock(&st->lock);\n \n \treturn 0;\n }\n@@ -386,6 +391,21 @@ static const struct iio_info at91_adc_info = {\n \t.driver_module = THIS_MODULE,\n };\n \n+static void at91_adc_init_hw(struct at91_adc_state *st, unsigned int freq)\n+{\n+\tat91_adc_writel(st, AT91_SAMA5D2_CR, AT91_SAMA5D2_CR_SWRST);\n+\tat91_adc_writel(st, AT91_SAMA5D2_IDR, 0xffffffff);\n+\t/*\n+\t * Transfer field must be set to 2 according to the datasheet and\n+\t * allows different analog settings for each channel.\n+\t */\n+\tat91_adc_writel(st, AT91_SAMA5D2_MR,\n+\t\t\tAT91_SAMA5D2_MR_TRANSFER(2) | AT91_SAMA5D2_MR_ANACH);\n+\n+\tat91_adc_setup_samp_freq(st, freq);\n+\n+}\n+\n static int at91_adc_probe(struct platform_device *pdev)\n {\n \tstruct iio_dev *indio_dev;\n@@ -482,16 +502,7 @@ static int at91_adc_probe(struct platform_device *pdev)\n \t\tgoto vref_disable;\n \t}\n \n-\tat91_adc_writel(st, AT91_SAMA5D2_CR, AT91_SAMA5D2_CR_SWRST);\n-\tat91_adc_writel(st, AT91_SAMA5D2_IDR, 0xffffffff);\n-\t/*\n-\t * Transfer field must be set to 2 according to the datasheet and\n-\t * allows different analog settings for each channel.\n-\t */\n-\tat91_adc_writel(st, AT91_SAMA5D2_MR,\n-\t\t\tAT91_SAMA5D2_MR_TRANSFER(2) | AT91_SAMA5D2_MR_ANACH);\n-\n-\tat91_adc_setup_samp_freq(st, st->soc_info.min_sample_rate);\n+\tat91_adc_init_hw(st, st->soc_info.min_sample_rate);\n \n \tret = clk_prepare_enable(st->per_clk);\n \tif (ret)\n@@ -541,12 +552,52 @@ static const struct of_device_id at91_adc_dt_match[] = {\n };\n MODULE_DEVICE_TABLE(of, at91_adc_dt_match);\n \n+#ifdef CONFIG_PM_SLEEP\n+static int at91_adc_suspend(struct device *dev)\n+{\n+\tstruct platform_device *pdev = to_platform_device(dev);\n+\tstruct iio_dev *indio_dev = platform_get_drvdata(pdev);\n+\tstruct at91_adc_state *st = iio_priv(indio_dev);\n+\n+\tclk_disable_unprepare(st->per_clk);\n+\n+\tregulator_disable(st->vref);\n+\tregulator_disable(st->reg);\n+\n+\treturn 0;\n+}\n+\n+static int at91_adc_resume(struct device *dev)\n+{\n+\tstruct platform_device *pdev = to_platform_device(dev);\n+\tstruct iio_dev *indio_dev = platform_get_drvdata(pdev);\n+\tstruct at91_adc_state *st = iio_priv(indio_dev);\n+\tint err;\n+\n+\terr = regulator_enable(st->reg);\n+\tif (err)\n+\t\treturn err;\n+\n+\terr = regulator_enable(st->vref);\n+\tif (err)\n+\t\treturn err;\n+\n+\tat91_adc_init_hw(st, st->current_rate);\n+\n+\terr = clk_prepare_enable(st->per_clk);\n+\treturn err;\n+}\n+#endif\n+\n+static SIMPLE_DEV_PM_OPS(at91_adc_pm_ops, at91_adc_suspend, at91_adc_resume);\n+\n static struct platform_driver at91_adc_driver = {\n \t.probe = at91_adc_probe,\n \t.remove = at91_adc_remove,\n \t.driver = {\n \t\t.name = \"at91-sama5d2_adc\",\n \t\t.of_match_table = at91_adc_dt_match,\n+\t\t.pm = &at91_adc_pm_ops,\n \t},\n };\n module_platform_driver(at91_adc_driver)\n", "prefixes": [ "v1", "07/10" ] }