get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/1526143/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1526143,
    "url": "http://patchwork.ozlabs.org/api/patches/1526143/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-pwm/patch/20210909101042.17431-1-marten.lindahl@axis.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": "<20210909101042.17431-1-marten.lindahl@axis.com>",
    "list_archive_url": null,
    "date": "2021-09-09T10:10:42",
    "name": "[v3] pwm: pwm-samsung: Trigger manual update when disabling PWM",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "b3452c145242d1d314f074e42d5e9caa05d749ba",
    "submitter": {
        "id": 71469,
        "url": "http://patchwork.ozlabs.org/api/people/71469/?format=api",
        "name": "Mårten Lindahl",
        "email": "marten.lindahl@axis.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-pwm/patch/20210909101042.17431-1-marten.lindahl@axis.com/mbox/",
    "series": [
        {
            "id": 261589,
            "url": "http://patchwork.ozlabs.org/api/series/261589/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-pwm/list/?series=261589",
            "date": "2021-09-09T10:10:42",
            "name": "[v3] pwm: pwm-samsung: Trigger manual update when disabling PWM",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/261589/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1526143/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1526143/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\tdkim=pass (2048-bit key;\n unprotected) header.d=axis.com header.i=@axis.com header.a=rsa-sha256\n header.s=axis-central1 header.b=N7dXfY2C;\n\tdkim-atps=neutral",
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=23.128.96.18; helo=vger.kernel.org;\n envelope-from=linux-pwm-owner@vger.kernel.org; receiver=<UNKNOWN>)"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [23.128.96.18])\n\tby ozlabs.org (Postfix) with ESMTP id 4H4vsQ38T7z9t0J\n\tfor <incoming@patchwork.ozlabs.org>; Thu,  9 Sep 2021 20:10:50 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n        id S233560AbhIIKL6 (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n        Thu, 9 Sep 2021 06:11:58 -0400",
            "from smtp2.axis.com ([195.60.68.18]:54458 \"EHLO smtp2.axis.com\"\n        rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n        id S229995AbhIIKL6 (ORCPT <rfc822;linux-pwm@vger.kernel.org>);\n        Thu, 9 Sep 2021 06:11:58 -0400"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n  d=axis.com; q=dns/txt; s=axis-central1; t=1631182249;\n  x=1662718249;\n  h=from:to:cc:subject:date:message-id:mime-version:\n   content-transfer-encoding;\n  bh=8WA791u9a+qKUngkNVzY5nIzKD8RRpENC0AG6NpLung=;\n  b=N7dXfY2CxoMInJmyiYFVAsSftNCrVD8UfRAiWuKcWJZdzrG8OTNnFsIR\n   +RIKAse6ctCouCBl4smzWSeEu7fvIJoMR59G2qsehkUZ5Qe3H/SyycvMN\n   bEta1dSzckDyPodZ5UqFaX5H9de1gOCK1cR99dNq+6H4MGCUPaDiyIHAD\n   ikfawhROqqu3D9+arFzXN8MCgY0beDf2ngIpBoxw2fBXtbm+13R051IDk\n   jVzL477KtBAX/w0zi7i/czZlzfYOFUZUl9hJofHg1Xo2yD8m05eAd5BK1\n   drmIfqzhYplwCThHDLXegFWnVPH6tULoVVzckESDHG2Tka/WdS3Jlj2Zr\n   Q==;",
        "From": "=?utf-8?q?M=C3=A5rten_Lindahl?= <marten.lindahl@axis.com>",
        "To": "Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,\n        Thierry Reding <thierry.reding@gmail.com>,\n        Lee Jones <lee.jones@linaro.org>",
        "CC": "=?utf-8?q?Uwe_Kleine-K=C3=B6nig?=  <u.kleine-koenig@pengutronix.de>,\n <linux-arm-kernel@lists.infradead.org>, <linux-samsung-soc@vger.kernel.org>,\n <linux-pwm@vger.kernel.org>, <kernel@axis.com>, =?utf-8?q?M=C3=A5rten_Linda?=\n\t=?utf-8?q?hl?= <marten.lindahl@axis.com>",
        "Subject": "[PATCH v3] pwm: pwm-samsung: Trigger manual update when disabling PWM",
        "Date": "Thu, 9 Sep 2021 12:10:42 +0200",
        "Message-ID": "<20210909101042.17431-1-marten.lindahl@axis.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"UTF-8\"",
        "Content-Transfer-Encoding": "8bit",
        "Precedence": "bulk",
        "List-ID": "<linux-pwm.vger.kernel.org>",
        "X-Mailing-List": "linux-pwm@vger.kernel.org"
    },
    "content": "When duty-cycle is at full level (100%), the TCNTn and TCMPn registers\nneeds to be flushed in order to disable the signal. The PWM manual does\nnot say anything about this, but states that only clearing the TCON\nauto-reload bit should be needed, and this seems to be true when the PWM\nduty-cycle is not at full level. This can be observed on an Axis\nARTPEC-8, by running:\n\n  echo <period> > pwm/period\n  echo <period> > pwm/duty_cycle\n  echo 1 > pwm/enable\n  echo 0 > pwm/enable\n\nSince the TCNTn and TCMPn registers are activated when enabling the PWM\n(setting TCON auto-reload bit), and are not touched when disabling the\nPWM, the double buffered auto-reload function seems to be still active.\nLowering duty-cycle, and restoring it again in between the enabling and\ndisabling, makes the disable work since it triggers a reload of the\nTCNTn and TCMPn registers.\n\nFix this by securing a reload of the TCNTn and TCMPn registers when\ndisabling the PWM and having a full duty-cycle.\n\nSigned-off-by: Mårten Lindahl <marten.lindahl@axis.com>\n---\n\nv2:\n - Move fix above setting of disabled_mask\n\nv3:\n - Move up definition of __pwm_samsung_manual_update to avoid\n   declaration of the same\n\n drivers/pwm/pwm-samsung.c | 30 ++++++++++++++++++++++--------\n 1 file changed, 22 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c\nindex f6c528f02d43..f660ec2501fd 100644\n--- a/drivers/pwm/pwm-samsung.c\n+++ b/drivers/pwm/pwm-samsung.c\n@@ -117,6 +117,20 @@ static inline unsigned int to_tcon_channel(unsigned int channel)\n \treturn (channel == 0) ? 0 : (channel + 1);\n }\n \n+static void __pwm_samsung_manual_update(struct samsung_pwm_chip *chip,\n+\t\t\t\t      struct pwm_device *pwm)\n+{\n+\tunsigned int tcon_chan = to_tcon_channel(pwm->hwpwm);\n+\tu32 tcon;\n+\n+\ttcon = readl(chip->base + REG_TCON);\n+\ttcon |= TCON_MANUALUPDATE(tcon_chan);\n+\twritel(tcon, chip->base + REG_TCON);\n+\n+\ttcon &= ~TCON_MANUALUPDATE(tcon_chan);\n+\twritel(tcon, chip->base + REG_TCON);\n+}\n+\n static void pwm_samsung_set_divisor(struct samsung_pwm_chip *pwm,\n \t\t\t\t    unsigned int channel, u8 divisor)\n {\n@@ -276,6 +290,13 @@ static void pwm_samsung_disable(struct pwm_chip *chip, struct pwm_device *pwm)\n \ttcon &= ~TCON_AUTORELOAD(tcon_chan);\n \twritel(tcon, our_chip->base + REG_TCON);\n \n+\t/*\n+\t * In case the PWM is at 100% duty cycle, force a manual\n+\t * update to prevent the signal from staying high.\n+\t */\n+\tif (readl(our_chip->base + REG_TCMPB(pwm->hwpwm)) == (u32)-1U)\n+\t\t__pwm_samsung_manual_update(our_chip, pwm);\n+\n \tour_chip->disabled_mask |= BIT(pwm->hwpwm);\n \n \tspin_unlock_irqrestore(&samsung_pwm_lock, flags);\n@@ -284,18 +305,11 @@ static void pwm_samsung_disable(struct pwm_chip *chip, struct pwm_device *pwm)\n static void pwm_samsung_manual_update(struct samsung_pwm_chip *chip,\n \t\t\t\t      struct pwm_device *pwm)\n {\n-\tunsigned int tcon_chan = to_tcon_channel(pwm->hwpwm);\n-\tu32 tcon;\n \tunsigned long flags;\n \n \tspin_lock_irqsave(&samsung_pwm_lock, flags);\n \n-\ttcon = readl(chip->base + REG_TCON);\n-\ttcon |= TCON_MANUALUPDATE(tcon_chan);\n-\twritel(tcon, chip->base + REG_TCON);\n-\n-\ttcon &= ~TCON_MANUALUPDATE(tcon_chan);\n-\twritel(tcon, chip->base + REG_TCON);\n+\t__pwm_samsung_manual_update(chip, pwm);\n \n \tspin_unlock_irqrestore(&samsung_pwm_lock, flags);\n }\n",
    "prefixes": [
        "v3"
    ]
}