From: Takashi Iwai Subject: Re: Where to put code for a new ioctl. Date: Tue, 29 Nov 2005 11:53:22 +0100 Message-ID: References: <4389943D.20100@superbug.co.uk> <438B52DB.4070606@superbug.co.uk> <438B7568.2000400@superbug.co.uk> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <438B7568.2000400@superbug.co.uk> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: James Courtier-Dutton Cc: Jaroslav Kysela , alsa-devel List-Id: alsa-devel@alsa-project.org At Mon, 28 Nov 2005 21:23:52 +0000, James Courtier-Dutton wrote: > > Takashi Iwai wrote: > > > > The dB information for most drivers is static. That is, it doesn't > > have to be in kernel space at all. The whole information is known. > > > > So, what you need is to identify the driver and the matching codec, > > and to obtain the dB information (scale, resolution and offset) for > > each control element of the given configuration. > > > > In the case of user-space solution, the scenario would be like the > > following: > > The h/w configuration can be retrieved via cardinfo and card > > components (for codec ids, etc). Then, access to a database on > > user-space to obtain the dB information. The database doesn't have to > > be a too complex one. We can reuse the alsa-lib's config space and > > separate files with driver and codec ids, for example. > > This all sounds rather messy to me. If we just take the intel8x0 driver > as an example. It's controls are fixed once the kernel module has > loaded, but even knowing the controller chip and the ac97 codec being > used, one still does not have complete information. One has to then take > into account all the quirks on the different boards. We may add a quirk type to the component field as more identifier. > >>I am therefore implementing an ioctl to handle (3) in control.c. > >>Any low level driver not implementing this ioctl will simply result in > >>dB values not being shown in the alsamixer. i.e. current behavior. > >> > >>(3) can be implemented in a number of different ways. I am intending to > >>implement it in as flexible way as possible using TLVs. > > > > > > It's fine with TLV. But please don't implement it on kernel space for > > drivers without dynamic configuration. A user-space database is > > much more flexible than strictly bound to kernel drivers. > > > > Also, (4) isn't too easy in some cases. It's not always logarithmic > > linear. For example, some ac97 codecs have +gain, and it's not the > > same curve as the attenuation. In addition, some codecs have a linear > > volume. This has to be converted to log. > > > > > > Takashi > > > > > > So what about a mix of the two. > 1) kernel space adding one extra parameter to each mixer control > registration. The extra parameter will simply be: index into dB function. > > 2) alsa-lib then contains a database of all the different conversion > functions, and simply uses the "index" to select the appropriate > function for this particular gain control. > > This will add minimal complexity to the kernel modules, and at the same > time simplify the user land code. Hmm, but the handling of quirk would be equally complicated since the swap or removal is done after registration... Takashi ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click