mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aaron Wu <aaron.wu@analog.com>
To: <linux-kernel@vger.kernel.org>
Cc: <aaron.wu@analog.com>
Subject: [Blackfin removal] [PATCH 11/28] misc: Remove Blackfin DSP echo support
Date: Fri, 16 Mar 2018 15:08:09 +0800	[thread overview]
Message-ID: <1521184106-24475-9-git-send-email-aaron.wu@analog.com> (raw)
In-Reply-To: <1521184106-24475-1-git-send-email-aaron.wu@analog.com>

Signed-off-by: Aaron Wu <aaron.wu@analog.com>

Remove Blackfin DSP echo support
---
 drivers/misc/echo/echo.c | 73 ------------------------------------------------
 drivers/misc/echo/fir.h  | 50 ---------------------------------
 2 files changed, 123 deletions(-)

diff --git a/drivers/misc/echo/echo.c b/drivers/misc/echo/echo.c
index 9597e95..8a5adc0 100644
--- a/drivers/misc/echo/echo.c
+++ b/drivers/misc/echo/echo.c
@@ -115,78 +115,6 @@
 
 /* adapting coeffs using the traditional stochastic descent (N)LMS algorithm */
 
-#ifdef __bfin__
-static inline void lms_adapt_bg(struct oslec_state *ec, int clean, int shift)
-{
-	int i;
-	int offset1;
-	int offset2;
-	int factor;
-	int exp;
-	int16_t *phist;
-	int n;
-
-	if (shift > 0)
-		factor = clean << shift;
-	else
-		factor = clean >> -shift;
-
-	/* Update the FIR taps */
-
-	offset2 = ec->curr_pos;
-	offset1 = ec->taps - offset2;
-	phist = &ec->fir_state_bg.history[offset2];
-
-	/* st: and en: help us locate the assembler in echo.s */
-
-	/* asm("st:"); */
-	n = ec->taps;
-	for (i = 0; i < n; i++) {
-		exp = *phist++ * factor;
-		ec->fir_taps16[1][i] += (int16_t) ((exp + (1 << 14)) >> 15);
-	}
-	/* asm("en:"); */
-
-	/* Note the asm for the inner loop above generated by Blackfin gcc
-	   4.1.1 is pretty good (note even parallel instructions used):
-
-	   R0 = W [P0++] (X);
-	   R0 *= R2;
-	   R0 = R0 + R3 (NS) ||
-	   R1 = W [P1] (X) ||
-	   nop;
-	   R0 >>>= 15;
-	   R0 = R0 + R1;
-	   W [P1++] = R0;
-
-	   A block based update algorithm would be much faster but the
-	   above can't be improved on much.  Every instruction saved in
-	   the loop above is 2 MIPs/ch!  The for loop above is where the
-	   Blackfin spends most of it's time - about 17 MIPs/ch measured
-	   with speedtest.c with 256 taps (32ms).  Write-back and
-	   Write-through cache gave about the same performance.
-	 */
-}
-
-/*
-   IDEAS for further optimisation of lms_adapt_bg():
-
-   1/ The rounding is quite costly.  Could we keep as 32 bit coeffs
-   then make filter pluck the MS 16-bits of the coeffs when filtering?
-   However this would lower potential optimisation of filter, as I
-   think the dual-MAC architecture requires packed 16 bit coeffs.
-
-   2/ Block based update would be more efficient, as per comments above,
-   could use dual MAC architecture.
-
-   3/ Look for same sample Blackfin LMS code, see if we can get dual-MAC
-   packing.
-
-   4/ Execute the whole e/c in a block of say 20ms rather than sample
-   by sample.  Processing a few samples every ms is inefficient.
-*/
-
-#else
 static inline void lms_adapt_bg(struct oslec_state *ec, int clean, int shift)
 {
 	int i;
@@ -215,7 +143,6 @@ static inline void lms_adapt_bg(struct oslec_state *ec, int clean, int shift)
 		ec->fir_taps16[1][i] += (int16_t) ((exp + (1 << 14)) >> 15);
 	}
 }
