All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David Härdeman" <david@hardeman.nu>
To: linux-media@vger.kernel.org
Cc: mchehab@redhat.com, jarod@redhat.com
Subject: [PATCH 23/43] rc-loopback: add RCIOCSIRTX ioctl support
Date: Wed, 23 May 2012 11:44:01 +0200	[thread overview]
Message-ID: <20120523094401.14474.23948.stgit@felix.hardeman.nu> (raw)
In-Reply-To: <20120523094157.14474.24367.stgit@felix.hardeman.nu>

As an example, this patch adds support for the new RCIOCSIRTX ioctl
to rc-loopback and removes deprecated functions without a loss in
functionality (as LIRC will automatically use the new functions).

Signed-off-by: David Härdeman <david@hardeman.nu>
---
 drivers/media/rc/rc-loopback.c |   59 +++++++++++++---------------------------
 1 file changed, 19 insertions(+), 40 deletions(-)

diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c
index a04b39b..de9a75e 100644
--- a/drivers/media/rc/rc-loopback.c
+++ b/drivers/media/rc/rc-loopback.c
@@ -49,43 +49,6 @@ struct loopback_dev {
 
 static struct loopback_dev loopdev;
 
-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) {
-		dprintk("invalid tx mask: %u\n", mask);
-		return -EINVAL;
-	}
-
-	dprintk("setting tx mask: %u\n", mask);
-	lodev->txmask = mask;
-	return 0;
-}
-
-static int loop_set_tx_carrier(struct rc_dev *dev, u32 carrier)
-{
-	struct loopback_dev *lodev = dev->priv;
-
-	dprintk("setting tx carrier: %u\n", carrier);
-	lodev->txcarrier = carrier;
-	return 0;
-}
-
-static int loop_set_tx_duty_cycle(struct rc_dev *dev, u32 duty_cycle)
-{
-	struct loopback_dev *lodev = dev->priv;
-
-	if (duty_cycle < 1 || duty_cycle > 99) {
-		dprintk("invalid duty cycle: %u\n", duty_cycle);
-		return -EINVAL;
-	}
-
-	dprintk("setting duty cycle: %u\n", duty_cycle);
-	lodev->txduty = duty_cycle;
-	return 0;
-}
-
 static int loop_tx_ir(struct rc_dev *dev)
 {
 	struct loopback_dev *lodev = dev->priv;
@@ -221,6 +184,24 @@ static void loop_get_ir_tx(struct rc_dev *dev, struct rc_ir_tx *tx)
 	tx->resolution_max = 1;
 }
 
+/**
+ * loop_set_ir_tx() - changes and returns the current TX settings
+ * @dev: the &struct rc_dev to change the settings for
+ * @tx: the &struct rc_ir_tx with the new settings
+ *
+ * This function is used to change and return the current TX settings.
+ */
+static int loop_set_ir_tx(struct rc_dev *dev, struct rc_ir_tx *tx)
+{
+	struct loopback_dev *lodev = dev->priv;
+
+	lodev->txmask = tx->tx_enabled & (RXMASK_REGULAR | RXMASK_LEARNING);
+	lodev->txcarrier = tx->freq;
+	lodev->txduty = tx->duty;
+
+	return 0;
+}
+
 static int __init loop_init(void)
 {
 	struct rc_dev *rc;
@@ -246,14 +227,12 @@ static int __init loop_init(void)
 	rc->max_timeout		= UINT_MAX;
 	rc->rx_resolution	= 1000;
 	rc->tx_resolution	= 1000;
-	rc->s_tx_mask		= loop_set_tx_mask;
-	rc->s_tx_carrier	= loop_set_tx_carrier;
-	rc->s_tx_duty_cycle	= loop_set_tx_duty_cycle;
 	rc->tx_ir		= loop_tx_ir;
 	rc->s_idle		= loop_set_idle;
 	rc->get_ir_rx		= loop_get_ir_rx;
 	rc->set_ir_rx		= loop_set_ir_rx;
 	rc->get_ir_tx		= loop_get_ir_tx;
+	rc->set_ir_tx		= loop_set_ir_tx;
 
 	loopdev.txmask		= RXMASK_REGULAR;
 	loopdev.txcarrier	= 36000;


  parent reply	other threads:[~2012-05-23  9:54 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-23  9:42 [PATCH 00/43] rc-core: feature parity with LIRC David Härdeman
2012-05-23  9:42 ` [PATCH 01/43] rc-core: move timeout and checks to lirc David Härdeman
2012-05-23  9:42 ` [PATCH 02/43] rc-core: add separate defines for protocol bitmaps and numbers David Härdeman
2012-05-23  9:42 ` [PATCH 03/43] rc-core: don't throw away protocol information David Härdeman
2012-05-23  9:42 ` [PATCH 04/43] rc-core: use the full 32 bits for NEC scancodes David Härdeman
2012-05-23  9:42 ` [PATCH 05/43] rc-core: merge rc5 and streamzap decoders David Härdeman
2012-05-23  9:42 ` [PATCH 06/43] rc-core: rename ir_input_class to rc_class David Härdeman
2012-05-23  9:42 ` [PATCH 07/43] rc-core: initialize rc-core earlier if built-in David Härdeman
2012-05-23  9:42 ` [PATCH 08/43] rc-core: use a device table rather than an atomic number David Härdeman
2012-05-23  9:42 ` [PATCH 09/43] rc-core: add chardev David Härdeman
2012-05-23  9:42 ` [PATCH 10/43] rc-core: allow chardev to be read David Härdeman
2012-05-23  9:42 ` [PATCH 11/43] mceusb: remove pointless kmalloc David Härdeman
2012-05-23  9:43 ` [PATCH 12/43] redrat: cleanup debug functions David Härdeman
2012-05-23  9:43 ` [PATCH 13/43] rc-core: use a kfifo for TX data David Härdeman
2012-05-23  9:43 ` [PATCH 14/43] rc-core: allow chardev to be written David Härdeman
2012-05-23  9:43 ` [PATCH 15/43] rc-core: add ioctl support to the rc chardev David Härdeman
2012-05-23  9:43 ` [PATCH 16/43] rc-core: add an ioctl for getting IR RX settings David Härdeman
2012-05-23  9:43 ` [PATCH 17/43] rc-loopback: add RCIOCGIRRX ioctl support David Härdeman
2012-05-23  9:43 ` [PATCH 18/43] rc-core: add an ioctl for setting IR RX settings David Härdeman
2012-05-23  9:43 ` [PATCH 19/43] rc-loopback: add RCIOCSIRRX ioctl support David Härdeman
2012-05-23  9:43 ` [PATCH 20/43] rc-core: add an ioctl for getting IR TX settings David Härdeman
2012-05-23  9:43 ` [PATCH 21/43] rc-loopback: add RCIOCGIRTX ioctl support David Härdeman
2012-05-23  9:43 ` [PATCH 22/43] rc-core: add an ioctl for setting IR TX settings David Härdeman
2012-05-23  9:44 ` David Härdeman [this message]
2012-05-23  9:44 ` [PATCH 24/43] rc-core: leave the internals of rc_dev alone David Härdeman
2012-05-23  9:44 ` [PATCH 25/43] rc-core: prepare for multiple keytables David Härdeman
2012-05-23  9:44 ` [PATCH 26/43] rc-core: do not take mutex on rc_dev registration David Härdeman
2012-05-23  9:44 ` [PATCH 27/43] rc-core: make the keytable of rc_dev an array David Härdeman
2012-05-23  9:44 ` [PATCH 28/43] rc-core: add ioctls for adding/removing keytables from userspace David Härdeman
2012-05-23  9:44 ` [PATCH 29/43] rc-core: remove redundant spinlock David Härdeman
2012-05-23  9:44 ` [PATCH 30/43] rc-core: make keytable RCU-friendly David Härdeman
2012-05-23  9:44 ` [PATCH 31/43] rc-core: allow empty keymaps David Härdeman
2012-05-23  9:44 ` [PATCH 32/43] rc-core: split IR raw handling to a separate module David Härdeman
2012-05-23  9:44 ` [PATCH 33/43] rc-ir-raw: simplify locking David Härdeman
2012-05-23  9:44 ` [PATCH 34/43] rc-core: rename mutex David Härdeman
2012-05-23  9:45 ` [PATCH 35/43] rc-ir-raw: atomic reads of protocols David Härdeman
2012-05-23  9:45 ` [PATCH 36/43] rc-core: fix various sparse warnings David Härdeman
2012-05-23  9:45 ` [PATCH 37/43] rc-core: don't report scancodes via input devices David Härdeman
2012-05-23  9:45 ` [PATCH 38/43] rc-ir-raw: add various rc_events David Härdeman
2012-05-23  9:45 ` [PATCH 39/43] rc-core: use struct rc_event to signal TX events from userspace David Härdeman
2012-05-23  9:45 ` [PATCH 40/43] rc-core: use struct rc_event for all rc communication David Härdeman
2012-05-23  9:45 ` [PATCH 41/43] rc-core: add keytable events David Härdeman
2012-05-23  9:45 ` [PATCH 42/43] rc-core: move remaining keytable functions David Härdeman
2012-05-23  9:45 ` [PATCH 43/43] rc-core: make rc-core.h userspace friendly David Härdeman
2012-06-22 17:37 ` [PATCH 00/43] rc-core: feature parity with LIRC Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120523094401.14474.23948.stgit@felix.hardeman.nu \
    --to=david@hardeman.nu \
    --cc=jarod@redhat.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.