From patchwork Mon Oct 5 06:08:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 526246 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3B58414090A for ; Mon, 5 Oct 2015 17:08:48 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=ffCLgr0o; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751121AbbJEGIr (ORCPT ); Mon, 5 Oct 2015 02:08:47 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:34203 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751083AbbJEGIq (ORCPT ); Mon, 5 Oct 2015 02:08:46 -0400 Received: by wicfx3 with SMTP id fx3so103448199wic.1; Sun, 04 Oct 2015 23:08:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=hWO/Xe1oc0/Ojr0aivtzIK6hWOMFcvWDYNw9egQFytc=; b=ffCLgr0o8i0KJ78jNEGP6bnFxprplhQ38oUdzKk5daYfYQHJW/CXoD5421RSomTmVt QMHuPm8hOBDVYhmy51C9HtWaCIQH267t+k0vtzNTVN9ZXFh9YAJEQ5NPN+oIcvEj9t14 JroJNCF9uCCUzYjpV1QeEnp6/qpNJHbDd7kBFAo3AT2S9OYdKHtI19QAvRysKv9UrrjA lBEQ0akS2gYqf+mlbLEU9bUQO3L1M7k1FX4nillK09SMK5LWN+1rklhsqFFFidsLhhNK I7BNyzpfFTM888o5GIFxV5vADssOg2NQb6GiyWsnBVYYSWyJADEBoTTIRsME2Km+5fYI 4d0Q== X-Received: by 10.194.88.74 with SMTP id be10mr26944244wjb.67.1444025325294; Sun, 04 Oct 2015 23:08:45 -0700 (PDT) Received: from localhost (port-1848.pppoe.wtnet.de. [84.46.7.63]) by smtp.gmail.com with ESMTPSA id r9sm24973183wjz.35.2015.10.04.23.08.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Oct 2015 23:08:44 -0700 (PDT) From: Thierry Reding To: Guan Xuetao Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, Thierry Reding Subject: [PATCH] unicore32: nb0916: Use PWM lookup table Date: Mon, 5 Oct 2015 08:08:43 +0200 Message-Id: <1444025323-23904-1-git-send-email-thierry.reding@gmail.com> X-Mailer: git-send-email 2.5.0 Sender: linux-pwm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pwm@vger.kernel.org Use a PWM lookup table to provide the PWM to the pwm-backlight device. The driver has a legacy code path that is required only because boards still use the legacy method of requesting PWMs by global ID. Replacing these usages allows that legacy fallback to be removed. Cc: Guan Xuetao Signed-off-by: Thierry Reding --- arch/unicore32/kernel/puv3-nb0916.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/unicore32/kernel/puv3-nb0916.c b/arch/unicore32/kernel/puv3-nb0916.c index 46ebfdccbc31..af3962d90def 100644 --- a/arch/unicore32/kernel/puv3-nb0916.c +++ b/arch/unicore32/kernel/puv3-nb0916.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -49,8 +50,12 @@ static struct resource puv3_i2c_resources[] = { } }; +static struct pwm_lookup nb0916_pwm_lookup[] = { + PWM_LOOKUP("PKUnity-v3-PWM", 0, "pwm-backlight", NULL, 0, + PWM_POLARITY_NORMAL), +}; + static struct platform_pwm_backlight_data nb0916_backlight_data = { - .pwm_id = 0, .max_brightness = 100, .dft_brightness = 100, .pwm_period_ns = 70 * 1024, @@ -112,6 +117,8 @@ int __init mach_nb0916_init(void) platform_device_register_simple("PKUnity-v3-I2C", -1, puv3_i2c_resources, ARRAY_SIZE(puv3_i2c_resources)); + pwm_add_table(nb0916_pwm_lookup, ARRAY_SIZE(nb0916_pwm_lookup)); + platform_device_register_data(NULL, "pwm-backlight", -1, &nb0916_backlight_data, sizeof(nb0916_backlight_data));