All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC V2 0/5] kvm : Paravirt-spinlock support for KVM guests
From: Raghavendra K T @ 2011-10-23 19:03 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Sedat Dilek, Stefano Stabellini, KVM,
	Jeremy Fitzhardinge <jerem>
  Cc: Peter Zijlstra, Suzuki Poulose, Raghavendra K T,
	Srivatsa Vaddagiri

The 5-patch series to follow this email extends KVM-hypervisor and Linux guest 
running on KVM-hypervisor to support pv-ticket spinlocks, based heavily on Xen's implementation.

Two hypercalls are being introduced in KVM hypervisor, one that allows a
vcpu (spinning on a lock) to block and another that allows a vcpu to kick
another out of blocking state.

This is discussed in : (posted by Srivatsa V).
https://lkml.org/lkml/2010/7/26/24
https://lkml.org/lkml/2011/1/19/212

The BASE patch is tip rc9 + Jeremy's following patches.
compare exchange (https://lkml.org/lkml/2011/8/29/321), 
xadd (https://lkml.org/lkml/2011/10/4/328)
x86/ticketlocklock  (https://lkml.org/lkml/2011/10/12/496).

Changes since last posting:
- rebased patchesto -rc9
- synchronization related changes based on Jeremy's changes (Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>) pointed by
Stephan Diestelhorst <stephan.diestelhorst@amd.com>
- enabling 32 bit guests
- splitted patches into two more chunks

Results:

set up : 
Kernel for host/guest : 3.1-rc9 + Jeremys ticketlock cleanup, xadd, pv spinlock patches as BASE

3 guests with 8VCPU, 4GB RAM, 1 used for kernbench (kernbench -f -H -M -o 20) other for cpuhog (shell script while 
true with an instruction)

scenario A: unpinned
scenario B: each vcpu pinned to corresponding cpu

1x: no hogs
2x: 8hogs in one guest
3x: 8hogs each in two guest

Result for Non PLE machine :
Machine : IBM xSeries with Intel(R) Xeon(R) x5570 2.93GHz CPU with 8 core , 64GB RAM
		 BASE                    BASE+patch            %improvement
		 mean (sd)               mean (sd)
Scenario A:	 			
case 1x:	 157.495 (15.2924) 	 148.355 (7.35479) 	5.80336
case 2x:	 761.955 (581.384) 	 247.306 (64.4707) 	67.5432
case 3x:	 2804.36 (2613.57) 	 261.522 (85.0856) 	90.6744

Scenario B				
case 1x:	 1241.86 (812.155) 	 313.805 (140.99) 	74.731
case 2x:	 1277.32 (771.316) 	 308.325 (124.808) 	75.8616
case 3x:	 1239.45 (860.012) 	 307.535 (124.243) 	75.1878

Result for PLE machine:
Machine : IBM xSeries with Intel(R) Xeon(R)  X7560 2.27GHz CPU with 32/64 core, with 8  
         online cores and 4*64GB RAM

		 BASE                    BASE+patch            %improvement
		 mean (sd)               mean (sd)
Scenario A:	 			
case 1x:	 72.7133 (43.7109) 	 70.0734 (37.7866) 	3.63056
case 2x:	 124.138 (79.9515) 	 119.28 (81.3597) 	3.91339
case 3x:	 174.561 (132.209) 	 159.283 (116.232) 	8.75224

Scenario B				
case 1x:	 166.101 (119.313) 	 160.056 (117.446) 	3.63935
case 2x:	 167.421 (120.767) 	 158.133 (115.022) 	5.54769
case 3x:	 169.317 (122.088) 	 159.353 (116.737) 	5.88482

 Srivatsa Vaddagiri, Suzuki Poulose, Raghavendra K T (5): 
  Add debugfs support to print u32-arrays in debugfs
  Renaming of xen functions and change unsigned to u32
  Add two hypercalls to KVM hypervisor to support pv-ticketlocks
  Added configuration support to enable debug information for KVM Guests
  pv-ticketlocks support for linux guests running on KVM hypervisor
 
 arch/x86/Kconfig                |    9 ++
 arch/x86/include/asm/kvm_para.h |   12 ++-
 arch/x86/kernel/head32.c        |    3 +
 arch/x86/kernel/head64.c        |    3 +
 arch/x86/kernel/kvm.c           |  247 +++++++++++++++++++++++++++++++++++++++
 arch/x86/kvm/x86.c              |   67 +++++++++++-
 arch/x86/xen/debugfs.c          |  104 ----------------
 arch/x86/xen/debugfs.h          |    4 -
 arch/x86/xen/spinlock.c         |    2 +-
 fs/debugfs/file.c               |  108 +++++++++++++++++
 include/linux/debugfs.h         |   11 ++
 include/linux/kvm.h             |    1 +
 include/linux/kvm_host.h        |    5 +
 include/linux/kvm_para.h        |    2 +
 virt/kvm/kvm_main.c             |    1 +
 15 files changed, 468 insertions(+), 111 deletions(-)
---

^ permalink raw reply

* [PATCH RFC V2 0/5] kvm : Paravirt-spinlock support for KVM guests
From: Raghavendra K T @ 2011-10-23 19:03 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Sedat Dilek, Stefano Stabellini, KVM,
	Jeremy Fitzhardinge <jerem
  Cc: Suzuki Poulose, Srivatsa Vaddagiri, Peter Zijlstra,
	Raghavendra K T

The 5-patch series to follow this email extends KVM-hypervisor and Linux guest 
running on KVM-hypervisor to support pv-ticket spinlocks, based heavily on Xen's implementation.

Two hypercalls are being introduced in KVM hypervisor, one that allows a
vcpu (spinning on a lock) to block and another that allows a vcpu to kick
another out of blocking state.

This is discussed in : (posted by Srivatsa V).
https://lkml.org/lkml/2010/7/26/24
https://lkml.org/lkml/2011/1/19/212

The BASE patch is tip rc9 + Jeremy's following patches.
compare exchange (https://lkml.org/lkml/2011/8/29/321), 
xadd (https://lkml.org/lkml/2011/10/4/328)
x86/ticketlocklock  (https://lkml.org/lkml/2011/10/12/496).

Changes since last posting:
- rebased patchesto -rc9
- synchronization related changes based on Jeremy's changes (Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>) pointed by
Stephan Diestelhorst <stephan.diestelhorst@amd.com>
- enabling 32 bit guests
- splitted patches into two more chunks

Results:

set up : 
Kernel for host/guest : 3.1-rc9 + Jeremys ticketlock cleanup, xadd, pv spinlock patches as BASE

3 guests with 8VCPU, 4GB RAM, 1 used for kernbench (kernbench -f -H -M -o 20) other for cpuhog (shell script while 
true with an instruction)

scenario A: unpinned
scenario B: each vcpu pinned to corresponding cpu

1x: no hogs
2x: 8hogs in one guest
3x: 8hogs each in two guest

Result for Non PLE machine :
Machine : IBM xSeries with Intel(R) Xeon(R) x5570 2.93GHz CPU with 8 core , 64GB RAM
		 BASE                    BASE+patch            %improvement
		 mean (sd)               mean (sd)
Scenario A:	 			
case 1x:	 157.495 (15.2924) 	 148.355 (7.35479) 	5.80336
case 2x:	 761.955 (581.384) 	 247.306 (64.4707) 	67.5432
case 3x:	 2804.36 (2613.57) 	 261.522 (85.0856) 	90.6744

Scenario B				
case 1x:	 1241.86 (812.155) 	 313.805 (140.99) 	74.731
case 2x:	 1277.32 (771.316) 	 308.325 (124.808) 	75.8616
case 3x:	 1239.45 (860.012) 	 307.535 (124.243) 	75.1878

Result for PLE machine:
Machine : IBM xSeries with Intel(R) Xeon(R)  X7560 2.27GHz CPU with 32/64 core, with 8  
         online cores and 4*64GB RAM

		 BASE                    BASE+patch            %improvement
		 mean (sd)               mean (sd)
Scenario A:	 			
case 1x:	 72.7133 (43.7109) 	 70.0734 (37.7866) 	3.63056
case 2x:	 124.138 (79.9515) 	 119.28 (81.3597) 	3.91339
case 3x:	 174.561 (132.209) 	 159.283 (116.232) 	8.75224

Scenario B				
case 1x:	 166.101 (119.313) 	 160.056 (117.446) 	3.63935
case 2x:	 167.421 (120.767) 	 158.133 (115.022) 	5.54769
case 3x:	 169.317 (122.088) 	 159.353 (116.737) 	5.88482

 Srivatsa Vaddagiri, Suzuki Poulose, Raghavendra K T (5): 
  Add debugfs support to print u32-arrays in debugfs
  Renaming of xen functions and change unsigned to u32
  Add two hypercalls to KVM hypervisor to support pv-ticketlocks
  Added configuration support to enable debug information for KVM Guests
  pv-ticketlocks support for linux guests running on KVM hypervisor
 
 arch/x86/Kconfig                |    9 ++
 arch/x86/include/asm/kvm_para.h |   12 ++-
 arch/x86/kernel/head32.c        |    3 +
 arch/x86/kernel/head64.c        |    3 +
 arch/x86/kernel/kvm.c           |  247 +++++++++++++++++++++++++++++++++++++++
 arch/x86/kvm/x86.c              |   67 +++++++++++-
 arch/x86/xen/debugfs.c          |  104 ----------------
 arch/x86/xen/debugfs.h          |    4 -
 arch/x86/xen/spinlock.c         |    2 +-
 fs/debugfs/file.c               |  108 +++++++++++++++++
 include/linux/debugfs.h         |   11 ++
 include/linux/kvm.h             |    1 +
 include/linux/kvm_host.h        |    5 +
 include/linux/kvm_para.h        |    2 +
 virt/kvm/kvm_main.c             |    1 +
 15 files changed, 468 insertions(+), 111 deletions(-)
---

^ permalink raw reply

* Compat-wireless release for 2011-10-23 is baked
From: Compat-wireless cronjob account @ 2011-10-23 19:02 UTC (permalink / raw)
  To: linux-wireless


compat-wireless code metrics

    814119 - Total upstream lines of code being pulled
      2431 - backport code changes
      2113 - backport code additions
       318 - backport code deletions
      8588 - backport from compat module
     11019 - total backport code
    1.3535 - % of code consists of backport work

^ permalink raw reply

* [U-Boot] [PATCH] gpio: Add PCA9698 40-bit I2C I/O port
From: Wolfgang Denk @ 2011-10-23 19:01 UTC (permalink / raw)
  To: u-boot
In-Reply-To: <1319101940-780-1-git-send-email-eibach@gdsys.de>

Dear Dirk Eibach,

In message <1319101940-780-1-git-send-email-eibach@gdsys.de> you wrote:
> Signed-off-by: Dirk Eibach <eibach@gdsys.de>
> ---
>  drivers/gpio/Makefile  |    1 +
>  drivers/gpio/pca9698.c |  143 ++++++++++++++++++++++++++++++++++++++++++++++++
>  include/pca9698.h      |   34 +++++++++++
>  3 files changed, 178 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/gpio/pca9698.c
>  create mode 100644 include/pca9698.h

is this some v3 of the patch?  If so, where is the change log?  What
has been changes?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There is is no reason for any individual to have a computer in  their
home.      -- Ken Olsen (President of Digital Equipment Corporation),
              Convention of the World Future Society, in Boston, 1977

^ permalink raw reply

* [PATCH] Move mostly read variables to __read_mostly section.
From: Eial Czerwacki @ 2011-10-23 18:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: Shai Fultheim (Shai@ScaleMP.com)


Move mostly read variables to __read_mostly section.

Signed-off-by: Eial Czerwacki<eial@ScaleMP.com>
Signed-off-by: Shai Fultheim<Shai@ScaleMP.com>
---

--- a/fs/buffer.c	2010-05-12 14:59:32.000000000 -0700
+++ b/fs/buffer.c	2010-05-24 11:56:32.000000000 -0700
@@ -3233,7 +3233,7 @@ SYSCALL_DEFINE2(bdflush, int, func, long
  /*
   * Buffer-head allocation
   */
-static struct kmem_cache *bh_cachep;
+static struct kmem_cache __read_mostly *bh_cachep;

  /*
   * Once the number of bh's in the machine exceeds this level, we start
--- a/kernel/time/timekeeping.c	2010-05-12 14:59:32.000000000 -0700
+++ b/kernel/time/timekeeping.c	2010-05-24 11:56:32.000000000 -0700
@@ -154,7 +154,7 @@ __cacheline_aligned_in_smp DEFINE_SEQLOC
   * used instead.
   */
  static struct timespec xtime __attribute__ ((aligned (16)));
-static struct timespec wall_to_monotonic __attribute__ ((aligned (16)));
+static struct timespec wall_to_monotonic __attribute__ ((aligned (16))) __read_mostly;
  static struct timespec total_sleep_time;

  /*




^ permalink raw reply

* [Buildroot] [PATCH v5] package: add opencv
From: Samuel Martin @ 2011-10-23 18:58 UTC (permalink / raw)
  To: buildroot

OpenCV is a free, open-source, cross-platform computer vision library

Changelog:
 v1: initial submission
 v2: changes according to Thomas Petazonni's review:
     - remove obvious unneeded options
     - typo and style fixes
     - do not use 3RDPARTY_LIBS
 v3: changes according to Thomas Petazonni's review:
     - typo and style fixes
     - remove host package (not needed)
 v4: update CMAKETARGET call to follow the infra.
 v5: - add post install hooks (following Mike Davies' remarks):
       - do not install doc
       - do not install OpenCVConfig.cmake in the target
     - optionally install data in the target
     - remove the 'Build examples' option (only install source files)
     - disable precompiled header usage (automacally disabled when
       compiler size optimization is set)

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
 package/Config.in        |    1 +
 package/opencv/Config.in |   77 ++++++++++++++++++++++++++++++++++++++++++++
 package/opencv/opencv.mk |   80 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 158 insertions(+), 0 deletions(-)
 create mode 100644 package/opencv/Config.in
 create mode 100644 package/opencv/opencv.mk

diff --git a/package/Config.in b/package/Config.in
index 3b2769d..c6ca350 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -297,6 +297,7 @@ source "package/libraw/Config.in"
 source "package/librsvg/Config.in"
 source "package/libsvgtiny/Config.in"
 source "package/libungif/Config.in"
+source "package/opencv/Config.in"
 source "package/pango/Config.in"
 source "package/pixman/Config.in"
 source "package/tiff/Config.in"
diff --git a/package/opencv/Config.in b/package/opencv/Config.in
new file mode 100644
index 0000000..41cb6c8
--- /dev/null
+++ b/package/opencv/Config.in
@@ -0,0 +1,77 @@
+menuconfig BR2_PACKAGE_OPENCV
+	bool "opencv"
+	select BR2_PACKAGE_ZLIB
+	help
+	  OpenCV (Open Source Computer Vision) is a library of programming
+	  functions for real time computer vision.
+
+	  http://opencv.willowgarage.com/wiki/
+
+if BR2_PACKAGE_OPENCV
+
+comment "Built targets"
+
+config BR2_PACKAGE_OPENCV_BUILD_NEW_PYTHON_SUPPORT
+	bool "Python support"
+	select BR2_PACKAGE_PYTHON
+
+config BR2_PACKAGE_OPENCV_BUILD_TESTS
+	bool "Tests"
+
+comment "Install options"
+
+config BR2_PACKAGE_OPENCV_INSTALL_DATA
+	bool "Install data"
+	help
+	  Install various data that is used by cv libraries and/or demo
+	  applications, specifically for haarcascades and lbpcascades features.
+
+	  For further information: see OpenCV documentation.
+
+comment "Build options"
+
+config BR2_PACKAGE_OPENCV_WITH_FFMPEG
+	bool "FFMPEG support"
+	select BR2_PACKAGE_FFMPEG
+	select BR2_PACKAGE_FFMPEG_SWSCALE
+	help
+	  Use ffmpeg from the target system.
+
+config BR2_PACKAGE_OPENCV_WITH_GSTREAMER
+	bool "Gstreamer support"
+	select BR2_PACKAGE_GSTREAMER
+	select BR2_PACKAGE_GST_PLUGINS_BASE
+	select BR2_PACKAGE_GST_PLUGINS_BASE_PLUGIN_APP
+
+config BR2_PACKAGE_OPENCV_WITH_GTK
+	bool "GTK support"
+	depends on BR2_PACKAGE_LIBGTK2 && BR2_PACKAGE_LIBGLIB2
+
+config BR2_PACKAGE_OPENCV_WITH_JPEG
+	bool "JPEG support"
+	select BR2_PACKAGE_JPEG
+	help
+	  Use shared libjpeg from the target system.
+
+config BR2_PACKAGE_OPENCV_WITH_PNG
+	bool "PNG support"
+	select BR2_PACKAGE_LIBPNG
+	help
+	  Use shared libpng from the target system.
+
+config BR2_PACKAGE_OPENCV_WITH_QT
+	bool "Qt Backend support"
+	select BR2_PACKAGE_QT
+
+config BR2_PACKAGE_OPENCV_WITH_TIFF
+	bool "TIFF support"
+	select BR2_PACKAGE_TIFF
+	help
+	  Use shared libtiff from the target system.
+
+config BR2_PACKAGE_OPENCV_WITH_V4L
+	bool "Video 4 Linux support"
+	select BR2_PACKAGE_LIBV4L
+	default y
+
+endif
diff --git a/package/opencv/opencv.mk b/package/opencv/opencv.mk
new file mode 100644
index 0000000..48add1e
--- /dev/null
+++ b/package/opencv/opencv.mk
@@ -0,0 +1,80 @@
+#############################################################
+#
+# OpenCV (Open Source Computer Vision)
+#
+#############################################################
+OPENCV_SERIES  = 2.3
+OPENCV_VERSION = $(OPENCV_SERIES).0
+OPENCV_SITE    = http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/project/opencvlibrary/opencv-unix/$(OPENCV_SERIES)
+OPENCV_SOURCE  = OpenCV-$(OPENCV_VERSION).tar.bz2
+OPENCV_INSTALL_STAGING = YES
+
+# Build type
+OPENCV_CONF_OPT += -DCMAKE_BUILD_TYPE=$(if $(BR2_ENABLE_DEBUG),Debug,Release)
+# Built targets
+OPENCV_CONF_OPT += -DBUILD_DOCS=OFF
+OPENCV_CONF_OPT += -DBUILD_EXAMPLES=OFF
+OPENCV_CONF_OPT += -DBUILD_NEW_PYTHON_SUPPORT=$(if $(BR2_PACKAGE_OPENCV_BUILD_NEW_PYTHON_SUPPORT),ON,OFF)
+OPENCV_DEPENDENCIES += $(if $(BR2_PACKAGE_OPENCV_BUILD_NEW_PYTHON_SUPPORT),python host-python,)
+OPENCV_CONF_OPT += -DBUILD_PACKAGE=OFF
+OPENCV_CONF_OPT += -DBUILD_TESTS=$(if $(BR2_PACKAGE_OPENCV_BUILD_TESTS),ON,OFF)
+# Build options
+OPENCV_CONF_OPT += -DBUILD_SHARED_LIBS=$(if $(BR2_PREFER_STATIC_LIB),OFF,ON)
+OPENCV_CONF_OPT += -DOPENCV_BUILD_3RDPARTY_LIBS=OFF
+OPENCV_CONF_OPT += -DENABLE_PROFILING=OFF
+OPENCV_CONF_OPT += -DCMAKE_SKIP_RPATH=OFF
+OPENCV_CONF_OPT += -DUSE_FAST_MATH=ON
+OPENCV_CONF_OPT += -DUSE_OMIT_FRAME_POINTER=ON
+OPENCV_CONF_OPT += -DUSE_PRECOMPILED_HEADERS=OFF
+OPENCV_CONF_OPT += -DWITH_1394=OFF
+OPENCV_CONF_OPT += -DWITH_CUDA=OFF
+OPENCV_CONF_OPT += -DWITH_EIGEN=OFF
+OPENCV_CONF_OPT += -DWITH_FFMPEG=$(if $(BR2_PACKAGE_OPENCV_WITH_FFMPEG),ON,OFF)
+OPENCV_DEPENDENCIES += $(if $(BR2_PACKAGE_OPENCV_WITH_FFMPEG),ffmpeg,)
+OPENCV_CONF_OPT += -DWITH_GSTREAMER=$(if $(BR2_PACKAGE_OPENCV_WITH_GSTREAMER),ON,OFF)
+OPENCV_DEPENDENCIES += $(if $(BR2_PACKAGE_OPENCV_WITH_GSTREAMER),gstreamer gst-plugins-base,)
+OPENCV_CONF_OPT += -DWITH_GTK=$(if $(BR2_PACKAGE_OPENCV_WITH_GTK),ON,OFF)
+OPENCV_DEPENDENCIES += $(if $(BR2_PACKAGE_OPENCV_WITH_GTK),libgtk2 libglib2,)
+OPENCV_CONF_OPT += -DWITH_IPP=OFF
+OPENCV_CONF_OPT += -DWITH_JASPER=OFF
+OPENCV_CONF_OPT += -DWITH_JPEG=$(if $(BR2_PACKAGE_OPENCV_WITH_JPEG),ON,OFF)
+OPENCV_DEPENDENCIES += $(if $(BR2_PACKAGE_OPENCV_WITH_JPEG),jpeg,)
+OPENCV_CONF_OPT += -DWITH_OPENEXR=OFF
+OPENCV_CONF_OPT += -DWITH_OPENNI=OFF
+OPENCV_CONF_OPT += -DWITH_PNG=$(if $(BR2_PACKAGE_OPENCV_WITH_PNG),ON,OFF)
+OPENCV_DEPENDENCIES += $(if $(BR2_PACKAGE_OPENCV_WITH_PNG),libpng,)
+OPENCV_CONF_OPT += -DWITH_PVAPI=OFF
+OPENCV_CONF_OPT += -DWITH_QT=$(if $(BR2_PACKAGE_OPENCV_WITH_QT),ON,OFF)
+OPENCV_DEPENDENCIES += $(if $(BR2_PACKAGE_OPENCV_WITH_QT),qt,)
+OPENCV_CONF_OPT += -DWITH_QT_OPENGL=OFF
+OPENCV_CONF_OPT += -DWITH_TBB=OFF
+OPENCV_CONF_OPT += -DWITH_TIFF=$(if $(BR2_PACKAGE_OPENCV_WITH_TIFF),ON,OFF)
+OPENCV_DEPENDENCIES += $(if $(BR2_PACKAGE_OPENCV_WITH_TIFF),tiff,)
+OPENCV_CONF_OPT += -DWITH_UNICAP=OFF
+OPENCV_CONF_OPT += -DWITH_V4L=$(if $(BR2_PACKAGE_OPENCV_WITH_V4L),ON,OFF)
+OPENCV_DEPENDENCIES += $(if $(BR2_PACKAGE_OPENCV_WITH_V4L),libv4l,)
+OPENCV_CONF_OPT += -DWITH_XINE=OFF
+# Install options
+OPENCV_CONF_OPT += -DINSTALL_C_EXAMPLES=OFF
+OPENCV_CONF_OPT += -DINSTALL_PYTHON_EXAMPLES=OFF
+
+define OPENCV_CLEAN_INSTALL_DOC
+	$(RM) -fr $(TARGET_DIR)/usr/share/opencv/doc
+endef
+
+define OPENCV_CLEAN_INSTALL_CMAKE
+	$(RM) -fr $(TARGET_DIR)/usr/share/opencv/*.cmake
+endef
+
+define OPENCV_CLEAN_INSTALL_DATA
+	$(RM) -fr $(TARGET_DIR)/usr/share/opencv/haarcascades \
+		$(TARGET_DIR)/usr/share/opencv/lbpcascades
+endef
+
+OPENCV_POST_INSTALL_TARGET_HOOKS += OPENCV_CLEAN_INSTALL_DOC OPENCV_CLEAN_INSTALL_CMAKE
+OPENCV_POST_INSTALL_TARGET_HOOKS += $(if $(BR2_PACKAGE_OPENCV_INSTALL_DATA),,OPENCV_CLEAN_INSTALL_DATA)
+
+OPENCV_POST_INSTALL_STAGING_HOOKS += OPENCV_CLEAN_INSTALL_DOC
+OPENCV_POST_INSTALL_STAGING_HOOKS += $(if $(BR2_PACKAGE_OPENCV_INSTALL_DATA),,OPENCV_CLEAN_INSTALL_DATA)
+
+$(eval $(call CMAKETARGETS))
-- 
1.7.0.4

^ permalink raw reply related

* [PATCH v7 0/3] Input: Cypress TTSP device driver
From: Javier Martinez Canillas @ 2011-10-23 18:53 UTC (permalink / raw)
  To: Henrik Rydberg
  Cc: Dmitry Torokhov, Mohan Pallaka, Kevin McNeely, Shubhrajyoti Datta,
	linux-input, linux-kernel

Cypress TrueTouch(tm) Standard Product controllers are found in a wide range of
embedded devices. This patch-set adds support for a variety of TTSP controllers.

The original author of the driver is Kevin McNeely <kev@cypress.com>

Since the hardware is capable of tracking identifiable contacts and the original
driver used multi-touch protocol type A (stateless), I've added multi-touch
protocol type B (stateful) support.

The driver is composed of a core driver that process the data sent by the
contacts (fingers) and two bus specific interface modules (I2C and SPI).

This is version 7 of the driver that fixes issues called out by Dmitry Torokhov,
Henrik Rydberg, Mohan Pallaka, Kevin McNeely and Shubhrajyoti Datta.

The patchset is composed of the following patches:

[PATCH v7 1/3] Input: cyttsp - Cypress TTSP capacitive multi-touch screen support
[PATCH v7 2/3] Input: cyttsp - add support for Cypress TTSP touchscreen I2C bus interface
[PATCH v7 3/3] Input: cyttsp - add support for Cypress TTSP touchscreen SPI bus interface

^ permalink raw reply

* [PATCH v7 3/3] Input: cyttsp - add support for Cypress TTSP touchscreen SPI bus interface
From: Javier Martinez Canillas @ 2011-10-23 18:53 UTC (permalink / raw)
  To: Henrik Rydberg
  Cc: Dmitry Torokhov, Mohan Pallaka, Kevin McNeely, Shubhrajyoti Datta,
	linux-input, linux-kernel, Javier Martinez Canillas
In-Reply-To: <1319396024-28558-1-git-send-email-martinez.javier@gmail.com>

The driver is composed of a core driver that process the data sent by
the contacts and a set of bus specific interface modules.

This patch add supports for the Cypress TTSP SPI bus interface.

Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
---

v2: Fix issues called out by Dmitry Torokhov
     - Extract the IRQ from the spi client data and pass to cyttsp_core_init()
     - Remove the extra retries and limit the retries to the cyttsp_core.c
       read/write block functions.
     - Cleanup cyttsp_spi_xfer(), check ACK in write operation and fix special
       EIO case to show its meaning.

v3: Fix issues called out by Henrik Rydberg and Mohan Pallaka
    - Remove bus type info since it is not used.

v7: Fix issues called out by Shubhrajyoti Datta
    - Remove unused ttsp_spi_tch_ext() function to handle extended touch data.
    - Move cyttsp_spi_[suspend | resume]() functions to dev pm ops.

 drivers/input/touchscreen/cyttsp/cyttsp_spi.c |  275 +++++++++++++++++++++++++
 1 files changed, 275 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/touchscreen/cyttsp/cyttsp_spi.c

diff --git a/drivers/input/touchscreen/cyttsp/cyttsp_spi.c b/drivers/input/touchscreen/cyttsp/cyttsp_spi.c
new file mode 100644
index 0000000..95dc7c8
--- /dev/null
+++ b/drivers/input/touchscreen/cyttsp/cyttsp_spi.c
@@ -0,0 +1,275 @@
+/*
+ * Source for:
+ * Cypress TrueTouch(TM) Standard Product (TTSP) SPI touchscreen driver.
+ * For use with Cypress Txx3xx parts.
+ * Supported parts include:
+ * CY8CTST341
+ * CY8CTMA340
+ *
+ * Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
+ * Copyright (C) 2011 Javier Martinez Canillas <martinez.javier@gmail.com>
+ *
+ * Multi-touch protocol type B support and cleanups by Javier Martinez Canillas
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2, and only version 2, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contact Cypress Semiconductor at www.cypress.com <kev@cypress.com>
+ *
+ */
+
+#include "cyttsp_core.h"
+
+#include <linux/spi/spi.h>
+#include <linux/delay.h>
+
+#define CY_SPI_WR_OP      0x00 /* r/~w */
+#define CY_SPI_RD_OP      0x01
+#define CY_SPI_CMD_BYTES  4
+#define CY_SPI_SYNC_BYTE  2
+#define CY_SPI_SYNC_ACK1  0x62 /* from protocol v.2 */
+#define CY_SPI_SYNC_ACK2  0x9D /* from protocol v.2 */
+#define CY_SPI_DATA_SIZE  128
+#define CY_SPI_DATA_BUF_SIZE (CY_SPI_CMD_BYTES + CY_SPI_DATA_SIZE)
+#define CY_SPI_BITS_PER_WORD 8
+
+struct cyttsp_spi {
+	struct cyttsp_bus_ops bus_ops;
+	struct spi_device *spi_client;
+	void *ttsp_client;
+	u8 wr_buf[CY_SPI_DATA_BUF_SIZE];
+	u8 rd_buf[CY_SPI_DATA_BUF_SIZE];
+};
+
+static int cyttsp_spi_xfer(u8 op, struct cyttsp_spi *ts,
+			   u8 reg, u8 *buf, int length)
+{
+	struct spi_message msg;
+	struct spi_transfer xfer[2];
+	u8 *wr_buf = ts->wr_buf;
+	u8 *rd_buf = ts->rd_buf;
+	int retval;
+
+	if (length > CY_SPI_DATA_SIZE) {
+		dev_dbg(ts->bus_ops.dev,
+			"%s: length %d is too big.\n",
+			__func__, length);
+		return -EINVAL;
+	}
+
+	memset(wr_buf, 0, CY_SPI_DATA_BUF_SIZE);
+	memset(rd_buf, 0, CY_SPI_DATA_BUF_SIZE);
+
+	wr_buf[0] = 0x00; /* header byte 0 */
+	wr_buf[1] = 0xFF; /* header byte 1 */
+	wr_buf[2] = reg;  /* reg index */
+	wr_buf[3] = op;   /* r/~w */
+	if (op == CY_SPI_WR_OP)
+		memcpy(wr_buf + CY_SPI_CMD_BYTES, buf, length);
+
+	memset((void *)xfer, 0, sizeof(xfer));
+	spi_message_init(&msg);
+
+	/*
+	  We set both TX and RX buffers because Cypress TTSP
+	  requires full duplex operation.
+	*/
+	xfer[0].tx_buf = wr_buf;
+	xfer[0].rx_buf = rd_buf;
+	if (op == CY_SPI_WR_OP) {
+		xfer[0].len = length + CY_SPI_CMD_BYTES;
+		spi_message_add_tail(&xfer[0], &msg);
+	} else if (op == CY_SPI_RD_OP) {
+		xfer[0].len = CY_SPI_CMD_BYTES;
+		spi_message_add_tail(&xfer[0], &msg);
+
+		xfer[1].rx_buf = buf;
+		xfer[1].len = length;
+		spi_message_add_tail(&xfer[1], &msg);
+	}
+
+	retval = spi_sync(ts->spi_client, &msg);
+	if (retval < 0) {
+		dev_dbg(ts->bus_ops.dev,
+			"%s: spi_sync() error %d, len=%d, op=%d\n",
+			__func__, retval, xfer[1].len, op);
+
+		/*
+		 * do not return here since was a bad ACK sequence
+		 * let the following ACK check handle any errors and
+		 * allow silent retries
+		 */
+	}
+
+	if ((rd_buf[CY_SPI_SYNC_BYTE] == CY_SPI_SYNC_ACK1) &&
+	    (rd_buf[CY_SPI_SYNC_BYTE+1] == CY_SPI_SYNC_ACK2))
+		retval = 0;
+	else {
+		int i;
+		for (i = 0; i < (CY_SPI_CMD_BYTES); i++)
+			dev_dbg(ts->bus_ops.dev,
+				"%s: test rd_buf[%d]:0x%02x\n",
+				__func__, i, rd_buf[i]);
+		for (i = 0; i < (length); i++)
+			dev_dbg(ts->bus_ops.dev,
+				"%s: test buf[%d]:0x%02x\n",
+				__func__, i, buf[i]);
+
+		/* signal ACK error so silent retry */
+		retval = 1;
+	}
+
+	return retval;
+}
+
+static s32 ttsp_spi_read_block_data(void *handle, u8 addr,
+				    u8 length, void *data)
+{
+	struct cyttsp_spi *ts =
+		container_of(handle, struct cyttsp_spi, bus_ops);
+	int retval;
+
+	retval = cyttsp_spi_xfer(CY_SPI_RD_OP, ts, addr, data, length);
+	if (retval < 0)
+		pr_err("%s: ttsp_spi_read_block_data failed\n",
+		       __func__);
+
+	/*
+	 * Do not print the above error if the data sync bytes were not found.
+	 * This is a normal condition for the bootloader loader startup and need
+	 * to retry until data sync bytes are found.
+	 */
+	if (retval > 0)
+		retval = -EIO;  /* now signal fail; so retry can be done */
+
+	return retval;
+}
+
+static s32 ttsp_spi_write_block_data(void *handle, u8 addr,
+				     u8 length, const void *data)
+{
+	struct cyttsp_spi *ts =
+		container_of(handle, struct cyttsp_spi, bus_ops);
+	int retval;
+
+	retval = cyttsp_spi_xfer(CY_SPI_WR_OP, ts, addr, (void *)data, length);
+	if (retval < 0)
+		pr_err("%s: ttsp_spi_write_block_data failed\n",
+		       __func__);
+
+	/*
+	 * Do not print the above error if the data sync bytes were not found.
+	 * This is a normal condition for the bootloader loader startup and need
+	 * to retry until data sync bytes are found.
+	 */
+	if (retval > 0)
+		retval = -EIO;  /* now signal fail; so retry can be done */
+
+	return retval;
+}
+
+static int __devinit cyttsp_spi_probe(struct spi_device *spi)
+{
+	struct cyttsp_spi *ts;
+	int retval;
+
+	/* Set up SPI*/
+	spi->bits_per_word = CY_SPI_BITS_PER_WORD;
+	spi->mode = SPI_MODE_0;
+	retval = spi_setup(spi);
+	if (retval < 0) {
+		dev_dbg(&spi->dev, "%s: SPI setup error %d\n",
+			__func__, retval);
+		return retval;
+	}
+
+	ts = kzalloc(sizeof(*ts), GFP_KERNEL);
+	if (!ts) {
+		dev_dbg(&spi->dev, "%s: Error, kzalloc\n", __func__);
+		return -ENOMEM;
+	}
+
+	ts->spi_client = spi;
+	dev_set_drvdata(&spi->dev, ts);
+	ts->bus_ops.write = ttsp_spi_write_block_data;
+	ts->bus_ops.read = ttsp_spi_read_block_data;
+	ts->bus_ops.dev = &spi->dev;
+
+	ts->ttsp_client = cyttsp_core_init(&ts->bus_ops, &spi->dev, spi->irq);
+	if (IS_ERR(ts->ttsp_client)) {
+		int retval = PTR_ERR(ts->ttsp_client);
+		kfree(ts);
+		return retval;
+	}
+
+	dev_dbg(ts->bus_ops.dev, "%s: Registration complete\n", __func__);
+
+	return 0;
+}
+
+static int __devexit cyttsp_spi_remove(struct spi_device *spi)
+{
+	struct cyttsp_spi *ts = dev_get_drvdata(&spi->dev);
+
+	cyttsp_core_release(ts->ttsp_client);
+	kfree(ts);
+	return 0;
+}
+
+#ifdef CONFIG_PM
+static int cyttsp_spi_suspend(struct device *dev)
+{
+	struct cyttsp_spi *ts = dev_get_drvdata(dev);
+
+	return cyttsp_suspend(ts->ttsp_client);
+}
+
+static int cyttsp_spi_resume(struct device *dev)
+{
+	struct cyttsp_spi *ts = dev_get_drvdata(dev);
+
+	return cyttsp_resume(ts->ttsp_client);
+}
+static SIMPLE_DEV_PM_OPS(cyttsp_spi_pm, cyttsp_spi_suspend, cyttsp_spi_resume);
+#endif
+
+static struct spi_driver cyttsp_spi_driver = {
+	.driver = {
+		.name = CY_SPI_NAME,
+		.owner = THIS_MODULE,
+#ifdef CONFIG_PM
+		.pm = &cyttsp_spi_pm,
+#endif
+	},
+	.probe = cyttsp_spi_probe,
+	.remove = __devexit_p(cyttsp_spi_remove),
+};
+
+static int __init cyttsp_spi_init(void)
+{
+	return spi_register_driver(&cyttsp_spi_driver);
+}
+module_init(cyttsp_spi_init);
+
+static void __exit cyttsp_spi_exit(void)
+{
+	spi_unregister_driver(&cyttsp_spi_driver);
+}
+module_exit(cyttsp_spi_exit);
+
+MODULE_ALIAS("spi:cyttsp");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Cypress TrueTouch(R) Standard Product (TTSP) SPI driver");
+MODULE_AUTHOR("Cypress");
+
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH v7 2/3] Input: cyttsp - add support for Cypress TTSP touchscreen I2C bus interface
From: Javier Martinez Canillas @ 2011-10-23 18:53 UTC (permalink / raw)
  To: Henrik Rydberg
  Cc: Dmitry Torokhov, Mohan Pallaka, Kevin McNeely, Shubhrajyoti Datta,
	linux-input, linux-kernel, Javier Martinez Canillas
In-Reply-To: <1319396024-28558-1-git-send-email-martinez.javier@gmail.com>

The driver is composed of a core driver that process the data sent by
the contacts and a set of bus specific interface modules.

This patch add supports for the Cypress TTSP I2C bus interface.

Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
---

v2: Fix issues called out by Dmitry Torokhov
    - Extract the IRQ from the i2c client data and pass to cyttsp_core_init().

v3: Fix issues called out by Henrik Rydberg and Mohan Pallaka
    - Remove bus type info since it is not used.

v7: Fix issues called out by Shubhrajyoti Datta
    - Check number of bytes in ttsp_i2c_[read | write]_block_data() functions.
    - Remove unused ttsp_i2c_tch_ext() function to handle extended touch data.
    - Remove unnecesary debug information.
    - Move cyttsp_i2c_[suspend | resume]() functions to dev pm ops.

 drivers/input/touchscreen/cyttsp/cyttsp_i2c.c |  178 +++++++++++++++++++++++++
 1 files changed, 178 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/touchscreen/cyttsp/cyttsp_i2c.c

diff --git a/drivers/input/touchscreen/cyttsp/cyttsp_i2c.c b/drivers/input/touchscreen/cyttsp/cyttsp_i2c.c
new file mode 100644
index 0000000..d7d62d4
--- /dev/null
+++ b/drivers/input/touchscreen/cyttsp/cyttsp_i2c.c
@@ -0,0 +1,178 @@
+/*
+ * Source for:
+ * Cypress TrueTouch(TM) Standard Product (TTSP) I2C touchscreen driver.
+ * For use with Cypress Txx3xx parts.
+ * Supported parts include:
+ * CY8CTST341
+ * CY8CTMA340
+ *
+ * Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
+ * Copyright (C) 2011 Javier Martinez Canillas <martinez.javier@gmail.com>
+ *
+ * Multi-touch protocol type B support and cleanups by Javier Martinez Canillas
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2, and only version 2, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contact Cypress Semiconductor at www.cypress.com <kev@cypress.com>
+ *
+ */
+
+#include "cyttsp_core.h"
+
+#include <linux/i2c.h>
+#include <linux/slab.h>
+
+#define CY_I2C_DATA_SIZE  128
+
+struct cyttsp_i2c {
+	struct cyttsp_bus_ops ops;
+	struct i2c_client *client;
+	void *ttsp_client;
+	u8 wr_buf[CY_I2C_DATA_SIZE];
+};
+
+static s32 ttsp_i2c_read_block_data(void *handle, u8 addr,
+	u8 length, void *values)
+{
+	struct cyttsp_i2c *ts = container_of(handle, struct cyttsp_i2c, ops);
+	int retval = 0;
+
+	retval = i2c_master_send(ts->client, &addr, 1);
+	if (retval < 0)
+		return retval;
+
+	retval = i2c_master_recv(ts->client, values, length);
+
+	if (retval != length)
+		return -EIO;
+
+	return (retval < 0) ? retval : 0;
+}
+
+static s32 ttsp_i2c_write_block_data(void *handle, u8 addr,
+	u8 length, const void *values)
+{
+	struct cyttsp_i2c *ts = container_of(handle, struct cyttsp_i2c, ops);
+	int retval;
+
+	ts->wr_buf[0] = addr;
+	memcpy(&ts->wr_buf[1], values, length);
+
+	retval = i2c_master_send(ts->client, ts->wr_buf, length+1);
+
+	if (retval != length)
+		return -EIO;
+
+	return (retval < 0) ? retval : 0;
+}
+
+static int __devinit cyttsp_i2c_probe(struct i2c_client *client,
+	const struct i2c_device_id *id)
+{
+	struct cyttsp_i2c *ts;
+
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
+		return -EIO;
+
+	/* allocate and clear memory */
+	ts = kzalloc(sizeof(*ts), GFP_KERNEL);
+	if (!ts) {
+		dev_dbg(&client->dev, "%s: Error, kzalloc.\n", __func__);
+		return -ENOMEM;
+	}
+
+	/* register driver_data */
+	ts->client = client;
+	i2c_set_clientdata(client, ts);
+	ts->ops.write = ttsp_i2c_write_block_data;
+	ts->ops.read = ttsp_i2c_read_block_data;
+	ts->ops.dev = &client->dev;
+
+	ts->ttsp_client = cyttsp_core_init(&ts->ops, &client->dev, client->irq);
+	if (IS_ERR(ts->ttsp_client)) {
+		int retval = PTR_ERR(ts->ttsp_client);
+		kfree(ts);
+		return retval;
+	}
+
+	return 0;
+}
+
+
+/* registered in driver struct */
+static int __devexit cyttsp_i2c_remove(struct i2c_client *client)
+{
+	struct cyttsp_i2c *ts;
+
+	ts = i2c_get_clientdata(client);
+	cyttsp_core_release(ts->ttsp_client);
+	kfree(ts);
+	return 0;
+}
+
+#ifdef CONFIG_PM
+static int cyttsp_i2c_suspend(struct device *dev)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct cyttsp_i2c *ts = i2c_get_clientdata(client);
+
+	return cyttsp_suspend(ts->ttsp_client);
+}
+
+static int cyttsp_i2c_resume(struct device *dev)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct cyttsp_i2c *ts = i2c_get_clientdata(client);
+
+	return cyttsp_resume(ts->ttsp_client);
+}
+static SIMPLE_DEV_PM_OPS(cyttsp_i2c_pm, cyttsp_i2c_suspend, cyttsp_i2c_resume);
+#endif
+
+static const struct i2c_device_id cyttsp_i2c_id[] = {
+	{ CY_I2C_NAME, 0 },  { }
+};
+
+static struct i2c_driver cyttsp_i2c_driver = {
+	.driver = {
+		.name = CY_I2C_NAME,
+		.owner = THIS_MODULE,
+#ifdef CONFIG_PM
+		.pm = &cyttsp_i2c_pm,
+#endif
+	},
+	.probe = cyttsp_i2c_probe,
+	.remove = __devexit_p(cyttsp_i2c_remove),
+	.id_table = cyttsp_i2c_id,
+};
+
+static int __init cyttsp_i2c_init(void)
+{
+	return i2c_add_driver(&cyttsp_i2c_driver);
+}
+
+static void __exit cyttsp_i2c_exit(void)
+{
+	return i2c_del_driver(&cyttsp_i2c_driver);
+}
+
+module_init(cyttsp_i2c_init);
+module_exit(cyttsp_i2c_exit);
+
+MODULE_ALIAS("i2c:cyttsp");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Cypress TrueTouch(R) Standard Product (TTSP) I2C driver");
+MODULE_AUTHOR("Cypress");
+MODULE_DEVICE_TABLE(i2c, cyttsp_i2c_id);
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH v7 1/3] Input: cyttsp - Cypress TTSP capacitive multi-touch screen support
From: Javier Martinez Canillas @ 2011-10-23 18:53 UTC (permalink / raw)
  To: Henrik Rydberg
  Cc: Dmitry Torokhov, Mohan Pallaka, Kevin McNeely, Shubhrajyoti Datta,
	linux-input, linux-kernel, Javier Martinez Canillas
In-Reply-To: <1319396024-28558-1-git-send-email-martinez.javier@gmail.com>

Cypress TrueTouch(tm) Standard Product controllers are found in
a wide range of embedded devices. This driver add support for a
variety of TTSP controllers.

Since the hardware is capable of tracking identifiable contacts, multi-touch
protocol type B (stateful) is used to report contact information.

The driver is composed of a core driver that process the data sent by
the contacts and a set of bus specific interface modules. This patch
adds the base core TTSP driver.

Signed-off-by: Javier Martinez Canillas <martinez.javier@gmail.com>
---

v2: Fix issues called out by Dmitry Torokhov
     - Add msleep() delays between retries for read and write operations.
     - Change cyttsp_core_init() to receive the IRQ from the client data 
       instead of obtaining from the platform_data.

v3: Fix issues called out by Henrik Rydberg and Mohan Pallaka
    - Map each possible track id to a multitouch input slot.
    - Remove bus type info since it is not used.
    - Add retry logic to ttsp_write_block_data().
    - ttsp_read_block_data() already msleep() remove the sleep in the caller.
    - cyttsp_xy_worker() sounds as if it's a workqueue, change the function name.
    - Check if handle is NULL in cyttsp_resume().
    - Use platform data's use_sleep to decide to go deep sleep or low power mode.
    - input_register_device() error path has to call input_free_device().

v4: Fix issues called out by Henrik Rydberg
    - Remove unnecesary code and cleanup contact handler since input core is able
      to detect duplicates.

v5: Fix issues called out by Henrik Rydberg
    - Cleanup ttsp_[read | write]_block_data functions.
    - Remove unused code to handle extended touch data.
    - Simplify code in cyttsp_bl_app_data() and cyttsp_soft_reset().

v6: Fix issues called out by Henrik Rydberg
    - Remove unneeded retval variables in load_bl_regs() and soft_reset().
    - Delete debug paths in bl_app_valid() and exit_bl_mode().
    - Simplify logic expressions in exit_bl_mode() and set_operational_mode().
    - Check for tries >= CY_DELAY_MAX errors and report accordingly.
    - Correct usage of bitwise operators.

 drivers/input/touchscreen/Kconfig              |    2 +
 drivers/input/touchscreen/Makefile             |    1 +
 drivers/input/touchscreen/cyttsp/Kconfig       |   36 ++
 drivers/input/touchscreen/cyttsp/Makefile      |    3 +
 drivers/input/touchscreen/cyttsp/cyttsp_core.c |  769 ++++++++++++++++++++++++
 drivers/input/touchscreen/cyttsp/cyttsp_core.h |   60 ++
 include/linux/input/cyttsp.h                   |   71 +++
 7 files changed, 942 insertions(+), 0 deletions(-)
 create mode 100644 drivers/input/touchscreen/cyttsp/Kconfig
 create mode 100644 drivers/input/touchscreen/cyttsp/Makefile
 create mode 100644 drivers/input/touchscreen/cyttsp/cyttsp_core.c
 create mode 100644 drivers/input/touchscreen/cyttsp/cyttsp_core.h
 create mode 100644 include/linux/input/cyttsp.h

diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index cabd9e5..6933823 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -726,4 +726,6 @@ config TOUCHSCREEN_TPS6507X
 	  To compile this driver as a module, choose M here: the
 	  module will be called tps6507x_ts.
 
+source "drivers/input/touchscreen/cyttsp/Kconfig"
+
 endif
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index 282d6f7..945950a 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -60,3 +60,4 @@ obj-$(CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE)	+= mainstone-wm97xx.o
 obj-$(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE)	+= zylonite-wm97xx.o
 obj-$(CONFIG_TOUCHSCREEN_W90X900)	+= w90p910_ts.o
 obj-$(CONFIG_TOUCHSCREEN_TPS6507X)	+= tps6507x-ts.o
+obj-$(CONFIG_TOUCHSCREEN_CYTTSP_CORE)	+= cyttsp/
diff --git a/drivers/input/touchscreen/cyttsp/Kconfig b/drivers/input/touchscreen/cyttsp/Kconfig
new file mode 100644
index 0000000..c8bc322
--- /dev/null
+++ b/drivers/input/touchscreen/cyttsp/Kconfig
@@ -0,0 +1,36 @@
+config TOUCHSCREEN_CYTTSP_CORE
+	tristate "Cypress TTSP touchscreen core"
+	depends on INPUT_TOUCHSCREEN
+	help
+          Say Y here if you have a touchscreen interface using one
+          controller from the Cypress TrueTouch(tm) Standard Product
+	  family.
+
+	  If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called cyttsp_core.
+
+config TOUCHSCREEN_CYTTSP_I2C
+	tristate "Cypress TTSP i2c touchscreen"
+	depends on I2C && TOUCHSCREEN_CYTTSP_CORE
+	help
+	  Say Y here if you have a Cypress TTSP touchscreen
+	  connected to your system with an I2C interface.
+
+	  If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called cyttsp_i2c.
+
+config TOUCHSCREEN_CYTTSP_SPI
+	tristate "Cypress TTSP spi touchscreen"
+	depends on SPI_MASTER && TOUCHSCREEN_CYTTSP_CORE
+	help
+	  Say Y here if you have a Cypress TTSP touchscreen
+	  connected to your  with an SPI interface.
+
+	  If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called cyttsp_spi.
diff --git a/drivers/input/touchscreen/cyttsp/Makefile b/drivers/input/touchscreen/cyttsp/Makefile
new file mode 100644
index 0000000..687eeaa
--- /dev/null
+++ b/drivers/input/touchscreen/cyttsp/Makefile
@@ -0,0 +1,3 @@
+obj-$(CONFIG_TOUCHSCREEN_CYTTSP_CORE)   += cyttsp_core.o
+obj-$(CONFIG_TOUCHSCREEN_CYTTSP_I2C)    += cyttsp_i2c.o
+obj-$(CONFIG_TOUCHSCREEN_CYTTSP_SPI)    += cyttsp_spi.o
diff --git a/drivers/input/touchscreen/cyttsp/cyttsp_core.c b/drivers/input/touchscreen/cyttsp/cyttsp_core.c
new file mode 100644
index 0000000..103ac39
--- /dev/null
+++ b/drivers/input/touchscreen/cyttsp/cyttsp_core.c
@@ -0,0 +1,769 @@
+/*
+ * Core Source for:
+ * Cypress TrueTouch(TM) Standard Product (TTSP) touchscreen drivers.
+ * For use with Cypress Txx3xx parts.
+ * Supported parts include:
+ * CY8CTST341
+ * CY8CTMA340
+ *
+ * Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
+ * Copyright (C) 2011 Javier Martinez Canillas <martinez.javier@gmail.com>
+ *
+ * Multi-touch protocol type B support and cleanups by Javier Martinez Canillas
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2, and only version 2, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contact Cypress Semiconductor at www.cypress.com <kev@cypress.com>
+ *
+ */
+
+#include "cyttsp_core.h"
+
+#include <linux/delay.h>
+#include <linux/input.h>
+#include <linux/input/mt.h>
+#include <linux/gpio.h>
+#include <linux/interrupt.h>
+#include <linux/slab.h>
+
+/* Bootloader number of command keys */
+#define CY_NUM_BL_KEYS    8
+
+/* helpers */
+#define GET_NUM_TOUCHES(x)          ((x) & 0x0F)
+#define IS_LARGE_AREA(x)            (((x) & 0x10) >> 4)
+#define IS_BAD_PKT(x)               ((x) & 0x20)
+#define IS_VALID_APP(x)             ((x) & 0x01)
+#define IS_OPERATIONAL_ERR(x)       ((x) & 0x3F)
+#define GET_HSTMODE(reg)            ((reg & 0x70) >> 4)
+#define GET_BOOTLOADERMODE(reg)     ((reg & 0x10) >> 4)
+
+#define CY_REG_BASE                 0x00
+#define CY_REG_ACT_DIST             0x1E
+#define CY_REG_ACT_INTRVL           0x1D
+#define CY_REG_TCH_TMOUT            (CY_REG_ACT_INTRVL+1)
+#define CY_REG_LP_INTRVL            (CY_REG_TCH_TMOUT+1)
+#define CY_MAXZ                     255
+#define CY_DELAY_DFLT               20 /* ms */
+#define CY_DELAY_MAX                (500/CY_DELAY_DFLT) /* half second */
+#define CY_ACT_DIST_DFLT            0xF8
+#define CY_HNDSHK_BIT               0x80
+/* device mode bits */
+#define CY_OPERATE_MODE             0x00
+#define CY_SYSINFO_MODE             0x10
+/* power mode select bits */
+#define CY_SOFT_RESET_MODE          0x01 /* return to Bootloader mode */
+#define CY_DEEP_SLEEP_MODE          0x02
+#define CY_LOW_POWER_MODE           0x04
+
+/* Slots management */
+#define CY_MAX_FINGER               4
+#define CY_MAX_ID                   16
+
+struct cyttsp_tch {
+	__be16 x, y;
+	u8 z;
+} __packed;
+
+/* TrueTouch Standard Product Gen3 interface definition */
+struct cyttsp_xydata {
+	u8 hst_mode;
+	u8 tt_mode;
+	u8 tt_stat;
+	struct cyttsp_tch tch1;
+	u8 touch12_id;
+	struct cyttsp_tch tch2;
+	u8 gest_cnt;
+	u8 gest_id;
+	struct cyttsp_tch tch3;
+	u8 touch34_id;
+	struct cyttsp_tch tch4;
+	u8 tt_undef[3];
+	u8 act_dist;
+	u8 tt_reserved;
+} __packed;
+
+/* TTSP System Information interface definition */
+struct cyttsp_sysinfo_data {
+	u8 hst_mode;
+	u8 mfg_cmd;
+	u8 mfg_stat;
+	u8 cid[3];
+	u8 tt_undef1;
+	u8 uid[8];
+	u8 bl_verh;
+	u8 bl_verl;
+	u8 tts_verh;
+	u8 tts_verl;
+	u8 app_idh;
+	u8 app_idl;
+	u8 app_verh;
+	u8 app_verl;
+	u8 tt_undef[5];
+	u8 scn_typ;
+	u8 act_intrvl;
+	u8 tch_tmout;
+	u8 lp_intrvl;
+};
+
+/* TTSP Bootloader Register Map interface definition */
+#define CY_BL_CHKSUM_OK 0x01
+struct cyttsp_bootloader_data {
+	u8 bl_file;
+	u8 bl_status;
+	u8 bl_error;
+	u8 blver_hi;
+	u8 blver_lo;
+	u8 bld_blver_hi;
+	u8 bld_blver_lo;
+	u8 ttspver_hi;
+	u8 ttspver_lo;
+	u8 appid_hi;
+	u8 appid_lo;
+	u8 appver_hi;
+	u8 appver_lo;
+	u8 cid_0;
+	u8 cid_1;
+	u8 cid_2;
+};
+
+struct cyttsp {
+	struct device *dev;
+	int irq;
+	struct input_dev *input;
+	char phys[32];
+	const struct cyttsp_platform_data *platform_data;
+	struct cyttsp_bus_ops *bus_ops;
+	struct cyttsp_bootloader_data bl_data;
+	struct cyttsp_sysinfo_data sysinfo_data;
+	struct completion bl_ready;
+	enum cyttsp_powerstate power_state;
+};
+
+static const u8 bl_command[] = {
+	0x00,			/* file offset */
+	0xFF,			/* command */
+	0xA5,			/* exit bootloader command */
+	0, 1, 2, 3, 4, 5, 6, 7	/* default keys */
+};
+
+static int ttsp_read_block_data(struct cyttsp *ts, u8 command,
+	u8 length, void *buf)
+{
+	int retval = -1;
+	int tries;
+
+	if (!buf || !length)
+		return -EINVAL;
+
+	for (tries = 0; tries < CY_NUM_RETRY && (retval < 0); tries++) {
+		retval = ts->bus_ops->read(ts->bus_ops, command, length, buf);
+		if (retval)
+			msleep(CY_DELAY_DFLT);
+	}
+
+	return retval;
+}
+
+static int ttsp_write_block_data(struct cyttsp *ts, u8 command,
+	u8 length, void *buf)
+{
+	int retval = -1;
+	int tries;
+
+	if (!buf || !length)
+		return -EINVAL;
+
+	for (tries = 0; tries < CY_NUM_RETRY && (retval < 0); tries++) {
+		retval = ts->bus_ops->write(ts->bus_ops, command, length, buf);
+		if (retval)
+			msleep(CY_DELAY_DFLT);
+	}
+
+	return retval;
+}
+
+static int cyttsp_load_bl_regs(struct cyttsp *ts)
+{
+	memset(&(ts->bl_data), 0, sizeof(struct cyttsp_bootloader_data));
+
+	ts->bl_data.bl_status = 0x10;
+
+	return  ttsp_read_block_data(ts, CY_REG_BASE, sizeof(ts->bl_data),
+				     &ts->bl_data);
+}
+
+static int cyttsp_bl_app_valid(struct cyttsp *ts)
+{
+	int retval;
+
+	retval = cyttsp_load_bl_regs(ts);
+
+	if (retval < 0) {
+		retval = -ENODEV;
+		goto done;
+	}
+
+	if (GET_BOOTLOADERMODE(ts->bl_data.bl_status)) {
+		if (IS_VALID_APP(ts->bl_data.bl_status))
+			return 0;
+		else
+			return -ENODEV;
+	}
+
+	if (GET_HSTMODE(ts->bl_data.bl_file) == CY_OPERATE_MODE) {
+		if (!(IS_OPERATIONAL_ERR(ts->bl_data.bl_status)))
+			return 1;
+		else
+			return -ENODEV;
+	}
+
+	retval = -ENODEV;
+done:
+	return retval;
+}
+
+static int cyttsp_exit_bl_mode(struct cyttsp *ts)
+{
+	int retval;
+	int tries;
+	u8 bl_cmd[sizeof(bl_command)];
+
+	memcpy(bl_cmd, bl_command, sizeof(bl_command));
+	if (ts->platform_data->bl_keys)
+		memcpy(&bl_cmd[sizeof(bl_command) - CY_NUM_BL_KEYS],
+			ts->platform_data->bl_keys, sizeof(bl_command));
+
+	retval = ttsp_write_block_data(ts, CY_REG_BASE,
+		sizeof(bl_cmd), (void *)bl_cmd);
+
+	if (retval < 0)
+		return retval;
+
+	/* wait for TTSP Device to complete switch to Operational mode */
+	tries = 0;
+	do {
+		msleep(CY_DELAY_DFLT);
+		retval = cyttsp_load_bl_regs(ts);
+	} while ((retval || GET_BOOTLOADERMODE(ts->bl_data.bl_status)) &&
+		(tries++ < CY_DELAY_MAX));
+
+	if (tries >= CY_DELAY_MAX)
+		return -ENODEV;
+
+	return retval;
+}
+
+static int cyttsp_set_operational_mode(struct cyttsp *ts)
+{
+	struct cyttsp_xydata xy_data;
+	int retval;
+	int tries = 0;
+	u8 cmd = CY_OPERATE_MODE;
+
+	retval = ttsp_write_block_data(ts, CY_REG_BASE, sizeof(cmd), &cmd);
+
+	if (retval < 0)
+		return retval;
+
+	/* wait for TTSP Device to complete switch to Operational mode */
+	do {
+		retval = ttsp_read_block_data(ts, CY_REG_BASE,
+			sizeof(xy_data), &(xy_data));
+	} while ((retval || xy_data.act_dist != CY_ACT_DIST_DFLT) &&
+		 (tries++ < CY_DELAY_MAX));
+
+	if (tries >= CY_DELAY_MAX)
+		return -EAGAIN;
+
+	return retval;
+}
+
+static int cyttsp_set_sysinfo_mode(struct cyttsp *ts)
+{
+	int retval;
+	int tries;
+	u8 cmd = CY_SYSINFO_MODE;
+
+	memset(&(ts->sysinfo_data), 0, sizeof(struct cyttsp_sysinfo_data));
+
+	/* switch to sysinfo mode */
+	retval = ttsp_write_block_data(ts, CY_REG_BASE, sizeof(cmd), &cmd);
+	if (retval < 0)
+		return retval;
+
+	/* read sysinfo registers */
+	tries = 0;
+	do {
+		msleep(CY_DELAY_DFLT);
+		retval = ttsp_read_block_data(ts, CY_REG_BASE,
+			sizeof(ts->sysinfo_data), &ts->sysinfo_data);
+	} while ((retval || (!ts->sysinfo_data.tts_verh &&
+			     !ts->sysinfo_data.tts_verl)) &&
+		 (tries++ < CY_DELAY_MAX));
+
+	if (tries >= CY_DELAY_MAX)
+		return -EAGAIN;
+
+	return retval;
+}
+
+static int cyttsp_set_sysinfo_regs(struct cyttsp *ts)
+{
+	int retval = 0;
+
+	if (ts->platform_data->act_intrvl != CY_ACT_INTRVL_DFLT ||
+		ts->platform_data->tch_tmout != CY_TCH_TMOUT_DFLT ||
+		ts->platform_data->lp_intrvl != CY_LP_INTRVL_DFLT) {
+
+		u8 intrvl_ray[3];
+
+		intrvl_ray[0] = ts->platform_data->act_intrvl;
+		intrvl_ray[1] = ts->platform_data->tch_tmout;
+		intrvl_ray[2] = ts->platform_data->lp_intrvl;
+
+		/* set intrvl registers */
+		retval = ttsp_write_block_data(ts,
+				CY_REG_ACT_INTRVL,
+				sizeof(intrvl_ray), intrvl_ray);
+
+		msleep(CY_DELAY_DFLT);
+	}
+
+	return retval;
+}
+
+static int cyttsp_soft_reset(struct cyttsp *ts)
+{
+	int retval;
+	u8 cmd = CY_SOFT_RESET_MODE;
+	long wait_jiffies = msecs_to_jiffies(CY_DELAY_DFLT * CY_DELAY_MAX);
+	/* wait for interrupt to set ready completion */
+	INIT_COMPLETION(ts->bl_ready);
+
+	retval = ttsp_write_block_data(ts, CY_REG_BASE, sizeof(cmd), &cmd);
+	if (retval < 0)
+		return retval;
+
+	return wait_for_completion_timeout(&ts->bl_ready, wait_jiffies);
+}
+
+static int cyttsp_act_dist_setup(struct cyttsp *ts)
+{
+	int retval;
+	u8 act_dist_setup;
+
+	/* Init gesture; active distance setup */
+	act_dist_setup = ts->platform_data->act_dist;
+	retval = ttsp_write_block_data(ts, CY_REG_ACT_DIST,
+		sizeof(act_dist_setup), &act_dist_setup);
+
+	return retval;
+}
+
+static int cyttsp_hndshk(struct cyttsp *ts, u8 hst_mode)
+{
+	u8 cmd;
+
+	cmd = hst_mode ^ CY_HNDSHK_BIT;
+
+	return ttsp_write_block_data(ts, CY_REG_BASE, sizeof(cmd), (u8 *)&cmd);
+}
+
+static void cyttsp_report_slot(struct input_dev *dev, int slot,
+			       int x, int y, int z)
+{
+	input_mt_slot(dev, slot);
+	input_mt_report_slot_state(dev, MT_TOOL_FINGER, true);
+	input_report_abs(dev, ABS_MT_POSITION_X, x);
+	input_report_abs(dev, ABS_MT_POSITION_Y, y);
+	input_report_abs(dev, ABS_MT_TOUCH_MAJOR, z);
+}
+
+static void cyttsp_report_slot_empty(struct input_dev *dev, int slot)
+{
+	input_mt_slot(dev, slot);
+	input_mt_report_slot_state(dev, MT_TOOL_FINGER, false);
+}
+
+static void cyttsp_extract_track_ids(struct cyttsp_xydata *xy_data, int *ids)
+{
+	ids[0] = xy_data->touch12_id >> 4;
+	ids[1] = xy_data->touch12_id & 0xF;
+	ids[2] = xy_data->touch34_id >> 4;
+	ids[3] = xy_data->touch34_id & 0xF;
+}
+
+static const struct cyttsp_tch *cyttsp_get_tch(struct cyttsp_xydata *xy_data,
+					       int idx)
+{
+	switch (idx) {
+	case 0:
+		return &xy_data->tch1;
+	case 1:
+		return &xy_data->tch2;
+	case 2:
+		return &xy_data->tch3;
+	case 3:
+		return  &xy_data->tch4;
+	default:
+		return NULL;
+	}
+}
+
+static int cyttsp_handle_tchdata(struct cyttsp *ts)
+{
+	struct cyttsp_xydata xy_data;
+	u8 num_cur_tch;
+	int i;
+	int ids[4];
+	const struct cyttsp_tch *tch = NULL;
+	int x, y, z;
+	int used = 0;
+
+	/* Get touch data from CYTTSP device */
+	if (ttsp_read_block_data(ts,
+		CY_REG_BASE, sizeof(struct cyttsp_xydata), &xy_data))
+		return 0;
+
+	/* provide flow control handshake */
+	if (ts->platform_data->use_hndshk)
+		if (cyttsp_hndshk(ts, xy_data.hst_mode))
+			return 0;
+
+	/* determine number of currently active touches */
+	num_cur_tch = GET_NUM_TOUCHES(xy_data.tt_stat);
+
+	/* check for any error conditions */
+	if (ts->power_state == CY_IDLE_STATE)
+		return 0;
+	else if (GET_BOOTLOADERMODE(xy_data.tt_mode)) {
+		return -1;
+	} else if (IS_LARGE_AREA(xy_data.tt_stat) == 1) {
+		/* terminate all active tracks */
+		num_cur_tch = 0;
+		dev_dbg(ts->dev, "%s: Large area detected\n", __func__);
+	} else if (num_cur_tch > CY_MAX_FINGER) {
+		/* terminate all active tracks */
+		num_cur_tch = 0;
+		dev_dbg(ts->dev, "%s: Num touch error detected\n", __func__);
+	} else if (IS_BAD_PKT(xy_data.tt_mode)) {
+		/* terminate all active tracks */
+		num_cur_tch = 0;
+		dev_dbg(ts->dev, "%s: Invalid buffer detected\n", __func__);
+	}
+
+	cyttsp_extract_track_ids(&xy_data, ids);
+
+	for (i = 0; i < num_cur_tch; i++) {
+		used |= (1 << ids[i]);
+
+		tch = cyttsp_get_tch(&xy_data, i);
+
+		x = be16_to_cpu(tch->x);
+		y = be16_to_cpu(tch->y);
+		z = tch->z;
+
+		cyttsp_report_slot(ts->input, ids[i], x, y, z);
+	}
+
+	for (i = 0; i < CY_MAX_ID; i++)
+		if (!(used & (1 << i)))
+			cyttsp_report_slot_empty(ts->input, i);
+
+	input_sync(ts->input);
+
+	return 0;
+}
+
+static void cyttsp_pr_state(struct cyttsp *ts)
+{
+	static char *cyttsp_powerstate_string[] = {
+		"IDLE",
+		"ACTIVE",
+		"LOW_PWR",
+		"SLEEP",
+		"BOOTLOADER",
+		"INVALID"
+	};
+
+	dev_info(ts->dev, "%s: %s\n", __func__,
+		ts->power_state < CY_INVALID_STATE ?
+		cyttsp_powerstate_string[ts->power_state] :
+		"INVALID");
+}
+
+static irqreturn_t cyttsp_irq(int irq, void *handle)
+{
+	struct cyttsp *ts = handle;
+	int retval;
+
+	if (ts->power_state == CY_BL_STATE)
+		complete(&ts->bl_ready);
+	else {
+		/* process the touches */
+		retval = cyttsp_handle_tchdata(ts);
+
+		if (retval < 0) {
+			/*
+			 * TTSP device has reset back to bootloader mode.
+			 * Restore to operational mode.
+			 */
+			retval = cyttsp_exit_bl_mode(ts);
+			if (retval)
+				ts->power_state = CY_IDLE_STATE;
+			else
+				ts->power_state = CY_ACTIVE_STATE;
+			cyttsp_pr_state(ts);
+		}
+	}
+
+	return IRQ_HANDLED;
+}
+
+static int cyttsp_power_on(struct cyttsp *ts)
+{
+	int retval = 0;
+
+	if (!ts)
+		return -ENOMEM;
+
+	ts->power_state = CY_BL_STATE;
+
+	/* enable interrupts */
+	retval = request_threaded_irq(ts->irq, NULL, cyttsp_irq,
+		IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+		ts->platform_data->name, ts);
+	if (retval < 0)
+		goto bypass;
+
+	retval = cyttsp_soft_reset(ts);
+	if (retval == 0)
+		goto bypass;
+
+	retval = cyttsp_bl_app_valid(ts);
+	if (retval < 0)
+		goto bypass;
+	else if (retval > 0)
+		goto no_bl_bypass;
+
+	retval = cyttsp_exit_bl_mode(ts);
+
+	if (retval < 0)
+		goto bypass;
+
+	ts->power_state = CY_IDLE_STATE;
+
+no_bl_bypass:
+	retval = cyttsp_set_sysinfo_mode(ts);
+	if (retval < 0)
+		goto bypass;
+
+	retval = cyttsp_set_sysinfo_regs(ts);
+	if (retval < 0)
+		goto bypass;
+
+	retval = cyttsp_set_operational_mode(ts);
+	if (retval < 0)
+		goto bypass;
+
+	/* init active distance */
+	retval = cyttsp_act_dist_setup(ts);
+	if (retval < 0)
+		goto bypass;
+
+	ts->power_state = CY_ACTIVE_STATE;
+	retval = 0;
+
+bypass:
+	cyttsp_pr_state(ts);
+	return retval;
+}
+
+#ifdef CONFIG_PM
+int cyttsp_resume(void *handle)
+{
+	struct cyttsp *ts = handle;
+	int retval = 0;
+	struct cyttsp_xydata xydata;
+
+	if (!ts)
+		return retval;
+
+	if (ts->platform_data->use_sleep && (ts->power_state !=
+					     CY_ACTIVE_STATE)) {
+
+		if (ts->platform_data->wakeup)
+			retval = ts->platform_data->wakeup();
+		else
+			retval = -ENOSYS;
+
+		if (retval >= 0) {
+			retval = ttsp_read_block_data(ts, CY_REG_BASE,
+						      sizeof(xydata),
+						      &xydata);
+			if (retval >= 0 &&
+			    !GET_HSTMODE(xydata.hst_mode))
+				ts->power_state = CY_ACTIVE_STATE;
+		}
+	}
+
+	return retval;
+}
+EXPORT_SYMBOL_GPL(cyttsp_resume);
+
+int cyttsp_suspend(void *handle)
+{
+	struct cyttsp *ts = handle;
+	u8 sleep_mode = 0;
+	int retval = 0;
+
+	if (ts->platform_data->use_sleep &&
+		(ts->power_state == CY_ACTIVE_STATE)) {
+		sleep_mode = ts->platform_data->use_sleep;
+		retval = ttsp_write_block_data(ts,
+			CY_REG_BASE, sizeof(sleep_mode), &sleep_mode);
+		if (retval >= 0)
+			ts->power_state = CY_SLEEP_STATE;
+	}
+
+	return retval;
+}
+EXPORT_SYMBOL_GPL(cyttsp_suspend);
+#endif
+
+static int cyttsp_open(struct input_dev *dev)
+{
+	struct cyttsp *ts = input_get_drvdata(dev);
+
+	return cyttsp_power_on(ts);
+}
+
+void cyttsp_core_release(void *handle)
+{
+	struct cyttsp *ts = handle;
+
+	if (ts) {
+		free_irq(ts->irq, ts);
+		input_unregister_device(ts->input);
+		if (ts->platform_data->exit)
+			ts->platform_data->exit();
+		input_mt_destroy_slots(ts->input);
+		kfree(ts);
+	}
+}
+EXPORT_SYMBOL_GPL(cyttsp_core_release);
+
+static void cyttsp_close(struct input_dev *dev)
+{
+	struct cyttsp *ts = input_get_drvdata(dev);
+
+	free_irq(ts->irq, ts);
+}
+
+void *cyttsp_core_init(struct cyttsp_bus_ops *bus_ops,
+		       struct device *dev, int irq)
+{
+	struct input_dev *input_device;
+	int ret;
+
+	struct cyttsp *ts = kzalloc(sizeof(*ts), GFP_KERNEL);
+
+	if (!ts) {
+		pr_err("%s: Error, kzalloc\n", __func__);
+		goto error_alloc_data;
+	}
+
+	if (dev == NULL || bus_ops == NULL) {
+		kfree(ts);
+		goto error_alloc_data;
+	}
+
+	ts->dev = dev;
+	ts->platform_data = dev->platform_data;
+	ts->bus_ops = bus_ops;
+	init_completion(&ts->bl_ready);
+
+	if (ts->platform_data->init) {
+		if (ts->platform_data->init()) {
+			dev_dbg(ts->dev, "%s: Error, platform init failed!\n",
+				__func__);
+			goto error_init;
+		}
+	}
+
+	ts->irq = irq;
+	if (ts->irq <= 0) {
+		dev_dbg(ts->dev, "%s: Error, failed to allocate irq\n",
+			__func__);
+			goto error_init;
+	}
+
+	/* Create the input device and register it. */
+	input_device = input_allocate_device();
+	if (!input_device) {
+		dev_dbg(ts->dev, "%s: Error, failed to allocate input device\n",
+			__func__);
+		goto error_input_allocate_device;
+	}
+
+	ts->input = input_device;
+	input_device->name = ts->platform_data->name;
+	snprintf(ts->phys, sizeof(ts->phys), "%s", dev_name(dev));
+	input_device->phys = ts->phys;
+	input_device->dev.parent = ts->dev;
+	input_device->open = cyttsp_open;
+	input_device->close = cyttsp_close;
+	input_set_drvdata(input_device, ts);
+
+	__set_bit(EV_SYN, input_device->evbit);
+	__set_bit(EV_KEY, input_device->evbit);
+	__set_bit(EV_ABS, input_device->evbit);
+
+	input_set_abs_params(input_device, ABS_MT_POSITION_X,
+			     0, ts->platform_data->maxx, 0, 0);
+	input_set_abs_params(input_device, ABS_MT_POSITION_Y,
+			     0, ts->platform_data->maxy, 0, 0);
+	input_set_abs_params(input_device, ABS_MT_TOUCH_MAJOR,
+			     0, CY_MAXZ, 0, 0);
+
+	input_mt_init_slots(input_device, CY_MAX_ID);
+
+	ret = input_register_device(input_device);
+	if (ret) {
+		dev_err(ts->dev, "%s: Error, failed to register input device: %d\n",
+			__func__, ret);
+		goto error_input_register_device;
+	}
+
+	goto no_error;
+
+error_input_register_device:
+	input_free_device(input_device);
+error_input_allocate_device:
+	if (ts->platform_data->exit)
+		ts->platform_data->exit();
+error_init:
+	kfree(ts);
+error_alloc_data:
+no_error:
+	return ts;
+}
+EXPORT_SYMBOL_GPL(cyttsp_core_init);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Cypress TrueTouch(R) Standard touchscreen driver core");
+MODULE_AUTHOR("Cypress");
+
diff --git a/drivers/input/touchscreen/cyttsp/cyttsp_core.h b/drivers/input/touchscreen/cyttsp/cyttsp_core.h
new file mode 100644
index 0000000..efefdb9
--- /dev/null
+++ b/drivers/input/touchscreen/cyttsp/cyttsp_core.h
@@ -0,0 +1,60 @@
+/*
+ * Header file for:
+ * Cypress TrueTouch(TM) Standard Product (TTSP) touchscreen drivers.
+ * For use with Cypress Txx3xx parts.
+ * Supported parts include:
+ * CY8CTST341
+ * CY8CTMA340
+ *
+ * Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
+ * Copyright (C) 2011 Javier Martinez Canillas <martinez.javier@gmail.com>
+ *
+ * Multi-touch protocol type B support and cleanups by Javier Martinez Canillas
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2, and only version 2, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contact Cypress Semiconductor at www.cypress.com <kev@cypress.com>
+ *
+ */
+
+
+#ifndef __CYTTSP_CORE_H__
+#define __CYTTSP_CORE_H__
+
+#include <linux/kernel.h>
+#include <linux/err.h>
+#include <linux/module.h>
+#include <linux/input/cyttsp.h>
+
+#define CY_NUM_RETRY                4 /* max number of retries for read ops */
+
+
+struct cyttsp_bus_ops {
+	s32 (*write)(void *handle, u8 addr, u8 length, const void *values);
+	s32 (*read)(void *handle, u8 addr, u8 length, void *values);
+	s32 (*ext)(void *handle, void *values);
+	struct device *dev;
+};
+
+void *cyttsp_core_init(struct cyttsp_bus_ops *bus_ops,
+		       struct device *dev, int irq);
+
+void cyttsp_core_release(void *handle);
+#ifdef CONFIG_PM
+int cyttsp_resume(void *handle);
+int cyttsp_suspend(void *handle);
+#endif
+
+#endif /* __CYTTSP_CORE_H__ */
diff --git a/include/linux/input/cyttsp.h b/include/linux/input/cyttsp.h
new file mode 100644
index 0000000..324344e
--- /dev/null
+++ b/include/linux/input/cyttsp.h
@@ -0,0 +1,71 @@
+/*
+ * Header file for:
+ * Cypress TrueTouch(TM) Standard Product (TTSP) touchscreen drivers.
+ * For use with Cypress Txx3xx parts.
+ * Supported parts include:
+ * CY8CTST341
+ * CY8CTMA340
+ *
+ * Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
+ * Copyright (C) 2011 Javier Martinez Canillas <martinez.javier@gmail.com>
+ *
+ * Multi-touch protocol type B support and cleanups by Javier Martinez Canillas
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2, and only version 2, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contact Cypress Semiconductor at www.cypress.com (kev@cypress.com)
+ *
+ */
+#ifndef _CYTTSP_H_
+#define _CYTTSP_H_
+
+#define CY_SPI_NAME "cyttsp-spi"
+#define CY_I2C_NAME "cyttsp-i2c"
+/* Active Power state scanning/processing refresh interval */
+#define CY_ACT_INTRVL_DFLT 0x00 /* ms */
+/* touch timeout for the Active power */
+#define CY_TCH_TMOUT_DFLT 0xFF /* ms */
+/* Low Power state scanning/processing refresh interval */
+#define CY_LP_INTRVL_DFLT 0x0A /* ms */
+/* Active distance in pixels for a gesture to be reported */
+#define CY_ACT_DIST_DFLT 0xF8 /* pixels */
+
+enum cyttsp_powerstate {
+	CY_IDLE_STATE,
+	CY_ACTIVE_STATE,
+	CY_LOW_PWR_STATE,
+	CY_SLEEP_STATE,
+	CY_BL_STATE,
+	CY_INVALID_STATE	/* always last in the list */
+};
+
+struct cyttsp_platform_data {
+	u32 maxx;
+	u32 maxy;
+	bool use_hndshk;
+	bool use_sleep;
+	u8 act_dist;	/* Active distance */
+	u8 act_intrvl;  /* Active refresh interval; ms */
+	u8 tch_tmout;   /* Active touch timeout; ms */
+	u8 lp_intrvl;   /* Low power refresh interval; ms */
+	int (*wakeup)(void);
+	int (*init)(void);
+	void (*exit)(void);
+	char *name;
+	s16 irq_gpio;
+	u8 *bl_keys;
+};
+
+#endif /* _CYTTSP_H_ */
-- 
1.7.4.1

^ permalink raw reply related

* Re: [PATCH 1/2] LSM: Do not apply mmap_min_addr check to PROT_NONE mappings
From: Roland McGrath @ 2011-10-23 18:52 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Andrew Morton, James Morris, Eric Paris, Stephen Smalley, selinux,
	John Johansen, linux-security-module, linux-kernel
In-Reply-To: <CA+55aFx_9D8jY2sqcZ+Tm305W9d8o+ZhEv8XNWuN4--S2bqRwQ@mail.gmail.com>

> The app can try to be robust by doing the mmap(PROT_NONE), but if that
> fails, then the app should just let it go.

Indeed the application does not get unhappy about the mmap failing.  It
does need to try it in a loop, moving up a page after each failure, though.
Its own robustness requirement mandates that space up to 0x10000 be blocked
off, even if the system is only enforcing it up to 0x1000, for example.

> But that's no reason for the kernel to *allow* the mapping.

I don't have a problem with that.

> So I was looking for some *other* reason for the patch.

As I explained, the rationale was not to have any LSM modules (such as
SELinux) complaining about the attempt.

> Btw, if the only concern is "you don't want to elevate the selinux
> denial to be some user-visible thing", then I'd suggest attacking
> *that* issue directly.

That's fine with me too.

> For example, maybe we could fail the PROT_NONE mmap (ie not actually
> create any mapping at all, and certainly not create anything that is
> then mprotectable), but return success and not elevate it to be
> reported.

That works, though AFAICT it needs this slightly more complex logic
repeated in each different LSM.

> But then it really is important to return success, because otherwise
> it would be a "silent probe" of the security model (ie a bad user
> could use the mmap(PROT_NONE) to see if min_mmap_addr is on or not
> without triggering any selinux warnings).

Agreed.

> And unlike your patch, it wouldn't open up some new interface
> (mprotect) to worry about.

I agree that is better.  What's important is that the application can rely
on the low memory range never being made accessible by any mmap.

> So I think it might be valid to say "always allow mmap(PROT_NONE)
> under mmap_min_limit, by simply turning it into a no-op".

Note that there is also CONFIG_LSM_MMAP_MIN_ADDR to consider, but yes.

> On Sun, Oct 23, 2011 at 2:08 AM, Kevin Easton <kevin@guarana.org> wrote:
> >
> > Won't this still allow silent probing, because the malicious user can
> > just try to create the mapping, then check in /proc/self/maps to see
> > if it really worked?
> 
> Yup, right you are.

Not if the application is already running inside a sandbox that prevents
direct access to /proc (e.g. in a private FS namespace, as my application
in fact is).

> So we shouldn't do that either, and probably just leave the current
> semantics, unless Roland (or others) can convince me that complicating
> the kernel  mmap security model really is worth it.

I'm really only concerned with two things:

1. The application can do something after which it can rely, with maximal
   paranoia, on the [0,0x10000) range never being used by any later
   non-MAP_FIXED mmap, regardless of kernel variant or local system
   configuration.
2. Whatever LSM stuff might be in use distinguishes the actions that ensure
   this from a "potentially malicious" attempt to do a usable mapping in
   that range.

So either the "pretend to succeed" or the "fail without LSM whining" models
can fit those needs as well as the "really succeed for PROT_NONE only"
model I proposed.  (Though I agree with your point above that "pretend to
succeed" is a little bit better because of potentially revealing less about
the exact constraints the system is imposing.)  In the status quo today,
AIUI the only way to do "fail without whining" under SELinux is with a
"dontaudit" policy rule for the MMAP_ZERO permission check for the given
application--but that doesn't distinguish the harmless PROT_NONE attempts
from an actual "malicious" attempt, so it's suboptimal.  (And I don't know
about other LSM implementations that might do their own kinds of whining.)

So it may be sufficient just to change SELinux (and perhaps other LSM
implementations) to treat PROT_NONE specially for purposes of the whining.
LSM folks will have to say how best to make that happen.


Thanks,
Roland

^ permalink raw reply

* Re: Subvolume level allocation policy
From: Hugo Mills @ 2011-10-23 18:52 UTC (permalink / raw)
  To: Phillip Susi; +Cc: linux-btrfs
In-Reply-To: <4EA4620A.3060702@cfl.rr.com>

[-- Attachment #1: Type: text/plain, Size: 677 bytes --]

On Sun, Oct 23, 2011 at 02:50:50PM -0400, Phillip Susi wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Is it ( yet? ) possible to manipulate the allocation policy on a
> subvolume level instead of the fs level?  For example, to make / use
> raid1, and /home use raid0?  Or to have / allocated from an ssd and
> /home allocated from the giant 2tb hd.

   Not yet, sorry. It's planned, but nobody's got around to
implementing it.

   Hugo.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
         --- I'm on a 30-day diet. So far I've lost 18 days. ---         

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

^ permalink raw reply

* [Buildroot] [PATCH] crosstool-ng: fix ccache dependencies order
From: Samuel Martin @ 2011-10-23 18:51 UTC (permalink / raw)
  To: buildroot

avoid gawk complaining when running 'make ctng-menuconfig' in a
clean/distclean tree in which ccache and crosstool-ng are enabled

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
 package/crosstool-ng/crosstool-ng.mk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/package/crosstool-ng/crosstool-ng.mk b/package/crosstool-ng/crosstool-ng.mk
index 8f53a77..84e218e 100644
--- a/package/crosstool-ng/crosstool-ng.mk
+++ b/package/crosstool-ng/crosstool-ng.mk
@@ -4,6 +4,6 @@ CROSSTOOL_NG_SITE              = http://crosstool-ng.org/download/crosstool-ng/
 CROSSTOOL_NG_INSTALL_STAGING   = NO
 CROSSTOOL_NG_INSTALL_TARGET    = NO
 CROSSTOOL_NG_MAKE              = $(MAKE1)
-HOST_CROSSTOOL_NG_DEPENDENCIES = host-gawk host-automake $(if $(BR2_CCACHE),host-ccache)
+HOST_CROSSTOOL_NG_DEPENDENCIES = $(if $(BR2_CCACHE),host-ccache) host-gawk host-automake
 
 $(eval $(call AUTOTARGETS,host))
-- 
1.7.0.4

^ permalink raw reply related

* Subvolume level allocation policy
From: Phillip Susi @ 2011-10-23 18:50 UTC (permalink / raw)
  To: linux-btrfs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is it ( yet? ) possible to manipulate the allocation policy on a
subvolume level instead of the fs level?  For example, to make / use
raid1, and /home use raid0?  Or to have / allocated from an ssd and
/home allocated from the giant 2tb hd.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6kYgYACgkQJ4UciIs+XuISPQCglUtPmg4GMrrY53Fkafk2fkcA
E84AoMAZXBha/fDrk6moMKPzbMYEtLci
=BIdX
-----END PGP SIGNATURE-----

^ permalink raw reply

* mtd_stresstest module bricked my dockstar
From: Roland Kletzing @ 2011-10-23 18:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: ext-adrian.hunter


Hello folks,
i was (really) happily fiddling  with my dockstar NAS for the last 2 days and managed to get 3.0.4 vanilla kernel running on that device, and since i wanted do do some more testing with heartbeat/led, i fired up my proven "load all sort of modules until the kernel oopses, crashes, freezes" routine (i happily ran on x86 for years as a proven source for oopsing or hanging the kernel and/or for reporting unknown bugs) and this was the last thing i saw in dmesg:
mtd_stresstest: MTD device size 1048576, eraseblock size 131072, page size 2048, count of eraseblocks 8, pages per eraseblock 64, OOB
 size 64
mtd_stresstest: scanning for bad eraseblocks
mtd_stresstest: scanned 8 eraseblocks, 0 are bad
mtd_stresstest: doing operations
mtd_stresstest: 0 operations done
mtd_stresstest: 1024 operations done
mtd_stresstest: 2048 operations done
.....

could not stop that, could not kill modprobe, could not unload module - device dead, no signs of life after power-cycle anymore.

DOH!

Let`s have a look:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7163cea15f7b362795b858e7c130cd617aecc0aa

ok - in there for a while.

Kconfig:

config MTD_TESTS
tristate "MTD tests support"
depends on m
help
  This option includes various MTD tests into compilation. The tests
  should normally be compiled as kernel modules. The modules perform
  various checks and verifications when loaded.


???  
"depends on m" ? 
Perform checks and verification when loaded ?
So, there is a linux kernel module which (apparently) stress-tests (i.e. overwrites) the MTD and somehow from a derived config in a third party kernel that module got it´s way into my 3.0.4 build - and on module load, it started to hammer on the first mtd it came across without any sign of warning and without any safeguard ? (i.e. the module kills your data just by loading it?)

It may be that it`s not recommended or considered "best practise" to load all sorts of unkown modules (i.e. find /lib/modules.... -name "*.ko"....)  - but people do (see https://bugzilla.novell.com/show_bug.cgi?id=224522[https://bugzilla.novell.com/show_bug.cgi?id=224522] ). And it`s not obvious that it`s THAT dangerous. And for me this is the first time Linux REALLY managed to badly brick my hardware in such a rigorous way.  Maybe someone can understand that i`m not really amused, as there is no easy way to recover, as seen on http://www.yourwarrantyisvoid.com/2010/09/08/dead-dockstar-resurrected-with-jtag/[http://www.yourwarrantyisvoid.com/2010/09/08/dead-dockstar-resurrected-with-jtag/] 

Luckily, i got that dockstar for cheap and have some more, so let`s call that "shit really happens".

I don`t want to accuse anybody, that module has it`s purpose, but please consider adding more safeguard against such issues.

One last question:
Is there any other really dangerous stuff like this inside the kernel ? (found mtd_torturetest, which seems another beast like this)

regards
Roland

ps:
Someone want the Dockstar for spending the hours and the money for debrick ? Or for extracting gold and other precious metals from electronic waste ? ;)

___________________________________________________________
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192

^ permalink raw reply

* [U-Boot] [PATCH 2/2] bootstage: Make use of BOOTSTAGE_ID_RUN_OS in show_boot_progress()
From: Wolfgang Denk @ 2011-10-23 18:44 UTC (permalink / raw)
  To: u-boot
In-Reply-To: <1318790446-24792-3-git-send-email-sjg@chromium.org>

Dear Simon Glass,

In message <1318790446-24792-3-git-send-email-sjg@chromium.org> you wrote:
> This changes the number 15 as used in boot_stage_progress() to use the
> new name provided for it,
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
...

> -	show_boot_progress (15);
> +	show_boot_progress(BOOTSTAGE_ID_RUN_OS);

To maintain consistent operation of the show_boot_progress()
implementation, you should also replace all ocurrances of

	show_boot_progress(-15);
with
	show_boot_progress(-BOOTSTAGE_ID_RUN_OS);


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I was playing poker the other night... with Tarot cards. I got a full
house and 4 people died.                              - Steven Wright

^ permalink raw reply

* [U-Boot] [PATCH 1/2] nand_spl_simple: Add omap3 DMA usage to SPL
From: Wolfgang Denk @ 2011-10-23 18:40 UTC (permalink / raw)
  To: u-boot
In-Reply-To: <1318759804-18688-2-git-send-email-simonschwarzcor@gmail.com>

Dear Simon Schwarz,

In message <1318759804-18688-2-git-send-email-simonschwarzcor@gmail.com> you wrote:
> This adds DMA copy for the nand spl implementation. If CONFIG_SPL_DMA_SUPPORT
> is defined the DMA is used.
> 
> Based on DMA driver patch:
> http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/109744/focus=109747
> 
> Signed-off-by: Simon Schwarz <simonschwarzcor@gmail.com>
> Cc: scottwood at freescale.com
> Cc: s-paulraj at ti.com
> ---
>  drivers/mtd/nand/nand_spl_simple.c |  185 ++++++++++++++++++++++++++++++++++--
>  1 files changed, 176 insertions(+), 9 deletions(-)
...
> +	for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
> +		res += omap3_dma_conf_transfer(0, nand_chip.IO_ADDR_R,
> +			(uint32_t *)p, CONFIG_SYS_NAND_ECCSIZE/4);

IIUC, drivers/mtd/nand/nand_spl_simple.c is a global, architecture
independent file.  However, you are adding OMAP3 specific code here.
If we did the same for all other potentially supported architectures
and SoCs, we'd soon have a serious mess.

Please move  architecture / SoC specific code out of such global
files.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There are always alternatives.
	-- Spock, "The Galileo Seven", stardate 2822.3

^ permalink raw reply

* Re: [PATCH 2/2] pulseaudio: inherit perlnative
From: Saul Wold @ 2011-10-23 18:31 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer
In-Reply-To: <1319380267-29794-2-git-send-email-raj.khem@gmail.com>

On 10/23/2011 07:31 AM, Khem Raj wrote:
> manpage generatition uses xmltoman utility
> which inturn uses xml-parser. So we add
> libxml-parser-perl-native to DEPENDS and also
> inherit perlnative so it does not use the one
> from build host
>
> Signed-off-by: Khem Raj<raj.khem@gmail.com>
> ---
>   .../pulseaudio/pulseaudio_0.9.23.bb                |    6 +++---
>   1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio_0.9.23.bb b/meta/recipes-multimedia/pulseaudio/pulseaudio_0.9.23.bb
> index 33f5e15..9521ab0 100644
> --- a/meta/recipes-multimedia/pulseaudio/pulseaudio_0.9.23.bb
> +++ b/meta/recipes-multimedia/pulseaudio/pulseaudio_0.9.23.bb
> @@ -1,10 +1,10 @@
>   require pulseaudio.inc
>
> -PR = "r5"
> +PR = "r6"
>
> -DEPENDS += "gdbm speex"
> +DEPENDS += "gdbm speex libxml-parser-perl-native"
>
> -inherit gettext
> +inherit gettext perlnative
>
>   SRC_URI = "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-${PV}.tar.gz \
>     file://buildfix.patch \
This patch is already out there from Martin, I just submitted it in a 
CONSOLIDATED PULL.

Sau!




^ permalink raw reply

* [CONSOLIDATED PULL 25/27] oprofile: Update to 0.9.7 and convert cvs->git
From: Saul Wold @ 2011-10-23 18:27 UTC (permalink / raw)
  To: openembedded-core
In-Reply-To: <cover.1319394187.git.sgw@linux.intel.com>

Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
 .../oprofile/{oprofile_0.9.6.bb => oprofile.inc}   |   13 +++------
 meta/recipes-kernel/oprofile/oprofile_0.9.7.bb     |   11 ++++++++
 meta/recipes-kernel/oprofile/oprofile_cvs.bb       |   28 --------------------
 meta/recipes-kernel/oprofile/oprofile_git.bb       |   11 ++++++++
 4 files changed, 26 insertions(+), 37 deletions(-)
 rename meta/recipes-kernel/oprofile/{oprofile_0.9.6.bb => oprofile.inc} (70%)
 create mode 100644 meta/recipes-kernel/oprofile/oprofile_0.9.7.bb
 delete mode 100644 meta/recipes-kernel/oprofile/oprofile_cvs.bb
 create mode 100644 meta/recipes-kernel/oprofile/oprofile_git.bb

diff --git a/meta/recipes-kernel/oprofile/oprofile_0.9.6.bb b/meta/recipes-kernel/oprofile/oprofile.inc
similarity index 70%
rename from meta/recipes-kernel/oprofile/oprofile_0.9.6.bb
rename to meta/recipes-kernel/oprofile/oprofile.inc
index 0f154c8..73a5a07 100644
--- a/meta/recipes-kernel/oprofile/oprofile_0.9.6.bb
+++ b/meta/recipes-kernel/oprofile/oprofile.inc
@@ -15,21 +15,16 @@ DEPENDS = "popt binutils"
 RDEPENDS_${PN} = "binutils-symlinks"
 RRECOMMENDS_${PN} = "kernel-vmlinux"
 
-FILES_${PN} = "${bindir} ${libdir}/${BPN}/lib*.so.* ${datadir}/${BPN}"
-FILES_${PN}-dev += "${libdir}/${BPN}/lib*.so ${libdir}/${BPN}/lib*.la"
+FILES_${PN} = "${bindir} ${libdir}/${BPN}/lib*${SOLIBS} ${datadir}/${BPN}"
+FILES_${PN}-dev += "${libdir}/${BPN}/lib*${SOLIBSDEV} ${libdir}/${BPN}/lib*.la"
 FILES_${PN}-staticdev += "${libdir}/${BPN}/lib*.a"
 
-PR = "r2"
+INC_PR = "r0"
 
-SRC_URI = "${SOURCEFORGE_MIRROR}/oprofile/oprofile-${PV}.tar.gz \
-           file://opstart.patch \
+SRC_URI = "file://opstart.patch \
            file://oprofile-no-query-modules.patch \
            file://acinclude.m4"
 
-SRC_URI[md5sum] = "4e407093ac06200185d5a5e6437d7242"
-SRC_URI[sha256sum] = "3f0dd40a7749fc650d25d79d42ebbff8f3b6db310c36e7c3839696cc09077880"
-S = "${WORKDIR}/oprofile-${PV}"
-
 inherit autotools
 
 EXTRA_OECONF = "--with-kernel-support --without-x"
diff --git a/meta/recipes-kernel/oprofile/oprofile_0.9.7.bb b/meta/recipes-kernel/oprofile/oprofile_0.9.7.bb
new file mode 100644
index 0000000..d7e1511
--- /dev/null
+++ b/meta/recipes-kernel/oprofile/oprofile_0.9.7.bb
@@ -0,0 +1,11 @@
+require oprofile.inc
+
+PR = "${INC_PR}.0"
+
+SRC_URI += "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz"
+
+SRC_URI[md5sum] = "8b5d1d9b65f84420bcc3234777ad3be3"
+SRC_URI[sha256sum] = "cb5b507d5dea058d223fcad3cec8ff9638a4163106afd66d176798bbd973d527"
+
+S = "${WORKDIR}/oprofile-${PV}"
+
diff --git a/meta/recipes-kernel/oprofile/oprofile_cvs.bb b/meta/recipes-kernel/oprofile/oprofile_cvs.bb
deleted file mode 100644
index c66f4d3..0000000
--- a/meta/recipes-kernel/oprofile/oprofile_cvs.bb
+++ /dev/null
@@ -1,28 +0,0 @@
-PV = "0.9.4+cvs${SRCDATE}"
-PR = "r1"
-SECTION = "devel"
-SUMMARY = "System-Wide Profiler"
-DESCRIPTION = "OProfile is a system-wide profiler for Linux systems, capable \
-of profiling all running code at low overhead."
-LICENSE = "GPL"
-DEPENDS = "popt binutils"
-RDEPENDS_${PN} = "binutils-symlinks"
-RRECOMMENDS_${PN} = "kernel-vmlinux"
-
-DEFAULT_PREFERENCE = "-1"
-
-SRC_URI = "cvs://anonymous@oprofile.cvs.sourceforge.net/cvsroot/oprofile;module=oprofile \
-           file://opstart.patch \
-	   file://acinclude.m4"
-S = "${WORKDIR}/oprofile"
-
-inherit autotools
-
-EXTRA_OECONF = "--with-kernel-support \
-		--without-x \
-		--disable-werror "
-
-do_configure () {
-	cp ${WORKDIR}/acinclude.m4 ${S}/
-	autotools_do_configure
-}
diff --git a/meta/recipes-kernel/oprofile/oprofile_git.bb b/meta/recipes-kernel/oprofile/oprofile_git.bb
new file mode 100644
index 0000000..c345548
--- /dev/null
+++ b/meta/recipes-kernel/oprofile/oprofile_git.bb
@@ -0,0 +1,11 @@
+require oprofile.inc
+
+SRCREV = "88f43190d412d28ebf5c75a76ba20343d0fe4c41"
+PV = "0.9.7+git${SRCPV}"
+PR = "${INC_PR}.0"
+
+SRC_URI += "git://oprofile.git.sourceforge.net/gitroot/${BPN}/${BPN};protocol=git"
+
+S = "${WORKDIR}/git"
+
+DEFAULT_PREFERENCE = "-1"
-- 
1.7.6.4




^ permalink raw reply related

* [CONSOLIDATED PULL 27/27] perl: remove debug set -x; pwd
From: Saul Wold @ 2011-10-23 18:27 UTC (permalink / raw)
  To: openembedded-core
In-Reply-To: <cover.1319394187.git.sgw@linux.intel.com>

Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
 meta/recipes-devtools/perl/perl_5.14.2.bb |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-devtools/perl/perl_5.14.2.bb b/meta/recipes-devtools/perl/perl_5.14.2.bb
index 6bd51ad..7889626 100644
--- a/meta/recipes-devtools/perl/perl_5.14.2.bb
+++ b/meta/recipes-devtools/perl/perl_5.14.2.bb
@@ -207,8 +207,6 @@ do_install() {
 PACKAGE_PREPROCESS_FUNCS += "perl_package_preprocess"
 
 perl_package_preprocess () {
-	set -x
-	pwd
         # Fix up installed configuration
         sed -i -e "s,${D},,g" \
                -e "s,-isystem${STAGING_INCDIR} ,,g" \
-- 
1.7.6.4




^ permalink raw reply related

* [CONSOLIDATED PULL 26/27] abiword: convert to svn
From: Saul Wold @ 2011-10-23 18:27 UTC (permalink / raw)
  To: openembedded-core
In-Reply-To: <cover.1319394187.git.sgw@linux.intel.com>

Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
 meta-demoapps/recipes-gnome/abiword/abiword.inc    |    4 ++--
 meta-demoapps/recipes-gnome/abiword/abiword_cvs.bb |   10 ----------
 meta-demoapps/recipes-gnome/abiword/abiword_svn.bb |   10 ++++++++++
 3 files changed, 12 insertions(+), 12 deletions(-)
 delete mode 100644 meta-demoapps/recipes-gnome/abiword/abiword_cvs.bb
 create mode 100644 meta-demoapps/recipes-gnome/abiword/abiword_svn.bb

diff --git a/meta-demoapps/recipes-gnome/abiword/abiword.inc b/meta-demoapps/recipes-gnome/abiword/abiword.inc
index b1b0f67..2b34a7a 100644
--- a/meta-demoapps/recipes-gnome/abiword/abiword.inc
+++ b/meta-demoapps/recipes-gnome/abiword/abiword.inc
@@ -13,8 +13,8 @@ RRECOMMENDS_${PN}    = "glibc-gconv-ibm850 glibc-gconv-cp1252 \
 RELURI = "http://www.abiword.org/downloads/abiword/${PV}/source/abiword-${PV}.tar.gz"
 RELSRC = "${WORKDIR}/abiword-${PV}/abi"
 
-CVSURI = "cvs://anoncvs:anoncvs@anoncvs.abisource.com/cvsroot;module=abi"
-CVSSRC = "${WORKDIR}/abi"
+SVNURI = "cvs://svn.abisource.com/abiword/trunk;module=abiword;proto=http"
+SVNSRC = "${WORKDIR}/abi"
 
 #want 2.x from 2.x.y for the installation directory
 SHRT_VER = "${@bb.data.getVar('PV',d,1).split('.')[0]}.${@bb.data.getVar('PV',d,1).split('.')[1]}"
diff --git a/meta-demoapps/recipes-gnome/abiword/abiword_cvs.bb b/meta-demoapps/recipes-gnome/abiword/abiword_cvs.bb
deleted file mode 100644
index 163029e..0000000
--- a/meta-demoapps/recipes-gnome/abiword/abiword_cvs.bb
+++ /dev/null
@@ -1,10 +0,0 @@
-require abiword.inc
-
-SRCDATE = "20070130"
-PV="2.5.0+cvs${SRCDATE}"
-PR = "r4"
-
-SRC_URI = "${CVSURI}"
-
-S = "${CVSSRC}"
-
diff --git a/meta-demoapps/recipes-gnome/abiword/abiword_svn.bb b/meta-demoapps/recipes-gnome/abiword/abiword_svn.bb
new file mode 100644
index 0000000..a8946a8
--- /dev/null
+++ b/meta-demoapps/recipes-gnome/abiword/abiword_svn.bb
@@ -0,0 +1,10 @@
+require abiword.inc
+
+SRCREV = "21818"
+PV="2.5.2+svnr${SRCPV}"
+PR = "r0"
+
+SRC_URI = "${SVNURI}"
+
+S = "${SVNSRC}"
+
-- 
1.7.6.4




^ permalink raw reply related

* [CONSOLIDATED PULL 24/27] texi2html: Added recipe from OE
From: Saul Wold @ 2011-10-23 18:27 UTC (permalink / raw)
  To: openembedded-core
In-Reply-To: <cover.1319394187.git.sgw@linux.intel.com>

Needed to build oe-core with oe-core

Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
 meta/recipes-extended/texi2html/texi2html_1.82.bb |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
 create mode 100644 meta/recipes-extended/texi2html/texi2html_1.82.bb

diff --git a/meta/recipes-extended/texi2html/texi2html_1.82.bb b/meta/recipes-extended/texi2html/texi2html_1.82.bb
new file mode 100644
index 0000000..f19b576
--- /dev/null
+++ b/meta/recipes-extended/texi2html/texi2html_1.82.bb
@@ -0,0 +1,14 @@
+DESCRIPTION = "Perl script that converts Texinfo to HTML"
+HOMEPAGE    = "http://www.nongnu.org/texi2html/"
+SECTION     = "console/utils"
+LICENSE     = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552"
+
+PR = "r0"
+
+SRC_URI     = "http://download.savannah.gnu.org/releases/texi2html/${P}.tar.bz2"
+
+SRC_URI[md5sum] = "a8a9193c0ac1bec2f3ca7be40a5a82eb"
+SRC_URI[sha256sum] = "d69c1effc416896409003ea64fdb21152cc0a9a7c665d437a0a3bef9b588b4f1"
+
+inherit autotools
-- 
1.7.6.4




^ permalink raw reply related

* [CONSOLIDATED PULL 22/27] kernel.bbclass: respect MACHINE_KERNEL_PR
From: Saul Wold @ 2011-10-23 18:27 UTC (permalink / raw)
  To: openembedded-core
In-Reply-To: <cover.1319394187.git.sgw@linux.intel.com>

From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

MACHINE_KERNEL_PR was introduced long ago in org.oe.dev. It's present in
meta-oe kernel.bbclass. Several machines depend on this functionality.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 meta/classes/kernel.bbclass |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 42543e0..60be980 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -20,6 +20,11 @@ python __anonymous () {
     image = bb.data.getVar('INITRAMFS_IMAGE', d, True)
     if image:
         bb.data.setVar('INITRAMFS_TASK', '${INITRAMFS_IMAGE}:do_rootfs', d)
+
+    machine_kernel_pr = bb.data.getVar('MACHINE_KERNEL_PR', d, True)
+
+    if machine_kernel_pr:
+        bb.data.setVar('PR', machine_kernel_pr, d)
 }
 
 inherit kernel-arch deploy
-- 
1.7.6.4




^ permalink raw reply related

* [CONSOLIDATED PULL 23/27] wget: Add recipe from OE
From: Saul Wold @ 2011-10-23 18:27 UTC (permalink / raw)
  To: openembedded-core
In-Reply-To: <cover.1319394187.git.sgw@linux.intel.com>

Needed to support building oe-core with oe-core

Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
 .../wget/wget-1.12/fix_makefile.patch              |   59 +++++
 .../wget/wget-1.12/gnutls.bzr.patch                |  266 ++++++++++++++++++++
 meta/recipes-extended/wget/wget.inc                |   40 +++
 meta/recipes-extended/wget/wget_1.12.bb            |   11 +
 4 files changed, 376 insertions(+), 0 deletions(-)
 create mode 100644 meta/recipes-extended/wget/wget-1.12/fix_makefile.patch
 create mode 100644 meta/recipes-extended/wget/wget-1.12/gnutls.bzr.patch
 create mode 100644 meta/recipes-extended/wget/wget.inc
 create mode 100644 meta/recipes-extended/wget/wget_1.12.bb

diff --git a/meta/recipes-extended/wget/wget-1.12/fix_makefile.patch b/meta/recipes-extended/wget/wget-1.12/fix_makefile.patch
new file mode 100644
index 0000000..3f34c76
--- /dev/null
+++ b/meta/recipes-extended/wget/wget-1.12/fix_makefile.patch
@@ -0,0 +1,59 @@
+
+Upstream-Status: Pending
+
+Signed-off-by: Saul Wold <sgw@linux.intel.com>
+
+Index: wget-1.12/po/Makefile.in.in
+===================================================================
+--- wget-1.12.orig/po/Makefile.in.in	2009-09-04 09:31:54.000000000 -0700
++++ wget-1.12/po/Makefile.in.in	2011-10-19 20:32:53.714812160 -0700
+@@ -8,8 +8,8 @@
+ # Please note that the actual code of GNU gettext is covered by the GNU
+ # General Public License and is *not* in the public domain.
+ #
+-# Origin: gettext-0.17
+-GETTEXT_MACRO_VERSION = 0.17
++# Origin: gettext-0.18
++GETTEXT_MACRO_VERSION = 0.18
+ 
+ PACKAGE = @PACKAGE@
+ VERSION = @VERSION@
+Index: wget-1.12/configure.ac
+===================================================================
+--- wget-1.12.orig/configure.ac	2009-09-22 09:39:49.000000000 -0700
++++ wget-1.12/configure.ac	2011-10-19 20:32:53.714812160 -0700
+@@ -110,7 +110,7 @@
+ dnl Gettext
+ dnl
+ AM_GNU_GETTEXT([external],[need-ngettext])
+-AM_GNU_GETTEXT_VERSION([0.17])
++AM_GNU_GETTEXT_VERSION([0.18])
+ 
+ AC_PROG_RANLIB
+ 
+Index: wget-1.12/configure
+===================================================================
+--- wget-1.12.orig/configure	2009-09-22 09:40:13.000000000 -0700
++++ wget-1.12/configure	2011-10-19 20:33:46.578812174 -0700
+@@ -5297,7 +5297,7 @@
+ 
+ 
+ 
+-      GETTEXT_MACRO_VERSION=0.17
++      GETTEXT_MACRO_VERSION=0.18
+ 
+ 
+ 
+Index: wget-1.12/m4/po.m4
+===================================================================
+--- wget-1.12.orig/m4/po.m4	2009-09-04 09:31:54.000000000 -0700
++++ wget-1.12/m4/po.m4	2011-10-19 20:33:53.426812176 -0700
+@@ -30,7 +30,7 @@
+ 
+   dnl Release version of the gettext macros. This is used to ensure that
+   dnl the gettext macros and po/Makefile.in.in are in sync.
+-  AC_SUBST([GETTEXT_MACRO_VERSION], [0.17])
++  AC_SUBST([GETTEXT_MACRO_VERSION], [0.18])
+ 
+   dnl Perform the following tests also if --disable-nls has been given,
+   dnl because they are needed for "make dist" to work.
diff --git a/meta/recipes-extended/wget/wget-1.12/gnutls.bzr.patch b/meta/recipes-extended/wget/wget-1.12/gnutls.bzr.patch
new file mode 100644
index 0000000..6f0c2eb
--- /dev/null
+++ b/meta/recipes-extended/wget/wget-1.12/gnutls.bzr.patch
@@ -0,0 +1,266 @@
+--- wget-1.12/src/gnutls.c	2009-09-22 04:59:33.000000000 +0200
++++ /OE/projects/wget/src/gnutls.c	2010-10-30 16:24:10.000000000 +0200
+@@ -1,6 +1,6 @@
+ /* SSL support via GnuTLS library.
+-   Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+-   Inc.
++   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
++   Foundation, Inc.
+ 
+ This file is part of GNU Wget.
+ 
+@@ -37,6 +37,8 @@
+ #endif
+ #include <string.h>
+ #include <stdio.h>
++#include <dirent.h>
++#include <stdlib.h>
+ 
+ #include <gnutls/gnutls.h>
+ #include <gnutls/x509.h>
+@@ -46,6 +48,10 @@
+ #include "url.h"
+ #include "ssl.h"
+ 
++#ifdef WIN32
++# include "w32sock.h"
++#endif
++
+ /* Note: some of the functions private to this file have names that
+    begin with "wgnutls_" (e.g. wgnutls_read) so that they wouldn't be
+    confused with actual gnutls functions -- such as the gnutls_read
+@@ -56,15 +62,50 @@
+ bool
+ ssl_init ()
+ {
++  const char *ca_directory;
++  DIR *dir;
++
+   gnutls_global_init ();
+   gnutls_certificate_allocate_credentials (&credentials);
++
++  ca_directory = opt.ca_directory ? opt.ca_directory : "/etc/ssl/certs";
++
++  dir = opendir (ca_directory);
++  if (dir == NULL)
++    {
++      if (opt.ca_directory)
++        logprintf (LOG_NOTQUIET, _("ERROR: Cannot open directory %s.\n"),
++                   opt.ca_directory);
++    }
++  else
++    {
++      struct dirent *dent;
++      while ((dent = readdir (dir)) != NULL)
++        {
++          struct stat st;
++          char *ca_file;
++          asprintf (&ca_file, "%s/%s", ca_directory, dent->d_name);
++
++          stat (ca_file, &st);
++
++          if (S_ISREG (st.st_mode))
++            gnutls_certificate_set_x509_trust_file (credentials, ca_file,
++                                                    GNUTLS_X509_FMT_PEM);
++
++          free (ca_file);
++        }
++
++      closedir (dir);
++    }
++
+   if (opt.ca_cert)
+     gnutls_certificate_set_x509_trust_file (credentials, opt.ca_cert,
+                                             GNUTLS_X509_FMT_PEM);
+   return true;
+ }
+ 
+-struct wgnutls_transport_context {
++struct wgnutls_transport_context
++{
+   gnutls_session session;       /* GnuTLS session handle */
+   int last_error;               /* last error returned by read/write/... */
+ 
+@@ -73,7 +114,7 @@
+      is stored to PEEKBUF, and wgnutls_read checks that buffer before
+      actually reading.  */
+   char peekbuf[512];
+-  int peekstart, peeklen;
++  int peeklen;
+ };
+ 
+ #ifndef MIN
+@@ -83,19 +124,18 @@
+ static int
+ wgnutls_read (int fd, char *buf, int bufsize, void *arg)
+ {
+-  int ret;
++  int ret = 0;
+   struct wgnutls_transport_context *ctx = arg;
+ 
+   if (ctx->peeklen)
+     {
+       /* If we have any peek data, simply return that. */
+       int copysize = MIN (bufsize, ctx->peeklen);
+-      memcpy (buf, ctx->peekbuf + ctx->peekstart, copysize);
++      memcpy (buf, ctx->peekbuf, copysize);
+       ctx->peeklen -= copysize;
+       if (ctx->peeklen != 0)
+-        ctx->peekstart += copysize;
+-      else
+-        ctx->peekstart = 0;
++        memmove (ctx->peekbuf, ctx->peekbuf + copysize, ctx->peeklen);
++
+       return copysize;
+     }
+ 
+@@ -105,6 +145,7 @@
+ 
+   if (ret < 0)
+     ctx->last_error = ret;
++
+   return ret;
+ }
+ 
+@@ -124,31 +165,49 @@
+ static int
+ wgnutls_poll (int fd, double timeout, int wait_for, void *arg)
+ {
+-  return 1;
++  struct wgnutls_transport_context *ctx = arg;
++  return ctx->peeklen || gnutls_record_check_pending (ctx->session)
++    || select_fd (fd, timeout, wait_for);
+ }
+ 
+ static int
+ wgnutls_peek (int fd, char *buf, int bufsize, void *arg)
+ {
+-  int ret;
++  int ret = 0;
+   struct wgnutls_transport_context *ctx = arg;
+-
+-  /* We don't support peeks following peeks: the reader must drain all
+-     peeked data before the next peek.  */
+-  assert (ctx->peeklen == 0);
++  int offset = MIN (bufsize, ctx->peeklen);
+   if (bufsize > sizeof ctx->peekbuf)
+     bufsize = sizeof ctx->peekbuf;
+ 
+-  do
+-    ret = gnutls_record_recv (ctx->session, buf, bufsize);
+-  while (ret == GNUTLS_E_INTERRUPTED);
++  if (ctx->peeklen)
++    memcpy (buf, ctx->peekbuf, offset);
+ 
+-  if (ret >= 0)
++  if (bufsize > offset)
+     {
+-      memcpy (ctx->peekbuf, buf, ret);
+-      ctx->peeklen = ret;
++      do
++        {
++          ret = gnutls_record_recv (ctx->session, buf + offset,
++                                    bufsize - offset);
++        }
++      while (ret == GNUTLS_E_INTERRUPTED);
++
++      if (ret < 0)
++        {
++          if (offset)
++            ret = 0;
++          else
++            return ret;
++        }
++
++      if (ret > 0)
++        {
++          memcpy (ctx->peekbuf + offset, buf + offset,
++                  ret);
++          ctx->peeklen += ret;
++        }
+     }
+-  return ret;
++
++  return offset + ret;
+ }
+ 
+ static const char *
+@@ -165,23 +224,20 @@
+   /*gnutls_bye (ctx->session, GNUTLS_SHUT_RDWR);*/
+   gnutls_deinit (ctx->session);
+   xfree (ctx);
+-#ifndef WINDOWS
+   close (fd);
+-#else
+-  closesocket (fd);
+-#endif
+ }
+ 
+ /* gnutls_transport is the singleton that describes the SSL transport
+    methods provided by this file.  */
+ 
+-static struct transport_implementation wgnutls_transport = {
++static struct transport_implementation wgnutls_transport =
++{
+   wgnutls_read, wgnutls_write, wgnutls_poll,
+   wgnutls_peek, wgnutls_errstr, wgnutls_close
+ };
+ 
+ bool
+-ssl_connect (int fd)
++ssl_connect_wget (int fd)
+ {
+   static const int cert_type_priority[] = {
+     GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0
+@@ -189,11 +245,42 @@
+   struct wgnutls_transport_context *ctx;
+   gnutls_session session;
+   int err;
++  int allowed_protocols[4] = {0, 0, 0, 0};
+   gnutls_init (&session, GNUTLS_CLIENT);
+   gnutls_set_default_priority (session);
+   gnutls_certificate_type_set_priority (session, cert_type_priority);
+   gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, credentials);
+-  gnutls_transport_set_ptr (session, (gnutls_transport_ptr) fd);
++#ifndef FD_TO_SOCKET
++# define FD_TO_SOCKET(X) (X)
++#endif
++  gnutls_transport_set_ptr (session, (gnutls_transport_ptr) FD_TO_SOCKET (fd));
++
++  err = 0;
++  switch (opt.secure_protocol)
++    {
++    case secure_protocol_auto:
++      break;
++    case secure_protocol_sslv2:
++    case secure_protocol_sslv3:
++      allowed_protocols[0] = GNUTLS_SSL3;
++      err = gnutls_protocol_set_priority (session, allowed_protocols);
++      break;
++    case secure_protocol_tlsv1:
++      allowed_protocols[0] = GNUTLS_TLS1_0;
++      allowed_protocols[1] = GNUTLS_TLS1_1;
++      allowed_protocols[2] = GNUTLS_TLS1_2;
++      err = gnutls_protocol_set_priority (session, allowed_protocols);
++      break;
++    default:
++      abort ();
++    }
++  if (err < 0)
++    {
++      logprintf (LOG_NOTQUIET, "GnuTLS: %s\n", gnutls_strerror (err));
++      gnutls_deinit (session);
++      return false;
++    }
++
+   err = gnutls_handshake (session);
+   if (err < 0)
+     {
+@@ -201,6 +288,7 @@
+       gnutls_deinit (session);
+       return false;
+     }
++
+   ctx = xnew0 (struct wgnutls_transport_context);
+   ctx->session = session;
+   fd_register_transport (fd, &wgnutls_transport, ctx);
diff --git a/meta/recipes-extended/wget/wget.inc b/meta/recipes-extended/wget/wget.inc
new file mode 100644
index 0000000..c0d9ba9
--- /dev/null
+++ b/meta/recipes-extended/wget/wget.inc
@@ -0,0 +1,40 @@
+DESCRIPTION = "A console URL download utility featuring HTTP, FTP, and more."
+SECTION = "console/network"
+DEPENDS = ""
+DEPENDS_shr = "gnutls"
+LICENSE = "GPL"
+LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
+
+
+INC_PR = "r9"
+
+S = "${WORKDIR}/wget-${PV}"
+
+inherit autotools gettext
+
+# Disable checking for SSL since that searches the system paths
+EXTRA_OECONF = "--enable-ipv6 --without-ssl"
+
+# Enable SSL it's usefull
+EXTRA_OECONF_shr = "--enable-ipv6 --with-ssl=gnutls"
+# The unslung kernel does not support ipv6
+EXTRA_OECONF_unslung = "--without-ssl"
+# SlugOS kernels do not support ipv6. Can be loaded as a module.
+EXTRA_OECONF_slugos = "--without-ssl"
+
+do_configure() {
+	autotools_do_configure
+}
+
+inherit autotools update-alternatives
+
+EXTRA_OECONF = "--with-libc"
+
+do_install_append () {
+	mv ${D}${bindir}/wget ${D}${bindir}/wget.${PN}
+}
+
+ALTERNATIVE_NAME = "wget"
+ALTERNATIVE_LINK = "${base_bindir}/wget"
+ALTERNATIVE_PATH = "${base_bindir}/wget.${PN}"
+ALTERNATIVE_PRIORITY = "100"
diff --git a/meta/recipes-extended/wget/wget_1.12.bb b/meta/recipes-extended/wget/wget_1.12.bb
new file mode 100644
index 0000000..cab27e9
--- /dev/null
+++ b/meta/recipes-extended/wget/wget_1.12.bb
@@ -0,0 +1,11 @@
+PR = "${INC_PR}.1"
+
+SRC_URI = "${GNU_MIRROR}/wget/wget-${PV}.tar.gz \
+           file://gnutls.bzr.patch \
+           file://fix_makefile.patch \
+          "
+
+SRC_URI[md5sum] = "141461b9c04e454dc8933c9d1f2abf83"
+SRC_URI[sha256sum] = "7578ed0974e12caa71120581fa3962ee5a69f7175ddc3d6a6db0ecdcba65b572"
+
+require wget.inc
-- 
1.7.6.4




^ permalink raw reply related

* [CONSOLIDATED PULL 21/27] default-providers: switch virtual/libgl from mesa-xlib to mesa-dri
From: Saul Wold @ 2011-10-23 18:26 UTC (permalink / raw)
  To: openembedded-core
In-Reply-To: <cover.1319394187.git.sgw@linux.intel.com>

From: Martin Jansa <martin.jansa@gmail.com>

* to match default virtual/xserver

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/conf/distro/include/default-providers.inc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/meta/conf/distro/include/default-providers.inc b/meta/conf/distro/include/default-providers.inc
index 66f7ff3..be23d36 100644
--- a/meta/conf/distro/include/default-providers.inc
+++ b/meta/conf/distro/include/default-providers.inc
@@ -5,7 +5,7 @@ PREFERRED_PROVIDER_virtual/db ?= "db"
 PREFERRED_PROVIDER_virtual/db-native ?= "db-native"
 PREFERRED_PROVIDER_virtual/xserver ?= "xserver-xorg"
 PREFERRED_PROVIDER_virtual/xserver-xf86 ?= "xserver-xorg"
-PREFERRED_PROVIDER_virtual/libgl ?= "mesa-xlib"
+PREFERRED_PROVIDER_virtual/libgl ?= "mesa-dri"
 PREFERRED_PROVIDER_virtual/update-alternatives ?= "update-alternatives-cworth"
 PREFERRED_PROVIDER_virtual/update-alternatives-native ?= "opkg-native"
 PREFERRED_PROVIDER_virtual/libx11 ?= "libx11-trim"
-- 
1.7.6.4




^ permalink raw reply related


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.