Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2769108ybh; Mon, 9 Mar 2020 12:36:33 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtn9lSbO3TjJ58PNIm/AdhU3IgxlIHagGIYXRaT63MGJFwu4o0DB3tqhfVtyYUzFg14Sega X-Received: by 2002:aca:be57:: with SMTP id o84mr622732oif.138.1583782593395; Mon, 09 Mar 2020 12:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583782593; cv=none; d=google.com; s=arc-20160816; b=sdJ6kdEVxgdv8Q4HYzKzcs1qWQMVUHYb4BKngk23MBEucwNQTf6EkzFgNwHmW6gVpX Qu+SE87Sn3VIvmecQXVxlgS07Kz50+HuaFKErgpRs4tRtq+KIZ4PohJuY7ddejJNCIsr EzfRYjD/z8/t4LbYawK0l8Oim67R6rdXuEHbchK5mlLp5wFZ9N1Dw6YnpEPKPWKjWhvW f8uBBL9ezYvVf5s2/CWeuC3K8PQo6t1FkXRm+GmgKqwqhpXR6dk/xxl6jcsk449jBK53 IZCC1NzEXb5UKQDYf/N8JbwZ2G+O7MhkDelnVYRBwgVkJki3ImOmM0epkK7Tb9WIkdar j1QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from; bh=BfRuv1OGcTnlpfQe2fgiPQZN8ZvugmDRa5KpVMqYa3k=; b=xDGu/BUNyunqIlEcGZxnacIBw9HbNKrGphSJfJutaXHeo0Qq4HeBbOtiDklhcTa+as 9BZ+LxTep5wqv7pOaU7j2ETIz0bb0EnpsUNGKzxhJTOl9cKeq7bwtwmN9Bx8dKDh/Eux qb/rVC7C4LSpex6Wl4sKoCAZZ9XYyaVpp/WiwF0BnM28QV0ZugiNLYk2KCXuWcf4YAII ZLC/FM53/WPSY/8K4s7252yclCEFasopjHx2yVpGqg6GuguVCnFwetu5OhLNV9SroAua zXsCb/GLkrWkmnO+26NeftkfE8BO59I3cVHrcjcpcf/E/aQPNKhb3VOy39YM+bXFj/ZJ 57SA== 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 l15si4668122oic.220.2020.03.09.12.36.21; Mon, 09 Mar 2020 12:36:33 -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; 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 S1726682AbgCITfa (ORCPT + 99 others); Mon, 9 Mar 2020 15:35:30 -0400 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:22361 "EHLO alexa-out-sd-02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726461AbgCITfY (ORCPT ); Mon, 9 Mar 2020 15:35:24 -0400 Received: from unknown (HELO ironmsg05-sd.qualcomm.com) ([10.53.140.145]) by alexa-out-sd-02.qualcomm.com with ESMTP; 09 Mar 2020 12:35:21 -0700 Received: from gurus-linux.qualcomm.com ([10.46.162.81]) by ironmsg05-sd.qualcomm.com with ESMTP; 09 Mar 2020 12:35:21 -0700 Received: by gurus-linux.qualcomm.com (Postfix, from userid 383780) id 43E1B4973; Mon, 9 Mar 2020 12:35:21 -0700 (PDT) From: Guru Das Srinagesh To: linux-pwm@vger.kernel.org Cc: Thierry Reding , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Subbaraman Narayanamurthy , linux-kernel@vger.kernel.org, Guru Das Srinagesh , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org Subject: [PATCH v7 12/13] backlight: pwm_bl: Use 64-bit division macros for period and duty cycle Date: Mon, 9 Mar 2020 12:35:15 -0700 Message-Id: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Because period and duty cycle are defined in the PWM framework structs as ints with units of nanoseconds, the maximum time duration that can be set is limited to ~2.147 seconds. Redefining them as u64 values will enable larger time durations to be set. As a first step, prepare drivers to handle the switch to u64 period and duty_cycle by replacing division operations involving pwm period and duty cycle with their 64-bit equivalents as appropriate. The actual switch to u64 period and duty_cycle follows as a separate patch. Where the dividend is 64-bit but the divisor is 32-bit, use *_ULL macros: - DIV_ROUND_UP_ULL - DIV_ROUND_CLOSEST_ULL - div_u64 Where the divisor is 64-bit (dividend may be 32-bit or 64-bit), use DIV64_* macros: - DIV64_U64_ROUND_CLOSEST - div64_u64 Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Cc: Bartlomiej Zolnierkiewicz Cc: linux-pwm@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Cc: linux-fbdev@vger.kernel.org Signed-off-by: Guru Das Srinagesh --- drivers/video/backlight/pwm_bl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index efb4efc..3e5dbcf 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -625,7 +625,8 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->scale = data->max_brightness; } - pb->lth_brightness = data->lth_brightness * (state.period / pb->scale); + pb->lth_brightness = data->lth_brightness * (div_u64(state.period, + pb->scale)); props.type = BACKLIGHT_RAW; props.max_brightness = data->max_brightness; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project