All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] pwm: Add stubs for pwm operations
@ 2011-05-20  4:59 ` Mohan Pallaka
  0 siblings, 0 replies; 16+ messages in thread
From: Mohan Pallaka @ 2011-05-20  4:59 UTC (permalink / raw)
  To: dmitry.torokhov, linux, rmk+kernel
  Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, linux-input,
	linux-i2c, rmk, Mohan Pallaka

Chip drivers that support both pwm and non-pwm modes
would encounter compilation errors if the platform doesn't
have support for pwm, even though the chip is programmed
to work in non-pwm mode. Add stubs for pwm functions to
avoid compilation errors in these scenarios.

Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
---
 include/linux/pwm.h |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 7c77575..54877f6 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -3,6 +3,7 @@
 
 struct pwm_device;
 
+#if defined(CONFIG_HAVE_PWM)
 /*
  * pwm_request - request a PWM device
  */
@@ -28,4 +29,26 @@ int pwm_enable(struct pwm_device *pwm);
  */
 void pwm_disable(struct pwm_device *pwm);
 
+#else
+
+struct pwm_device *pwm_request(int pwm_id, const char *label)
+{
+	return NULL;
+}
+
+void pwm_free(struct pwm_device *pwm) { }
+
+int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
+{
+	return -EINVAL;
+}
+
+int pwm_enable(struct pwm_device *pwm)
+{
+	return -EINVAL;
+}
+
+void pwm_disable(struct pwm_device *pwm) { }
+
+#endif /* CONFIG_HAVE_PWM */
 #endif /* __LINUX_PWM_H */
--
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply related	[flat|nested] 16+ messages in thread
* [PATCH 1/2] pwm: Add stubs for pwm operations
@ 2011-05-18 13:00 ` Mohan Pallaka
  0 siblings, 0 replies; 16+ messages in thread
From: Mohan Pallaka @ 2011-05-18 13:00 UTC (permalink / raw)
  To: dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-lFZ/pmaqli7XmaaqVzeoHQ, rmk+kernel-lFZ/pmaqli7XmaaqVzeoHQ
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	rmk-MIedHU+rSCMANfyc6IWni62ZND6+EDdj, Mohan Pallaka

Chip drivers that support both pwm and non-pwm modes
would encounter compilation errors if the platform doesn't
have support for pwm, even though the chip is programmed
to work in non-pwm mode. Add stubs for pwm functions to
avoid compilation errors in these scenarios.

Change-Id: Iec4c55fce253bda809947672be82a7bd14bcd663
Signed-off-by: Mohan Pallaka <mpallaka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
 include/linux/pwm.h |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 7c77575..a3cb33f 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -3,6 +3,7 @@
 
 struct pwm_device;
 
+#if defined(CONFIG_HAVE_PWM)
 /*
  * pwm_request - request a PWM device
  */
@@ -28,4 +29,27 @@ int pwm_enable(struct pwm_device *pwm);
  */
 void pwm_disable(struct pwm_device *pwm);
 
+#else
+
+struct pwm_device *pwm_request(int pwm_id, const char *label)
+{
+	return NULL;
+}
+
+void pwm_free(struct pwm_device *pwm) { }
+
+int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
+{
+	return -EINVAL;
+}
+
+int pwm_enable(struct pwm_device *pwm)
+{
+	return -EINVAL;
+}
+
+void pwm_disable(struct pwm_device *pwm) { }
+
+
+#endif /* CONFIG_PWM */
 #endif /* __LINUX_PWM_H */
-- 
1.7.1.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread
* [PATCH 0/2] Support for isa1200 haptic chip
@ 2011-05-18  5:18 Mohan Pallaka
  2011-05-18  5:18   ` Mohan Pallaka
  0 siblings, 1 reply; 16+ messages in thread
From: Mohan Pallaka @ 2011-05-18  5:18 UTC (permalink / raw)
  To: dmitry.torokhov, linux, rmk+kernel
  Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, linux-input,
	linux-i2c, rmk, Mohan Pallaka

This patchset includes stubs for pwm apis in pwm.h and
a ff-memless based isa1200 driver.

ISA1200 chip can operate in two modes and if the chip has been
configured for pwm-generation mode, which doesn't use pwm standard
apis then it'd encounter compilation errors if the host doesn't
support PWM. Adding pwm stubs will avoid compilation errors in those
cases. This driver is based on Park's isa1200 driver that uses
haptic class.

Kyungmin Park (1):
  input: misc: Add support for isa1200 chip

Mohan Pallaka (1):
  pwm: Add stubs for pwm operations

 drivers/input/misc/Kconfig    |   12 +
 drivers/input/misc/Makefile   |    1 +
 drivers/input/misc/isa1200.c  |  442 +++++++++++++++++++++++++++++++++++++++++
 include/linux/input/isa1200.h |   46 +++++
 include/linux/pwm.h           |   24 +++
 5 files changed, 525 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/misc/isa1200.c
 create mode 100644 include/linux/input/isa1200.h
-- 
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2011-05-26 11:31 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-20  4:59 [PATCH 1/2] pwm: Add stubs for pwm operations Mohan Pallaka
2011-05-20  4:59 ` Mohan Pallaka
2011-05-21 14:30 ` Mohan Pallaka
2011-05-21 14:30   ` Mohan Pallaka
2011-05-24 11:04   ` Mohan Pallaka
2011-05-24 11:04     ` Mohan Pallaka
     [not found]     ` <4DDB90D9.1020902-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-05-26 11:31       ` Mohan Pallaka
2011-05-26 11:31         ` Mohan Pallaka
2011-05-26 11:31         ` Mohan Pallaka
  -- strict thread matches above, loose matches on Subject: below --
2011-05-18 13:00 Mohan Pallaka
2011-05-18 13:00 ` Mohan Pallaka
2011-05-18 13:00 ` Mohan Pallaka
2011-05-18  5:18 [PATCH 0/2] Support for isa1200 haptic chip Mohan Pallaka
2011-05-18  5:18 ` [PATCH 1/2] pwm: Add stubs for pwm operations Mohan Pallaka
2011-05-18  5:18   ` Mohan Pallaka
2011-05-18  6:45   ` Dmitry Torokhov
2011-05-18  6:45     ` Dmitry Torokhov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.