From patchwork Mon Jun 1 06:51:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11581469 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4315860D for ; Mon, 1 Jun 2020 06:52:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 212462076B for ; Mon, 1 Jun 2020 06:52:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aAgWshPn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 212462076B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF6AB6E060; Mon, 1 Jun 2020 06:52:20 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by gabe.freedesktop.org (Postfix) with ESMTPS id CCC2F6E07B for ; Mon, 1 Jun 2020 06:52:19 +0000 (UTC) Received: by mail-lf1-x142.google.com with SMTP id w15so3272940lfe.11 for ; Sun, 31 May 2020 23:52:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1eeMoKxAzqRLfG82D7/NnXCikugDW+fdpYxngSA6iFI=; b=aAgWshPneNtHmvHZbOwLSMACJLA/eyikM9LREx0iVbyS5NGKrOEOP2hPXuVAKYHQL7 mENPh0g/Z2u1Vu+ikgWrRmUu/xXwS00twheq0sTee++UxWHOyY7mfWxFxu3EZSIejxQ7 I6LzBW/OO9PrLK24/JMwaUQzDF4fgYdVU9brt1pEtGlq4yk7qocwJ65H2bBwwory75IK MLa0kPOebSLE+HCR8R1L3LQY0SPPbegvpSfVkC8oDwNpZplt7eIYKJSUSjpnh0dMZpOS 0YSA0sZRHRshNqmk2nPd+AbkN8RdTed1so3OzYp0em5688mOo4IRV0/BFLNRXP3TnKCm T9+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=1eeMoKxAzqRLfG82D7/NnXCikugDW+fdpYxngSA6iFI=; b=XUYnK/jIEAlv79Wi1irdSSziQdsF+NUtWMTI6K3Hiv3L6oFROWzOYQSj7b/+s+kBef 7PWrHM715waFaI9gMmJihnitQIOwwk5AiXp/0tsWxJ+9r0F0WL9LgVYS70LrH8f7hA0q IJNFPyUD2AVVYIrP96M/8YILCm4Cv+hraz35sRoli3s5y+090+bl1AOrLIV5O55iDNOF 22iNNnMPcpw1l6k8IUfhZtVaZrFOSxzPA5H+hukbFSJdJkL5ce1bKLFzB0nJxBktIH6j DfQS8o6gW2YDvvQ6KMkyxG4SPtelHBSfAYxwOZj08BEQukMeplJMaYrLWfgPJVPhLyYY 12eQ== X-Gm-Message-State: AOAM532pKIekgdjbNBdFCd9hcG8DGvM/OR6T4nY6DlXaqp920GiTaEzn jwSuXghqv42rZX0Unxq25AC/bAHNm/Q= X-Google-Smtp-Source: ABdhPJyFSkTjFfWMMJZinRAJ4OlypddpujAqkuiCerdpn5kIaB5I3o/t8Iy1sv1JBlw6uJwWJTzuoA== X-Received: by 2002:ac2:4886:: with SMTP id x6mr10335237lfc.198.1590994338004; Sun, 31 May 2020 23:52:18 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:281d:a604:434c:a58d]) by smtp.gmail.com with ESMTPSA id e13sm2540462ljl.117.2020.05.31.23.52.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 23:52:17 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v3 01/13] backlight: refactor fb_notifier_callback() Date: Mon, 1 Jun 2020 08:51:55 +0200 Message-Id: <20200601065207.492614-2-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601065207.492614-1-sam@ravnborg.org> References: <20200601065207.492614-1-sam@ravnborg.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, Support Opensource , Michael Hennerich , Bartlomiej Zolnierkiewicz , David Airlie , Daniel Vetter , Tomi Valkeinen , Jonathan Corbet , Emil Velikov , Bjorn Andersson , Peter Ujfalusi , Andy Gross , Thierry Reding , Thomas Zimmermann , linux-arm-msm@vger.kernel.org, Uwe Kleine-Konig , Sam Ravnborg , patches@opensource.cirrus.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Increase readability of fb_notifier_callback() by removing a few indent levels. No functional change. Signed-off-by: Sam Ravnborg Reviewed-by: Daniel Thompson Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- drivers/video/backlight/backlight.c | 43 +++++++++++++++-------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index cac3e35d7630..17f04cff50ab 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -58,28 +58,29 @@ static int fb_notifier_callback(struct notifier_block *self, bd = container_of(self, struct backlight_device, fb_notif); mutex_lock(&bd->ops_lock); - if (bd->ops) - if (!bd->ops->check_fb || - bd->ops->check_fb(bd, evdata->info)) { - fb_blank = *(int *)evdata->data; - if (fb_blank == FB_BLANK_UNBLANK && - !bd->fb_bl_on[node]) { - bd->fb_bl_on[node] = true; - if (!bd->use_count++) { - bd->props.state &= ~BL_CORE_FBBLANK; - bd->props.fb_blank = FB_BLANK_UNBLANK; - backlight_update_status(bd); - } - } else if (fb_blank != FB_BLANK_UNBLANK && - bd->fb_bl_on[node]) { - bd->fb_bl_on[node] = false; - if (!(--bd->use_count)) { - bd->props.state |= BL_CORE_FBBLANK; - bd->props.fb_blank = fb_blank; - backlight_update_status(bd); - } - } + + if (!bd->ops) + goto out; + if (bd->ops->check_fb && !bd->ops->check_fb(bd, evdata->info)) + goto out; + + fb_blank = *(int *)evdata->data; + if (fb_blank == FB_BLANK_UNBLANK && !bd->fb_bl_on[node]) { + bd->fb_bl_on[node] = true; + if (!bd->use_count++) { + bd->props.state &= ~BL_CORE_FBBLANK; + bd->props.fb_blank = FB_BLANK_UNBLANK; + backlight_update_status(bd); + } + } else if (fb_blank != FB_BLANK_UNBLANK && bd->fb_bl_on[node]) { + bd->fb_bl_on[node] = false; + if (!(--bd->use_count)) { + bd->props.state |= BL_CORE_FBBLANK; + bd->props.fb_blank = fb_blank; + backlight_update_status(bd); } + } +out: mutex_unlock(&bd->ops_lock); return 0; } From patchwork Mon Jun 1 06:51:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11581473 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 85B0F60D for ; Mon, 1 Jun 2020 06:52:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 640992076B for ; Mon, 1 Jun 2020 06:52:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="e2Fj5Mog" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 640992076B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B515B6E072; Mon, 1 Jun 2020 06:52:23 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 23A886E072 for ; Mon, 1 Jun 2020 06:52:22 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id s1so6785483ljo.0 for ; Sun, 31 May 2020 23:52:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=18JbutLa3sEGZU8ji80y4T0HOoe/GimoCUZDbVyKY0E=; b=e2Fj5MogkKmmlicpZQIOcwOKcfsndqV5JSgZlnOJPZKp5N41Qkoah2I5L+kq+0n5xH 3wTRhIuHGWcFmhJecE6nLFQQEAgNEn0P5D72ORGOutadmzwdvFMXCoQlxfbmN+Myklzl rguVPFRYjbKEkUFrlPWeF5147m7T/7ELoYom48Fdu1C/F1qH4wKFR76529LX2cTBtgDz J5NlM9AJ/0Z7WJGmQPmbZ/x5QYxm5SBp2RdyIl0DAAuuUC7YBSK/2J2uKFoL0ntMGdnK dHZ/3Wy/+sVKJtZtQe2kQ67mTFb5aOlSC8FdrBm5kiY5ybts/i67pwFqK7AJm3E0cJYN 1jfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=18JbutLa3sEGZU8ji80y4T0HOoe/GimoCUZDbVyKY0E=; b=oapwzuK9LK913tBGOr6iXJPHz4yxcC8SEUHyX+nIylkLDnUkPCFJgefsA2C77xEmKH tgV51TwVDtjbCROX6vYawxdMcofObrB2ErT95JNbJRBIdAuH7ho8gmpfiGoz2vP1qQKt xRRGD/y1rv4b9CPUmCG1ftvild/+OCM7ClUiXCz6KyG6HCgK3IxKtVXXMfMEiy0F/Xtr cv4HJyGyW5n88ykhoKNhM69iKVeRRQ3lxFZ//i3IyKAsnf2ArUl2vkGSy5IApLqGvDXX BZCNY5TrK1kGIFvkHhZViFIBSStlUAzvseoiiEMVqnhgt1mm2jJ/Pn0ocSQI0hf9ntIW F2ww== X-Gm-Message-State: AOAM530HjPFN6XS2Bpr/rQHk9BZWGuiHoS1S+5bSjttIEqu7R1cqTnsB uzvQu1QzSzkE2YK65DOHEczkijDMPuE= X-Google-Smtp-Source: ABdhPJzTmzfyLe20++Ve5cRFiyoAQagMqwFVvs32L/FlmdwyctEw1qWH+8aNS3DXRsegMEk3+htxXg== X-Received: by 2002:a2e:4612:: with SMTP id t18mr4691823lja.212.1590994340242; Sun, 31 May 2020 23:52:20 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:281d:a604:434c:a58d]) by smtp.gmail.com with ESMTPSA id e13sm2540462ljl.117.2020.05.31.23.52.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 23:52:19 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v3 02/13] backlight: add backlight_is_blank() Date: Mon, 1 Jun 2020 08:51:56 +0200 Message-Id: <20200601065207.492614-3-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601065207.492614-1-sam@ravnborg.org> References: <20200601065207.492614-1-sam@ravnborg.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, Support Opensource , Michael Hennerich , Bartlomiej Zolnierkiewicz , David Airlie , Daniel Vetter , Tomi Valkeinen , Jonathan Corbet , Emil Velikov , Bjorn Andersson , Peter Ujfalusi , Andy Gross , Thierry Reding , Thomas Zimmermann , linux-arm-msm@vger.kernel.org, Uwe Kleine-Konig , Sam Ravnborg , patches@opensource.cirrus.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The backlight support has two properties that express the state: - power - state It is un-documented and easy to get wrong. Add backlight_is_blank() helper to make it simpler for drivers to get the check of the state correct. A lot of drivers also includes checks for fb_blank. This check is redundant when the state is checked and thus not needed in this helper function. But added anyway to avoid introducing subtle bugs due to the creative use of fb_blank in some drivers. Introducing this helper will for some drivers results in added support for fb_blank. This will be a change in functionality, which will improve the backlight driver. Rolling out this helper to all relevant backlight drivers will eliminate almost all accesses to fb_blank. v3: - Clarified that the fb_blank support in backlight_is_blank() may result in functionality changes for the users (Emil) v2: - Added fb_blank condition (Daniel) Signed-off-by: Sam Ravnborg Reviewed-by: Daniel Thompson Cc: Emil Velikov Cc: Daniel Vetter Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Reviewed-by: Peter Ujfalusi --- include/linux/backlight.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index c7d6b2e8c3b5..a0a083b35c47 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -175,6 +175,25 @@ static inline void backlight_put(struct backlight_device *bd) put_device(&bd->dev); } +/** + * backlight_is_blank - Return true if display is expected to be blank + * @bd: the backlight device + * + * Display is expected to be blank if any of these is true:: + * + * 1) if power in not UNBLANK + * 2) if fb_blank is not UNBLANK + * 3) if state indicate BLANK or SUSPENDED + * + * Returns true if display is expected to be blank, false otherwise. + */ +static inline bool backlight_is_blank(struct backlight_device *bd) +{ + return bd->props.power != FB_BLANK_UNBLANK || + bd->props.fb_blank != FB_BLANK_UNBLANK || + bd->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK); +} + extern struct backlight_device *backlight_device_register(const char *name, struct device *dev, void *devdata, const struct backlight_ops *ops, const struct backlight_properties *props); From patchwork Mon Jun 1 06:51:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11581477 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D1E45913 for ; Mon, 1 Jun 2020 06:52:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B06CA206E2 for ; Mon, 1 Jun 2020 06:52:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lHZrAwhU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B06CA206E2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3D5B96E07B; Mon, 1 Jun 2020 06:52:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 667A76E0F7 for ; Mon, 1 Jun 2020 06:52:24 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id s1so6785589ljo.0 for ; Sun, 31 May 2020 23:52:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8Sfwu+QYJQXZ27WkGs9nXQTR3LioIzX0uzeUzjF2u24=; b=lHZrAwhUA9ZqnUgZgH1Uy8rPayRa8+BTvae7rSKE/cCa3u7kO5sWAq9xUYPl0Ke4Lr vtDnJ1QOX71BFFBG5IEiRda0pFP45GOr3rfOevTOf9dGjdPIpA6cODMDfRiVJDAFm2lw UETyEg7wFFOygA5/Owq7S0CRF3F4MUgfoQ1/DRA1h5zh6N0f0FxGTw0jREkc97L4dv89 8rMTLcspJBO5HBc/Sq6UjpCZ6GmIe8Bf7qyAAc05F7sFfSlSig6c1xhbprA0T+smHr2K kIru4fB5iXgftMdzZFZNSIm1AFAk8biSle6XgWDB7HU7moXWhSB/qddLZJLDgGpQP1Qi t3bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8Sfwu+QYJQXZ27WkGs9nXQTR3LioIzX0uzeUzjF2u24=; b=uAwKNf7q88yJNWQi5APAR6DkspKhCo+kbbEuM643sAB8D2JtRN5KeI7Ch7ousWIWMU eSGFoIt5LPHw4oe6U3cPdxPTyvXdfz6noio6MyzjR5EhTAFwTrKkaosxq5qN9oW2Q8nH ShX6s1kzUdpiSUYhpwZrI2IHuMgF8SbJpUbzooogRN43ECy5kaABC12WIbKRdmyDD951 /1CizDnYQUbGixW9HHlhdJ8iMYwmFaoJQPOwd+uZuTBO3g7tdGJTm4/YIarrunK3Ojky 2J56xKXF1JRf/rQgRaQmaD+fYTGab/YB64YC5S7kk0Xm9GNiJ/hhNAX8+s6EIBrVxvYC Dezw== X-Gm-Message-State: AOAM531ksQ9N9YxiHDeQGTNQ65yJj+aYQpbl2AfF3rUesALd+h1lxDXG Z1PitpH70KkVAlnd4g0e+DnWoi53DQo= X-Google-Smtp-Source: ABdhPJxYPLRO1ryCQRr5AV72Ht6tCVngauJZ8/BPYmkzbfRWcgO0pHV8+nxu8ltid+CauVRtj5x2gw== X-Received: by 2002:a2e:b8ce:: with SMTP id s14mr2045697ljp.89.1590994342576; Sun, 31 May 2020 23:52:22 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:281d:a604:434c:a58d]) by smtp.gmail.com with ESMTPSA id e13sm2540462ljl.117.2020.05.31.23.52.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 23:52:22 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v3 03/13] backlight: improve backlight_ops documentation Date: Mon, 1 Jun 2020 08:51:57 +0200 Message-Id: <20200601065207.492614-4-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601065207.492614-1-sam@ravnborg.org> References: <20200601065207.492614-1-sam@ravnborg.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, Support Opensource , Michael Hennerich , Bartlomiej Zolnierkiewicz , David Airlie , Daniel Vetter , Tomi Valkeinen , Jonathan Corbet , Emil Velikov , Bjorn Andersson , Peter Ujfalusi , Andy Gross , Thierry Reding , Thomas Zimmermann , linux-arm-msm@vger.kernel.org, Uwe Kleine-Konig , Sam Ravnborg , patches@opensource.cirrus.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Improve the documentation for backlight_ops and adapt it to kernel-doc style. v2: - Add intro for each field (Daniel) Signed-off-by: Sam Ravnborg Reviewed-by: Daniel Thompson Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- include/linux/backlight.h | 59 +++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index a0a083b35c47..b6c1ab6c922a 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -55,19 +55,66 @@ enum backlight_scale { struct backlight_device; struct fb_info; +/** + * struct backlight_ops - backlight operations + * + * The backlight operations are specifed when the backlight device is registered. + */ struct backlight_ops { + /** + * @options: Configure how operations are called from the core. + * + * The options parameter is used to adjust the behaviour of the core. + * Set BL_CORE_SUSPENDRESUME to get the update_status() operation called + * upon suspend and resume. + */ unsigned int options; #define BL_CORE_SUSPENDRESUME (1 << 0) - /* Notify the backlight driver some property has changed */ + /** + * @update_status: Operation called when properties have changed. + * + * Notify the backlight driver some property has changed. + * The update_status operation is protected by the update_lock. + * + * The backlight driver is expected to use backlight_is_blank() + * to check if the display is blanked and set brightness accordingly. + * update_status() is called when any of the properties has changed. + * + * RETURNS: + * + * 0 on sucees, negative error code if any failure occured. + */ int (*update_status)(struct backlight_device *); - /* Return the current backlight brightness (accounting for power, - fb_blank etc.) */ + + /** + * @get_brightness: Return the current backlight brightness. + * + * The driver may implement this as a readback from the HW. + * This operation is optional and if not present then the current + * brightness property value is used. + * + * RETURNS: + * + * A brightness value which is 0 or a positive numer. + * On failure a negative error code is returned. + */ int (*get_brightness)(struct backlight_device *); - /* Check if given framebuffer device is the one bound to this backlight; - return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */ - int (*check_fb)(struct backlight_device *, struct fb_info *); + + /** + * @check_fb: Check the framebuffer device. + * + * Check if given framebuffer device is the one bound to this backlight. + * This operation is optional and if not implemented it is assumed that the + * fbdev is always the one bound to the backlight. + * + * RETURNS: + * + * If info is NULL or the info matches the fbdev bound to the backlight return true. + * If info does not match the fbdev bound to the backlight return false. + */ + int (*check_fb)(struct backlight_device *bd, struct fb_info *info); }; /* This structure defines all the properties of a backlight */ From patchwork Mon Jun 1 06:51:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11581479 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C66C1913 for ; Mon, 1 Jun 2020 06:52:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A41432076B for ; Mon, 1 Jun 2020 06:52:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FB8sUWHt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A41432076B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 916926E0F7; Mon, 1 Jun 2020 06:52:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id A2D606E0F7 for ; Mon, 1 Jun 2020 06:52:26 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id u10so5510189ljj.9 for ; Sun, 31 May 2020 23:52:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wgQFgo3RHYwmcB8tP1uDfvnC0G/9E3cMrWKRfBK9IL8=; b=FB8sUWHtOWot1aPy7v97jwE2MCN9TFsZ8Uzu9Z2YTCLVknO+bXcp3uJkdWR2fGuHs8 ZWssNLxEldBQUfhYGP9t1ThPGqRMwdelU3gewbV3Rftyl9AAetV3O4zpyk8PPHf2QCZ5 xNA7J6x6lk8QJrfOpVkNWjPfi3sXMAl1cVzqbbZurLhdkXvGsIh4A0AabGXW0yNUB/uu AvlqROHPpoYOwtV2h4TlIO7iJWcsAqfKczoGhIiw+uX3BsBm5DnRLmSy3/fbwWyY1CwX l45bKiFfSZbWa14DxgOYoXGnnpi4EinY4CzhASM382I0RrBG1IO9r1D5wH2KlqfmYfqM j2dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=wgQFgo3RHYwmcB8tP1uDfvnC0G/9E3cMrWKRfBK9IL8=; b=C4ht3DaQnI2j/32DgCY2H/+E+nS79NJBi8F3MMqQmSY3Bb6hBBeEg/eyMG0NdSPqzb GUAg0yvw4L2nNUWkdEY34rdGilcfRja3H1PrOGn6jXwn+6y7chYcqcEth9Bs/k647AuC cSgnSPxagqGCwxqIrTf0FVI+qVagBcPxts7HN15GJY+m+rex5fOmNEMJUUkj75JLWSzx XVOUYareMkTcwofJccCa1RwweqAe8UG1LrnzabQ+LzRrWUTMWtbtEn3H/EVDVFybVc+g YEVegS5httPGXGS0JV0MOabHXuwwZDLJjcZq7EEPkO1DYNH7IpDyeW+OmNaPIL7SxKZD vL+w== X-Gm-Message-State: AOAM530602ORJNe4GMimUcJwzCt03w7pCZHefhpHm3eRbaltTJ4mZvwO u75jSmjysIsP78NoGV40Re7llXx2kJs= X-Google-Smtp-Source: ABdhPJzYtFLljsRs6Mh3pY4A40UVOWi60Y4AkVBMEcmu4THO7pQ00+38XavNrIHuVeGK1VbdGJyydg== X-Received: by 2002:a2e:9b4a:: with SMTP id o10mr5192012ljj.278.1590994344766; Sun, 31 May 2020 23:52:24 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:281d:a604:434c:a58d]) by smtp.gmail.com with ESMTPSA id e13sm2540462ljl.117.2020.05.31.23.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 23:52:24 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v3 04/13] backlight: improve backlight_properties documentation Date: Mon, 1 Jun 2020 08:51:58 +0200 Message-Id: <20200601065207.492614-5-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601065207.492614-1-sam@ravnborg.org> References: <20200601065207.492614-1-sam@ravnborg.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, Support Opensource , Michael Hennerich , Bartlomiej Zolnierkiewicz , David Airlie , Daniel Vetter , Tomi Valkeinen , Jonathan Corbet , Emil Velikov , Bjorn Andersson , Peter Ujfalusi , Andy Gross , Thierry Reding , Thomas Zimmermann , linux-arm-msm@vger.kernel.org, Uwe Kleine-Konig , Sam Ravnborg , patches@opensource.cirrus.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Improve the documentation for backlight_properties and adapt it to kernel-doc style. v2: - Added into for each field (Daniel) - Re-written some parts to explain what to do, rather than what not to do. Partly based on suggestions from the review (Daniel) Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Reviewed-by: Daniel Thompson --- include/linux/backlight.h | 96 ++++++++++++++++++++++++++++++++++----- 1 file changed, 85 insertions(+), 11 deletions(-) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index b6c1ab6c922a..69a20da03035 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -117,28 +117,102 @@ struct backlight_ops { int (*check_fb)(struct backlight_device *bd, struct fb_info *info); }; -/* This structure defines all the properties of a backlight */ +/** + * struct backlight_properties - backlight properties + * + * This structure defines all the properties of a backlight. + */ struct backlight_properties { - /* Current User requested brightness (0 - max_brightness) */ + /** + * @brightness: The current brightness requested by the user. + * + * The backlight core makes sure the range is (0 to max_brightness) + * when the brightness is set via the sysfs attribute: + * /sys/class/backlight//brightness. + * + * This value can be set in the backlight_properties passed + * to devm_backlight_device_register() to set a default brightness + * value. + */ int brightness; - /* Maximal value for brightness (read-only) */ + + /** + * @max_brightness: The maximum brightness value. + * + * This value must be set in the backlight_properties passed to + * devm_backlight_device_register() and shall not be modified by the + * driver after registration. + */ int max_brightness; - /* Current FB Power mode (0: full on, 1..3: power saving - modes; 4: full off), see FB_BLANK_XXX */ + + /** + * @power: The current power mode. + * + * User space can configure the power mode using the sysfs + * attribute: /sys/class/backlight//bl_power + * When the power property is updated update_status() is called. + * + * The possible values are: (0: full on, 1 to 3: power saving + * modes; 4: full off), see FB_BLANK_XXX. + * + * When the backlight device is enabled @power is set + * to FB_BLANK_UNBLANK. When the backlight device is disabled + * @power is set to FB_BLANK_POWERDOWN. + */ int power; - /* FB Blanking active? (values as for power) */ - /* Due to be removed, please use (state & BL_CORE_FBBLANK) */ + + /** + * @fb_blank: The power state from the FBIOBLANK ioclt. + * + * When the FBIOBLANK ioctl is called fb_blank is set to the + * blank parameter and the update_status() operation is called. + * + * When the backlight device is enabled @fb_blank is set + * to FB_BLANK_UNBLANK. When the backlight device is disabled + * @fb_blank is set to FB_BLANK_POWERDOWN. + * + * Backlight drivers should avoid using this property. It has been + * replaced by state & BL_CORE_FBLANK (although most drivers should + * use backlight_is_blank() as the preferred means to get the blank + * state). + * + * fb_blank is deprecated and will be removed. + */ int fb_blank; - /* Backlight type */ + + /** + * @type: The type of backlight supported. + * + * The backlight type allows userspace to make appropriate + * policy desicions based on the backlight type. + * + * This value must be set in the backlight_properties + * passed to devm_backlight_device_register(). + */ enum backlight_type type; - /* Flags used to signal drivers of state changes */ + + /** + * @state: The state of the backlight core. + * + * The state is a bitmask. BL_CORE_FBBLANK is set when the display + * is expected to be blank. BL_CORE_SUSPENDED is set when the + * driver is suspended. + * + * backlight drivers are excpected to use backlight_is_blank() + * in their update_status() operation rather than reading the + * state property. + * + * The state is maintained by the core and drivers may not modify it. + */ unsigned int state; - /* Type of the brightness scale (linear, non-linear, ...) */ - enum backlight_scale scale; #define BL_CORE_SUSPENDED (1 << 0) /* backlight is suspended */ #define BL_CORE_FBBLANK (1 << 1) /* backlight is under an fb blank event */ + /** + * @scale: The type of the brightness scale. + */ + enum backlight_scale scale; }; struct backlight_device { From patchwork Mon Jun 1 06:51:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11581485 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6406160D for ; Mon, 1 Jun 2020 06:52:35 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 42728206E2 for ; Mon, 1 Jun 2020 06:52:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ojtUytOV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 42728206E2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2975D6E11F; Mon, 1 Jun 2020 06:52:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id E363F6E11F for ; Mon, 1 Jun 2020 06:52:28 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id s1so6785793ljo.0 for ; Sun, 31 May 2020 23:52:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E7HkxkpHSeUWg+0ye+F2gdRI1PIMCE5pzVQmnOBV6l0=; b=ojtUytOV3rh6oRh5gNALmSYwsY5lka6bh6bPFygGrqRWn80LmipzWwpSs4c6LXmhmN tNYD09IlEn/d/tFmyncf+SctnMXKDdnT9+xSu/HNxvafs2F3VDDzOaTbWqWmeLgHa4vc 9ZXMNcOnncjuneXMoyRSESy1eMDgokSzFP11lxe21mMyFPcj5bhKGGfsW1ZuWW7RbHUf Bxg4WVZYXcr5QVs8H/tB0jQUvJIZZC9vS5sqMHia5j25MdgQtlOeJhxkpeG807zfqhyl a4BZ7U6EfAHlRp0+N3f5jXM/sa86ICY2iLtKejHrcuNloG/onPi8uePTHsSWUW2O4KUr m98g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=E7HkxkpHSeUWg+0ye+F2gdRI1PIMCE5pzVQmnOBV6l0=; b=rrMUkuVY0RpZJX0sR0K+54Y0LiPGDN9gQXsgol3ZxWxh29OWUaVlevuaIuxPoE2GvK 02cBAleLkez++xMAzvW3vw8NI03YAjph18LkeqE3jpa4of+KOHt/IC1eB/kR5dbFUjT+ KybTOkoxczXKFm7ZX+1vCeV6cvVpvf1XbxbGE/NWJEeXc0Nfq9U8IKWluV00Puuwf5bf iLugpz1aMqC3xxyUr2zrYkbx4fprb45SjQh35a61LD2FTqUlrf54f6HjU/DBEZgTlZzE 8v89DjLgsp5Qc9Zaa/kWMuwzt9/BO7zKD/etYUSA2hUCpYxeXy4MrHr6yt2dOEvMSCPa 0SaQ== X-Gm-Message-State: AOAM532+GGrf76KKmQKL9yCNdfBxIQCNxec3bivvbyns+XHHlOq+nZZj Y3tu/vILaBFaEK1OS1+Oavn0QKwzntA= X-Google-Smtp-Source: ABdhPJy37DH82D0CeHL7Sr2OMF4RZfTIP5Kb12jq2LE9Ca3vZgAarg4cgPeBxOMFux4+KcCV6O1+ow== X-Received: by 2002:a2e:b4e7:: with SMTP id s7mr4553753ljm.336.1590994347111; Sun, 31 May 2020 23:52:27 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:281d:a604:434c:a58d]) by smtp.gmail.com with ESMTPSA id e13sm2540462ljl.117.2020.05.31.23.52.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 23:52:26 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v3 05/13] backlight: improve backlight_device documentation Date: Mon, 1 Jun 2020 08:51:59 +0200 Message-Id: <20200601065207.492614-6-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601065207.492614-1-sam@ravnborg.org> References: <20200601065207.492614-1-sam@ravnborg.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, Support Opensource , Michael Hennerich , Bartlomiej Zolnierkiewicz , David Airlie , Daniel Vetter , Tomi Valkeinen , Jonathan Corbet , Emil Velikov , Bjorn Andersson , Peter Ujfalusi , Andy Gross , Thierry Reding , Thomas Zimmermann , linux-arm-msm@vger.kernel.org, Uwe Kleine-Konig , Sam Ravnborg , patches@opensource.cirrus.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Improve the documentation for backlight_device and adapt it to kernel-doc style. v2: - Add short intro to all fields (Daniel) - Updated description of update_lock (Daniel) Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- include/linux/backlight.h | 72 ++++++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 23 deletions(-) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 69a20da03035..cae1af95dd9d 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -14,21 +14,6 @@ #include #include -/* Notes on locking: - * - * backlight_device->ops_lock is an internal backlight lock protecting the - * ops pointer and no code outside the core should need to touch it. - * - * Access to update_status() is serialised by the update_lock mutex since - * most drivers seem to need this and historically get it wrong. - * - * Most drivers don't need locking on their get_brightness() method. - * If yours does, you need to implement it in the driver. You can use the - * update_lock mutex if appropriate. - * - * Any other use of the locks below is probably wrong. - */ - enum backlight_update_reason { BACKLIGHT_UPDATE_HOTKEY, BACKLIGHT_UPDATE_SYSFS, @@ -215,30 +200,71 @@ struct backlight_properties { enum backlight_scale scale; }; +/** + * struct backlight_device - backlight device data + * + * This structure holds all data required by a backlight device. + */ struct backlight_device { - /* Backlight properties */ + /** + * @props: Backlight properties + */ struct backlight_properties props; - /* Serialise access to update_status method */ + /** + * @update_lock: The lock used when calling the update_status() operation. + * + * update_lock is an internal backlight lock that serialise access + * to the update_status() operation. The backlight core holds the update_lock + * when calling the update_status() operation. The update_lock shall not + * be used by backlight drivers. + */ struct mutex update_lock; - /* This protects the 'ops' field. If 'ops' is NULL, the driver that - registered this device has been unloaded, and if class_get_devdata() - points to something in the body of that driver, it is also invalid. */ + /** + * @ops_lock: The lock used around everything related to backlight_ops. + * + * ops_lock is an internal backlight lock that protects the ops pointer + * and is used around all accesses to ops and when the operations are + * invoked. The ops_lock shall not be used by backlight drivers. + */ struct mutex ops_lock; + + /** + * @ops: Pointer to the backlight operations. + * + * If ops is NULL, the driver that registered this device has been unloaded, + * and if class_get_devdata() points to something in the body of that driver, + * it is also invalid. + */ const struct backlight_ops *ops; - /* The framebuffer notifier block */ + /** + * @fb_notif: The framebuffer notifier block + */ struct notifier_block fb_notif; - /* list entry of all registered backlight devices */ + /** + * @entry: List entry of all registered backlight devices + */ struct list_head entry; + /** + * @dev: Parent device. + */ struct device dev; - /* Multiple framebuffers may share one backlight device */ + /** + * @fb_bl_on: The state of individual fbdev's. + * + * Multiple fbdev's may share one backlight device. The fb_bl_on + * records the state of the individual fbdev. + */ bool fb_bl_on[FB_MAX]; + /** + * @use_count: The number of uses of fb_bl_on. + */ int use_count; }; From patchwork Mon Jun 1 06:52:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11581487 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A1DA60D for ; Mon, 1 Jun 2020 06:52:37 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ECCB7206E2 for ; Mon, 1 Jun 2020 06:52:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VktVUoO8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ECCB7206E2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4EF5D6E12B; Mon, 1 Jun 2020 06:52:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7C25A6E12B for ; Mon, 1 Jun 2020 06:52:31 +0000 (UTC) Received: by mail-lf1-x141.google.com with SMTP id d7so3263787lfi.12 for ; Sun, 31 May 2020 23:52:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=69nTzFI2GNQU9AQvcUBs3yFCmAT6Gg/K7NgbR/V9P7s=; b=VktVUoO8qiYt72hT3cUOFa7m832AcmJVn4azwkTffzj718DYgrsAiAe+pQylySaE3z 2qbA2Od2sVWrnx5VhmKMbAgZnVQObrPPJD7QdpmPLrXvbIrxHgh4JF0tWmP9BOW9GdI4 4FOD3VbPc1vWAHZOsqSteyU42LfkvkFjhQ+KUO5scm2F0yWif8WccThGeEMsWOH1q3B7 QsNZ5o2j3A/TzyQf+lqCJnrsRgFIN4LyspE+lmjqg8RZcpVXkCTWIyOnabnhzJOfCDD1 sTmWUghnYSC7+m/7V6iz00DT1PVLQumitScjqWtQ54p6OWW+WTlydQSIVpyo1W6ZwiMX 1vbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=69nTzFI2GNQU9AQvcUBs3yFCmAT6Gg/K7NgbR/V9P7s=; b=Ut0GP/bwYeNabEOU3hc7m/H6erYjbeHZiTOGD6Ju0pI5+JPMCMWKh71bqFD0GWFYC4 UpeCmwpW09Uv62x789c8GZswaIUAscJbQOrwVABahgd5pTrG38PvorQAN2Z2RWb3PeoW 6m7UB/8ML68rbVXsoxBf3e0B6cVQsESg5C2xK6pnMIsxQzUKoiATXTzwAP20f42tp7iW cJJx96mxbq0Yf1sDvKzNMzn6KaXpxm3BIdQwZtQHOwHFAtAV9K5kNKMrjiPeKNnPHUXK wpCUlLhpeXZKignYmywgKA3/6OrHBUfAkn/1OrQ72Dw1TdOoSktLi5lOJ4y6S/n5LrGK Ajnw== X-Gm-Message-State: AOAM5324T8Xtg1LGIpd8bnkBXWp0c6OCCoYC6VAzXRx0udgetYY2Jq1l 1CkZ8LQN1QyuTNTFNmpHf51xcSmG7PQ= X-Google-Smtp-Source: ABdhPJxsAjomR+EHBTZIUY3oWKM0UlreSmcXcRGSGObIKKhLr85RwEES5aA9AnNo+TFzZ8DUbJib0Q== X-Received: by 2002:ac2:41d4:: with SMTP id d20mr8177683lfi.204.1590994349317; Sun, 31 May 2020 23:52:29 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:281d:a604:434c:a58d]) by smtp.gmail.com with ESMTPSA id e13sm2540462ljl.117.2020.05.31.23.52.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 23:52:28 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v3 06/13] backlight: document inline functions in backlight.h Date: Mon, 1 Jun 2020 08:52:00 +0200 Message-Id: <20200601065207.492614-7-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601065207.492614-1-sam@ravnborg.org> References: <20200601065207.492614-1-sam@ravnborg.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, Support Opensource , Michael Hennerich , Bartlomiej Zolnierkiewicz , David Airlie , Daniel Vetter , Tomi Valkeinen , Jonathan Corbet , Emil Velikov , Bjorn Andersson , Peter Ujfalusi , Andy Gross , Thierry Reding , Thomas Zimmermann , linux-arm-msm@vger.kernel.org, Uwe Kleine-Konig , Sam Ravnborg , patches@opensource.cirrus.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add documentation for the inline functions in backlight.h v2: - Fix spelling (Daniel) Signed-off-by: Sam Ravnborg Reviewed-by: Daniel Thompson Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- include/linux/backlight.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index cae1af95dd9d..f99ca19cc3ec 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -268,6 +268,10 @@ struct backlight_device { int use_count; }; +/** + * backlight_update_status - force an update of the backlight device status + * @bd: the backlight device + */ static inline int backlight_update_status(struct backlight_device *bd) { int ret = -ENOENT; @@ -360,6 +364,18 @@ extern int backlight_device_set_brightness(struct backlight_device *bd, unsigned #define to_backlight_device(obj) container_of(obj, struct backlight_device, dev) +/** + * bl_get_data - access devdata + * @bl_dev: pointer to backlight device + * + * When a backlight device is registered the driver has the possibility + * to supply a void * devdata. bl_get_data() return a pointer to the + * devdata. + * + * RETURNS: + * + * pointer to devdata stored while registering the backlight device. + */ static inline void * bl_get_data(struct backlight_device *bl_dev) { return dev_get_drvdata(&bl_dev->dev); From patchwork Mon Jun 1 06:52:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11581491 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 97DE0157C for ; Mon, 1 Jun 2020 06:52:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 764BF206E2 for ; Mon, 1 Jun 2020 06:52:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rbuMMtwa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 764BF206E2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 521B36E132; Mon, 1 Jun 2020 06:52:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7A5166E138 for ; Mon, 1 Jun 2020 06:52:33 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id o9so6757619ljj.6 for ; Sun, 31 May 2020 23:52:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NySSdlyQJkQGVkK1Cp0EHZZ6M2Ik0zG0av6w2Ego7I4=; b=rbuMMtwa32PlMgO3FLH9ovOTcW9dDxJqamtsGyz/yDGxwGhiZUOAictnebq5XGOUJa GYZvEoglN5aUz07Eb4Ee3r0Wm9PGmdbXlkyeB+jemEaWfvCvEH7w+t/werIAsAywDiZh KmYK99Ouzqz0FoNxuHqfn4P45jIzXf30SdpFboGDrjsHoYfaxCB8QP0+XD+OCivpqj9e akRwRzz7YLfe6sCinOxkIkYvq+HIEMUyDLTh6aFNitX7C2+2xVj9B2LLnkUJI0UksEnT NxBr+dxvmZYllzVKeglKLHrvkqRhYALq6R6Ni9HlDTtyBCtxtfb2UxmGSU2MA7XnbSif G5sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=NySSdlyQJkQGVkK1Cp0EHZZ6M2Ik0zG0av6w2Ego7I4=; b=lt5pdkvhlT5GSjFFmGW4rUaXnQKzkEsQEtt6upwmMPv7LB6woKzsQE4SP1kOvBiZba hn4CIUPvz3in4SOFEnY5CzxYX+KQ7i3bk5QEYJdhW1I65iAiFULWGQLJ+IpidkNfvuTm +LAgxpLWYiD1MQOq2hUBAlio3wLqCqx6CiJMMoFxuLGqnhd4T03FQ47jvISQbhw/GCCV ALgpfhKVGxbMTetovqyo0XIySibmrXx3hBmcdvgjOmFVY/X8W6O81w5FDuecJGeTBbkn dUbo/t25aeKwewFfKwtrK0cs+TThiCgMxFdr0XPE7ZkLf8Rk0LdQeAbozsJ+9e+Yh0Ki YHDQ== X-Gm-Message-State: AOAM530gDwc2Imvl804LztpJtWfH+cPQ5Q+c1uBnUPmjYCFdhoi0V8HJ fpnzVmigfZfw0qO7pWWF6kKu0UP+w6o= X-Google-Smtp-Source: ABdhPJzFLoA3566dKX71K1Hk/avEwSPU2a8TFY6W34e11xmPVzkT9VeSoTjpuep92eETOAu24eniEA== X-Received: by 2002:a2e:82d0:: with SMTP id n16mr7862747ljh.6.1590994351618; Sun, 31 May 2020 23:52:31 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:281d:a604:434c:a58d]) by smtp.gmail.com with ESMTPSA id e13sm2540462ljl.117.2020.05.31.23.52.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 23:52:31 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v3 07/13] backlight: document enums in backlight.h Date: Mon, 1 Jun 2020 08:52:01 +0200 Message-Id: <20200601065207.492614-8-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601065207.492614-1-sam@ravnborg.org> References: <20200601065207.492614-1-sam@ravnborg.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, Support Opensource , Michael Hennerich , Bartlomiej Zolnierkiewicz , David Airlie , Daniel Vetter , Tomi Valkeinen , Jonathan Corbet , Emil Velikov , Bjorn Andersson , Peter Ujfalusi , Andy Gross , Thierry Reding , Thomas Zimmermann , linux-arm-msm@vger.kernel.org, Uwe Kleine-Konig , Sam Ravnborg , patches@opensource.cirrus.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add kernel-doc documentation for the backlight enums v2: - Add intro to each enum member (Daniel) Except backlight type as line lenght was too long. The generated HTML is the same. Signed-off-by: Sam Ravnborg Reviewed-by: Daniel Thompson Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- include/linux/backlight.h | 74 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index f99ca19cc3ec..c1c7b1666a9b 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -14,26 +14,98 @@ #include #include +/** + * enum backlight_update_reason - what method was used to update backlight + * + * A driver indicates the method (reason) used for updating the backlight + * when calling backlight_force_update(). + */ enum backlight_update_reason { + /** + * @BACKLIGHT_UPDATE_HOTKEY: The backlight was updated using a hot-key. + */ BACKLIGHT_UPDATE_HOTKEY, + + /** + * @BACKLIGHT_UPDATE_SYSFS: The backlight was updated using sysfs. + */ BACKLIGHT_UPDATE_SYSFS, }; +/** + * enum backlight_type - the type of backlight control + * + * The type of interface used to control the backlight. + */ enum backlight_type { + /** + * @BACKLIGHT_RAW: + * + * The backlight is controlled using hardware registers. + */ BACKLIGHT_RAW = 1, + + /** + * @BACKLIGHT_PLATFORM: + * + * The backlight is controlled using a platform-specific interface. + */ BACKLIGHT_PLATFORM, + + /** + * @BACKLIGHT_FIRMWARE: + * + * The backlight is controlled using a standard firmware interface. + */ BACKLIGHT_FIRMWARE, + + /** + * @BACKLIGHT_TYPE_MAX: Number of entries. + */ BACKLIGHT_TYPE_MAX, }; +/** + * enum backlight_notification - the type of notification + * + * The notifications that is used for notification sent to the receiver + * that registered notifications using backlight_register_notifier(). + */ enum backlight_notification { + /** + * @BACKLIGHT_REGISTERED: The backlight device is registered. + */ BACKLIGHT_REGISTERED, + + /** + * @BACKLIGHT_UNREGISTERED: The backlight revice is unregistered. + */ BACKLIGHT_UNREGISTERED, }; +/** enum backlight_scale - the type of scale used for brightness values + * + * The type of scale used for brightness values. + */ enum backlight_scale { + /** + * @BACKLIGHT_SCALE_UNKNOWN: The scale is unknown. + */ BACKLIGHT_SCALE_UNKNOWN = 0, + + /** + * @BACKLIGHT_SCALE_LINEAR: The scale is linear. + * + * The linear scale will increase brightness the same for each step. + */ BACKLIGHT_SCALE_LINEAR, + + /** + * @BACKLIGHT_SCALE_NON_LINEAR: The scale is not linear. + * + * This is often used when the brightness values tries to adjust to + * the relative perception of the eye demanding a non-linear scale. + */ BACKLIGHT_SCALE_NON_LINEAR, }; @@ -149,7 +221,7 @@ struct backlight_properties { /** * @fb_blank: The power state from the FBIOBLANK ioclt. * - * When the FBIOBLANK ioctl is called fb_blank is set to the + * When the FBIOBLANK ioctl is called @fb_blank is set to the * blank parameter and the update_status() operation is called. * * When the backlight device is enabled @fb_blank is set From patchwork Mon Jun 1 06:52:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11581495 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 02AD260D for ; Mon, 1 Jun 2020 06:52:40 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D4EFE206E2 for ; Mon, 1 Jun 2020 06:52:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CEXAusFg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4EFE206E2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2C8466E138; Mon, 1 Jun 2020 06:52:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD78A6E138 for ; Mon, 1 Jun 2020 06:52:35 +0000 (UTC) Received: by mail-lj1-x241.google.com with SMTP id m18so6757956ljo.5 for ; Sun, 31 May 2020 23:52:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vDqVAIjccZnYRUpLcbxJO82lc5tSgraJEEtyeI//9cw=; b=CEXAusFgeTZ1RgVQ9hS2P6VoCaZ82REziAk3UsxYQeACDlGmILLx/1tyRgu5k/gsHK 7bhDWlYPZxQ//HvR95PuodmqLBjecdAs3P/yv6AvhsvKnd/T7BIUgwHXAQvim2XUOXMO 02RqhhhLt6EAxVEE4xFd1MfMrb3dQ70WWXGsEyjblCUE521UmSz3KzCLMKGd2YyjTBcp DN8/HmhnXU41qBZ26BynfdCgn47BZOI6N0wZJI1qSDjwg81QvvH/nZRdJVbIqO7Imddy c8BhPMbJ4xv51Q0pkZ1PdoSyGoZR0Nsw5F57UEp666T/rTZbD6uwwH+nQU2V/+J4GRSP hlWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=vDqVAIjccZnYRUpLcbxJO82lc5tSgraJEEtyeI//9cw=; b=iCJbtu/nVU66peZ+vZEwmSGrhNXEVs9KE7L659DfQeRgtvVMETdnCBXbz+dgm00mnB zLNFw7d+6pDoHAQ9/vEJs34yqOemIvmnMPcLRW9sFNfnhpzafbw8s45bSp9zaTveJJYy BTM4A/oHB8rOaE+m17cW3M47VolCj/ypRa3NlNLoiJM787LxTpt2eIXAui/QwuhZ293s 0DkrBWuBy9z5lXhMCDKMGCKZgl3mGo0Dhge2j07KjnVRmzE9h73Da0uQXSM2hms2kDM3 bz7ciwLvmRZk+IC5YFIYYc3za7CChF0hkaykVAZKkxhxRSCwlFmslrAwBrK5jen5k+IM r3jQ== X-Gm-Message-State: AOAM533nPFq4g39AEitIqFlh9CQoCO7CdAqWnKJK8CoHRsNglgEKb2Eq r0y0GZJG1unJPcAVJde0f9L8vfocK78= X-Google-Smtp-Source: ABdhPJx/qq0CrraGku2u6S8qFTum2RKXM4M4pOEdTsmcCFc4PeCAn382lO6xEJ0gLuJxdJ41zO8/VQ== X-Received: by 2002:a2e:a0cd:: with SMTP id f13mr6644884ljm.139.1590994353880; Sun, 31 May 2020 23:52:33 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:281d:a604:434c:a58d]) by smtp.gmail.com with ESMTPSA id e13sm2540462ljl.117.2020.05.31.23.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 23:52:33 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v3 08/13] backlight: remove the unused backlight_bl driver Date: Mon, 1 Jun 2020 08:52:02 +0200 Message-Id: <20200601065207.492614-9-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601065207.492614-1-sam@ravnborg.org> References: <20200601065207.492614-1-sam@ravnborg.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, Support Opensource , Michael Hennerich , Bartlomiej Zolnierkiewicz , David Airlie , Daniel Vetter , Tomi Valkeinen , Jonathan Corbet , Emil Velikov , Bjorn Andersson , Peter Ujfalusi , Andy Gross , Thierry Reding , Thomas Zimmermann , linux-arm-msm@vger.kernel.org, Uwe Kleine-Konig , Sam Ravnborg , patches@opensource.cirrus.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The backlight_bl driver required initialization using struct generic_bl_info. As there are no more references to this struct there is no users left. So it is safe to delete the driver. Signed-off-by: Sam Ravnborg Reviewed-by: Daniel Thompson Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- drivers/video/backlight/Kconfig | 8 -- drivers/video/backlight/Makefile | 1 - drivers/video/backlight/generic_bl.c | 110 --------------------------- include/linux/backlight.h | 9 --- 4 files changed, 128 deletions(-) delete mode 100644 drivers/video/backlight/generic_bl.c diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 7d22d7377606..14abfeee8868 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig @@ -173,14 +173,6 @@ config BACKLIGHT_EP93XX To compile this driver as a module, choose M here: the module will be called ep93xx_bl. -config BACKLIGHT_GENERIC - tristate "Generic (aka Sharp Corgi) Backlight Driver" - default y - help - Say y to enable the generic platform backlight driver previously - known as the Corgi backlight driver. If you have a Sharp Zaurus - SL-C7xx, SL-Cxx00 or SL-6000x say y. - config BACKLIGHT_IPAQ_MICRO tristate "iPAQ microcontroller backlight driver" depends on MFD_IPAQ_MICRO diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index 0c1a1524627a..9b998cfdc56d 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile @@ -31,7 +31,6 @@ obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o obj-$(CONFIG_BACKLIGHT_DA903X) += da903x_bl.o obj-$(CONFIG_BACKLIGHT_DA9052) += da9052_bl.o obj-$(CONFIG_BACKLIGHT_EP93XX) += ep93xx_bl.o -obj-$(CONFIG_BACKLIGHT_GENERIC) += generic_bl.o obj-$(CONFIG_BACKLIGHT_GPIO) += gpio_backlight.o obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o diff --git a/drivers/video/backlight/generic_bl.c b/drivers/video/backlight/generic_bl.c deleted file mode 100644 index 8fe63dbc8590..000000000000 --- a/drivers/video/backlight/generic_bl.c +++ /dev/null @@ -1,110 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Generic Backlight Driver - * - * Copyright (c) 2004-2008 Richard Purdie - */ - -#include -#include -#include -#include -#include -#include -#include - -static int genericbl_intensity; -static struct backlight_device *generic_backlight_device; -static struct generic_bl_info *bl_machinfo; - -static int genericbl_send_intensity(struct backlight_device *bd) -{ - int intensity = bd->props.brightness; - - if (bd->props.power != FB_BLANK_UNBLANK) - intensity = 0; - if (bd->props.state & BL_CORE_FBBLANK) - intensity = 0; - if (bd->props.state & BL_CORE_SUSPENDED) - intensity = 0; - - bl_machinfo->set_bl_intensity(intensity); - - genericbl_intensity = intensity; - - if (bl_machinfo->kick_battery) - bl_machinfo->kick_battery(); - - return 0; -} - -static int genericbl_get_intensity(struct backlight_device *bd) -{ - return genericbl_intensity; -} - -static const struct backlight_ops genericbl_ops = { - .options = BL_CORE_SUSPENDRESUME, - .get_brightness = genericbl_get_intensity, - .update_status = genericbl_send_intensity, -}; - -static int genericbl_probe(struct platform_device *pdev) -{ - struct backlight_properties props; - struct generic_bl_info *machinfo = dev_get_platdata(&pdev->dev); - const char *name = "generic-bl"; - struct backlight_device *bd; - - bl_machinfo = machinfo; - if (!machinfo->limit_mask) - machinfo->limit_mask = -1; - - if (machinfo->name) - name = machinfo->name; - - memset(&props, 0, sizeof(struct backlight_properties)); - props.type = BACKLIGHT_RAW; - props.max_brightness = machinfo->max_intensity; - bd = devm_backlight_device_register(&pdev->dev, name, &pdev->dev, - NULL, &genericbl_ops, &props); - if (IS_ERR(bd)) - return PTR_ERR(bd); - - platform_set_drvdata(pdev, bd); - - bd->props.power = FB_BLANK_UNBLANK; - bd->props.brightness = machinfo->default_intensity; - backlight_update_status(bd); - - generic_backlight_device = bd; - - dev_info(&pdev->dev, "Generic Backlight Driver Initialized.\n"); - return 0; -} - -static int genericbl_remove(struct platform_device *pdev) -{ - struct backlight_device *bd = platform_get_drvdata(pdev); - - bd->props.power = 0; - bd->props.brightness = 0; - backlight_update_status(bd); - - dev_info(&pdev->dev, "Generic Backlight Driver Unloaded\n"); - return 0; -} - -static struct platform_driver genericbl_driver = { - .probe = genericbl_probe, - .remove = genericbl_remove, - .driver = { - .name = "generic-bl", - }, -}; - -module_platform_driver(genericbl_driver); - -MODULE_AUTHOR("Richard Purdie "); -MODULE_DESCRIPTION("Generic Backlight Driver"); -MODULE_LICENSE("GPL"); diff --git a/include/linux/backlight.h b/include/linux/backlight.h index c1c7b1666a9b..6bd981a600ef 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -453,15 +453,6 @@ static inline void * bl_get_data(struct backlight_device *bl_dev) return dev_get_drvdata(&bl_dev->dev); } -struct generic_bl_info { - const char *name; - int max_intensity; - int default_intensity; - int limit_mask; - void (*set_bl_intensity)(int intensity); - void (*kick_battery)(void); -}; - #ifdef CONFIG_OF struct backlight_device *of_find_backlight_by_node(struct device_node *node); #else From patchwork Mon Jun 1 06:52:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11581499 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8CB7C157C for ; Mon, 1 Jun 2020 06:52:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6B06D2076B for ; Mon, 1 Jun 2020 06:52:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pT3RA9tp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B06D2076B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C413E6E13C; Mon, 1 Jun 2020 06:52:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 05EF76E13C for ; Mon, 1 Jun 2020 06:52:38 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id m18so6758082ljo.5 for ; Sun, 31 May 2020 23:52:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VTAgQ0/+by/AFCHtw1iOg7GKteKKQa3tJwaqwJToo1s=; b=pT3RA9tpY/ttV+F7JpvmxfJbJnSZSfBhqafI59EsUccx1b1tYuvoUDNRs5Vo7tnxOe qecKoCV9H6Ri3NKNFmtFYyTq+R3V3gQZ+xGnTTEVta3UIgi1JOmB/x+dtLjEoAt8C6q4 t7Y4yqcG+h0R8J5KTxPRwM+mTP9KjnEdCLyy24UqY+7se1bDYK6a+y2d3FEXNexGIs9j pJqB7Vo8V2tmyJGgF3Wx/4zdbcr92ufm130gqJ0AGirICGeAj6m8Y7uXD2V+DCWSS+uj pwYAQQQBc5UL5/iV9dXIB+bBipimkJGzCLLPNGfjs9DBPf9LMF+w9eH/AokUH2QHxFuh zETA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=VTAgQ0/+by/AFCHtw1iOg7GKteKKQa3tJwaqwJToo1s=; b=nev8XGealOPS6ifIXvqDBSNvj7mPQ/ZMZ1z7Dh1gBwyZ9uWpJ0EmB9jtI3jblatdJZ o/BaEGJdIBAXbsz2h0FKWUZYzSASdfwz2DhTpoE93X9YIRl8BDsx+xrthYz/2BBLl1SZ BmefG7GEozpRCR/IedRM88KvbCpAiQlYqzM3tRnr04Vx9FRnm+x1ss9Fxiqzqex5grXw g30+U6aJzu6eFEbhS3uLIJXhOhtBmpX5vsW69KRXohPsm1QiQTddYposCVwdYaX0/t+c ExH069QInyl8moer4IHf3hK2YmSsbUPBdKesCpAryzQzzKWuG78aJnU7uEBuDZM+pRcN cG5w== X-Gm-Message-State: AOAM533VLVJnbYrnAI+mvq6jg7n3xxF5Md3+7ftUR6nIzvb13UOUQEyj /u9x+qr5hUb8TV3ZxRWMFO72GPFR3Ig= X-Google-Smtp-Source: ABdhPJzl8Fs749+ZgMHWRo08UWn6h05dlQMe31AthZ5mkRyww2y2SCrZPCwPjKghl3VnvYogfvbsAA== X-Received: by 2002:a2e:868d:: with SMTP id l13mr2107229lji.306.1590994356092; Sun, 31 May 2020 23:52:36 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:281d:a604:434c:a58d]) by smtp.gmail.com with ESMTPSA id e13sm2540462ljl.117.2020.05.31.23.52.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 23:52:35 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v3 09/13] backlight: drop extern from prototypes Date: Mon, 1 Jun 2020 08:52:03 +0200 Message-Id: <20200601065207.492614-10-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601065207.492614-1-sam@ravnborg.org> References: <20200601065207.492614-1-sam@ravnborg.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, Support Opensource , Michael Hennerich , Bartlomiej Zolnierkiewicz , David Airlie , Daniel Vetter , Tomi Valkeinen , Jonathan Corbet , Emil Velikov , Bjorn Andersson , Peter Ujfalusi , Andy Gross , Thierry Reding , Thomas Zimmermann , linux-arm-msm@vger.kernel.org, Uwe Kleine-Konig , Sam Ravnborg , patches@opensource.cirrus.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" No need to put "extern" in front of prototypes. While touching the prototypes adjust indent to follow the kernel style. Signed-off-by: Sam Ravnborg Reviewed-by: Daniel Thompson Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- include/linux/backlight.h | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 6bd981a600ef..25a3aac89618 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -417,22 +417,25 @@ static inline bool backlight_is_blank(struct backlight_device *bd) bd->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK); } -extern struct backlight_device *backlight_device_register(const char *name, - struct device *dev, void *devdata, const struct backlight_ops *ops, - const struct backlight_properties *props); -extern struct backlight_device *devm_backlight_device_register( - struct device *dev, const char *name, struct device *parent, - void *devdata, const struct backlight_ops *ops, - const struct backlight_properties *props); -extern void backlight_device_unregister(struct backlight_device *bd); -extern void devm_backlight_device_unregister(struct device *dev, - struct backlight_device *bd); -extern void backlight_force_update(struct backlight_device *bd, - enum backlight_update_reason reason); -extern int backlight_register_notifier(struct notifier_block *nb); -extern int backlight_unregister_notifier(struct notifier_block *nb); -extern struct backlight_device *backlight_device_get_by_type(enum backlight_type type); -extern int backlight_device_set_brightness(struct backlight_device *bd, unsigned long brightness); +struct backlight_device * +backlight_device_register(const char *name, struct device *dev, void *devdata, + const struct backlight_ops *ops, + const struct backlight_properties *props); +struct backlight_device * +devm_backlight_device_register(struct device *dev, const char *name, + struct device *parent, void *devdata, + const struct backlight_ops *ops, + const struct backlight_properties *props); +void backlight_device_unregister(struct backlight_device *bd); +void devm_backlight_device_unregister(struct device *dev, + struct backlight_device *bd); +void backlight_force_update(struct backlight_device *bd, + enum backlight_update_reason reason); +int backlight_register_notifier(struct notifier_block *nb); +int backlight_unregister_notifier(struct notifier_block *nb); +struct backlight_device *backlight_device_get_by_type(enum backlight_type type); +int backlight_device_set_brightness(struct backlight_device *bd, + unsigned long brightness); #define to_backlight_device(obj) container_of(obj, struct backlight_device, dev) From patchwork Mon Jun 1 06:52:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11581501 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 33A0960D for ; Mon, 1 Jun 2020 06:52:43 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 11B492076B for ; Mon, 1 Jun 2020 06:52:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sy/pCIaU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 11B492076B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D96FB6E139; Mon, 1 Jun 2020 06:52:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3C7286E139 for ; Mon, 1 Jun 2020 06:52:40 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id m18so6758200ljo.5 for ; Sun, 31 May 2020 23:52:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eLPbrmDW/Xo7kllaN/jCjZjnSWOdy/pm0/gQ/6XVf4A=; b=sy/pCIaUj13T9e3LXdfQwILdRtEsOihqjqCmAlpi+ZAG38uyQTE6UdXc+uASFgFnUp aa0b/ut2gLuNbsSGBSTZi95lJrPlNBQgWJp3VGCmnztKoD/29bqHjc28reTrc9m8ke2t x0wSf/RDekXJuDSRufwrLqpnsuvzvOSziNd7Z/UXDIOVyN4MlnPPwWLvNwvNy971BQGT YoyY9Jd7+mJ2WCIFTd/krWbAxDSrT7PVKvPK8BSy6y672fB/d3bLS9wKC483H4+ZTXwh wAY9ThG1Ar/QQVF/dzX1gNBJo4peBDoXZJ9WwsWsZFBOHSQxhHXc+YiU9DkfR+RHs1c/ LDsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=eLPbrmDW/Xo7kllaN/jCjZjnSWOdy/pm0/gQ/6XVf4A=; b=f6UEWwtX2qNyzLGUbYepNWFJIHrkb6JmxxAxHUp6wuzOfqa12Akc26V5gDHrgySxYL pA10x6JjUvrN3IhLHv0wdgCx18sjg6Ga44yYto0HRm3erFkhrVmC3uz/oSY5hbHug/PO xJzTfpRuus8hdDBjmT6SMf28BIaOmXilzXCsNXPpQXBWjmBpS7avc4KBW1mSpsCRCsCK y688kxqbLE2ha2EJAv4du2rtHg+t9ixzGmMkMOVbUpOyjA4eqCoYRk4g56CScXHn9dWT /FJkr1j1HUf+EPrI5cxFs8pXFj7Qm55FVRVNKy8F3Jotc07lYMLsZHvWF70cQfCMHteX tBzw== X-Gm-Message-State: AOAM533UqCwhyBMYUS5WjD9qVUPnzQLoQwjQk8LxD6FJ4zOUB2W3R3nm JkYQycPdPSezUd0VkvwKFtL15tUo5FQ= X-Google-Smtp-Source: ABdhPJx3iN7XIZ42IHrIlaq3HbS6VzZr9rEiDubQTN25H+BVg8cLbISr3mtT4bLA/BTkd8q1dsTEYg== X-Received: by 2002:a2e:9105:: with SMTP id m5mr10594493ljg.408.1590994358348; Sun, 31 May 2020 23:52:38 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:281d:a604:434c:a58d]) by smtp.gmail.com with ESMTPSA id e13sm2540462ljl.117.2020.05.31.23.52.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 23:52:37 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v3 10/13] backlight: add overview and update existing doc Date: Mon, 1 Jun 2020 08:52:04 +0200 Message-Id: <20200601065207.492614-11-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601065207.492614-1-sam@ravnborg.org> References: <20200601065207.492614-1-sam@ravnborg.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, Support Opensource , Michael Hennerich , Bartlomiej Zolnierkiewicz , David Airlie , Daniel Vetter , Tomi Valkeinen , Jonathan Corbet , Emil Velikov , Bjorn Andersson , Peter Ujfalusi , Andy Gross , Thierry Reding , Thomas Zimmermann , linux-arm-msm@vger.kernel.org, Uwe Kleine-Konig , Sam Ravnborg , patches@opensource.cirrus.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add overview chapter to backlight.c. Update existing kernel-doc to follow a more consistent style and drop kernel-doc for deprecated functions. v2: - Sevaral editorial corrections that makes reading much easier (Daniel) - Spelling fixes (Daniel) - updated intro chapter with a little more info Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- drivers/video/backlight/backlight.c | 131 +++++++++++++++++++--------- 1 file changed, 90 insertions(+), 41 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 17f04cff50ab..06bcddd76a7e 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -22,6 +22,46 @@ #include #endif +/** + * DOC: overview + * + * The backlight core supports implementing backlight drivers. + * + * A backlight driver registers a driver using + * devm_backlight_device_register(). The properties of the backlight + * driver such as type and max_brightness must be specified. + * When the core detect changes in for example brightness or power state + * the update_status() operation is called. The backlight driver shall + * implement this operation and use it to adjust backlight. + * + * Several sysfs attributes are provided by the backlight core:: + * + * - brightness R/W, set the requested brightness level + * - actual_brighness RO, the brightness level used by the HW + * - max_brightness RO, the maximum brightness level supported + * + * See Documentation/ABI/stable/sysfs-class-backlight for the full list. + * + * The backlight can be adjusted using the sysfs interface, and + * the backlight driver may also support adjusting backlight using + * a hot-key or some other platfrom or firmware specific way. + * + * The driver shall implement the get_brightness() operation if + * the HW do not support all the levels that can be specified in + * brightness, thus providing user-space access to the actual level + * via the actual_brightness attribute. + * When the backlight changes this is reported to user-space using + * an uevent connected to the actual_brightness attribute. + * When brightness is set by platform specific means, for example + * a hot-key to adjust backlight, the driver must notify the backlight + * core that brightness has changed using backlight_force_update(). + * + * The backlight driver core receives notifications from fbdev and + * if the event is FB_EVENT_BLANK and if the value of blank, from the + * FBIOBLANK ioclt, results in a change in the backlight state the + * update_status() operation is called. + */ + static struct list_head backlight_dev_list; static struct mutex backlight_dev_list_mutex; static struct blocking_notifier_head backlight_notifier; @@ -40,9 +80,17 @@ static const char *const backlight_scale_types[] = { #if defined(CONFIG_FB) || (defined(CONFIG_FB_MODULE) && \ defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)) -/* This callback gets called when something important happens inside a - * framebuffer driver. We're looking if that important event is blanking, - * and if it is and necessary, we're switching backlight power as well ... +/* + * fb_notifier_callback + * + * This callback gets called when something important happens inside a + * framebuffer driver. The backlight core only cares about FB_BLANK_UNBLANK + * which is reported to the driver using backlight_update_status() + * as a state change. + * + * There may be several fbdev's connected to the backlight device, + * in which case they are kept track of. A state change is only reported + * if there is a change in backlight for the specified fbdev. */ static int fb_notifier_callback(struct notifier_block *self, unsigned long event, void *data) @@ -318,12 +366,15 @@ static struct attribute *bl_device_attrs[] = { ATTRIBUTE_GROUPS(bl_device); /** - * backlight_force_update - tell the backlight subsystem that hardware state - * has changed + * backlight_force_update - force an update due to a hardware change * @bd: the backlight device to update + * @reason: the method used for the backlight update * * Updates the internal state of the backlight in response to a hardware event, - * and generate a uevent to notify userspace + * and generates an uevent to notify userspace. A backlight driver shall call + * backlight_force_update() when the backlight is changed using, for example, + * a hot-key. The updated brightness is read using get_brightness() and the + * brightness value is reported using an uevent. */ void backlight_force_update(struct backlight_device *bd, enum backlight_update_reason reason) @@ -336,19 +387,7 @@ void backlight_force_update(struct backlight_device *bd, } EXPORT_SYMBOL(backlight_force_update); -/** - * backlight_device_register - create and register a new object of - * backlight_device class. - * @name: the name of the new object(must be the same as the name of the - * respective framebuffer device). - * @parent: a pointer to the parent device - * @devdata: an optional pointer to be stored for private driver use. The - * methods may retrieve it by using bl_get_data(bd). - * @ops: the backlight operations structure. - * - * Creates and registers new backlight device. Returns either an - * ERR_PTR() or a pointer to the newly allocated device. - */ +/* deprecated - use devm_backlight_device_register() */ struct backlight_device *backlight_device_register(const char *name, struct device *parent, void *devdata, const struct backlight_ops *ops, const struct backlight_properties *props) @@ -415,6 +454,15 @@ struct backlight_device *backlight_device_register(const char *name, } EXPORT_SYMBOL(backlight_device_register); +/** backlight_device_get_by_type - find first backlight device of a type + * @type: the type of backlight device + * + * Look up the first backlight device of the specified type + * + * RETURNS: + * + * Pointer to backlight device if any was found. Otherwise NULL. + */ struct backlight_device *backlight_device_get_by_type(enum backlight_type type) { bool found = false; @@ -433,12 +481,7 @@ struct backlight_device *backlight_device_get_by_type(enum backlight_type type) } EXPORT_SYMBOL(backlight_device_get_by_type); -/** - * backlight_device_unregister - unregisters a backlight device object. - * @bd: the backlight device object to be unregistered and freed. - * - * Unregisters a previously registered via backlight_device_register object. - */ +/* deprecated - use devm_backlight_device_unregister() */ void backlight_device_unregister(struct backlight_device *bd) { if (!bd) @@ -486,10 +529,12 @@ static int devm_backlight_device_match(struct device *dev, void *res, * backlight_register_notifier - get notified of backlight (un)registration * @nb: notifier block with the notifier to call on backlight (un)registration * - * @return 0 on success, otherwise a negative error code - * * Register a notifier to get notified when backlight devices get registered * or unregistered. + * + * RETURNS: + * + * 0 on success, otherwise a negative error code */ int backlight_register_notifier(struct notifier_block *nb) { @@ -501,10 +546,12 @@ EXPORT_SYMBOL(backlight_register_notifier); * backlight_unregister_notifier - unregister a backlight notifier * @nb: notifier block to unregister * - * @return 0 on success, otherwise a negative error code - * * Register a notifier to get notified when backlight devices get registered * or unregistered. + * + * RETURNS: + * + * 0 on success, otherwise a negative error code */ int backlight_unregister_notifier(struct notifier_block *nb) { @@ -513,20 +560,22 @@ int backlight_unregister_notifier(struct notifier_block *nb) EXPORT_SYMBOL(backlight_unregister_notifier); /** - * devm_backlight_device_register - resource managed backlight_device_register() + * devm_backlight_device_register - register a new backlight device * @dev: the device to register * @name: the name of the device - * @parent: a pointer to the parent device + * @parent: a pointer to the parent device (often the same as @dev) * @devdata: an optional pointer to be stored for private driver use * @ops: the backlight operations structure * @props: the backlight properties * - * @return a struct backlight on success, or an ERR_PTR on error + * Creates and registers new backlight device. When a backlight device + * is registered the configuration must be specified in the @props + * parameter. See description of &backlight_properties. * - * Managed backlight_device_register(). The backlight_device returned - * from this function are automatically freed on driver detach. - * See backlight_device_register() for more information. - */ + * RETURNS: + * + * struct backlight on success, or an ERR_PTR on error +*/ struct backlight_device *devm_backlight_device_register(struct device *dev, const char *name, struct device *parent, void *devdata, const struct backlight_ops *ops, @@ -553,13 +602,13 @@ struct backlight_device *devm_backlight_device_register(struct device *dev, EXPORT_SYMBOL(devm_backlight_device_register); /** - * devm_backlight_device_unregister - resource managed backlight_device_unregister() + * devm_backlight_device_unregister - unregister backlight device * @dev: the device to unregister * @bd: the backlight device to unregister * - * Deallocated a backlight allocated with devm_backlight_device_register(). + * Deallocates a backlight allocated with devm_backlight_device_register(). * Normally this function will not need to be called and the resource management - * code will ensure that the resource is freed. + * code will ensure that the resources are freed. */ void devm_backlight_device_unregister(struct device *dev, struct backlight_device *bd) @@ -650,8 +699,8 @@ static void devm_backlight_release(void *data) } /** - * devm_of_find_backlight - Resource-managed of_find_backlight() - * @dev: Device + * devm_of_find_backlight - find backlight for a device + * @dev: the device * * Device managed version of of_find_backlight(). * The reference on the backlight device is automatically From patchwork Mon Jun 1 06:52:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11581505 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B4FBE60D for ; Mon, 1 Jun 2020 06:52:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 934EF2077D for ; Mon, 1 Jun 2020 06:52:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E7MeDZFY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 934EF2077D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 374FF6E146; Mon, 1 Jun 2020 06:52:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4ABC46E146 for ; Mon, 1 Jun 2020 06:52:42 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id c17so994222lji.11 for ; Sun, 31 May 2020 23:52:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AnaHL8ZW2AHSXoDqHfMNaVU3hWEgwww58aZX9yKaEh8=; b=E7MeDZFYP1vjvb0jmnutl7Cd/7rXGGCPAXDxfA3kTRbZHzTQ2zKfSTZtmIrriXZLdY 6WIWBnm/MFR3O9nIQxM3tR0Cl1HBuV3Emywhryw1zL4FZwh/66DsL5G6TKVeC4nzEPsv wVPKVD3gj04X9hB5d7ZN6lR7DCjJ0jGjtauxtNB2VIzQ4gQqv1L2W81H+owG6MuFS/N+ IkjT1FrK5OJSb4Yss1QUwQKddggmHXmXPZkn7KryS48uwBNvh4uXmZxd0VI+rFeL9l88 ddtpPee0eUztEq4yAVQy397i2KERofzwnmWngZ5ZLhIm0Ul/3hkeA4JNev+xJQusw3Rm vV9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=AnaHL8ZW2AHSXoDqHfMNaVU3hWEgwww58aZX9yKaEh8=; b=hjqQFj83la1+lzqbGlrFR323vI/fpC4JijnrIm+vMnV/aLXRS52Tlugj3TOkA50wt2 uHcu8+oMRQFyt6QDERhvXnyYsKH6Oc6zXW1U3r+bE/nOvp++LprFagzR/w0VDKMPswVL cKjWVf16f2NZkI+e1P0rVatMmZodv3c/tjg9hXpElN4y51Si8+eT5X8WlGqhySAq58a8 72IKLIn7I+oFPYQVM8VpxpAGI2HH2mPjnnUsZJYkIFr7RuEuXwj4QEtlqMjrU/ofxydb g+fIn9dx9EVbycLJbPzVHGkJ2rWEsGT0tQdw4FeV5sZhF4IOP++ESSQInki1qJpyvSK8 gLfA== X-Gm-Message-State: AOAM532MQ29uaf2h3SAWuh2D6JjzQ8UDslF/FhCAkFdIS4AxxzNpcJJO d3O28VQDB4Mk3upAxdERnl3b4M++/zo= X-Google-Smtp-Source: ABdhPJy6NUne+NeaxEir/nZPRNno9Z/JzFLm/d5YWSPgm0nw28WxZgRoVCFDsShL4PLF+JqMBV3P3w== X-Received: by 2002:a2e:960b:: with SMTP id v11mr2290702ljh.77.1590994360550; Sun, 31 May 2020 23:52:40 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:281d:a604:434c:a58d]) by smtp.gmail.com with ESMTPSA id e13sm2540462ljl.117.2020.05.31.23.52.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 23:52:40 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v3 11/13] backlight: wire up kernel-doc documentation Date: Mon, 1 Jun 2020 08:52:05 +0200 Message-Id: <20200601065207.492614-12-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601065207.492614-1-sam@ravnborg.org> References: <20200601065207.492614-1-sam@ravnborg.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, Support Opensource , Michael Hennerich , Bartlomiej Zolnierkiewicz , David Airlie , Daniel Vetter , Tomi Valkeinen , Jonathan Corbet , Emil Velikov , Bjorn Andersson , Peter Ujfalusi , Andy Gross , Thierry Reding , Thomas Zimmermann , linux-arm-msm@vger.kernel.org, Uwe Kleine-Konig , Sam Ravnborg , patches@opensource.cirrus.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Include backlight so the documentation is now generated with make htmldocs and friends. Signed-off-by: Sam Ravnborg Reviewed-by: Daniel Thompson Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter Cc: Jonathan Corbet --- Documentation/gpu/backlight.rst | 12 ++++++++++++ Documentation/gpu/index.rst | 1 + 2 files changed, 13 insertions(+) create mode 100644 Documentation/gpu/backlight.rst diff --git a/Documentation/gpu/backlight.rst b/Documentation/gpu/backlight.rst new file mode 100644 index 000000000000..9ebfc9d0aced --- /dev/null +++ b/Documentation/gpu/backlight.rst @@ -0,0 +1,12 @@ +================= +Backlight support +================= + +.. kernel-doc:: drivers/video/backlight/backlight.c + :doc: overview + +.. kernel-doc:: include/linux/backlight.h + :internal: + +.. kernel-doc:: drivers/video/backlight/backlight.c + :export: diff --git a/Documentation/gpu/index.rst b/Documentation/gpu/index.rst index 1fcf8e851e15..c9a51e3bfb5a 100644 --- a/Documentation/gpu/index.rst +++ b/Documentation/gpu/index.rst @@ -12,6 +12,7 @@ Linux GPU Driver Developer's Guide drm-uapi drm-client drivers + backlight vga-switcheroo vgaarbiter todo From patchwork Mon Jun 1 06:52:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11581507 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 84FFC157C for ; Mon, 1 Jun 2020 06:52:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6359120772 for ; Mon, 1 Jun 2020 06:52:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mtY7E35P" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6359120772 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5744A6E147; Mon, 1 Jun 2020 06:52:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6212F6E14A for ; Mon, 1 Jun 2020 06:52:44 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id c17so994298lji.11 for ; Sun, 31 May 2020 23:52:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NjiBPif2aC324+vDH5W7L3OnbFVYWltMaLDt/zt0WxE=; b=mtY7E35P7NMSOhp9i+6bfaqRO2BlrKF2/SCdxL4Wo+C/dxcNueZ/8rL6drsV5Qk4ms OBZHTwJMwRh3vvlu1nl9mBpequPzPsTggrEfpwP84EHz2HBpIB9avd6RWb23Qqp2sjkZ Pb04vSzZr1FEM/sZ8OBTs38Gh1DDOLFSM1Ujn+0t7oUMdCNm9bVm2M0EIeSGSnwt45KB 6Y/glw6EfVkRqqZhnjpU+wNvUkQRAf/gun9TNPiJ1plRGvTPhUJ5Gd9V7gakd43XkzX4 tNhtDSKq6ZvNVi01I14PkmXvUCoLKioBy7SAaHwC79131X0KVxC3qKFBFsgkuxrePiiE nX1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=NjiBPif2aC324+vDH5W7L3OnbFVYWltMaLDt/zt0WxE=; b=CdB0mYuitFE37eaTM+HNPdN7YLtaqKWurhM1e5mF2Trvl37ngmeUxy4NVYH5JyPbNx IeV/jmMP5lmNvPTsOQzvwn0fl3tpOwW7WZMG2ZdJb8+FZa5QF+DXwG+M8WwYcfMRdxAb DvM6vLDpPaXcDp1m77asfIf2gL8pwKMiNSPkufJ6hpQ0q4hBgsbZgfPp6qgFZJohPX68 4rk++uVlc7jd8tgywqu2QCISkUXwkEXSzyn0y7yhlivxltpE+8RUIOSUXSs/nalOLStS vI1JHPzVMKZra449IcQSAScMjK0wFq6GGwPVuaN9cICdpLfc0kFOCq6hTzzX0Eh7efkQ Y+ZA== X-Gm-Message-State: AOAM533PSc/aCnaXuwU/4QYoYC6On8aX85coh7GdNqNrEz553jbyGqjJ yic+xylkiNEiQTA58cK7VZd9O6wnpPk= X-Google-Smtp-Source: ABdhPJy7GQRKVdKefzETWFNpD9tAcpKEGeCIQ2ORhC0pwxa34K7ayOx8SXEcMeR6aBbHrE77mAFjFQ== X-Received: by 2002:a2e:8044:: with SMTP id p4mr10445457ljg.151.1590994362678; Sun, 31 May 2020 23:52:42 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:281d:a604:434c:a58d]) by smtp.gmail.com with ESMTPSA id e13sm2540462ljl.117.2020.05.31.23.52.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 23:52:42 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v3 12/13] backlight: as3711_bl: introduce backlight_is_blank() Date: Mon, 1 Jun 2020 08:52:06 +0200 Message-Id: <20200601065207.492614-13-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601065207.492614-1-sam@ravnborg.org> References: <20200601065207.492614-1-sam@ravnborg.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, Support Opensource , Michael Hennerich , Bartlomiej Zolnierkiewicz , David Airlie , Daniel Vetter , Tomi Valkeinen , Jonathan Corbet , Emil Velikov , Bjorn Andersson , Peter Ujfalusi , Andy Gross , Thierry Reding , Thomas Zimmermann , linux-arm-msm@vger.kernel.org, Uwe Kleine-Konig , Sam Ravnborg , patches@opensource.cirrus.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replaces the open-coded checks of the state, with the backlight_is_blank() helper. This increases readability of the code and aling the functionality across the drivers. Futhermore drop the debug prints in update_status(). If we need debug printing then we can add it to the backlight core. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Cc: Emil Velikov Reviewed-by: Daniel Thompson --- drivers/video/backlight/as3711_bl.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/video/backlight/as3711_bl.c b/drivers/video/backlight/as3711_bl.c index 33f0f0f2e8b3..cc5628beaffd 100644 --- a/drivers/video/backlight/as3711_bl.c +++ b/drivers/video/backlight/as3711_bl.c @@ -107,13 +107,7 @@ static int as3711_bl_update_status(struct backlight_device *bl) int brightness = bl->props.brightness; int ret = 0; - dev_dbg(&bl->dev, "%s(): brightness %u, pwr %x, blank %x, state %x\n", - __func__, bl->props.brightness, bl->props.power, - bl->props.fb_blank, bl->props.state); - - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) + if (backlight_is_blank(bl)) brightness = 0; if (data->type == AS3711_BL_SU1) { From patchwork Mon Jun 1 06:52:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11581513 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9DD6460D for ; Mon, 1 Jun 2020 06:52:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7C09420772 for ; Mon, 1 Jun 2020 06:52:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BXGN0Vcl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C09420772 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CC5EC6E14A; Mon, 1 Jun 2020 06:52:48 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by gabe.freedesktop.org (Postfix) with ESMTPS id 87AEE6E14A for ; Mon, 1 Jun 2020 06:52:47 +0000 (UTC) Received: by mail-lf1-x144.google.com with SMTP id x22so3304038lfd.4 for ; Sun, 31 May 2020 23:52:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WjyhXx/lEqOZWTi26IV1FNBZljIsRlbX7f2/Pg8bPak=; b=BXGN0Vclh8bt+Q54Yx/Mp00uTlxzlS/KGoxU/IHQ6H7NL/oykHjxzbwVnAKI3ky4ue X8gqdFtkMUB68lcVmYcOioZlLWnbbAMo5gOTgUEtYgW4RQOgZw0OvsW1l3Ov6f1UZJh9 GRKjNMGZkMwCTAsKaEI5WgwnBEyYQH+/GRweU1/HksjgRKztl2AsuAr8Tq2E8hjKNtcc ObvmFPTJOKPiXOd15u6R4BCD9aMCHFmU4XLROgfri/+3iZ85GOPMoby6fk01pt6eyyxE tHkV4I0mtMS2BW3H+e2RLyYgNY+4oLP1yxBGtO6OAzOb9V3HOlRmdSRSlw2vTC38mS+2 RlqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=WjyhXx/lEqOZWTi26IV1FNBZljIsRlbX7f2/Pg8bPak=; b=tkaNv6IGFwkgVaEFDLLfbKmWFfVRDN/lH/UZp4BdVnEpRkB8MDijJnCwdTCyb4cuDa Uf4huVO2nSxedpYubhrUhJFbMEtNtnsZnjOBLTWPRSsEoM3DQJMRcd4sncEQA0lYWKlL RV1XkbduefwpupooF2GRGH67+6NIIFt06d3GxcZ6Hui/IgCJOzyGofNdgneT/py9HQmc OaHYRshV/z113FW9+2UX8u+A63ISsxwgFi+Dpe53iPTZeUEaV4QmFq5WeBISneHQLrnv QSyyUD3OXPYfn1Qt3TzSIDupaHfupULy94YqwJHZ/cjQu3Xosyq91qMQG0OGy6oObWQv guNQ== X-Gm-Message-State: AOAM533jynhPynAirrlTs2ogE8/n3wX/SZWj0suWECyG8rsTThiVvpAR v5O4ya+aaDUyXEa+jNcDD5YJJm+HBe0= X-Google-Smtp-Source: ABdhPJzYzxMK+XuB5Xnj54j4sWqQJ7zyCFHD4iu0lWxBiwkDkBhhFC0YbeK85VLY4R8gmft0Um5J+w== X-Received: by 2002:a19:c8e:: with SMTP id 136mr10308817lfm.72.1590994365045; Sun, 31 May 2020 23:52:45 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:281d:a604:434c:a58d]) by smtp.gmail.com with ESMTPSA id e13sm2540462ljl.117.2020.05.31.23.52.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 23:52:44 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v3 13/13] backlight: use backlight_is_blank() in all backlight drivers Date: Mon, 1 Jun 2020 08:52:07 +0200 Message-Id: <20200601065207.492614-14-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601065207.492614-1-sam@ravnborg.org> References: <20200601065207.492614-1-sam@ravnborg.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, Support Opensource , Michael Hennerich , Bartlomiej Zolnierkiewicz , David Airlie , Daniel Vetter , Tomi Valkeinen , Jonathan Corbet , Emil Velikov , Bjorn Andersson , Peter Ujfalusi , Andy Gross , Thierry Reding , Thomas Zimmermann , linux-arm-msm@vger.kernel.org, Uwe Kleine-Konig , Sam Ravnborg , patches@opensource.cirrus.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replaces the open-coded checks of the state etc., with the backlight_is_blank() helper. This increases readability of the code and align the functionality across the drivers. v3: - Dropped as3711_bl, it will be modified in another patch v2: - Fixed so changelog is readable Signed-off-by: Sam Ravnborg Reviewed-by: Daniel Thompson Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Cc: Michael Hennerich Cc: Support Opensource Cc: Thierry Reding Cc: "Uwe Kleine-König" Cc: Andy Gross Cc: Bjorn Andersson Cc: linux-pwm@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org Cc: patches@opensource.cirrus.com Reviewed-by: Peter Ujfalusi --- drivers/video/backlight/88pm860x_bl.c | 8 +------- drivers/video/backlight/adp5520_bl.c | 5 +---- drivers/video/backlight/adp8860_bl.c | 5 +---- drivers/video/backlight/adp8870_bl.c | 5 +---- drivers/video/backlight/bd6107.c | 4 +--- drivers/video/backlight/corgi_lcd.c | 5 +---- drivers/video/backlight/cr_bllcd.c | 22 +++++++--------------- drivers/video/backlight/da903x_bl.c | 8 +------- drivers/video/backlight/ep93xx_bl.c | 3 +-- drivers/video/backlight/gpio_backlight.c | 4 +--- drivers/video/backlight/hp680_bl.c | 4 +--- drivers/video/backlight/jornada720_bl.c | 2 +- drivers/video/backlight/kb3886_bl.c | 4 +--- drivers/video/backlight/led_bl.c | 4 +--- drivers/video/backlight/lm3533_bl.c | 4 +--- drivers/video/backlight/locomolcd.c | 4 +--- drivers/video/backlight/lv5207lp.c | 4 +--- drivers/video/backlight/max8925_bl.c | 8 +------- drivers/video/backlight/pwm_bl.c | 4 +--- drivers/video/backlight/qcom-wled.c | 4 +--- drivers/video/backlight/tps65217_bl.c | 4 +--- drivers/video/backlight/wm831x_bl.c | 8 +------- 22 files changed, 28 insertions(+), 95 deletions(-) diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c index 20d96a5ac384..162c83ab0f5a 100644 --- a/drivers/video/backlight/88pm860x_bl.c +++ b/drivers/video/backlight/88pm860x_bl.c @@ -123,13 +123,7 @@ static int pm860x_backlight_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.state & BL_CORE_SUSPENDED) + if (backlight_is_blank(bl)) brightness = 0; return pm860x_backlight_set(bl, brightness); diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c index 0f63f76723a5..d817b0d95c9d 100644 --- a/drivers/video/backlight/adp5520_bl.c +++ b/drivers/video/backlight/adp5520_bl.c @@ -67,10 +67,7 @@ static int adp5520_bl_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bl)) brightness = 0; return adp5520_bl_set(bl, brightness); diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c index 19968104fc47..a0ce2a3701fa 100644 --- a/drivers/video/backlight/adp8860_bl.c +++ b/drivers/video/backlight/adp8860_bl.c @@ -363,10 +363,7 @@ static int adp8860_bl_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bl)) brightness = 0; return adp8860_bl_set(bl, brightness); diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c index 4c0032010cfe..ae4269fdb189 100644 --- a/drivers/video/backlight/adp8870_bl.c +++ b/drivers/video/backlight/adp8870_bl.c @@ -401,10 +401,7 @@ static int adp8870_bl_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bl)) brightness = 0; return adp8870_bl_set(bl, brightness); diff --git a/drivers/video/backlight/bd6107.c b/drivers/video/backlight/bd6107.c index d5d5fb457e78..f6a5c1dba3bc 100644 --- a/drivers/video/backlight/bd6107.c +++ b/drivers/video/backlight/bd6107.c @@ -84,9 +84,7 @@ static int bd6107_backlight_update_status(struct backlight_device *backlight) struct bd6107 *bd = bl_get_data(backlight); int brightness = backlight->props.brightness; - if (backlight->props.power != FB_BLANK_UNBLANK || - backlight->props.fb_blank != FB_BLANK_UNBLANK || - backlight->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) + if (backlight_is_blank(backlight)) brightness = 0; if (brightness) { diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c index 25ef0cbd7583..c9adf4e26355 100644 --- a/drivers/video/backlight/corgi_lcd.c +++ b/drivers/video/backlight/corgi_lcd.c @@ -422,10 +422,7 @@ static int corgi_bl_update_status(struct backlight_device *bd) struct corgi_lcd *lcd = bl_get_data(bd); int intensity = bd->props.brightness; - if (bd->props.power != FB_BLANK_UNBLANK) - intensity = 0; - - if (bd->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bd)) intensity = 0; if (corgibl_flags & CORGIBL_SUSPENDED) diff --git a/drivers/video/backlight/cr_bllcd.c b/drivers/video/backlight/cr_bllcd.c index 4624b7b7c6a6..d5ab7675f55c 100644 --- a/drivers/video/backlight/cr_bllcd.c +++ b/drivers/video/backlight/cr_bllcd.c @@ -59,26 +59,18 @@ struct cr_panel { static int cr_backlight_set_intensity(struct backlight_device *bd) { - int intensity = bd->props.brightness; u32 addr = gpio_bar + CRVML_PANEL_PORT; u32 cur = inl(addr); - if (bd->props.power == FB_BLANK_UNBLANK) - intensity = FB_BLANK_UNBLANK; - if (bd->props.fb_blank == FB_BLANK_UNBLANK) - intensity = FB_BLANK_UNBLANK; - if (bd->props.power == FB_BLANK_POWERDOWN) - intensity = FB_BLANK_POWERDOWN; - if (bd->props.fb_blank == FB_BLANK_POWERDOWN) - intensity = FB_BLANK_POWERDOWN; - - if (intensity == FB_BLANK_UNBLANK) { /* FULL ON */ - cur &= ~CRVML_BACKLIGHT_OFF; - outl(cur, addr); - } else if (intensity == FB_BLANK_POWERDOWN) { /* OFF */ + if (backlight_is_blank(bd)) { + /* OFF */ cur |= CRVML_BACKLIGHT_OFF; outl(cur, addr); - } /* anything else, don't bother */ + } else { + /* FULL ON */ + cur &= ~CRVML_BACKLIGHT_OFF; + outl(cur, addr); + } return 0; } diff --git a/drivers/video/backlight/da903x_bl.c b/drivers/video/backlight/da903x_bl.c index 62540e4bdedb..ca351badfdcf 100644 --- a/drivers/video/backlight/da903x_bl.c +++ b/drivers/video/backlight/da903x_bl.c @@ -79,13 +79,7 @@ static int da903x_backlight_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.state & BL_CORE_SUSPENDED) + if (backlight_is_blank(bl)) brightness = 0; return da903x_backlight_set(bl, brightness); diff --git a/drivers/video/backlight/ep93xx_bl.c b/drivers/video/backlight/ep93xx_bl.c index 4149e0b2f83c..491185df1411 100644 --- a/drivers/video/backlight/ep93xx_bl.c +++ b/drivers/video/backlight/ep93xx_bl.c @@ -38,8 +38,7 @@ static int ep93xxbl_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bl)) brightness = 0; return ep93xxbl_set(bl, brightness); diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 75409ddfba3e..94b65e4d2aa0 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -25,9 +25,7 @@ static int gpio_backlight_get_next_brightness(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) + if (backlight_is_blank(bl)) brightness = 0; return brightness; diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c index 8ea42b8d9bc8..01d805ca8415 100644 --- a/drivers/video/backlight/hp680_bl.c +++ b/drivers/video/backlight/hp680_bl.c @@ -35,9 +35,7 @@ static void hp680bl_send_intensity(struct backlight_device *bd) u16 v; int intensity = bd->props.brightness; - if (bd->props.power != FB_BLANK_UNBLANK) - intensity = 0; - if (bd->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bd)) intensity = 0; if (hp680bl_suspended) intensity = 0; diff --git a/drivers/video/backlight/jornada720_bl.c b/drivers/video/backlight/jornada720_bl.c index f0385f9cf9da..996f7ba3b373 100644 --- a/drivers/video/backlight/jornada720_bl.c +++ b/drivers/video/backlight/jornada720_bl.c @@ -54,7 +54,7 @@ static int jornada_bl_update_status(struct backlight_device *bd) jornada_ssp_start(); /* If backlight is off then really turn it off */ - if ((bd->props.power != FB_BLANK_UNBLANK) || (bd->props.fb_blank != FB_BLANK_UNBLANK)) { + if (backlight_is_blank(bd)) { ret = jornada_ssp_byte(BRIGHTNESSOFF); if (ret != TXDUMMY) { dev_info(&bd->dev, "brightness off timeout\n"); diff --git a/drivers/video/backlight/kb3886_bl.c b/drivers/video/backlight/kb3886_bl.c index 1dfe13c18925..a0fd5d3d82f5 100644 --- a/drivers/video/backlight/kb3886_bl.c +++ b/drivers/video/backlight/kb3886_bl.c @@ -89,9 +89,7 @@ static int kb3886bl_send_intensity(struct backlight_device *bd) { int intensity = bd->props.brightness; - if (bd->props.power != FB_BLANK_UNBLANK) - intensity = 0; - if (bd->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bd)) intensity = 0; if (kb3886bl_flags & KB3886BL_SUSPENDED) intensity = 0; diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c index 3f66549997c8..c655ddd99cfb 100644 --- a/drivers/video/backlight/led_bl.c +++ b/drivers/video/backlight/led_bl.c @@ -56,9 +56,7 @@ static int led_bl_update_status(struct backlight_device *bl) struct led_bl_data *priv = bl_get_data(bl); int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & BL_CORE_FBBLANK) + if (backlight_is_blank(bl)) brightness = 0; if (brightness > 0) diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c index ee09d1bd02b9..476146b62c4e 100644 --- a/drivers/video/backlight/lm3533_bl.c +++ b/drivers/video/backlight/lm3533_bl.c @@ -41,9 +41,7 @@ static int lm3533_bl_update_status(struct backlight_device *bd) struct lm3533_bl *bl = bl_get_data(bd); int brightness = bd->props.brightness; - if (bd->props.power != FB_BLANK_UNBLANK) - brightness = 0; - if (bd->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bd)) brightness = 0; return lm3533_ctrlbank_set_brightness(&bl->cb, (u8)brightness); diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c index cdc02e04f89d..8064cad8d683 100644 --- a/drivers/video/backlight/locomolcd.c +++ b/drivers/video/backlight/locomolcd.c @@ -113,9 +113,7 @@ static int locomolcd_set_intensity(struct backlight_device *bd) { int intensity = bd->props.brightness; - if (bd->props.power != FB_BLANK_UNBLANK) - intensity = 0; - if (bd->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bd)) intensity = 0; if (locomolcd_flags & LOCOMOLCD_SUSPENDED) intensity = 0; diff --git a/drivers/video/backlight/lv5207lp.c b/drivers/video/backlight/lv5207lp.c index c6ad73a784e2..ef8aa9803577 100644 --- a/drivers/video/backlight/lv5207lp.c +++ b/drivers/video/backlight/lv5207lp.c @@ -48,9 +48,7 @@ static int lv5207lp_backlight_update_status(struct backlight_device *backlight) struct lv5207lp *lv = bl_get_data(backlight); int brightness = backlight->props.brightness; - if (backlight->props.power != FB_BLANK_UNBLANK || - backlight->props.fb_blank != FB_BLANK_UNBLANK || - backlight->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) + if (backlight_is_blank(backlight)) brightness = 0; if (brightness) { diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index 97cc260ff9d1..b8af2c6407d3 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c @@ -66,13 +66,7 @@ static int max8925_backlight_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.state & BL_CORE_SUSPENDED) + if (backlight_is_blank(bl)) brightness = 0; return max8925_backlight_set(bl, brightness); diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 82b8d7594701..7d0ffcd37f07 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -111,9 +111,7 @@ static int pwm_backlight_update_status(struct backlight_device *bl) int brightness = bl->props.brightness; struct pwm_state state; - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & BL_CORE_FBBLANK) + if (backlight_is_blank(bl)) brightness = 0; if (pb->notify) diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c index 3d276b30a78c..9600f5d58ece 100644 --- a/drivers/video/backlight/qcom-wled.c +++ b/drivers/video/backlight/qcom-wled.c @@ -261,9 +261,7 @@ static int wled_update_status(struct backlight_device *bl) u16 brightness = bl->props.brightness; int rc = 0; - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & BL_CORE_FBBLANK) + if (backlight_is_blank(bl)) brightness = 0; mutex_lock(&wled->lock); diff --git a/drivers/video/backlight/tps65217_bl.c b/drivers/video/backlight/tps65217_bl.c index 762e3feed097..1041e5e62ee3 100644 --- a/drivers/video/backlight/tps65217_bl.c +++ b/drivers/video/backlight/tps65217_bl.c @@ -82,9 +82,7 @@ static int tps65217_bl_update_status(struct backlight_device *bl) if (bl->props.state & BL_CORE_SUSPENDED) brightness = 0; - if ((bl->props.power != FB_BLANK_UNBLANK) || - (bl->props.fb_blank != FB_BLANK_UNBLANK)) - /* framebuffer in low power mode or blanking active */ + if (backlight_is_blank(bl)) brightness = 0; if (brightness > 0) { diff --git a/drivers/video/backlight/wm831x_bl.c b/drivers/video/backlight/wm831x_bl.c index e55977d54c15..dc2ab6c8b7f9 100644 --- a/drivers/video/backlight/wm831x_bl.c +++ b/drivers/video/backlight/wm831x_bl.c @@ -93,13 +93,7 @@ static int wm831x_backlight_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.state & BL_CORE_SUSPENDED) + if (backlight_is_blank(bl)) brightness = 0; return wm831x_backlight_set(bl, brightness);