From patchwork Sun May 6 10:14:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Ospite X-Patchwork-Id: 11034 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1SQyV1-0000RY-Ug for patchwork@linuxtv.org; Sun, 06 May 2012 12:15:31 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-3) with esmtp for id 1SQyV1-0003Lh-Dt; Sun, 06 May 2012 12:15:31 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753190Ab2EFKPX (ORCPT ); Sun, 6 May 2012 06:15:23 -0400 Received: from smtp205.alice.it ([82.57.200.101]:55501 "EHLO smtp205.alice.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753110Ab2EFKPP (ORCPT ); Sun, 6 May 2012 06:15:15 -0400 Received: from jcn (87.3.148.200) by smtp205.alice.it (8.6.023.02) id 4F421F7B089A1B8E; Sun, 6 May 2012 12:15:13 +0200 Received: from ao2 by jcn with local (Exim 4.77) (envelope-from ) id 1SQyUc-0004Zk-Ef; Sun, 06 May 2012 12:15:06 +0200 From: Antonio Ospite To: linux-media@vger.kernel.org Cc: Antonio Ospite , Jean-Francois Moine , linux-input@vger.kernel.org, Dmitry Torokhov Subject: [PATCH v2 2/3] Input: move drivers/input/fixp-arith.h to include/linux Date: Sun, 6 May 2012 12:14:57 +0200 Message-Id: <1336299298-17517-3-git-send-email-ospite@studenti.unina.it> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1336299298-17517-1-git-send-email-ospite@studenti.unina.it> References: <20120505102614.31395c2979f0b7aac0c8a107@studenti.unina.it> <1336299298-17517-1-git-send-email-ospite@studenti.unina.it> X-Face: z*RaLf`X<@C75u6Ig9}{oW$H; 1_\2t5)({*|jhM/Vb; ]yA5\I~93>J<_`<4)A{':UrE Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.5.6.100315 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODY_SIZE_6000_6999 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __C230066_P2 0, __CP_MEDIA_BODY 0, __CP_URI_IN_BODY 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __STOCK_PHRASE_7 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' Move drivers/input/fixp-arith.h to include/linux so that the functions defined there can be used by other subsystems, for instance some video devices ISPs can control the output HUE value by setting registers for sin(HUE) and cos(HUE). Signed-off-by: Antonio Ospite Acked-by: Dmitry Torokhov --- Changes since version 1: - Just added the Acked-by: Dmitry to the commit message drivers/input/ff-memless.c | 3 +- drivers/input/fixp-arith.h | 87 -------------------------------------------- include/linux/fixp-arith.h | 87 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 89 deletions(-) delete mode 100644 drivers/input/fixp-arith.h create mode 100644 include/linux/fixp-arith.h diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c index 117a59a..5f55885 100644 --- a/drivers/input/ff-memless.c +++ b/drivers/input/ff-memless.c @@ -31,8 +31,7 @@ #include #include #include - -#include "fixp-arith.h" +#include MODULE_LICENSE("GPL"); MODULE_AUTHOR("Anssi Hannula "); diff --git a/drivers/input/fixp-arith.h b/drivers/input/fixp-arith.h deleted file mode 100644 index 3089d73..0000000 --- a/drivers/input/fixp-arith.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef _FIXP_ARITH_H -#define _FIXP_ARITH_H - -/* - * Simplistic fixed-point arithmetics. - * Hmm, I'm probably duplicating some code :( - * - * Copyright (c) 2002 Johann Deneux - */ - -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Should you need to contact me, the author, you can do so by - * e-mail - mail your message to - */ - -#include - -/* The type representing fixed-point values */ -typedef s16 fixp_t; - -#define FRAC_N 8 -#define FRAC_MASK ((1< 123.0 */ -static inline fixp_t fixp_new(s16 a) -{ - return a< -1.0 - 0x8000 -> 1.0 - 0x0000 -> 0.0 -*/ -static inline fixp_t fixp_new16(s16 a) -{ - return ((s32)a)>>(16-FRAC_N); -} - -static inline fixp_t fixp_cos(unsigned int degrees) -{ - int quadrant = (degrees / 90) & 3; - unsigned int i = degrees % 90; - - if (quadrant == 1 || quadrant == 3) - i = 90 - i; - - i >>= 1; - - return (quadrant == 1 || quadrant == 2)? -cos_table[i] : cos_table[i]; -} - -static inline fixp_t fixp_sin(unsigned int degrees) -{ - return -fixp_cos(degrees + 90); -} - -static inline fixp_t fixp_mult(fixp_t a, fixp_t b) -{ - return ((s32)(a*b))>>FRAC_N; -} - -#endif diff --git a/include/linux/fixp-arith.h b/include/linux/fixp-arith.h new file mode 100644 index 0000000..3089d73 --- /dev/null +++ b/include/linux/fixp-arith.h @@ -0,0 +1,87 @@ +#ifndef _FIXP_ARITH_H +#define _FIXP_ARITH_H + +/* + * Simplistic fixed-point arithmetics. + * Hmm, I'm probably duplicating some code :( + * + * Copyright (c) 2002 Johann Deneux + */ + +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Should you need to contact me, the author, you can do so by + * e-mail - mail your message to + */ + +#include + +/* The type representing fixed-point values */ +typedef s16 fixp_t; + +#define FRAC_N 8 +#define FRAC_MASK ((1< 123.0 */ +static inline fixp_t fixp_new(s16 a) +{ + return a< -1.0 + 0x8000 -> 1.0 + 0x0000 -> 0.0 +*/ +static inline fixp_t fixp_new16(s16 a) +{ + return ((s32)a)>>(16-FRAC_N); +} + +static inline fixp_t fixp_cos(unsigned int degrees) +{ + int quadrant = (degrees / 90) & 3; + unsigned int i = degrees % 90; + + if (quadrant == 1 || quadrant == 3) + i = 90 - i; + + i >>= 1; + + return (quadrant == 1 || quadrant == 2)? -cos_table[i] : cos_table[i]; +} + +static inline fixp_t fixp_sin(unsigned int degrees) +{ + return -fixp_cos(degrees + 90); +} + +static inline fixp_t fixp_mult(fixp_t a, fixp_t b) +{ + return ((s32)(a*b))>>FRAC_N; +} + +#endif