Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/misc/bt-host: Add ioctl() for SMSATN #4

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions drivers/misc/bt-host.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/miscdevice.h>
#include <linux/timer.h>
#include <linux/jiffies.h>
#include <linux/bt-host.h>

#define DEVICE_NAME "bt"
#define BT_NUM_DEVS 1
Expand Down Expand Up @@ -101,6 +102,11 @@ static void clr_b_busy(struct bt_host *bt_host)
bt_outb(bt_host, BT_CTRL_B_BUSY, BT_CTRL);
}

static void set_sms_atn(struct bt_host *bt_host)
{
bt_outb(bt_host, BT_CTRL_SMS_ATN, BT_CTRL);
}

static void set_b2h_atn(struct bt_host *bt_host)
{
bt_outb(bt_host, BT_CTRL_B2H_ATN, BT_CTRL);
Expand Down Expand Up @@ -231,13 +237,24 @@ static unsigned int bt_host_poll(struct file *file, poll_table *wait)
return mask;
}

static long bt_host_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
switch (cmd) {
case BT_HOST_IOCTL_SMS_ATN:
set_sms_atn(bt_host);
return 0;
default:
return -ENOIOCTLCMD;
}
}
static const struct file_operations bt_host_fops = {
.owner = THIS_MODULE,
.open = bt_host_open,
.read = bt_host_read,
.write = bt_host_write,
.release = bt_host_release,
.poll = bt_host_poll,
.unlocked_ioctl = bt_host_ioctl,
};

static struct miscdevice bt_host_miscdev = {
Expand Down
1 change: 1 addition & 0 deletions include/uapi/linux/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ header-y += bpf_common.h
header-y += bpf.h
header-y += bpqether.h
header-y += bsg.h
header-y += bt-host.h
header-y += btrfs.h
header-y += can.h
header-y += capability.h
Expand Down
16 changes: 16 additions & 0 deletions include/uapi/linux/bt-host.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* include/linux/bt-host.h
*
*/

#ifndef _UAPI_LINUX_BT_HOST_H
#define _UAPI_LINUX_BT_HOST_H

#include <linux/types.h>
#include <linux/ioctl.h>
#include <linux/irqnr.h>

#define BT_HOST_IOCTL_MAGIC 0xb1
#define BT_HOST_IOCTL_SMS_ATN _IO( BT_HOST_IOCTL_MAGIC, 0x00 )

#endif /* _UAPI_LINUX_BT_HOST_H */