Received: by 10.213.65.68 with SMTP id h4csp34125imn; Thu, 15 Mar 2018 15:45:05 -0700 (PDT) X-Google-Smtp-Source: AG47ELveeL6G3h/SxTtnVTLNnD7AUq2+1rnHKgN/FJEx4dFJgXZoPgJQf7vbZfcmwcvZ5mowZ0Dr X-Received: by 2002:a17:902:b68c:: with SMTP id c12-v6mr5471085pls.52.1521153905777; Thu, 15 Mar 2018 15:45:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521153905; cv=none; d=google.com; s=arc-20160816; b=ZtgvNfiRiTZspKh8QejjAXqzmWD99CJy643xbaG1KYSs4gFIWDerwIuBI56OK2ZsJr uwmRbWEKJcrtT26GKNSxf1QjFyHN+3uUvRvyzQaiCI26YYylUXZJljWcsH1WdUmcTZPM wrUQqE1oz8l/GvLLINjfN556RoBYptFGiPUQGVlhgD5sXbXH2x+Vziu5jltCrl1gaiM8 REgw8oNidCjMZKPV78rKSCYXERVQukdQ1wO0dhdvIa9Ca2vKHkVOgY+X2A1vJFk8Wh0x cKsAN0k6wPcvY3/ZpprrAVktJ0xKkae08EpOH/rzUh+Dwgtx5qs3ehN8qvMcfM0eBwo4 s/uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=rtobec5VnRKUkdl+knqS0esxBj+GT3+bRc7/GQ7MWoQ=; b=qG+DyUqnnEw+5k2mRir8D5hhcZ6BwWJ20nFFFEgIxzsljCu17kJm89EO5xZEt1DNMA wSarrHxQU+h458yCKTfIvVMeT0To5SB98qcfNEawD2ePdTqPty6oMdoXr9g65VIQnaD4 9YfPKUKGWR80hGI6oHMNvEGrRbf1/bJhwzI7MxZhqcgMnfDGFNdeEvM0KbWh7OxSb4Bg 284Fj+GVepDcDD30ATxIVVJifMwDSw1UkzWlR+SC4eQ1KJzot1mDZqCoznjeu5o3rwwL 4wiTftC6dTh+aa0P5QxvLnvdRwmuknuOqdu7U3uLgFckbRTgsetXyWKYBDA/zVNMoYR6 YakQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LTzZ388u; 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 x2-v6si4847403plo.479.2018.03.15.15.44.48; Thu, 15 Mar 2018 15:45:05 -0700 (PDT) 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=LTzZ388u; 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 S932890AbeCOWnE (ORCPT + 99 others); Thu, 15 Mar 2018 18:43:04 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:45144 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932666AbeCOWmJ (ORCPT ); Thu, 15 Mar 2018 18:42:09 -0400 Received: by mail-pl0-f66.google.com with SMTP id v9-v6so4688509plp.12; Thu, 15 Mar 2018 15:42:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rtobec5VnRKUkdl+knqS0esxBj+GT3+bRc7/GQ7MWoQ=; b=LTzZ388uzxjHN6bi78gO5qdXjpZAtNvmT0SVEYIpehgCPQiKk/OOLUN+sJgXe7dGeb IXAtLZILWPIhsoVfoldk3+cnkpmRi6ysRyXEI9sizfqyMn/uNNb6OueHUEj9RJVg8t4F mNIvmw6sigmfzw9Xf0QeQOF0MjY4erfI22iN30u2RDG6Y+e6Z57/2mOyXTowCd+eWuYM M+HwZUMw8ozqOK5GwQ0cZM9/FOmjjjJiUijGxEYw5YS0QOs40/35GtCSo5Qqbj9DFTB/ yysv+CLL4eEbUZnrKa+16U/tCoQOedfjS/ndp/d0zB8/UZWBieOp3CiqyMvFEAIGJqRu 53lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rtobec5VnRKUkdl+knqS0esxBj+GT3+bRc7/GQ7MWoQ=; b=qb82Ja1Bs9ZejqIkCvIce3Hrc1cbGflEdG6LBF/UrTBYyLUNHqj2yrlqqh1+DGV/CS X2fE898/H2JOIbMdjrY5jsS3m8R3Agj5P1f49+ddIjliyNl4ZLKnzd1W2YH907R8BLNO FROQPGq8z3LhP699Kp2uGr2y+G0cM9tMtqn1nlsdvmU4Ehf16HwKxGExpg5/TH9IxhFk jDnj1NptrRcX1K3md/jlDn1gMZf/HvqxHU+G5NqeD93cKBMLQOcqTqhhlaUYEZ9MGWI7 leINASoAPkbFhwqiTLhdbKOn8XZ72XFAIYf8IMr77Etngqp1c4knIBi+8JzdiNqvlxZ5 lSGQ== X-Gm-Message-State: AElRT7H8uIxjnxAHs5WFXg/bdDtwr819tuuGqqZsJRQF1cy3feUI519w HwRfhZXJun890tP7/ZyiH8c= X-Received: by 2002:a17:902:8c97:: with SMTP id t23-v6mr10130776plo.372.1521153728194; Thu, 15 Mar 2018 15:42:08 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:0:1000:1511:8de6:27a8:ed13:2ef5]) by smtp.gmail.com with ESMTPSA id c62sm4607888pfk.179.2018.03.15.15.42.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 15:42:07 -0700 (PDT) From: Dmitry Torokhov To: Laurent Pinchart , Lee Jones Cc: Daniel Thompson , Jingoo Han , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org, Yoshinori Sato , Rich Felker , Linus Walleij Subject: [RFC 2/4] sh: ecovec24: conditionally register backlight device Date: Thu, 15 Mar 2018 15:42:00 -0700 Message-Id: <20180315224202.96668-3-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.16.2.804.g6dcf76e118-goog In-Reply-To: <20180315224202.96668-1-dmitry.torokhov@gmail.com> References: <20180315224202.96668-1-dmitry.torokhov@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit fe79f919f47e ("sh: ecovec24: Use gpio-backlight") removed custom backlight support and switched over to generic gpio-backlight driver. The comment when we run with DVI states "no backlight", but setting gpio_backlight_data.fbdev to NULL actually makes gpio-backlight to react to events from any framebuffer device, not ignore them. We want to get rid of platform data in favor of generic device properties in gpio_backlight driver, so we can not have kernel pointers passed around to tie the framebuffer device to backlight. Assuming that the intent of the above referenced commit was to indeed not export backlight when using DVI, let's switch to conditionally registering backlight device so it is not present at all in DVI case. Signed-off-by: Dmitry Torokhov --- arch/sh/boards/mach-ecovec24/setup.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index 6f929abe0b50f..67633d2d42390 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -368,7 +368,6 @@ static struct platform_device lcdc_device = { }; static struct gpio_backlight_platform_data gpio_backlight_data = { - .fbdev = &lcdc_device.dev, .gpio = GPIO_PTR1, .def_value = 1, .name = "backlight", @@ -987,7 +986,6 @@ static struct platform_device *ecovec_devices[] __initdata = { &usb1_common_device, &usbhs_device, &lcdc_device, - &gpio_backlight_device, &ceu0_device, &ceu1_device, &keysc_device, @@ -1077,6 +1075,8 @@ static int __init arch_setup(void) { struct clk *clk; bool cn12_enabled = false; + bool use_backlight = false; + int error; /* register board specific self-refresh code */ sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF | @@ -1193,9 +1193,6 @@ static int __init arch_setup(void) lcdc_info.ch[0].lcd_modes = ecovec_dvi_modes; lcdc_info.ch[0].num_modes = ARRAY_SIZE(ecovec_dvi_modes); - /* No backlight */ - gpio_backlight_data.fbdev = NULL; - gpio_set_value(GPIO_PTA2, 1); gpio_set_value(GPIO_PTU1, 1); } else { @@ -1217,6 +1214,8 @@ static int __init arch_setup(void) /* enable TouchScreen */ i2c_register_board_info(0, &ts_i2c_clients, 1); irq_set_irq_type(IRQ0, IRQ_TYPE_LEVEL_LOW); + + use_backlight = true; } /* enable CEU0 */ @@ -1431,8 +1430,19 @@ static int __init arch_setup(void) gpio_set_value(GPIO_PTG4, 1); #endif - return platform_add_devices(ecovec_devices, - ARRAY_SIZE(ecovec_devices)); + error = platform_add_devices(ecovec_devices, + ARRAY_SIZE(ecovec_devices)); + if (error) + return error; + + if (use_backlight) { + error = platform_device_add(&gpio_backlight_device); + if (error) + pr_warn("%s: failed to register backlight: %d\n", + error); + } + + return 0; } arch_initcall(arch_setup); -- 2.16.2.804.g6dcf76e118-goog