From patchwork Thu May 14 19:09: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: 11549503 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 BFE17618 for ; Thu, 14 May 2020 19:10: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 9DEB0207D0 for ; Thu, 14 May 2020 19:10:24 +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="KhTkE42C" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9DEB0207D0 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 11D926EBA9; Thu, 14 May 2020 19:10:20 +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 3C4BA6EBAA for ; Thu, 14 May 2020 19:10:18 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id a21so4718179ljj.11 for ; Thu, 14 May 2020 12:10: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=J916F81BKXSH1NRVPofwjNX6i7ySZukl1DQn7KOtjRY=; b=KhTkE42CZnDvo5d4tHCxFOUM/fdSLjbFY/mCcZEoAqhx8J5I7dtrJTI2Of9JD9wiu0 ngMdA6sgzjKks/LuuWupwhrnbv0fh8R8+mCxe3sgMOguRjwh0ICfRqPYYWmcgIa3lC7g FBfd2sqHT3rlSOxo0Cxx+Hm1wuzoIfTuu/KKlkM+IiANb9Zi/DwYnj67dlZMXQsylTDo xtQrkDqz8Hu+5hloVAHFN6cGpn221+2SDJ20D8qtErm9fpIeca5I8w2u7Y2752HehSqu ou4r2diGpibjXDuFwwLJEI5+nxyHYBkMKCk9mQQEK0neEE7PlBJ4KB7iEZL2pPb+AWOQ xIwg== 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=J916F81BKXSH1NRVPofwjNX6i7ySZukl1DQn7KOtjRY=; b=lw4OBxTqZMpmMuCv6SrWIk0p6hiqDBn2Tj1dkLhR1gDw4wdwoIffCLP2C6spMmtWh6 YrQNe/BvQRZg8jqggOM9f8tvOGYOxN3/wUG1Y0OjqjmHLT0KcI5Vlrya/zBQajP7JfgL +KAVy1K5ozcDdSGI/r+4Jy17UKCodPFHiW6LC8aaWKevIfV4wZzP5GWx0FkA3E/Fp/yQ cTpT1KqbPeDWfPARgaMyYYn62BbNtXXtI9pw4mhf3yPtszGwq+1tK83gcj11HPI0n6Bn r2VryNhAGt5BW3JTGU2ZRxwphhueLhFdQ/78nQI5+6wf8sn7kjbJqElyIO/wcckdYWno aKuw== X-Gm-Message-State: AOAM530mbVBsEiQDz42iFBAFt+tJaUiY5yk5wgWQ6kjLiAIrxyalqB7F V46I5HVrOvo+pBf6tjzdy7k4zpq8xV4zlQ== X-Google-Smtp-Source: ABdhPJzmOnNVIJlWDEc/Vi8Cs/lkpqkVwdrbcdNjtNuimAeT/PfHkeObjIoyXMQnn9rV3ILgNFk0Hw== X-Received: by 2002:a2e:860a:: with SMTP id a10mr3924004lji.20.1589483416265; Thu, 14 May 2020 12:10:16 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:15 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 01/18] drm/omap: display: use devm_of_find_backlight Date: Thu, 14 May 2020 21:09:44 +0200 Message-Id: <20200514191001.457441-2-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Look up backlight device using devm_of_find_backlight(). This simplifies the code and prevents us from hardcoding the node name in the driver. Signed-off-by: Sam Ravnborg Cc: Tomi Valkeinen Cc: Zheng Bin Cc: Kate Stewart Cc: Enrico Weigelt Cc: Allison Randal Cc: Laurent Pinchart Cc: Thomas Gleixner Cc: Kefeng Wang Cc: Sam Ravnborg Reviewed-by: Tomi Valkeinen --- .../gpu/drm/omapdrm/displays/panel-dsi-cm.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c index 3484b5d4a91c..faca5c873bde 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c @@ -1163,7 +1163,7 @@ static const struct omap_dss_driver dsicm_dss_driver = { static int dsicm_probe_of(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; - struct device_node *backlight; + struct backlight_device *backlight; struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct display_timing timing; int err; @@ -1216,17 +1216,15 @@ static int dsicm_probe_of(struct platform_device *pdev) ddata->vddi = NULL; } - backlight = of_parse_phandle(node, "backlight", 0); - if (backlight) { - ddata->extbldev = of_find_backlight_by_node(backlight); - of_node_put(backlight); + backlight = devm_of_find_backlight(&pdev->dev); + if (IS_ERR(backlight)) + return PTR_ERR(backlight); - if (!ddata->extbldev) - return -EPROBE_DEFER; - } else { - /* assume native backlight support */ + /* If no backlight device is found assume native backlight support */ + if (backlight) + ddata->extbldev = backlight; + else ddata->use_dsi_backlight = true; - } /* TODO: ulps */ From patchwork Thu May 14 19:09: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: 11549511 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 543E2618 for ; Thu, 14 May 2020 19:10:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 30A4F206A5 for ; Thu, 14 May 2020 19:10:27 +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="OrqDrsx5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 30A4F206A5 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 356C76EBAA; Thu, 14 May 2020 19:10:23 +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 5C8766EBAA for ; Thu, 14 May 2020 19:10:20 +0000 (UTC) Received: by mail-lf1-x142.google.com with SMTP id d22so3571773lfm.11 for ; Thu, 14 May 2020 12:10: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=iALLuERW1McwN1PgISrEqSKRl+DwcpATFhkrhtmrlJY=; b=OrqDrsx57GbIKMFC5gURmUlwlXbmOqs7a3uuD/o3zYSUdLnKOrLToMPE2u3vlFpT5V IeWIeABYAjFRkBDUmkWSD7Zo0BHCtMufMofSC4wm+JJX15TjGKcS3I3/DFmzqZ4/A838 r8Xx7r7Fq+bAYTtUVfvDWLP0yqUSXEhYUytoyezBaSvjJ+EBiqNTid/xv2f3u0p10FLp 6guun3D6rhS65c3eG0fOvGkSRCLYI4XT0HjP6EclM79x2NS4ZsRjkFsTes6d35P7D3rC FN9FegLPZAjO9n9n2+a9YTTfdgJDRL127KOe/jD+CtixSxlf4DJ02r/tSSxLWw9SOppY 7ZXw== 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=iALLuERW1McwN1PgISrEqSKRl+DwcpATFhkrhtmrlJY=; b=e29SuwTp4HtcVHAItNggJwLLDsn53rI51XS7inks/g2NolpZk/1NKYZBhrco16E9AC QHp675FbmOLulOfgNe19D2WfWCYCzNGdV4AOnvUUEK/sxze1xzGfhjgMmRnh01dc0r2o +megPXJkFyNh/TyxgOmUZU0LpQ0EBUjZyuwUv+K3v9QohbaMFKDjggJLnwjnSSaRWl3r hCK30CGlNanAU7a5KAhaMKV+a8g0dYMWaT+RpAK1FvU4GAXr97cA9DJd945ZPyK4BMKm LiJwQVLkMOc6PKZIiD7fuNDKruEH2cHhwm2FijSVkSAnmabFnhwmQav1Be74Vcd8iQk8 7mNQ== X-Gm-Message-State: AOAM533bQtKa3dclZoQE+Gl3wF0mVDhxOb1TrsQzbqYGcwupfE5Vtsx1 rE7oUSbuaAFdi4r6emCgV+M993DmoIpgaA== X-Google-Smtp-Source: ABdhPJxtOgNHrWlT1g6kVCkaO7bY7+x7AvNWUz2afNrA3i5zMlrlrAvEYJLlXd6AdF/rD1Dg4wHqew== X-Received: by 2002:ac2:4304:: with SMTP id l4mr4314956lfh.87.1589483418267; Thu, 14 May 2020 12:10:18 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:17 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 02/18] drm/tilcdc: use devm_of_find_backlight Date: Thu, 14 May 2020 21:09:45 +0200 Message-Id: <20200514191001.457441-3-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Look up backlight device using devm_of_find_backlight(). This simplifies the code and prevents us from hardcoding the node name in the driver. Signed-off-by: Sam Ravnborg Cc: Jyri Sarha Cc: Tomi Valkeinen Reviewed-by: Tomi Valkeinen --- drivers/gpu/drm/tilcdc/tilcdc_panel.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c index 12823d60c4e8..b207b2f19d42 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c @@ -299,7 +299,8 @@ static struct tilcdc_panel_info *of_get_panel_info(struct device_node *np) static int panel_probe(struct platform_device *pdev) { - struct device_node *bl_node, *node = pdev->dev.of_node; + struct device_node *node = pdev->dev.of_node; + struct backlight_device *backlight; struct panel_module *panel_mod; struct tilcdc_module *mod; struct pinctrl *pinctrl; @@ -315,16 +316,10 @@ static int panel_probe(struct platform_device *pdev) if (!panel_mod) return -ENOMEM; - bl_node = of_parse_phandle(node, "backlight", 0); - if (bl_node) { - panel_mod->backlight = of_find_backlight_by_node(bl_node); - of_node_put(bl_node); - - if (!panel_mod->backlight) - return -EPROBE_DEFER; - - dev_info(&pdev->dev, "found backlight\n"); - } + backlight = devm_of_find_backlight(&pdev->dev); + if (IS_ERR(backlight)) + return PTR_ERR(backlight); + panel_mod->backlight = backlight; panel_mod->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable", GPIOD_OUT_LOW); From patchwork Thu May 14 19:09: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: 11549515 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 9A9C3618 for ; Thu, 14 May 2020 19:10:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 78908206A5 for ; Thu, 14 May 2020 19:10:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OaZrLbTW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 78908206A5 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 976666EBAB; Thu, 14 May 2020 19:10:23 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3F2E16EBAA for ; Thu, 14 May 2020 19:10:22 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id j3so4742258ljg.8 for ; Thu, 14 May 2020 12:10: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=uvAqoIVnlBgyd68hnn1WiT3rXHhwfxcl0UeJKweLhko=; b=OaZrLbTWdUNdE4LXccXwIoqLV+2ksJ4Yz7Tv7vBdYId/RUkl1J0RJkHGPtLE+qYQGD A3lwKWbkJx/maHhmD8hyeQvedIL+YgJAm5IIMnc/f7FcnwTB+mkaVDOussWdSjd3TC95 S4SVAwpqeGMuoL4PsU0pdB46yS0P/3VYKCz04GBoWP+uMYBLflp74lTTunGciS/ZNmI2 AEWlRbgNES13Gr1h6jAp6FjKHLxqsvKiEeYOrZJwoKwadRo0GU8h5epYANQi32oo8O7i QAF7LXsTMpCAxVGAamcGOH1pWHqo7ppeP4H5AKbRB2xrYCxVnfxd14kZBurnDchUwezT QTjQ== 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=uvAqoIVnlBgyd68hnn1WiT3rXHhwfxcl0UeJKweLhko=; b=d+cjdF6GF5QR/5y/IjFAtL+Kmn0plwQvbLjuphIVU4MXrvBhzfG5LUtb/pQArL0KPC 5PD/8eArL1DtrErpZtCQ81Np1yXjVax3DweogNhC8AiXTgdWTbv/gTE6iEty0RA2eqr6 zt+nl+Lc+79OJlyFyi5k5Xdqj0tZ6bkys8eQPDg7nIV04s3B8tbTru2CoiP/l1s4NpbT HVuJhP/P7cCvNCf0XLWWKYmW93htoffKIsD4fgW3+cZC/uvYpAXdLDuDKmpBYa0Z9Tl8 ZtoWCeaOaBKa1Qlc0bZ9NnbHmDTDpzaH28ML+y8qEGunx3kat3U3ZzBpJLV8DNFm8ksL FD3w== X-Gm-Message-State: AOAM532CdRY2UEV3sew1NuW7eBjveDD0KAsWfUKeBx87+2RgItqKZrU+ 0rDReyTaMtkLoLP2lKnXqmn1c+Hvwe5zQA== X-Google-Smtp-Source: ABdhPJz1wwUxhhbKyXbGPZbBiIEsG4KEM76cKxu9cIh2796pYawzu/mXE3iTzXyvDvGKAApNYB578A== X-Received: by 2002:a2e:8805:: with SMTP id x5mr3852963ljh.223.1589483420269; Thu, 14 May 2020 12:10:20 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:19 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 03/18] video: amba-clcd: use devm_of_find_backlight Date: Thu, 14 May 2020 21:09:46 +0200 Message-Id: <20200514191001.457441-4-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Look up backlight device using devm_of_find_backlight(). This simplifies the code and prevents us from hardcoding the node name in the driver. Signed-off-by: Sam Ravnborg Cc: Russell King Cc: Sam Ravnborg Cc: Bartlomiej Zolnierkiewicz Cc: Daniel Vetter Cc: Linus Walleij Cc: Jani Nikula Cc: Douglas Anderson --- drivers/video/fbdev/amba-clcd.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c index c3d55fc6c4e0..b7682de412d8 100644 --- a/drivers/video/fbdev/amba-clcd.c +++ b/drivers/video/fbdev/amba-clcd.c @@ -602,20 +602,17 @@ static int clcdfb_snprintf_mode(char *buf, int size, struct fb_videomode *mode) mode->refresh); } -static int clcdfb_of_get_backlight(struct device_node *panel, +static int clcdfb_of_get_backlight(struct device *dev, struct clcd_panel *clcd_panel) { - struct device_node *backlight; + struct backlight_device *backlight; - /* Look up the optional backlight phandle */ - backlight = of_parse_phandle(panel, "backlight", 0); - if (backlight) { - clcd_panel->backlight = of_find_backlight_by_node(backlight); - of_node_put(backlight); + /* Look up the optional backlight device */ + backlight = devm_of_find_backlight(dev); + if (IS_ERR(backlight)) + return PTR_ERR(backlight); - if (!clcd_panel->backlight) - return -EPROBE_DEFER; - } + clcd_panel->backlight = backlight; return 0; } @@ -717,7 +714,7 @@ static int clcdfb_of_init_display(struct clcd_fb *fb) if (!panel) return -ENODEV; - err = clcdfb_of_get_backlight(panel, fb->panel); + err = clcdfb_of_get_backlight(&fb->dev->dev, fb->panel); if (err) return err; From patchwork Thu May 14 19:09:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11549521 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 A8A2F618 for ; Thu, 14 May 2020 19:10: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 860A5206A5 for ; Thu, 14 May 2020 19:10: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="oj0oQMsc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 860A5206A5 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 EC91E6EBAC; Thu, 14 May 2020 19:10:26 +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 4865C6EBAC for ; Thu, 14 May 2020 19:10:25 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id f18so4723758lja.13 for ; Thu, 14 May 2020 12:10: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=5PQMEcv1NfMXN6wgUUifwpupdvWgrHF4WujE2wy4cnE=; b=oj0oQMsctNEpY1Wsm80tWYK/q7dzRkAqb6HlnzXJUL19Cgmz4XskAKYFsBqvAuDqmR Tb6ANd9TbmRjHWu2Fi4ZgPck973cCMYCiI2gGKP2evVR8HKW0Uec8a1bSvCX4jMsBtp7 v+PgVhXgn1CHe9CRVJDwFex4n1MFv0Fq9MPCLFjQ1soe26jMwinI6RRNQVOrtUJjKFQD zk95KlNJOtSxy/L3D0nlWAmJuotrWdD9Rl/dQMGD7QjXrO1VMCxoZCdCWKu+n0OHOQsC OLAwaYaIaM9+L8bl5EYgYapIbN4gS07Zp9eAIW7DiVadx9TmJKp0aam96POD0/0IpIcO 10fg== 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=5PQMEcv1NfMXN6wgUUifwpupdvWgrHF4WujE2wy4cnE=; b=iuYgrvI5uW1g5J3d3mdhGrQgs52CMvSVhc/dctt4eaEDU1Px4kxE6wS94EnKN4ptOy rwmE0AjJN8zKV/JLDmbSNJNnlAMtn3dvzNk1+2/QSXA4zIlbqTBAe+tiGc7rI0QXWxCL F28iaRwfmqSYwybVRY4af4CpsuJgOS4BjwmJi4BRMgPPz1J9V6qNUS23Yo3Vq9YEHdSo QGyXbiSPnxzdUoErlrt824iGXAHNtdUV4acQi8ykEhyOVD2cZvuH0CunL/ZgZ/69lBXD hsI5Xe/NR9Zk6yezhFq2rw5opgJRFoxj4ihegmtwbjCVBcKUUKb1bJD3t0I1rM+qD87T 70pg== X-Gm-Message-State: AOAM531aGQjWyQNGwP2epKHwOqquUiJk4NaF8PLZ9ksmEKeqT7h7b7g1 9cvmCu7gnCEEia4AxxVWdgGq6TktseWglg== X-Google-Smtp-Source: ABdhPJzQGH3odWJt1CgHuRerG8SSDuaUrK5vOO5PmO0Wr7eBmwauHxTg8DZWDE/ijgcS4S+dMFzoxg== X-Received: by 2002:a2e:9843:: with SMTP id e3mr3717492ljj.249.1589483422387; Thu, 14 May 2020 12:10:22 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:21 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 04/18] backlight: make of_find_backlight static Date: Thu, 14 May 2020 21:09:47 +0200 Message-Id: <20200514191001.457441-5-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt 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. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- drivers/video/backlight/backlight.c | 31 ++++++++++------------------- include/linux/backlight.h | 6 ------ 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index cac3e35d7630..511bb382c584 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -600,22 +600,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; @@ -641,7 +626,6 @@ struct backlight_device *of_find_backlight(struct device *dev) return bd; } -EXPORT_SYMBOL(of_find_backlight); static void devm_backlight_release(void *data) { @@ -652,9 +636,16 @@ static void devm_backlight_release(void *data) * devm_of_find_backlight - Resource-managed of_find_backlight() * @dev: Device * - * Device managed version of of_find_backlight(). - * The reference on the backlight device is automatically - * dropped on driver detach. + * 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) { diff --git a/include/linux/backlight.h b/include/linux/backlight.h index c7d6b2e8c3b5..a0f03bb322d7 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -219,14 +219,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 Thu May 14 19:09:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11549525 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 8378F14B7 for ; Thu, 14 May 2020 19:10: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 5FF3B206F1 for ; Thu, 14 May 2020 19:10: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="IDmHNpwe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5FF3B206F1 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 5C15B6EBAD; Thu, 14 May 2020 19:10:30 +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 BC2E46EBAC for ; Thu, 14 May 2020 19:10:26 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id u15so4786616ljd.3 for ; Thu, 14 May 2020 12:10:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JXcb5fvumjPwkXBdjr17g9fCe8HBhpUDprGnSWssRKA=; b=IDmHNpwe6d3mPVdhTHpjxh9kKdZR9F1sadb+SsnmpGwzd0wlt8H44GHCqgfXMvpDGx 4fuyt72GdGn2OX5tNFsT5tkuNdTfT+7qSnfT08Udhz0dG52v0Gu7ixWZ2hqMj48BJbNA Zo0HY0D/+VFd2Wl1LKiVLUUKLaQpXoVPbzvq0q9OXNu7osS99tmo6Q7LwamfmruYgYhv YE+ugRnJJL/cC9iu86uwASoZS9tbauk0UqFGW9pCH5xgufkbi9Blb/r8s4Xt1z2TyPqZ C2NbdYCdTQ5ded9Yqx0AVyeB024sJTrxK3n97kF4UV8ZJVx6kjq1DShfT4W3lYQQFeke iDFQ== 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=JXcb5fvumjPwkXBdjr17g9fCe8HBhpUDprGnSWssRKA=; b=ekiyPRFoZ8jqNCV+gki2E2ftYiwXu1LtJOuQcnF713Xemyfj0Ds3yF2lOs61qfiumK YYdbEzFt4JyoyXVZ9uNhJhYTL7LVyRUDdPQBEBPdozXuJbISeO0gNgNTTyLdNbDYmrpa 1hibmGORcSQ7WJTfz3ZvADr342qoHCOYA7a49nysQAHcF2aeV+kNiYsggvioj0CQrMpk nIhtWX0ZjrOYPPz8wQJqXpqWWclRk3qkheB8Bsa75LRo0nLKgUQOYD5GdGruxD3+47i3 pSl+HINhL2iRmlRq2GDqisXQvH5t8oCv1tiU7+/YLmZqJmnLcb42l53uTY4JDPRY10Mb XFpw== X-Gm-Message-State: AOAM531ezDMbTL6ulP4NrCiVyle+trEbeyH1cgoC4k5w5Dt/hy4VMAtc Shg2o+aDUVk/ntCgMp2uvdAHeDsSf1azyg== X-Google-Smtp-Source: ABdhPJwEfhzXKzDLCNWiv662wAHi0cNv35xPMR0eOeZHcYH2WYInKTWYkLQ0Ng5w3INxzAOG1XaPiQ== X-Received: by 2002:a05:651c:97:: with SMTP id 23mr3892365ljq.17.1589483424521; Thu, 14 May 2020 12:10:24 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:23 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 05/18] backlight: drop backlight_put() Date: Thu, 14 May 2020 21:09:48 +0200 Message-Id: <20200514191001.457441-6-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt 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 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 511bb382c584..547aa3e1a03a 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -629,7 +629,10 @@ static struct backlight_device *of_find_backlight(struct device *dev) static void devm_backlight_release(void *data) { - backlight_put(data); + struct backlight_device *bd = data; + + if (bd) + put_device(&bd->dev); } /** @@ -657,7 +660,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 a0f03bb322d7..3d757a850b88 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -165,16 +165,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); -} - 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 Thu May 14 19:09:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11549527 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 5173A14B7 for ; Thu, 14 May 2020 19:10:35 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2FA31206A5 for ; Thu, 14 May 2020 19:10:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CVItBRgQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2FA31206A5 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 3632D6EBAF; Thu, 14 May 2020 19:10:32 +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 D7D246EBAD for ; Thu, 14 May 2020 19:10:28 +0000 (UTC) Received: by mail-lf1-x144.google.com with SMTP id z22so3634247lfd.0 for ; Thu, 14 May 2020 12:10:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=es7L7BT5X1JhlaIi9tn96sUgeVkIuHpmkzZvtAwIcug=; b=CVItBRgQEjiAp4UKpopUfv37fyjDo1mY+XLZ8itHw+itr+e6Dc2W1Vwv+h7O94kTKO ojVnxcMI0XuVLhYbZThBf7xSndRQhUZSUZygweq503IdIl7oGa+TRkVU/DAqknpwVA6X 5bEKgfcjbRZqcFUz+Thpwnr7oStu1zNdb2ghP8iQ/wS46V6lMGfIv0ZJItty3by/0hQ4 IQRDi7Kk0xZ39rzzeWMQM6XgJ+9P9vc5XpXlmbrKDKLDNbvetdJN+utHwluVYHA91VyE sn4qpE62jAztmy4V6sw51DHoW0Gb2YlPqpjmqYegPOojTKEuWN9eAiXcYRW6u0eIXkJU udHA== 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=es7L7BT5X1JhlaIi9tn96sUgeVkIuHpmkzZvtAwIcug=; b=GGCXJgPEPWCubuoQRe/H5yl1KOLRQCjkntfPQKqdympK3nRpLidZHwFtZcwhSQbdFS L73RkRdostHOwX9EBlFuiXIS4rOayRUZ+KJ5gE6lBJL6YLp90Hd/wGUu3h+1CFHmTEeO 8pRfDvtz6cgShGYVyBFqy5ZqpIn+v+p0Lw35bK/06/MTvRfdP4nmP8qI8wCcTbX2gwFD 1lhKlLhyrwYoz8QKg/yYnZ8rOtgptnc8ag/kRsGyggmq8fb++0m7l0MjTySVHP1WZEEZ davXHrhbwoXyjDOo9W3/2M/HhSiMY+/XujT/2MyOksG9zGf3WvSxqoj9lORItAxdzs+Y xpBQ== X-Gm-Message-State: AOAM532yRkTrYC1PxX57qNcNHhSlr3vQKO+j7eUuGyrW8EdM0r4FuUbP HFWNqXh5vX3akNQKGNyBOCWrCk2toknE+g== X-Google-Smtp-Source: ABdhPJz8pGerusE9OOKAKVj0mi5K/KXSSEFkTv+0WU6pZ/84b7vD0iKdmma7g9JVVyDE/6Qynkos6Q== X-Received: by 2002:ac2:4436:: with SMTP id w22mr4268011lfl.55.1589483426792; Thu, 14 May 2020 12:10:26 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:26 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 06/18] backlight: make of_find_backlight_by_node() static Date: Thu, 14 May 2020 21:09:49 +0200 Message-Id: <20200514191001.457441-7-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt 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. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- drivers/video/backlight/backlight.c | 22 +++++++++------------- include/linux/backlight.h | 10 ---------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 547aa3e1a03a..91dfcf4a2087 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -577,19 +577,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; @@ -598,6 +588,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 3d757a850b88..b7839ea9d00a 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -198,16 +198,6 @@ struct generic_bl_info { void (*kick_battery)(void); }; -#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 From patchwork Thu May 14 19:09:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11549529 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 CAE94618 for ; Thu, 14 May 2020 19:10: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 A90DC2074A for ; Thu, 14 May 2020 19:10: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="KV/zGbts" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A90DC2074A 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 8A7BB6EBB1; Thu, 14 May 2020 19:10:33 +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 533606EBB0 for ; Thu, 14 May 2020 19:10:31 +0000 (UTC) Received: by mail-lf1-x144.google.com with SMTP id r17so3583716lff.9 for ; Thu, 14 May 2020 12:10: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=BQs36UgnZaPqNCAzoKYxz5KT6Lkm6yBS/09B/P3wXNw=; b=KV/zGbtsbcJBxUhUrfp45Uhh9notrMrdzzIKpcIeNRZ/UIuQ/tcjKahpPEWXfvxjQb fWQduc+4oFVyt7yP8uiuMgRZYrIvtzZIsyxgQIUbPgznA9JEDfpPvg6cIzkEXUjvLDZo he3er8hWZZU0Y4FfDT/EexB/aBkbi9afI923EWgCYS5/odE77G00lIdQ9AeypaW6gdU6 llakEYcUjg33wxYGfyHigCcxeRFC/qukFHM3HxAM9cbekovP2VNIiu2OiHn5Hz9azwIG IkzaQwXo3GYPH6OXim2AktQ+wWIk6d5QgDhExmYL8tbK7KhBCvtPQZ1w4CvKnxZEPGlV 90Vw== 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=BQs36UgnZaPqNCAzoKYxz5KT6Lkm6yBS/09B/P3wXNw=; b=cSujn+CdBqjTx9UA2aTvYkQSfkfLhAlBOaNhPbhG4d9zuDMJVCrM4UGHAVRSvp2k2E +mOHY8JFJD3/bVz5aQjtRr0bwdFst5hOFCjwgX567Gaw5cFWUe8PWTlelhKhCRkVAbov tQNjOwW4Kj3gdkW9MaukWyjIJwLzYG67Misz3zx0HtnCbYJfalPytQja5d4C1GdmHXt8 2TCnu7wmXqQ9Ii73yK2ZAWbnmPensT9Lzwv5eu7qskXvLe+dOZIdDnb0/fh9FhpsBTH0 hpc9GBptYFHpdKMj3y15KNUJBZFagLImP2hSoObNQorYVHhh3tf8UW8Sz4L3dSh+h3lh 21NQ== X-Gm-Message-State: AOAM5306MoJodqhlIyqCKJ/Vqy3PtS7agolX27mh3oC05CwrKgRgFuxD wYJkCuLaezS12y5W233P2j5fhexbbuGAqQ== X-Google-Smtp-Source: ABdhPJyaih7Y5ge2hEfQtSUZ8mgLT+i9VMogVKUGX/RzFXXlVNpwUIo3AxeVCYK+anlI7bCTNwaz4Q== X-Received: by 2002:ac2:44cd:: with SMTP id d13mr2565957lfm.2.1589483429230; Thu, 14 May 2020 12:10:29 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:28 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 07/18] backlight: refactor fb_notifier_callback() Date: Thu, 14 May 2020 21:09:50 +0200 Message-Id: <20200514191001.457441-8-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt 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 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 91dfcf4a2087..5e08f4f1c99a 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 Thu May 14 19:09:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11549531 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 57D1214B7 for ; Thu, 14 May 2020 19:10: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 3619820675 for ; Thu, 14 May 2020 19:10:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eidvGM9t" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3619820675 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 5C6396EBB0; Thu, 14 May 2020 19:10:36 +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 26E216EBB0 for ; Thu, 14 May 2020 19:10:34 +0000 (UTC) Received: by mail-lf1-x141.google.com with SMTP id h26so3591877lfg.6 for ; Thu, 14 May 2020 12:10:34 -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=0CehtWkd1Er3yC2BMyIEGrFFapubFNN7PqykdJUfMHI=; b=eidvGM9t96XHHWfRflJPjBBF5HTlVuyDtHlLIgkQ17RztqdmJdDb5ththyU0zKGQ4m q54IGp7jpOWWEm13OdvzXnDuiL6IhITR4HNGgHvejHkL9tIkrhN7Z0X54Wz4mvoxxdsx aeAJqpmbvbvLKIKomqcMvNFzkir+eMGDIzeXf1dzcz7uCCsvmxXFsEbp2WZiy8aQ+b9K kofg6lfZvlrXKi16NHuuu5BviIcNsMgd5p+Jwkp8S05qoOGvqLpUUI8HJQk+WA8rDLfq ISHDb0p5qYN3IbCBh96bEobzdD9XWy3YRIqbt+jbVfa7Zhb0YeRGGa2Iki9z4oCC6wJe o6YQ== 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=0CehtWkd1Er3yC2BMyIEGrFFapubFNN7PqykdJUfMHI=; b=eP/de2spGDz35o2reG38ki3RRpWNOVkgLxES0xrW1TU55Lx3/Ee7dUDNG7seJr6Dlh Y7rnuh2xwGAAauFZxv+9qN1jth1jeDPqHS1rjK70vvaurjM/ramNF0mLUsdrHpn4K5Op y96sgH8TZYmKAkTyEkimpIylr4kzYjO7jz8N0cqa665pBDODOGflyPyWm6QACQpYoSCY FRGVgtWEYTlNmyKNcPQ8LAMySdHUjNdkC6xbRyR/qS3xettBMW6Hkp+kKmeKJ9MpgrKX xTwzj4a02dYNnsV6ypxBCvG/TBwTUojvPelTwjhZ0Rg+HRaZURr5pmhRsPsv+KA2v40A ONgw== X-Gm-Message-State: AOAM532xx5WvBa0+wI4hdrsThB/VbrSf0zmcO9tDgTD95fI9AojCx/bU NJ0itXn5lvazmdG9az0jvVbNZevIQpYjBQ== X-Google-Smtp-Source: ABdhPJzlhguokXHBb6OrRTCkI/stO8K6/VCjE7cIr/pNl4vTApu2RhD3AXVSV3P255PVDcwAxt3qMA== X-Received: by 2002:ac2:599e:: with SMTP id w30mr3544961lfn.188.1589483432002; Thu, 14 May 2020 12:10:32 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:30 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 08/18] backlight: add backlight_is_blank() Date: Thu, 14 May 2020 21:09:51 +0200 Message-Id: <20200514191001.457441-9-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt 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 as thus not needed in this helper function. Rolling out this helper to all relevant backlight drivers will eliminate almost all accesses to fb_blank. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- include/linux/backlight.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index b7839ea9d00a..e67e926de1e2 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -165,6 +165,23 @@ static inline int backlight_disable(struct backlight_device *bd) return backlight_update_status(bd); } +/** + * 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 state indicate BLANK or SUSPENDED + * + * Returns true if display is expected to be blank, false otherwise. + */ +static inline bool backlight_is_blank(struct backlight_device *bd) +{ + return bd->props.power != FB_BLANK_UNBLANK || + bd->props.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 Thu May 14 19:09:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11549541 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 DA4B0618 for ; Thu, 14 May 2020 19:10: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 B7CEF206DC for ; Thu, 14 May 2020 19:10: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="hmEzwt90" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B7CEF206DC 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 16E8E6EBB2; Thu, 14 May 2020 19:10:40 +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 A56766EBB2 for ; Thu, 14 May 2020 19:10:36 +0000 (UTC) Received: by mail-lf1-x141.google.com with SMTP id r17so3583934lff.9 for ; Thu, 14 May 2020 12:10:36 -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=62dugcWsovCeCskk/LKWdY/i7tcZK4WDkmw+PPDUYp0=; b=hmEzwt90DZ7x99DPyRV6/hvrG2vuVWtFc62KnUO3UBwXxpBa4RO+CO0Yd4cwPS1GPU PsZhmR/YGuJbKV1hs5Ah0j2oll5bCnbp+SJLk4CiL76I9JpIYfKvDGXMs410dHKyLFVV 2QFgL0oKBOSbKK5nfGLrWpfz1AzvNAuWO2G7nlYD1KwjaqZd6efLZLTcWEg6kdCXkq/y d08f96AQ7fGekUXvVfIVuvX7qjp3qfJaEa7Nry04lPM8p5aJDuJJoZAX19OX4qydbEH3 ewBrwT57tPyR9qdrYGwCDHi59X+F8Z/b5cpdzF83DmfGG6VIgbzDjX0u/NH0SbSfxZP5 d1ag== 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=62dugcWsovCeCskk/LKWdY/i7tcZK4WDkmw+PPDUYp0=; b=ijkQ2U5U1ye1lUCw0Ihd5htwr/dyVfFSlOSum/4HQqIoqynv9+ly3AN6Y2L3Cdb5/t sdrVwJyhC5N1bvPzqY46tv/viHlYTQfZo3tg+1kb72yCDNXJkbC1DAR5EncIYQC1NxtE uFqfePn8ACqVfbITkACM+dJrkSg6qf6xIIa3yGmPKK0MOxnXqVsPpc8qc0SX0Doejx4k kS0Uedl8G8SGdahACw8aTjzIaZrAxa9fh5xoTHiOzug7OynTwLgfICT66jMLU06gSdKX 1py+JNPes5eHGfHh2c1woUnmjtiq8HmQ4bfZmSpnvxhE/tPsQymzMtB5IqVd6vUhFmxX lPiA== X-Gm-Message-State: AOAM533PPg8b8af3tmuHWrqbmlAq5qF37GCB+FVAKUdckazZS6yN+Wki Wv7Oy4vjZY/7KPw1LGlp88QbRkAB/n9Q+Q== X-Google-Smtp-Source: ABdhPJw+1WHsEHe6VbX3gtcUnN10QNwuwD64Zx0hRMjc16fHurTG/QV6aCvAhZrWJ1MOCzc4ALaROA== X-Received: by 2002:ac2:4da1:: with SMTP id h1mr4242794lfe.152.1589483434518; Thu, 14 May 2020 12:10:34 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:33 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 09/18] backlight: improve backlight_ops documentation Date: Thu, 14 May 2020 21:09:52 +0200 Message-Id: <20200514191001.457441-10-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Improve the documentation for backlight_ops and adapt it to kernel-doc style. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- include/linux/backlight.h | 60 +++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index e67e926de1e2..51f0d0abea25 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -55,19 +55,67 @@ 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: + * + * 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: + * + * 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 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 Thu May 14 19:09:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11549539 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 7026A14C0 for ; Thu, 14 May 2020 19:10:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4AB90206F1 for ; Thu, 14 May 2020 19:10:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cidQOtSQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4AB90206F1 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 196DF6EBB3; Thu, 14 May 2020 19:10:40 +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 C45326EBB2 for ; Thu, 14 May 2020 19:10:38 +0000 (UTC) Received: by mail-lf1-x144.google.com with SMTP id 82so2080447lfh.2 for ; Thu, 14 May 2020 12:10:38 -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=DU9BwH5P6JpnKqtdKJ6tqvGSR4Gzunk38snlPE5mOfk=; b=cidQOtSQ/2cvmUi149fw0puJ03Rou6Ou3yGl+kps97oZSBOHCqwFqaes1QXK3q8lyp nuNk+dbzYSoQnX0F061oC5j8HDGQMuhdkqoGoW5xJRX7nSw4D7x3xrkn2nQ6n0Q5alqw 3OIhhmAT0SN4V5SN4/GC5TQB/rkJoq/XopbU5UVXTu+cslDxLjZrlYueolViXrKKoDuL hGR8uCjg/ypoQS423tRoCcD9K6DMisYG8T3KxVUT7cYp51U+T5ESQcye8Fk4dOAmBxY3 AdmEJy3Ek/x0/cQeAG4aac5OJNc/0Dt8HtN5BORz4zNyQQoICTlTjf/Jdk8qw/8j1R1T zT4Q== 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=DU9BwH5P6JpnKqtdKJ6tqvGSR4Gzunk38snlPE5mOfk=; b=QjWyLfeJqQwcdHf8qEFT5ehkFG9Lm+/1CGHTZ55ICjgNz8xFEgYXi6PoNQ8n5Mx7Ti ztJkeMXhEwmlmtLWrQoau0I2fXaSIo6qjc9BOJdAYnjkL0uMGsgrhe+XDE3M8H4KgAHJ YwhDo+gnUtsHULyQCNGugYvkI4un2l5Dgqa4zyXQRQkAKoqUk8Ng1rzk3ibYBZ5FvWCQ Ic8XmjM+CYZo8sBR8ay819j1s8grgiUDht0i02QZpe5aUlJXVtro9/t+sk0rM44MyfAZ MdxMvqhSwXYgO3+nZzsUzbsvqEALR4iFWOUxs4uA5UNl74OdeY0EeUq3gc2HAXPShDjS c4/w== X-Gm-Message-State: AOAM532FwnEvaMy6IqgLGV5OPn056jKhMAYqhklLfkCWRUWftX0r5JIG OPNIvXrHV+hGtF9bbEd/uZ9VyYWTWJNobw== X-Google-Smtp-Source: ABdhPJzMUI3wXjuWNAVuLeVxiJIQ+xHYSiwpRZJ0PPAitpNM8uo7AAQUzfKu+agdL1tLH8/i1w/U2A== X-Received: by 2002:a19:c04:: with SMTP id 4mr3990355lfm.17.1589483436799; Thu, 14 May 2020 12:10:36 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:36 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 10/18] backlight: improve backlight_properties documentation Date: Thu, 14 May 2020 21:09:53 +0200 Message-Id: <20200514191001.457441-11-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Improve the documentation for backlight_properties and adapt it to kernel-doc style. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- include/linux/backlight.h | 101 +++++++++++++++++++++++++++++++++----- 1 file changed, 90 insertions(+), 11 deletions(-) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 51f0d0abea25..c81b77af44d4 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -118,28 +118,107 @@ 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 requested brightness by the user. + * The backlight core makes sure the range is (0 - 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(). + * + * This property must not be modified by a driver except + * before registering the backlight device as explained above. + */ 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 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..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: + * + * 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. + * + * This property must not be modified by a driver. + * The backlight driver shall never read this variable, + * as the necessary info is avaialble via the 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 property is used to inform drivers of state changes + * when the update_status() operation is called. + * 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. + * + * This property must not be modified by a driver. + */ 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 (linear, non-linear, ...) + */ + enum backlight_scale scale; }; struct backlight_device { From patchwork Thu May 14 19:09:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11549543 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 77747618 for ; Thu, 14 May 2020 19:10: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 42B7C20675 for ; Thu, 14 May 2020 19:10: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="eGDXq2gk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 42B7C20675 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 208A26EBB5; Thu, 14 May 2020 19:10:43 +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 B19516EBB5 for ; Thu, 14 May 2020 19:10:40 +0000 (UTC) Received: by mail-lf1-x141.google.com with SMTP id 82so2080564lfh.2 for ; Thu, 14 May 2020 12:10:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w93KHIix1KwNNTaPJvVdVMvh/rS96v+7uJyDQPCp+jo=; b=eGDXq2gkkYR9ddSm7q5nNuNKvYqB6zVrH2D2RQC9Xt+MBfpZUUQ7kXef5J1CxCmeNC 4t4nlDUVE7vNuetbObaCXcZ0N4C4NDzaGgMCdPTYgn1kqv694TEhGr9xtD0qbFNDO7fr zloc2SqbsohpuzLpixER84WBHIJCpAa515vPWwaq2CrhO5LFUMSuxfZO+BIX1EdBWMob 4BhW9wqqDcHJMFd4eA1JkCCyKp5RbdbKU5vH3eYqz/PIZcPEGvwJsfetEAVLvrKeh55X X4FKRQDwx+e2gKr6srXsumCcrw7Aa9hQ2qVP8qAfWP2qSaLIRoORwrU6ZZdSVbHtiBCU 6fgQ== 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=w93KHIix1KwNNTaPJvVdVMvh/rS96v+7uJyDQPCp+jo=; b=KUrVekx3PZ04KJaqUv5O7t9ZotjTx0dI+PNSPvZhFwdg+m1hF2KJLoFcQ91ljnDpNL /Bv4Slz+KtUfDF7NPEI3aHmmolqE3wfPFVC77O0shgbWLm2h3SQ4mNS0Gj6IXYYIW2PC VnRS4ULAJRV2GLc06RFK4vd0i031cXBaCxIlYJhzzPXq1smuwvTz8YakX7JMg4wr0GYg 8KyfcRg95mpxGhlFG4rAYRngpO7avqtWrNoVUBYXgEvKvIvlvxi8Zl1m1toZIhn/zrpO CtTXmN8vUj2PSjvbxOQ5epbLGuMJ/+s8X2PqxJY10F0tiy8QjF95WU/rm/G+luzmq8FE 7oCg== X-Gm-Message-State: AOAM531a+J2qDbtbYWgXcxXrZofDF+vt1h9XTjtKkIm50fVD01ruoVt5 PDG5j0UZX+Nn19LFCLLy63Z5IjvSsD0cdw== X-Google-Smtp-Source: ABdhPJxnjy1VIP5/HwcaRpS7WhqMTnte+MydT1bqKgrCc6fGers5oSxc2xs7YND2DJSTZnsR18PdZg== X-Received: by 2002:ac2:5f73:: with SMTP id c19mr4211562lfc.135.1589483438819; Thu, 14 May 2020 12:10:38 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:38 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 11/18] backlight: improve backlight_device documentation Date: Thu, 14 May 2020 21:09:54 +0200 Message-Id: <20200514191001.457441-12-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Improve the documentation for backlight_device and adapt it to kernel-doc style. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- include/linux/backlight.h | 81 ++++++++++++++++++++++++++++----------- 1 file changed, 58 insertions(+), 23 deletions(-) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index c81b77af44d4..34ba1e444334 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, @@ -221,30 +206,80 @@ 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: + * + * update_lock is an internal backlight lock that serialise access + * to the update_status() method. The iupdate_lock mutex 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: + * + * 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 mutex 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: + * + * 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 Thu May 14 19:09:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11549555 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 17E60618 for ; Thu, 14 May 2020 19:10:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EA10020675 for ; Thu, 14 May 2020 19:10: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="a5Ap00Ov" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA10020675 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 2284C6EBB8; Thu, 14 May 2020 19:10:46 +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 A88726EBB5 for ; Thu, 14 May 2020 19:10:42 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id g4so4778753ljl.2 for ; Thu, 14 May 2020 12:10:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2As4iiMj0BTo7C+dTbzUgkC9XsiqqnfWF8EBRNpLd7g=; b=a5Ap00Ov2KLpVSkuuJkC3wj3lAszNGu+09WiQxhFyIG16BxWDWEP0CTK+Ir8wQolJB fmNSaQvE3d6FYDQmT7XN4eiJDVmy+OGsc1Okns994TIBQ7jN5UHgrXc+D8kh9+oJowHX Pxt2zCCeofI4AYNqqmGoXvtPUnynTsVjRBJHYpFnDfjQUimKmm1XLYJMKzk/UZ4XZXbm RX8arI7PerFkdsLcQLBm1T6wGmwNKohqY0EdsQZsY+/p0+cqai/NHfN4Z6TuSL5V0nzR bShpRseQyR+pEIzfHxb0wdhbehBq41T2pFW0nCxYBcnIaZqVd0CtqvThiz1aBQ8je36I JOlg== 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=2As4iiMj0BTo7C+dTbzUgkC9XsiqqnfWF8EBRNpLd7g=; b=uZDlqC3pfjAwo56C4UEdU/SjXL7GPo5VkCFouF/kH+Q3Ne2qVjAuKh+KdRAe0fYLGU OW7QCQX29412L7C1nZtQBIvpT74fWJPN+/v7eSgA4DAM0Zesg9pWHx7E/aSdPLPlyQTy wfIacE032rRhLIv7S774jbARMKBSx+v02Pv+S8LGtaZEGn8SCn0NQXdIk+rF6DeotjSE ZN7ipYeap2+xTs3gPLs0auVhspH6/jeqiew1R6tH347THOiiKdKYGYLjepDCsm7+qYeH 2nG4uGq0Q17qqqQsjTPYGgl0T14Ai2ikhIFxOOhwWESU1zSAmC0SkQn6FV0LLNGWGJ8V KmtQ== X-Gm-Message-State: AOAM532ZK3Iy24IWdMG/1WWCLVEaTCVLKnOUYtDZ0WTl2p150QxWyG7z yak1DA87j7SpmZVQnsfYLN8+W7op3jkQ0A== X-Google-Smtp-Source: ABdhPJxOE9RU/MsJ6k8PfrsSEIcqB8AFxJK7Zaq6b7zomy4TpPcp6vACPeUyOYCZdkuXTyvn1J9mHg== X-Received: by 2002:a2e:9456:: with SMTP id o22mr3716363ljh.94.1589483440767; Thu, 14 May 2020 12:10:40 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:40 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 12/18] backlight: document inline functions in backlight.h Date: Thu, 14 May 2020 21:09:55 +0200 Message-Id: <20200514191001.457441-13-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add documentation for the inline functions in backlight.h Signed-off-by: Sam Ravnborg 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 34ba1e444334..b8e78549a48c 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -283,6 +283,10 @@ struct backlight_device { int use_count; }; +/** + * backlight_update_status - force an update of the backligt device status + * @bd: the backlight device + */ static inline int backlight_update_status(struct backlight_device *bd) { int ret = -ENOENT; @@ -363,6 +367,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 Thu May 14 19:09:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11549551 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 D4CDC14B7 for ; Thu, 14 May 2020 19:10: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 B2C1F206F1 for ; Thu, 14 May 2020 19:10: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="l7NkQzxm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2C1F206F1 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 A751A6EBB7; Thu, 14 May 2020 19:10:45 +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 986DD6EBB6 for ; Thu, 14 May 2020 19:10:44 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id u15so4787731ljd.3 for ; Thu, 14 May 2020 12:10: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=7NL7oOh2YpmGkieh3R7y/HMeuTthqrGLkMzsF1Tg8k0=; b=l7NkQzxmJKlSolH7PJHAvYG4SzzLtTDVkv7A5b8wb8TSIjPhQGtgXsYBBxnnIAKqbX pJchKTttYj1Gbcaqq2XupUvICzobt2Mdl1t7G2DjVrE3+Gc/y0pP4bJCp89MlCOLUl0w 6YK2XlFOt1c286dSaBmDauQ6RcHYnYLOKfyPPaAsKIYpTc58IFpkPagWZURSJewPXbg5 EPtuXM63ZGxf3p+ucfulm5rjpVbQkDph0XKtaojCjYaAxEudP3XAelw/UxLGxdNb498w eIf4RiMOc8ZesgTFe1ULkkmrT+hrwmmOvibWieZpqaLpBXNGmTQo1k5leY/tBU65PwP7 0OIg== 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=7NL7oOh2YpmGkieh3R7y/HMeuTthqrGLkMzsF1Tg8k0=; b=aDFFcd65FJWR+zP6yHoWwcPYiN5Mp/blNqLvmZj3njatfY6eLihs0N9i/2mayS+fMz Lz/nrGWAtkFvKLdL7EroYIVxWb+GMaoAA1Ph5E5rpE9Cd6PczwWWeUhdFn4MNpUpnpMj oRsjEpCqUR27kf8qjy+1yOXiUTXL2hO0QXjP7cHvQhzJL77Bl0oCbGHKfh3KDDlMpQG7 kvOEuKn+uQKhS55oMirtfWOa+uEvMqTUEp/2qb+3i5GlJK5REHuVsfAr0zx0ajAO95Yh TyzmKFfoZMFF9AIHVNOdIqPOuXn1ahLptj90ZOBiu1HydmuNvMP605eCDEtz7J7BpyJw 8Kfg== X-Gm-Message-State: AOAM530IiPj11AYOoxSTDxVj3wUjUDfUu+l0RgIqjwmzImbBXSE/gb0B uzTl3jy5sruyb9VEuXiJsjc8EgR4glpn+g== X-Google-Smtp-Source: ABdhPJzKDt4XU/BmWeiLV6W594VhbfU7W8uhu8wo1ZRThIlXSSv8E9xcMBsJko0RoOFHj/dT79mvAQ== X-Received: by 2002:a05:651c:c8:: with SMTP id 8mr3521844ljr.182.1589483442684; Thu, 14 May 2020 12:10:42 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:42 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 13/18] backlight: document enums in backlight.h Date: Thu, 14 May 2020 21:09:56 +0200 Message-Id: <20200514191001.457441-14-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add kernel-doc documentation for the backlight enums Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- include/linux/backlight.h | 84 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index b8e78549a48c..bedc0c9885b6 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -14,26 +14,110 @@ #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 directly. + */ BACKLIGHT_RAW = 1, + + /** + * @BACKLIGHT_PLATFORM: + * + * The backlight is controller 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, so the brigness increase is the same + * when increasing with the same steps (more or less). + */ 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 Thu May 14 19:09:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11549557 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 430B1618 for ; Thu, 14 May 2020 19:10:50 +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 20F07206F1 for ; Thu, 14 May 2020 19:10:50 +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="pCreTNMa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 20F07206F1 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 309E26EBB6; Thu, 14 May 2020 19:10:49 +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 A313B6EBB9 for ; Thu, 14 May 2020 19:10:46 +0000 (UTC) Received: by mail-lj1-x241.google.com with SMTP id g4so4778951ljl.2 for ; Thu, 14 May 2020 12:10: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=QQ6cQiTwX0MTLVxycmbf+pLMjVFwJNOhFy3nlUWgnjo=; b=pCreTNMaYfEgANnrPA959oqaXhY2cWpZxw2Wal7KtAjSEk5IFgYXokbj7XpAaPhpkE V+fQboPEXIxiiGqSCDA0yUrVCu2klvb3ba3TzO56wlh02dXjDUJmOXA9Qu+qywv5Bq4C 7ksReG+5wbwUvBtxs1naUel7VOYGACnBsQREpL83NXP9LUaZPKIjUPVmi4Roe3D8rJD9 c2yDB8ryMXDQP94WTmmmikSntDW3lhzyMV/h/FcWRZjhYNOsA1muuHJqIupDyUc0TBmd 64raqD5G7jwLW7VFk6I+VFGT9cW1uVh7jecSCmqkUKuiPGIYuxfL77RDM410f6K9TLC4 ixOw== 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=QQ6cQiTwX0MTLVxycmbf+pLMjVFwJNOhFy3nlUWgnjo=; b=g0W2oE4eatBIJXYda0F/MZxNsSl3S0oE7pGVpyJ7IqI5bOFcwFitp1AFDxN4mQrdO+ DCRO2cfuT65t+kvuvqpae7Zq0wEzk2oEROQ6KOOHSc9oBbYif/7Wp73ClM8J5rdQbn0x FL2747/goQD4mtfBYmDyWI/8XwHD2A3UJnJWUOCju2/AyuVFng9Q1OQJCPmTRvIeA1OE NA9e0PWyYpbEWWlApr6ZPtDNQFllDjY2HJstK/0qLnlqLKQ4nJEg5o1I9nNMD9QZevyo 6ICp+rB7pO+dDxlwaRD1fuitc1bVGTiK7YqnZP58OJ8Yx2PJqAdf77H1ptGfSTwUj54w Cprw== X-Gm-Message-State: AOAM533BQtsa+p3fcjUUoh9lxQkZPiHQ0Wpz2ye/0tHvScis+A9/H4Hr T6prlEu54KdzB0/RwLwxaQSeg0nBJmM10A== X-Google-Smtp-Source: ABdhPJzrGXGPIUoPXnw1NRKXERD2PDmupXT3TDJShzgLrY62Erezsz2rIItgK5KTox7WCS6nuxZ3Ug== X-Received: by 2002:a2e:96d1:: with SMTP id d17mr3639946ljj.239.1589483444633; Thu, 14 May 2020 12:10:44 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:44 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 14/18] backlight: remove the unused backlight_bl driver Date: Thu, 14 May 2020 21:09:57 +0200 Message-Id: <20200514191001.457441-15-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The 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 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 bedc0c9885b6..35fdc277bdc5 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -468,15 +468,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); -}; - #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE) struct backlight_device *devm_of_find_backlight(struct device *dev); #else From patchwork Thu May 14 19:09:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11549561 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 C826F618 for ; Thu, 14 May 2020 19:10:51 +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 A5E0C20675 for ; Thu, 14 May 2020 19:10:51 +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="R7Nzrctq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5E0C20675 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 7622C6EBB9; Thu, 14 May 2020 19:10:49 +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 83A2A6EBB6 for ; Thu, 14 May 2020 19:10:48 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id r17so3584463lff.9 for ; Thu, 14 May 2020 12:10:48 -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=k+fYBnpUxdD0+lpDaEI6w4m+CbJ5UGddgxFwRuGeORE=; b=R7NzrctqgtXQJS3grrlCPGzWGsCfe4ksm+P7pT2D3yz0IXyglmxFJjfYfjTpkVhphC yp0XR+p/ME4HsJIM7OK34eEY/Ry/Ig/Yij4eN5Y/keWxcEyfoJt3j54KL7BUUJc3Hjwi KxdjGN4yZFeuBwMNS0LV+9ZYsTt5Gie6RegfdgoZDk+tKGNyl0KMqmxM3G9/WfFCvzUQ HRxXA/UZHyoIMafTAlpilKiSSCJNIwGUrR53dItkAGwTHNNx3ujbIGicy/0Orppqz/sE ZkPDj9Cs5JE6aDPh/el55OykGqpwNCHjZDjTMX3Ga7/U+SV4I88WDDT66wY77pjFFlBy 4x2g== 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=k+fYBnpUxdD0+lpDaEI6w4m+CbJ5UGddgxFwRuGeORE=; b=Ms6QvJrvI1TStQtSHgSNLjbkLZNV1uaOA3XYLCQMZO9/KhW3JjvAUdXmOyBSepzb9d mex/L33LUxv3muTv8noqaUlHf7pQKfgXl8xWQ5nCdnethpOyLGUDk7o3DD0liMzvKbPL 72KJgoJNhmiXa/s9kJHg/72hC9INd4D7J43D8qci9oVgGmHo3ug5Y+hIvi1R/RwZvsUp i/Il39u41hG0VN1/ea5vNHIKzBzzHGb5CspLv1ZtO12TSFSWAjCANcUkHIFI0iTdM/Dz s9oKBVz3TEwlBP8vv5WXEDyYpEdvt3I50HSyi9yL2VkbYlvB8XGCAFh5bV5DLJHeZr7w ml9A== X-Gm-Message-State: AOAM5317Huhbt65+FaKE8NLiGYSQgvDmtoD0cDJ29K4IOxywyTFGQMhp g3Xf4bp2l2d0EaIBn2of/OC2wS0SpX2iHQ== X-Google-Smtp-Source: ABdhPJwH8dTDYPDQIUpGDGvj6FZ3qIeYzBsHCr3lDzcRaF/M7CXtfPsF3/BedGYjm3vTx1CBz7gtLw== X-Received: by 2002:ac2:596e:: with SMTP id h14mr4244342lfp.215.1589483446686; Thu, 14 May 2020 12:10:46 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:45 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 15/18] backlight: drop extern from prototypes Date: Thu, 14 May 2020 21:09:58 +0200 Message-Id: <20200514191001.457441-16-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt 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 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 35fdc277bdc5..99fc1c950578 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -432,22 +432,25 @@ static inline bool backlight_is_blank(struct backlight_device *bd) bd->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK); } -extern struct backlight_device *backlight_device_register(const char *name, - struct device *dev, void *devdata, const struct backlight_ops *ops, - const struct backlight_properties *props); -extern struct backlight_device *devm_backlight_device_register( - struct device *dev, const char *name, struct device *parent, - void *devdata, const struct backlight_ops *ops, - const struct backlight_properties *props); -extern void backlight_device_unregister(struct backlight_device *bd); -extern void devm_backlight_device_unregister(struct device *dev, - struct backlight_device *bd); -extern void backlight_force_update(struct backlight_device *bd, - enum backlight_update_reason reason); -extern int backlight_register_notifier(struct notifier_block *nb); -extern int backlight_unregister_notifier(struct notifier_block *nb); -extern struct backlight_device *backlight_device_get_by_type(enum backlight_type type); -extern int backlight_device_set_brightness(struct backlight_device *bd, unsigned long brightness); +struct backlight_device * +backlight_device_register(const char *name, struct device *dev, void *devdata, + const struct backlight_ops *ops, + const struct backlight_properties *props); +struct backlight_device * +devm_backlight_device_register(struct device *dev, const char *name, + struct device *parent, void *devdata, + const struct backlight_ops *ops, + const struct backlight_properties *props); +void backlight_device_unregister(struct backlight_device *bd); +void devm_backlight_device_unregister(struct device *dev, + struct backlight_device *bd); +void backlight_force_update(struct backlight_device *bd, + enum backlight_update_reason reason); +int backlight_register_notifier(struct notifier_block *nb); +int backlight_unregister_notifier(struct notifier_block *nb); +struct backlight_device *backlight_device_get_by_type(enum backlight_type type); +int backlight_device_set_brightness(struct backlight_device *bd, + unsigned long brightness); #define to_backlight_device(obj) container_of(obj, struct backlight_device, dev) From patchwork Thu May 14 19:09:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11549567 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 C41E514B7 for ; Thu, 14 May 2020 19:10:55 +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 A1664206D8 for ; Thu, 14 May 2020 19:10:55 +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="WXdhfmDW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A1664206D8 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 B8E976EBBC; Thu, 14 May 2020 19:10:53 +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 B03C76EBBB for ; Thu, 14 May 2020 19:10:50 +0000 (UTC) Received: by mail-lf1-x141.google.com with SMTP id z22so3635242lfd.0 for ; Thu, 14 May 2020 12:10:50 -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=FHEFLzf7L16sgSpniAzOoaly07qlbfOb04HDRQaDGfk=; b=WXdhfmDWCDNiJ4nDMbGJteAniCz/JCNt2ThhTVsQN2wz1Dx015tVCfFamkbLzpxfF5 edsSFg/6rO2Tr7p11gRZYIugEVKBisaT0W6WzJJSnPu0Of3HdTP1/n6rVB1B3zpjgY29 fdEwjDtB4ccimxRB01CzLTYEXUWLvYRBaugDvypiw1jHE6QrQAmq81VptkFyHgGRHhJ1 jcXjiE61mE+41sljm9CAzTAhcNfFzs/ZpRJkbKEP+LQ7sOhjYlptVi1ccojx0CvKCVCo ZzSMqZbFLJbRyB4sVd5siCJHTVioCHge6GMGiZNRqfKKW6BdGMIk2TAPB1DewXhZMwVE nygg== 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=FHEFLzf7L16sgSpniAzOoaly07qlbfOb04HDRQaDGfk=; b=QE9hr+2NnVWGiv+sfswkI0+zdMHzN66h/+G/yzndPOX3a0LbdTK3zfPcyrthEbrpZ9 GbmlPUvVJJjlbHcpwTsvvXclR/V/y+2ISJelBCJk3W8o/NYPhNUqspCl0souR9UtF301 KWGz+lss0qM8wNEZTbGme3qGq86JNtS+3g/JXeJC4fIJ8g0T0WSo3llSwKCUcPOdecwe BZ5A2PiQduhOb5UPOto2gYFfRN69zRLnArfS5ukDqKYMTQybxkAZBaWCgoWT23WfIEHQ 1dEjxNmxG8hHvoapsuu/Cxv3DuCWfvj4RTqrp2P2PeKe0Eq3xmm7Zw/YNSJw150ow0nN e0mA== X-Gm-Message-State: AOAM5319VOnN+PaYl+mXV4eeJCYXxeQzjNPRHogV/CSH0dwmlgyzGfIl fgilE+h+b9M9eG4I+gizZH7tGot9P7Btgg== X-Google-Smtp-Source: ABdhPJxvf22RhMCh9UUwygPqoLIgjwhYAYnWv1raYMF7jVr1DJ/tIQBG1KUemRh4q1DVuslPhbDpBQ== X-Received: by 2002:ac2:5685:: with SMTP id 5mr4282404lfr.5.1589483448703; Thu, 14 May 2020 12:10:48 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:48 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 16/18] backlight: add overview and update existing doc Date: Thu, 14 May 2020 21:09:59 +0200 Message-Id: <20200514191001.457441-17-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt 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. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- drivers/video/backlight/backlight.c | 134 +++++++++++++++++++--------- 1 file changed, 92 insertions(+), 42 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 5e08f4f1c99a..441d2880ffe2 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -22,6 +22,45 @@ #include #endif +/** + * DOC: overview + * + * The backlight core supports implementing backlight drivers. + * + * backlight is controlled from userspace via firmware, a platform + * specific way or via sysfs. The backlight core provide support + * for all three types of backlight control. + * + * 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 driver shall implement the get_brightness() operation if + * the HW do not support all the levels that can be specified in + * brightness, thus providing user-space access to the actual level + * via the actual_brightness attribute. + * When the backlight changes this is reported to user-space using + * an uevent connected to the actual_brightness attribute. + * When brightness is set by platform specific means, for example + * a hot-key to adjust backlight, the driver must notify the backlight + * core that brighness has changed using backlight_force_update(). + * + * The backlight driver core receives notifications from fbdev and + * if the event is FB_EVENT_BLANK the value of blank, from the FBIOBLANK + * ioclt, is passed to the driver via the update_status() operation. + */ + static struct list_head backlight_dev_list; static struct mutex backlight_dev_list_mutex; static struct blocking_notifier_head backlight_notifier; @@ -40,9 +79,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 care 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 backligt for the specified fbdev. */ static int fb_notifier_callback(struct notifier_block *self, unsigned long event, void *data) @@ -318,12 +365,16 @@ 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 generate an uevent to notify userspace. + * A backlight driver shall call backlight_force_update() when the backlight + * is changed using, for example, a hot-key. + * The updated brightness is read using get_brightness() and the brightness + * value is reported using an uevent. */ void backlight_force_update(struct backlight_device *bd, enum backlight_update_reason reason) @@ -336,19 +387,7 @@ void backlight_force_update(struct backlight_device *bd, } EXPORT_SYMBOL(backlight_force_update); -/** - * backlight_device_register - create and register a new object of - * backlight_device class. - * @name: the name of the new object(must be the same as the name of the - * respective framebuffer device). - * @parent: a pointer to the parent device - * @devdata: an optional pointer to be stored for private driver use. The - * methods may retrieve it by using bl_get_data(bd). - * @ops: the backlight operations structure. - * - * Creates and registers new backlight device. Returns either an - * ERR_PTR() or a pointer to the newly allocated device. - */ +/* deprecated - use devm_backlight_device_register() */ struct backlight_device *backlight_device_register(const char *name, struct device *parent, void *devdata, const struct backlight_ops *ops, const struct backlight_properties *props) @@ -415,6 +454,15 @@ struct backlight_device *backlight_device_register(const char *name, } EXPORT_SYMBOL(backlight_device_register); +/** backlight_device_get_by_type - find first backlight device of a type + * @type: the type of backlight device + * + * Look up the first backlight device of the specified type + * + * RETURNS: + * + * Pointer to backlight device if any was found. Otherwise NULL. + */ struct backlight_device *backlight_device_get_by_type(enum backlight_type type) { bool found = false; @@ -433,12 +481,7 @@ struct backlight_device *backlight_device_get_by_type(enum backlight_type type) } EXPORT_SYMBOL(backlight_device_get_by_type); -/** - * backlight_device_unregister - unregisters a backlight device object. - * @bd: the backlight device object to be unregistered and freed. - * - * Unregisters a previously registered via backlight_device_register object. - */ +/* deprecated - use devm_backlight_device_unregister() */ void backlight_device_unregister(struct backlight_device *bd) { if (!bd) @@ -486,10 +529,12 @@ static int devm_backlight_device_match(struct device *dev, void *res, * backlight_register_notifier - get notified of backlight (un)registration * @nb: notifier block with the notifier to call on backlight (un)registration * - * @return 0 on success, otherwise a negative error code - * * Register a notifier to get notified when backlight devices get registered * or unregistered. + * + * RETURNS: + * + * 0 on success, otherwise a negative error code */ int backlight_register_notifier(struct notifier_block *nb) { @@ -501,10 +546,12 @@ EXPORT_SYMBOL(backlight_register_notifier); * backlight_unregister_notifier - unregister a backlight notifier * @nb: notifier block to unregister * - * @return 0 on success, otherwise a negative error code - * * Register a notifier to get notified when backlight devices get registered * or unregistered. + * + * RETURNS: + * + * 0 on success, otherwise a negative error code */ int backlight_unregister_notifier(struct notifier_block *nb) { @@ -513,20 +560,22 @@ int backlight_unregister_notifier(struct notifier_block *nb) EXPORT_SYMBOL(backlight_unregister_notifier); /** - * devm_backlight_device_register - resource managed backlight_device_register() + * devm_backlight_device_register - registering a new backlight device * @dev: the device to register * @name: the name of the device - * @parent: a pointer to the parent device + * @parent: a pointer to the parent device (often the same as @dev) * @devdata: an optional pointer to be stored for private driver use * @ops: the backlight operations structure * @props: the backlight properties * - * @return a struct backlight on success, or an ERR_PTR on error + * Creates and registers new backlight device. When a backlight device + * is registered the configuration must be specified in the @props + * parameter. See description of &backlight_properties. * - * Managed backlight_device_register(). The backlight_device returned - * from this function are automatically freed on driver detach. - * See backlight_device_register() for more information. - */ + * RETURNS: + * + * struct backlight on success, or an ERR_PTR on error +*/ struct backlight_device *devm_backlight_device_register(struct device *dev, const char *name, struct device *parent, void *devdata, const struct backlight_ops *ops, @@ -553,13 +602,13 @@ struct backlight_device *devm_backlight_device_register(struct device *dev, EXPORT_SYMBOL(devm_backlight_device_register); /** - * devm_backlight_device_unregister - resource managed backlight_device_unregister() + * devm_backlight_device_unregister - backlight device unregister * @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) @@ -633,15 +682,16 @@ 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 * * 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: + * 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. From patchwork Thu May 14 19:10:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11549565 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 4C73A14C0 for ; Thu, 14 May 2020 19:10:54 +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 2A2E4206D8 for ; Thu, 14 May 2020 19:10:54 +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="emUIe2Cr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A2E4206D8 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 2B21A6EBBA; Thu, 14 May 2020 19:10:53 +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 7EA6E6EBBA for ; Thu, 14 May 2020 19:10:52 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id r17so3584630lff.9 for ; Thu, 14 May 2020 12:10:52 -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=5HPqfvqRtncVQoHgcS/XINMTd0DOJVWJH0ZC6vuce8s=; b=emUIe2CrPkK2Pwcu2rfzSfgyOhqN1IgF5D2tNyx65tJLOK+sdsxdQdABAi2myLyVNU FVe7XS7lP2xf1PtrUdBTd7VG0r7l/xopB+Shzu2H8leaiBz0cAJ5Lmz0UZ8UN0NaAZAG kdeSlnmPPmTnRmjTrDfK98KxZ2UqI+JIRnhty532B+bH9W4Z7O+VW6MZH/dsackpEzee u+Ojyu99hdyfHcq8qv5JDnjR6ToMFTjtwZmG/vb3dATHY2ijf6AksA557BDukLR/f4m4 gfDXh+sgY9mp7Xj0jCssrrUPa+hpwpm86QE2h2YVFKxK6YXUdMoczCrymXX6e/yUncQT CLbg== 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=5HPqfvqRtncVQoHgcS/XINMTd0DOJVWJH0ZC6vuce8s=; b=kPSFRi/66ocvGnN5dXisCmctOzd5DqKXHzLC/oHU2vQqe5bbBCQbE/p96xF/6+n40M lmJ3oUF5pmNInbiGPIE4ca980aH64dDyGsCFD4B8py59UeKaFkiD/1kYeJa5AsShA5Rr npyfY8fJ9BtJGhoTECvWmIuDsovVirOSPc0qe0mAcH8HlVI86Pd9UBODUBO5kcOhWTSd n1At4dTlJJ4DA11VccQmddFG7IRbVUTmM+NevQe9Aubd0pB6weN6UAil90mfLzEhHePE F0H4pkobEV7vCw/cA000Hdz6b3jKpVtIuDmDAlNAPCgFOpirvwCJb0CteNqwv4GqbDXn o53Q== X-Gm-Message-State: AOAM533YfDizBSQ+tJsV3vHehy0QWybM/hGTC1LKp4FL8SiaWFrDMqUg 1jteh7GmbpeYr7cl1NhDUJKMZmyJO7az3Q== X-Google-Smtp-Source: ABdhPJz4fQ85VUGDnvtJWFMEdr6v82wLiLbqW9nzb/RM5/7jT50m1uFyuDASQfywGtOcDsB8ZlPt5Q== X-Received: by 2002:a05:6512:3384:: with SMTP id h4mr4329647lfg.150.1589483450598; Thu, 14 May 2020 12:10:50 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:50 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 17/18] backlight: wire up kernel-doc documentation Date: Thu, 14 May 2020 21:10:00 +0200 Message-Id: <20200514191001.457441-18-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt 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 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 Thu May 14 19:10:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11549573 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 319FE14B7 for ; Thu, 14 May 2020 19:10:59 +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 0E565206D8 for ; Thu, 14 May 2020 19:10:59 +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="qB5TrxOz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E565206D8 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 563E36EBBB; Thu, 14 May 2020 19:10:58 +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 D74AB6EBBB for ; Thu, 14 May 2020 19:10:54 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id d21so4742747ljg.9 for ; Thu, 14 May 2020 12:10:54 -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=0TjjfHtIftg6y1deaf9Au+YmodMuSD9MQOJ+iJ1XC7I=; b=qB5TrxOzjLBBhlSoGt8TqwqgBxxHnB0NHvQ5aJh23W7xd7hF8BHRW1acVqQuik1z8G WCT7g1li4wyVYG5WrY0Gemk+2wP79/KYP9bmc5dLvzzKxVs1Ke4S3CghcZzH5wJkcGVL WNsxhcM1y//UKZWYIujGlYMZtUmGZODaYaLqgoI5xT53TP9oo+uDOLZZw2+9lzJ24bKN aEoxZ7aeHyJdqoSMBituxppxjqTodvptmgzozN94QgdBlRT/+s2+xGG050MB14g18D3v TaF2DptPjPQpk7APo75MKikXLg4XHptLwAFmgkEohJD5YUJnd3qpy+Ud93+GLXu8GPX5 WEGQ== 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=0TjjfHtIftg6y1deaf9Au+YmodMuSD9MQOJ+iJ1XC7I=; b=SXmpe85S4TQ2maco6onbXV1MrRJNT7uw5Of2cMC3BVqnA7pIlkfICqybXDlYohc3nz 9H2A8kH5B1koSRnYSX52hcmowyrz3Lc/46UqDWPzr8ClFeI8HqW09iUWuybSE55Nf2XI Frw7qim/6VZyK7hs3jOJQBoawRLPJnHbHxWdCv8ybznsUqrNd/y/noMQy6XQKrE4rQCf X7mWbdn8ylXs8KwRXWVPcM9iEuVwas1Lnvq+Yzv5M1ppwgnuuoEKyf+AT6Z9Oar+GQQc SCz7xMK+ck3kZQ2gfbgWsqj3wI9lqG6ujWJXXvPWspyMQMK+iWogAU4ILbcTEpePJoX7 ZdGw== X-Gm-Message-State: AOAM532kc75jW5qb0NzAx97/m6BeaCfpxLyNXvaMjvIFZNgn8aeD4YEC Ays3WltNSgJT14MDKrNtaGmGPLJBBSvo6w== X-Google-Smtp-Source: ABdhPJxpxx/dPjZR2NjE1DnmTmJigaruwKU6OtMCe86mU8Qk4zIy8kOoYxSwtVLnPSHdFZ1PkniTQw== X-Received: by 2002:a05:651c:1027:: with SMTP id w7mr3670125ljm.205.1589483452641; Thu, 14 May 2020 12:10:52 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:52 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 18/18] backlight: use backlight_is_blank() in all backlight drivers Date: Thu, 14 May 2020 21:10:01 +0200 Message-Id: <20200514191001.457441-19-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-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: Kate Stewart , Kefeng Wang , David Airlie , Daniel Vetter , Bjorn Andersson , Thierry Reding , Laurent Pinchart , Sam Ravnborg , Jonathan Corbet , Tomi Valkeinen , Russell King , Andy Gross , Uwe Kleine Konig , linux-pwm@vger.kernel.org, Michael Hennerich , Bartlomiej Zolnierkiewicz , Jani Nikula , linux-arm-msm@vger.kernel.org, Jyri Sarha , Thomas Gleixner , Allison Randal , Support Opensource , patches@opensource.cirrus.com, Douglas Anderson , Zheng Bin , Thomas Zimmermann , Enrico Weigelt Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replaces the open-coded checks if the state etc., with the backlight_is_blank() helper. This increases readability of the code and aling the functionality. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Cc: Michael Hennerich Cc: Support Opensource Cc: Thierry Reding Cc: "Uwe Kleine-König" Cc: Andy Gross Cc: Bjorn Andersson Cc: linux-pwm@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org Cc: patches@opensource.cirrus.com --- drivers/video/backlight/88pm860x_bl.c | 8 +------- drivers/video/backlight/adp5520_bl.c | 5 +---- drivers/video/backlight/adp8860_bl.c | 5 +---- drivers/video/backlight/adp8870_bl.c | 5 +---- drivers/video/backlight/as3711_bl.c | 8 +++----- drivers/video/backlight/bd6107.c | 4 +--- drivers/video/backlight/corgi_lcd.c | 5 +---- drivers/video/backlight/cr_bllcd.c | 22 +++++++--------------- drivers/video/backlight/da903x_bl.c | 8 +------- drivers/video/backlight/ep93xx_bl.c | 3 +-- drivers/video/backlight/gpio_backlight.c | 4 +--- drivers/video/backlight/hp680_bl.c | 4 +--- drivers/video/backlight/jornada720_bl.c | 2 +- drivers/video/backlight/kb3886_bl.c | 4 +--- drivers/video/backlight/led_bl.c | 4 +--- drivers/video/backlight/lm3533_bl.c | 4 +--- drivers/video/backlight/locomolcd.c | 4 +--- drivers/video/backlight/lv5207lp.c | 4 +--- drivers/video/backlight/max8925_bl.c | 8 +------- drivers/video/backlight/pwm_bl.c | 4 +--- drivers/video/backlight/qcom-wled.c | 4 +--- drivers/video/backlight/tps65217_bl.c | 4 +--- drivers/video/backlight/wm831x_bl.c | 8 +------- 23 files changed, 31 insertions(+), 100 deletions(-) diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c index 20d96a5ac384..162c83ab0f5a 100644 --- a/drivers/video/backlight/88pm860x_bl.c +++ b/drivers/video/backlight/88pm860x_bl.c @@ -123,13 +123,7 @@ static int pm860x_backlight_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.state & BL_CORE_SUSPENDED) + if (backlight_is_blank(bl)) brightness = 0; return pm860x_backlight_set(bl, brightness); diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c index 0f63f76723a5..d817b0d95c9d 100644 --- a/drivers/video/backlight/adp5520_bl.c +++ b/drivers/video/backlight/adp5520_bl.c @@ -67,10 +67,7 @@ static int adp5520_bl_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bl)) brightness = 0; return adp5520_bl_set(bl, brightness); diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c index 19968104fc47..a0ce2a3701fa 100644 --- a/drivers/video/backlight/adp8860_bl.c +++ b/drivers/video/backlight/adp8860_bl.c @@ -363,10 +363,7 @@ static int adp8860_bl_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bl)) brightness = 0; return adp8860_bl_set(bl, brightness); diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c index 4c0032010cfe..ae4269fdb189 100644 --- a/drivers/video/backlight/adp8870_bl.c +++ b/drivers/video/backlight/adp8870_bl.c @@ -401,10 +401,7 @@ static int adp8870_bl_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bl)) brightness = 0; return adp8870_bl_set(bl, brightness); diff --git a/drivers/video/backlight/as3711_bl.c b/drivers/video/backlight/as3711_bl.c index 33f0f0f2e8b3..7fa76008c7bf 100644 --- a/drivers/video/backlight/as3711_bl.c +++ b/drivers/video/backlight/as3711_bl.c @@ -107,13 +107,11 @@ static int as3711_bl_update_status(struct backlight_device *bl) int brightness = bl->props.brightness; int ret = 0; - dev_dbg(&bl->dev, "%s(): brightness %u, pwr %x, blank %x, state %x\n", + dev_dbg(&bl->dev, "%s(): brightness %u, pwr %x, state %x\n", __func__, bl->props.brightness, bl->props.power, - bl->props.fb_blank, bl->props.state); + bl->props.state); - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) + if (backlight_is_blank(bl)) brightness = 0; if (data->type == AS3711_BL_SU1) { diff --git a/drivers/video/backlight/bd6107.c b/drivers/video/backlight/bd6107.c index d5d5fb457e78..f6a5c1dba3bc 100644 --- a/drivers/video/backlight/bd6107.c +++ b/drivers/video/backlight/bd6107.c @@ -84,9 +84,7 @@ static int bd6107_backlight_update_status(struct backlight_device *backlight) struct bd6107 *bd = bl_get_data(backlight); int brightness = backlight->props.brightness; - if (backlight->props.power != FB_BLANK_UNBLANK || - backlight->props.fb_blank != FB_BLANK_UNBLANK || - backlight->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) + if (backlight_is_blank(backlight)) brightness = 0; if (brightness) { diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c index 25ef0cbd7583..c9adf4e26355 100644 --- a/drivers/video/backlight/corgi_lcd.c +++ b/drivers/video/backlight/corgi_lcd.c @@ -422,10 +422,7 @@ static int corgi_bl_update_status(struct backlight_device *bd) struct corgi_lcd *lcd = bl_get_data(bd); int intensity = bd->props.brightness; - if (bd->props.power != FB_BLANK_UNBLANK) - intensity = 0; - - if (bd->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bd)) intensity = 0; if (corgibl_flags & CORGIBL_SUSPENDED) diff --git a/drivers/video/backlight/cr_bllcd.c b/drivers/video/backlight/cr_bllcd.c index 4624b7b7c6a6..d5ab7675f55c 100644 --- a/drivers/video/backlight/cr_bllcd.c +++ b/drivers/video/backlight/cr_bllcd.c @@ -59,26 +59,18 @@ struct cr_panel { static int cr_backlight_set_intensity(struct backlight_device *bd) { - int intensity = bd->props.brightness; u32 addr = gpio_bar + CRVML_PANEL_PORT; u32 cur = inl(addr); - if (bd->props.power == FB_BLANK_UNBLANK) - intensity = FB_BLANK_UNBLANK; - if (bd->props.fb_blank == FB_BLANK_UNBLANK) - intensity = FB_BLANK_UNBLANK; - if (bd->props.power == FB_BLANK_POWERDOWN) - intensity = FB_BLANK_POWERDOWN; - if (bd->props.fb_blank == FB_BLANK_POWERDOWN) - intensity = FB_BLANK_POWERDOWN; - - if (intensity == FB_BLANK_UNBLANK) { /* FULL ON */ - cur &= ~CRVML_BACKLIGHT_OFF; - outl(cur, addr); - } else if (intensity == FB_BLANK_POWERDOWN) { /* OFF */ + if (backlight_is_blank(bd)) { + /* OFF */ cur |= CRVML_BACKLIGHT_OFF; outl(cur, addr); - } /* anything else, don't bother */ + } else { + /* FULL ON */ + cur &= ~CRVML_BACKLIGHT_OFF; + outl(cur, addr); + } return 0; } diff --git a/drivers/video/backlight/da903x_bl.c b/drivers/video/backlight/da903x_bl.c index 62540e4bdedb..ca351badfdcf 100644 --- a/drivers/video/backlight/da903x_bl.c +++ b/drivers/video/backlight/da903x_bl.c @@ -79,13 +79,7 @@ static int da903x_backlight_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.state & BL_CORE_SUSPENDED) + if (backlight_is_blank(bl)) brightness = 0; return da903x_backlight_set(bl, brightness); diff --git a/drivers/video/backlight/ep93xx_bl.c b/drivers/video/backlight/ep93xx_bl.c index 4149e0b2f83c..491185df1411 100644 --- a/drivers/video/backlight/ep93xx_bl.c +++ b/drivers/video/backlight/ep93xx_bl.c @@ -38,8 +38,7 @@ static int ep93xxbl_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bl)) brightness = 0; return ep93xxbl_set(bl, brightness); diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 75409ddfba3e..94b65e4d2aa0 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -25,9 +25,7 @@ static int gpio_backlight_get_next_brightness(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) + if (backlight_is_blank(bl)) brightness = 0; return brightness; diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c index 8ea42b8d9bc8..01d805ca8415 100644 --- a/drivers/video/backlight/hp680_bl.c +++ b/drivers/video/backlight/hp680_bl.c @@ -35,9 +35,7 @@ static void hp680bl_send_intensity(struct backlight_device *bd) u16 v; int intensity = bd->props.brightness; - if (bd->props.power != FB_BLANK_UNBLANK) - intensity = 0; - if (bd->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bd)) intensity = 0; if (hp680bl_suspended) intensity = 0; diff --git a/drivers/video/backlight/jornada720_bl.c b/drivers/video/backlight/jornada720_bl.c index f0385f9cf9da..996f7ba3b373 100644 --- a/drivers/video/backlight/jornada720_bl.c +++ b/drivers/video/backlight/jornada720_bl.c @@ -54,7 +54,7 @@ static int jornada_bl_update_status(struct backlight_device *bd) jornada_ssp_start(); /* If backlight is off then really turn it off */ - if ((bd->props.power != FB_BLANK_UNBLANK) || (bd->props.fb_blank != FB_BLANK_UNBLANK)) { + if (backlight_is_blank(bd)) { ret = jornada_ssp_byte(BRIGHTNESSOFF); if (ret != TXDUMMY) { dev_info(&bd->dev, "brightness off timeout\n"); diff --git a/drivers/video/backlight/kb3886_bl.c b/drivers/video/backlight/kb3886_bl.c index 1dfe13c18925..a0fd5d3d82f5 100644 --- a/drivers/video/backlight/kb3886_bl.c +++ b/drivers/video/backlight/kb3886_bl.c @@ -89,9 +89,7 @@ static int kb3886bl_send_intensity(struct backlight_device *bd) { int intensity = bd->props.brightness; - if (bd->props.power != FB_BLANK_UNBLANK) - intensity = 0; - if (bd->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bd)) intensity = 0; if (kb3886bl_flags & KB3886BL_SUSPENDED) intensity = 0; diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c index 3f66549997c8..c655ddd99cfb 100644 --- a/drivers/video/backlight/led_bl.c +++ b/drivers/video/backlight/led_bl.c @@ -56,9 +56,7 @@ static int led_bl_update_status(struct backlight_device *bl) struct led_bl_data *priv = bl_get_data(bl); int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & BL_CORE_FBBLANK) + if (backlight_is_blank(bl)) brightness = 0; if (brightness > 0) diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c index ee09d1bd02b9..476146b62c4e 100644 --- a/drivers/video/backlight/lm3533_bl.c +++ b/drivers/video/backlight/lm3533_bl.c @@ -41,9 +41,7 @@ static int lm3533_bl_update_status(struct backlight_device *bd) struct lm3533_bl *bl = bl_get_data(bd); int brightness = bd->props.brightness; - if (bd->props.power != FB_BLANK_UNBLANK) - brightness = 0; - if (bd->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bd)) brightness = 0; return lm3533_ctrlbank_set_brightness(&bl->cb, (u8)brightness); diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c index cdc02e04f89d..8064cad8d683 100644 --- a/drivers/video/backlight/locomolcd.c +++ b/drivers/video/backlight/locomolcd.c @@ -113,9 +113,7 @@ static int locomolcd_set_intensity(struct backlight_device *bd) { int intensity = bd->props.brightness; - if (bd->props.power != FB_BLANK_UNBLANK) - intensity = 0; - if (bd->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bd)) intensity = 0; if (locomolcd_flags & LOCOMOLCD_SUSPENDED) intensity = 0; diff --git a/drivers/video/backlight/lv5207lp.c b/drivers/video/backlight/lv5207lp.c index c6ad73a784e2..ef8aa9803577 100644 --- a/drivers/video/backlight/lv5207lp.c +++ b/drivers/video/backlight/lv5207lp.c @@ -48,9 +48,7 @@ static int lv5207lp_backlight_update_status(struct backlight_device *backlight) struct lv5207lp *lv = bl_get_data(backlight); int brightness = backlight->props.brightness; - if (backlight->props.power != FB_BLANK_UNBLANK || - backlight->props.fb_blank != FB_BLANK_UNBLANK || - backlight->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) + if (backlight_is_blank(backlight)) brightness = 0; if (brightness) { diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index 97cc260ff9d1..b8af2c6407d3 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c @@ -66,13 +66,7 @@ static int max8925_backlight_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.state & BL_CORE_SUSPENDED) + if (backlight_is_blank(bl)) brightness = 0; return max8925_backlight_set(bl, brightness); diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 82b8d7594701..7d0ffcd37f07 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -111,9 +111,7 @@ static int pwm_backlight_update_status(struct backlight_device *bl) int brightness = bl->props.brightness; struct pwm_state state; - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & BL_CORE_FBBLANK) + if (backlight_is_blank(bl)) brightness = 0; if (pb->notify) diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c index 3d276b30a78c..9600f5d58ece 100644 --- a/drivers/video/backlight/qcom-wled.c +++ b/drivers/video/backlight/qcom-wled.c @@ -261,9 +261,7 @@ static int wled_update_status(struct backlight_device *bl) u16 brightness = bl->props.brightness; int rc = 0; - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & BL_CORE_FBBLANK) + if (backlight_is_blank(bl)) brightness = 0; mutex_lock(&wled->lock); diff --git a/drivers/video/backlight/tps65217_bl.c b/drivers/video/backlight/tps65217_bl.c index 762e3feed097..1041e5e62ee3 100644 --- a/drivers/video/backlight/tps65217_bl.c +++ b/drivers/video/backlight/tps65217_bl.c @@ -82,9 +82,7 @@ static int tps65217_bl_update_status(struct backlight_device *bl) if (bl->props.state & BL_CORE_SUSPENDED) brightness = 0; - if ((bl->props.power != FB_BLANK_UNBLANK) || - (bl->props.fb_blank != FB_BLANK_UNBLANK)) - /* framebuffer in low power mode or blanking active */ + if (backlight_is_blank(bl)) brightness = 0; if (brightness > 0) { diff --git a/drivers/video/backlight/wm831x_bl.c b/drivers/video/backlight/wm831x_bl.c index e55977d54c15..dc2ab6c8b7f9 100644 --- a/drivers/video/backlight/wm831x_bl.c +++ b/drivers/video/backlight/wm831x_bl.c @@ -93,13 +93,7 @@ static int wm831x_backlight_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.state & BL_CORE_SUSPENDED) + if (backlight_is_blank(bl)) brightness = 0; return wm831x_backlight_set(bl, brightness);