*
* ChangeLog:
* Aug.18, 2020 Kenneth Chan <kenneth.t.chan@gmail.com>
+ * add write support to mute
* fix sticky_key init bug
* fix naming of platform files for consistency with other
* modules
acpi_handle handle;
unsigned long num_sifr;
int sticky_key;
+ int mute;
u32 *sinf;
struct acpi_device *device;
struct input_dev *input_dev;
return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_MUTE]);
}
+static ssize_t mute_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct acpi_device *acpi = to_acpi_device(dev);
+ struct pcc_acpi *pcc = acpi_driver_data(acpi);
+ int err, val;
+
+ err = kstrtoint(buf, 0, &val);
+ if (err)
+ return err;
+ if (val == 0 || val == 1) {
+ acpi_pcc_write_sset(pcc, SINF_MUTE, val);
+ pcc->mute = val;
+ }
+
+ return count;
+}
+
static ssize_t sticky_key_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
static DEVICE_ATTR_RO(numbatt);
static DEVICE_ATTR_RO(lcdtype);
-static DEVICE_ATTR_RO(mute);
+static DEVICE_ATTR_RW(mute);
static DEVICE_ATTR_RW(sticky_key);
static DEVICE_ATTR_RW(cdpower);
if (!pcc)
return -EINVAL;
+ acpi_pcc_write_sset(pcc, SINF_MUTE, pcc->mute);
acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_key);
return 0;
acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, 0);
pcc->sticky_key = 0;
+ pcc->mute = pcc->sinf[SINF_MUTE];
+
/* add sysfs attributes */
result = sysfs_create_group(&device->dev.kobj, &pcc_attr_group);
if (result)