Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp737094pxb; Tue, 14 Sep 2021 07:42:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJxDCyb6ylqx4j3BE/LQqETMRevODa3kNUtLG0LFKlaySNoyjy2JJu2Mx8sUsDr5Rtdn05 X-Received: by 2002:a17:906:7f01:: with SMTP id d1mr19485714ejr.318.1631630565656; Tue, 14 Sep 2021 07:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631630565; cv=none; d=google.com; s=arc-20160816; b=D4IvnX4cJEO8YmUcefNBg36YJ/TuFRFNeQ4PMp+eM35AEoLiSemLTj6W5THgovqHhG r0boH4pJ7QxZxKXDNgEhqOW1YoU5LRxaBjuSoP9tgZnO1dbKveEkmJ/NkhVsUpBerJrV mfKUaYzKFbiXzshMjFqkFUTDPR0ZvjYWr0NYkBhLs0Zr0JprjZz11Pgh4ysZFZH04W/6 qkZV/j2XHJl7KpjvVQg+I0kLBiuNX+vXto6MGOVoY5APhhu1ltFq0fX5plPec+LhPODR XBKpixBq9+lAvItzEZInIMK6pVT2vvC9HoJ1hAFE55eJuq8U9P3Q5zBz63SA+UMnkNUt +6zw== 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=SefmWFJqMPXOgbmzx4G4AbQhT9F7Aj6aUn/8cFjEUQQ=; b=H0t3e9g6gtrfjQAzgaq0gaV82kAYuKe/ZbKTVa9pil16zq7QtgrMsaoRH1hRTk3AFh F+FABbsH1p2MLfiOP3/uUVWW3/12Y/JgGR1+c405VsWiBtvs8K8+G2Lamno5EnePcE1l zCoaWH0V16xkRgQYm/4sUBYdnSam8fmO/KSFN9U5U+uKu56Q0wH2PMk+IkwRMV9zZ+Xi HnEOxTFsZ2KF0k5RmrScOB5F1dNWbWjXXPF7A4LsqRqoflxZjeIxtsLM2Nf+cMzeIdly Spf2VgWPOBKlJfDA+AdMh4qdgxkNO474pmJW/UNAM2y0g95ZUzGO1WAvKVI4+lIwxAlK eIGw== 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 v4si8199484edi.396.2021.09.14.07.42.15; Tue, 14 Sep 2021 07:42:45 -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 S234554AbhINOkY (ORCPT + 99 others); Tue, 14 Sep 2021 10:40:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234084AbhINOkE (ORCPT ); Tue, 14 Sep 2021 10:40:04 -0400 Received: from xavier.telenet-ops.be (xavier.telenet-ops.be [IPv6:2a02:1800:120:4::f00:14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 505E3C06178A for ; Tue, 14 Sep 2021 07:38:44 -0700 (PDT) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed20:d46f:7eb5:4a37:9d14]) by xavier.telenet-ops.be with bizsmtp id tqef2500Y2aSKa101qef6K; Tue, 14 Sep 2021 16:38:42 +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 1mQ9a3-004VGu-BQ; Tue, 14 Sep 2021 16:38:39 +0200 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1mQ9a2-0028yp-NW; Tue, 14 Sep 2021 16:38:38 +0200 From: Geert Uytterhoeven To: Robin van der Gracht , Miguel Ojeda , Rob Herring , Paul Burton Cc: Greg Kroah-Hartman , Pavel Machek , Marek Behun , devicetree@vger.kernel.org, linux-leds@vger.kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v6 09/19] auxdisplay: ht16k33: Connect backlight to fbdev Date: Tue, 14 Sep 2021 16:38:25 +0200 Message-Id: <20210914143835.511051-10-geert@linux-m68k.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210914143835.511051-1-geert@linux-m68k.org> References: <20210914143835.511051-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 --- v6: - No changes, v5: - No changes, v4: - No changes, v3: - No changes, 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