Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3382986pxf; Mon, 29 Mar 2021 00:11:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGcVU3Sy4+wkggorvSbTIcpro3m7fnKH+/Sd6A2rOkYlET+Q0kxAcJHDw0kNk3suNlqnRn X-Received: by 2002:a05:6402:4395:: with SMTP id o21mr26667880edc.22.1617001878413; Mon, 29 Mar 2021 00:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617001878; cv=none; d=google.com; s=arc-20160816; b=LlhrZT3A40HNpZwet8BCa9XehCtA0U4g3x4Xo60eywF2kuz7GbSnl8NHdqXSKdISaB haIorDvPCfCDZ+1OoMdAJufA3CrOGOauIoCiru7DUSShftHS66sySNfP4I/ZeSfHOfiw tbAU5+zfokfRCA3WbBpeiL4v9ieDxx0GorE/UBWQz82sWskON/VjTk6g2kPpO3MKpKY4 qyJaTkSelVpjCicFDi7lQZRCGDFkjaytA3yGm6O5ow5fQIu4IMkTmAGvhlQQp6otquSp LBTfmazYjyqQvbzhHPSOtZXO3sG0wvspmlRfXFApBiTHxJRxKP82AS/0f2dM7UrC+xgd uQsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :message-id:user-agent:references:in-reply-to:reply-to:subject:cc:to :from:date:mime-version; bh=iLXY6Uljwn/2Y9w5aZfK7SROnIdO4CstFLeU/rfkisY=; b=L4ORXawPCHTdfrfoqT+pRHOThASTqhkNoaf0A0Y0bia8jOZSXHmQ90v6MAmjr9E/Fy W8hxY3CPT9a40LxxQ1zidtszsuv/FqPOC6oLhNEhzNHX8ssHKwdB7CN/V0DMZWe6nexq 20HwqZHVF6d8KtZadb3wJPXvtcB6l3W55fqHnDja5BAZVqm4tbtXnJLfKwQf2MSYQ+ik /OtnT8E89txtKZAYId1CH1EFTYqu9AisLoituwWz8mw6en6vrX4geI4lWe+3DGeld3Up FdOMS1OdqNXKjv9Z2evrOrHDFDgZQ7puGQ3J9laNgR4jTt3cpUiA87hHklaFinRGR5wW gkrQ== 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 y15si13306445edv.49.2021.03.29.00.10.56; Mon, 29 Mar 2021 00:11:18 -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 S230421AbhC2HJK (ORCPT + 99 others); Mon, 29 Mar 2021 03:09:10 -0400 Received: from protonic.xs4all.nl ([83.163.252.89]:46480 "EHLO protonic.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbhC2HJG (ORCPT ); Mon, 29 Mar 2021 03:09:06 -0400 Received: from fiber.protonic.nl (edge2.prtnl [192.168.1.170]) by sparta.prtnl (Postfix) with ESMTP id 5B25444A022C; Mon, 29 Mar 2021 09:08:59 +0200 (CEST) MIME-Version: 1.0 Date: Mon, 29 Mar 2021 09:08:59 +0200 From: Robin van der Gracht To: Geert Uytterhoeven Cc: Rob Herring , Miguel Ojeda , Paul Burton , Greg Kroah-Hartman , devicetree@vger.kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 16/17] auxdisplay: ht16k33: Add support for segment displays Reply-To: robin@protonic.nl In-Reply-To: <20210322144848.1065067-17-geert@linux-m68k.org> References: <20210322144848.1065067-1-geert@linux-m68k.org> <20210322144848.1065067-17-geert@linux-m68k.org> User-Agent: Roundcube Webmail/1.4.8 Message-ID: <2868cd091dc6ff0cab14b5da07f89984@protonic.nl> X-Sender: robin@protonic.nl Organization: Protonic Holland Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Geert, On 2021-03-22 15:48, Geert Uytterhoeven wrote: > The Holtek HT16K33 LED controller is not only used for driving > dot-matrix displays, but also for driving segment displays. > > Add support for 4-digit 7-segment and quad 14-segment alphanumeric > displays, like the Adafruit 7-segment and 14-segment display backpack > and FeatherWing expansion boards. Use the character line display core > support to display a message, which will be scrolled if it doesn't fit. > > Signed-off-by: Geert Uytterhoeven > --- > The 7-segment support is based on schematics, and untested on actual > hardware. > --- > drivers/auxdisplay/ht16k33.c | 198 +++++++++++++++++++++++++++++++++-- > 1 file changed, 191 insertions(+), 7 deletions(-) > ... > > +static int ht16k33_seg_probe(struct i2c_client *client, > + struct ht16k33_priv *priv, uint32_t brightness) > +{ > + struct ht16k33_seg *seg = &priv->seg; > + struct device *dev = &client->dev; > + int err; > + > + err = ht16k33_brightness_set(priv, MAX_BRIGHTNESS); > + if (err) > + return err; > + > + switch (priv->type) { > + case DISP_MATRIX: > + /* not handled here */ > + break; This 'case' shouldn't happen. Having said that, the break here will still cause the linedisp_register() function to be called for the DISP_MATRIX type. If you'd like to handle this case, a return (or setting 'err') should prevent this. > + > + case DISP_QUAD_7SEG: > + INIT_DELAYED_WORK(&priv->work, ht16k33_seg7_update); > + seg->map.seg7 = initial_map_seg7; > + seg->map_size = sizeof(seg->map.seg7); > + err = device_create_file(dev, &dev_attr_map_seg7); > + break; > + > + case DISP_QUAD_14SEG: > + INIT_DELAYED_WORK(&priv->work, ht16k33_seg14_update); > + seg->map.seg14 = initial_map_seg14; > + seg->map_size = sizeof(seg->map.seg14); > + err = device_create_file(dev, &dev_attr_map_seg14); > + break; > + } > + if (err) > + return err; > + > + err = linedisp_register(&seg->linedisp, dev, 4, seg->curr, > + ht16k33_linedisp_update); > + if (err) > + goto err_remove_map_file; > + > + return 0; Groetjes/Kind regards, Robin van der Gracht