Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp622339imu; Thu, 13 Dec 2018 01:20:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/XZzLVBwyOOowaORsitbVgatNu+sFg2fhtVFPfJG+YSL8mtdIdZB3wWOTQ+PZCMkmaMyigN X-Received: by 2002:a63:ce08:: with SMTP id y8mr20941239pgf.388.1544692822463; Thu, 13 Dec 2018 01:20:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544692822; cv=none; d=google.com; s=arc-20160816; b=uorF32ibH7Dku2GiLElS9JPbtCf1wYgJDsVe+WjY9iY0/4z6vdcHP21saV7tzLKbQV vofeiCCVfiIdGkcyOyEnPmUbmmncU25fbvLoXm+R39xnBlDqO60a2RCp+CP3MSspDz7w L5f5V5SJuyD8JspEnKGTgScyhLjZh4RpNNm4R33KcPKDBxArrszfIQUrlCnIikrnV9Lb 919DpbKnczVnzVD7ZZCs49XypRl8y++LI63Kki+oFl4jtId/VbMcH+nxgXcIR8bQ3bLZ 7Fcl+9RAtn+JFdBftjjD9zGQUv7FK15iG96W+dRYD9jhjMjbU2l9niyzRdEbs5HxGsmg 1FTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=wxLz0DpwL+/4cqygGXEayAUH9g25lnmc+1nBzon+Jow=; b=hMDj4FRqfPn0EKVRs3H2/9btxHjVf/jyvHQkWiUga3xCIGTja9xtEkyMbU588WlS/e ulpKVMX8sRqFMLAnFkbBU9EQQEuaj7/zVyqo7KJwgO9tkMW0bUMC6fclSVz2aUItMBaL PmP9v0aAgQcDVZdFrHCjbB4XRTc4flquDx9IDXbu9gxdKcGwCerTAwy4t0PfcwdPcwDA UqidCI/n3mr1yczyZx5bZ383MMGWHS7J7yspUcx3bT3dLAC1+lgtCjevf3BmoRfNdt4K AjvJqGjosjypkCWdcP5YWoSyqYh6Bm9R3r4mH/gCAnNuyfutaS8haOg3QfIw1NS5xa3x gqvg== 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 d10si1115593pgf.136.2018.12.13.01.20.07; Thu, 13 Dec 2018 01:20:22 -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 S1727969AbeLMJSi (ORCPT + 99 others); Thu, 13 Dec 2018 04:18:38 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:41515 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727194AbeLMJSg (ORCPT ); Thu, 13 Dec 2018 04:18:36 -0500 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gXN8T-0005Yl-Ns; Thu, 13 Dec 2018 10:18:25 +0100 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1gXN8Q-0005wl-CR; Thu, 13 Dec 2018 10:18:22 +0100 Date: Thu, 13 Dec 2018 10:18:22 +0100 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Paul Cercueil Cc: Thierry Reding , Rob Herring , Mark Rutland , Daniel Lezcano , Thomas Gleixner , Ralf Baechle , Paul Burton , James Hogan , Jonathan Corbet , Mathieu Malaterre , Ezequiel Garcia , PrasannaKumar Muralidharan , linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-mips@vger.kernel.org, linux-doc@vger.kernel.org, linux-clk@vger.kernel.org, od@zcrc.me Subject: Re: [PATCH v8 12/26] pwm: jz4740: Allow selection of PWM channels 0 and 1 Message-ID: <20181213091822.r5ilpsllfhzaiqw4@pengutronix.de> References: <20181212220922.18759-1-paul@crapouillou.net> <20181212220922.18759-13-paul@crapouillou.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20181212220922.18759-13-paul@crapouillou.net> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 12, 2018 at 11:09:07PM +0100, Paul Cercueil wrote: > The TCU channels 0 and 1 were previously reserved for system tasks, and > thus unavailable for PWM. > > The driver will now only allow a PWM channel to be requested if memory > resources corresponding to the register area of the channel were > supplied to the driver. This allows the TCU channels to be reserved for > system tasks from within the devicetree. > > Signed-off-by: Paul Cercueil While there is someone caring for this driver I'd like to complete (a bit) my picture about the different capabilities and specialities of the supported PWMs. So I have a few questions: Is there a publicly available reference manual for this device? (If yes, adding a link to the driver would be great.) jz4740_pwm_config looks as if the currently running period isn't completed before the new config is in effect. Is that correct? If yes, can this be fixed? A similar question for set_polarity: Does setting the JZ_TIMER_CTRL_PWM_ACTIVE_LOW bit in the control register take effect immediately or is this shadowed until the next period starts? How does the device's output behave after the PWM is disabled? Does it complete the currently running period? How does the output behave then? (active/inactive/high/low/high-z?) > @@ -42,11 +68,7 @@ static int jz4740_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) > char clk_name[16]; > int ret; > > - /* > - * Timers 0 and 1 are used for system tasks, so they are unavailable > - * for use as PWMs. > - */ > - if (pwm->hwpwm < 2) > + if (!jz4740_pwm_can_use_chn(jz, pwm->hwpwm)) > return -EBUSY; Maybe EBUSY isn't the best choice here. If the needed register space for the requested pwm is not included in the memory resources provided to the device I'd prefer ENXIO or ENODEV. > snprintf(clk_name, sizeof(clk_name), "timer%u", pwm->hwpwm); > @@ -208,6 +230,12 @@ static int jz4740_pwm_probe(struct platform_device *pdev) > return -EINVAL; > } > > + jz4740->parent_res = platform_get_resource( > + to_platform_device(dev->parent), > + IORESOURCE_MEM, 0); > + if (!jz4740->parent_res) > + return -EINVAL; > + > jz4740->chip.dev = dev; > jz4740->chip.ops = &jz4740_pwm_ops; > jz4740->chip.npwm = NUM_PWM; Thanks Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |