return 0;
 }
 
+static int comp_params_store(struct zram *zram, u32 prio, s32 level)
+{
+       zram->params[prio].level = level;
+       return 0;
+}
+
+static ssize_t algorithm_params_store(struct device *dev,
+                                     struct device_attribute *attr,
+                                     const char *buf,
+                                     size_t len)
+{
+       s32 prio = ZRAM_PRIMARY_COMP, level = ZCOMP_PARAM_NO_LEVEL;
+       char *args, *param, *val, *algo = NULL;
+       struct zram *zram = dev_to_zram(dev);
+       int ret;
+
+       args = skip_spaces(buf);
+       while (*args) {
+               args = next_arg(args, ¶m, &val);
+
+               if (!val || !*val)
+                       return -EINVAL;
+
+               if (!strcmp(param, "priority")) {
+                       ret = kstrtoint(val, 10, &prio);
+                       if (ret)
+                               return ret;
+                       continue;
+               }
+
+               if (!strcmp(param, "level")) {
+                       ret = kstrtoint(val, 10, &level);
+                       if (ret)
+                               return ret;
+                       continue;
+               }
+
+               if (!strcmp(param, "algo")) {
+                       algo = val;
+                       continue;
+               }
+       }
+
+       /* Lookup priority by algorithm name */
+       if (algo) {
+               s32 p;
+
+               prio = -EINVAL;
+               for (p = ZRAM_PRIMARY_COMP; p < ZRAM_MAX_COMPS; p++) {
+                       if (!zram->comp_algs[p])
+                               continue;
+
+                       if (!strcmp(zram->comp_algs[p], algo)) {
+                               prio = p;
+                               break;
+                       }
+               }
+       }
+
+       if (prio < ZRAM_PRIMARY_COMP || prio >= ZRAM_MAX_COMPS)
+               return -EINVAL;
+
+       ret = comp_params_store(zram, prio, level);
+       return ret ? ret : len;
+}
+
 static ssize_t comp_algorithm_show(struct device *dev,
                                   struct device_attribute *attr,
                                   char *buf)
 static DEVICE_ATTR_RW(recomp_algorithm);
 static DEVICE_ATTR_WO(recompress);
 #endif
+static DEVICE_ATTR_WO(algorithm_params);
 
 static struct attribute *zram_disk_attrs[] = {
        &dev_attr_disksize.attr,
        &dev_attr_recomp_algorithm.attr,
        &dev_attr_recompress.attr,
 #endif
+       &dev_attr_algorithm_params.attr,
        NULL,
 };