Received: by 10.223.185.116 with SMTP id b49csp6571279wrg; Thu, 8 Mar 2018 09:33:03 -0800 (PST) X-Google-Smtp-Source: AG47ELsbUbt01qNyS/5yumXmErk7rqCKBG6L+a4QaIGVpM5iegLFq9qUsHz3WqqILxYs8uSD27OH X-Received: by 10.99.119.72 with SMTP id s69mr21627116pgc.224.1520530383777; Thu, 08 Mar 2018 09:33:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520530383; cv=none; d=google.com; s=arc-20160816; b=CKja8QzuRbVheSmScSOzmDAuiKhYL5jtr6vl6l9VTg15A9WLETN0s0vbT9/90sNmRI qa4d7Y0dq0vYUdWrIyw80XAHtA3mRoLFOhnyxHvRgihyyrDfLoPTXDHFYbtsLOsauLqq 9KBdIkjtlny206ebnXvg5X8XH7z4gGgEVDhfl4CR427n+fhW8Y7cQlRL7rKXmN1a24xQ lzVXtufzgKcYA2P538JFCRCwASs4+ke3DSYyVb8khnU4epxLYJNJ5JY2jn5SJ5JcVgIA aOzGYLO2wUjXqA2vojqsqU1oJNwZlPIgc0MctDOlHne7oya/BLOZJjjClzctziGM+YQT D8lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=ozHopj1T/0rwPlD2MtFXY/XPtEUCqGfbgS61An9GDk0=; b=0ZmJr+Uy6l8pE7F5U8rFmsZ69DooUC11tCJe60MSOYDF3GRal5EIRkyKWmqg+MXmoa M9dOXvX12sOMcdzcbqWQPl3ERYQhM7Ro6hCxfkSZqwFPmTxpJdbFfP8uqMqgWRhGoDTV cQUfvEMgngXleNMZTOQFUzWiWnVZaQrFLTWOXMmT6A79sOX69jzXx297QT4UkBtasukb 9J+BwwKQwtySL04oYSAwWmKHOPdr19HEdDapJqnW5gzPl4BHq4IfgfjhYvcOlpgc8flf +mUOtpJi0dAFuMDD/USxkQqvtKayzA8Y/RHNR+OIAzZDfIRJ8o94v6tROciivDkonRxH mwsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=f6Y3JYZY; 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=QUARANTINE 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 32-v6si15253033pls.319.2018.03.08.09.32.35; Thu, 08 Mar 2018 09:33:03 -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=f6Y3JYZY; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936011AbeCHRaB (ORCPT + 99 others); Thu, 8 Mar 2018 12:30:01 -0500 Received: from mail-qt0-f193.google.com ([209.85.216.193]:40749 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932091AbeCHR37 (ORCPT ); Thu, 8 Mar 2018 12:29:59 -0500 Received: by mail-qt0-f193.google.com with SMTP id y6so7617931qtm.7 for ; Thu, 08 Mar 2018 09:29:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ozHopj1T/0rwPlD2MtFXY/XPtEUCqGfbgS61An9GDk0=; b=f6Y3JYZYBeNYSlEsCQ8sTh36PV4uJVtmTENYo+CO0cr6mEmv0wQG5xw4hKLd0ELj6+ hX5OT9kc3ivsPVH9wqvqWXtIeOpSWvTVvTCE+qHXaBcAb8twOYuLTMmcf5O6OFrXZ8cJ aKMuq7RiSF/HhCWsJDu4QHpJv2U6SrgA80uLIiSFfj2odit1rgJyZrx9doa9MfV88olw TCHr0og36txb2xo3qdhSX/59okCaG9dqssa/yOHjJTUAPi+Ts2WNcW6hYXZ4vxH9Vcla rq7xjFHRIIygzgO2MUTpDG4v2aIVkDxSm8yDvKZg/QH3kd/GtVVDuTOP+PnbUTFbs8u2 qlRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ozHopj1T/0rwPlD2MtFXY/XPtEUCqGfbgS61An9GDk0=; b=WcH1vZtK4X/VWRRW73okYQIF5FWPbLLWHe8Ef9uQ+wQ77A6ziuDreJ5RaTxOyByTbE Qxzgi2mC1aR8j9bGgyxX08ibtmRerDECF8NjdgbUhVUbgDbeJ1yxHY2UC+3/n0Wx2qN/ f42flYwt2d0YR5MOIBNGeXJuKnzN0Npuw0JuYNsq5Pw9Lt9+eKatW90FoVrKOT7eJrQp GGxGbdWB/tTAPGdAYkjcUhdg/lWl0t4hiYp76cNtJqSd1Oc6dYTW49y5YV1J8qiCILcO jE2WOcGz4ryIzYR1AzArejSHtI11DPUO1T4xvjS1MhVnPzR4WPr1ieMfgzjkt1FSuTFp 132Q== X-Gm-Message-State: AElRT7GY2oaJCU1H/7XU2DNk7K97jeoDSvOXgUHK41tYCyWzmhs1cBTp vVBD3qOxR2Qwd/JZtFNI6THuIaYQ9tVjO7jwumPF3A== X-Received: by 10.237.50.66 with SMTP id y60mr42591814qtd.179.1520530198988; Thu, 08 Mar 2018 09:29:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.80.146 with HTTP; Thu, 8 Mar 2018 09:29:58 -0800 (PST) In-Reply-To: References: <20180307024011.25033-1-andrew.smirnov@gmail.com> From: Andrey Smirnov Date: Thu, 8 Mar 2018 09:29:58 -0800 Message-ID: Subject: Re: [PATCH 1/2] backlight: Add RAVE SP backlight driver To: Daniel Thompson Cc: Lee Jones , Jingoo Han , linux-kernel , Chris Healy , Lucas Stach , Aleksander Morgado Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 8, 2018 at 8:58 AM, Daniel Thompson wrote: > On 07/03/18 02:40, Andrey Smirnov wrote: >> >> This driver provides access to RAVE SP backlight control >> functionality. >> >> Cc: Lee Jones >> Cc: Daniel Thompson >> Cc: Jingoo Han >> Cc: linux-kernel@vger.kernel.org >> Cc: Chris Healy >> Cc: Lucas Stach >> Cc: Aleksander Morgado >> Signed-off-by: Andrey Smirnov >> --- >> drivers/video/backlight/Kconfig | 6 +++ >> drivers/video/backlight/Makefile | 1 + >> drivers/video/backlight/rave-sp-backlight.c | 82 >> +++++++++++++++++++++++++++++ >> include/linux/mfd/rave-sp.h | 1 + >> 4 files changed, 90 insertions(+) >> create mode 100644 drivers/video/backlight/rave-sp-backlight.c >> >> diff --git a/drivers/video/backlight/Kconfig >> b/drivers/video/backlight/Kconfig >> index 4e1d2ad50ba1..5d2d0d7e8100 100644 >> --- a/drivers/video/backlight/Kconfig >> +++ b/drivers/video/backlight/Kconfig >> @@ -467,6 +467,12 @@ config BACKLIGHT_ARCXCNN >> If you have an ARCxCnnnn family backlight say Y to enable >> the backlight driver. >> +config BACKLIGHT_RAVE_SP >> + tristate "RAVE SP Backlight driver" >> + depends on RAVE_SP_CORE >> + help >> + Support for backlight control on RAVE SP device. >> + >> endif # BACKLIGHT_CLASS_DEVICE >> endif # BACKLIGHT_LCD_SUPPORT >> diff --git a/drivers/video/backlight/Makefile >> b/drivers/video/backlight/Makefile >> index 5e28f01c8391..19da71d518bf 100644 >> --- a/drivers/video/backlight/Makefile >> +++ b/drivers/video/backlight/Makefile >> @@ -57,3 +57,4 @@ obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o >> obj-$(CONFIG_BACKLIGHT_TPS65217) += tps65217_bl.o >> obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o >> obj-$(CONFIG_BACKLIGHT_ARCXCNN) += arcxcnn_bl.o >> +obj-$(CONFIG_BACKLIGHT_RAVE_SP) += rave-sp-backlight.o >> diff --git a/drivers/video/backlight/rave-sp-backlight.c >> b/drivers/video/backlight/rave-sp-backlight.c >> new file mode 100644 >> index 000000000000..62836ba561db >> --- /dev/null >> +++ b/drivers/video/backlight/rave-sp-backlight.c >> @@ -0,0 +1,82 @@ >> +// SPDX-License-Identifier: GPL-2.0+ >> + >> +/* >> + * LCD Backlight driver for RAVE SP >> + * >> + * Copyright (C) 2018 Zodiac Inflight Innovations >> + * >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#define RAVE_SP_BACKLIGHT_LCD_EN BIT(7) >> + >> +static int rave_sp_backlight_update_status(struct backlight_device *bd) >> +{ >> + const struct backlight_properties *p = &bd->props; >> + const u8 intensity = >> + (p->power == FB_BLANK_UNBLANK) ? p->brightness : 0; >> + struct rave_sp *sp = dev_get_drvdata(&bd->dev); >> + u8 cmd[] = { >> + [0] = RAVE_SP_CMD_SET_BACKLIGHT, >> + [1] = 0, >> + [2] = intensity ? RAVE_SP_BACKLIGHT_LCD_EN | intensity : >> 0, >> + [3] = 0, >> + [4] = 0, >> + }; >> + >> + return rave_sp_exec(sp, cmd, sizeof(cmd), NULL, 0); >> +} >> + >> +static const struct backlight_ops rave_sp_backlight_ops = { >> + .options = BL_CORE_SUSPENDRESUME, >> + .update_status = rave_sp_backlight_update_status, >> +}; >> + >> +static struct backlight_properties rave_sp_backlight_props = { >> + .type = BACKLIGHT_FIRMWARE, > > > I would have thought BACKLIGHT_PLATFORM would be more suitable here. > BACKLIGHT_FIRMWARE is used for things like the ACPI backlight driver. > > Why did you select this one? > Good point and I don't think I have any justification to choose FIRMWARE over PLATFORM, will fix in v2. Thanks, Andrey Smirnov