From patchwork Fri Jul 3 18:45:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642627 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 4929413BD for ; Fri, 3 Jul 2020 18:46:10 +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 27CDD2084C for ; Fri, 3 Jul 2020 18:46:10 +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="hWudvJIM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27CDD2084C 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 13C3F6EB92; Fri, 3 Jul 2020 18:46:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by gabe.freedesktop.org (Postfix) with ESMTPS id 95F326EB92 for ; Fri, 3 Jul 2020 18:46:06 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id k17so6251274lfg.3 for ; Fri, 03 Jul 2020 11:46:06 -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=slEyhjL47i6I9Wxhc3waVaJdqdZuvpWrNlMHpCPdtlI=; b=hWudvJIMNNbUW3X9DzjPBCCvb5ZIR6oSWPu4iLaJwfPDbd00Hi7Rk3R0vWiNrR60Nz rfBpoPiWKAovJ5AsHV5Aqgndv5gBqK6RoDgSnXgHGD2qRdJVyj7zPsWzxaj7cbNmFfEq H5kumOr2XGwekyw6aLMHigST7LM22Lp0yI6e9eoi8HarqcgDrOfXPPJHx4mjRkOq7gz0 Jh7E4jvR0dyqawG4vQQWT/sH8HW/wDSYcuxSzwpkA12OtxNuRY8bNbSzZMDom+dyIwN6 Qfw2eHWwx7Ldc2PtO4PkIyCif+BE8Ln593yOTLX1fue8dyO5Kbnz7hrBCS2vuS2Wv9oJ dKvA== 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=slEyhjL47i6I9Wxhc3waVaJdqdZuvpWrNlMHpCPdtlI=; b=aj7xcHgbBia7QOiK3EQql/k/SIR6uCQ77qtHsHaVwxcCa9JkKieic9AEeecBB0rpGI 6yHFvDuCfL6xPDCvaQTbMFCpfXX8cxdElhxuqTDepl2jxYRVBfVFVNiPwuMirvNek/wT jZ70z09kB9P4uXq5r0CIBDG/Unml3S1tapHZJRl83qV7v7O3Up56pAnyl+01km3agkui U3sX2lA6oUzbVJ8pss3h5r+Br1XiU9GqzBA1+bTIHaItpWLXIoTSdnZnISP6TFAPHSBP dv4EabTUFANtjMlVllQsB9IeTMHt4ihRR+q08fWK4S27ZvfWWvahvREYnCKyQmvPB4Sd B7nQ== X-Gm-Message-State: AOAM530cHdbV1iuXPdKOuEg5qOwoRYOEms5wFFSXlGn/9E93/ik3lfkX l27h3/lrCEt08QUg9SezzU2TPYsHudU= X-Google-Smtp-Source: ABdhPJxZVEriVlg0DtABp602eurzMwv/ufWQs5sh/lb4hdctxwi/NmZJQsLASiwNE69v1pDGutzH7Q== X-Received: by 2002:a19:4a4e:: with SMTP id x75mr22707227lfa.70.1593801964841; Fri, 03 Jul 2020 11:46:04 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:04 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 01/20] backlight: refactor fb_notifier_callback() Date: Fri, 3 Jul 2020 20:45:27 +0200 Message-Id: <20200703184546.144664-2-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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 Reviewed-by: Emil Velikov 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 92d80aa0c0ef..7e249aa90b0e 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 Fri Jul 3 18:45:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642631 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 6FF7A13BD for ; Fri, 3 Jul 2020 18:46:13 +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 4B0762084C for ; Fri, 3 Jul 2020 18:46:13 +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="Kh0cYIP7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B0762084C 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 194746EB94; Fri, 3 Jul 2020 18:46:10 +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 C48616EB95 for ; Fri, 3 Jul 2020 18:46:08 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id b25so34487001ljp.6 for ; Fri, 03 Jul 2020 11:46:08 -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=eK/aZ3+ghdIFopzJxrnMF+M6xcoKuP5T0HDHhE7PCRE=; b=Kh0cYIP7f7GRh0jsMz67pBF5ogXJKQ7HBpCm8kOupB7NNCNTYuS2nhr5cYKlAV+XZk +t40EIa7T2OjEBA2E+1hU9CV+xVscjQY0tBenF6ouGcNayV9g8TqXWkIkH2b5DIoDRR+ XvE1O8abD1mm/wxeD2v/SUMBPRUzX6C3k2mDiil6gHNrfozZtmf71iXfvGav2UEZaLH4 BusJhlRNqdQmxRObtWc2I6ed/YOAA3XU9yWcdfbiJG5PIwEKUJBXc8MeIoiJJxsNxMo4 rXkO/YJ0N3+JDrdboHmgth5Pct86Gvn9qT7he86M5Xyt24uu0PtildaZKF224trgwTUU 3ObQ== 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=eK/aZ3+ghdIFopzJxrnMF+M6xcoKuP5T0HDHhE7PCRE=; b=UUax9Ga9O+aWfc5FQtJyJqj1YTUWXBq36mbj1BqM+GuQVMNwEZwv5NbJyOwPDMnefW Ws63fR6wM3zw0ITLKwYYam58QlbywkN5UXDWNs7FA6sdmk7y+FRdJLfdTZJYoKkTSTP0 OWJpo7pgHCstvDw+7t1gVjGgXk98XcJ0vxhL/vVBzaTz14OVh38MiZ0XOdbapj6qX22H 91szHtj60nuClAyp4WJ0ni8WNWcsBAfHGBETMTDwz0WbCdHwXmX1mIQurnekU+vOW/u4 ghC9IrKVn9sEqC2Rdlauoz1TSGrAGvchiUowl2hT3sSbQJlL4hUfbyzqzbYWRRfPs/Fr YKMg== X-Gm-Message-State: AOAM530hHyCeSvKtQb0Sd5ojohR7dt5+HGf97uQssTmeJTlWt5H3eEqN U8L2GKb7vCrtfTxB2xeprwN4MCutP/0= X-Google-Smtp-Source: ABdhPJx6f8dy7nC47enwxaN0YU2FjLuW8bB0B5VwVDqrwe5zJLqWBOoRu8fveYQH8mG3ZLmypskStw== X-Received: by 2002:a2e:99c6:: with SMTP id l6mr14274238ljj.220.1593801966954; Fri, 03 Jul 2020 11:46:06 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:06 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 02/20] backlight: add backlight_is_blank() Date: Fri, 3 Jul 2020 20:45:28 +0200 Message-Id: <20200703184546.144664-3-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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. v4: - struct backlight_device * is now const 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 Reviewed-by: Peter Ujfalusi Reviewed-by: Emil Velikov Cc: Emil Velikov Cc: Daniel Vetter Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Reviewed-by: Daniel Vetter --- include/linux/backlight.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 56e4580d4f55..56e51ebab740 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(const 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 Fri Jul 3 18:45:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642635 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 8438060D for ; Fri, 3 Jul 2020 18:46:15 +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 62B8A2084C for ; Fri, 3 Jul 2020 18:46:15 +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="NN0cF9Pc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 62B8A2084C 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 948596EB98; Fri, 3 Jul 2020 18:46:12 +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 B43BB6EB95 for ; Fri, 3 Jul 2020 18:46:10 +0000 (UTC) Received: by mail-lf1-x144.google.com with SMTP id d21so19026118lfb.6 for ; Fri, 03 Jul 2020 11:46:10 -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=7IVQg6N9Y7IT+7TfYzwS4f6zi+ddclNT7W4+DeE2wDo=; b=NN0cF9PcXBtt5ay+WTZ71waV5oPagPhgRWuVg7vbghnZ6i5YM5Re+IGejakQTtnmpm 1t0DuQJ4FdwcWhZxHPKkInyIhxys8OAYMv+vJ7eISf33Oy3E41Big2T+T41oXJyRX1eB JktCqfQoZtFje5t/bocmLZNm6vE4XrNISrS55nH3VlIktDKm1/+pDCA03NOhvcoj/7KV Cp8bHHRMdWehBhYbjpM9LC/Rgpi0zF8dayMGJK0zURWeBVAQIS8za2L9hxBLT8iFD/oI c5SXHtPHIAprvz+8WQh/Whch7xVPggIpuMQh9LFsRhS4EY/DOiayCWxuVIcV9O5UMLN6 Mpng== 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=7IVQg6N9Y7IT+7TfYzwS4f6zi+ddclNT7W4+DeE2wDo=; b=LF5cZYkVhMvYYO5JwqvxC/t5njnuAgf8FKz5cOEA/OXes00BdWYywI+iTfB7tU4XPP luHP1c7eYN7d8VHzEbOFr0iIghE0cAzCcZAzErObJZl+v1V6KmZITYq2G1kHzz9FCJiD QSQxzSRjXiYTcYL0VzkBQFyqpFxCLsKqKqVd0oLVxbMWi1J0mBfeDBysEcqjK5w0dOxg WjywJVQgzvGcbhLLx+rrYhLVfovzamDP6ounM7+leIJ2ooF4XzndEPn06oFLpy5VDUY+ t5GgLjGVsmBZJNvLGAXCJP6DppYdG8JUPmMVCrKTFE6jtSSbnN5ssxyYq5/65Ad+6kqI 7OZA== X-Gm-Message-State: AOAM531A0/86HWhbRIquCP0Y/7Y7+kL5L2dIGwQLttGHCRE9s0voa8BA 22ZUEmF6xmCRPDkNODZVRP342J3z0xo= X-Google-Smtp-Source: ABdhPJzceajSEflpyNDbvmbQ5SE9lYyuwdyQ3ujHp2eBq+Gvz2qzAiPY5DvHTg24oWc7pxGMT9Y9hA== X-Received: by 2002:ac2:508d:: with SMTP id f13mr8858766lfm.65.1593801968942; Fri, 03 Jul 2020 11:46:08 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:08 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 03/20] backlight: improve backlight_ops documentation Date: Fri, 3 Jul 2020 20:45:29 +0200 Message-Id: <20200703184546.144664-4-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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 Reviewed-by: Emil Velikov 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 56e51ebab740..dfb43ee02ea0 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 Fri Jul 3 18:45:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642639 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 5CFDA60D for ; Fri, 3 Jul 2020 18:46:17 +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 3B9FF2084C for ; Fri, 3 Jul 2020 18:46:17 +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="aUrQbKZd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B9FF2084C 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 662BF6EB97; Fri, 3 Jul 2020 18:46:14 +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 D2C946EB9A for ; Fri, 3 Jul 2020 18:46:12 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id e4so38110093ljn.4 for ; Fri, 03 Jul 2020 11:46:12 -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=nbqgxv/h5SeSHOXMolpp1BPamIvzkqESgLDvhPwqMhU=; b=aUrQbKZdkhxD1Dd4uBn5ucmlkFRreyu98hbK7o3nUJZwjsPOawXWWS3FA7FkPHM25i t+C8U4CEYx2Yg5LL/Vs9FGMuAvPEf1RTdiSrn8EvyIxw0IQmpmxWlfxR5tK5D36ezspC VqkBZ7eiUJKfCW88KNSRS0JtIBAGLD+KKpPMpyDTOFfUI3wCZx+MfDnHO+YMtMp9i4fN Ym/N7AHLblWfueGGKW8aszqrB0bYioGSbtVSsrZUvIdOTEhWfUqmBaNpQS3xmKxDUouD ar0ODZlYti3Y9E2NBZ9hkIJC24AyseEOkN1Vjxc+BfGlvVCtCHe8yNYEqFXWa0z/3Zbx aNmQ== 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=nbqgxv/h5SeSHOXMolpp1BPamIvzkqESgLDvhPwqMhU=; b=ggC/IKPzvnzDE3YWW1g9Qj2qMD2QYFvVWZDt0AL0mzOGw02CvKlqvIhutuBgBDHMjv ES9DjeGXB3eSGcMcABd40VmW6JvdlJRhXFfU1I2rroMgwKA37pr+sJtwsmCV/j/UXDyu Z6y/iuPJQ4TyzLwEerES9WcHSEB1vdnpQAA03X/6PW5zF04eRT8ppU36l+FDzuRK9R+K R3segsi4y0IdFeexrtNXUm8McTSvhn/lNIT2Gile7V4Fp/W1lRpH2HVvuQMk5SpGJtZq X5FS5IeV9AGmGpiqns+XI2MIwHOIwfC9EgMhZfjOXZpcj4rum6Qhrt8JF7cEpwyNsP/z cAyg== X-Gm-Message-State: AOAM533Po6k7hgb2z/ySxPVF0NKBVCpnsC/WavQExm0ixu5qnPE2ndhr 8joaNZ7Kra++cVkdBDCossMUx1hiaDc= X-Google-Smtp-Source: ABdhPJyB2KLbGvSFYJK9M08dD+WetXzOuCGvcnziBRnn8Uhx16R3/LsaKsRHnGUZi1/20iEoXXzyoQ== X-Received: by 2002:a2e:8804:: with SMTP id x4mr20595944ljh.56.1593801971005; Fri, 03 Jul 2020 11:46:11 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:10 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 04/20] backlight: improve backlight_properties documentation Date: Fri, 3 Jul 2020 20:45:30 +0200 Message-Id: <20200703184546.144664-5-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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. v3: - Added missing '@' in kernel-doc 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 Reviewed-by: Daniel Thompson Reviewed-by: Emil Velikov Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- 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 dfb43ee02ea0..10518b00b059 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 Fri Jul 3 18:45:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642643 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 204A813BD for ; Fri, 3 Jul 2020 18:46:19 +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 F30232084C for ; Fri, 3 Jul 2020 18:46:18 +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="HpaxBh5G" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F30232084C 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 B53A16EB9A; Fri, 3 Jul 2020 18:46:15 +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 D56156EB9A for ; Fri, 3 Jul 2020 18:46:14 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id n23so38125815ljh.7 for ; Fri, 03 Jul 2020 11:46:14 -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=3+EMFfJ/GWN/oYTzmUu/mo7ItELrHC8VJ43RJqgEoQE=; b=HpaxBh5GXclKWorfDS8eeubjSbUnPeSdneyP8++kij8FIY+Qnp3c4K9T9afDl2eT/F kMzutjwUbVj9XeRzxdqtcKjTi7hRy3ksWM9rplbsHITFwGsyIg4BbGj1v9cqPy0RFeBd xKJxbxzSwMIvTLRgIIxRTFO0bEKMwQs9C1+fOrxXrD/jItC4h0rVXry/gsFbVk3zf/n+ 19TMl2UhhsocFn2yJIrmfW9qkxZpfWFIhY1p9XVPa05x1UYnLcT8dxCA3UCy/LA9HOc+ mcMRtRYnOQxVeSDp7S1ktRoNFyozsHAbvaSIgkO3mrQlNtUGCtLX1MZlzHxOGDCYZk5Z 7irQ== 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=3+EMFfJ/GWN/oYTzmUu/mo7ItELrHC8VJ43RJqgEoQE=; b=NDsREPCH0VWN4f43MGOblNOWz+oIEn6XgmUMc2iW906N3TYNjPX0V567cqPeUcJ7Hk PBrp4imgGCVr4dmy3RFx5jYLPyzl9HKOfGskVfYdSLNRO178F+TqVdUYd+vUXq9cuOeh nIHRWmVWx8pQB6dWaUotKHF2z9kajsrDts4VRed0CgFLn/6wckt87xgzs4OpySD1fcTy brpJtf+F2q09U/r+yA1UITPI1mQiyM3ylABHslbnW9mDsgDMD1NnLFM1BDq8leI7SkOj fgmG83B7g2jY688De9gUxCKM/z5bMw146Ny+y3dBeFwxjpiFqdND3XgD5uMYf4ZX+kxB dn4w== X-Gm-Message-State: AOAM530bQHb5CNgqXpyvxxEzT96NqD0/SkfPHIG1XwQhxQ/ZwSFh1uNn U4q0hgL28DbiwZHYyBfxbqwbhIKLeC0= X-Google-Smtp-Source: ABdhPJxDMmMZURhZTC0zGczgDx+Llxqhg3gaeOXHUSat2Cl1VgrK5usCllaKBX0X8BU0F3tdoUNFCQ== X-Received: by 2002:a2e:9c95:: with SMTP id x21mr13648532lji.234.1593801973131; Fri, 03 Jul 2020 11:46:13 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:12 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 05/20] backlight: improve backlight_device documentation Date: Fri, 3 Jul 2020 20:45:31 +0200 Message-Id: <20200703184546.144664-6-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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. The updated documentation is more strict on how locking is used. With the update neither update_lock nor ops_lock may be used outside the backlight core. This restriction was introduced to keep the locking simple by keeping it in the core. It was verified that this documents the current state by renaming update_lock => bl_update_lock and ops_lock => bl_ops_lock. The rename did not reveal any uses outside the backlight core. The rename is NOT part of this patch. v3: - Update changelog to explain locking details (Daniel) v2: - Add short intro to all fields (Daniel) - Updated description of update_lock (Daniel) Signed-off-by: Sam Ravnborg Reviewed-by: Emil Velikov Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Reviewed-by: Daniel Thompson Reviewed-by: 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 10518b00b059..7654fe5f1589 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 Fri Jul 3 18:45:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642647 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 CE65560D for ; Fri, 3 Jul 2020 18:46:20 +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 AD5AA2084C for ; Fri, 3 Jul 2020 18:46:20 +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="XCwWqqKa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD5AA2084C 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 1AA826EB9B; Fri, 3 Jul 2020 18:46:18 +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 D24A56EB9C for ; Fri, 3 Jul 2020 18:46:16 +0000 (UTC) Received: by mail-lf1-x144.google.com with SMTP id k17so6251535lfg.3 for ; Fri, 03 Jul 2020 11:46:16 -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=76GYwHJgmpg1D+ufO0JSzMv0fcAJAUH2Ai/nlDiORJQ=; b=XCwWqqKaoJ9GY8XfUndqUq6Vjy5mVIvp/JQIsd3c2s3e/DFaT4x1RYdECZ7hADeg7A XD8laph6i7Omw2sMJacDaEjBVaFGHcr/slybT0ZO0RnOSo9URXZvOUVPaV1taIp3wbZK 5wZX2gjTq2EzzilQDlzx4HPYwgU9eeuXla+wjfnbjR2+O6ftUdKY8FLGMAy5xcMJfdZH K/jqmptdwiGN8U5ZCBkrBiu/38Wu0RD5rAaO385T2OezFvo0ZPFMk6lnVSgeabIKkxqG BKEPdzsLnJTfZ5h8shP7CucATIIXQOm3BLcJFMYZIYK8EUn1jPHlJBnegoWDh/3Hzr3p vtOg== 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=76GYwHJgmpg1D+ufO0JSzMv0fcAJAUH2Ai/nlDiORJQ=; b=OzTmOrJu8rMfpbLYTKyg6q87BPlWDVTeG2SI9+WbJx0Q3n6GpdakjTQ8/npN/I+6D9 lyn85daH/k0yz7+UY/e0WYYjSosfzsx57HftZcu4Y0IBUN28hS+sJd7M1j2ZQehf03k5 nMzcDdFRCfm19znnHUjvJpWCO7T084lleS8xJi1cGB3Uu83QXenWMJT0DMtQfSSP2SdN aoU0iKa+zfjA4UDiH+3XM/iyHHMrbL01LCZo9yIpmndz8fkL2vm+JzgUPbQowjOos0n1 Ds/rjdpG6xtyYdnA7ZuVCQS06aHeinbawkMyC28maoP8BpzpqAcwelT+sWLIlFJMZzbb ccfg== X-Gm-Message-State: AOAM53192ex1d2OOY98iT+7M13R7MNnlVXn8UxvTQt9dFu9NGu+7B3MZ Q2xjqOwgLRAjQx/lyGVp9o/uz3jhceo= X-Google-Smtp-Source: ABdhPJz8bmVRIrBKTzOJ3rIl6mEq0ud3DW6wn671IW0G6f34jg/y3QlzvCxFFE92mpTId7a05bIO+Q== X-Received: by 2002:a19:ad41:: with SMTP id s1mr6607452lfd.191.1593801975119; Fri, 03 Jul 2020 11:46:15 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:14 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 06/20] backlight: document inline functions in backlight.h Date: Fri, 3 Jul 2020 20:45:32 +0200 Message-Id: <20200703184546.144664-7-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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 Reviewed-by: Emil Velikov 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 7654fe5f1589..7d6cb61e10f5 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; @@ -361,6 +365,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 Fri Jul 3 18:45:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642651 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 46BF2159A for ; Fri, 3 Jul 2020 18:46:22 +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 24B732088E for ; Fri, 3 Jul 2020 18:46:22 +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="oqlozcFW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 24B732088E 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 1BD016EB9C; Fri, 3 Jul 2020 18:46:20 +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 E97EE6EB9C for ; Fri, 3 Jul 2020 18:46:18 +0000 (UTC) Received: by mail-lf1-x141.google.com with SMTP id u25so19059451lfm.1 for ; Fri, 03 Jul 2020 11:46:18 -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=vYmiCB0MtpvvbRewOLH7Fp+n6izpRPTScgvaYJf2yds=; b=oqlozcFWehIysU86i5aW350PmfFrB7Ra6isNeLOds2GK3ZvMtIbcb8V7a6Nu9BAOfh HDZ5zc/BsZ2NkN+tQ+IcbtTiHEmghORPoE1t/GJBgr5Eec7J03qDdSVkjBR0QunAIrQW l6EC7yv12PfmCpcmAeB3G1UfNFSXmdciCV3w8f+9vHwtgu2ixi+O9fsYxLTbuIoDrWNM M+6oSKwMMWe1cKaWKMQRj3I6w5Fgs4lwkIuU9E2ggfKh6fNe1AXRL5dwJDbGvZTnkb4U j/NJWIG21fTGVtGrtPV0oy2vmvAh7TgF9MghMs8S54emllM+WBbis+OyhrFMK5hqMTkg +A5A== 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=vYmiCB0MtpvvbRewOLH7Fp+n6izpRPTScgvaYJf2yds=; b=lwO0TPv61lLGvIX6mJovFkJZ9rp6caVD/1mZUdIk/qTiJF6aI/dGwIpEjD5vN3c/UQ dOrKffoKml9oAUHoo73Kb6m4sNuXBsvWlbEd1+tuJpBxSRk0fNAdPS1BLc7Xg/T4sYXs wk2ocLVROlob4JNxQx9/D76bQcqbGz6PNPvsYRzXBEhzZUqcXRTJYhRstk1+yHlP2VkX dK81iz6OrbLzTFK/V6U/JKRew0PxKAjjhOoE2I8EgcGmbFB2m8XCeNrWu/bX8M77WUae kvzAw2YATxkn0LUP3vbP6y6xDEMxHHTQW5Ms/BJzxD/X1TgZ6sm8Gs2twXLfbwPU7p5u f2Ig== X-Gm-Message-State: AOAM533TjXrajG90k+nL+0C0+rg/SsKK9aegfvKdKl9rZj0MJft8QFU/ izX+8PiHtOl+2D3BXR0uy16aCj027Fw= X-Google-Smtp-Source: ABdhPJzzse2Tcvz14qq7VJIffxIIsoOKapJx3DrpiEf2jHlq+xTMPZVqx19W0DYg0TKZm/6G4csY3g== X-Received: by 2002:a19:3f42:: with SMTP id m63mr22876684lfa.104.1593801977166; Fri, 03 Jul 2020 11:46:17 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:16 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 07/20] backlight: document enums in backlight.h Date: Fri, 3 Jul 2020 20:45:33 +0200 Message-Id: <20200703184546.144664-8-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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 Reviewed-by: Emil Velikov Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- include/linux/backlight.h | 72 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 7d6cb61e10f5..0f425b32e6be 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, }; From patchwork Fri Jul 3 18:45:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642653 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 072F060D for ; Fri, 3 Jul 2020 18:46:24 +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 DA1FB20870 for ; Fri, 3 Jul 2020 18:46:23 +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="GeFJaWFx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA1FB20870 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 AEDCD6EB9E; Fri, 3 Jul 2020 18:46:22 +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 02C9F6EB9E for ; Fri, 3 Jul 2020 18:46:20 +0000 (UTC) Received: by mail-lf1-x142.google.com with SMTP id c11so19017414lfh.8 for ; Fri, 03 Jul 2020 11:46:20 -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=DyGPI75iVIn4zSAbyXty7YPUo17h6RwpsgJybxzcfiE=; b=GeFJaWFx7DzXF5WaoiOt3YVO308KSx5ai3uoIfkbrusBBdhN8+3Nh5NspFKQUa0EeA Lb+2o8PK1umste5xUNQ34dd2Zx1lt9xTVORBm/mwV7KZ+TkmplyPEJWai3qIE/4p5M+B 9L0hbR3fW51INBaTUTIW5X1x4hcCBD5djoiWFpk0/7j/d4Wh5yItQUHtZN+qv2ogZ1k1 x6sYPv1F0swtpzlwIwGlvXQ6b96loKPHMbn0Zkj0zI94HRMA6aob5f4V9fQZPK848Z/M Ua0Fd9iDeoK4WMnIfoUbil42ThLSJyPpMYbxWXh0ME4ojKi1Zn+cIh26yiwzYXscH51m GIAQ== 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=DyGPI75iVIn4zSAbyXty7YPUo17h6RwpsgJybxzcfiE=; b=Eh/xqZTYxw/HP9unHULnYT4bgXsRYQzHeab+wtiyqsHCGi3nN1JxKbEIS4MqJe4fDz 3hN6h1nsAk7WhRxo6/ZyMnLxDNBSaXv23Jh434mivtVkBZN2+WJtLf459fxlPAy/gu8o rhfs8edPHfpK2Bm1SghWtMchLH96zViBS9DkT+9W04rpb/LUihtVjg/bXJS3/aXFLtwP JjSll2qA6Wb2kBuN3bUj5vbtUGGun6i0iYYQUBwB7HAqEfvz9oXuwAkk/iueDyqgvHP4 4fDtPLLM4i14oBmP5L6NdtCUctlCoU6GYaMtqnYmlPAd6Y3OwGGcTAvmeX2AaAVkTdHo Ksmg== X-Gm-Message-State: AOAM533eXU2D2O/eQ7aBXzOUDFwe3ozJiPHrpZKM2UbRHmjTj0QKcLiJ K/w2ZnMUW4wOsgKbVb4lU1VEdVw0HDs= X-Google-Smtp-Source: ABdhPJxWAGpokmBlMdz4EupmP9LWdBe3jxR4pP1/De7yLnALWqE4Roc1hCXZGQ357KSercARwbQuig== X-Received: by 2002:a19:7d84:: with SMTP id y126mr23115474lfc.149.1593801979148; Fri, 03 Jul 2020 11:46:19 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:18 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 08/20] backlight: remove the unused backlight_bl driver Date: Fri, 3 Jul 2020 20:45:34 +0200 Message-Id: <20200703184546.144664-9-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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 Reviewed-by: Emil Velikov 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 0f425b32e6be..8f2005a6f8a9 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -454,15 +454,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 Fri Jul 3 18:45:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642657 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 723B113BD for ; Fri, 3 Jul 2020 18:46:25 +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 512C3208C7 for ; Fri, 3 Jul 2020 18:46:25 +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="CQPQFiOf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 512C3208C7 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 1EB1C6EB9F; Fri, 3 Jul 2020 18:46:24 +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 0F7396EB9F for ; Fri, 3 Jul 2020 18:46:23 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id q4so2358923lji.2 for ; Fri, 03 Jul 2020 11:46: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=QMIhGECQ39mxsFBNf2RZfIR0vNjqITM52PNfMW2B2fM=; b=CQPQFiOfJOvQsfgdhUU3Zl+ZYMCyX8a6t2TCYHjiTn6hqmlUvooqT7C30hg6ilj/ek k1a0AXbEzGYW10pu8eooF8kgdF1CTZ/euzASPYmGbZgDrcktTg/pO5GESva7pwfIpTxt gEUZgTaRdy+zoJempzZdVNW3CYj8DaVYqdLVJ/rWvECgL6q2WMDFJ+tUNMCKNIBexq2a 305I0tMVL0ZTOvJY3VPdnWpIOaRV9J2Xcx0eN044vqLbVuZqEISB6ezM9UtTfqWCiH9r sbsnuvI0P66OmceZ0X8mTW+f9kB3GY60oUECWOQlPaGT9PDQ7jmpFBAwVfmsmQgsn6CJ 5VEQ== 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=QMIhGECQ39mxsFBNf2RZfIR0vNjqITM52PNfMW2B2fM=; b=eSUThK6X9l+1S5BVF3Z5SiA9bEXHCoJgudSRjEYQorTj8Mnk1abz1XlhVD0M0yYdlK 8FoxpbheK1M4m0G1/7Qp8GXB+Rc+G8ogH685wxyGUtFJPKS2ahixZYgrq5QJgdJNq5nG LvQ9z9ILohj8IjuSKjmq+pCTy3xco7UI0wCL4IPoOKWAOc+zHrHy+rBCAOaL6oBVlbGS sLv3dTiTF7ev3j647U+ep8gDDzKvutPh9/2NDo0UzBM5+3Z0KVZNnMFNYBUGaz+q4wHa qQp5uC9E8/zLSsq+cReSRq/ehS0rTqPg0JSxWMkxiIPKsJWmTSejCVgGNDtyfyV2csRh l9MQ== X-Gm-Message-State: AOAM531uwXKsxrlGGiP1+0t8bfYdZ+mzccf4U+esdQ3vUnlIoAFnKwX/ JQbefQX6Lw59ktLWZCP5bmCOw5OsSwA= X-Google-Smtp-Source: ABdhPJzf9L8N4cz0RXnl+kds2M1mB9xgIlwVmFXhdkQBQtHfhvqbYqt46eq1HskHMqSbdEDRhNeGlw== X-Received: by 2002:a2e:91da:: with SMTP id u26mr14772411ljg.311.1593801981314; Fri, 03 Jul 2020 11:46:21 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:20 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 09/20] backlight: drop extern from prototypes Date: Fri, 3 Jul 2020 20:45:35 +0200 Message-Id: <20200703184546.144664-10-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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 Reviewed-by: Emil Velikov 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 8f2005a6f8a9..c6ac4cbb9ddb 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -417,23 +417,26 @@ static inline bool backlight_is_blank(const 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); +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_name(const char *name); -extern int backlight_device_set_brightness(struct backlight_device *bd, unsigned long brightness); +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 Fri Jul 3 18:45:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642661 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 23EAF60D for ; Fri, 3 Jul 2020 18:46:28 +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 02BC02088E for ; Fri, 3 Jul 2020 18:46:28 +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="jxTsAzyZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 02BC02088E 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 2071E6EBA0; Fri, 3 Jul 2020 18:46:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8669C6EBA0 for ; Fri, 3 Jul 2020 18:46:25 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id k17so6251778lfg.3 for ; Fri, 03 Jul 2020 11:46:25 -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=59JfyX1WPdKVllheyw55/VatnLv0Vnvhrfc5kCXlkEY=; b=jxTsAzyZFA3fIkxKASQZ+zaPiQd+OmiSkpJeU3TMQjJDb3pY9Sw/APCodqZpPHQ9Wd gIXWXiBY2jBqzM9COUJQVgUKL5wNok38Le9mru51Ne6twHTh4LKY/CpgbTK1DJHm1Z8W K6X+tBxWakZKTraZKpVJHEemek9sxWA703UIbmo1utesmV8PgJxj3hfSqnWD5ARoEuSk fLxt/+3Dn4io674ITjBIVl77Dj9nJ0YC8VwVT+IgSHPKVdAEoxcI+PpcJCHxMIvayH2E XTLT51QJLyqXOoj3jIuSfIlWtxwJEmGyJthxxsxycR3Yyti6a+LOdcQWcldWYLJk240d DKgw== 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=59JfyX1WPdKVllheyw55/VatnLv0Vnvhrfc5kCXlkEY=; b=g9AVTgY1vZNPH0NwaBi4I9tOYtO7VGpaZn7RpO2Jya74lgbLTwXVpAwr//k/9XEAFJ H8mQadyi/wRnwRQJanfs/l2kaCzimJ/Ke4gbf6gzSAxZOjHEAx/nH05bQ5oA6sPEphKl SsKdK0IkqlZz9O216buoMIzcc5RWTiby87kSXDdGBx/REEDM7eO5i4V/hTKiZFs6bVyV YRRbqqq917159lbujWuCBsaVR+dy++awNeWzHZwlyjdzHFVwKsDP/lzs9QX0J4NIk3f+ we6wB8Bz/mlTuCcYrCWldFoBMCyIqCx8f486QkUijOc//WktwPL5Mhus+Th7fQ2B6cd+ KTVw== X-Gm-Message-State: AOAM531eiFhMJgiFBWV2d8E9vXONzvDPZJr0An/z8uvngKG2E/1CPGlJ fLyX2oKNFDaJybr4OPEMsImODn4UwNM= X-Google-Smtp-Source: ABdhPJwY6tHnd7M7fpG9C1mdeyfb6WozR5cvpF5G+nQZYqOAbmOw0Q1/T3JABcLVEWZwCT+HGeHHfQ== X-Received: by 2002:ac2:46f0:: with SMTP id q16mr23003197lfo.51.1593801983423; Fri, 03 Jul 2020 11:46:23 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:22 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 10/20] backlight: add overview and update existing doc Date: Fri, 3 Jul 2020 20:45:36 +0200 Message-Id: <20200703184546.144664-11-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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. v4: - Include updated devm_of_find_backlight doc (was accidently included in a later patch) v3: - Updated a few editorial details (Daniel) 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 Reviewed-by: Daniel Thompson Reviewed-by: Emil Velikov Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- drivers/video/backlight/backlight.c | 143 +++++++++++++++++++--------- 1 file changed, 100 insertions(+), 43 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 7e249aa90b0e..db8717581ec5 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -22,6 +22,47 @@ #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 must 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 +81,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 +367,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 +388,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 +455,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; @@ -454,12 +503,7 @@ struct backlight_device *backlight_device_get_by_name(const char *name) } EXPORT_SYMBOL(backlight_device_get_by_name); -/** - * 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) @@ -507,10 +551,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) { @@ -522,10 +568,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) { @@ -534,20 +582,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, @@ -574,13 +624,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) @@ -671,12 +721,19 @@ 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 + * This function looks for a property named 'backlight' on the DT node + * connected to @dev and looks up the backlight device. The lookup is + * device managed so the reference to the backlight device is automatically * dropped on driver detach. + * + * RETURNS: + * + * A pointer to the backlight device if found. + * Error pointer -EPROBE_DEFER if the DT property is set, but no backlight + * device is found. NULL if there's no backlight property. */ struct backlight_device *devm_of_find_backlight(struct device *dev) { From patchwork Fri Jul 3 18:45:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642665 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 37DBA13BD for ; Fri, 3 Jul 2020 18:46:30 +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 1650920870 for ; Fri, 3 Jul 2020 18:46:30 +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="AEA3tNC3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1650920870 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 37C866EBA1; Fri, 3 Jul 2020 18:46:29 +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 5950A6EBA1 for ; Fri, 3 Jul 2020 18:46:27 +0000 (UTC) Received: by mail-lf1-x142.google.com with SMTP id s16so13568283lfp.12 for ; Fri, 03 Jul 2020 11:46:27 -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=wW63XUx9iwsgo3sF+eLJ1EmI31rAQ/9VoQVVmqYGrJA=; b=AEA3tNC3BMq9rPELr/rZiMYPpVOIgC5hETJd60ZbiaM2cESBA/+X6SIVasVZyvUEr6 cHgqNIYhMv4o1ACU1pNaBLEdnNvfZsPpwvGNquYML5vL12I8TBAauNOURQt3Knjlgf04 ZJG0pg+nwijDjTqOX8bJOzplLrBMVtQCgJ0BYfKgXdf54tmt7VQ+gUhdTTpGaDn8N5MX o65NysSypWG+FAdScjb1ygXPmFmHnyKSmuRYI+sP/q5QIMxFEHf2Iw1rtrxXNcRKPeda T7HQeUO1rf8M9+L/8GSNTG8DmqIIJsecGhQbruef2OdAIVBQfc+6ur/9b85tbX0ojth4 AnBw== 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=wW63XUx9iwsgo3sF+eLJ1EmI31rAQ/9VoQVVmqYGrJA=; b=HdzIIrNHphMf7dmSxqhQl2b1J2qnUchqrENnK5bWODy3/TPZcpW3HLCec9n4VLSGIa ndsKRuAAa32edUIzIRYtWWiKGtBpoMcWvu+soV4UeRceyTjGLdEXkhAT5yl0tOSSHFVK 9r7ESkO4VcNSuoa7Prjc4liBq/C8JL6qP4Gm0kFvQ65KVUFgVJJc+vjyV958eQuoUqrc V0sbcsbiQnjuo324yArG5rXWItkV6wol6ljZ/okSi+3IAKnUqURsEvHcEekPw3S+Vook RL94CzoaM1/asy5Bo9S5C2GDdaENG7C/Ic5toAmRquHQLElBqYukWzj6y84P9FRiOgsd cbJA== X-Gm-Message-State: AOAM532UdQRJvlgWn+CY/Qq5gqA+OVFq7r03P6Iw2Lpwmg0juBEOqooR WlSsvMDzJ+JAXqwliep90RrCJP0KTz4= X-Google-Smtp-Source: ABdhPJxEUXz4bOYpqKTDSZSj17VqbWse7IL9pSVI2ig7Wc0HkhTmo1clZ+dbXQsbopGFStzEnYoN6Q== X-Received: by 2002:a19:815:: with SMTP id 21mr22267814lfi.119.1593801985628; Fri, 03 Jul 2020 11:46:25 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:25 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 11/20] backlight: wire up kernel-doc documentation Date: Fri, 3 Jul 2020 20:45:37 +0200 Message-Id: <20200703184546.144664-12-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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 Reviewed-by: Emil Velikov 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 Fri Jul 3 18:45:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642669 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 B891D13BD for ; Fri, 3 Jul 2020 18:46: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 972FA2088E for ; Fri, 3 Jul 2020 18:46: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="VfpVPRzw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 972FA2088E 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 5071A6EBA3; Fri, 3 Jul 2020 18:46:30 +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 4AD866EBA3 for ; Fri, 3 Jul 2020 18:46:29 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id z24so13181062ljn.8 for ; Fri, 03 Jul 2020 11:46:29 -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=41qjmVVsRfujBfZE1W4YGhZi8CncNw8be02IRMyut3M=; b=VfpVPRzwwuFqCZ7fUPqVLOJvQKni550zzdLt2nGP8ambnSmBuqZNmOwpBEqZSOYgiD Q8wotiZqUwhzppC46a/R6RJQVIy7x8V/SdEntazBT6CNGvhWmpE2akVXz/zMHxEbC9yA a9gkAs2F+BBPUJGjxNT5WQUtL3nBRueVyIms0y1cIvPnm33wMSk7Vhv+HBLL5NmNQ+u5 HZ/F7cbQJxWn3UWnV1oGF5R3idD8JquldlJz/TRhX89eih5/9rBJi7pvMpQ6m5hOG3/x NYiGpf8TElwWyQiw22MQIo2/FfKkB9TGrqeqLiOUUVwBT8z5aeRJEKNHK8SH/acHRmBX P2bw== 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=41qjmVVsRfujBfZE1W4YGhZi8CncNw8be02IRMyut3M=; b=Fw0M2aa8x/V0/lda4dOFBAhVmJvkpCMPnFYxCN0Mlv9rCmFbio3yeLihGljSP0uVLX YGWCPfbg9F+16rqS0wxmMoSuALwlbtC2AsQhENoCtzLAJSVJCSDCSDJ4KJK9N6EcFLYn T4d6YYGRGj8sR1jjEzJf64T/adtf80WSnSB4mvf7ed+5M66+XnCsk1NT44WIofAA6Dzw W4b59UIhHfkq2vRhRB8goA6VCHCPut4zxCDXmBfE/Lax/j9gD8p0yAy3PCuzfSiNmVL8 2FfXM9UpLy5tSy9oT1+jwQq7aYA/xW9j24wOE6SS0Q85GIXN+DmFJzXWmS1qHgQoJ4Zy Uu5g== X-Gm-Message-State: AOAM532JXJBAsIMWgZ55otURZ04pMTSZjiI52jdV0hW3tN/tv+qQHm7a aFLfWIdKPct4B/5fGh4JqmfEGp7B2/s= X-Google-Smtp-Source: ABdhPJzQM5YseU4FLRbGqPO9auj0rWYRuQJ6L3t2SBa1OIW6Mb98AjbEZouXoOeElwNDHjdcB1Td5w== X-Received: by 2002:a2e:9b04:: with SMTP id u4mr21861645lji.364.1593801987598; Fri, 03 Jul 2020 11:46:27 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:27 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 12/20] backlight: introduce backlight_get_brightness() Date: Fri, 3 Jul 2020 20:45:38 +0200 Message-Id: <20200703184546.144664-13-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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" Based on an idea from Emil Velikov add a helper that checks backlight_is_blank() and return 0 as brightness if display is blank or the property value if not. This allows us to simplify the update_status() implementation in most of the backlight drivers. Signed-off-by: Sam Ravnborg Cc: Emil Velikov Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Reviewed-by: Daniel Thompson --- include/linux/backlight.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index c6ac4cbb9ddb..38db67588b16 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -417,6 +417,25 @@ static inline bool backlight_is_blank(const struct backlight_device *bd) bd->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK); } +/** + * backlight_get_brightness - Returns the current brightness value + * @bd: the backlight device + * + * Returns the current brightness value, taking in consideration the current + * state. If backlight_is_blank() returns true then return 0 as brightness + * otherwise return the current brightness property value. + * + * Backlight drivers are expected to use this function in their update_status() + * operation to get the brightness value. + */ +static inline int backlight_get_brightness(const struct backlight_device *bd) +{ + if (backlight_is_blank(bd)) + return 0; + else + return bd->props.brightness; +} + struct backlight_device * backlight_device_register(const char *name, struct device *dev, void *devdata, const struct backlight_ops *ops, From patchwork Fri Jul 3 18:45:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642673 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 8CEB960D for ; Fri, 3 Jul 2020 18:46: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 6B2A920884 for ; Fri, 3 Jul 2020 18:46: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="kK9IT2VP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B2A920884 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 8CCB26EBA4; Fri, 3 Jul 2020 18:46:32 +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 66CCA6EBA5 for ; Fri, 3 Jul 2020 18:46:31 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id e4so38110946ljn.4 for ; Fri, 03 Jul 2020 11:46: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=cuNmp2Y8twclxYeBZp9lqPlgdVdohaDn7/kP95qzQpY=; b=kK9IT2VP55hji7w3/BPDLgv5S1BIM2VNWRPFZIgGj+pAQViasT2BzK72Q2m6YUvVH8 t/I6KFLwVacqpCFWKF+aCBrTNuHmcgP0/vAbplT6/Ggvkuf91DEHeaH64Pw1pV13ZeK1 ZLPwGz4UG31u9GgK5ghjIGp8j3pBywRL9FKk1Xqu4zsvpIUf819HT3xjV/667+MQ752t JhaleG7ou2hlANhNQmSJmNrAHwNNkBhuREnz1Oc9OdKIqMffLZjCG3sA00bmd6JRQtyq z/wJG9+GIV3Zt7hWIui9V6yowJKpARl7old5SfFOeUZ3or/5MBU/6Imc2W6DIvvxwvxE fdWg== 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=cuNmp2Y8twclxYeBZp9lqPlgdVdohaDn7/kP95qzQpY=; b=nT7uSK2bUxWXUT3rva3zdtnk+Yu5IRnrHmD7pPbpXGr6wau4nfkcg2J4cFLBRqIdZW 21iskXC3enmrxiLJ9c8w7mVa5u2hgpdJG36P40PS6ZCl/kECDyOmMdvTF8vNgKigKPHN mVWDcKJZfOJ9Lob3ZMiC52HVqUAhxBD2Q8c7FK/GQ32kZvTEUKcuJer9L24qt9JIlYkp g9ZJ5aAHh8SNEhqFk/FP0WIWgtB56qZodZxfsdUayiAS5sO+qp9AxyLer+orz0Vrsjkx xFxcuEt8turHWJ+KOUQaXtr9dD3pKVnxejjdAsSEcMxcmdIFNNhs+MNDiwEAlBjWvQaD oM2A== X-Gm-Message-State: AOAM533Wtt8IXEAF3JSt03RtgQe84vDa54hqgLSQg0dMlUngU2IXxwrN wyyqXzZeveW4guh7o7xkCoTo841OaoA= X-Google-Smtp-Source: ABdhPJyBGH29SvxYyw0NjjWdvgwbdFGb97e14xVHDWd3nm3sy4Dj+wDXJFZR2VJ9zNEY+qr7qlaf+g== X-Received: by 2002:a2e:8092:: with SMTP id i18mr13181844ljg.265.1593801989670; Fri, 03 Jul 2020 11:46:29 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:29 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 13/20] backlight: as3711_bl: simplify update_status Date: Fri, 3 Jul 2020 20:45:39 +0200 Message-Id: <20200703184546.144664-14-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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_get_brightness() helper. This increases readability of the code and align 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. v2: - Use backlight_get_brightness() Signed-off-by: Sam Ravnborg Reviewed-by: Daniel Thompson Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Cc: Emil Velikov --- drivers/video/backlight/as3711_bl.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/video/backlight/as3711_bl.c b/drivers/video/backlight/as3711_bl.c index 33f0f0f2e8b3..3b60019cdc2b 100644 --- a/drivers/video/backlight/as3711_bl.c +++ b/drivers/video/backlight/as3711_bl.c @@ -104,17 +104,10 @@ static int as3711_bl_update_status(struct backlight_device *bl) struct as3711_bl_data *data = bl_get_data(bl); struct as3711_bl_supply *supply = to_supply(data); struct as3711 *as3711 = supply->as3711; - int brightness = bl->props.brightness; + int 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)) - brightness = 0; + brightness = backlight_get_brightness(bl); if (data->type == AS3711_BL_SU1) { ret = as3711_set_brightness_v(as3711, brightness, From patchwork Fri Jul 3 18:45:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642677 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 4ADB513BD for ; Fri, 3 Jul 2020 18:46:36 +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 29D5C2088E for ; Fri, 3 Jul 2020 18:46: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="i+dGOr4E" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 29D5C2088E 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 4FE836EBA5; Fri, 3 Jul 2020 18:46:35 +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 8A2156EBA6 for ; Fri, 3 Jul 2020 18:46:33 +0000 (UTC) Received: by mail-lj1-x241.google.com with SMTP id s9so38027421ljm.11 for ; Fri, 03 Jul 2020 11:46: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=yVpNCLVbYK3myT9m7EMLcaTGTbPNg14V6/aAMmsTZXg=; b=i+dGOr4EWUC5qQNHs62J7il3yC06m2A2KuvuM3yYcl8cBQLVGR/s0evNAyTgE2gcL6 dWM2JmoB1nEH4m+EYd1sCOmt3eIF/qSD7cZpMCla1tgSHcPn3R1KzFxnVTBbu9kTJT2y aafHd4s88I8gQloKgllw6AvfV24E3rSHtJlq8RijQRAL1lodcrvg1nnftOj8st6usR+0 PsXVhep4vXi2W4d/pWgkuUwF0/Te/s3OVe3iGYVC8UcWYURMgEPbhgdk9J1LKcar7g3d 0o/cx9EmYbM7MdzAHLxShbbqr/ReRkLyGSIA8Vpz2tb6VpphFmQ9P43mLiEKCAk0krZz qfNg== 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=yVpNCLVbYK3myT9m7EMLcaTGTbPNg14V6/aAMmsTZXg=; b=Qlau41cgaJy59PjTDftE0xiVqAcm9LfyzSoEq4XsXlDa6JkcMis6YIn5wLhdmicgSj FxB098aTw6aRnyCK43ZWSOKXKxD81X4uwT6nB60+eeTvTS4fGgLSp7leP8mhk10ITDW5 MQTIL5XnOnqHIyNoWOz8Gh0EwlzGeElG+bOgEUz4GVJt08/5kGKZ3XF7VgXqQVaUf84n X4+uTHqbImrU3fz/KWLLljnBssSy5dY+SbWBAaQ4kWzAn3+FfkBwwh47T8TrWvuZ9V/V pnWMmANo3Uxo307JorXEe0bYFu2iCRXZY935wnFjnzu4fV4ShTLpKktS1HjzGQsIUz6A +cOg== X-Gm-Message-State: AOAM53174tUEHR4ZbZSBlCWEd3UiHfc3IdmTF5kbsjRDP++j+ofGYbr6 KrB9vNwlhaqm+pER8LNsfnVE/52aNhU= X-Google-Smtp-Source: ABdhPJz6ywgEAki17QCT6lxB5XBqQ6/MR1UrT5bX2iXgmUlYUHpArI48qZ8zUwJ276Dr8lVs/vVFZA== X-Received: by 2002:a05:651c:1a7:: with SMTP id c7mr20688976ljn.345.1593801991763; Fri, 03 Jul 2020 11:46:31 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:31 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 14/20] backlight: cr_bllcd: introduce backlight_is_blank() Date: Fri, 3 Jul 2020 20:45:40 +0200 Message-Id: <20200703184546.144664-15-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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 cr_bllcd uses the FB_BLANK states as brightness. This results in brightness value equals 0 that turn on the display and 4 that turn off the display. Simplify the logic but keep current behaviour as userspace may expect brightness set to 0 to turn on the display. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- drivers/video/backlight/cr_bllcd.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/video/backlight/cr_bllcd.c b/drivers/video/backlight/cr_bllcd.c index 4624b7b7c6a6..edca5fee9689 100644 --- a/drivers/video/backlight/cr_bllcd.c +++ b/drivers/video/backlight/cr_bllcd.c @@ -63,22 +63,16 @@ static int cr_backlight_set_intensity(struct backlight_device *bd) 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) + if (backlight_is_blank(bd)) intensity = FB_BLANK_POWERDOWN; - if (intensity == FB_BLANK_UNBLANK) { /* FULL ON */ + if (intensity != FB_BLANK_POWERDOWN) { /* FULL ON */ cur &= ~CRVML_BACKLIGHT_OFF; outl(cur, addr); - } else if (intensity == FB_BLANK_POWERDOWN) { /* OFF */ + } else { /* OFF */ cur |= CRVML_BACKLIGHT_OFF; outl(cur, addr); - } /* anything else, don't bother */ + } return 0; } From patchwork Fri Jul 3 18:45:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642683 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 19482159A for ; Fri, 3 Jul 2020 18:46: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 EC8DA208E4 for ; Fri, 3 Jul 2020 18:46:37 +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="kGXo9YiH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC8DA208E4 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 2E7E86EBA6; Fri, 3 Jul 2020 18:46:37 +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 7947B6EBA6 for ; Fri, 3 Jul 2020 18:46:35 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id b25so34488270ljp.6 for ; Fri, 03 Jul 2020 11:46: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=yEjF7pEN/xrGxy0935aYNV70k+jmMYiQOI/9QnjZUaY=; b=kGXo9YiHByb/ZdboHuQZf8/EXqVwrUOLV9K0C5ghuKRYxJjlsf1mC0LWPcUal83U3e T0NSF9MKhwJ9kEvgnNnnDN1t2KVI47sT0lxaLwGz7KhVbKvICydANUR8r0UECtRAnNo4 sp11uPYqiDOWsw90j4YKvQ8YGCI6nEzY+3hajSV2DjnNctILaLi29pooDiv/3JlfcmFN CudZEwUe0wsT7+YCX4E3CkwvdzbZe0bltiUrqFPzZBgpg0G3VCnFsLxJRWsA+uLAtyKC S0SkhTxqUhvYc3BjntJLaG8/zLUt4V//9sY3veBe0vSrzuLckbEkE3RCOWUoVb6A++2U 55rw== 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=yEjF7pEN/xrGxy0935aYNV70k+jmMYiQOI/9QnjZUaY=; b=WBFFgsNf3fVhlzgrL07UNiIDrRQ2ZfFsJVs0FLLULKyH0760OXx1cRmwKRo1kxMpGg LqohksBX2i9JXV09rK6ADPcU9wb7qAxUslD8f6orNj2NbluEjsU1dBwIqUjP9Xq+7d8S b9lVKiDAuQLhSEo01ELSiFbVQRmcSlS0vuPcB53Knc09IObMjY4DSXlGhlDxpqbLK4p2 6cCp7O3QwBXKvECBxH+lE1rgggZ/No+VrAwsizUIxsYEa0J7QVIe88Uj8EdCikhLQ3H9 9q5XewyKh96btmzjMve/CGViGGjeofeyVOLL1gSvc9RFoU/57cuhnosiMoeUoP22Hr3i CR8g== X-Gm-Message-State: AOAM531rBnk8082fedKO/PFYPLv4ZTBHivqmHOL8guU+xWzKaIZQ5ZKm 3gx4fL2k75m/v3dCaDpOviFb8A4+ibE= X-Google-Smtp-Source: ABdhPJzXfRgTjlP6hr/OlcHKewcVR9hdREuWmRp2p6dKhsVeuObmf+HrkvtKNrQTf3gBMQArzdojCQ== X-Received: by 2002:a05:651c:3c2:: with SMTP id f2mr20912755ljp.37.1593801993807; Fri, 03 Jul 2020 11:46:33 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:33 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 15/20] backlight: gpio_backlight: simplify update_status() Date: Fri, 3 Jul 2020 20:45:41 +0200 Message-Id: <20200703184546.144664-16-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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" Introduce the use of backlight_get_brightness() to simplify the update_status() operation. With the simpler implementation drop the gpio_backlight_get_next_brightness() helper as it was now a one-liner. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Reviewed-by: Daniel Thompson --- drivers/video/backlight/gpio_backlight.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 75409ddfba3e..6f78d928f054 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -21,24 +21,11 @@ struct gpio_backlight { struct gpio_desc *gpiod; }; -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)) - brightness = 0; - - return brightness; -} - static int gpio_backlight_update_status(struct backlight_device *bl) { struct gpio_backlight *gbl = bl_get_data(bl); - int brightness = gpio_backlight_get_next_brightness(bl); - gpiod_set_value_cansleep(gbl->gpiod, brightness); + gpiod_set_value_cansleep(gbl->gpiod, backlight_get_brightness(bl)); return 0; } @@ -108,7 +95,7 @@ static int gpio_backlight_probe(struct platform_device *pdev) bl->props.brightness = 1; - init_brightness = gpio_backlight_get_next_brightness(bl); + init_brightness = backlight_get_brightness(bl); ret = gpiod_direction_output(gbl->gpiod, init_brightness); if (ret) { dev_err(dev, "failed to set initial brightness\n"); From patchwork Fri Jul 3 18:45:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642689 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 3B2EE13BD for ; Fri, 3 Jul 2020 18:46: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 1A3692084C for ; Fri, 3 Jul 2020 18:46:40 +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="IN60Gzku" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A3692084C 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 373546EBA7; Fri, 3 Jul 2020 18:46:39 +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 7F0DA6EBA7 for ; Fri, 3 Jul 2020 18:46:37 +0000 (UTC) Received: by mail-lf1-x142.google.com with SMTP id k17so6252086lfg.3 for ; Fri, 03 Jul 2020 11:46: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=VZNZ91Ufx6ojfiiT+ZYBRZsahy67A4bJ2OQndrGkqvw=; b=IN60GzkumPnjdCCjAXLga3TkI9r+tMRO4r414D3XwPqkkmoMM8IG73aedwq6jOFFJ+ i7v/VdzLHRcaZ7LPh1243jMCJi+2OJVLjsA274K/ukCLJCkpUZcxMo2guoC2vFIScnvO DlugE49fFCUtw8ZSysGlX8UGz07m+FEoCmLKEUmba1IDOzTymnRiUNAhph69R5P+yR5Y shmKTkktHAcpdRBmICeMMF+e/roC/9Zygvi762Zu68xJCJLIIOQdMhsv3EZPerg9E/El +f/nH0T6d9m9idHYJXLNi1qNL1tSacKpX/gOpuPzvkZUu2+/U916r+cl5wcl1dnATqpV 4Vhw== 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=VZNZ91Ufx6ojfiiT+ZYBRZsahy67A4bJ2OQndrGkqvw=; b=Ld0v21A50RoyD/PAqRsl/oHGynssj1PUWYislsuzkPA6Ev3XjVck90cCUsNqarzhLL uWTSXthRUpgS4+qyf5pFC6NA5uGQH2nk8o6MMTOsm4EIH51AGBiGwD6sfEmuDoLf5axg 2kDwr+46qSXT5NopJyp73K2ImAskLlQ3VUugKwhurTnDx4gz2/4fLAOXFmvSEYu4Axvt mshru48AugutrmBQXNf5FmGYF6Y0/QEz8CxBAoBmHVBvwfdfRy0NlulTKANn7heh87si kr7N1Islhstp6axAhdc72wO1h7CtaSjsGQqIm32k/Ev7RM585AjvfiQE7MzIQ1QY4vB9 cq2g== X-Gm-Message-State: AOAM530rZxnQ3g0db9weiqSwf1PLHHN3HI6XkG7uKOkYjG98EehkWnUa PGwO00UzJfuLBcN5iKAvQ/UdYtvWveU= X-Google-Smtp-Source: ABdhPJyNvWX5NnnpSSlpfSVj4ZmLvfiZUcS46+w0anQr3yWLoRT6w2fGIF+x7Bzmy6J8QO/7sRO4Aw== X-Received: by 2002:ac2:43dc:: with SMTP id u28mr22896333lfl.17.1593801995826; Fri, 03 Jul 2020 11:46:35 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:35 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 16/20] backlight: jornada720_bl: introduce backlight_is_blank() Date: Fri, 3 Jul 2020 20:45:42 +0200 Message-Id: <20200703184546.144664-17-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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" Use the backlight_is_blank() helper to simplify the code a bit. This add support for fb_blank as a side-effect. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Reviewed-by: Daniel Thompson --- drivers/video/backlight/jornada720_bl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"); From patchwork Fri Jul 3 18:45:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642693 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 9789560D for ; Fri, 3 Jul 2020 18:46:42 +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 765152084C for ; Fri, 3 Jul 2020 18:46:42 +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="cH5Pv4VO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 765152084C 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 A3DBE6EBA8; Fri, 3 Jul 2020 18:46: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 075086EBA9 for ; Fri, 3 Jul 2020 18:46:40 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id q7so24836867ljm.1 for ; Fri, 03 Jul 2020 11:46:39 -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=GidHBFAlZuOQ9IgkGlu+gLN1LIBt1hSU/cJfZ8cMxLM=; b=cH5Pv4VOo3t8IdF4+PXdzPvsaPyqf4pgIPDb7RTkGSxmXtp6+Th9pAK41px+6ghpPc uroPusDDxgJh6BOjLx9XPnmZl3ff3I/lFc7g1gxOE0BbEg8VVgifALnG5O9ou5Wycohi yGVXELEwXPuLF2MvSzlfiU4F1nmptJ0xY1ysole+y6XgYmTyz5F/IbiCR/LgGBLLQ37g ZFBbEZ5JpMViCzjyn3c/UfRaXvru4OkQ4HFyh0rhxnK+3TGgQKdm2tnpReeQnU2q1X/g otNWiDlNo+/pna3X3afh/xNg63jeUiKY6r3zko3ddXVGTrzHookwO3Mfg62Pltltr9uq Jpaw== 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=GidHBFAlZuOQ9IgkGlu+gLN1LIBt1hSU/cJfZ8cMxLM=; b=Qb2teXreKDtEGDCNP0smhjnsJLX1FeIGecxyGf5HZq2DfgU1OOrcHAem3l1xw9hadT wP8mvcEOX0hX5EreqrMrFp4ufW0zapr8A3ed/xXxidFVqcMx279UUu9VgRwO+6+xxAv6 5BXpMPa7fHGJSMlpJ57a/tG7jGEPKGy1mJRh2me2S8dY3V6suM5vvzLlC6wW9yv8z6fo ucjmn+rBQLvZHuczCc0a3CSdM7WL/rDZHMvtDgGmRHZo0xnHuplx2YeTlkVTMpGAiPmI QdI95VzRA2u8KPqL89/AMB43a1mw/+D6zGodBeaJutnORVpfhTm299wthhVZWW9azFav cz2Q== X-Gm-Message-State: AOAM530CeYdRt9usgoQ15oXWBM46XB/tu44EHEpD1eMSKj5dLL92UBie Yy7VMPOSZPfNCZCelB9t/qOH1WsPr3o= X-Google-Smtp-Source: ABdhPJwKqYjOuzWjxnodfOMC8+BTrkFzfGQyxI7l5FfsjU8wRGpDokt/PoeXmxzANG0oGFPvPiL1Ag== X-Received: by 2002:a2e:8043:: with SMTP id p3mr14027545ljg.469.1593801997946; Fri, 03 Jul 2020 11:46:37 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:37 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 17/20] backlight: use backligt_get_brightness() Date: Fri, 3 Jul 2020 20:45:43 +0200 Message-Id: <20200703184546.144664-18-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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" Introduce the backlight_get_brightness() helper in all video/backlight/* drivers. This simplifies the code and align the implementation of the update_status() operation across the different backlight drivers. Some of the drivers gains a little extra functionality by the change as they now respect the fb_blank() ioctl. Signed-off-by: Sam Ravnborg Reviewed-by: Daniel Thompson --- drivers/video/backlight/88pm860x_bl.c | 13 +------------ drivers/video/backlight/adp5520_bl.c | 10 +--------- drivers/video/backlight/adp8860_bl.c | 10 +--------- drivers/video/backlight/adp8870_bl.c | 10 +--------- drivers/video/backlight/bd6107.c | 7 +------ drivers/video/backlight/corgi_lcd.c | 8 +------- drivers/video/backlight/da903x_bl.c | 13 +------------ drivers/video/backlight/ep93xx_bl.c | 8 +------- drivers/video/backlight/hp680_bl.c | 6 +----- drivers/video/backlight/kb3886_bl.c | 6 +----- drivers/video/backlight/led_bl.c | 7 +------ drivers/video/backlight/lm3533_bl.c | 8 +------- drivers/video/backlight/locomolcd.c | 6 +----- drivers/video/backlight/lv5207lp.c | 7 +------ drivers/video/backlight/max8925_bl.c | 13 +------------ drivers/video/backlight/pwm_bl.c | 7 +------ drivers/video/backlight/qcom-wled.c | 7 +------ drivers/video/backlight/tps65217_bl.c | 10 +--------- drivers/video/backlight/wm831x_bl.c | 13 +------------ 19 files changed, 19 insertions(+), 150 deletions(-) diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c index 20d96a5ac384..25e409bbb1a2 100644 --- a/drivers/video/backlight/88pm860x_bl.c +++ b/drivers/video/backlight/88pm860x_bl.c @@ -121,18 +121,7 @@ static int pm860x_backlight_set(struct backlight_device *bl, int brightness) 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) - brightness = 0; - - return pm860x_backlight_set(bl, brightness); + return pm860x_backlight_set(bl, backlight_get_brightness(bl)); } static int pm860x_backlight_get_brightness(struct backlight_device *bl) diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c index 0f63f76723a5..686988c3df3a 100644 --- a/drivers/video/backlight/adp5520_bl.c +++ b/drivers/video/backlight/adp5520_bl.c @@ -65,15 +65,7 @@ static int adp5520_bl_set(struct backlight_device *bl, int brightness) 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) - brightness = 0; - - return adp5520_bl_set(bl, brightness); + return adp5520_bl_set(bl, backlight_get_brightness(bl)); } static int adp5520_bl_get_brightness(struct backlight_device *bl) diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c index 19968104fc47..ddc7f5f0401f 100644 --- a/drivers/video/backlight/adp8860_bl.c +++ b/drivers/video/backlight/adp8860_bl.c @@ -361,15 +361,7 @@ static int adp8860_bl_set(struct backlight_device *bl, int brightness) 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) - brightness = 0; - - return adp8860_bl_set(bl, brightness); + return adp8860_bl_set(bl, backlight_get_brightness(bl)); } static int adp8860_bl_get_brightness(struct backlight_device *bl) diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c index 4c0032010cfe..8b5213a39527 100644 --- a/drivers/video/backlight/adp8870_bl.c +++ b/drivers/video/backlight/adp8870_bl.c @@ -399,15 +399,7 @@ static int adp8870_bl_set(struct backlight_device *bl, int brightness) 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) - brightness = 0; - - return adp8870_bl_set(bl, brightness); + return adp8870_bl_set(bl, backlight_get_brightness(bl)); } static int adp8870_bl_get_brightness(struct backlight_device *bl) diff --git a/drivers/video/backlight/bd6107.c b/drivers/video/backlight/bd6107.c index d5d5fb457e78..515184fbe33a 100644 --- a/drivers/video/backlight/bd6107.c +++ b/drivers/video/backlight/bd6107.c @@ -82,12 +82,7 @@ static int bd6107_write(struct bd6107 *bd, u8 reg, u8 data) 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)) - brightness = 0; + int brightness = backlight_get_brightness(backlight); if (brightness) { bd6107_write(bd, BD6107_PORTSEL, BD6107_PORTSEL_LEDM(2) | diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c index 25ef0cbd7583..33f5d80495e6 100644 --- a/drivers/video/backlight/corgi_lcd.c +++ b/drivers/video/backlight/corgi_lcd.c @@ -420,13 +420,7 @@ static int corgi_bl_set_intensity(struct corgi_lcd *lcd, int intensity) 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) - intensity = 0; + int intensity = backlight_get_brightness(bd); if (corgibl_flags & CORGIBL_SUSPENDED) intensity = 0; diff --git a/drivers/video/backlight/da903x_bl.c b/drivers/video/backlight/da903x_bl.c index 62540e4bdedb..71f21bbc7a9f 100644 --- a/drivers/video/backlight/da903x_bl.c +++ b/drivers/video/backlight/da903x_bl.c @@ -77,18 +77,7 @@ static int da903x_backlight_set(struct backlight_device *bl, int brightness) 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) - brightness = 0; - - return da903x_backlight_set(bl, brightness); + return da903x_backlight_set(bl, backlight_get_brightness(bl)); } static int da903x_backlight_get_brightness(struct backlight_device *bl) diff --git a/drivers/video/backlight/ep93xx_bl.c b/drivers/video/backlight/ep93xx_bl.c index 4149e0b2f83c..2387009d452d 100644 --- a/drivers/video/backlight/ep93xx_bl.c +++ b/drivers/video/backlight/ep93xx_bl.c @@ -36,13 +36,7 @@ static int ep93xxbl_set(struct backlight_device *bl, int brightness) 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) - brightness = 0; - - return ep93xxbl_set(bl, brightness); + return ep93xxbl_set(bl, backlight_get_brightness(bl)); } static int ep93xxbl_get_brightness(struct backlight_device *bl) diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c index 8ea42b8d9bc8..9123c33def05 100644 --- a/drivers/video/backlight/hp680_bl.c +++ b/drivers/video/backlight/hp680_bl.c @@ -33,12 +33,8 @@ static void hp680bl_send_intensity(struct backlight_device *bd) { unsigned long flags; u16 v; - int intensity = bd->props.brightness; + int intensity = backlight_get_brightness(bd); - if (bd->props.power != FB_BLANK_UNBLANK) - intensity = 0; - if (bd->props.fb_blank != FB_BLANK_UNBLANK) - intensity = 0; if (hp680bl_suspended) intensity = 0; diff --git a/drivers/video/backlight/kb3886_bl.c b/drivers/video/backlight/kb3886_bl.c index 1dfe13c18925..55794b239cff 100644 --- a/drivers/video/backlight/kb3886_bl.c +++ b/drivers/video/backlight/kb3886_bl.c @@ -87,12 +87,8 @@ static const struct dmi_system_id kb3886bl_device_table[] __initconst = { static int kb3886bl_send_intensity(struct backlight_device *bd) { - int intensity = bd->props.brightness; + int intensity = backlight_get_brightness(bd); - if (bd->props.power != FB_BLANK_UNBLANK) - intensity = 0; - if (bd->props.fb_blank != FB_BLANK_UNBLANK) - 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..f54d256e2d54 100644 --- a/drivers/video/backlight/led_bl.c +++ b/drivers/video/backlight/led_bl.c @@ -54,12 +54,7 @@ static void led_bl_power_off(struct led_bl_data *priv) 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) - brightness = 0; + int brightness = backlight_get_brightness(bl); if (brightness > 0) led_bl_set_brightness(priv, brightness); diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c index ee09d1bd02b9..d07a2bd805fc 100644 --- a/drivers/video/backlight/lm3533_bl.c +++ b/drivers/video/backlight/lm3533_bl.c @@ -39,14 +39,8 @@ static inline int lm3533_bl_get_ctrlbank_id(struct lm3533_bl *bl) 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) - brightness = 0; - - return lm3533_ctrlbank_set_brightness(&bl->cb, (u8)brightness); + return lm3533_ctrlbank_set_brightness(&bl->cb, backlight_get_brightness(bd)); } static int lm3533_bl_get_brightness(struct backlight_device *bd) diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c index cdc02e04f89d..297ee2e1ab0b 100644 --- a/drivers/video/backlight/locomolcd.c +++ b/drivers/video/backlight/locomolcd.c @@ -111,12 +111,8 @@ static int current_intensity; static int locomolcd_set_intensity(struct backlight_device *bd) { - int intensity = bd->props.brightness; + int intensity = backlight_get_brightness(bd); - if (bd->props.power != FB_BLANK_UNBLANK) - intensity = 0; - if (bd->props.fb_blank != FB_BLANK_UNBLANK) - 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..1842ae9a55f8 100644 --- a/drivers/video/backlight/lv5207lp.c +++ b/drivers/video/backlight/lv5207lp.c @@ -46,12 +46,7 @@ static int lv5207lp_write(struct lv5207lp *lv, u8 reg, u8 data) 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)) - brightness = 0; + int brightness = backlight_get_brightness(backlight); if (brightness) { lv5207lp_write(lv, LV5207LP_CTRL1, diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index 97cc260ff9d1..e607ec6fd4bf 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c @@ -64,18 +64,7 @@ static int max8925_backlight_set(struct backlight_device *bl, int brightness) 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) - brightness = 0; - - return max8925_backlight_set(bl, brightness); + return max8925_backlight_set(bl, backlight_get_brightness(bl)); } static int max8925_backlight_get_brightness(struct backlight_device *bl) diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 82b8d7594701..eff64db2e02e 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -108,14 +108,9 @@ static int compute_duty_cycle(struct pwm_bl_data *pb, int brightness) static int pwm_backlight_update_status(struct backlight_device *bl) { struct pwm_bl_data *pb = bl_get_data(bl); - int brightness = bl->props.brightness; + int brightness = backlight_get_brightness(bl); struct pwm_state state; - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & BL_CORE_FBBLANK) - brightness = 0; - if (pb->notify) brightness = pb->notify(pb->dev, brightness); diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c index 4c8c34b99441..94d3b96244f0 100644 --- a/drivers/video/backlight/qcom-wled.c +++ b/drivers/video/backlight/qcom-wled.c @@ -433,14 +433,9 @@ static int wled5_ovp_delay(struct wled *wled) static int wled_update_status(struct backlight_device *bl) { struct wled *wled = bl_get_data(bl); - u16 brightness = bl->props.brightness; + u16 brightness = backlight_get_brightness(bl); int rc = 0; - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & BL_CORE_FBBLANK) - brightness = 0; - mutex_lock(&wled->lock); if (brightness) { rc = wled->wled_set_brightness(wled, brightness); diff --git a/drivers/video/backlight/tps65217_bl.c b/drivers/video/backlight/tps65217_bl.c index 762e3feed097..8457166f357f 100644 --- a/drivers/video/backlight/tps65217_bl.c +++ b/drivers/video/backlight/tps65217_bl.c @@ -77,15 +77,7 @@ static int tps65217_bl_update_status(struct backlight_device *bl) { struct tps65217_bl *tps65217_bl = bl_get_data(bl); int rc; - int brightness = bl->props.brightness; - - 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 */ - brightness = 0; + int brightness = backlight_get_brightness(bl); if (brightness > 0) { rc = tps65217_reg_write(tps65217_bl->tps, diff --git a/drivers/video/backlight/wm831x_bl.c b/drivers/video/backlight/wm831x_bl.c index e55977d54c15..c5aaee205bdf 100644 --- a/drivers/video/backlight/wm831x_bl.c +++ b/drivers/video/backlight/wm831x_bl.c @@ -91,18 +91,7 @@ static int wm831x_backlight_set(struct backlight_device *bl, int brightness) 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) - brightness = 0; - - return wm831x_backlight_set(bl, brightness); + return wm831x_backlight_set(bl, backlight_get_brightness(bl)); } static int wm831x_backlight_get_brightness(struct backlight_device *bl) From patchwork Fri Jul 3 18:45:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642697 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 277C913BD for ; Fri, 3 Jul 2020 18:46: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 064D520899 for ; Fri, 3 Jul 2020 18:46: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="ZIwE1w1G" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 064D520899 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 315596EBA9; Fri, 3 Jul 2020 18:46:43 +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 D7ABF6EBA9 for ; Fri, 3 Jul 2020 18:46:41 +0000 (UTC) Received: by mail-lj1-x241.google.com with SMTP id z24so13181678ljn.8 for ; Fri, 03 Jul 2020 11:46:41 -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=0lVGBtlKGV7mdea3qCpDAmIlkL+A1oTLOm9ndlSKSYE=; b=ZIwE1w1Ghx/3tjTG+wWLdg1TLz4DCo7E7vGxFhkIbmVtSA4a3WjTgV2QLaq4v6iYPs rJH2NSWw4cwTu6I109t15wwb+yZDIG2EE2PGAZB32JlOO2Z6y5DM6qQDP4tecxbnFmWw 1u8su0FG/qdwH/YNq8J+hQNaQkKjlxkQ0uuwySNCYmXbXsZtsbzDBfPBRI+7cG5ZLEsQ 0B0Gxz9/XyRl2XSFGkC194VTypSXzD+TJbgUrJHvHddFMEY6naI7207I4hsezHVN5phY CsYcfAD9A1rBYyCIgJ24hn7Ge0Ngc8uilgeIvtZ5v3JpDtZDCT6ch4vQaLc5yYtJJyRt 5f7g== 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=0lVGBtlKGV7mdea3qCpDAmIlkL+A1oTLOm9ndlSKSYE=; b=rDx6O33IpgTXOGcfJVnf/s6NkMQkgSpna0C8ELfh2mOadQzy81Xrb6icmqvXRw0yQd gvEMMECkSd+rOPQqmDYyGZhC7zoyw63JaLPX34uGzAV1sY8pwkZRbXlQoBwUk0iNFeFG JwCtkQqQgXuxv9EhWpcwkufceNCHvdkLL9jreBtjfTWt6KHQ8wOIGnXq7qsKUXG+r3du /uQlAoBnC34Z8pAgfYY6VKiCU4Xa78cxsCayEbiYJbrkeXVg1Qu5jqMMxBRupu6v/I4Y clCYuUxDXS4JS0sk0EMiwgy0EeOrYMivRYBFB9m6YMz2aNYxe4Aeq8I9KlwMsQiPA4Zr 0Alg== X-Gm-Message-State: AOAM530O5Bh8NL+vD+dSkGPDFuiypRg7xYGwufW9yukZWeR2w6ezsfRL TcxWG1iB8xYYKr1RgpznAaS2/NElzPc= X-Google-Smtp-Source: ABdhPJyj54hLQtM3LIea5xG6yd7fVGh0vAlECmdYKX5F8gkkwLsjofvTh3sUVDiGYYetSfgISEkpmA== X-Received: by 2002:a2e:161a:: with SMTP id w26mr20539700ljd.216.1593802000116; Fri, 03 Jul 2020 11:46:40 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:39 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 18/20] backlight: drop backlight_put() Date: Fri, 3 Jul 2020 20:45:44 +0200 Message-Id: <20200703184546.144664-19-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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" There are no external users of backlight_put(). Drop it and open code the two users in backlight.c. Signed-off-by: Sam Ravnborg Reviewed-by: Daniel Thompson Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- drivers/video/backlight/backlight.c | 7 +++++-- include/linux/backlight.h | 10 ---------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index db8717581ec5..099023771ab1 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -717,7 +717,10 @@ EXPORT_SYMBOL(of_find_backlight); static void devm_backlight_release(void *data) { - backlight_put(data); + struct backlight_device *bd = data; + + if (bd) + put_device(&bd->dev); } /** @@ -745,7 +748,7 @@ struct backlight_device *devm_of_find_backlight(struct device *dev) return bd; ret = devm_add_action(dev, devm_backlight_release, bd); if (ret) { - backlight_put(bd); + put_device(&bd->dev); return ERR_PTR(ret); } return bd; diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 38db67588b16..f3b484c99789 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -388,16 +388,6 @@ static inline int backlight_disable(struct backlight_device *bd) return backlight_update_status(bd); } -/** - * backlight_put - Drop backlight reference - * @bd: the backlight device to put - */ -static inline void backlight_put(struct backlight_device *bd) -{ - if (bd) - put_device(&bd->dev); -} - /** * backlight_is_blank - Return true if display is expected to be blank * @bd: the backlight device From patchwork Fri Jul 3 18:45:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642701 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 E7EEC60D for ; Fri, 3 Jul 2020 18:46: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 C6DEC20899 for ; Fri, 3 Jul 2020 18:46: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="nBiBGqmR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C6DEC20899 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 E334F6EBAC; Fri, 3 Jul 2020 18:46:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3108E6EBAC for ; Fri, 3 Jul 2020 18:46:44 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id d21so19026909lfb.6 for ; Fri, 03 Jul 2020 11:46: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=Q86XdCJfHm4NXa8RPuVpLMGPelEiFzOicNNaQKmE/Tg=; b=nBiBGqmR5JNs/DnxM/smCnXHsf8bZ9h+pbLeNYLjLQ2Rcovhk3ODpGdV50KiQt+Kca cuoq6henFkcNUS076lI9Ebou281QOyaIPCUw+yjymXUm30BXc/mVq9b+1WYkoCozQDo6 i93T7vFV75j/Br4G3oixOkU86XkZCZGiK9F9pITDefqczikdFNmARPU3TcHWm9r0r6Ir ew4YX0S8lj3zWQ2vY1q/kTWWH77/XC72/vYsaSpaY3pWXmv7MjaLxlECYEGHrM7sv5/h ww5+gcgyjh/hmLUtWYFClvOccaVoOkUz2qsANjO8qhpe/VtvNCELy58jkG1Q+YUJ6eTG 9lqg== 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=Q86XdCJfHm4NXa8RPuVpLMGPelEiFzOicNNaQKmE/Tg=; b=Ft4M3dUQRYc4Dz/Bm+c/bKiRxaI+OIC2hrvClxqqAI+dVkKFVPuF8ksvuiYvwF3yyh DyALN0FapUQXeLrLSNj49TF9sHBFW0O/V97dKtMubrc2TasAqcbZikcLEWUr4Se85uZD QnHfxLSOY/Ee9aewSORDDBUS7U2hMgR78lC/F2Ouzv+ul5ftv5mU3SPYoakXXIawuue2 KIQz4qJHbt9eW6PitqE4CGaPmwirnPIAkU+a/DUr2ryqNhZLrK/K7cKV27jEHWytM+qx AJV4LL54FEhDsMvVLVLvzczJ/wa3oYG3LXV1GIVK+7OiIX9IxWcACn8WotZnnzbvnWey UWVQ== X-Gm-Message-State: AOAM533WDjTzg5m77LkcJbal834PzwT9MsNhiaURyx9epnDKuEmbO6bN PbipKV4jZoPJ27SKYipU/Sa2hqubnCo= X-Google-Smtp-Source: ABdhPJyac79zADQ53wcZqwr2NvTksQGiIwtv5yruNnDCMzz6vo8jWzvXmY58HB/AOxGojDo5ENwokA== X-Received: by 2002:a19:787:: with SMTP id 129mr22863367lfh.147.1593802002408; Fri, 03 Jul 2020 11:46:42 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:41 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 19/20] backlight: make of_find_backlight static Date: Fri, 3 Jul 2020 20:45:45 +0200 Message-Id: <20200703184546.144664-20-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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" There are no external users of of_find_backlight, as they have all changed to use the managed version. Make of_find_backlight static to prevent new external users. v3: - Move doc for devm_of_find_backlight out of this patch v2: - Editorial corrections (Daniel) - Returns => RETURNS (Daniel) Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Reviewed-by: Daniel Thompson --- drivers/video/backlight/backlight.c | 18 +----------------- include/linux/backlight.h | 6 ------ 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 099023771ab1..06f4da3c58e1 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -672,22 +672,7 @@ struct backlight_device *of_find_backlight_by_node(struct device_node *node) EXPORT_SYMBOL(of_find_backlight_by_node); #endif -/** - * of_find_backlight - Get backlight device - * @dev: Device - * - * This function looks for a property named 'backlight' on the DT node - * connected to @dev and looks up the backlight device. - * - * Call backlight_put() to drop the reference on the backlight device. - * - * Returns: - * A pointer to the backlight device if found. - * Error pointer -EPROBE_DEFER if the DT property is set, but no backlight - * device is found. - * NULL if there's no backlight property. - */ -struct backlight_device *of_find_backlight(struct device *dev) +static struct backlight_device *of_find_backlight(struct device *dev) { struct backlight_device *bd = NULL; struct device_node *np; @@ -713,7 +698,6 @@ struct backlight_device *of_find_backlight(struct device *dev) return bd; } -EXPORT_SYMBOL(of_find_backlight); static void devm_backlight_release(void *data) { diff --git a/include/linux/backlight.h b/include/linux/backlight.h index f3b484c99789..8b43fd90d84a 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -477,14 +477,8 @@ of_find_backlight_by_node(struct device_node *node) #endif #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE) -struct backlight_device *of_find_backlight(struct device *dev); struct backlight_device *devm_of_find_backlight(struct device *dev); #else -static inline struct backlight_device *of_find_backlight(struct device *dev) -{ - return NULL; -} - static inline struct backlight_device * devm_of_find_backlight(struct device *dev) { From patchwork Fri Jul 3 18:45:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11642705 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 AD45B13BD for ; Fri, 3 Jul 2020 18:46:48 +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 87C782088E for ; Fri, 3 Jul 2020 18:46:48 +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="IJ2pvZZu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 87C782088E 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 99C1D6EBAD; Fri, 3 Jul 2020 18:46:47 +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 225C96EBAD for ; Fri, 3 Jul 2020 18:46:46 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id f5so22207369ljj.10 for ; Fri, 03 Jul 2020 11:46:46 -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=hT0shvcR5E7UTkS/zrKMtVL3+oENb6Mn/8BtotMdc8Y=; b=IJ2pvZZu0XFyrYCZR2R+QxMO9PRsdBwoi67YSGTnXEoC6Xq35Un0PVtT9vh44xnDXP TEGeRIMsZGiYY6Awzwdq+jUzsSGLB4ADGwQ5ok8jjv4wOuWndRvZyE5OMfDznoZo90Th pQcuWXf8XYXOT5JioZmngSaaYWiRgjJLjdtvcWBOXqXAbHLIakqb1FUs9Jj7IOY1MgLt ONhxzqoJfYbWq2QSd6qoKs6tCTsLdmwEw77REvuGMEl0iwJS2rQFwTCmd9xNtGeisMjM gjOHzaRw4srWPfNxRglgv6ILapKfzB1ETl+0v76GQhbHDgft/Z8QaE1QiJoHBEmHxr1+ y7vA== 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=hT0shvcR5E7UTkS/zrKMtVL3+oENb6Mn/8BtotMdc8Y=; b=oUI2wnJXUR/fGei/4LOwkrrpgB6cKKiGhBQmyOOuIs0x8gqZrkRBqxhsBopoblDBOR ZEi958hdDTsDrW+t2JLKuYhkVIYRR+0WCRlBaT7nsK7cCnaGIKHf0V1iNyUE4oXRjOhu lVpibP+GaYPuykvJDgSbhkxcaeUME1lxbZXBQvkFU2zrSgr+wE2Jti1KGxdeq5HxXwJ+ GIJjm3GAHJSVMsgTQUjgUOt8aLi+JwrAUuXUFVToajpfPqh+M5gNSMJIfxr3l+NYz3P5 n+Uf84yM6aVkNxpitBgf8GBmulHY0Af8guy9qPlX2s9D7jdMDI9AygVQPT06UtpyAZCU qjTw== X-Gm-Message-State: AOAM530L9B9cS1VEoVy4lpEqLnxTMSXusqA3MpR/aQzeCMXUHpmltnah LRq/hrDqBDV2arTLbWuzBhqdGkLXoY4= X-Google-Smtp-Source: ABdhPJxYcPNmrmNBGSR3OEKzHcluG3e3qxVbhV/zKtVskDiIRKCh+SQkMLB/z9B+fykgAg9N0oyykQ== X-Received: by 2002:a2e:3311:: with SMTP id d17mr19563882ljc.13.1593802004416; Fri, 03 Jul 2020 11:46:44 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:44 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v4 20/20] backlight: make of_find_backlight_by_node() static Date: Fri, 3 Jul 2020 20:45:46 +0200 Message-Id: <20200703184546.144664-21-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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" There are no external users of of_find_backlight_by_node(). Make it static so we keep it that way. v2: - drop EXPORT of of_find_backlight_by_node Signed-off-by: Sam Ravnborg Reviewed-by: Daniel Thompson Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Reported-by: kernel test robot --- drivers/video/backlight/backlight.c | 23 +++++++++-------------- include/linux/backlight.h | 10 ---------- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 06f4da3c58e1..ff84e6607486 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -649,19 +649,9 @@ static int of_parent_match(struct device *dev, const void *data) return dev->parent && dev->parent->of_node == data; } -/** - * of_find_backlight_by_node() - find backlight device by device-tree node - * @node: device-tree node of the backlight device - * - * Returns a pointer to the backlight device corresponding to the given DT - * node or NULL if no such backlight device exists or if the device hasn't - * been probed yet. - * - * This function obtains a reference on the backlight device and it is the - * caller's responsibility to drop the reference by calling put_device() on - * the backlight device's .dev field. - */ -struct backlight_device *of_find_backlight_by_node(struct device_node *node) +/* Find backlight device by device-tree node */ +static struct backlight_device * +of_find_backlight_by_node(struct device_node *node) { struct device *dev; @@ -669,7 +659,12 @@ struct backlight_device *of_find_backlight_by_node(struct device_node *node) return dev ? to_backlight_device(dev) : NULL; } -EXPORT_SYMBOL(of_find_backlight_by_node); +#else +static struct backlight_device * +of_find_backlight_by_node(struct device_node *node) +{ + return NULL; +} #endif static struct backlight_device *of_find_backlight(struct device *dev) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 8b43fd90d84a..fa443899b4ee 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -466,16 +466,6 @@ static inline void * bl_get_data(struct backlight_device *bl_dev) return dev_get_drvdata(&bl_dev->dev); } -#ifdef CONFIG_OF -struct backlight_device *of_find_backlight_by_node(struct device_node *node); -#else -static inline struct backlight_device * -of_find_backlight_by_node(struct device_node *node) -{ - return NULL; -} -#endif - #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE) struct backlight_device *devm_of_find_backlight(struct device *dev); #else