linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: rc:     Add support for another 0xffdc device
@ 2019-09-14  8:54 pretoriano80
  2019-09-14 17:20 ` kbuild test robot
  0 siblings, 1 reply; 4+ messages in thread
From: pretoriano80 @ 2019-09-14  8:54 UTC (permalink / raw)
  To: sean; +Cc: linux-media

The device it's an iMON UltraBay (0x98 in config byte) with LCD,
IR and dual-knobs front panel.

To work properly the device also require its own key table,
and repeat suppression for all buttons.

Signed-off-by: pretoriano80 <viusflag@libero.it>
---
 drivers/media/rc/imon.c | 44 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 7bee72108b0e..3b29e0815610 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -83,6 +83,7 @@ struct imon_usb_dev_descr {
 	__u16 flags;
 #define IMON_NO_FLAGS 0
 #define IMON_NEED_20MS_PKT_DELAY 1
+#define IMON_SUPPRESS_REPEATED_KEYS 2
 	struct imon_panel_key_table key_table[];
 };
 
@@ -315,6 +316,32 @@ static const struct imon_usb_dev_descr imon_DH102 = {
 	}
 };
 
+/* imon ultrabay front panel key table */
+static const struct imon_usb_dev_descr imon_ultrabay_table = {
+	.flags = IMON_SUPPRESS_REPEATED_KEYS,
+	.key_table = {
+		{ 0x0000000f0000ffeell, KEY_MEDIA },      /* Go */
+		{ 0x000000000100ffeell, KEY_UP },
+		{ 0x000000000001ffeell, KEY_DOWN },
+		{ 0x000000160000ffeell, KEY_ENTER },
+		{ 0x0000001f0000ffeell, KEY_AUDIO },	/* Music */
+		{ 0x000000200000ffeell, KEY_VIDEO },	/* Movie */
+		{ 0x000000210000ffeell, KEY_CAMERA },	/* Photo */
+		{ 0x000000270000ffeell, KEY_DVD },
+		{ 0x000000230000ffeell, KEY_TV },
+		{ 0x000000050000ffeell, KEY_PREVIOUS },
+		{ 0x000000070000ffeell, KEY_REWIND },
+		{ 0x000000040000ffeell, KEY_STOP },
+		{ 0x000000020000ffeell, KEY_PLAYPAUSE },
+		{ 0x000000080000ffeell, KEY_FASTFORWARD },
+		{ 0x000000060000ffeell, KEY_NEXT },
+		{ 0x000100000000ffeell, KEY_VOLUMEUP },
+		{ 0x010000000000ffeell, KEY_VOLUMEDOWN },
+		{ 0x000000010000ffeell, KEY_MUTE },
+		{ 0, KEY_RESERVED },
+	}
+};
+
 /*
  * USB Device ID for iMON USB Control Boards
  *
@@ -1661,6 +1688,17 @@ static void imon_incoming_packet(struct imon_context *ictx,
 			return;
 		}
 	}
+	/* KEY repeats from knob need to be suppressed */
+	if (ictx->dev_descr->flags & IMON_SUPPRESS_REPEATED_KEYS) {
+		if (ictx->kc == ictx->last_keycode) {
+			msec = ktime_ms_delta(t, prev_time);
+			if (msec < ictx->idev->rep[REP_DELAY]) {
+				spin_unlock_irqrestore(&ictx->kc_lock, flags);
+				return;
+			}
+		}
+	}
+
 	prev_time = t;
 	kc = ictx->kc;
 
@@ -1843,6 +1881,12 @@ static void imon_get_ffdc_type(struct imon_context *ictx)
 		dev_info(ictx->dev, "0xffdc iMON Inside, iMON IR");
 		ictx->display_supported = false;
 		break;
+	/* Soundgraph iMON UltraBay */
+	case 0x98:
+		dev_info(ictx->dev, "0xffdc iMON UltraBay, LCD + IR");
+		detected_display_type = IMON_DISPLAY_TYPE_LCD;
+		allowed_protos = RC_PROTO_BIT_IMON | RC_PROTO_BIT_RC6_MCE;
+		ictx->dev_descr = (struct imon_usb_dev_descr *) &imon_ultrabay_table;
 	default:
 		dev_info(ictx->dev, "Unknown 0xffdc device, defaulting to VFD and iMON IR");
 		detected_display_type = IMON_DISPLAY_TYPE_VFD;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] media: rc:     Add support for another 0xffdc device
  2019-09-14  8:54 [PATCH] media: rc: Add support for another 0xffdc device pretoriano80
@ 2019-09-14 17:20 ` kbuild test robot
  2019-09-14 22:40   ` [PATCH v2] " pretoriano80
  0 siblings, 1 reply; 4+ messages in thread
From: kbuild test robot @ 2019-09-14 17:20 UTC (permalink / raw)
  To: pretoriano80; +Cc: kbuild-all, sean, linux-media

[-- Attachment #1: Type: text/plain, Size: 4844 bytes --]

Hi pretoriano80,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[cannot apply to v5.3-rc8 next-20190904]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/pretoriano80/media-rc-Add-support-for-another-0xffdc-device/20190914-235639
base:   git://linuxtv.org/media_tree.git master
config: i386-randconfig-g003-201937 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-11) 7.4.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/media/rc/imon.c: In function 'imon_get_ffdc_type':
>> drivers/media/rc/imon.c:1894:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
      ictx->dev_descr = (struct imon_usb_dev_descr *) &imon_ultrabay_table;
      ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/rc/imon.c:1895:2: note: here
     default:
     ^~~~~~~

vim +1894 drivers/media/rc/imon.c

  1825	
  1826	/*
  1827	 * The 0x15c2:0xffdc device ID was used for umpteen different imon
  1828	 * devices, and all of them constantly spew interrupts, even when there
  1829	 * is no actual data to report. However, byte 6 of this buffer looks like
  1830	 * its unique across device variants, so we're trying to key off that to
  1831	 * figure out which display type (if any) and what IR protocol the device
  1832	 * actually supports. These devices have their IR protocol hard-coded into
  1833	 * their firmware, they can't be changed on the fly like the newer hardware.
  1834	 */
  1835	static void imon_get_ffdc_type(struct imon_context *ictx)
  1836	{
  1837		u8 ffdc_cfg_byte = ictx->usb_rx_buf[6];
  1838		u8 detected_display_type = IMON_DISPLAY_TYPE_NONE;
  1839		u64 allowed_protos = RC_PROTO_BIT_IMON;
  1840	
  1841		switch (ffdc_cfg_byte) {
  1842		/* iMON Knob, no display, iMON IR + vol knob */
  1843		case 0x21:
  1844			dev_info(ictx->dev, "0xffdc iMON Knob, iMON IR");
  1845			ictx->display_supported = false;
  1846			break;
  1847		/* iMON 2.4G LT (usb stick), no display, iMON RF */
  1848		case 0x4e:
  1849			dev_info(ictx->dev, "0xffdc iMON 2.4G LT, iMON RF");
  1850			ictx->display_supported = false;
  1851			ictx->rf_device = true;
  1852			break;
  1853		/* iMON VFD, no IR (does have vol knob tho) */
  1854		case 0x35:
  1855			dev_info(ictx->dev, "0xffdc iMON VFD + knob, no IR");
  1856			detected_display_type = IMON_DISPLAY_TYPE_VFD;
  1857			break;
  1858		/* iMON VFD, iMON IR */
  1859		case 0x24:
  1860		case 0x30:
  1861		case 0x85:
  1862			dev_info(ictx->dev, "0xffdc iMON VFD, iMON IR");
  1863			detected_display_type = IMON_DISPLAY_TYPE_VFD;
  1864			break;
  1865		/* iMON VFD, MCE IR */
  1866		case 0x46:
  1867		case 0x9e:
  1868			dev_info(ictx->dev, "0xffdc iMON VFD, MCE IR");
  1869			detected_display_type = IMON_DISPLAY_TYPE_VFD;
  1870			allowed_protos = RC_PROTO_BIT_RC6_MCE;
  1871			break;
  1872		/* iMON VFD, iMON or MCE IR */
  1873		case 0x7e:
  1874			dev_info(ictx->dev, "0xffdc iMON VFD, iMON or MCE IR");
  1875			detected_display_type = IMON_DISPLAY_TYPE_VFD;
  1876			allowed_protos |= RC_PROTO_BIT_RC6_MCE;
  1877			break;
  1878		/* iMON LCD, MCE IR */
  1879		case 0x9f:
  1880			dev_info(ictx->dev, "0xffdc iMON LCD, MCE IR");
  1881			detected_display_type = IMON_DISPLAY_TYPE_LCD;
  1882			allowed_protos = RC_PROTO_BIT_RC6_MCE;
  1883			break;
  1884		/* no display, iMON IR */
  1885		case 0x26:
  1886			dev_info(ictx->dev, "0xffdc iMON Inside, iMON IR");
  1887			ictx->display_supported = false;
  1888			break;
  1889		/* Soundgraph iMON UltraBay */
  1890		case 0x98:
  1891			dev_info(ictx->dev, "0xffdc iMON UltraBay, LCD + IR");
  1892			detected_display_type = IMON_DISPLAY_TYPE_LCD;
  1893			allowed_protos = RC_PROTO_BIT_IMON | RC_PROTO_BIT_RC6_MCE;
> 1894			ictx->dev_descr = (struct imon_usb_dev_descr *) &imon_ultrabay_table;
  1895		default:
  1896			dev_info(ictx->dev, "Unknown 0xffdc device, defaulting to VFD and iMON IR");
  1897			detected_display_type = IMON_DISPLAY_TYPE_VFD;
  1898			/*
  1899			 * We don't know which one it is, allow user to set the
  1900			 * RC6 one from userspace if IMON wasn't correct.
  1901			 */
  1902			allowed_protos |= RC_PROTO_BIT_RC6_MCE;
  1903			break;
  1904		}
  1905	
  1906		printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte);
  1907	
  1908		ictx->display_type = detected_display_type;
  1909		ictx->rc_proto = allowed_protos;
  1910	}
  1911	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36240 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] media: rc: Add support for another 0xffdc device
  2019-09-14 17:20 ` kbuild test robot
