mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Kyungmin Park <kmpark@infradead.org>
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	soni.trilok@gmail.com
Subject: Re: [PATCH] Haptic class support (v2)
Date: Tue, 6 Oct 2009 08:25:14 -0700	[thread overview]
Message-ID: <20091006082514.a0424ec8.randy.dunlap@oracle.com> (raw)
In-Reply-To: <20091006074533.GA28889@july>

On Tue, 06 Oct 2009 16:45:33 +0900 Kyungmin Park wrote:

> This patch includes two haptic devices, isa1000 and isa1200
> ISA1000 is gpio based haptic, but isa1200 is based on I2C
> Both are working on Samsung SoCs and tested.
> 
> To enable the haptic, echo 1 > /sys/class/haptic/${name}/enable
> You can adjust the level by echo ${level} > /sys/class/haptic/${name}/enable
> or
> With oneshot feature, echo ${msec time} > /sys/class/haptic/${name}/oneshot
> 
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/Kconfig                     |    2
>  drivers/Makefile                    |    1
>  drivers/haptic/Kconfig              |   31 ++
>  drivers/haptic/Makefile             |    8
>  drivers/haptic/haptic-class.c       |  256 ++++++++++++++++++++++
>  drivers/haptic/haptic-samsung-pwm.c |  377 ++++++++++++++++++++++++++++++++
>  drivers/haptic/haptic.h             |   35 +++
>  drivers/haptic/isa1200.c            |  413 ++++++++++++++++++++++++++++++++++++
>  include/linux/haptic.h              |   85 +++++++
>  9 files changed, 1208 insertions(+)
> 
> diff --git a/drivers/Kconfig b/drivers/Kconfig
> index 48bbdbe..d44a601 100644
> --- a/drivers/Kconfig
> +++ b/drivers/Kconfig
> @@ -62,6 +62,8 @@ source "drivers/power/Kconfig"
>  
>  source "drivers/hwmon/Kconfig"
>  
> +source "drivers/haptic/Kconfig"
> +
>  source "drivers/thermal/Kconfig"
>  
>  source "drivers/watchdog/Kconfig"
> diff --git a/drivers/Makefile b/drivers/Makefile
> index 6ee53c7..16b8f67 100644
> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -77,6 +77,7 @@ obj-$(CONFIG_PPS)		+= pps/
>  obj-$(CONFIG_W1)		+= w1/
>  obj-$(CONFIG_POWER_SUPPLY)	+= power/
>  obj-$(CONFIG_HWMON)		+= hwmon/
> +obj-$(CONFIG_HAPTIC)		+= haptic/
>  obj-$(CONFIG_THERMAL)		+= thermal/
>  obj-$(CONFIG_WATCHDOG)		+= watchdog/
>  obj-$(CONFIG_PHONE)		+= telephony/
> diff --git a/drivers/haptic/Kconfig b/drivers/haptic/Kconfig
> new file mode 100644
> index 0000000..9acb02a
> --- /dev/null
> +++ b/drivers/haptic/Kconfig
> @@ -0,0 +1,31 @@
> +menuconfig HAPTIC
> +	bool "HAPTIC support"
> +	help
> +	  Say Y to enalbe haptic support. It enables the haptic and controlled

	           enable
The next sentence is incomplete.  Maybe it should be (but I don't know):

	                                  It enables haptic devices and controls

> +	  from both userspace and kernel

	                      and kernel.

> +
> +if HAPTIC
> +
> +config HAPTIC_CLASS
> +	tristate "Haptic Class Support"
> +	help
> +	  This option enables the haptic sysfs class in /sys/class/haptic.
> +
> +comment "Haptic drivers"
> +
> +config HAPTIC_SAMSUNG_PWM
> +	tristate "Haptic Support for SAMSUNG PWM-controlled motor (ISA1000)"
> +	depends on HAPTIC_CLASS && (ARCH_S3C64XX || ARCH_S5PC1XX)
> +	help
> +	  This options enables support for haptic connected to GPIO lines
> +	  controlled by a PWM timer on SAMSUNG CPUs.
> +
> +comment "Haptic chips"
> +
> +config HAPTIC_ISA1200
> +	tristate "Haptic Motor"
> +	depends on HAPTIC_CLASS && I2C
> +	help
> +	  The ISA1200 is a high performance enhanced haptic motor driver

end sentence with period ('.')


> +
> +endif	# HAPTIC

> diff --git a/drivers/haptic/haptic-class.c b/drivers/haptic/haptic-class.c
> new file mode 100644
> index 0000000..b93e8e0
> --- /dev/null
> +++ b/drivers/haptic/haptic-class.c
> @@ -0,0 +1,256 @@
> +/*
> + *  Haptic Class Core
> + *
> + *  Copyright (C) 2008 Samsung Electronics
> + *  Kyungmin Park <kyungmin.park@samsung.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + */
> +

> +/**
> + * haptic_classdev_unregister - unregisters a object of haptic_properties class.

s/haptic_properties/haptic_classdev/ ??

> + * @haptic_cdev: the haptic device to unregister
> + *
> + * Unregisters a previously registered via haptic_classdev_register object.
> + */
> +void haptic_classdev_unregister(struct haptic_classdev *haptic_cdev)
> +{
> +	class_remove_file(haptic_class, &class_attr_enable);
> +	class_remove_file(haptic_class, &class_attr_oneshot);
> +	class_remove_file(haptic_class, &class_attr_level);
> +	class_remove_file(haptic_class, &class_attr_level_max);
> +	class_remove_file(haptic_class, &class_attr_value);
> +
> +	device_unregister(haptic_cdev->dev);
> +
> +	down_write(&haptic_list_lock);
> +	list_del(&haptic_cdev->node);
> +	up_write(&haptic_list_lock);
> +}
> +EXPORT_SYMBOL_GPL(haptic_classdev_unregister);

> diff --git a/drivers/haptic/haptic-samsung-pwm.c b/drivers/haptic/haptic-samsung-pwm.c
> new file mode 100644
> index 0000000..0fc1093
> --- /dev/null
> +++ b/drivers/haptic/haptic-samsung-pwm.c
> @@ -0,0 +1,377 @@
> +/*
> + *  drivers/haptic/haptic-samsung-pwm.c
> + *
> + *  Copyright (C) 2008 Samsung Electronics
> + *  Kyungmin Park <kyungmin.park@samsung.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +


> diff --git a/drivers/haptic/isa1200.c b/drivers/haptic/isa1200.c
> new file mode 100644
> index 0000000..19a3801
> --- /dev/null
> +++ b/drivers/haptic/isa1200.c
> @@ -0,0 +1,413 @@
> +/*
> + *  isa1200.c - Haptic Motor
> + *
> + *  Copyright (C) 2009 Samsung Electronics
> + *  Kyungmin Park <kyungmin.park@samsung.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +struct isa1200_chip {
> +	struct i2c_client *client;
> +	struct pwm_device *pwm;
> +	struct haptic_classdev cdev;
> +	struct work_struct work;
> +	struct timer_list timer;
> +
> +	unsigned int	len;		/* LDO enable */
> +	unsigned int	hen;		/* Haptic haptic enable */

Drop one "haptic" ?

> +
> +	int enable;
> +	int powered;
> +
> +	int level;
> +	int level_max;
> +
> +	int ldo_level;
> +};

---
~Randy

  reply	other threads:[~2009-10-06 15:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-06  7:45 Kyungmin Park
2009-10-06 15:25 ` Randy Dunlap [this message]
2009-10-06 18:35 ` Trilok Soni
2009-10-07  5:13   ` Kyungmin Park
2009-10-11  9:05 ` Pavel Machek
2009-10-12  0:32   ` Kyungmin Park
2009-10-12 13:44     ` Trilok Soni
2009-10-12 14:40       ` Greg KH
2009-10-13 11:05     ` Pavel Machek
2009-10-12 15:42 ` Kay Sievers
2009-10-12 16:20   ` Mark Brown
2009-10-13 16:45 ` Kay Sievers
2009-10-20  6:44   ` Trilok Soni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091006082514.a0424ec8.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=kmpark@infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=soni.trilok@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®