mirror of https://gitee.com/openkylin/linux.git
[media] rc: add allowed/enabled wakeup protocol masks
Only a single allowed and enabled protocol mask currently exists in struct rc_dev, however to support a separate wakeup filter protocol two of each are needed, ideally as an array. Therefore make both rc_dev::allowed_protos and rc_dev::enabled_protocols arrays, update all users to reference the first element (RC_FILTER_NORMAL), and add a couple more helper functions for drivers to use for setting the allowed and enabled wakeup protocols. We also rename allowed_protos to allowed_protocols while we're at it, which is more consistent with enabled_protocols. Signed-off-by: James Hogan <james.hogan@imgtec.com> Reviewed-by: Antti Seppälä <a.seppala@gmail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
parent
1a1934fab0
commit
acff5f2473
|
@ -830,9 +830,9 @@ static ssize_t show_protocols(struct device *device,
|
||||||
|
|
||||||
mutex_lock(&dev->lock);
|
mutex_lock(&dev->lock);
|
||||||
|
|
||||||
enabled = dev->enabled_protocols;
|
enabled = dev->enabled_protocols[RC_FILTER_NORMAL];
|
||||||
if (dev->driver_type == RC_DRIVER_SCANCODE)
|
if (dev->driver_type == RC_DRIVER_SCANCODE)
|
||||||
allowed = dev->allowed_protos;
|
allowed = dev->allowed_protocols[RC_FILTER_NORMAL];
|
||||||
else if (dev->raw)
|
else if (dev->raw)
|
||||||
allowed = ir_raw_get_allowed_protocols();
|
allowed = ir_raw_get_allowed_protocols();
|
||||||
else {
|
else {
|
||||||
|
@ -906,7 +906,7 @@ static ssize_t store_protocols(struct device *device,
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
type = dev->enabled_protocols;
|
type = dev->enabled_protocols[RC_FILTER_NORMAL];
|
||||||
|
|
||||||
while ((tmp = strsep((char **) &data, " \n")) != NULL) {
|
while ((tmp = strsep((char **) &data, " \n")) != NULL) {
|
||||||
if (!*tmp)
|
if (!*tmp)
|
||||||
|
@ -964,7 +964,7 @@ static ssize_t store_protocols(struct device *device,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->enabled_protocols = type;
|
dev->enabled_protocols[RC_FILTER_NORMAL] = type;
|
||||||
IR_dprintk(1, "Current protocol(s): 0x%llx\n",
|
IR_dprintk(1, "Current protocol(s): 0x%llx\n",
|
||||||
(long long)type);
|
(long long)type);
|
||||||
|
|
||||||
|
@ -1316,7 +1316,7 @@ int rc_register_device(struct rc_dev *dev)
|
||||||
rc = dev->change_protocol(dev, &rc_type);
|
rc = dev->change_protocol(dev, &rc_type);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto out_raw;
|
goto out_raw;
|
||||||
dev->enabled_protocols = rc_type;
|
dev->enabled_protocols[RC_FILTER_NORMAL] = rc_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&dev->lock);
|
mutex_unlock(&dev->lock);
|
||||||
|
|
|
@ -73,8 +73,10 @@ enum rc_filter_type {
|
||||||
* @input_dev: the input child device used to communicate events to userspace
|
* @input_dev: the input child device used to communicate events to userspace
|
||||||
* @driver_type: specifies if protocol decoding is done in hardware or software
|
* @driver_type: specifies if protocol decoding is done in hardware or software
|
||||||
* @idle: used to keep track of RX state
|
* @idle: used to keep track of RX state
|
||||||
* @allowed_protos: bitmask with the supported RC_BIT_* protocols
|
* @allowed_protocols: bitmask with the supported RC_BIT_* protocols for each
|
||||||
* @enabled_protocols: bitmask with the enabled RC_BIT_* protocols
|
* filter type
|
||||||
|
* @enabled_protocols: bitmask with the enabled RC_BIT_* protocols for each
|
||||||
|
* filter type
|
||||||
* @scanmask: some hardware decoders are not capable of providing the full
|
* @scanmask: some hardware decoders are not capable of providing the full
|
||||||
* scancode to the application. As this is a hardware limit, we can't do
|
* scancode to the application. As this is a hardware limit, we can't do
|
||||||
* anything with it. Yet, as the same keycode table can be used with other
|
* anything with it. Yet, as the same keycode table can be used with other
|
||||||
|
@ -124,8 +126,8 @@ struct rc_dev {
|
||||||
struct input_dev *input_dev;
|
struct input_dev *input_dev;
|
||||||
enum rc_driver_type driver_type;
|
enum rc_driver_type driver_type;
|
||||||
bool idle;
|
bool idle;
|
||||||
u64 allowed_protos;
|
u64 allowed_protocols[RC_FILTER_MAX];
|
||||||
u64 enabled_protocols;
|
u64 enabled_protocols[RC_FILTER_MAX];
|
||||||
u32 users;
|
u32 users;
|
||||||
u32 scanmask;
|
u32 scanmask;
|
||||||
void *priv;
|
void *priv;
|
||||||
|
@ -162,24 +164,38 @@ struct rc_dev {
|
||||||
|
|
||||||
static inline bool rc_protocols_allowed(struct rc_dev *rdev, u64 protos)
|
static inline bool rc_protocols_allowed(struct rc_dev *rdev, u64 protos)
|
||||||
{
|
{
|
||||||
return rdev->allowed_protos & protos;
|
return rdev->allowed_protocols[RC_FILTER_NORMAL] & protos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* should be called prior to registration or with mutex held */
|
/* should be called prior to registration or with mutex held */
|
||||||
static inline void rc_set_allowed_protocols(struct rc_dev *rdev, u64 protos)
|
static inline void rc_set_allowed_protocols(struct rc_dev *rdev, u64 protos)
|
||||||
{
|
{
|
||||||
rdev->allowed_protos = protos;
|
rdev->allowed_protocols[RC_FILTER_NORMAL] = protos;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool rc_protocols_enabled(struct rc_dev *rdev, u64 protos)
|
static inline bool rc_protocols_enabled(struct rc_dev *rdev, u64 protos)
|
||||||
{
|
{
|
||||||
return rdev->enabled_protocols & protos;
|
return rdev->enabled_protocols[RC_FILTER_NORMAL] & protos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* should be called prior to registration or with mutex held */
|
/* should be called prior to registration or with mutex held */
|
||||||
static inline void rc_set_enabled_protocols(struct rc_dev *rdev, u64 protos)
|
static inline void rc_set_enabled_protocols(struct rc_dev *rdev, u64 protos)
|
||||||
{
|
{
|
||||||
rdev->enabled_protocols = protos;
|
rdev->enabled_protocols[RC_FILTER_NORMAL] = protos;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* should be called prior to registration or with mutex held */
|
||||||
|
static inline void rc_set_allowed_wakeup_protocols(struct rc_dev *rdev,
|
||||||
|
u64 protos)
|
||||||
|
{
|
||||||
|
rdev->allowed_protocols[RC_FILTER_WAKEUP] = protos;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* should be called prior to registration or with mutex held */
|
||||||
|
static inline void rc_set_enabled_wakeup_protocols(struct rc_dev *rdev,
|
||||||
|
u64 protos)
|
||||||
|
{
|
||||||
|
rdev->enabled_protocols[RC_FILTER_WAKEUP] = protos;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue