From patchwork Thu Apr 3 23:33:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?RGF2aWQgSMODwqRyZGVtYW4=?= X-Patchwork-Id: 3934911 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B90479F369 for ; Thu, 3 Apr 2014 23:33:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E0DE420306 for ; Thu, 3 Apr 2014 23:33:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 003CF20303 for ; Thu, 3 Apr 2014 23:33:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754028AbaDCXda (ORCPT ); Thu, 3 Apr 2014 19:33:30 -0400 Received: from hardeman.nu ([95.142.160.32]:40315 "EHLO hardeman.nu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754019AbaDCXd3 (ORCPT ); Thu, 3 Apr 2014 19:33:29 -0400 Received: from zeus.hardeman.nu (unknown [IPv6:2001:a60:16f7:7000:b8ab:ce09:22ee:d164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by vader.hardeman.nu (Postfix) with ESMTPSA id C4CC8253; Fri, 4 Apr 2014 01:33:27 +0200 (CEST) Received: by zeus.hardeman.nu (Postfix, from userid 1000) id 61EAEC600FA; Fri, 4 Apr 2014 01:33:27 +0200 (CEST) Subject: [PATCH 26/49] rc-core: add an ioctl for getting IR TX settings From: David =?utf-8?b?SMOkcmRlbWFu?= To: linux-media@vger.kernel.org Cc: m.chehab@samsung.com Date: Fri, 04 Apr 2014 01:33:27 +0200 Message-ID: <20140403233327.27099.21460.stgit@zeus.muc.hardeman.nu> In-Reply-To: <20140403232420.27099.94872.stgit@zeus.muc.hardeman.nu> References: <20140403232420.27099.94872.stgit@zeus.muc.hardeman.nu> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This ioctl follows the same rationale and structure as the ioctl for getting IR RX settings (RCIOCGIRRX) but it works on TX settings instead. As with the RX ioctl, it would be nice if people could check struct rc_ir_tx carefully to make sure that their favourite parameter hasn't been left out. Signed-off-by: David Härdeman --- drivers/media/rc/rc-main.c | 12 ++++++++++++ include/media/rc-core.h | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 3ad565f..611d24d 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -1675,6 +1675,7 @@ static long rc_do_ioctl(struct rc_dev *dev, unsigned int cmd, unsigned long arg) void __user *p = (void __user *)arg; unsigned int __user *ip = (unsigned int __user *)p; struct rc_ir_rx rx; + struct rc_ir_tx tx; int error; switch (cmd) { @@ -1712,6 +1713,17 @@ static long rc_do_ioctl(struct rc_dev *dev, unsigned int cmd, unsigned long arg) return -EFAULT; return 0; + + case RCIOCGIRTX: + memset(&tx, 0, sizeof(tx)); + + if (dev->get_ir_tx) + dev->get_ir_tx(dev, &tx); + + if (copy_to_user(p, &tx, sizeof(tx))) + return -EFAULT; + + return 0; } return -EINVAL; diff --git a/include/media/rc-core.h b/include/media/rc-core.h index 09bf8b5..566ae7d 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -113,6 +113,42 @@ struct rc_ir_rx { __u32 reserved[9]; } __packed; +/* get ir tx parameters */ +#define RCIOCGIRTX _IOC(_IOC_READ, RC_IOC_MAGIC, 0x05, sizeof(struct rc_ir_tx)) + +/** + * struct rc_ir_tx - used to get all IR TX parameters in one go + * @flags: device specific flags + * @tx_supported: bitmask of supported transmitters + * @tx_enabled: bitmask of enabled transmitters + * @tx_connected: bitmask of connected transmitters + * @freq: current carrier frequency + * @freq_min: min carrier frequency + * @freq_max: max carrier frequency + * @duty: current duty cycle + * @duty_min: min duty cycle + * @duty_max: max duty cycle + * @resolution: current resolution + * @resolution_min: min resolution + * @resolution_max: max resolution + * @reserved: for future use, set to zero + */ +struct rc_ir_tx { + __u32 flags; + __u32 tx_supported; + __u32 tx_enabled; + __u32 tx_connected; + __u32 freq; + __u32 freq_min; + __u32 freq_max; + __u32 duty; + __u32 duty_min; + __u32 duty_max; + __u32 resolution; + __u32 resolution_min; + __u32 resolution_max; + __u32 reserved[9]; +} __packed; enum rc_driver_type { @@ -270,6 +306,7 @@ enum rc_filter_type { * @s_wakeup_filter: set the wakeup scancode filter * @get_ir_rx: allow driver to provide rx settings * @set_ir_rx: allow driver to change rx settings + * @get_ir_tx: allow driver to provide tx settings */ struct rc_dev { struct device dev; @@ -333,6 +370,7 @@ struct rc_dev { struct rc_scancode_filter *filter); void (*get_ir_rx)(struct rc_dev *dev, struct rc_ir_rx *rx); int (*set_ir_rx)(struct rc_dev *dev, struct rc_ir_rx *rx); + void (*get_ir_tx)(struct rc_dev *dev, struct rc_ir_tx *tx); }; #define to_rc_dev(d) container_of(d, struct rc_dev, dev)