Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752244AbdDNCUN (ORCPT ); Thu, 13 Apr 2017 22:20:13 -0400 Received: from mail-sn1nam01on0133.outbound.protection.outlook.com ([104.47.32.133]:12928 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751308AbdDNCUL (ORCPT ); Thu, 13 Apr 2017 22:20:11 -0400 Authentication-Results: spf=pass (sender IP is 117.103.190.42) smtp.mailfrom=sony.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=sony.com; From: To: , , CC: , , Yasunari Takiguchi , Masayuki Yamamoto , Hideki Nozawa , "Kota Yonezawa" , Toshihiko Matsumoto , Satoshi Watanabe Subject: [PATCH v2 04/15] [media] cxd2880: Add math functions for the driver Date: Fri, 14 Apr 2017 11:22:37 +0900 Message-ID: <20170414022237.17269-1-Yasunari.Takiguchi@sony.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170414015043.16731-1-Yasunari.Takiguchi@sony.com> References: <20170414015043.16731-1-Yasunari.Takiguchi@sony.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [43.25.42.176] X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:117.103.190.42;IPV:NLI;CTRY:JP;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(39860400002)(39410400002)(39850400002)(39400400002)(39450400003)(39840400002)(2980300002)(438002)(189002)(199003)(50986999)(36756003)(2906002)(76176999)(189998001)(6666003)(2950100002)(8676002)(8936002)(3846002)(50226002)(6116002)(1076002)(5660300001)(106466001)(50466002)(7736002)(305945005)(2876002)(356003)(4326008)(7636002)(48376002)(66066001)(86152003)(39060400002)(47776003)(54906002)(38730400002)(2201001)(107886003)(49486002)(6306002)(5003940100001)(86362001)(2004002);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR13MB1458;H:JPYOKXEG102.jp.sony.com;FPR:;SPF:Pass;MLV:ovrnspm;MX:1;A:1;PTR:jpyokxeg102.jp.sony.com;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2NAM02FT008;1:THV45/O/IEhcz1Eqw88kWJcEGJsD6NngjkCQpHNjWixHX/mNCoB98RZv9YofXeyER1bYTKrbcgSY9qWi6Z94Ep3C0qgsRZ2vN/9KvRYxFphZMtZmxEJNSwpCcm2XkrZlVSQ3hGA1CN0cfA7PUtoAw72KnD1FSMg6cUMBYHte5bhN77gdMgfCZywU+8yI/NrgytjqtstI+gQsBuLcq0OVGQB3CsspYrTN45p9nbirFVZlB/QSYPizfLPnnD6AhHKpm7CJDoJkBB7kDGs77xjNojzAxgkIiZVUJ6avZHRd94Hqk3N3nBsPY7FL0PBZvAUyWMffaPkDH4yqjS8OE5dqBKzZshzJlzo2MCauJ9A5UxJjN5nAforvRBGxp4pquMSMxd46agKfbXX1mVbC+5mhpFHF4mRbn0hifv5XBFC0XhDzDOZaehmsk7zHcMlGBp2g2oC1zfD+Yxs5WP6lgpPcSdi+632ENI6y77b5gPN+0mp8dlY0ip3PgwjkVaroQKh2tlXMUezJKbE9VJV4UUmo577KXpRPvuhgiKMHQEWE2MjHKUi0L/32jvgr0wl92S1l X-MS-Office365-Filtering-Correlation-Id: 5e2322d2-6a6a-4465-a903-08d482dcc59a X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081)(201702281549075);SRVR:BN6PR13MB1458; X-Microsoft-Exchange-Diagnostics: 1;BN6PR13MB1458;3:ZQKW1llmuhoPKRFsD7EJSKSy7RMhB57idc3vh5v4MYyaAoFgzhU2lHqPfeQ7hJ/Nk8pvqWgHHwsUf+vVlf6h1oiYd5W8ydsRyL+uB3GyQGmIsVCPsEQck16ugLfusf7yr8Z/C8hfrXo8H9Bgy46p+1XziKqlXKinghO76OCGzNYqmAHcRQbIwFeif+9xJQ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IXrHsoITyK7i37cSpZH9/jSE29bmeZKqXRc34QIPd7zIegswE51eimSLR9X8nEn9Qe608IX5KHDkO+2cnUVW4BJSpni38Cmd7lpUf5TbSkbBDkI= X-Microsoft-Exchange-Diagnostics: 1;BN6PR13MB1458;20:IiWWBmFZGdNs/ujYG/s2gLE9LzGomYaiv3XpjFQCYdoOOz3fgIML3ld9e6ttX9teduVeB0DKuYqilzCz7zxPAFWfsaYg0jVxu7bpwMxvt9wIhtN3nLleYmlcD2wz7gei8zYSRjeBbHBHE6mvuiFCmF2ZxjoW3n1hRaaifg5Es+UYRv18WUzmcSTPmpTBCczwiHygrq2dHQjvkHH1WNocrYYism7swUMpTmwE93ZRzRh8AvbU7G7v9ty1uCOpjyLq+MmNZHwD0yJqSEigolu/t6XEmMpjx8NVmwWTQH6cQziZ/Pn8mWBhSFiZMeA2DEWSb0okBhZ6FzyQFADu7605fMP41Wb3hdu9U2m3zTjMnN7lrSIZ6XGjKpHsTZ+/+lf2fdIL6WYe4si0Mna47KHag45ar4xiOhnzZZOeZRly9yPmGXMjGgcAD2RAE9gLBbgs8/kMUICLZi6lXXcqMv9ThjJ483fIBUfXqAkEP/OvwFnfrciAIDGvb4E9PB2EmYbn X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(182409339516656)(22074186197030); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(13017025)(5005006)(8121501046)(13015025)(13024025)(13023025)(13018025)(93006095)(93004095)(3002001)(10201501046)(6055026)(6041248)(20161123564025)(20161123560025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(20161123555025)(6072148);SRVR:BN6PR13MB1458;BCL:0;PCL:0;RULEID:;SRVR:BN6PR13MB1458; X-Microsoft-Exchange-Diagnostics: 1;BN6PR13MB1458;4:kNsxGYOOGT95omwXBPNK6+yiZ/FyX/12IqhXmc0cLloPCI7D+fTQwfPQinxnJjqopYbalsF2Yoi2eQkfu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 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BN6PR13MB1458;7:RJfux5VRo4oq7W4acXab9R0cENzfQxkMtBTFTaJXbNOwb/SXieOoElk//k15GtN0rsAUer/uF3dhoU8m8X2XaMWhTmYLRG6UPwxVxKnhCTWAKxKJ+YZA6JcB35+XPLic5aOo6rGTGYy0JI8XhU5FZ8KwabVFAkHjNXgBwgfHmqlxW9q723pZvEr3pZ++Yn+SEvaQ/XNBAlkrE94gWBzzjukJfVyLn45pCCpPRDndJ3npL7dKCfz0ZHNXHpXbrf4V9/nMaiOhaCFu8rATpMK1SAwCyx6PX8K6Gwo9XkVKRtuAjgEc1PAkuiBv91DQBwvGzjT96tx/t3zOw2VVEjJSLg== X-OriginatorOrg: sony.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2017 02:20:08.1214 (UTC) X-MS-Exchange-CrossTenant-Id: 66c65d8a-9158-4521-a2d8-664963db48e4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=66c65d8a-9158-4521-a2d8-664963db48e4;Ip=[117.103.190.42];Helo=[JPYOKXEG102.jp.sony.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR13MB1458 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5260 Lines: 161 From: Yasunari Takiguchi Provide some math support functions (fixed-point log functions) for the Sony CXD2880 DVB-T2/T tuner + demodulator driver. Signed-off-by: Yasunari Takiguchi Signed-off-by: Masayuki Yamamoto Signed-off-by: Hideki Nozawa Signed-off-by: Kota Yonezawa Signed-off-by: Toshihiko Matsumoto Signed-off-by: Satoshi Watanabe --- drivers/media/dvb-frontends/cxd2880/cxd2880_math.c | 89 ++++++++++++++++++++++ drivers/media/dvb-frontends/cxd2880/cxd2880_math.h | 40 ++++++++++ 2 files changed, 129 insertions(+) create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_math.c create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_math.h diff --git a/drivers/media/dvb-frontends/cxd2880/cxd2880_math.c b/drivers/media/dvb-frontends/cxd2880/cxd2880_math.c new file mode 100644 index 000000000000..434c827898ff --- /dev/null +++ b/drivers/media/dvb-frontends/cxd2880/cxd2880_math.c @@ -0,0 +1,89 @@ +/* + * cxd2880_math.c + * Sony CXD2880 DVB-T2/T tuner + demodulator driver + * mathmatics functions + * + * Copyright (C) 2016, 2017 Sony Semiconductor Solutions Corporation + * + * 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; version 2 of the License. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#include "cxd2880_math.h" + +#define MAX_BIT_PRECISION 5 +#define FRAC_BITMASK 0x1F +#define LOG2_10_100X 332 +#define LOG2_E_100X 144 + +static const u8 log2_look_up[] = { + 0, 4, + 9, 13, + 17, 21, + 25, 29, + 32, 36, + 39, 43, + 46, 49, + 52, 55, + 58, 61, + 64, 67, + 70, 73, + 75, 78, + 81, 83, + 86, 88, + 91, 93, + 95, 98 +}; + +u32 cxd2880_math_log2(u32 x) +{ + u8 count = 0; + u8 index = 0; + u32 xval = x; + + for (x >>= 1; x > 0; x >>= 1) + count++; + + x = count * 100; + + if (count > 0) { + if (count <= MAX_BIT_PRECISION) { + index = + (u8)(xval << (MAX_BIT_PRECISION - count)) & + FRAC_BITMASK; + x += log2_look_up[index]; + } else { + index = + (u8)(xval >> (count - MAX_BIT_PRECISION)) & + FRAC_BITMASK; + x += log2_look_up[index]; + } + } + + return x; +} + +u32 cxd2880_math_log10(u32 x) +{ + return ((100 * cxd2880_math_log2(x) + LOG2_10_100X / 2) / LOG2_10_100X); +} + +u32 cxd2880_math_log(u32 x) +{ + return ((100 * cxd2880_math_log2(x) + LOG2_E_100X / 2) / LOG2_E_100X); +} diff --git a/drivers/media/dvb-frontends/cxd2880/cxd2880_math.h b/drivers/media/dvb-frontends/cxd2880/cxd2880_math.h new file mode 100644 index 000000000000..94211835a4ad --- /dev/null +++ b/drivers/media/dvb-frontends/cxd2880/cxd2880_math.h @@ -0,0 +1,40 @@ +/* + * cxd2880_math.h + * Sony CXD2880 DVB-T2/T tuner + demodulator driver + * mathmatics definitions + * + * Copyright (C) 2016, 2017 Sony Semiconductor Solutions Corporation + * + * 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; version 2 of the License. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#ifndef CXD2880_MATH_H_ +#define CXD2880_MATH_H_ + +#include "cxd2880_common.h" + +u32 cxd2880_math_log2(u32 x); +u32 cxd2880_math_log10(u32 x); +u32 cxd2880_math_log(u32 x); + +#ifndef min +#define min(a, b) (((a) < (b)) ? (a) : (b)) +#endif + +#endif -- 2.11.0