diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 02e2f38..a2a68f3 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -967,6 +967,119 @@ out:
 	return ret;
 }
 
+/**
+ * show_wakeup_scancodes() - shows the current IR wake scancode(s)
+ * @device:	the device descriptor
+ * @mattr:	the device attribute struct (unused)
+ * @buf:	a pointer to the output buffer
+ *
+ * This routine is a callback routine for input read the IR wake scancode(s).
+ * it is trigged by reading /sys/class/rc/rc?/wakeup_scancodes.
+ * It returns the currently active IR wake scancode or empty buffer if wake
+ * scancode is not active.
+ *
+ * dev->lock is taken to guard against races between device
+ * registration, store_wakeup_scancodes and show_wakeup_scancodes.
+ */
+static ssize_t show_wakeup_scancodes(struct device *device,
+				     struct device_attribute *mattr, char *buf)
+{
+	int ret, pos = 0;
+	struct rc_wakeup_scancode *scancode, *next;
+	LIST_HEAD(scancode_list);
+	struct rc_dev *dev = to_rc_dev(device);
+
+	if (!dev || !dev->s_wakeup_scancodes)
+		return -ENODEV;
+
+	mutex_lock(&dev->lock);
+
+	ret = dev->s_wakeup_scancodes(dev, &scancode_list, 0);
+
+	list_for_each_entry_safe_reverse(scancode, next, &scancode_list,
+					 list_item) {
+		pos += scnprintf(buf + pos, PAGE_SIZE - pos, "0x%x ",
+				 scancode->value);
+		list_del(&scancode->list_item);
+		kfree(scancode);
+	}
+	pos += scnprintf(buf + pos, PAGE_SIZE - pos, "\n");
+
+	mutex_unlock(&dev->lock);
+
+	if (ret < 0)
+		return ret;
+
+	return pos;
+}
+
+/**
+ * store_wakeup_scancodes() - changes the current IR wake scancode(s)
+ * @device:	the device descriptor
+ * @mattr:	the device attribute struct (unused)
+ * @buf:	a pointer to the input buffer
+ * @len:	length of the input buffer
+ *
+ * This routine is for changing the IR wake scancode.
+ * It is trigged by writing to /sys/class/rc/rc?/wakeup_scancodes.
+ * Writing bytes separated by white space will pass them to the hardware.
+ * Writing "" (empty) will clear active wake scancode.
+ * Returns -EINVAL if too many values or invalid values were used
+ * otherwise @len.
+ *
+ * dev->lock is taken to guard against races between device
+ * registration, store_wakeup_scancodes and show_wakeup_scancodes.
+ */
+static ssize_t store_wakeup_scancodes(struct device *device,
+				      struct device_attribute *mattr,
+				      const char *data,
+				      size_t len)
+{
+	int ret = 0, error = 0;
+	char *tmp;
+	u8 value;
+	struct rc_wakeup_scancode *scancode, *next;
+	LIST_HEAD(scancode_list);
+	struct rc_dev *dev = to_rc_dev(device);
+
+	if (!dev || !dev->s_wakeup_scancodes)
+		return -ENODEV;
+
+	mutex_lock(&dev->lock);
+
+	while ((tmp = strsep((char **) &data, " ,\t\n")) != NULL) {
+		if (!*tmp)
+			break;
+
+		if (sscanf(tmp, "0x%2hhx", &value) != 1 &&
+		    sscanf(tmp,   "%2hhx", &value) != 1) {
+			error = 1;
+			break;
+		} else {
+			scancode = kmalloc(sizeof(struct rc_wakeup_scancode),
+					   GFP_KERNEL);
+			scancode->value = value;
+			list_add(&scancode->list_item, &scancode_list);
+		}
+	}
+
+	if (error)
+		IR_dprintk(1, "Error parsing value of %s", tmp);
+	else
+		ret = dev->s_wakeup_scancodes(dev, &scancode_list, 1);
+
+	list_for_each_entry_safe(scancode, next, &scancode_list, list_item) {
+		list_del(&scancode->list_item);
+		kfree(scancode);
+	}
+
+	mutex_unlock(&dev->lock);
+	if (ret < 0)
+		return ret;
+
+	return error ? -EINVAL : len;
+}
+
 static void rc_dev_release(struct device *device)
 {
 }
@@ -1019,6 +1132,15 @@ static struct device_type rc_dev_type = {
 	.uevent		= rc_dev_uevent,
 };
 
+static struct device_attribute dev_attr_wakeup_scancodes = {
+	.attr	= {
+		.name = "wakeup_scancodes",
+		.mode = S_IRUGO | S_IWUSR,
+	},
+	.show = show_wakeup_scancodes,
+	.store = store_wakeup_scancodes,
+};
+
 struct rc_dev *rc_allocate_device(void)
 {
 	struct rc_dev *dev;
@@ -1175,6 +1297,13 @@ int rc_register_device(struct rc_dev *dev)
 		dev->enabled_protocols = rc_type;
 	}
 
+	/* Create sysfs entry only if device has wake scancode support */
+	if (dev->s_wakeup_scancodes) {
+		rc = device_create_file(&dev->dev, &dev_attr_wakeup_scancodes);
+		if (rc < 0)
+			goto out_raw;
+	}
+
 	mutex_unlock(&dev->lock);
 
 	IR_dprintk(1, "Registered rc%ld (driver: %s, remote: %s, mode %s)\n",
