Received: by 10.223.176.46 with SMTP id f43csp967895wra; Wed, 24 Jan 2018 08:35:04 -0800 (PST) X-Google-Smtp-Source: AH8x2241OcreOio+tIZQfNdSgzkkAuy9Zrdog7LxHbcjVORidbjlfdWri6zrdzN45ckyDkWqvv43 X-Received: by 10.99.176.15 with SMTP id h15mr11443425pgf.374.1516811704540; Wed, 24 Jan 2018 08:35:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516811704; cv=none; d=google.com; s=arc-20160816; b=Nv6j+iYmzV3fE19f6bCpaZoZ7qbi8zXkkU7m3nQLdlOJCufLmLjl21RITzdn4uEE0U mqKeOX0xynniBs2+zPP0s04EP9hY5XYMF/T4bmmXZGswNkQs58vVA4doebcHpi6TdkoY 4DCl3M3/fedD2IiE3IbmVlbr6/yohZ0wMZLYN7TC1IRb73/mZ/1mtztxYBQf5W5ilFOo n0DLtaxcXrhWVu3FQaDRulfmdXlNEm+ffQ4tS/vWr83akzU6/QwL5BxHJwa6OBlPRkUG MGKk8QVV50P0Gi4Iz98jJ2s2LxbgXh67dU7fJY7BPSQSqYEvvXN17L4Amhxhcp5x5y+S 4TbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:dkim-signature :arc-authentication-results; bh=pdNsliHJNILoQAHRBxBbdaXubLQEUCwN1/AMqcAN7No=; b=zaiK2bKt49UjX/KmLAAjNpG4xZxdm5I4yXmtaX3bJKMx5Y2IlzuMOq5jz95ZJmf1oj z6d7z6k+I4At88VQgw9HGteIJWlVNSMXsI4cGHVUFIDCJhp9R2WaDR6USsH9ppZBaKx5 xtv4WkPPvocRvmsyN+1WNTw0a1scNsWnQgyAaEbXhjB/vgnTu/gPh84sit+yd/l7rrv9 YXhjSeXKC03csFiinsutKWexWIGv5hDFb9w87jggSC8HTdxfYo1C65oa8ewsJT8LXafV aopj5PFxip/L90vMAinlkgNdsGuyVqb3A4WindFscvUGDuBTCqXd+22PHEN67Tio6u+Z w7Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WB1BmcJR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e18si3087732pfi.130.2018.01.24.08.34.50; Wed, 24 Jan 2018 08:35:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WB1BmcJR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964827AbeAXQeP (ORCPT + 99 others); Wed, 24 Jan 2018 11:34:15 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:46381 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934224AbeAXQeO (ORCPT ); Wed, 24 Jan 2018 11:34:14 -0500 Received: by mail-pf0-f193.google.com with SMTP id y5so3464645pff.13 for ; Wed, 24 Jan 2018 08:34:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=pdNsliHJNILoQAHRBxBbdaXubLQEUCwN1/AMqcAN7No=; b=WB1BmcJRCHPs5Fqc2GIk/EjDnJRnUnnstS3nYadpGrpuGi22HnaM2xURRXj3cFpoxL 9ipKGbJgPOE8HLAMT38i32r0ryYH73thXNnaTGwQe05O2pE81+jpaZZm50LbOcYUfIOX Zaaq/ME1s7g3mzn7Wa/bZoKQHc2fdQHli7uuT/k6bHWJETNZqNFy/LXfvT9S1M40oxGs vjHu9QuNY1BcCDW+v5WBNmAGauMj3N9amBo/w2VDCdNbDowduZB0yX6si+UVpdIeYteZ 5PJDUZy3GK1zDbF4NyKifBQjLGeMTVeiVGsx+I0gZtDbf33/SIG8Wh64TWJ6XQCTCEMM O2eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=pdNsliHJNILoQAHRBxBbdaXubLQEUCwN1/AMqcAN7No=; b=j+YbEVWDPkNPmNucMtcxAL9SytM6e1YZ0q1nFx9odoDFWiyqqiwjcrFbIM0g43CnGG rGFoVBX/ZR8hF1zjA5H69Ov/oonHMgO9UqzczvX0A2Z713sAt+yOqYC/7m0nBSqoo8z3 2RHbnUUV3zrMqDvqCyGk4cSEzOsZNL8DNrGV4TVZJd15UaN2CB9k/T+iIPBdTC0/HcjG bXVlqt2vMAil/P00CNDRaCVnc3nXrV7Z1B2yrCapYA4FLE1alcbfPpSGXa5K5AVz2dY9 ZY/y8VQALf/EJlILjH4/fZ9SUcXCuNFcsZReFIwvRyVcz5x4aU7UJo/CT+QIe5R+0Bk+ +3OA== X-Gm-Message-State: AKwxytdjES/r4O9Fl6vF6s4Td13l4uaWsvCnRh8mZLlInxWfpzbf31Wq RK+bJwEcumMitNeenj/TObY= X-Received: by 10.101.88.130 with SMTP id d2mr11040114pgu.278.1516811653675; Wed, 24 Jan 2018 08:34:13 -0800 (PST) Received: from raspberrypi ([122.172.61.122]) by smtp.gmail.com with ESMTPSA id p68sm10116888pfp.30.2018.01.24.08.34.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Jan 2018 08:34:12 -0800 (PST) Date: Wed, 24 Jan 2018 16:34:07 +0000 From: Meghana Madhyastha To: Lee Jones , Daniel Thompson , Jingoo Han , Thierry Reding , Noralf =?iso-8859-1?Q?Tr=F8nnes?= , Tomi Valkeinen , Daniel Vetter , Sean Paul , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v19 01/10] video: backlight: Add helpers to enable and disable backlight Message-ID: <39b5bf0a02008a8072d910bdf8231c431e9ef504.1516810725.git.meghana.madhyastha@gmail.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add helper functions backlight_enable and backlight_disable to enable/disable a backlight device. These helper functions can then be used by different drm and tinydrm drivers to avoid repetition of code and also to enforce a uniform and consistent way to enable/disable a backlight device. Acked-by: Daniel Thompson Reviewed-by: Noralf Tr?nnes Reviewed-by: Sean Paul Signed-off-by: Meghana Madhyastha --- include/linux/backlight.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index af7003548..ace825e2c 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -130,6 +130,38 @@ static inline int backlight_update_status(struct backlight_device *bd) return ret; } +/** + * backlight_enable - Enable backlight + * @bd: the backlight device to enable + */ +static inline int backlight_enable(struct backlight_device *bd) +{ + if (!bd) + return 0; + + bd->props.power = FB_BLANK_UNBLANK; + bd->props.fb_blank = FB_BLANK_UNBLANK; + bd->props.state &= ~BL_CORE_FBBLANK; + + return backlight_update_status(bd); +} + +/** + * backlight_disable - Disable backlight + * @bd: the backlight device to disable + */ +static inline int backlight_disable(struct backlight_device *bd) +{ + if (!bd) + return 0; + + bd->props.power = FB_BLANK_POWERDOWN; + bd->props.fb_blank = FB_BLANK_POWERDOWN; + bd->props.state |= BL_CORE_FBBLANK; + + return backlight_update_status(bd); +} + 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); -- 2.11.0