Skip to content

drivers: Supporting driver-specific extensions to existing generic APIs #11993

@pabigot

Description

@pabigot

I frequently run into cases where I want a specific driver to support capabilities not accessible through the standard driver API. Some of these might be added to the generic API, but some are too specific. Examples include:

  • adc support calibration on Nordic SAADC peripheral
  • gpio configure multiple pins simultaneously, as with Semtech SX150x
  • ccs811 sensor manage calibration constants and update environmental state

Candidate approaches include:

  • driver-specific functions exposed to user applications through a header, e.g. <drivers/sensor/ccs811.h>
  • a generic IOCTL-like approach that would add a function pointer to struct device_config making the feature available on any driver through a common API, as with the power management commands (which would also require a header to document available commands and required data structures)

This issue is open to solicit perspectives on how this should be supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementChanges/Updates/Additions to existing featuresarea: APIChanges to public APIsarea: Drivers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions