Received: by 10.223.185.116 with SMTP id b49csp3557696wrg; Mon, 26 Feb 2018 01:59:19 -0800 (PST) X-Google-Smtp-Source: AH8x226lIvvWnVOum/BCFr1GJddObYpQGgcjbuX6/ueq6JHtRupQm0d5YDKj4wSn7QFAWJCSv7vc X-Received: by 10.98.93.87 with SMTP id r84mr10056982pfb.131.1519639159015; Mon, 26 Feb 2018 01:59:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519639158; cv=none; d=google.com; s=arc-20160816; b=rfR99PLN2EAfeTd3nfDUAEjWRkNrnw1CK1SWAh+DLNAbQ7AbTVcwBvZRu5aRn7wYOB VHd7CVUCX8z+LKh+h9K65kgcDJIlNqid/TUYbYTuVj+zJ0iCDkjNlHgm5wGcDyNBBg9p 5kg7mzxpeKAliwn427P59sUYXn9UV9Y/tXPR7gPIPZ+tsmwJXLq3rVTE7eN6fTjI8tYO fuMBKxXYgRiuDjs49lLmGAiQdKMADOkBzhJ1EzWQrLxfmfxtSQJJNuNp13dBsmYBki59 m4D6lpGLGJt2iG9jERVMJqsbSu+UvvLyuswGtk3Kwui5Nw07LrPB53TrORKi5QS3SFwH odrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from :arc-authentication-results; bh=ygD7pEmHqr88XkdgDnWURFQF1Gx/sqmu6oMDBwAoVL8=; b=jCgYx4w1MTxqr2M0Z7FNvMknNIJUoKeGnqu8QB1Km3Ls1JwMLxm4Vs0QZq5UANAHE5 lxX3q0NMwent3H1tWS6UbA4QJzyK6lrWiulWCiqMFkPg/WevKSjOYS0RdO0llapLD12k 9iAwVTTnYAKiCmsgTID5FOkxXSYu9pKOVM5kQO2me5XIwyUOKHd3VN8OuvMNSWmOkfQi 63NuVUDc2b8uTt9yJHvKFGrFm8/Om2FUPmW1zYHkiRxTYuOWKVJob2HepgNAUzPIKOZf JkSYAtnWDZVdd2shqMeZfDIBOy/N76iGVuRukYgm2zF+OV2HqEGaukBNbUtiF6k/UV2m ZOQQ== 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 r7si6513892pfg.30.2018.02.26.01.59.05; Mon, 26 Feb 2018 01:59:18 -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 S1752668AbeBZJ5s (ORCPT + 99 others); Mon, 26 Feb 2018 04:57:48 -0500 Received: from mga01.intel.com ([192.55.52.88]:19168 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752402AbeBZJ5m (ORCPT ); Mon, 26 Feb 2018 04:57:42 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2018 01:57:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,396,1515484800"; d="scan'208";a="33645589" Received: from ederpatr-mobl.ger.corp.intel.com (HELO localhost) ([10.249.35.171]) by fmsmga001.fm.intel.com with ESMTP; 26 Feb 2018 01:57:26 -0800 From: Jani Nikula To: Daniel Thompson , Claudiu Beznea Cc: thierry.reding@gmail.com, shc_work@mail.ru, kgene@kernel.org, krzk@kernel.org, linux@armlinux.org.uk, mturquette@baylibre.com, sboyd@codeaurora.org, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, airlied@linux.ie, kamil@wypas.org, b.zolnierkie@samsung.com, jdelvare@suse.com, linux@roeck-us.net, dmitry.torokhov@gmail.com, rpurdie@rpsys.net, jacek.anaszewski@gmail.com, pavel@ucw.cz, mchehab@kernel.org, sean@mess.org, lee.jones@linaro.org, jingoohan1@gmail.com, milo.kim@ti.com, robh+dt@kernel.org, mark.rutland@arm.com, corbet@lwn.net, nicolas.ferre@microchip.com, alexandre.belloni@free-electrons.com, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-hwmon@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, linux-media@vger.kernel.org, linux-fbdev@vger.kernel.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org Subject: Re: [PATCH v3 05/10] pwm: add PWM mode to pwm_config() In-Reply-To: <20180222123308.mypx2r7n6o63mj5z@oak.lan> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <1519300881-8136-1-git-send-email-claudiu.beznea@microchip.com> <1519300881-8136-6-git-send-email-claudiu.beznea@microchip.com> <20180222123308.mypx2r7n6o63mj5z@oak.lan> Date: Mon, 26 Feb 2018 11:57:25 +0200 Message-ID: <87po4s2hve.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 22 Feb 2018, Daniel Thompson wrote: > On Thu, Feb 22, 2018 at 02:01:16PM +0200, Claudiu Beznea wrote: >> Add PWM mode to pwm_config() function. The drivers which uses pwm_config() >> were adapted to this change. >> >> Signed-off-by: Claudiu Beznea >> --- >> arch/arm/mach-s3c24xx/mach-rx1950.c | 11 +++++++++-- >> drivers/bus/ts-nbus.c | 2 +- >> drivers/clk/clk-pwm.c | 3 ++- >> drivers/gpu/drm/i915/intel_panel.c | 17 ++++++++++++++--- >> drivers/hwmon/pwm-fan.c | 2 +- >> drivers/input/misc/max77693-haptic.c | 2 +- >> drivers/input/misc/max8997_haptic.c | 6 +++++- >> drivers/leds/leds-pwm.c | 5 ++++- >> drivers/media/rc/ir-rx51.c | 5 ++++- >> drivers/media/rc/pwm-ir-tx.c | 5 ++++- >> drivers/video/backlight/lm3630a_bl.c | 4 +++- >> drivers/video/backlight/lp855x_bl.c | 4 +++- >> drivers/video/backlight/lp8788_bl.c | 5 ++++- >> drivers/video/backlight/pwm_bl.c | 11 +++++++++-- >> drivers/video/fbdev/ssd1307fb.c | 3 ++- >> include/linux/pwm.h | 6 ++++-- >> 16 files changed, 70 insertions(+), 21 deletions(-) >> >> diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c >> index 2030a6b77a09..696fa25dafd2 100644 >> --- a/drivers/video/backlight/lm3630a_bl.c >> +++ b/drivers/video/backlight/lm3630a_bl.c >> @@ -165,8 +165,10 @@ static void lm3630a_pwm_ctrl(struct lm3630a_chip *pchip, int br, int br_max) >> { >> unsigned int period = pchip->pdata->pwm_period; >> unsigned int duty = br * period / br_max; >> + struct pwm_caps caps = { }; >> >> - pwm_config(pchip->pwmd, duty, period); >> + pwm_get_caps(pchip->pwmd->chip, pchip->pwmd, &caps); >> + pwm_config(pchip->pwmd, duty, period, BIT(ffs(caps.modes) - 1)); > > Well... I admit I've only really looked at the patches that impact > backlight but dispersing this really odd looking bit twiddling > throughout the kernel doesn't strike me a great API design. > > IMHO callers should not be required to find the first set bit in > some specially crafted set of capability bits simply to get sane > default behaviour. Agreed. IMHO the regular use case becomes rather tedious, ugly, and error prone. BR, Jani. -- Jani Nikula, Intel Open Source Technology Center