From nobody Fri Oct 3 12:12:07 2025 Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E68A1487E9 for ; Mon, 1 Sep 2025 02:00:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756692038; cv=none; b=CjvJyXY/VPfRYeyZP5YnFA2wIakQdEyrbBQiAOKL4sui7zeEsa+WsSUw7upFmF5J5KzXhbKs1wVpSRzDG5z9wGrpdG87XoHbQ6mbFvEgW3oohKyZ4RfMeUh3QRo2RezWu+1dHu32RC9WlOIx1ZqM6a/5ayEK8Thl++oy+wz4F9I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756692038; c=relaxed/simple; bh=1aWTBAdS4PB+lh6dnTRs/ku6VxyVPsJAiRIyLMSDIL8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pMEyLimzkp0wWggukOZTAlZPyahr2XJTLnqllDNxzB0gQvD8po5RZhbip0dNuJslp8PUJsCqlXBNHE9gT7OkJz2Y+pZO0CtF7aPhB9Oqh5F9gSkshCL0feh+eml+GzgidgK4l1zWt+uIo85VZ4C1qWhk89KnOaDnlANDwrvAdWU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UEvM2nkw; arc=none smtp.client-ip=209.85.160.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UEvM2nkw" Received: by mail-qt1-f179.google.com with SMTP id d75a77b69052e-4b109c58e29so69580431cf.3 for ; Sun, 31 Aug 2025 19:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756692036; x=1757296836; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KD5oP3Sp6/nJlHDS88G+RVK/pDe+DHoDDcESnyvvqMA=; b=UEvM2nkw+KfCcTVSdsTu2pKJ6pmafBAppfr2yXOn8cdG/FxacMopTwddXTosboew3z m1WtDkIw8/VH6wUuKRVSI3R8HK2HS16qg38n4YISKZG35MVhn7d7Px5jOOlL6yoeYh1t xLz0yCzh/XDxLNa+BggYHM/jXIDiSEHpv6jzHgSZpiDZYmpZ5r3V7I9HwFmYII5Ij1iv /nUgooDUN/yJtIA2UgE/36vDuK99H1LArCxE5/NEduTUU9md/XNfziK/nPUB9LeYFcSi dY2hGcrcEesJLdgxrSf7XhTFF6Os40YEO4xtus+iKHKXgbAQ5GfpehJII1HfRQRocNkz PGMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756692036; x=1757296836; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KD5oP3Sp6/nJlHDS88G+RVK/pDe+DHoDDcESnyvvqMA=; b=uE02qVYdOVRdCyD9WQzj7P1o6uwl0BzdCQlOfbZev9mxQ4KkXzJQOdMF7oBlETCZDr d6X6z4g5GI6/n6lTqZujEzB2n+GvFVmtT87ZXkVaZ2q2KH8yHT5b4mjJr0zgI7fj+FZL pR+Ff/y7wp12uBEhHtVXexJh1dW6GV7nlZdqcY9KGEdDBakPFpMLJvtTG7sT8+s0OXze /sJ78TimAAKSwCChn3MKsB6J0J4gNBs8Y6kXNy4gBky1B1TWxHxu8+AAXrwWL9ij1zF7 MyhV1xqgbeaGKSfHrocw38CColGNGlGpOziSBbdJnqRQX66VZ58BbDWmeDNOG99Xs+yf ingg== X-Gm-Message-State: AOJu0YzOMeK5LaHbw5vla0Jo6678Ojs8nZ4hKpR3Ec8lBtmL6Abf9Ktr RgziAcmmTRA+fYrw2WrG4yx6rgiGg3w5btXp5ljorn5PRST3A+j6oZxM X-Gm-Gg: ASbGncs+Za20sxO6ZcFmsWdpLRjDFM1+EGSv1nyHtWmlsaB01wS/vv6L47Hxcr6Gotw YtdcYGfqoMi+QpH4mrB7z24oX/kjOaKXgC4OoDOCJZ8H7rBQ8UjVlFoCBb2FHsaDWmNABhW/Ws1 wjzl5T84QCrG1dLDTpgUzwOp8pf/rmWZ7oJcQbNfHeWB05eHJxcooEe3GVEroM7DSISZMW8H4tQ N3XpDbGxigcA3ksGnJ5XR7o4TF/xWS0WnJZBfvSqYvC6PE5o+AHpbNpNcUvaRLivoBTuKvI1s5M kDw4M/fM+ubEWlaG65K6CTt2mGKxQEozNj++2PVqKJgU269vAtqnR/ezRacAAiT7Kz2OIzZgtss Zh9tXjc0T/7va50Drk9QaN++POoROZhCemWuexjZB+QklVap9s5nR/g6tP4ud2pkuRrwDIik3D+ RXXAc= X-Google-Smtp-Source: AGHT+IEEEhOHJHKVo9c2qoDwUkUfdgrICndDqLDF0Y9QKv018f7khAYv85uhvdgp1+VXtxmxOp873A== X-Received: by 2002:a05:622a:2cb:b0:4b3:d28:c96 with SMTP id d75a77b69052e-4b31d7f062emr76822691cf.13.1756692035726; Sun, 31 Aug 2025 19:00:35 -0700 (PDT) Received: from localhost (modemcable197.17-162-184.mc.videotron.ca. [184.162.17.197]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4b30b584340sm53060731cf.17.2025.08.31.19.00.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Aug 2025 19:00:35 -0700 (PDT) From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Lessard?= To: Andy Shevchenko , Geert Uytterhoeven Cc: linux-kernel@vger.kernel.org Subject: [PATCH 1/5] auxdisplay: linedisp: encapsulate container_of usage within to_linedisp Date: Sun, 31 Aug 2025 22:00:25 -0400 Message-ID: <20250901020033.60196-2-jefflessard3@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250901020033.60196-1-jefflessard3@gmail.com> References: <20250901020033.60196-1-jefflessard3@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Replace direct container_of() calls with a to_linedisp() helper function throughout the line-display auxdisplay library module. This abstraction prepares for upcoming dual-mode support where linedisp context retrieval will need to handle both dedicated child devices and attached parent auxdisplay devices. No functional changes in this patch. Signed-off-by: Jean-Fran=C3=A7ois Lessard --- drivers/auxdisplay/line-display.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-di= splay.c index 8590a4cd2..e44341b1e 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -31,6 +31,11 @@ =20 #define DEFAULT_SCROLL_RATE (HZ / 2) =20 +static struct linedisp *to_linedisp(struct device *dev) +{ + return container_of(dev, struct linedisp, dev); +} + /** * linedisp_scroll() - scroll the display by a character * @t: really a pointer to the private data structure @@ -133,7 +138,7 @@ static int linedisp_display(struct linedisp *linedisp, = const char *msg, static ssize_t message_show(struct device *dev, struct device_attribute *a= ttr, char *buf) { - struct linedisp *linedisp =3D container_of(dev, struct linedisp, dev); + struct linedisp *linedisp =3D to_linedisp(dev); =20 return sysfs_emit(buf, "%s\n", linedisp->message); } @@ -152,7 +157,7 @@ static ssize_t message_show(struct device *dev, struct = device_attribute *attr, static ssize_t message_store(struct device *dev, struct device_attribute *= attr, const char *buf, size_t count) { - struct linedisp *linedisp =3D container_of(dev, struct linedisp, dev); + struct linedisp *linedisp =3D to_linedisp(dev); int err; =20 err =3D linedisp_display(linedisp, buf, count); @@ -164,7 +169,7 @@ static DEVICE_ATTR_RW(message); static ssize_t scroll_step_ms_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct linedisp *linedisp =3D container_of(dev, struct linedisp, dev); + struct linedisp *linedisp =3D to_linedisp(dev); =20 return sysfs_emit(buf, "%u\n", jiffies_to_msecs(linedisp->scroll_rate)); } @@ -173,7 +178,7 @@ static ssize_t scroll_step_ms_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct linedisp *linedisp =3D container_of(dev, struct linedisp, dev); + struct linedisp *linedisp =3D to_linedisp(dev); unsigned int ms; int err; =20 @@ -195,7 +200,7 @@ static DEVICE_ATTR_RW(scroll_step_ms); =20 static ssize_t map_seg_show(struct device *dev, struct device_attribute *a= ttr, char *buf) { - struct linedisp *linedisp =3D container_of(dev, struct linedisp, dev); + struct linedisp *linedisp =3D to_linedisp(dev); struct linedisp_map *map =3D linedisp->map; =20 memcpy(buf, &map->map, map->size); @@ -205,7 +210,7 @@ static ssize_t map_seg_show(struct device *dev, struct = device_attribute *attr, c static ssize_t map_seg_store(struct device *dev, struct device_attribute *= attr, const char *buf, size_t count) { - struct linedisp *linedisp =3D container_of(dev, struct linedisp, dev); + struct linedisp *linedisp =3D to_linedisp(dev); struct linedisp_map *map =3D linedisp->map; =20 if (count !=3D map->size) @@ -232,7 +237,7 @@ static struct attribute *linedisp_attrs[] =3D { static umode_t linedisp_attr_is_visible(struct kobject *kobj, struct attri= bute *attr, int n) { struct device *dev =3D kobj_to_dev(kobj); - struct linedisp *linedisp =3D container_of(dev, struct linedisp, dev); + struct linedisp *linedisp =3D to_linedisp(dev); struct linedisp_map *map =3D linedisp->map; umode_t mode =3D attr->mode; =20 @@ -263,7 +268,7 @@ static DEFINE_IDA(linedisp_id); =20 static void linedisp_release(struct device *dev) { - struct linedisp *linedisp =3D container_of(dev, struct linedisp, dev); + struct linedisp *linedisp =3D to_linedisp(dev); =20 kfree(linedisp->map); kfree(linedisp->message); --=20 2.43.0 From nobody Fri Oct 3 12:12:07 2025 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 790591F5617 for ; Mon, 1 Sep 2025 02:00:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756692040; cv=none; b=Wh/ydiWes2rEHWxf4/k/SIQrKgOw0alGQH9ShyEfOyLfBpR1fKC+eoFb8VKP6b2HMTV6iJSs+0nNEl0DNP2NX9W+xB9IH3VMeTm5DZmgHj2y673TZ28pjp8rYuZl5Uvpzqk7t1vHzef1dJhzoTaiN5gwyBfQnJnLtILXAe0dgo4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756692040; c=relaxed/simple; bh=SHx/err06cat1Rq44fqyBd180FjnqLoHf/fPnd/fJJ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hEDrrwdfCo2LdYb1vov3/Bg0C9ukQ+qT1HjRv9EY4of/jYf9JhiMuyL1/nHYL4GSDTPq2lZBuDBFTIyS6aGiO9s/kz6alzQ+y/Lrc6HDkPpbFFi8okEvFxIPNyi1m2djbnlmUaqFLBoUSU+4j3DHxPnos9KdNNnALFl+a2N+3Dk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lkZBipRV; arc=none smtp.client-ip=209.85.222.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lkZBipRV" Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-7f6f367a248so352361585a.3 for ; Sun, 31 Aug 2025 19:00:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756692037; x=1757296837; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OaD/OWwKQXAYi1ON0/0C3vmv92rVLm893Z0kjykczRg=; b=lkZBipRVs6VLtGIUwNo8y6QzdA+nNJmPySjwbMkoSe0fUBCCGmxJym8mupLDq9TJ7i N/d0O+5Mx9uEtmyW8o/dNJJeXsNxqC1T6Ys7k7VGgnhEeGdKOYJEPZv2Lki4tRIcJftQ 2zHzynQz0SBSxKDmj20W2Nc/y1n04C6oawX4DiNRc6DJ80NCzGKuKWurrCresnwux5Wj r+oMkj8SNClPnn2+m09er+GyhXSD9zY1VpwLHuvRyaoYiyaPk1frAdjVTmHCPfJFu+KY Wrh8owicnOA2ng1IcoqgZxSv5biXI9RTQITEvbgOZ8uQ7LGgCd8yK6wqsZwTm7nc3xC5 SkPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756692037; x=1757296837; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OaD/OWwKQXAYi1ON0/0C3vmv92rVLm893Z0kjykczRg=; b=AJ/vhWpfYRJJODtklYYpU3S1p750edCfooGmcItoZd1osPgY5Dp7RYvbXjJ9CshykK Jehx7OWzZ1iGpP1Yz++cr/5auN/jgQsRaGozufbwVyb3w2Q1A5bIZLWRwykXt1EzIAqy XsOGUpEugZTU/ltXLBKY06UL7Gg455PcKLbRv3FSv5l8Ad4vgh5sWHUcPP9aTV9O+nlB hB+M7DM3QsEdIwNii1ZuMIvzVrzC+P9DaF+v3sat2kr5WUgWF0yXETlffEOv5OHEbK6V cQTuswuN4n7JdAK7DKznT3AJeFNfydia9r5vhX/3krs8lKUGMXk+7+PBzFNNTyPX5md7 WP5g== X-Gm-Message-State: AOJu0YzjL2eLfI8Jm33GUOSDVci4qUsQzbq7zU/escrQ2BgPLcw28yrW iIhqQ9esvbo3B0usOxS8ezIF0XChBL4LeGFWV7XSpKZ2nSDG0d4Kgu8JYs4eTg== X-Gm-Gg: ASbGncsnydac8zGd19QndWrOham90Rx7lmQRW2ID5/5ORM3eHitliwV0RNf8tA/L2Z+ Kb5HSPQ5ntSjiUdcRsACJbsOaOZj/dZAsYVf1XYn5BGCXjQHRbrXlm/ncptokHXmbYVJFvkC+nu V7ytep1bygFLYj428/RQ36ICgOKpbTxP1QPfsbe/PnLpgMfa/DE0nrB2Su8fo/P4xCSujBzLz5K wxeWcIaZl10docZmEcVqOncx8nsjhwjc5QRmfCi1PQlblycO1kMBaDTDuNB/x9WSUEYuB/8gyAg kygYGX3siiScnp+IdNdnCQcYbttTm118l3N1sWr0MQ7nolBT48x4CYUP6xGyKWk9w3D2Fvg1GON keQSIAjbVQdQbOlxrvaFpDPg3HihURJXk4249FajvkWQq/TI59FvTtTZt54nn5wNIPenu X-Google-Smtp-Source: AGHT+IEQVAjYL4ImVlKXfF6ZwfIyOQerdjH8mW7wg1Cl1DAKvCXFs0uhgqOgIxuEk2EaWXkTeTHwvw== X-Received: by 2002:a05:620a:701a:b0:7fa:40bb:71a4 with SMTP id af79cd13be357-7ff2c32f9e8mr700392485a.72.1756692037147; Sun, 31 Aug 2025 19:00:37 -0700 (PDT) Received: from localhost (modemcable197.17-162-184.mc.videotron.ca. [184.162.17.197]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-70fb263449esm32441416d6.25.2025.08.31.19.00.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Aug 2025 19:00:36 -0700 (PDT) From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Lessard?= To: Andy Shevchenko , Geert Uytterhoeven Cc: linux-kernel@vger.kernel.org Subject: [PATCH 2/5] auxdisplay: linedisp: display static message when length <= display size Date: Sun, 31 Aug 2025 22:00:26 -0400 Message-ID: <20250901020033.60196-3-jefflessard3@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250901020033.60196-1-jefflessard3@gmail.com> References: <20250901020033.60196-1-jefflessard3@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Currently, when a message shorter than the display size is written, the content wraps around (e.g., "123" on a 4-digit display shows "1231") without scrolling, which is confusing and unintuitive. Change behavior to display short messages statically with space padding (e.g. "123 ") while only scrolling messages longer than the display width. This provides more natural behavior that aligns with user expectations and current linedisp_display() kernel-doc. The scroll logic is also consolidated into a helper function for clarity. No API changes are introduced. Signed-off-by: Jean-Fran=C3=A7ois Lessard --- drivers/auxdisplay/line-display.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-di= splay.c index e44341b1e..ea23c43bb 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -36,6 +36,11 @@ static struct linedisp *to_linedisp(struct device *dev) return container_of(dev, struct linedisp, dev); } =20 +static inline bool should_scroll(struct linedisp *linedisp) +{ + return linedisp->message_len > linedisp->num_chars && linedisp->scroll_ra= te; +} + /** * linedisp_scroll() - scroll the display by a character * @t: really a pointer to the private data structure @@ -67,7 +72,7 @@ static void linedisp_scroll(struct timer_list *t) linedisp->scroll_pos %=3D linedisp->message_len; =20 /* rearm the timer */ - if (linedisp->message_len > num_chars && linedisp->scroll_rate) + if (should_scroll(linedisp)) mod_timer(&linedisp->timer, jiffies + linedisp->scroll_rate); } =20 @@ -118,8 +123,16 @@ static int linedisp_display(struct linedisp *linedisp,= const char *msg, linedisp->message_len =3D count; linedisp->scroll_pos =3D 0; =20 - /* update the display */ - linedisp_scroll(&linedisp->timer); + if (should_scroll(linedisp)) { + /* display scrolling message */ + linedisp_scroll(&linedisp->timer); + } else { + /* display static message */ + memset(linedisp->buf, ' ', linedisp->num_chars); + memcpy(linedisp->buf, linedisp->message, + umin(linedisp->num_chars, linedisp->message_len)); + linedisp->ops->update(linedisp); + } =20 return 0; } @@ -186,12 +199,12 @@ static ssize_t scroll_step_ms_store(struct device *de= v, if (err) return err; =20 + timer_delete_sync(&linedisp->timer); + linedisp->scroll_rate =3D msecs_to_jiffies(ms); - if (linedisp->message && linedisp->message_len > linedisp->num_chars) { - timer_delete_sync(&linedisp->timer); - if (linedisp->scroll_rate) - linedisp_scroll(&linedisp->timer); - } + + if (should_scroll(linedisp)) + linedisp_scroll(&linedisp->timer); =20 return count; } --=20 2.43.0 From nobody Fri Oct 3 12:12:07 2025 Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA3BE214A6A for ; Mon, 1 Sep 2025 02:00:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756692041; cv=none; b=WAaRpApYJGm+G/91DL3vg0stm/+ZfPTaJTxrH+/XcUw0VUN8eAX737kxeq5LJIFc56nRBNEfPeASqGOVuqmxXvxezDqaDr0M5Gaz4/x9WvqCaPiawbe7wCxnkbF/ZUhaLsIg3iDvhiE/Lf3ySPLUrlnAc3s0jwTCfqaemloI3t4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756692041; c=relaxed/simple; bh=X1O9vF5LeDkAuoDWLe04K5pE9hzgkOLKPGnHJpIRHew=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=auyMryyldgn8Gl1fQomaxecRQYS43Pqje3LdWi+kyicaoLl0ow2SUo838x0cDzd7jZTSpsikF1vZC+S8mh3+HBmuCEFf/1BCtaeqmAZdhgUkyA7ZnWARu/vFZUqq1O9Spn4V4TW7e+RmtrflCvM5Q/AWENytH1gx2gmMrlxyIJ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JSvIBrhQ; arc=none smtp.client-ip=209.85.219.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JSvIBrhQ" Received: by mail-qv1-f51.google.com with SMTP id 6a1803df08f44-70ddadde2e9so32130896d6.0 for ; Sun, 31 Aug 2025 19:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756692039; x=1757296839; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Nvwjm1HRhlfMOv0sa7UDrNAhf2iFFKuHjGFmy19Fn7o=; b=JSvIBrhQwzgrqCPzWJ3XowAwOO8aoRJxv08W1yJ4D0CoJBJApW8L2Udk9pTiKrg2VP Feg70YJPp/4sGiOJySPpCHUM257TBEHsKxHK/STMGXYILO/P6NUQ19t+trLKGcbvQB+b bPXuWMwp2hnGhkuRH5gDqdj9i+Yuio97FLLJbTMnJ7xP42FVn06fOJ2OcRi25W3wohBp DCCaXDtVcwCjEKIPC9ZtYtdiLcJzhodQFtPgtfR/BUIRLBEDRmAZpBgnWZJh8/I9ac9Y Jc6Xk8I0XXX4QXn+2Gax2tvblceiXL9UgJuU5QVJxo7GU/ua0W+YmDqJmrWsD94df5wm CrEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756692039; x=1757296839; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Nvwjm1HRhlfMOv0sa7UDrNAhf2iFFKuHjGFmy19Fn7o=; b=Rf9Qtju06MP+5dngUIOOTGt1pH5edFZ1XubhBFpxaN0XyKDGr4GgsSj9FjRAsz4vfm 3sohy7PsLVya7VcDra7JbH099h9pC8HbLj1KKK/DM+bG3ta0b15NgiLUCApR6X8mPpvQ ty5A6WWNmG7uEXZi2TME07Vnd/QkZu6GlM4dLQlPRbHj3mFyjsB6lPO0OG34+T1vmRpz zbxoFVrbrLcbPAyS+eUBOVNockaJ4HJMQZK69nboT+7t+58QLAwCv827/4UhxvhTN/V7 PRU4bUX4u5vewLzs+aVabgJ9bvkLdXG033q+BrVhv7AiObYD6eLtlpUPjc8OSD12ma28 WZSg== X-Gm-Message-State: AOJu0YxCBeaJgyhv1wEdoGNJuMuNJCk7wbqQDSgctFk+ZdR2hmn9mTl3 d3tw+lUYbc5nmJWTBEjYgKiYPL3s+R6kA2pY9CVnouFzzVFkNYDkG9BB X-Gm-Gg: ASbGncvKjxA9Fnqghae7xWi60E/0fnzC2luskd/w8O1ZYc2nLovOv3CaahoMI0SKhZ7 SIIfHzQs42vHWKbMc2XpTaGArHfPfRBK64IlP+h/lphyi/RQoyjG7NOVwMmew055O1x93bZ6kF3 PDJ2E5y57nLUJCAoTVJktIh/IFLcT1BTJfUsL5Ss3pZys2bQ0jQIvV1W5RugVmTMWkkgljzOwHr aruSqb8MpjerqPOeaMPDRq+QGVY0XEnKFxn5qe0ZdBW0wm5Lvc7GH013M3FkHO0iS5mfsKX9DVp oeSNScvsXObuVYd2FNjLRaMIBjC1OWfgDFEEur0y07xFpLtmMzSxrs8E8jYtbVVYNon3GXtxJvY 5DplRxKcOp/fbJYSu4CNGBIA8lZCIkPSpWXlHPQDdjNBrNVaMyThoILb9JGJHz0kp0Wdgk1wuTo 5AprQ= X-Google-Smtp-Source: AGHT+IHhCqh+SKEztfWuegZJcIZaogGT2qitPVl9dnUZUKhyWxRolJxXeWeYryFcvj4VASLEzXsO6A== X-Received: by 2002:a05:6214:2525:b0:70d:ef27:9d0e with SMTP id 6a1803df08f44-70fac544cb6mr68297216d6.0.1756692038469; Sun, 31 Aug 2025 19:00:38 -0700 (PDT) Received: from localhost (modemcable197.17-162-184.mc.videotron.ca. [184.162.17.197]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-70fb2837f9esm32151346d6.48.2025.08.31.19.00.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Aug 2025 19:00:38 -0700 (PDT) From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Lessard?= To: Andy Shevchenko , Geert Uytterhoeven Cc: linux-kernel@vger.kernel.org Subject: [PATCH 3/5] auxdisplay: linedisp: add num_chars sysfs attribute Date: Sun, 31 Aug 2025 22:00:27 -0400 Message-ID: <20250901020033.60196-4-jefflessard3@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250901020033.60196-1-jefflessard3@gmail.com> References: <20250901020033.60196-1-jefflessard3@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Add a read-only 'num_chars' sysfs attribute to report display digit count. The num_chars attribute provides essential capability information to userspace applications that need to know display dimensions before writing messages, complementing the existing message and scroll controls. No functional changes to existing behavior. Signed-off-by: Jean-Fran=C3=A7ois Lessard --- drivers/auxdisplay/line-display.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-di= splay.c index ea23c43bb..abeed8812 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -211,6 +211,16 @@ static ssize_t scroll_step_ms_store(struct device *dev, =20 static DEVICE_ATTR_RW(scroll_step_ms); =20 +static ssize_t num_chars_show(struct device *dev, struct device_attribute = *attr, + char *buf) +{ + struct linedisp *linedisp =3D to_linedisp(dev); + + return sysfs_emit(buf, "%u\n", linedisp->num_chars); +} + +static DEVICE_ATTR_RO(num_chars); + static ssize_t map_seg_show(struct device *dev, struct device_attribute *a= ttr, char *buf) { struct linedisp *linedisp =3D to_linedisp(dev); @@ -242,6 +252,7 @@ static DEVICE_ATTR(map_seg14, 0644, map_seg_show, map_s= eg_store); static struct attribute *linedisp_attrs[] =3D { &dev_attr_message.attr, &dev_attr_scroll_step_ms.attr, + &dev_attr_num_chars.attr, &dev_attr_map_seg7.attr, &dev_attr_map_seg14.attr, NULL --=20 2.43.0 From nobody Fri Oct 3 12:12:07 2025 Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 405F921B1AA for ; Mon, 1 Sep 2025 02:00:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756692043; cv=none; b=kRm7crvaeQujaQMXrt5lg/xz9iJrynfGydeNkHYVTrrEhsT3eUShhGZ8pYVii9710sagQCjbgCQq+0hOnbWjpWbulfOB/LsKal40iuvU5uBZ3ns8aJdHRO+JCYwJv2Zz4O4r/BWU3W/vuQhIt8tS/y0UKqRe4X/O2y3lNKOdhhA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756692043; c=relaxed/simple; bh=uCrvTMbf7NF0MNMD7g0oXt0igXQlfP+RbJ5iFk5FAwc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eS4y+9hynqaYY4XXzyEHGvS1Jps6Nh56RpbILL8nRrGBECCgiTT7jPV9bqux2upKirV9eNYVRMdDqtuBFbEg+jf5JywYwRHE3fj+Rp39EuyLRVbK3XDTKDcrlivYAlsHfjwB5I3RjZSWXqVpVwgrTvAaQ1iuBYAmMvisX0qhGkE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lPM0LN/f; arc=none smtp.client-ip=209.85.219.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lPM0LN/f" Received: by mail-qv1-f49.google.com with SMTP id 6a1803df08f44-70df92872ceso31591616d6.1 for ; Sun, 31 Aug 2025 19:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756692040; x=1757296840; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=btv2+zrNnBuWpIYtzQbHrU0RH1HbmWmw6AIer95J2Vk=; b=lPM0LN/fDjToCk6umNxMUaLxf/eKuHEIy/wo1B16hsw1j2Jul6E9n6dbhhmCJUxRsb JUB+xrtsBqFOcWVG963psLFazb4b1FnRGIV1X0dr8XfpMpLbos4VGJoPR0k/MSiprx/y hsRNA2rJZZu+R257sdoUN3VrkojXpXMn/J1iqF3sguYcjwe/sBNrB+ybMsu9HVkAqO69 BUIkMnfpz/6DSTUdnAeH04W33/0oEOAU52pFB72fiEb5zABVKatJuefg3XvzoSSgxgVw m7PBxt3bT5lp6q+k7qCzY19KNA82BflfbDdKP3zHP0sr7Ot1MJ1Mpc2w+ZNji0PBJ4u5 z4Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756692040; x=1757296840; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=btv2+zrNnBuWpIYtzQbHrU0RH1HbmWmw6AIer95J2Vk=; b=Zzm9E1THcu2rYDhqUscwYDwGkHToQR8hFHm3D4I6/3zMZxXh81R0X5TToQnMX1DBws 5sJY9cNad4Ii0vzSlJKsb5y3kh8JRYvJK65mAAlrvxqyKEl/WoQ2yzhfJFedop3So/0I tqrIsGRirlWt5Ao8WupTOQVfCDF/4csUf+5QES0/hcsJnpeKNa4bVvKrQcRPoL87Q/PN Mog9DwsS0k/DxJPrl7HtJZqJ9N/OhUPHBkStjcsLP/lfqtBEjrotHu/7kzW8o7u6aprH DeI0NrNSGfg4St9JZ/kHKs9q3SH2EKw5UEtCP/uqavXT/qUZDvq3LDYc9uPw8M25HV8m I07w== X-Gm-Message-State: AOJu0YydInbbf/BH0s66VDY0cMAT1MY6FBfGGDvss96Ok50vBN+SoV7+ djzF0fVXTC7E6jlSbVkrw1FdSNy0xeyYMnX0nxoCBGmo6eq4AEsRvMUd X-Gm-Gg: ASbGncvxBFPt2kWT5cJ/ouSnbPzc4wAE0HzeEvj9b1Yp5WvfxmFKisCioeyKOXUfpLf FD/1kE8mDgbNpLQCWPfOwXJVgPkOC3YG8RTvlFnYesmuQ44fRkopHz9eQFoKaPTB5+AMgDCSKlY umGPHLb1y1OWF7x4bl5sbaCpto3IcVagHqErVYJk/tl83oqsT+ojLbchkeDJ2rYFDrSzzO7GFOg ZKhbUsBAOXx6+gDQPRY1q97i7Dl+Ydxxy4SlZPmX5EAQO4Dmv7qOHoM9lZMbE92e9fPH/wD7R8p NQF67ALVtMiCaG9lC5jCJEvZH/+exJGvArtNmwvv4GkJonw4VlHXCGl/dLj8XM5SW/R2nJzwnRE 2E3gTmuPMm8pQQos2CbeUfz3OqHleR/2CrBG5o2gSo4/IDCLh6n+zOUo/dqaJaacBoYqQSZXzp2 KTw2I= X-Google-Smtp-Source: AGHT+IHZTBNgW56teLD3sHSLrvkv0m337tB6iNKQKpqlBsfGGabYGgvI0lsbSLvoRIAMxLpvom0IdQ== X-Received: by 2002:a05:6214:aca:b0:718:787b:fece with SMTP id 6a1803df08f44-718787c00a2mr23553336d6.16.1756692039841; Sun, 31 Aug 2025 19:00:39 -0700 (PDT) Received: from localhost (modemcable197.17-162-184.mc.videotron.ca. [184.162.17.197]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-70fb28983fasm31908136d6.54.2025.08.31.19.00.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Aug 2025 19:00:39 -0700 (PDT) From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Lessard?= To: Andy Shevchenko , Geert Uytterhoeven Cc: linux-kernel@vger.kernel.org Subject: [PATCH 4/5] auxdisplay: linedisp: support attribute attachment to auxdisplay devices Date: Sun, 31 Aug 2025 22:00:28 -0400 Message-ID: <20250901020033.60196-5-jefflessard3@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250901020033.60196-1-jefflessard3@gmail.com> References: <20250901020033.60196-1-jefflessard3@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Enable linedisp library integration into existing kernel devices (like LED class) to provide a uniform 7-segment userspace API without creating separate child devices, meeting the consistent interface while maintaining coherent device hierarchies. This allows uniform 7-segment API across all drivers while solving device proliferation and fragmented userspace interfaces. The provided attributes appear in two locations depending on usage: 1. On linedisp.N child devices (legacy linedisp_register()) 2. On the parent auxdisplay device (new linedisp_attach()) Functionality is identical in both modes. Existing consumers of linedisp_register() are unaffected. The new API enables drivers like TM16XX to integrate 7-segment display functionality seamlessly within their LED class device hierarchy. Signed-off-by: Jean-Fran=C3=A7ois Lessard --- drivers/auxdisplay/line-display.c | 160 +++++++++++++++++++++++++++++- drivers/auxdisplay/line-display.h | 4 + 2 files changed, 161 insertions(+), 3 deletions(-) diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-di= splay.c index abeed8812..1176d46f0 100644 --- a/drivers/auxdisplay/line-display.c +++ b/drivers/auxdisplay/line-display.c @@ -6,20 +6,23 @@ * Author: Paul Burton * * Copyright (C) 2021 Glider bv + * Copyright (C) 2025 Jean-Fran=C3=A7ois Lessard */ =20 #ifndef CONFIG_PANEL_BOOT_MESSAGE #include #endif =20 -#include +#include #include #include #include #include #include +#include #include #include +#include #include #include #include @@ -31,9 +34,72 @@ =20 #define DEFAULT_SCROLL_RATE (HZ / 2) =20 +struct linedisp_attachment { + struct list_head list; + struct device *device; + struct linedisp *linedisp; + bool owns_device; /* true for child device mode, false for attached mode= */ +}; + +static LIST_HEAD(linedisp_attachments); +static DEFINE_SPINLOCK(linedisp_attachments_lock); + +static int create_attachment(struct device *dev, struct linedisp *linedisp= , bool owns_device) +{ + struct linedisp_attachment *attachment; + + attachment =3D kzalloc(sizeof(*attachment), GFP_KERNEL); + if (!attachment) + return -ENOMEM; + + attachment->device =3D dev; + attachment->linedisp =3D linedisp; + attachment->owns_device =3D owns_device; + + guard(spinlock)(&linedisp_attachments_lock); + list_add(&attachment->list, &linedisp_attachments); + + return 0; +} + +static struct linedisp *delete_attachment(struct device *dev, bool owns_de= vice) +{ + struct linedisp_attachment *attachment; + struct linedisp *linedisp; + + guard(spinlock)(&linedisp_attachments_lock); + + list_for_each_entry(attachment, &linedisp_attachments, list) { + if (attachment->device =3D=3D dev && + attachment->owns_device =3D=3D owns_device) + break; + } + + if (list_entry_is_head(attachment, &linedisp_attachments, list)) + return NULL; + + linedisp =3D attachment->linedisp; + list_del(&attachment->list); + kfree(attachment); + + return linedisp; +} + static struct linedisp *to_linedisp(struct device *dev) { - return container_of(dev, struct linedisp, dev); + struct linedisp_attachment *attachment; + + guard(spinlock)(&linedisp_attachments_lock); + + list_for_each_entry(attachment, &linedisp_attachments, list) { + if (attachment->device =3D=3D dev) + break; + } + + if (list_entry_is_head(attachment, &linedisp_attachments, list)) + return NULL; + + return attachment->linedisp; } =20 static inline bool should_scroll(struct linedisp *linedisp) @@ -349,6 +415,87 @@ static int linedisp_init_map(struct linedisp *linedisp) #define LINEDISP_INIT_TEXT "Linux " UTS_RELEASE " " #endif =20 +/** + * linedisp_attach - attach a character line display + * @linedisp: pointer to character line display structure + * @dev: pointer of the device to attach to + * @num_chars: the number of characters that can be displayed + * @ops: character line display operations + * + * Return: zero on success, else a negative error code. + */ +int linedisp_attach(struct linedisp *linedisp, struct device *dev, + unsigned int num_chars, const struct linedisp_ops *ops) +{ + int err; + + memset(linedisp, 0, sizeof(*linedisp)); + linedisp->ops =3D ops; + linedisp->num_chars =3D num_chars; + linedisp->scroll_rate =3D DEFAULT_SCROLL_RATE; + + linedisp->buf =3D kzalloc(linedisp->num_chars, GFP_KERNEL); + if (!linedisp->buf) + return -ENOMEM; + + /* initialise a character mapping, if required */ + err =3D linedisp_init_map(linedisp); + if (err) + goto out_free_buf; + + /* initialise a timer for scrolling the message */ + timer_setup(&linedisp->timer, linedisp_scroll, 0); + + err =3D create_attachment(dev, linedisp, false); + if (err) + goto out_del_timer; + + /* add attribute groups to target device */ + err =3D device_add_groups(dev, linedisp_groups); + if (err) + goto out_del_attach; + + /* display a default message */ + err =3D linedisp_display(linedisp, LINEDISP_INIT_TEXT, -1); + if (err) + goto out_rem_groups; + + return 0; + +out_rem_groups: + device_remove_groups(dev, linedisp_groups); +out_del_attach: + delete_attachment(dev, false); +out_del_timer: + timer_delete_sync(&linedisp->timer); +out_free_buf: + kfree(linedisp->buf); + return err; +} +EXPORT_SYMBOL_NS_GPL(linedisp_attach, "LINEDISP"); + +/** + * linedisp_detach - detach a character line display + * @dev: pointer of the device to detach from, that was previously + * attached with linedisp_attach() + */ +void linedisp_detach(struct device *dev) +{ + struct linedisp *linedisp =3D delete_attachment(dev, false); + + if (!linedisp) + return; + + timer_delete_sync(&linedisp->timer); + + device_remove_groups(dev, linedisp_groups); + + kfree(linedisp->map); + kfree(linedisp->message); + kfree(linedisp->buf); +} +EXPORT_SYMBOL_NS_GPL(linedisp_detach, "LINEDISP"); + /** * linedisp_register - register a character line display * @linedisp: pointer to character line display structure @@ -391,10 +538,14 @@ int linedisp_register(struct linedisp *linedisp, stru= ct device *parent, /* initialise a timer for scrolling the message */ timer_setup(&linedisp->timer, linedisp_scroll, 0); =20 - err =3D device_add(&linedisp->dev); + err =3D create_attachment(&linedisp->dev, linedisp, true); if (err) goto out_del_timer; =20 + err =3D device_add(&linedisp->dev); + if (err) + goto out_del_attach; + /* display a default message */ err =3D linedisp_display(linedisp, LINEDISP_INIT_TEXT, -1); if (err) @@ -404,6 +555,8 @@ int linedisp_register(struct linedisp *linedisp, struct= device *parent, =20 out_del_dev: device_del(&linedisp->dev); +out_del_attach: + delete_attachment(&linedisp->dev, true); out_del_timer: timer_delete_sync(&linedisp->timer); out_put_device: @@ -420,6 +573,7 @@ EXPORT_SYMBOL_NS_GPL(linedisp_register, "LINEDISP"); void linedisp_unregister(struct linedisp *linedisp) { device_del(&linedisp->dev); + delete_attachment(&linedisp->dev, true); timer_delete_sync(&linedisp->timer); put_device(&linedisp->dev); } diff --git a/drivers/auxdisplay/line-display.h b/drivers/auxdisplay/line-di= splay.h index 4348d7a2f..36853b639 100644 --- a/drivers/auxdisplay/line-display.h +++ b/drivers/auxdisplay/line-display.h @@ -6,6 +6,7 @@ * Author: Paul Burton * * Copyright (C) 2021 Glider bv + * Copyright (C) 2025 Jean-Fran=C3=A7ois Lessard */ =20 #ifndef _LINEDISP_H @@ -81,6 +82,9 @@ struct linedisp { unsigned int id; }; =20 +int linedisp_attach(struct linedisp *linedisp, struct device *dev, + unsigned int num_chars, const struct linedisp_ops *ops); +void linedisp_detach(struct device *dev); int linedisp_register(struct linedisp *linedisp, struct device *parent, unsigned int num_chars, const struct linedisp_ops *ops); void linedisp_unregister(struct linedisp *linedisp); --=20 2.43.0 From nobody Fri Oct 3 12:12:07 2025 Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54D3B22157E for ; Mon, 1 Sep 2025 02:00:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756692044; cv=none; b=snw0Hl7Uv8VKzWcS36VcWBUrQIiKVh9KhYhsldAf87gnIdfH/LqPaBnlsPHUSZPPxhv0t7GT9rPgLi96ZeIW/sO2jr+FrX75daU9zxnx/sgII07VojLFxpdZ+dBCe4+ahhLWrr3Y9zZnvXcD95vlVI5t2cMHDuuKzr62tXfsejg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756692044; c=relaxed/simple; bh=VjSEQuTk8Aic2ULjMShGdIHNMpD4YMEhT97QSvsWINM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WAXu853WN7BmScIZ5wsukoKOqUPzL8wWRcmqTbNlx0r2DAWe9QDR/OT6P48POD4ZYiMXeiayIkgzw4lPiduQo7IqCzbp7lqOpROLdu+y0pmkPnexmMSQOcDcUVh8vJbMq5eHVwo0Zi1AJUwCHw01qWA6QoizM/PSTcJEw8RZvBk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MuMZeGxP; arc=none smtp.client-ip=209.85.219.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MuMZeGxP" Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-70de9ffcfffso37798436d6.2 for ; Sun, 31 Aug 2025 19:00:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756692041; x=1757296841; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=n71lxSZhtaKmDioqwBpuFWbtYkrE4A8cOtuolZZ4xFs=; b=MuMZeGxPjobAqstBIsavnDZ3cXis40ihN86kNASMweGoywuMnXw1GS35UC2EcFD7qO /ApEw92uXKd8FdAvpCOTEyLMe5PFAzkDj0J3OwHSTF2UbDh8X/Pq8JCbb1WLxNfwvSl+ cp1yLR82sfsHS59Ad7sOxBK7Gb8mfFAhxca3RyXE1dlU5Mn7V90+q7gybIkVHSJWoxiL mqAA2L3RhZbqmJh1Z+xUt5/0IdKJOTX7KF7ylLUOtdQORIMbYuNcFHt4z+D8nSCA6dVv GN3Q4I7d+rMNAaBxYM4DoOKGjDDvijEPCC/wcRbFauCivGluFfepkiOQQIkT4lXJ3MoR bfMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756692041; x=1757296841; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n71lxSZhtaKmDioqwBpuFWbtYkrE4A8cOtuolZZ4xFs=; b=AbhNQrLQWjOy5dY0CvW0eYKpRoJggSZtZvnFcfEZK9INkIjWQFRlE731Qkim4Y6Vtm 1AusW9q0LklDKBFyTRogFTqDHNOxUtEedsIH+fLbnWBAX04XekzRlELyeNjjOZvCNNde +w01EAcifG2YthDBSJHwfMG5xPLT7YsA9fDmfsVeJKFVs8dS6DUnl4n4qYuXjbILBYX7 69dSLgd1kLSgTb2DH0kz7IXd1NwvUcxq7sr5zCpp311sgJvo1Vy17HWaZyI3fAFzfd07 lYlnWPyq84NO8TIx36nwafcjCKLUBbvwx7LSJ76h0oHHoYqdk/oqjgYeqduypB6XoYBb xLIg== X-Gm-Message-State: AOJu0YxgFu7aK2vyRQyiuOzFJw1wk8Z6Zy0AZLMD4o4RHNSD+aqh5e/3 oEtIeXPj6Lnbip3eLtecxVjlWGwR2PWKT/THyHFWiKwJ7l7C3e0rjPTqoTk/Jw== X-Gm-Gg: ASbGncvFesQ9sU3WHroNldwyGanoO5jEOh/EJuzFCD2hD2hga+y425XDWgqutyK05Ex LK4FhUnuCuWYWPj4A1/3OYqSiBoj2oUZaxvoeq2/nVHiKJnyPu/voVXYtsF3i7TgDAIkffoR5gw UVe1G9sFU6/+MAVIBVQo2S+NOuMWPvvnK5AL6H6R0afsnKg4cvGzOHyuH22Q3tCvQy+jbaeRceJ LPAlFmXLhSypUIYnpaUnl/YBynlQucX+6ytjTsXiQwcPjnCfFA08e6uLUyKihtDtxEXS6esmLVs u6J1i3BZXtQRd8xarwY6QYBZUzjSz08IUhd5a/2YZJsTSN1G5U27SFyuN7q4Tz4f6RKLFfIRsf8 5ix00S4nveABS61H0d4SjZUknzdnElDs9q+47JfsB31me30c8R1mRtiyIeZQTKQaDavaL X-Google-Smtp-Source: AGHT+IEaGu+VYdICMtJaTj4cIkBGcsfziLHVIU6jPygVTgEEWqJYHyBwxY2MAfxI6b1oIhohl443gg== X-Received: by 2002:a05:6214:2529:b0:70d:ce68:e019 with SMTP id 6a1803df08f44-70fac6f9d75mr58888606d6.8.1756692041077; Sun, 31 Aug 2025 19:00:41 -0700 (PDT) Received: from localhost (modemcable197.17-162-184.mc.videotron.ca. [184.162.17.197]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-70fb25c6f49sm32124496d6.15.2025.08.31.19.00.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Aug 2025 19:00:40 -0700 (PDT) From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Lessard?= To: Andy Shevchenko , Geert Uytterhoeven Cc: linux-kernel@vger.kernel.org Subject: [PATCH 5/5] docs: ABI: auxdisplay: document linedisp library sysfs attributes Date: Sun, 31 Aug 2025 22:00:29 -0400 Message-ID: <20250901020033.60196-6-jefflessard3@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250901020033.60196-1-jefflessard3@gmail.com> References: <20250901020033.60196-1-jefflessard3@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Add ABI documentation for sysfs attributes provided by the line-display auxdisplay library module. These attributes enable text message display and configuration on character-based auxdisplay devices. Documents previously undocumented attributes: - message, scroll_step_ms (introduced in v5.16) - map_seg7, map_seg14 (introduced in v6.9) Documents newly added attribute: - num_chars (targeted for v6.18) The line-display library is used by multiple auxdisplay drivers and can expose these attributes either on linedisp.N child devices or directly on parent auxdisplay devices. Signed-off-by: Jean-Fran=C3=A7ois Lessard --- .../ABI/testing/sysfs-auxdisplay-linedisp | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-auxdisplay-linedisp diff --git a/Documentation/ABI/testing/sysfs-auxdisplay-linedisp b/Document= ation/ABI/testing/sysfs-auxdisplay-linedisp new file mode 100644 index 000000000..63c47f192 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-auxdisplay-linedisp @@ -0,0 +1,90 @@ +What: /sys/.../message +Date: October 2021 +KernelVersion: 5.16 +Description: + Controls the text message displayed on character line displays. + + Reading returns the current message with a trailing newline. + Writing updates the displayed message. Messages longer than the + display width will automatically scroll. Trailing newlines in + input are automatically trimmed. + + Writing an empty string clears the display. + + Example: + echo "Hello World" > message + cat message # Returns "Hello World\n" + +What: /sys/.../scroll_step_ms +Date: October 2021 +KernelVersion: 5.16 +Description: + Controls the scrolling speed for messages longer than the display + width, specified in milliseconds per scroll step. + + Setting to 0 disables scrolling. Default is 500ms. + + Example: + echo "250" > scroll_step_ms # 4Hz scrolling + cat scroll_step_ms # Returns "250\n" + +What: /sys/.../num_chars +Date: November 2025 +KernelVersion: 6.18 +Contact: Jean-Fran=C3=A7ois Lessard +Description: + Read-only attribute showing the character width capacity of + the line display device. Messages longer than this will scroll. + + Example: + cat num_chars # Returns "16\n" for 16-char display + +What: /sys/.../map_seg7 +Date: January 2024 +KernelVersion: 6.9 +Description: + Read/write binary blob representing the ASCII-to-7-segment + display conversion table used by the linedisp driver, as defined + by struct seg7_conversion_map in . + + Only visible on displays with 7-segment capability. + + This attribute is not human-readable. Writes must match the + struct size exactly, else -EINVAL is returned; reads return the + entire mapping as a binary blob. + + This interface and its implementation match existing conventions + used in segment-mapped display drivers since 2005. + + ABI note: This style of binary sysfs attribute *is an exception* + to current "one value per file, text only" sysfs rules, for + historical compatibility and driver uniformity. New drivers are + discouraged from introducing additional binary sysfs ABIs. + + Reference interface guidance: + - include/uapi/linux/map_to_7segment.h + +What: /sys/.../map_seg14 +Date: January 2024 +KernelVersion: 6.9 +Description: + Read/write binary blob representing the ASCII-to-14-segment + display conversion table used by the linedisp driver, as defined + by struct seg14_conversion_map in . + + Only visible on displays with 14-segment capability. + + This attribute is not human-readable. Writes must match the + struct size exactly, else -EINVAL is returned; reads return the + entire mapping as a binary blob. + + This interface and its implementation match existing conventions + used by segment-mapped display drivers since 2005. + + ABI note: This style of binary sysfs attribute *is an exception* + to current "one value per file, text only" sysfs rules, for + historical compatibility and driver uniformity. New drivers are + discouraged from introducing additional binary sysfs ABIs. + + Reference interface guidance: + - include/uapi/linux/map_to_14segment.h --=20 2.43.0