mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:46:16 +00:00
ee27f44e15
Pass stm source type via stm_write() to allow different handling on protocol level. The measure above should allow protocol level encoder to differentiate and accordingly pack the messages. As an example SyS-T might get use of ftrace message ID's and instead of applying regular header, pack them as SyS-T catalog or SyS-T Structured Binary Data message to allow proper decoding on the other side. Signed-off-by: Mikhail Lappo <miklelappo@gmail.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20240429130119.1518073-4-alexander.shishkin@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
50 lines
1.1 KiB
C
50 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Basic framing protocol for STM devices.
|
|
* Copyright (c) 2018, Intel Corporation.
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/device.h>
|
|
#include <linux/stm.h>
|
|
#include "stm.h"
|
|
|
|
static ssize_t basic_write(struct stm_data *data, struct stm_output *output,
|
|
unsigned int chan, const char *buf, size_t count,
|
|
struct stm_source_data *source)
|
|
{
|
|
unsigned int c = output->channel + chan;
|
|
unsigned int m = output->master;
|
|
const unsigned char nil = 0;
|
|
ssize_t sz;
|
|
|
|
sz = stm_data_write(data, m, c, true, buf, count);
|
|
if (sz > 0)
|
|
data->packet(data, m, c, STP_PACKET_FLAG, 0, 0, &nil);
|
|
|
|
return sz;
|
|
}
|
|
|
|
static const struct stm_protocol_driver basic_pdrv = {
|
|
.owner = THIS_MODULE,
|
|
.name = "p_basic",
|
|
.write = basic_write,
|
|
};
|
|
|
|
static int basic_stm_init(void)
|
|
{
|
|
return stm_register_protocol(&basic_pdrv);
|
|
}
|
|
|
|
static void basic_stm_exit(void)
|
|
{
|
|
stm_unregister_protocol(&basic_pdrv);
|
|
}
|
|
|
|
module_init(basic_stm_init);
|
|
module_exit(basic_stm_exit);
|
|
|
|
MODULE_LICENSE("GPL v2");
|
|
MODULE_DESCRIPTION("Basic STM framing protocol driver");
|
|
MODULE_AUTHOR("Alexander Shishkin <alexander.shishkin@linux.intel.com>");
|