From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 43A95C433EF for ; Thu, 12 May 2022 09:55:59 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 51C9D1941; Thu, 12 May 2022 11:55:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 51C9D1941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1652349357; bh=OIK0kZYBM7Gz/GythPSJ1p0v/c/x6YG4hX0YyPqJpIw=; h=Date:From:To:Subject:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YIZ47KW6ZdVwZk8iIBDxeYa9FqRV40iM/9BqXBd6L5nqZfCit1ZACCNc9UAIkW9Vb 5SMQ2I+9Ws6PK4Jgs5k/aZJd0bOQTOQLRM/47Er9WyhMpHbcxHnKa7Ytn+dJrLB3ha lobC/KdsHz6WHU0OMAj7BQIEjxCzgkQPvd2wHRzo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id F08A6F80154; Thu, 12 May 2022 11:55:06 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C567CF800BB; Thu, 12 May 2022 11:55:05 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 220D2F800BB for ; Thu, 12 May 2022 11:55:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 220D2F800BB Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="TH7Xk7G6"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="M+u7rlAR" Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id AA1AB1F8C9; Thu, 12 May 2022 09:55:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1652349302; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mvsLWkdnsom47iYa6LwFEPqruONRlnQhyPnRuMzFJOA=; b=TH7Xk7G6VUrJaS08AkqlmKz3kC22fNGKCMTsbChPc0UZP2qQUQU6m5Gf5GXJiWqUKG6MvE tNhSC/chvXIkE7xUiNq3QCwU3tepyILE6jWuq3PW52Do8hCUW0EL5siwH80xHydg2iPMQl BFbvh92BusmQeyZjGYcNQG37aKE1YXs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1652349302; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mvsLWkdnsom47iYa6LwFEPqruONRlnQhyPnRuMzFJOA=; b=M+u7rlARL2l5kjfm3Qx4O5UVSpUFet4OtNqc4mTWf1Shc+0yqADvOk9eEjRbM1g3sffZ3H cqeRR+pPJcsft+DA== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 9E8662C141; Thu, 12 May 2022 09:55:02 +0000 (UTC) Date: Thu, 12 May 2022 11:55:02 +0200 Message-ID: From: Takashi Iwai To: Daniel Kaehn Subject: Re: [PATCH v7 0/2] Add generic serial MIDI driver using serial bus API In-Reply-To: <20220509145933.1161526-1-kaehndan@gmail.com> References: <20220509145933.1161526-1-kaehndan@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: robh@kernel.org, alsa-devel@alsa-project.org, tiwai@suse.com, devicetree@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Mon, 09 May 2022 16:59:31 +0200, Daniel Kaehn wrote: > > Generic serial MIDI driver adding support for using serial devices > compatible with the serial bus as raw MIDI devices, allowing using > additional serial devices not compatible with the existing > serial-u16550 driver. Supports only setting standard serial baudrates on > the underlying serial device; however, the underlying serial device can > be configured so that a requested 38.4 kBaud is actually the standard MIDI > 31.25 kBaud. Supports DeviceTree configuration. > > Changes in v7: > - Separate examples in dt-binding to remove need to specify unit name > (fixing dt_binding_check error) > > Changes in v6: > - Change compatible "serialmidi" -> serial-midi" > - Default current-speed to 38400 (closest baud to MIDI standard speed) > - Appropriately stop reading or writing MIDI if input or output > _trigger() is called with a parameter of zero, respectively > - Zero out corresponding triggered state on close to ensure input and > output closing results in the serial port being closed > - Fix order of operations in _probe() > - Remove "DEBUG" literal from debug messages > - Remove unused dt-parsing patch checking for existence of node > - Whitespace / tabbing fixes / improvements > > Changes in v5: > - Reword description in dt-binding for clarity > - Change 'speed' dt property to standard 'current-speed' > - Move MIDI output loop onto workqueue (since this could loop quite a while, > if ALSA provides a continuous stream of bytes) > - Add tx_state bit flags to snd_serial_generic struct > - Safegard critical section in tx_work with atomic bit ops on tx_state > - Switch operations on filemode to use atomic bit ops > > Changes in v4: > - Fix regressed typo - Correct 3.84 kBaud -> 38.4 kBaud in DT & Kconfig > (sorry about spam - noticed after sending v3 and didn't want to let > the error sit around for too long) > > Changes in v3: > - Replace use of snd_printk() with dev_* alternatives > - Removed unnecessary initialization of err variables > - Replaced instances of `== SERIAL_MODE_NOT_OPENED` with zero check > - Loop on output_write to completely fill output buffer if data available > - Depend on CONFIG_OF in Kconfig > - Replace use of devm_kzalloc() with extra_size allocation in snd_devm_card_new() > - Use module_serdev_device_driver() instead of module_init() and module_exit(0) > > Changes in v2: > - Fix 'snd_serial_generic_write_wakeup' missing static keyword > - Correct 3.125 kBaud > 31.25 kBaud in documentation for MIDI > > > The need for this driver arose from a project using a Raspberry Pi4 which > needed to receive and send raw MIDI with low latency. The pl011 UART > used is not compatible with the existing serial MIDI driver made for > u16550-style devices. Using a userspace program such as ttymidi to feed > input from the TTY device to a virtual ALSA MIDI device was functional, > but not ideal. > > I am not sure if a MIDI driver needing the mentioned 'hack' to clock > 38.4 kBaud down to the standard MIDI baud is permissible in the mainline > kernel, but am submitting nevertheless in case it is useful. To my knowledge, > it doesn't seem that there would be any way for this driver to manually > configure a serial port to 31.25 kBaud using the serial bus API (please > correct me f I'm wrong). In my use case, I am actually configuring one port > to run at 115.2 kBaud for faster communication with a custom onboard MIDI controller. > > Daniel Kaehn (2): > dt-bindings: sound: Add generic serial MIDI device > Add generic serial MIDI driver using serial bus API Now applied both patches to for-next branch. thanks, Takashi