diff options
Diffstat (limited to 'drivers/motor/max77693_haptic.c')
-rw-r--r-- | drivers/motor/max77693_haptic.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/drivers/motor/max77693_haptic.c b/drivers/motor/max77693_haptic.c index beb7f2a..9c83c25 100644 --- a/drivers/motor/max77693_haptic.c +++ b/drivers/motor/max77693_haptic.c @@ -24,6 +24,11 @@ #include <linux/mfd/max77693.h> #include <linux/mfd/max77693-private.h> +#define PWM_MIN 0 +#define PWM_DEFAULT 50 +#define PWM_THRESH 75 +#define PWM_MAX 100 + static unsigned long pwm_val = 50; /* duty in percent */ static int pwm_duty = 27787; /* duty value, 37050=100%, 27787=50%, 18525=0% */ @@ -301,6 +306,42 @@ ssize_t pwm_value_store(struct device *dev, static DEVICE_ATTR(pwm_value, S_IRUGO | S_IWUSR, pwm_value_show, pwm_value_store); +static ssize_t pwm_default_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sprintf(buf, "%u\n", PWM_DEFAULT); +} + +static DEVICE_ATTR(pwm_default, S_IRUGO, + pwm_default_show, NULL); + +static ssize_t pwm_max_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sprintf(buf, "%u\n", PWM_MAX); +} + +static DEVICE_ATTR(pwm_max, S_IRUGO, + pwm_max_show, NULL); + +static ssize_t pwm_min_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sprintf(buf, "%u\n", PWM_MIN); +} + +static DEVICE_ATTR(pwm_min, S_IRUGO, + pwm_min_show, NULL); + +static ssize_t pwm_threshold_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sprintf(buf, "%u\n", PWM_THRESH); +} + +static DEVICE_ATTR(pwm_threshold, S_IRUGO, + pwm_threshold_show, NULL); + static int max77693_haptic_probe(struct platform_device *pdev) { int error = 0; @@ -378,6 +419,23 @@ static int max77693_haptic_probe(struct platform_device *pdev) if (error < 0) { pr_err("[VIB] create sysfs fail: pwm_value\n"); } + error = device_create_file(hap_data->tout_dev.dev, &dev_attr_pwm_max); + if (error < 0) { + pr_err("[VIB] create sysfs fail: pwm_max\n"); + } + error = device_create_file(hap_data->tout_dev.dev, &dev_attr_pwm_min); + if (error < 0) { + pr_err("[VIB] create sysfs fail: pwm_min\n"); + } + error = device_create_file(hap_data->tout_dev.dev, &dev_attr_pwm_default); + if (error < 0) { + pr_err("[VIB] create sysfs fail: pwm_default\n"); + } + error = device_create_file(hap_data->tout_dev.dev, &dev_attr_pwm_threshold); + if (error < 0) { + pr_err("[VIB] create sysfs fail: pwm_threshold\n"); + } + #endif pr_debug("[VIB] -- %s\n", __func__); |