@ 2019-09-14 22:40   ` pretoriano80
  2019-09-19 13:13     ` Flavius Georgescu
  0 siblings, 1 reply; 4+ messages in thread
From: pretoriano80 @ 2019-09-14 22:40 UTC (permalink / raw)
  To: sean; +Cc: linux-media, kbuild-all, kbuild test robot

The device it's an iMON UltraBay (0x98 in config byte) with LCD,
IR and dual-knobs front panel.

To work properly the device also require its own key table,
and repeat suppression for all buttons.

Reported-by: kbuild test robot <lkp@intel.com>

Signed-off-by: pretoriano80 <viusflag@libero.it>
---
 drivers/media/rc/imon.c | 45 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 7bee72108b0e..798ac95791cb 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -83,6 +83,7 @@ struct imon_usb_dev_descr {
 	__u16 flags;
 #define IMON_NO_FLAGS 0
 #define IMON_NEED_20MS_PKT_DELAY 1
+#define IMON_SUPPRESS_REPEATED_KEYS 2
 	struct imon_panel_key_table key_table[];
 };
 
@@ -315,6 +316,32 @@ static const struct imon_usb_dev_descr imon_DH102 = {
 	}
 };
 
+/* imon ultrabay front panel key table */
+static const struct imon_usb_dev_descr imon_ultrabay_table = {
+	.flags = IMON_SUPPRESS_REPEATED_KEYS,
+	.key_table = {
+		{ 0x0000000f0000ffeell, KEY_MEDIA },      /* Go */
+		{ 0x000000000100ffeell, KEY_UP },
+		{ 0x000000000001ffeell, KEY_DOWN },
+		{ 0x000000160000ffeell, KEY_ENTER },
+		{ 0x0000001f0000ffeell, KEY_AUDIO },	/* Music */
+		{ 0x000000200000ffeell, KEY_VIDEO },	/* Movie */
+		{ 0x000000210000ffeell, KEY_CAMERA },	/* Photo */
+		{ 0x000000270000ffeell, KEY_DVD },
+		{ 0x000000230000ffeell, KEY_TV },
+		{ 0x000000050000ffeell, KEY_PREVIOUS },
+		{ 0x000000070000ffeell, KEY_REWIND },
+		{ 0x000000040000ffeell, KEY_STOP },
+		{ 0x000000020000ffeell, KEY_PLAYPAUSE },
+		{ 0x000000080000ffeell, KEY_FASTFORWARD },
+		{ 0x000000060000ffeell, KEY_NEXT },
+		{ 0x000100000000ffeell, KEY_VOLUMEUP },
+		{ 0x010000000000ffeell, KEY_VOLUMEDOWN },
+		{ 0x000000010000ffeell, KEY_MUTE },
+		{ 0, KEY_RESERVED },
+	}
+};
+
 /*
  * USB Device ID for iMON USB Control Boards
  *
@@ -1661,6 +1688,17 @@ static void imon_incoming_packet(struct imon_context *ictx,
 			return;
 		}
 	}
+	/* KEY repeats from knob need to be suppressed */
+	if (ictx->dev_descr->flags & IMON_SUPPRESS_REPEATED_KEYS) {
+		if (ictx->kc == ictx->last_keycode) {
+			msec = ktime_ms_delta(t, prev_time);
+			if (msec < ictx->idev->rep[REP_DELAY]) {
+				spin_unlock_irqrestore(&ictx->kc_lock, flags);
+				return;
+			}
+		}
+	}
+
 	prev_time = t;
 	kc = ictx->kc;
 
