sound/soc/sdca/sdca_hid.c
Source file repositories/reference/linux-study-clean/sound/soc/sdca/sdca_hid.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sdca/sdca_hid.c- Extension
.c- Size
- 4040 bytes
- Lines
- 169
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/byteorder/generic.hlinux/cleanup.hlinux/device.hlinux/dev_printk.hlinux/hid.hlinux/module.hlinux/property.hlinux/soundwire/sdw.hlinux/types.hsound/sdca.hsound/sdca_function.hsound/sdca_hid.hsound/sdca_interrupts.hsound/sdca_ump.h
Detected Declarations
function sdwhid_parsefunction sdwhid_startfunction sdwhid_stopfunction sdwhid_openfunction sdwhid_closefunction sdca_add_hid_devicefunction sdca_hid_process_report
Annotated Snippet
// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
/*
* The MIPI SDCA specification is available for public downloads at
* https://www.mipi.org/mipi-sdca-v1-0-download
*/
#include <linux/acpi.h>
#include <linux/byteorder/generic.h>
#include <linux/cleanup.h>
#include <linux/device.h>
#include <linux/dev_printk.h>
#include <linux/hid.h>
#include <linux/module.h>
#include <linux/property.h>
#include <linux/soundwire/sdw.h>
#include <linux/types.h>
#include <sound/sdca.h>
#include <sound/sdca_function.h>
#include <sound/sdca_hid.h>
#include <sound/sdca_interrupts.h>
#include <sound/sdca_ump.h>
static int sdwhid_parse(struct hid_device *hid)
{
struct sdca_entity *entity = hid->driver_data;
unsigned int rsize;
int ret;
rsize = le16_to_cpu(entity->hide.hid_desc.rpt_desc.wDescriptorLength);
if (!rsize || rsize > HID_MAX_DESCRIPTOR_SIZE) {
dev_err(&hid->dev, "invalid size of report descriptor (%u)\n", rsize);
return -EINVAL;
}
ret = hid_parse_report(hid, entity->hide.hid_report_desc, rsize);
if (!ret)
return 0;
dev_err(&hid->dev, "parsing report descriptor failed\n");
return ret;
}
static int sdwhid_start(struct hid_device *hid)
{
return 0;
}
static void sdwhid_stop(struct hid_device *hid)
{
}
static int sdwhid_raw_request(struct hid_device *hid, unsigned char reportnum,
__u8 *buf, size_t len, unsigned char rtype, int reqtype)
{
switch (reqtype) {
case HID_REQ_GET_REPORT:
/* not implemented yet */
return 0;
case HID_REQ_SET_REPORT:
/* not implemented yet */
return 0;
default:
return -EIO;
}
}
static int sdwhid_open(struct hid_device *hid)
{
return 0;
}
static void sdwhid_close(struct hid_device *hid)
{
}
static const struct hid_ll_driver sdw_hid_driver = {
.parse = sdwhid_parse,
.start = sdwhid_start,
.stop = sdwhid_stop,
.open = sdwhid_open,
.close = sdwhid_close,
.raw_request = sdwhid_raw_request,
};
int sdca_add_hid_device(struct device *dev, struct sdw_slave *sdw,
struct sdca_entity *entity)
{
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/byteorder/generic.h`, `linux/cleanup.h`, `linux/device.h`, `linux/dev_printk.h`, `linux/hid.h`, `linux/module.h`, `linux/property.h`.
- Detected declarations: `function sdwhid_parse`, `function sdwhid_start`, `function sdwhid_stop`, `function sdwhid_open`, `function sdwhid_close`, `function sdca_add_hid_device`, `function sdca_hid_process_report`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.