From patchwork Mon Jan 15 09:58:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Young X-Patchwork-Id: 46473 X-Patchwork-Delegate: sean@mess.org Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eb1XH-0004aI-Ff; Mon, 15 Jan 2018 09:58:35 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933282AbeAOJ6c (ORCPT + 1 other); Mon, 15 Jan 2018 04:58:32 -0500 Received: from gofer.mess.org ([88.97.38.141]:36113 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932931AbeAOJ61 (ORCPT ); Mon, 15 Jan 2018 04:58:27 -0500 Received: by gofer.mess.org (Postfix, from userid 1000) id 6DCD8610A5; Mon, 15 Jan 2018 09:58:25 +0000 (GMT) From: Sean Young To: Miguel Ojeda Sandonis , linux-media@vger.kernel.org Subject: [PATCH 2/5] auxdisplay: charlcd: add flush function Date: Mon, 15 Jan 2018 09:58:21 +0000 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The Sasem Remote Controller has an LCD, which is connnected via usb. Multiple write reg or write data commands can be combined into one usb packet. The latency of usb is such that if we send commands one by one, we get very obvious tearing on the LCD. By adding a flush function, we can buffer all commands until either the usb packet is full or the lcd changes are complete. Signed-off-by: Sean Young --- drivers/auxdisplay/charlcd.c | 6 ++++++ include/misc/charlcd.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c index 45ec5ce697c4..a16c72779722 100644 --- a/drivers/auxdisplay/charlcd.c +++ b/drivers/auxdisplay/charlcd.c @@ -642,6 +642,9 @@ static ssize_t charlcd_write(struct file *file, const char __user *buf, charlcd_write_char(the_charlcd, c); } + if (the_charlcd->ops->flush) + the_charlcd->ops->flush(the_charlcd); + return tmp - buf; } @@ -703,6 +706,9 @@ static void charlcd_puts(struct charlcd *lcd, const char *s) charlcd_write_char(lcd, *tmp); } + + if (lcd->ops->flush) + lcd->ops->flush(lcd); } /* initialize the LCD driver */ diff --git a/include/misc/charlcd.h b/include/misc/charlcd.h index 23f61850f363..ff8fd456018e 100644 --- a/include/misc/charlcd.h +++ b/include/misc/charlcd.h @@ -32,6 +32,7 @@ struct charlcd_ops { void (*write_cmd_raw4)(struct charlcd *lcd, int cmd); /* 4-bit only */ void (*clear_fast)(struct charlcd *lcd); void (*backlight)(struct charlcd *lcd, int on); + void (*flush)(struct charlcd *lcd); }; struct charlcd *charlcd_alloc(unsigned int drvdata_size);