@@ -1843,6 +1881,13 @@ static void imon_get_ffdc_type(struct imon_context *ictx)
 		dev_info(ictx->dev, "0xffdc iMON Inside, iMON IR");
 		ictx->display_supported = false;
 		break;
+	/* Soundgraph iMON UltraBay */
+	case 0x98:
+		dev_info(ictx->dev, "0xffdc iMON UltraBay, LCD + IR");
+		detected_display_type = IMON_DISPLAY_TYPE_LCD;
+		allowed_protos = RC_PROTO_BIT_IMON | RC_PROTO_BIT_RC6_MCE;
+		ictx->dev_descr = (struct imon_usb_dev_descr *) &imon_ultrabay_table;
+		break;
 	default:
 		dev_info(ictx->dev, "Unknown 0xffdc device, defaulting to VFD and iMON IR");
 		detected_display_type = IMON_DISPLAY_TYPE_VFD;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] media: rc: Add support for another 0xffdc device
  2019-09-14 22:40   ` [PATCH v2] " pretoriano80
@ 2019-09-19 13:13     ` Flavius Georgescu
  0 siblings, 0 replies; 4+ messages in thread
From: Flavius Georgescu @ 2019-09-19 13:13 UTC (permalink / raw)
  To: linux-media

 Please igonore this patch,due to some dumb mistakes and to avoid confusion ,
 i will re-send the patch as a new thread.I apologize for any inconvenience!


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-19 13:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-14  8:54 [PATCH] media: rc: Add support for another 0xffdc device pretoriano80
2019-09-14 17:20 ` kbuild test robot
2019-09-14 22:40   ` [PATCH v2] " pretoriano80
2019-09-19 13:13     ` Flavius Georgescu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).