Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp2739510ybb; Sat, 30 Mar 2019 12:32:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqx8hOedYoxKkyEpQ4hFbxWcSGlgahGQpaowGVjlQBGUrrk2izZjhtjZzWnvmWfb9sMoc+Oj X-Received: by 2002:a63:190d:: with SMTP id z13mr52130650pgl.432.1553974348085; Sat, 30 Mar 2019 12:32:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553974348; cv=none; d=google.com; s=arc-20160816; b=OGCEFd1L4HI9OTQt6ShfUu0a1dQYJj0tGdUPHbspBOYlmdLcqzpIjbQdNKJ+p8qJj/ 71p9A6oCs8GjYVBpvlWkn4fYvlJ92HzuEm7nIz+e1sMc5zt5mtON2bijMhn6gb3YgRf3 5hHkmL0X1AGsjvnKFpRz0pruUa9MMNYY0vStuQ9d7/vOjywND2noOCWJOr+RhKghPSo7 RuLrPqVJChxFGJpiLAMwselqTnolDtM6w3AQyXza/20wNCPUX87EFA52hT+fMQieWZhH nLjV9UmbO8+1xZ87WWl8E/LcH3ZDNCmZMtiJ28eVduy3ihWogpJgqggfB2/oztWu9BVX XNmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=E3qsfecLL9h7PueF/05aCXUcyy8uC+uxLap7FHg1oLI=; b=J83vCtBJ+9QqYp4qfMxp97azcbzXjd56zflV8r5ttG7QJ8vuHLAcdtYybZLdjV1D9b 7KhJFqcaVY+SuK8B9Ywf3b2zJ6cFEg8Rw9KiJVuvMtBugU7VNZ4IgQs54AuB+434mq1z SK8AU48IkE2tX5GjH7nUUoki+aRijV6YYLgLtQoYJQNl9q2p+0fuE1T9UHarWEgsZAxX RFcyBdFVv7YoXpkiuddjyg99eJMTIMURM8TMFC/n0+jjJmd3RZjb93r3hDGm+Ee86p0H dO864zk0pwNidD605AlWUxL/9IqI5xd/BPwtS7hpaw3zGSKAx0bSLzyA3kDSWcE3ZFfZ JS8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=JJvukiDZ; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i96si5176942plb.322.2019.03.30.12.31.36; Sat, 30 Mar 2019 12:32:28 -0700 (PDT) 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; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=JJvukiDZ; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730924AbfC3T3r (ORCPT + 99 others); Sat, 30 Mar 2019 15:29:47 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:35427 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730815AbfC3T3r (ORCPT ); Sat, 30 Mar 2019 15:29:47 -0400 Received: by mail-oi1-f196.google.com with SMTP id j132so4286607oib.2; Sat, 30 Mar 2019 12:29:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=E3qsfecLL9h7PueF/05aCXUcyy8uC+uxLap7FHg1oLI=; b=JJvukiDZK6piJa7w18mO2Sr0UIic7oHfTfXP5fMDsp7/PadyaGOOoap5p8ZwiT3sjQ eTNuZ3S59vVYnSUnTR2yJXxwsw3wgTY3oU33nS+6GR6b7LwtoJn+xJ+ZQgXabiENAxKb eD1gXPhlVswQUicBcqpBk5Cd6YOlc1oe3fQxK4Cqd1FbaEAKWzkmpBbUlUhd3UbZ5W5k RBah0roUdTOtftkyy5L3M4+/aHwz+WfdSeQxT601t7S6hmQRmr9Z4aHwIh9GHXPPHAzd FBVniLGDkAgrf43FInwns18VVM54dUMVtps+7qUK0TmW0/HwlxQN+9apVVU9d/Yvf5lZ 9OTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=E3qsfecLL9h7PueF/05aCXUcyy8uC+uxLap7FHg1oLI=; b=V9UNlRl6EnJCwuDyG5udFOmrhp2cYMjwJ9qzsHHy72H/Ci/9psFJ6m51vCa7+t3Y5V u/GCpiZzecrGzcqNrT4R5YwRs/VjgdZZlr/c2p07PU92lGcfczFHziccUfGNxqgzEXul X4etiWzWGvP4ixpFamIabjZjrVKA99ZbtXHL5yEcXDA9ztSkh9A4ReaKPaVOhlTOhKyQ b/WRJ91XqRBVqDfCrTYZjZmRXBl1bZ7Dl0bKrZowRgKdBqfEMK6hDV3wZl241J2zKxgf cjHLVsDn0u7GdlYZWEMg/0/fVOJfdx8XOsOIgkItVSh6jQoB8znaJ3hafMG67XIKqn/t 8LvQ== X-Gm-Message-State: APjAAAV9RZESytqrxknHyylhoFHZknUeMGkPh7LIipznHcg1uZLhO8pW TLla3D1GW2HShLvPuJGLhdj9soGq2NFQ2M2c3Xk= X-Received: by 2002:aca:4482:: with SMTP id r124mr2147683oia.39.1553974186198; Sat, 30 Mar 2019 12:29:46 -0700 (PDT) MIME-Version: 1.0 References: <20190324220217.15813-1-martin.blumenstingl@googlemail.com> <20190325084153.l44pzfewcqlkoaoe@pengutronix.de> <20190325200730.cx73jgxfexz6ybzq@pengutronix.de> In-Reply-To: <20190325200730.cx73jgxfexz6ybzq@pengutronix.de> From: Martin Blumenstingl Date: Sat, 30 Mar 2019 20:29:35 +0100 Message-ID: Subject: Re: [PATCH 0/1] pwm: meson: fix scheduling while atomic issue To: =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= Cc: thierry.reding@gmail.com, Neil Armstrong , jbrunet@baylibre.com, linux-pwm@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Uwe, On Mon, Mar 25, 2019 at 9:07 PM Uwe Kleine-K=C3=B6nig wrote: [...] > > > - Does stopping the PWM (i.e. clearing MISC_{A,B}_EN in the MISC_AB > > > register) freeze the output, or is the currently running period > > > completed first? (The latter is the right behaviour.) > > I don't know, I would have to measure this with a logic analyzer. > > In practise you can do this with a multimeter, too. Just do something > like: > > pwm_apply_state({ .enabled =3D true, .period =3D 5s, .duty_cycle = =3D 5s, .polarity =3D PWM_POLARITY_NORMAL }); > pwm_apply_state({ .enabled =3D false, .period =3D 5s, .duty_cycle= =3D 5s, .polarity =3D PWM_POLARITY_NORMAL }); > > (assuming the PWM supports periods that long). The expectation is that > the last command takes nearly 5 s to complete and while it waits the > output is high and on return it's low. If that isn't the case, there is > a bug somewhere. the longest supported period (using the 24MHz crystal as input, which is the slowest input clock and thus gives the longest possible duration) is 349514407ns (that's approx. 0.35 seconds). my multimeter isn't fast enough to measure this so I'm using my logic analyzer with puleseview instead: [0] I added the following code to meson_pwm_request: struct pwm_state enable =3D { .enabled =3D true, .period =3D 349514407U, .duty_cycle =3D 349514407U, .polarity =3D PWM_POLARITY_NORMAL }; struct pwm_state disable =3D { .enabled =3D false, .period =3D 349514407U, .duty_cycle =3D 349514407U, .polarity =3D PWM_POLARITY_NORMAL }; pwm_apply_state(pwm, &enable); pwm_apply_state(pwm, &disable); this returns immediately. my logic analyzer doesn't see signal change (I'm sampling at 1MHz). can you please confirm that my test code and measurement procedure is corre= ct? if it is then my observation is that disabling the PWM does so immediately, without waiting for the current period to complete Regards Martin [0] https://sigrok.org/wiki/Lcsoft_Mini_Board