All of lore.kernel.org
 help / color / mirror / Atom feed
* Hardware-specific IOCTLs
@ 2012-01-13 16:22 Ivan Bublikov
  2012-01-13 17:31 ` Clemens Ladisch
  0 siblings, 1 reply; 4+ messages in thread
From: Ivan Bublikov @ 2012-01-13 16:22 UTC (permalink / raw)
  To: alsa-devel

Message body
Hello All,
 
My question is about how to allocate a new hardware-specific IOCTL code. For example, the HDA driver consists of common HDA code and vendor-specific codes for various HDA codecs. As an HDA codec vendor, I want to be able to control some functionality in my codec, that is not present in codecs from other vendors. For this, I want to implement a special IOCTL in my vendor-specific code. I understand that I can register an IOCTL handler using snd_ctl_register_ioctl. My difficulty is how to define a code for my IOCTL and avoid a conflict with the common code in the future.
 
Looking at header files, I see  common "ALSA" audio IOCTLs starting with letter 'A', and "HWDEP" IOCTLs starting with letter 'H'. Some of H-IOCTLs are defined in asound.h, starting at offset 0, and some in hda_hwdep.h and sb16_csp.h starting at offset 0x10. My guess is that the latter start at 0x10 to give some expansion room for H-IOCTLs in asound.h...?
 
I think I need some offset range in H-IOCTLs or a new IOCTL family with another letter, officially reserved for such codec-specific IOCTLs. Any suggestions?
 
Best regards,
Ivan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hardware-specific IOCTLs
  2012-01-13 16:22 Hardware-specific IOCTLs Ivan Bublikov
@ 2012-01-13 17:31 ` Clemens Ladisch
  2012-01-13 22:45   ` Ivan Bublikov
  0 siblings, 1 reply; 4+ messages in thread
From: Clemens Ladisch @ 2012-01-13 17:31 UTC (permalink / raw)
  To: Ivan Bublikov; +Cc: alsa-devel

Ivan Bublikov wrote:
> As an HDA codec vendor, I want to be able to control some functionality
> in my codec, that is not present in codecs from other vendors.  [...]
> I can register an IOCTL handler using snd_ctl_register_ioctl.

This functions is for ioctl calls on the ctl device, which is global
for one sound card and is not appropriate if one wants to address
something like a PCM device or a codec.

For a HDA codec, use a hwdep device.

> My difficulty is how to define a code for my IOCTL and avoid
> a conflict with the common code in the future.

Pick something not yet allocated in Documentation/ioctl/ioctl-number.txt.


Regards,
Clemens

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hardware-specific IOCTLs
  2012-01-13 17:31 ` Clemens Ladisch
@ 2012-01-13 22:45   ` Ivan Bublikov
  2012-01-17 22:02     ` Clemens Ladisch
  0 siblings, 1 reply; 4+ messages in thread
From: Ivan Bublikov @ 2012-01-13 22:45 UTC (permalink / raw)
  To: alsa-devel



> From: Clemens Ladisch <clemens@ladisch.de>
> 
> Ivan Bublikov wrote:
>> As an HDA codec vendor, I want to be able to control some functionality
>> in my codec, that is not present in codecs from other vendors.  [...]
>> I can register an IOCTL handler using snd_ctl_register_ioctl.
> 
> This functions is for ioctl calls on the ctl device, which is global
> for one sound card and is not appropriate if one wants to address
> something like a PCM device or a codec.
> 
> For a HDA codec, use a hwdep device.

OK, I understand I simply need to add a new case in hda_hwdep_ioctl().

>> My difficulty is how to define a code for my IOCTL and avoid
>> a conflict with the common code in the future.
> 
> Pick something not yet allocated in Documentation/ioctl/ioctl-number.txt.

Since half of the lines in it are marked "Conflict!" anyway, should I only pay attention to not conflict with "sound/*" lines?  And then add a new line for my IOCTLs? And should I put my IOCTL definitions in hda_hwdep.h or create a new file?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hardware-specific IOCTLs
  2012-01-13 22:45   ` Ivan Bublikov
@ 2012-01-17 22:02     ` Clemens Ladisch
  0 siblings, 0 replies; 4+ messages in thread
From: Clemens Ladisch @ 2012-01-17 22:02 UTC (permalink / raw)
  To: alsa-devel

Ivan Bublikov wrote:
>> Ivan Bublikov wrote:
>>> My difficulty is how to define a code for my IOCTL and avoid
>>> a conflict with the common code in the future.
>>
>> Pick something not yet allocated in Documentation/ioctl/ioctl-number.txt.
>
> Since half of the lines in it are marked "Conflict!" anyway, should
> I only pay attention to not conflict with "sound/*" lines?

There are enough free codes so that you do not need to introduce new
conflicts.

>  And then add a new line for my IOCTLs?

Yes.

> And should I put my IOCTL definitions in hda_hwdep.h or create a new
> file?

If you go through the existing HDA hwdep device, your ioctls probably
should go into the same header.


Regards,
Clemens

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-17 22:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-13 16:22 Hardware-specific IOCTLs Ivan Bublikov
2012-01-13 17:31 ` Clemens Ladisch
2012-01-13 22:45   ` Ivan Bublikov
2012-01-17 22:02     ` Clemens Ladisch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.