Received: by 10.223.176.46 with SMTP id f43csp2994176wra; Mon, 22 Jan 2018 06:50:45 -0800 (PST) X-Google-Smtp-Source: AH8x226c9IZPH4WMox0FbuSkT7zht2NyU2Clqm1QTjnviYIeNY1R/u175+X/pc1W5pRZ7qcsYj/u X-Received: by 2002:a17:902:2f84:: with SMTP id t4-v6mr1080396plb.81.1516632645028; Mon, 22 Jan 2018 06:50:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516632645; cv=none; d=google.com; s=arc-20160816; b=NyZXr8wYgwajlZxvVSaowXTp91aA8CKA6KRDedqTIqbu7O8QbkAoVxUC6LYLHX3En6 0bSk9VjzZzXEgX3ZuVDx1WOl5HAx710Xiw3nUIGZlSxk0+xuwjoINpeAWW2fSwxr/F4O 3mFdWAsQ/qSnUJzZxkvnBidZ7J+y+p/zWGv6p7+9vV1abaS5RzlGLzoWzpaHE0pmSXgQ TUr0w/dIoMoJUx/CfUdgO6Qm8v9VkOwNhV5xPxKCcOFIiiMnT48pymqvt/a35na/2swQ 3mlIP2M2FJztEce8iSIbJlFmvDm8K65CZl4cyW926cfJrZ38zY0nFDkVs6Pp+67ZXuoJ MPVw== 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=7mdSUZo7lfe/qsZQaQEgMYq0T0FQP//L8IQbxihDABk=; b=awzwTpxg17qFKlo8zUAuO9XMmufkcZ70Jeabl1l1FB9FdDyz5WKl8d6DlwwOQIlKo2 J4QUmDRo+Igjz03w7vhvQ8GBL4LrplJ6vLuqPFKoVJW7ABgrEpcnfJrMPuzJ4TDj8sSZ 18P8dStm6taszL4hBqrukImMhfCCN8mfdYfSEOek/EB6sOQnkrj3Qcd6W+m+SAcqnxTC cag8zMGThdt0ML1K4Fk5HQ8i4o67XeXdfrLtlpTJYf1MfXhVE+7IMGqZbTkjAvj2nGu5 nnpsnAtlOob85KxA0idpZGxkt70Uuy37lFhBgFRWVcqRVdPeViTkSfRBkXZuC+qIKuSR YUww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EUc8SNdZ; 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 l7si13776625pgs.316.2018.01.22.06.50.30; Mon, 22 Jan 2018 06:50:44 -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=EUc8SNdZ; 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 S1751189AbeAVOtg (ORCPT + 99 others); Mon, 22 Jan 2018 09:49:36 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:40329 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750945AbeAVOtf (ORCPT ); Mon, 22 Jan 2018 09:49:35 -0500 Received: by mail-pg0-f66.google.com with SMTP id g16so7254141pgn.7 for ; Mon, 22 Jan 2018 06:49:34 -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=7mdSUZo7lfe/qsZQaQEgMYq0T0FQP//L8IQbxihDABk=; b=EUc8SNdZjBWGDlru6eZb18VPVH9UyGY3Ky3KXK8AIrfKSDYZVVDZSAy/kBSyxoiCoa qcIh7cG0VzP/8gnrI6douNPBs4KIEYE89uQi+W7qvhf49/dhWHZWf6YUfJ5HrgGKzqT0 9WcUXm+6Y8crO24GylpaSf+dSeG2udr4b3wps820xDPS0gpiuRlOIr0eEYwvyqoKMExa FlCqb0I0yme8wpQTG2vKFLTBk4nNYwCN53rzFlzu04wvq1lFTKDMBYdAVfa4++LwaVVR HwQrKQT3wZJW40tAo/mBXZFXf+ozUo9hOMlYOh1L0DnhVR+OSKahTX9fStSdGiLuuBHG Zcug== 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=7mdSUZo7lfe/qsZQaQEgMYq0T0FQP//L8IQbxihDABk=; b=kzkS5T7bQJpdUZHvu3W6EzSoIMJUlvnNhwJ4P+iEkw/ymBOk3jw/IwdMN77cmdS1k6 RUtZbNEAEUIP4Cl2IAaDATyJQCim2OpXw3ji4ryUQI6XEj/RdAF8oLCIBCz74bmuNeXR lgrQO+nP81U1KL70iGsZ2qu9S29j6Q/ZiRWt57hyk96rTf0bO6DXYgkBbhNWCyB+C85j +El09PaeWrdaabp6C8dhCZGixHEaoV1wKpiygDnSNFq1Hk+as5/NaJjy9Kf7EUL4VdQn lEa4qCLSCVmySQTfe4rh8iiAR1geTtvn68r2vZUKwOUtFbqsHygiFouAAjS5st88rX9/ unHw== X-Gm-Message-State: AKwxyteioqN4DD8hd+uGrOizGtvj6QlfMz6QODB+Zd+oCuetMUprEox8 4AVvppbvjka5rZOdbe0NV/E= X-Received: by 10.99.120.66 with SMTP id t63mr7398117pgc.375.1516632574521; Mon, 22 Jan 2018 06:49:34 -0800 (PST) Received: from raspberrypi ([122.171.92.137]) by smtp.gmail.com with ESMTPSA id o25sm30692649pgc.75.2018.01.22.06.49.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jan 2018 06:49:33 -0800 (PST) Date: Mon, 22 Jan 2018 14:49:28 +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 v18 01/10] video: backlight: Add helpers to enable and disable backlight Message-ID: <39b5bf0a02008a8072d910bdf8231c431e9ef504.1516632387.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. Signed-off-by: Meghana Madhyastha --- Acked-by: Daniel Thompson Reviewed-by: Noralf Tr?nnes Reviewed-by: Sean Paul 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