Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1119010pxv; Fri, 25 Jun 2021 06:01:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwlo2zDUVCi0x3dZwm0yrSIRWJpn0zGpTW7u6eBkK8SZeRDBR6bQ4QTgqL2wTl2p/N/pg5 X-Received: by 2002:a05:6402:402:: with SMTP id q2mr14214459edv.239.1624626072352; Fri, 25 Jun 2021 06:01:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624626072; cv=none; d=google.com; s=arc-20160816; b=rYkEqRt6LidTt/RVKvrjR5uhvPjBBKSkMB9o9RjgClUd7XCrH5ajP7ay2qPDnyaEzk uX2pm3IwcqS0lOpluQ5LeBgFWYnXaiCcgvkv4ySVyZUITN0gEQsi0Yj4Dgc2HwDlI4f6 gFyCkUyHzN85yonlz0mXoO5LGWFXXybI/Yfh09Ys8D8ku6dCKOaS/KySpqZGWVaYlpmb 6rlXJ3U4w9ZyS2z0xHj2V/kt9eQc/D9oJZBKTTboNeTckVCP5SVRCc2V11x1U2iu6FNJ HTqAwA1ZKpJoHd3NLuZV55DViNXVjv/Mw5KalPFBXpwv51+8ZjIA3YZ9kkAUYj8vaKym b1Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=h2NPcDaLuT7CbUzIlQQndthMAj6UhfdB1w6vxqXVN58=; b=vyoJOYBQ1+tyhfWVEWHppqR8JJB8h1R4vgqo24mqyERUrKDAr8m+q5PKSU58VvaIsa 8KQwyO3eZsUspn7TgB+5qgd9XfwnO76RLrYNb5kANPkOIzOFqQGdQMWvZM4PR5cembQm eZuJM094WEUKiODaZbiIWhi9IIK+126alUqr0r0AveS3PhwddEfp0YEK0zr6cRtGNbdx X8gRwtRW0clwYMmTkAGcDCPNZMj8bY2SSdifp2XftL/hF7Nwrn6b/XdT3GdRbDvLfF+j AdZ358HwO8obTTXNiUC6WSHfBOgCcJbdzWZpU1gVUXQpgdRtbCHIWnXhObUDr55LNHeo Wjfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id da11si6305508edb.222.2021.06.25.06.00.47; Fri, 25 Jun 2021 06:01:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231634AbhFYNCB (ORCPT + 99 others); Fri, 25 Jun 2021 09:02:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231563AbhFYNBj (ORCPT ); Fri, 25 Jun 2021 09:01:39 -0400 Received: from michel.telenet-ops.be (michel.telenet-ops.be [IPv6:2a02:1800:110:4::f00:18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00EBBC061151 for ; Fri, 25 Jun 2021 05:59:17 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed20:1476:ce84:e216:add8]) by michel.telenet-ops.be with bizsmtp id MQzD2500C2B1U9906QzDHu; Fri, 25 Jun 2021 14:59:14 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1lwlQO-003TML-P3; Fri, 25 Jun 2021 14:59:12 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1lwlQN-004sQv-Lh; Fri, 25 Jun 2021 14:59:11 +0200 From: Geert Uytterhoeven To: Robin van der Gracht , Rob Herring , Miguel Ojeda , Paul Burton , Greg Kroah-Hartman , Pavel Machek Cc: devicetree@vger.kernel.org, linux-leds@vger.kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2 09/18] auxdisplay: ht16k33: Connect backlight to fbdev Date: Fri, 25 Jun 2021 14:58:53 +0200 Message-Id: <20210625125902.1162428-10-geert@linux-m68k.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210625125902.1162428-1-geert@linux-m68k.org> References: <20210625125902.1162428-1-geert@linux-m68k.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently /sys/class/graphics/fb0/bl_curve is not accessible (-ENODEV), as the driver does not connect the backlight to the frame buffer device. Fix this moving backlight initialization up, and filling in fb_info.bl_dev. Fixes: 8992da44c6805d53 ("auxdisplay: ht16k33: Driver for LED controller") Signed-off-by: Geert Uytterhoeven --- v2: - New. --- drivers/auxdisplay/ht16k33.c | 56 ++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c index 1e69cc6d21a0dca2..2b630e194570f6e5 100644 --- a/drivers/auxdisplay/ht16k33.c +++ b/drivers/auxdisplay/ht16k33.c @@ -413,6 +413,33 @@ static int ht16k33_probe(struct i2c_client *client, if (err) return err; + /* Backlight */ + memset(&bl_props, 0, sizeof(struct backlight_properties)); + bl_props.type = BACKLIGHT_RAW; + bl_props.max_brightness = MAX_BRIGHTNESS; + + bl = devm_backlight_device_register(&client->dev, DRIVER_NAME"-bl", + &client->dev, priv, + &ht16k33_bl_ops, &bl_props); + if (IS_ERR(bl)) { + dev_err(&client->dev, "failed to register backlight\n"); + return PTR_ERR(bl); + } + + err = of_property_read_u32(node, "default-brightness-level", + &dft_brightness); + if (err) { + dft_brightness = MAX_BRIGHTNESS; + } else if (dft_brightness > MAX_BRIGHTNESS) { + dev_warn(&client->dev, + "invalid default brightness level: %u, using %u\n", + dft_brightness, MAX_BRIGHTNESS); + dft_brightness = MAX_BRIGHTNESS; + } + + bl->props.brightness = dft_brightness; + ht16k33_bl_update_status(bl); + /* Framebuffer (2 bytes per column) */ BUILD_BUG_ON(PAGE_SIZE < HT16K33_FB_SIZE); fbdev->buffer = (unsigned char *) get_zeroed_page(GFP_KERNEL); @@ -445,6 +472,7 @@ static int ht16k33_probe(struct i2c_client *client, fbdev->info->screen_size = HT16K33_FB_SIZE; fbdev->info->fix = ht16k33_fb_fix; fbdev->info->var = ht16k33_fb_var; + fbdev->info->bl_dev = bl; fbdev->info->pseudo_palette = NULL; fbdev->info->flags = FBINFO_FLAG_DEFAULT; fbdev->info->par = priv; @@ -460,34 +488,6 @@ static int ht16k33_probe(struct i2c_client *client, goto err_fbdev_unregister; } - /* Backlight */ - memset(&bl_props, 0, sizeof(struct backlight_properties)); - bl_props.type = BACKLIGHT_RAW; - bl_props.max_brightness = MAX_BRIGHTNESS; - - bl = devm_backlight_device_register(&client->dev, DRIVER_NAME"-bl", - &client->dev, priv, - &ht16k33_bl_ops, &bl_props); - if (IS_ERR(bl)) { - dev_err(&client->dev, "failed to register backlight\n"); - err = PTR_ERR(bl); - goto err_fbdev_unregister; - } - - err = of_property_read_u32(node, "default-brightness-level", - &dft_brightness); - if (err) { - dft_brightness = MAX_BRIGHTNESS; - } else if (dft_brightness > MAX_BRIGHTNESS) { - dev_warn(&client->dev, - "invalid default brightness level: %u, using %u\n", - dft_brightness, MAX_BRIGHTNESS); - dft_brightness = MAX_BRIGHTNESS; - } - - bl->props.brightness = dft_brightness; - ht16k33_bl_update_status(bl); - ht16k33_fb_queue(priv); return 0; -- 2.25.1