media: rc: rename s_learning_mode() to s_wideband_receiver()

The s_learning_mode() function is called in response to the ioctl
LIRC_SET_WIDEBAND_RECEIVER, so rename it to s_wideband_receiver().

Learning mode is when both the wideband receiver is turned on and
carrier reports are enabled.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Sean Young 2021-07-03 11:04:40 +02:00 коммит произвёл Mauro Carvalho Chehab
Родитель 50634548d3
Коммит 8b777edff0
5 изменённых файлов: 22 добавлений и 22 удалений

Просмотреть файл

@ -1052,7 +1052,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
rdev->device_name = "ENE eHome Infrared Remote Receiver";
if (dev->hw_learning_and_tx_capable) {
rdev->s_learning_mode = ene_set_learning_mode;
rdev->s_wideband_receiver = ene_set_learning_mode;
init_completion(&dev->tx_complete);
rdev->tx_ir = ene_transmit;
rdev->s_tx_mask = ene_set_tx_mask;

Просмотреть файл

@ -412,7 +412,7 @@ static long lirc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
val |= LIRC_CAN_SET_REC_CARRIER |
LIRC_CAN_SET_REC_CARRIER_RANGE;
if (dev->s_learning_mode)
if (dev->s_wideband_receiver)
val |= LIRC_CAN_USE_WIDEBAND_RECEIVER;
if (dev->s_carrier_report)
@ -519,10 +519,10 @@ static long lirc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
break;
case LIRC_SET_WIDEBAND_RECEIVER:
if (!dev->s_learning_mode)
if (!dev->s_wideband_receiver)
ret = -ENOTTY;
else
ret = dev->s_learning_mode(dev, !!val);
ret = dev->s_wideband_receiver(dev, !!val);
break;
case LIRC_SET_MEASURE_CARRIER_MODE:

Просмотреть файл

@ -1630,7 +1630,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
rc->tx_ir = mceusb_tx_ir;
}
if (ir->flags.rx2 > 0) {
rc->s_learning_mode = mceusb_set_rx_wideband;
rc->s_wideband_receiver = mceusb_set_rx_wideband;
rc->s_carrier_report = mceusb_set_rx_carrier_report;
}
rc->driver_name = DRIVER_NAME;

Просмотреть файл

@ -15,9 +15,9 @@
#include <linux/slab.h>
#include <media/rc-core.h>
#define DRIVER_NAME "rc-loopback"
#define RXMASK_REGULAR 0x1
#define RXMASK_LEARNING 0x2
#define DRIVER_NAME "rc-loopback"
#define RXMASK_NARROWBAND 0x1
#define RXMASK_WIDEBAND 0x2
struct loopback_dev {
struct rc_dev *dev;
@ -25,7 +25,7 @@ struct loopback_dev {
u32 txcarrier;
u32 txduty;
bool idle;
bool learning;
bool wideband;
bool carrierreport;
u32 rxcarriermin;
u32 rxcarriermax;
@ -37,7 +37,7 @@ static int loop_set_tx_mask(struct rc_dev *dev, u32 mask)
{
struct loopback_dev *lodev = dev->priv;
if ((mask & (RXMASK_REGULAR | RXMASK_LEARNING)) != mask) {
if ((mask & (RXMASK_NARROWBAND | RXMASK_WIDEBAND)) != mask) {
dev_dbg(&dev->dev, "invalid tx mask: %u\n", mask);
return 2;
}
@ -98,10 +98,10 @@ static int loop_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count)
goto out;
}
if (lodev->learning)
rxmask = RXMASK_LEARNING;
if (lodev->wideband)
rxmask = RXMASK_WIDEBAND;
else
rxmask = RXMASK_REGULAR;
rxmask = RXMASK_NARROWBAND;
if (!(rxmask & lodev->txmask)) {
dev_dbg(&dev->dev, "ignoring tx, rx mask mismatch\n");
@ -144,13 +144,13 @@ static void loop_set_idle(struct rc_dev *dev, bool enable)
}
}
static int loop_set_learning_mode(struct rc_dev *dev, int enable)
static int loop_set_wideband_receiver(struct rc_dev *dev, int enable)
{
struct loopback_dev *lodev = dev->priv;
if (lodev->learning != enable) {
dev_dbg(&dev->dev, "%sing learning mode\n", enable ? "enter" : "exit");
lodev->learning = !!enable;
if (lodev->wideband != enable) {
dev_dbg(&dev->dev, "using %sband receiver\n", enable ? "wide" : "narrow");
lodev->wideband = !!enable;
}
return 0;
@ -233,17 +233,17 @@ static int __init loop_init(void)
rc->s_rx_carrier_range = loop_set_rx_carrier_range;
rc->tx_ir = loop_tx_ir;
rc->s_idle = loop_set_idle;
rc->s_learning_mode = loop_set_learning_mode;
rc->s_wideband_receiver = loop_set_wideband_receiver;
rc->s_carrier_report = loop_set_carrier_report;
rc->s_wakeup_filter = loop_set_wakeup_filter;
loopdev.txmask = RXMASK_REGULAR;
loopdev.txmask = RXMASK_NARROWBAND;
loopdev.txcarrier = 36000;
loopdev.txduty = 50;
loopdev.rxcarriermin = 1;
loopdev.rxcarriermax = ~0;
loopdev.idle = true;
loopdev.learning = false;
loopdev.wideband = false;
loopdev.carrierreport = false;
ret = rc_register_device(rc);

Просмотреть файл

@ -151,7 +151,7 @@ struct lirc_fh {
* @tx_ir: transmit IR
* @s_idle: enable/disable hardware idle mode, upon which,
* device doesn't interrupt host until it sees IR pulses
* @s_learning_mode: enable wide band receiver used for learning
* @s_wideband_receiver: enable wide band receiver used for learning
* @s_carrier_report: enable carrier reports
* @s_filter: set the scancode filter
* @s_wakeup_filter: set the wakeup scancode filter. If the mask is zero
@ -218,7 +218,7 @@ struct rc_dev {
int (*s_rx_carrier_range)(struct rc_dev *dev, u32 min, u32 max);
int (*tx_ir)(struct rc_dev *dev, unsigned *txbuf, unsigned n);
void (*s_idle)(struct rc_dev *dev, bool enable);
int (*s_learning_mode)(struct rc_dev *dev, int enable);
int (*s_wideband_receiver)(struct rc_dev *dev, int enable);
int (*s_carrier_report) (struct rc_dev *dev, int enable);
int (*s_filter)(struct rc_dev *dev,
struct rc_scancode_filter *filter);