-#endif
 
 static inline int top_bit(unsigned int bits)
 {
diff --git a/drivers/misc/echo/fir.h b/drivers/misc/echo/fir.h
index 7b9fabf..4e0f365 100644
--- a/drivers/misc/echo/fir.h
+++ b/drivers/misc/echo/fir.h
@@ -27,14 +27,6 @@
 #define _FIR_H_
 
 /*
-   Blackfin NOTES & IDEAS:
-
-   A simple dot product function is used to implement the filter.  This performs
-   just one MAC/cycle which is inefficient but was easy to implement as a first
-   pass.  The current Blackfin code also uses an unrolled form of the filter
-   history to avoid 0 length hardware loop issues.  This is wasteful of
-   memory.
-
    Ideas for improvement:
 
    1/ Rewrite filter for dual MAC inner loop.  The issue here is handling
@@ -94,21 +86,13 @@ static inline const int16_t *fir16_create(struct fir16_state_t *fir,
 	fir->taps = taps;
 	fir->curr_pos = taps - 1;
 	fir->coeffs = coeffs;
-#if defined(__bfin__)
-	fir->history = kcalloc(2 * taps, sizeof(int16_t), GFP_KERNEL);
-#else
 	fir->history = kcalloc(taps, sizeof(int16_t), GFP_KERNEL);
-#endif
 	return fir->history;
 }
 
 static inline void fir16_flush(struct fir16_state_t *fir)
 {
-#if defined(__bfin__)
-	memset(fir->history, 0, 2 * fir->taps * sizeof(int16_t));
-#else
 	memset(fir->history, 0, fir->taps * sizeof(int16_t));
-#endif
 }
 
 static inline void fir16_free(struct fir16_state_t *fir)
@@ -116,42 +100,9 @@ static inline void fir16_free(struct fir16_state_t *fir)
 	kfree(fir->history);
 }
 
-#ifdef __bfin__
-static inline int32_t dot_asm(short *x, short *y, int len)
-{
-	int dot;
-
-	len--;
-
-	__asm__("I0 = %1;\n\t"
-		"I1 = %2;\n\t"
-		"A0 = 0;\n\t"
-		"R0.L = W[I0++] || R1.L = W[I1++];\n\t"
-		"LOOP dot%= LC0 = %3;\n\t"
-		"LOOP_BEGIN dot%=;\n\t"
-		"A0 += R0.L * R1.L (IS) || R0.L = W[I0++] || R1.L = W[I1++];\n\t"
-		"LOOP_END dot%=;\n\t"
-		"A0 += R0.L*R1.L (IS);\n\t"
-		"R0 = A0;\n\t"
-		"%0 = R0;\n\t"
-		: "=&d"(dot)
-		: "a"(x), "a"(y), "a"(len)
-		: "I0", "I1", "A1", "A0", "R0", "R1"
-	);
-
-	return dot;
-}
-#endif
-
 static inline int16_t fir16(struct fir16_state_t *fir, int16_t sample)
 {
 	int32_t y;
-#if defined(__bfin__)
-	fir->history[fir->curr_pos] = sample;
-	fir->history[fir->curr_pos + fir->taps] = sample;
-	y = dot_asm((int16_t *) fir->coeffs, &fir->history[fir->curr_pos],
-		    fir->taps);
-#else
 	int i;
 	int offset1;
 	int offset2;
@@ -165,7 +116,6 @@ static inline int16_t fir16(struct fir16_state_t *fir, int16_t sample)
 		y += fir->coeffs[i] * fir->history[i - offset1];
 	for (; i >= 0; i--)
 		y += fir->coeffs[i] * fir->history[i + offset2];
-#endif
 	if (fir->curr_pos <= 0)
 		fir->curr_pos = fir->taps;
 	fir->curr_pos--;
-- 
2.7.4

  parent reply	other threads:[~2018-03-16  7:22 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-16  7:08 [Blackfin removal] [PATCH 03/28] media: Remove Blackfin media support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 04/28] tty: Remove Blackfin tty and uart support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 05/28] rtc: Remove Blackfin RTC support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 06/28] mmc: Remove Blackfin SD host support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 07/28] watchdog: Remove Blackfin watchdog support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 08/28] Asoc: Remove Blackfin ASOC support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 09/28] input: Remove Blackfin input support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 10/28] i2c: Remove Blackfin I2C bus support Aaron Wu
2018-03-16  7:08 ` Aaron Wu [this message]
2018-03-16  7:08 ` [Blackfin removal] [PATCH 12/28] video: Remove Blackfin video support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 13/28] cpufreq: Remove Blackfin CPU frequency support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 14/28] mtd: Remove Blackfin MTD support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 15/28] spi: Remove Blackfin SPI bus support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 16/28] irda: Remove Blackfin IRDA support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 17/28] usb: Remove Blackfin USB support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 18/28] crypto: Remove Blackfin crypto support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 19/28] ata: Remove Blackfin PATA support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 20/28] pwm: Remove Blackfin PWM support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 21/28] pcmcia: Remove Blackfin PCMCIA support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 22/28] can: Remove Blackfin CAN bus support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 23/28] char: Remove Blackfin OTP support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 24/28] pinctrl: Remove Blackfin pinctrl support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 25/28] staging: Remove Blackfin iio trigger timer support Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 26/28] samples: Remove Blackfin gptimers sample code Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 27/28] documentation: Remove Blackfin documentation Aaron Wu
2018-03-16  7:08 ` [Blackfin removal] [PATCH 28/28] MAINTAINERS: Remove Blackfin from MAINTAINERS list Aaron Wu

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=1521184106-24475-9-git-send-email-aaron.wu@analog.com \
    --to=aaron.wu@analog.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

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

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

all inboxes | Powered by JetHome®