From patchwork Wed Sep 2 16:10:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751227 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 717CD14E3 for ; Wed, 2 Sep 2020 16:18:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 574BB20C56 for ; Wed, 2 Sep 2020 16:18:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063487; bh=BhKTMtLT8tEvJO4Z3S48DHTiFHHjF37Jb/BKMjkgGYk=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=LaAN6Nd7xLl6Fwkkki7pRzK0tOecam7FfVjSZrNJjZgKbBdYRFL3QLGlJQ4scQY/U mfj7CGGQnwgUUDG6pXyRzYsg+9siKO6SROpQXgBJLQLKIzyWIkub9PDVCtqNzhomFz gMGOGiIaKdxVqHVkJGmHAbro9xJziEkzogNRhi/k= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728483AbgIBQSF (ORCPT ); Wed, 2 Sep 2020 12:18:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:53874 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727997AbgIBQKs (ORCPT ); Wed, 2 Sep 2020 12:10:48 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E0CDE2151B; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=BhKTMtLT8tEvJO4Z3S48DHTiFHHjF37Jb/BKMjkgGYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ji1MZZS0aC7lXUeQvKnjJ55ugpcvz6eLJUMbd4J3HALMK1mOqDKjY75gIxevxzgEF u5IlznikXopH6gq8xyVvB8HfMvCa72zZn2VNR/F3+JNTjx1QrO5ahDk0QvM1skmIOR z/fvinToCQMx04klOMY3dbDTXZU+LNYb7aYOjcX8= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLP-000t9j-LB; Wed, 02 Sep 2020 18:10:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/38] media: tda10086: cleanup symbol_rate setting logic Date: Wed, 2 Sep 2020 18:10:04 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The original logic had an integer to unsigned integer conversion, plus a float-point math. While gcc should be able to do the match at compile time, other compilers might not do the same. Also, those produce the following warnings with static code analyzers: drivers/media/dvb-frontends/tda10086.c:300 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero. drivers/media/dvb-frontends/tda10086.c:303 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero. drivers/media/dvb-frontends/tda10086.c:306 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero. drivers/media/dvb-frontends/tda10086.c:309 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero. drivers/media/dvb-frontends/tda10086.c:312 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero. drivers/media/dvb-frontends/tda10086.c:315 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero. drivers/media/dvb-frontends/tda10086.c:318 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero. drivers/media/dvb-frontends/tda10086.c:321 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero. drivers/media/dvb-frontends/tda10086.c:324 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero. drivers/media/dvb-frontends/tda10086.c:327 tda10086_set_symbol_rate() warn: unsigned 'symbol_rate' is never less than zero. Change the logic to declare the reference constant as unsigned and to not use float point math. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/tda10086.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/media/dvb-frontends/tda10086.c b/drivers/media/dvb-frontends/tda10086.c index be6b40138f6e..cdcf97664bba 100644 --- a/drivers/media/dvb-frontends/tda10086.c +++ b/drivers/media/dvb-frontends/tda10086.c @@ -17,7 +17,7 @@ #include #include "tda10086.h" -#define SACLK 96000000 +#define SACLK 96000000U struct tda10086_state { struct i2c_adapter* i2c; @@ -297,34 +297,34 @@ static int tda10086_set_symbol_rate(struct tda10086_state *state, dprintk ("%s %i\n", __func__, symbol_rate); /* setup the decimation and anti-aliasing filters.. */ - if (symbol_rate < (u32) (SACLK * 0.0137)) { + if (symbol_rate < SACLK / 10000 * 137) { dfn=4; afs=1; - } else if (symbol_rate < (u32) (SACLK * 0.0208)) { + } else if (symbol_rate < SACLK / 10000 * 208) { dfn=4; afs=0; - } else if (symbol_rate < (u32) (SACLK * 0.0270)) { + } else if (symbol_rate < SACLK / 10000 * 270) { dfn=3; afs=1; - } else if (symbol_rate < (u32) (SACLK * 0.0416)) { + } else if (symbol_rate < SACLK / 10000 * 416) { dfn=3; afs=0; - } else if (symbol_rate < (u32) (SACLK * 0.0550)) { + } else if (symbol_rate < SACLK / 10000 * 550) { dfn=2; afs=1; - } else if (symbol_rate < (u32) (SACLK * 0.0833)) { + } else if (symbol_rate < SACLK / 10000 * 833) { dfn=2; afs=0; - } else if (symbol_rate < (u32) (SACLK * 0.1100)) { + } else if (symbol_rate < SACLK / 10000 * 1100) { dfn=1; afs=1; - } else if (symbol_rate < (u32) (SACLK * 0.1666)) { + } else if (symbol_rate < SACLK / 10000 * 1666) { dfn=1; afs=0; - } else if (symbol_rate < (u32) (SACLK * 0.2200)) { + } else if (symbol_rate < SACLK / 10000 * 2200) { dfn=0; afs=1; - } else if (symbol_rate < (u32) (SACLK * 0.3333)) { + } else if (symbol_rate < SACLK / 10000 * 3333) { dfn=0; afs=0; } else { From patchwork Wed Sep 2 16:10:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751237 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 21A0414E3 for ; Wed, 2 Sep 2020 16:18:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0133D20639 for ; Wed, 2 Sep 2020 16:18:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063527; bh=o6Sh4lf9iPZGm59TmPs0E72ml8wcW0c1F943Y0tZ+fU=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=qZVahz0sU72nrx7+r1ncj4/4WIjF0brr0X28/sWocDwKzt17Q/yASorYj0bEfL4XD CerjqqYuUDDTDxeA0ITvclNWJ4IFM3ZOml9y+9gOj3P3dq/pjeAZ22QxoauGITPgvF LlBYgCaY1uF/6YRmCMbMZhDmojkszw+xVkA3RQiE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728404AbgIBQSn (ORCPT ); Wed, 2 Sep 2020 12:18:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:53504 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726771AbgIBQKq (ORCPT ); Wed, 2 Sep 2020 12:10:46 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D6DCE208CA; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=o6Sh4lf9iPZGm59TmPs0E72ml8wcW0c1F943Y0tZ+fU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q8vRkqBaakRSn5pZdvB0Iz/Uk04wuGVZ5NGOLRHAVU1NKm+g04R+Ic2PSCEAIHje0 XTyYzYr7Tn968sW59wVoqt0U1E+4veme24+9Cfjaad0K0aSje46uYK48TBUTjpsj4r b/HxNImuKoH0l07N/riDO2pNYtn/WAPRFoXwtl5U= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLP-000t9l-M7; Wed, 02 Sep 2020 18:10:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Arnd Bergmann , Laurent Pinchart , Vandana BN , =?utf-8?q?Niklas_S=C3=B6derlund?= , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/38] media: v4l2-ioctl: avoid memory leaks on some time32 compat functions Date: Wed, 2 Sep 2020 18:10:05 +0200 Message-Id: <27254f9780e7ec8502761826c2888dbd51a536a8.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There are some reports about possible memory leaks: drivers/media/v4l2-core//v4l2-ioctl.c:3203 video_put_user() warn: check that 'ev32' doesn't leak information (struct has a hole after 'type') drivers/media/v4l2-core//v4l2-ioctl.c:3230 video_put_user() warn: check that 'vb32' doesn't leak information (struct has a hole after 'memory') While smatch seems to be reporting a false positive (line 3203), there's indeed a possible leak with reserved2 at vb32. We might have fixed just that one, but smatch checks won't be able to check leaks at ev32. So, re-work the code in a way that will ensure that the var contents will be zeroed before filling it. With that, we don't need anymore to touch reserved fields. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Laurent Pinchart --- drivers/media/v4l2-core/v4l2-ioctl.c | 48 ++++++++++++++-------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index a556880f225a..6f3fe9c4b64a 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -3189,17 +3189,16 @@ static int video_put_user(void __user *arg, void *parg, unsigned int cmd) #ifdef CONFIG_COMPAT_32BIT_TIME case VIDIOC_DQEVENT_TIME32: { struct v4l2_event *ev = parg; - struct v4l2_event_time32 ev32 = { - .type = ev->type, - .pending = ev->pending, - .sequence = ev->sequence, - .timestamp.tv_sec = ev->timestamp.tv_sec, - .timestamp.tv_nsec = ev->timestamp.tv_nsec, - .id = ev->id, - }; + struct v4l2_event_time32 ev32; + memset(&ev32, 0, sizeof(ev32)); + ev32.type = ev->type, + ev32.pending = ev->pending, + ev32.sequence = ev->sequence, + ev32.timestamp.tv_sec = ev->timestamp.tv_sec, + ev32.timestamp.tv_nsec = ev->timestamp.tv_nsec, + ev32.id = ev->id, memcpy(&ev32.u, &ev->u, sizeof(ev->u)); - memcpy(&ev32.reserved, &ev->reserved, sizeof(ev->reserved)); if (copy_to_user(arg, &ev32, sizeof(ev32))) return -EFAULT; @@ -3210,21 +3209,22 @@ static int video_put_user(void __user *arg, void *parg, unsigned int cmd) case VIDIOC_DQBUF_TIME32: case VIDIOC_PREPARE_BUF_TIME32: { struct v4l2_buffer *vb = parg; - struct v4l2_buffer_time32 vb32 = { - .index = vb->index, - .type = vb->type, - .bytesused = vb->bytesused, - .flags = vb->flags, - .field = vb->field, - .timestamp.tv_sec = vb->timestamp.tv_sec, - .timestamp.tv_usec = vb->timestamp.tv_usec, - .timecode = vb->timecode, - .sequence = vb->sequence, - .memory = vb->memory, - .m.userptr = vb->m.userptr, - .length = vb->length, - .request_fd = vb->request_fd, - }; + struct v4l2_buffer_time32 vb32; + + memset(&vb32, 0, sizeof(vb32)); + vb32.index = vb->index, + vb32.type = vb->type, + vb32.bytesused = vb->bytesused, + vb32.flags = vb->flags, + vb32.field = vb->field, + vb32.timestamp.tv_sec = vb->timestamp.tv_sec, + vb32.timestamp.tv_usec = vb->timestamp.tv_usec, + vb32.timecode = vb->timecode, + vb32.sequence = vb->sequence, + vb32.memory = vb->memory, + vb32.length = vb->length, + vb32.request_fd = vb->request_fd, + memcpy(&vb32.m, &vb->m, sizeof(vb->m)); if (copy_to_user(arg, &vb32, sizeof(vb32))) return -EFAULT; From patchwork Wed Sep 2 16:10:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751151 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C7422109A for ; Wed, 2 Sep 2020 16:11:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AB4432072A for ; Wed, 2 Sep 2020 16:11:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063066; bh=yHxkHJXmHHTyvyIwik9o+Zn+nYcXFp6fggzlMJQEB0w=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=HSfK7Cq+xkxzDg5eV41r95oZp3QRk3MKbNE7ct5UBMKGPd0uZpnhsUCWe3QpH9DwK h1dCLFJEFLkQNErW/klbHDAnCo1qaajj7oe268DZJgJbg4xrMFCvhTfi3Gd71LBqVN CtelYOLV+ZKM/oTzIe8gysvQklEr2BjrE8E1/NiI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728313AbgIBQLB (ORCPT ); Wed, 2 Sep 2020 12:11:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:53920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728164AbgIBQKw (ORCPT ); Wed, 2 Sep 2020 12:10:52 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DA1312137B; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=yHxkHJXmHHTyvyIwik9o+Zn+nYcXFp6fggzlMJQEB0w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2alxKTRfIVmUUpPCedtGlFXhuDyxf1uwEBLlY7gwRwZx4sF0APleIQv6D5VLfX/zK pTG8GW4JxZPNBkUDj2PmZse9xJklp/hvnjECggpAcCjAnSEsP1tgNZx+NXZ1LAh/FB OBO39kdozwMgLnQEynMss6S/y14oBGm2PHeD7qTc= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLP-000t9n-N0; Wed, 02 Sep 2020 18:10:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Antti Palosaari , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/38] media: qt1010: fix usage of unititialized value Date: Wed, 2 Sep 2020 18:10:06 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As pointed by smatch: drivers/media/tuners/qt1010.c:239 qt1010_init_meas1() error: uninitialized symbol 'val2'. drivers/media/tuners/qt1010.c:273 qt1010_init_meas2() error: uninitialized symbol 'val'. The logic is ok, but it is hard for static analyzers to parse it, as it depends on a value read in the middle of a loop. Also, it takes a while for humans to verify. Re-write the first function to use a more direct way. At the second one, I opted to just initialize the read var, in order to shut up the report. While here, address a few coding style issues at the function code. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/tuners/qt1010.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/media/tuners/qt1010.c b/drivers/media/tuners/qt1010.c index e48faf942830..3853a3d43d4f 100644 --- a/drivers/media/tuners/qt1010.c +++ b/drivers/media/tuners/qt1010.c @@ -222,23 +222,24 @@ static int qt1010_init_meas1(struct qt1010_priv *priv, { QT1010_WR, reg, reg_init_val }, { QT1010_WR, 0x1e, 0x00 }, { QT1010_WR, 0x1e, oper }, - { QT1010_RD, reg, 0xff } }; for (i = 0; i < ARRAY_SIZE(i2c_data); i++) { - if (i2c_data[i].oper == QT1010_WR) { - err = qt1010_writereg(priv, i2c_data[i].reg, - i2c_data[i].val); - } else { - err = qt1010_readreg(priv, i2c_data[i].reg, &val2); - } - if (err) return err; + err = qt1010_writereg(priv, i2c_data[i].reg, + i2c_data[i].val); + if (err) + return err; } + err = qt1010_readreg(priv, reg, &val2); + if (err) + return err; do { val1 = val2; err = qt1010_readreg(priv, reg, &val2); - if (err) return err; + if (err) + return err; + dev_dbg(&priv->i2c->dev, "%s: compare reg:%02x %02x %02x\n", __func__, reg, val1, val2); } while (val1 != val2); @@ -250,7 +251,7 @@ static int qt1010_init_meas1(struct qt1010_priv *priv, static int qt1010_init_meas2(struct qt1010_priv *priv, u8 reg_init_val, u8 *retval) { - u8 i, val; + u8 i, val = 0xff; int err; qt1010_i2c_oper_t i2c_data[] = { { QT1010_WR, 0x07, reg_init_val }, @@ -261,6 +262,7 @@ static int qt1010_init_meas2(struct qt1010_priv *priv, { QT1010_WR, 0x1e, 0x00 }, { QT1010_WR, 0x22, 0xff } }; + for (i = 0; i < ARRAY_SIZE(i2c_data); i++) { if (i2c_data[i].oper == QT1010_WR) { err = qt1010_writereg(priv, i2c_data[i].reg, @@ -268,7 +270,8 @@ static int qt1010_init_meas2(struct qt1010_priv *priv, } else { err = qt1010_readreg(priv, i2c_data[i].reg, &val); } - if (err) return err; + if (err) + return err; } *retval = val; return 0; From patchwork Wed Sep 2 16:10:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751231 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6CAF514E3 for ; Wed, 2 Sep 2020 16:18:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 548C320829 for ; Wed, 2 Sep 2020 16:18:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063517; bh=5Br08z5EHU347ymKSVPsmlv2b1oAPGH5xsj10Ivzd+8=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=KBJcSRarzCwYxbhKeKxQzMghFCUmflsmXSZbRYNBJEWEfTWVBwQHRALqSgiW4Dpho pmvPnGAh170gYeaC0zCJjj+9c5w+/c8jXZVk9v6ns99o+YVOL3Zby4sDcx3hmryGJK /X/+PjIuTn6uQ4sBoPLjCMMT+QSdPcD2cO2+A8As= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728896AbgIBQSI (ORCPT ); Wed, 2 Sep 2020 12:18:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:53872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727991AbgIBQKs (ORCPT ); Wed, 2 Sep 2020 12:10:48 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DD2D8214F1; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=5Br08z5EHU347ymKSVPsmlv2b1oAPGH5xsj10Ivzd+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pdpEcpknJFkU98IyHqqtNNK8vHKCDK0nq3a+OkyxFNbyCbTCQyyGL5Ajo3M8HPjgz 2g1iOTnZcQzciGbRcyzqKXOPHvz9khZunuLBu0QXWgSZogk89TsPpXZalTCXReJtNY Q/xKMs1oqd2OMMfJZX6q+NDBemfgpYi57uGkYCFI= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLP-000t9p-Nq; Wed, 02 Sep 2020 18:10:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/38] media: av7110_v4l: avoid a typecast Date: Wed, 2 Sep 2020 18:10:07 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org While smatch reports an issue there: drivers/media/pci/ttpci/av7110_v4l.c:163 ves1820_set_tv_freq() warn: unsigned 'freq' is never less than zero. drivers/media/pci/ttpci/av7110_v4l.c:165 ves1820_set_tv_freq() warn: unsigned 'freq' is never less than zero. The logic is actually fine. Yet, removing the typecast shuts up smatch and makes the code more readable. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/ttpci/av7110_v4l.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/ttpci/av7110_v4l.c b/drivers/media/pci/ttpci/av7110_v4l.c index cabe006658dd..6d9c908be713 100644 --- a/drivers/media/pci/ttpci/av7110_v4l.c +++ b/drivers/media/pci/ttpci/av7110_v4l.c @@ -160,9 +160,9 @@ static int ves1820_set_tv_freq(struct saa7146_dev *dev, u32 freq) buf[1] = div & 0xff; buf[2] = 0x8e; - if (freq < (u32) (16 * 168.25)) + if (freq < 16U * 168.25) config = 0xa0; - else if (freq < (u32) (16 * 447.25)) + else if (freq < 16U * 447.25) config = 0x90; else config = 0x30; From patchwork Wed Sep 2 16:10:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751147 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F0792109A for ; Wed, 2 Sep 2020 16:10:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D88C3216C4 for ; Wed, 2 Sep 2020 16:10:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063051; bh=1OCEDwU9HDg1YRkwjzMBn5RpJKhK/uC509VN2U3vg0c=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=RrTmm9ULT9CGCG233e+iEmg/HuXd8cWTNY7OPFrGFdeqRoY5lCYm0Kjos8NUmLh4m uADA0x2rhPksS40bBRqpmoad3NgmDUhyUSuO79UEjeNKgPmuqbBNFa81sGD1+lYA5j naAAaCpIskHxCxf0PRbLruR44fozxzk43Tf0XuNU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728035AbgIBQKs (ORCPT ); Wed, 2 Sep 2020 12:10:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:53486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726323AbgIBQKq (ORCPT ); Wed, 2 Sep 2020 12:10:46 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D5B0320829; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=1OCEDwU9HDg1YRkwjzMBn5RpJKhK/uC509VN2U3vg0c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ifhvhUuYT6pd0LE2qsDDFfRrMs8OdIaCz9X7BIOgxoGIjS6nbjFk3zb/jSh37oh2k nF6OongzJKq2WaCYU3KSWPiKn5o9cVjdXfv0Jh96z4VXkZpBNguFTgU0YhvGGBUa+O Ypt7/TzZzQ1xyDr+AhnWN65zCsVHK6mfMlG7CzEI= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLP-000t9r-Oh; Wed, 02 Sep 2020 18:10:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Hans Verkuil , Allen Pais , Romain Perier , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/38] media: wl128x: get rid of a potential spectre issue Date: Wed, 2 Sep 2020 18:10:08 +0200 Message-Id: <17a07bd5f4a690a388ba03daf8d01b30bd9cd8d9.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As reported by smatch: drivers/media/radio/wl128x/fmdrv_common.c:736 fm_irq_handle_rdsdata_getcmd_resp() warn: potential spectre issue 'rds_fmt.data.groupdatabuff.buff> Address it by using array_index_nospec(). While here, reorder the linux/ includes. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/radio/wl128x/fmdrv_common.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c index 5c395da74e17..9abc8e0283c1 100644 --- a/drivers/media/radio/wl128x/fmdrv_common.c +++ b/drivers/media/radio/wl128x/fmdrv_common.c @@ -19,9 +19,11 @@ * Author: Manjunatha Halli */ -#include -#include #include +#include +#include +#include + #include "fmdrv.h" #include "fmdrv_v4l2.h" #include "fmdrv_common.h" @@ -700,7 +702,7 @@ static void fm_irq_handle_rdsdata_getcmd_resp(struct fmdev *fmdev) struct fm_rds *rds = &fmdev->rx.rds; unsigned long group_idx, flags; u8 *rds_data, meta_data, tmpbuf[FM_RDS_BLK_SIZE]; - u8 type, blk_idx; + u8 type, blk_idx, idx; u16 cur_picode; u32 rds_len; @@ -733,9 +735,11 @@ static void fm_irq_handle_rdsdata_getcmd_resp(struct fmdev *fmdev) } /* Skip checkword (control) byte and copy only data byte */ - memcpy(&rds_fmt.data.groupdatabuff. - buff[blk_idx * (FM_RDS_BLK_SIZE - 1)], - rds_data, (FM_RDS_BLK_SIZE - 1)); + idx = array_index_nospec(blk_idx * (FM_RDS_BLK_SIZE - 1), + FM_RX_RDS_INFO_FIELD_MAX - (FM_RDS_BLK_SIZE - 1)); + + memcpy(&rds_fmt.data.groupdatabuff.buff[idx], rds_data, + FM_RDS_BLK_SIZE - 1); rds->last_blk_idx = blk_idx; From patchwork Wed Sep 2 16:10:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751217 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE806109B for ; Wed, 2 Sep 2020 16:17:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AB3BC20829 for ; Wed, 2 Sep 2020 16:17:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063449; bh=iMwur6qM3ZZ6P0L7pVxBdHuvvZDLHp1t0SylHttyE2M=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=TN+i75w0/XKeGhEvwCTUjQxDjZCmjfHl+wG+bODhwA2iwTeQTJo4152leabpP+Uhq +1zRZsXy3Bmn+wBM8t9aDGqHRumGkgbEjeBBP7/54+x8t8NRQqHlQAQiRnHXr9ztGd BqFXCmsSaFyhpAZAu5DwU7II6fX7ORkFRZlc69bs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728219AbgIBQKv (ORCPT ); Wed, 2 Sep 2020 12:10:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:53500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726528AbgIBQKq (ORCPT ); Wed, 2 Sep 2020 12:10:46 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D596B2072A; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=iMwur6qM3ZZ6P0L7pVxBdHuvvZDLHp1t0SylHttyE2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FKIcXRYqTJF0AmXLoClH7H/yXvzpyvcH1uSCsd+ZGN2Tmwb+nCHcZSxsyw7b7zxXn xgM1HqgHX0MmHK6coPjhKYN+E3paH36oxBY0fA6ib2lXONudq/3XVYYGon3/+g1LY4 ERBx6hi/mXjQpO5BeNlXb5D70bugk3PiDt0FXq8I= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLP-000t9u-PX; Wed, 02 Sep 2020 18:10:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Stanimir Varbanov , Andy Gross , Bjorn Andersson , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/38] media: venus: place extern venus_fw_debug on a header file Date: Wed, 2 Sep 2020 18:10:09 +0200 Message-Id: <64a99ecb3e7cfae697a16c6b6ca05034f73ad985.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sparse warns about this symbol: drivers/media/platform/qcom/venus/hfi_venus.c:133:5: warning: symbol 'venus_fw_debug' was not declared. Should it be static? Because hfi_venus.c doesn't include a header file with the extern. So, move it to core.h, with is included by both hfi_venus.c and dbgfs.c. This way, if something changes with it, warnings or errors will be produced. Signed-off-by: Mauro Carvalho Chehab Acked-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 2 ++ drivers/media/platform/qcom/venus/dbgfs.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 8e75a199f9f7..1a7aee7ee628 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -24,6 +24,8 @@ #define VIDC_VCODEC_CLKS_NUM_MAX 2 #define VIDC_PMDOMAINS_NUM_MAX 3 +extern int venus_fw_debug; + struct freq_tbl { unsigned int load; unsigned long freq; diff --git a/drivers/media/platform/qcom/venus/dbgfs.c b/drivers/media/platform/qcom/venus/dbgfs.c index 782d54ac1b8f..52de47f2ca88 100644 --- a/drivers/media/platform/qcom/venus/dbgfs.c +++ b/drivers/media/platform/qcom/venus/dbgfs.c @@ -7,8 +7,6 @@ #include "core.h" -extern int venus_fw_debug; - void venus_dbgfs_init(struct venus_core *core) { core->root = debugfs_create_dir("venus", NULL); From patchwork Wed Sep 2 16:10:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751223 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 50557109B for ; Wed, 2 Sep 2020 16:18:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 371392145D for ; Wed, 2 Sep 2020 16:18:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063483; bh=0Hj7ZIEL0P3+LazNj3oWTUDc18jn9Tcv84+tSkI0Wtg=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=0K+i6/avLb0bMt3MXcNRIqz8SMgsIxsJIgbN+yUXrVr6elLGHsLlVDy7fsQ1jUz5P fHdiKWOo+mJQSWCDm6FbuenK5QEZNHRAHV4o4qqfCHe4P7cGM927JwaWxVL7snU3Ca vkQrfICflcY0esQg/JXGFk93kRMY5jts6VEuJUiA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728497AbgIBQRa (ORCPT ); Wed, 2 Sep 2020 12:17:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:53892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728045AbgIBQKv (ORCPT ); Wed, 2 Sep 2020 12:10:51 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DAC322145D; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=0Hj7ZIEL0P3+LazNj3oWTUDc18jn9Tcv84+tSkI0Wtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VA1GN01hnAbujexln0WXKOHjK5Pa4EMpteFO/qoRPoLo700l4eXmKSgDC8ry2xvJe NbCw3PqKHFOy/OHBHi5tSYUBkXpBmk16gxahSRl3o9FGd0SSMMBP9faddVrPmsk4z1 +86S5WrUxcqj1cz+be5EXucse5DHu9lzZ38p3nds= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLP-000t9w-QL; Wed, 02 Sep 2020 18:10:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/38] media: tda10021: avoid casts when using symbol_rate Date: Wed, 2 Sep 2020 18:10:10 +0200 Message-Id: <316f5e497a02dc245953134f22cfb70aa67ccd26.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The usage of castings and float point when checking for the setup based at the symbol_rate cause those warnings with smatch: drivers/media/dvb-frontends/tda10021.c:153 tda10021_set_symbolrate() warn: unsigned 'symbolrate' is never less than zero. drivers/media/dvb-frontends/tda10021.c:155 tda10021_set_symbolrate() warn: unsigned 'symbolrate' is never less than zero. drivers/media/dvb-frontends/tda10021.c:157 tda10021_set_symbolrate() warn: unsigned 'symbolrate' is never less than zero. drivers/media/dvb-frontends/tda10021.c:159 tda10021_set_symbolrate() warn: unsigned 'symbolrate' is never less than zero. While the code should work with gcc, as it will evaluate the values into a constant before compiling, other compilers could do otherwise. So, get rid of float pointing math on it, avoiding the need of doing typecasts. While here, cleanup some coding style issues at the related code. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb-frontends/tda10021.c | 38 ++++++++++++++++---------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/drivers/media/dvb-frontends/tda10021.c b/drivers/media/dvb-frontends/tda10021.c index 9fb207b41576..faa6e54b3372 100644 --- a/drivers/media/dvb-frontends/tda10021.c +++ b/drivers/media/dvb-frontends/tda10021.c @@ -137,26 +137,36 @@ static int tda10021_set_symbolrate (struct tda10021_state* state, u32 symbolrate { s32 BDR; s32 BDRI; - s16 SFIL=0; + s16 SFIL = 0; u16 NDEC = 0; u32 tmp, ratio; - if (symbolrate > XIN/2) - symbolrate = XIN/2; - if (symbolrate < 500000) + if (symbolrate > XIN / 2) + symbolrate = XIN / 2; + else if (symbolrate < 500000) symbolrate = 500000; - if (symbolrate < XIN/16) NDEC = 1; - if (symbolrate < XIN/32) NDEC = 2; - if (symbolrate < XIN/64) NDEC = 3; + if (symbolrate < XIN / 16) + NDEC = 1; + if (symbolrate < XIN / 32) + NDEC = 2; + if (symbolrate < XIN / 64) + NDEC = 3; - if (symbolrate < (u32)(XIN/12.3)) SFIL = 1; - if (symbolrate < (u32)(XIN/16)) SFIL = 0; - if (symbolrate < (u32)(XIN/24.6)) SFIL = 1; - if (symbolrate < (u32)(XIN/32)) SFIL = 0; - if (symbolrate < (u32)(XIN/49.2)) SFIL = 1; - if (symbolrate < (u32)(XIN/64)) SFIL = 0; - if (symbolrate < (u32)(XIN/98.4)) SFIL = 1; + if (symbolrate < XIN * 10 / 123) + SFIL = 1; + if (symbolrate < XIN * 10 / 160) + SFIL = 0; + if (symbolrate < XIN * 10 / 246) + SFIL = 1; + if (symbolrate < XIN * 10 / 320) + SFIL = 0; + if (symbolrate < XIN * 10 / 492) + SFIL = 1; + if (symbolrate < XIN * 10 / 640) + SFIL = 0; + if (symbolrate < XIN * 10 / 984) + SFIL = 1; symbolrate <<= NDEC; ratio = (symbolrate << 4) / FIN; From patchwork Wed Sep 2 16:10:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751221 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7C2E109B for ; Wed, 2 Sep 2020 16:17:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B6D19208B3 for ; Wed, 2 Sep 2020 16:17:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063454; bh=zqQVmwBJFUyvG7NUGiAocdFONJNzYAoPsK4CmSnBlQA=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=sfJ7Y+cQGXQeUEr+dEUotwMVfh80EQ8cMiLvBHb4ChLIrTsL3wb5Ju6g5pOJoriJe FMqlrxKDb2nGGcLxObvjErSR9RWrArIHsU8Ay44MRiimXsDxUjAb+kabfT6CNl7TV8 rjA6Hq3Rlz+kirU0FNFEJDPCfNSQn9XJ/T8UpIlM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728865AbgIBQRb (ORCPT ); Wed, 2 Sep 2020 12:17:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:53894 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728078AbgIBQKu (ORCPT ); Wed, 2 Sep 2020 12:10:50 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DC395214D8; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=zqQVmwBJFUyvG7NUGiAocdFONJNzYAoPsK4CmSnBlQA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PZ8sJlOWtVhPnAEFoqiJYvBe9fsgsyCGzubxafXZQos6UeL9Ja3TpeqF/AOU54zeQ 4QyWQZ6HGf9bkRGXDkakUJWhhHWWeBcugUYX3PpP/Y1uknULcDEGdU2gaBk9AEPVZ2 bTdr82Qdb4Qcq/q9vvmkyE0tr4r6OCC4fzQhsueQ= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLP-000t9y-RD; Wed, 02 Sep 2020 18:10:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sean Young , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/38] media: serial_ir: use the right type for a dma address Date: Wed, 2 Sep 2020 18:10:11 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As warned by smatch: drivers/media/rc/serial_ir.c:550 serial_ir_probe() warn: should '8 << ioshift' be a 64 bit type? the "8" constant should be unsigned long. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/rc/serial_ir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/rc/serial_ir.c b/drivers/media/rc/serial_ir.c index d77507ba0fb5..5b5b3203f5a0 100644 --- a/drivers/media/rc/serial_ir.c +++ b/drivers/media/rc/serial_ir.c @@ -547,7 +547,7 @@ static int serial_ir_probe(struct platform_device *dev) /* Reserve io region. */ if ((iommap && - (devm_request_mem_region(&dev->dev, iommap, 8 << ioshift, + (devm_request_mem_region(&dev->dev, iommap, 8UL << ioshift, KBUILD_MODNAME) == NULL)) || (!iommap && (devm_request_region(&dev->dev, io, 8, KBUILD_MODNAME) == NULL))) { From patchwork Wed Sep 2 16:10:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751233 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7D44109B for ; Wed, 2 Sep 2020 16:18:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BA8AA208B3 for ; Wed, 2 Sep 2020 16:18:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063517; bh=fpks8/wgVNH3xUBKsGhywKHuyIv8sN2aTZ5fHxmheuM=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=ZMeiz2e5Ibernv9hc4acG4oxCCq5mDrG1l1j9+mKKIC67R3T428fbZO1qUaQi9mQw JoUJ8wS8UnbCvFUU2/lEW8KXTivneph4wtEzdPMQxnSC82vFF3p+9iyEfYD6beMJ9q GkUdYpvtP744BcAnBFX+QTmEqlWVI0pOYumAxnZ8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728887AbgIBQSH (ORCPT ); Wed, 2 Sep 2020 12:18:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:53842 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727970AbgIBQKs (ORCPT ); Wed, 2 Sep 2020 12:10:48 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D6D1D208C7; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=fpks8/wgVNH3xUBKsGhywKHuyIv8sN2aTZ5fHxmheuM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sZm4UigSYItvrgyo3ZQ5jhbMEUIVHtHTwQbKUsSwIaqGhjKsoCQm/vGhYLO5IR5QD ltTBCRxT45+x76RlQaeFQBdhxtD4yiLkgOD2wE0MOCvWy+iL8af1uCDIDVdPQ7HkHk uQmGMODE9wotHtT5VjPpI2st9L/X2gSn3BlwdhHc= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLP-000tA1-S2; Wed, 02 Sep 2020 18:10:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/38] media: vivid: move the detection part out of vivid_create_instance Date: Wed, 2 Sep 2020 18:10:12 +0200 Message-Id: <5c740fb631ed95df4b15ea5de43bd9b1a7a53493.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The vivid_create_instance() function is too harry. Smatch can't process it, because it takes too long. The detection part is an important piece of it. As such, there are even comments before and after such block. So, it makes sense to just move it to a separate function. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/test-drivers/vivid/vivid-core.c | 151 ++++++++++-------- 1 file changed, 83 insertions(+), 68 deletions(-) diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c index 931218fa955e..d4785da440d9 100644 --- a/drivers/media/test-drivers/vivid/vivid-core.c +++ b/drivers/media/test-drivers/vivid/vivid-core.c @@ -832,56 +832,16 @@ static int vivid_create_queue(struct vivid_dev *dev, return vb2_queue_init(q); } -static int vivid_create_instance(struct platform_device *pdev, int inst) +static int vivid_detect_feature_set(struct vivid_dev *dev, int inst, + unsigned node_type, + bool *has_tuner, + bool *has_modulator, + int *ccs_cap, + int *ccs_out, + unsigned in_type_counter[4], + unsigned out_type_counter[4]) { - static const struct v4l2_dv_timings def_dv_timings = - V4L2_DV_BT_CEA_1280X720P60; - unsigned in_type_counter[4] = { 0, 0, 0, 0 }; - unsigned out_type_counter[4] = { 0, 0, 0, 0 }; - int ccs_cap = ccs_cap_mode[inst]; - int ccs_out = ccs_out_mode[inst]; - bool has_tuner; - bool has_modulator; - struct vivid_dev *dev; - struct video_device *vfd; - unsigned node_type = node_types[inst]; - v4l2_std_id tvnorms_cap = 0, tvnorms_out = 0; - int ret; int i; -#ifdef CONFIG_VIDEO_VIVID_CEC - unsigned int cec_tx_bus_cnt = 0; -#endif - - /* allocate main vivid state structure */ - dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) - return -ENOMEM; - - dev->inst = inst; - -#ifdef CONFIG_MEDIA_CONTROLLER - dev->v4l2_dev.mdev = &dev->mdev; - - /* Initialize media device */ - strscpy(dev->mdev.model, VIVID_MODULE_NAME, sizeof(dev->mdev.model)); - snprintf(dev->mdev.bus_info, sizeof(dev->mdev.bus_info), - "platform:%s-%03d", VIVID_MODULE_NAME, inst); - dev->mdev.dev = &pdev->dev; - media_device_init(&dev->mdev); - dev->mdev.ops = &vivid_media_ops; -#endif - - /* register v4l2_device */ - snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), - "%s-%03d", VIVID_MODULE_NAME, inst); - ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); - if (ret) { - kfree(dev); - return ret; - } - dev->v4l2_dev.release = vivid_dev_release; - - /* start detecting feature set */ /* do we use single- or multi-planar? */ dev->multiplanar = multiplanar[inst] > 1; @@ -947,14 +907,12 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) !dev->has_vid_cap && !dev->has_meta_cap) { v4l2_warn(&dev->v4l2_dev, "Webcam or HDMI input without video or metadata nodes\n"); - kfree(dev); return -EINVAL; } if ((in_type_counter[TV] || in_type_counter[SVID]) && !dev->has_vid_cap && !dev->has_vbi_cap && !dev->has_meta_cap) { v4l2_warn(&dev->v4l2_dev, "TV or S-Video input without video, VBI or metadata nodes\n"); - kfree(dev); return -EINVAL; } @@ -976,13 +934,11 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) !dev->has_vid_out && !dev->has_vbi_out && !dev->has_meta_out) { v4l2_warn(&dev->v4l2_dev, "S-Video output without video, VBI or metadata nodes\n"); - kfree(dev); return -EINVAL; } if (out_type_counter[HDMI] && !dev->has_vid_out && !dev->has_meta_out) { v4l2_warn(&dev->v4l2_dev, "HDMI output without video or metadata nodes\n"); - kfree(dev); return -EINVAL; } @@ -999,25 +955,25 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) dev->has_tv_tuner = in_type_counter[TV]; /* do we have a tuner? */ - has_tuner = ((dev->has_vid_cap || dev->has_vbi_cap) && in_type_counter[TV]) || - dev->has_radio_rx || dev->has_sdr_cap; + *has_tuner = ((dev->has_vid_cap || dev->has_vbi_cap) && in_type_counter[TV]) || + dev->has_radio_rx || dev->has_sdr_cap; /* do we have a modulator? */ - has_modulator = dev->has_radio_tx; + *has_modulator = dev->has_radio_tx; if (dev->has_vid_cap) /* do we have a framebuffer for overlay testing? */ dev->has_fb = node_type & 0x10000; /* can we do crop/compose/scaling while capturing? */ - if (no_error_inj && ccs_cap == -1) - ccs_cap = 7; + if (no_error_inj && *ccs_cap == -1) + *ccs_cap = 7; /* if ccs_cap == -1, then the user can select it using controls */ - if (ccs_cap != -1) { - dev->has_crop_cap = ccs_cap & 1; - dev->has_compose_cap = ccs_cap & 2; - dev->has_scaler_cap = ccs_cap & 4; + if (*ccs_cap != -1) { + dev->has_crop_cap = *ccs_cap & 1; + dev->has_compose_cap = *ccs_cap & 2; + dev->has_scaler_cap = *ccs_cap & 4; v4l2_info(&dev->v4l2_dev, "Capture Crop: %c Compose: %c Scaler: %c\n", dev->has_crop_cap ? 'Y' : 'N', dev->has_compose_cap ? 'Y' : 'N', @@ -1025,14 +981,14 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) } /* can we do crop/compose/scaling with video output? */ - if (no_error_inj && ccs_out == -1) - ccs_out = 7; + if (no_error_inj && *ccs_out == -1) + *ccs_out = 7; /* if ccs_out == -1, then the user can select it using controls */ - if (ccs_out != -1) { - dev->has_crop_out = ccs_out & 1; - dev->has_compose_out = ccs_out & 2; - dev->has_scaler_out = ccs_out & 4; + if (*ccs_out != -1) { + dev->has_crop_out = *ccs_out & 1; + dev->has_compose_out = *ccs_out & 2; + dev->has_scaler_out = *ccs_out & 4; v4l2_info(&dev->v4l2_dev, "Output Crop: %c Compose: %c Scaler: %c\n", dev->has_crop_out ? 'Y' : 'N', dev->has_compose_out ? 'Y' : 'N', @@ -1042,7 +998,66 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) /* do we create a touch capture device */ dev->has_touch_cap = node_type & 0x80000; - /* end detecting feature set */ + return 0; +} + +static int vivid_create_instance(struct platform_device *pdev, int inst) +{ + static const struct v4l2_dv_timings def_dv_timings = + V4L2_DV_BT_CEA_1280X720P60; + unsigned in_type_counter[4] = { 0, 0, 0, 0 }; + unsigned out_type_counter[4] = { 0, 0, 0, 0 }; + int ccs_cap = ccs_cap_mode[inst]; + int ccs_out = ccs_out_mode[inst]; + bool has_tuner; + bool has_modulator; + struct vivid_dev *dev; + struct video_device *vfd; + unsigned node_type = node_types[inst]; + v4l2_std_id tvnorms_cap = 0, tvnorms_out = 0; + int ret; + int i; +#ifdef CONFIG_VIDEO_VIVID_CEC + unsigned int cec_tx_bus_cnt = 0; +#endif + + /* allocate main vivid state structure */ + dev = kzalloc(sizeof(*dev), GFP_KERNEL); + if (!dev) + return -ENOMEM; + + dev->inst = inst; + +#ifdef CONFIG_MEDIA_CONTROLLER + dev->v4l2_dev.mdev = &dev->mdev; + + /* Initialize media device */ + strscpy(dev->mdev.model, VIVID_MODULE_NAME, sizeof(dev->mdev.model)); + snprintf(dev->mdev.bus_info, sizeof(dev->mdev.bus_info), + "platform:%s-%03d", VIVID_MODULE_NAME, inst); + dev->mdev.dev = &pdev->dev; + media_device_init(&dev->mdev); + dev->mdev.ops = &vivid_media_ops; +#endif + + /* register v4l2_device */ + snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name), + "%s-%03d", VIVID_MODULE_NAME, inst); + ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); + if (ret) { + kfree(dev); + return ret; + } + dev->v4l2_dev.release = vivid_dev_release; + + ret = vivid_detect_feature_set(dev, inst, node_type, + &has_tuner, &has_modulator, + &ccs_cap, &ccs_out, + in_type_counter, out_type_counter); + if (ret) { + kfree(dev); + return ret; + } if (dev->has_vid_cap) { /* set up the capabilities of the video capture device */ From patchwork Wed Sep 2 16:10:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751229 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E6B20166C for ; Wed, 2 Sep 2020 16:18:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C8F34208C7 for ; Wed, 2 Sep 2020 16:18:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063487; bh=TNOI/VLtApvB6yPQmCUZBBC5lN9M1DLUltQ/CvohjAk=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=YqN5lu9Uk+H4iyXRiFeWV3k5cP30iYK5u5ZUhjb8TNrtfc9fpvUHUa0i4qY72cw4P 9biPhM6Upf98Yg85vHF4dDtFtRdXbJ/Y8ZYldpof7kLBVB1DHWpON6mA70cIwvPlzA CJjqzn1jxTuzPpu6tIJUyoFa7OsC3MQdLLo0YWSg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726479AbgIBQSG (ORCPT ); Wed, 2 Sep 2020 12:18:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:53840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727963AbgIBQKs (ORCPT ); Wed, 2 Sep 2020 12:10:48 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D59CD20773; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=TNOI/VLtApvB6yPQmCUZBBC5lN9M1DLUltQ/CvohjAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ulejFWlemy/ELe8wIxriEGQ+0t4Le5mwgc8X6SsTuH5DSfSTZx3GZS4LpUjSuPjE+ QsPQDUtQyPNDEl72XFYmGWVeEyv9GhUXQdZWYEbv5ic4bpyEgd8hUBGpw0wcViIbaW UiDvY4++Z2Qjmkk9O8RhG/BYzZmxqwbaN+5Gf4uA= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLP-000tA4-T2; Wed, 02 Sep 2020 18:10:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/38] media: vivid: place the logic which disables ioctl on a separate function Date: Wed, 2 Sep 2020 18:10:13 +0200 Message-Id: <04bdd5013c20f0a623039d0bb65eb722bfd7f497.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Move this code out of the long vivid_create_instance() function. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/test-drivers/vivid/vivid-core.c | 182 +++++++++--------- 1 file changed, 96 insertions(+), 86 deletions(-) diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c index d4785da440d9..f8cb4133e1ce 100644 --- a/drivers/media/test-drivers/vivid/vivid-core.c +++ b/drivers/media/test-drivers/vivid/vivid-core.c @@ -1001,6 +1001,100 @@ static int vivid_detect_feature_set(struct vivid_dev *dev, int inst, return 0; } +static void vivid_disable_unused_ioctls(struct vivid_dev *dev, + bool has_tuner, + bool has_modulator, + unsigned in_type_counter[4], + unsigned out_type_counter[4]) +{ + /* disable invalid ioctls based on the feature set */ + if (!dev->has_audio_inputs) { + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_AUDIO); + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_AUDIO); + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_ENUMAUDIO); + v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_S_AUDIO); + v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_G_AUDIO); + v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_ENUMAUDIO); + v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_S_AUDIO); + v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_G_AUDIO); + v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_ENUMAUDIO); + } + if (!dev->has_audio_outputs) { + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_AUDOUT); + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_AUDOUT); + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUMAUDOUT); + v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_S_AUDOUT); + v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_G_AUDOUT); + v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_ENUMAUDOUT); + v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_S_AUDOUT); + v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_G_AUDOUT); + v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_ENUMAUDOUT); + } + if (!in_type_counter[TV] && !in_type_counter[SVID]) { + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_STD); + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_STD); + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_ENUMSTD); + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_QUERYSTD); + } + if (!out_type_counter[SVID]) { + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_STD); + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_STD); + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUMSTD); + } + if (!has_tuner && !has_modulator) { + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_FREQUENCY); + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_FREQUENCY); + v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_S_FREQUENCY); + v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_G_FREQUENCY); + v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_S_FREQUENCY); + v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_G_FREQUENCY); + } + if (!has_tuner) { + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_TUNER); + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_TUNER); + v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_S_TUNER); + v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_G_TUNER); + v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_S_TUNER); + v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_G_TUNER); + } + if (in_type_counter[HDMI] == 0) { + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_EDID); + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_EDID); + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_DV_TIMINGS_CAP); + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_DV_TIMINGS); + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_DV_TIMINGS); + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_ENUM_DV_TIMINGS); + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_QUERY_DV_TIMINGS); + } + if (out_type_counter[HDMI] == 0) { + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_EDID); + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_DV_TIMINGS_CAP); + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_DV_TIMINGS); + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_DV_TIMINGS); + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUM_DV_TIMINGS); + } + if (!dev->has_fb) { + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_FBUF); + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_FBUF); + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_OVERLAY); + } + v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_HW_FREQ_SEEK); + v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_S_HW_FREQ_SEEK); + v4l2_disable_ioctl(&dev->sdr_cap_dev, VIDIOC_S_HW_FREQ_SEEK); + v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_S_HW_FREQ_SEEK); + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_FREQUENCY); + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_FREQUENCY); + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUM_FRAMESIZES); + v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUM_FRAMEINTERVALS); + v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_S_FREQUENCY); + v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_G_FREQUENCY); + v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_S_FREQUENCY); + v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_G_FREQUENCY); + v4l2_disable_ioctl(&dev->touch_cap_dev, VIDIOC_S_PARM); + v4l2_disable_ioctl(&dev->touch_cap_dev, VIDIOC_ENUM_FRAMESIZES); + v4l2_disable_ioctl(&dev->touch_cap_dev, VIDIOC_ENUM_FRAMEINTERVALS); +} + static int vivid_create_instance(struct platform_device *pdev, int inst) { static const struct v4l2_dv_timings def_dv_timings = @@ -1189,92 +1283,8 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) (u32)bt->pixelclock / (htot * vtot)); } - /* disable invalid ioctls based on the feature set */ - if (!dev->has_audio_inputs) { - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_AUDIO); - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_AUDIO); - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_ENUMAUDIO); - v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_S_AUDIO); - v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_G_AUDIO); - v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_ENUMAUDIO); - v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_S_AUDIO); - v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_G_AUDIO); - v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_ENUMAUDIO); - } - if (!dev->has_audio_outputs) { - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_AUDOUT); - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_AUDOUT); - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUMAUDOUT); - v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_S_AUDOUT); - v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_G_AUDOUT); - v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_ENUMAUDOUT); - v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_S_AUDOUT); - v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_G_AUDOUT); - v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_ENUMAUDOUT); - } - if (!in_type_counter[TV] && !in_type_counter[SVID]) { - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_STD); - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_STD); - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_ENUMSTD); - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_QUERYSTD); - } - if (!out_type_counter[SVID]) { - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_STD); - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_STD); - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUMSTD); - } - if (!has_tuner && !has_modulator) { - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_FREQUENCY); - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_FREQUENCY); - v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_S_FREQUENCY); - v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_G_FREQUENCY); - v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_S_FREQUENCY); - v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_G_FREQUENCY); - } - if (!has_tuner) { - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_TUNER); - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_TUNER); - v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_S_TUNER); - v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_G_TUNER); - v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_S_TUNER); - v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_G_TUNER); - } - if (in_type_counter[HDMI] == 0) { - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_EDID); - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_EDID); - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_DV_TIMINGS_CAP); - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_G_DV_TIMINGS); - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_DV_TIMINGS); - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_ENUM_DV_TIMINGS); - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_QUERY_DV_TIMINGS); - } - if (out_type_counter[HDMI] == 0) { - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_EDID); - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_DV_TIMINGS_CAP); - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_DV_TIMINGS); - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_DV_TIMINGS); - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUM_DV_TIMINGS); - } - if (!dev->has_fb) { - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_FBUF); - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_FBUF); - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_OVERLAY); - } - v4l2_disable_ioctl(&dev->vid_cap_dev, VIDIOC_S_HW_FREQ_SEEK); - v4l2_disable_ioctl(&dev->vbi_cap_dev, VIDIOC_S_HW_FREQ_SEEK); - v4l2_disable_ioctl(&dev->sdr_cap_dev, VIDIOC_S_HW_FREQ_SEEK); - v4l2_disable_ioctl(&dev->meta_cap_dev, VIDIOC_S_HW_FREQ_SEEK); - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_S_FREQUENCY); - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_G_FREQUENCY); - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUM_FRAMESIZES); - v4l2_disable_ioctl(&dev->vid_out_dev, VIDIOC_ENUM_FRAMEINTERVALS); - v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_S_FREQUENCY); - v4l2_disable_ioctl(&dev->vbi_out_dev, VIDIOC_G_FREQUENCY); - v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_S_FREQUENCY); - v4l2_disable_ioctl(&dev->meta_out_dev, VIDIOC_G_FREQUENCY); - v4l2_disable_ioctl(&dev->touch_cap_dev, VIDIOC_S_PARM); - v4l2_disable_ioctl(&dev->touch_cap_dev, VIDIOC_ENUM_FRAMESIZES); - v4l2_disable_ioctl(&dev->touch_cap_dev, VIDIOC_ENUM_FRAMEINTERVALS); + vivid_disable_unused_ioctls(dev, has_tuner, has_modulator, + in_type_counter, out_type_counter); /* configure internal data */ dev->fmt_cap = &vivid_formats[0]; From patchwork Wed Sep 2 16:10:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751235 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD9B014E3 for ; Wed, 2 Sep 2020 16:18:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F1AE20639 for ; Wed, 2 Sep 2020 16:18:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063523; bh=mAfBaiRJRkp25BV0rN9ichUjyzowk2QtFfeZRpXBqio=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=ZkvNCcJQtVUF2o4x8YgBdHrWVOF8bYeuPXNM41KruIlIvnDYL4abd5NJSlJdJ/Qi4 fC1qWBqlEFvedKVIVVJvKRh29ZUwaBlsSI+hrMJ0jvfgz0bFUL4q8D5+7h/aKKPMnH P0nhLXysqfKREiZCtbhmrPzByd7iG+ssozLBpjH8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728904AbgIBQSn (ORCPT ); Wed, 2 Sep 2020 12:18:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:53496 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726293AbgIBQKr (ORCPT ); Wed, 2 Sep 2020 12:10:47 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D5AAF207EA; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=mAfBaiRJRkp25BV0rN9ichUjyzowk2QtFfeZRpXBqio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YrSjrgBqjLvEimNjiscWYcFi/Z9/Adwx0IFgc2usu33c7Pup8nyXZmXKAtw5NML4T Li0vbFaztxpJNQ1Dlti/ZM2IuMf8bs3pQv2HJVEt8APXbCegWINupstRUEiZMdEKnv DO0pCwH8Xi9IJn++lnqNg0RiPUoZ+Gs8qBl9N0tI= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLP-000tA7-U8; Wed, 02 Sep 2020 18:10:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/38] media: vivid: move set_capabilities logic to a separate function Date: Wed, 2 Sep 2020 18:10:14 +0200 Message-Id: <38814ad757c215a94c964c85b67b99fb327ad7f4.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Move such logic from vivid_create_instance(), as otherwise smatch takes forever. The vivid_create_instance() is still a too big for my taste. So, further cleanups are still needed. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/test-drivers/vivid/vivid-core.c | 161 +++++++++--------- 1 file changed, 83 insertions(+), 78 deletions(-) diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c index f8cb4133e1ce..e3ffc2566623 100644 --- a/drivers/media/test-drivers/vivid/vivid-core.c +++ b/drivers/media/test-drivers/vivid/vivid-core.c @@ -1001,6 +1001,88 @@ static int vivid_detect_feature_set(struct vivid_dev *dev, int inst, return 0; } +static void vivid_set_capabilities(struct vivid_dev *dev) +{ + if (dev->has_vid_cap) { + /* set up the capabilities of the video capture device */ + dev->vid_cap_caps = dev->multiplanar ? + V4L2_CAP_VIDEO_CAPTURE_MPLANE : + V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OVERLAY; + dev->vid_cap_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; + if (dev->has_audio_inputs) + dev->vid_cap_caps |= V4L2_CAP_AUDIO; + if (dev->has_tv_tuner) + dev->vid_cap_caps |= V4L2_CAP_TUNER; + } + if (dev->has_vid_out) { + /* set up the capabilities of the video output device */ + dev->vid_out_caps = dev->multiplanar ? + V4L2_CAP_VIDEO_OUTPUT_MPLANE : + V4L2_CAP_VIDEO_OUTPUT; + if (dev->has_fb) + dev->vid_out_caps |= V4L2_CAP_VIDEO_OUTPUT_OVERLAY; + dev->vid_out_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; + if (dev->has_audio_outputs) + dev->vid_out_caps |= V4L2_CAP_AUDIO; + } + if (dev->has_vbi_cap) { + /* set up the capabilities of the vbi capture device */ + dev->vbi_cap_caps = (dev->has_raw_vbi_cap ? V4L2_CAP_VBI_CAPTURE : 0) | + (dev->has_sliced_vbi_cap ? V4L2_CAP_SLICED_VBI_CAPTURE : 0); + dev->vbi_cap_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; + if (dev->has_audio_inputs) + dev->vbi_cap_caps |= V4L2_CAP_AUDIO; + if (dev->has_tv_tuner) + dev->vbi_cap_caps |= V4L2_CAP_TUNER; + } + if (dev->has_vbi_out) { + /* set up the capabilities of the vbi output device */ + dev->vbi_out_caps = (dev->has_raw_vbi_out ? V4L2_CAP_VBI_OUTPUT : 0) | + (dev->has_sliced_vbi_out ? V4L2_CAP_SLICED_VBI_OUTPUT : 0); + dev->vbi_out_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; + if (dev->has_audio_outputs) + dev->vbi_out_caps |= V4L2_CAP_AUDIO; + } + if (dev->has_sdr_cap) { + /* set up the capabilities of the sdr capture device */ + dev->sdr_cap_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_TUNER; + dev->sdr_cap_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; + } + /* set up the capabilities of the radio receiver device */ + if (dev->has_radio_rx) + dev->radio_rx_caps = V4L2_CAP_RADIO | V4L2_CAP_RDS_CAPTURE | + V4L2_CAP_HW_FREQ_SEEK | V4L2_CAP_TUNER | + V4L2_CAP_READWRITE; + /* set up the capabilities of the radio transmitter device */ + if (dev->has_radio_tx) + dev->radio_tx_caps = V4L2_CAP_RDS_OUTPUT | V4L2_CAP_MODULATOR | + V4L2_CAP_READWRITE; + + /* set up the capabilities of meta capture device */ + if (dev->has_meta_cap) { + dev->meta_cap_caps = V4L2_CAP_META_CAPTURE | + V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; + if (dev->has_audio_inputs) + dev->meta_cap_caps |= V4L2_CAP_AUDIO; + if (dev->has_tv_tuner) + dev->meta_cap_caps |= V4L2_CAP_TUNER; + } + /* set up the capabilities of meta output device */ + if (dev->has_meta_out) { + dev->meta_out_caps = V4L2_CAP_META_OUTPUT | + V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; + if (dev->has_audio_outputs) + dev->meta_out_caps |= V4L2_CAP_AUDIO; + } + /* set up the capabilities of the touch capture device */ + if (dev->has_touch_cap) { + dev->touch_cap_caps = V4L2_CAP_TOUCH | V4L2_CAP_STREAMING | + V4L2_CAP_READWRITE; + dev->touch_cap_caps |= dev->multiplanar ? + V4L2_CAP_VIDEO_CAPTURE_MPLANE : V4L2_CAP_VIDEO_CAPTURE; + } +} + static void vivid_disable_unused_ioctls(struct vivid_dev *dev, bool has_tuner, bool has_modulator, @@ -1153,84 +1235,7 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) return ret; } - if (dev->has_vid_cap) { - /* set up the capabilities of the video capture device */ - dev->vid_cap_caps = dev->multiplanar ? - V4L2_CAP_VIDEO_CAPTURE_MPLANE : - V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OVERLAY; - dev->vid_cap_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; - if (dev->has_audio_inputs) - dev->vid_cap_caps |= V4L2_CAP_AUDIO; - if (dev->has_tv_tuner) - dev->vid_cap_caps |= V4L2_CAP_TUNER; - } - if (dev->has_vid_out) { - /* set up the capabilities of the video output device */ - dev->vid_out_caps = dev->multiplanar ? - V4L2_CAP_VIDEO_OUTPUT_MPLANE : - V4L2_CAP_VIDEO_OUTPUT; - if (dev->has_fb) - dev->vid_out_caps |= V4L2_CAP_VIDEO_OUTPUT_OVERLAY; - dev->vid_out_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; - if (dev->has_audio_outputs) - dev->vid_out_caps |= V4L2_CAP_AUDIO; - } - if (dev->has_vbi_cap) { - /* set up the capabilities of the vbi capture device */ - dev->vbi_cap_caps = (dev->has_raw_vbi_cap ? V4L2_CAP_VBI_CAPTURE : 0) | - (dev->has_sliced_vbi_cap ? V4L2_CAP_SLICED_VBI_CAPTURE : 0); - dev->vbi_cap_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; - if (dev->has_audio_inputs) - dev->vbi_cap_caps |= V4L2_CAP_AUDIO; - if (dev->has_tv_tuner) - dev->vbi_cap_caps |= V4L2_CAP_TUNER; - } - if (dev->has_vbi_out) { - /* set up the capabilities of the vbi output device */ - dev->vbi_out_caps = (dev->has_raw_vbi_out ? V4L2_CAP_VBI_OUTPUT : 0) | - (dev->has_sliced_vbi_out ? V4L2_CAP_SLICED_VBI_OUTPUT : 0); - dev->vbi_out_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; - if (dev->has_audio_outputs) - dev->vbi_out_caps |= V4L2_CAP_AUDIO; - } - if (dev->has_sdr_cap) { - /* set up the capabilities of the sdr capture device */ - dev->sdr_cap_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_TUNER; - dev->sdr_cap_caps |= V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; - } - /* set up the capabilities of the radio receiver device */ - if (dev->has_radio_rx) - dev->radio_rx_caps = V4L2_CAP_RADIO | V4L2_CAP_RDS_CAPTURE | - V4L2_CAP_HW_FREQ_SEEK | V4L2_CAP_TUNER | - V4L2_CAP_READWRITE; - /* set up the capabilities of the radio transmitter device */ - if (dev->has_radio_tx) - dev->radio_tx_caps = V4L2_CAP_RDS_OUTPUT | V4L2_CAP_MODULATOR | - V4L2_CAP_READWRITE; - - /* set up the capabilities of meta capture device */ - if (dev->has_meta_cap) { - dev->meta_cap_caps = V4L2_CAP_META_CAPTURE | - V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; - if (dev->has_audio_inputs) - dev->meta_cap_caps |= V4L2_CAP_AUDIO; - if (dev->has_tv_tuner) - dev->meta_cap_caps |= V4L2_CAP_TUNER; - } - /* set up the capabilities of meta output device */ - if (dev->has_meta_out) { - dev->meta_out_caps = V4L2_CAP_META_OUTPUT | - V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; - if (dev->has_audio_outputs) - dev->meta_out_caps |= V4L2_CAP_AUDIO; - } - /* set up the capabilities of the touch capture device */ - if (dev->has_touch_cap) { - dev->touch_cap_caps = V4L2_CAP_TOUCH | V4L2_CAP_STREAMING | - V4L2_CAP_READWRITE; - dev->touch_cap_caps |= dev->multiplanar ? - V4L2_CAP_VIDEO_CAPTURE_MPLANE : V4L2_CAP_VIDEO_CAPTURE; - } + vivid_set_capabilities(dev); ret = -ENOMEM; /* initialize the test pattern generator */ From patchwork Wed Sep 2 16:10:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751149 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C49DF14E3 for ; Wed, 2 Sep 2020 16:11:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC8BC207EA for ; Wed, 2 Sep 2020 16:11:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063061; bh=0QtwpM2+k4SGeByY3Ftq2AvC2KycTDYtoRM0Sll0Zyo=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=SwvlZ5AhWbrMEKvLUsDS4rFYElElwA7PRID9rwsGegbUgGiaeR1o0A2rLSBvML16+ ndHdtw6kANN1zqrOGb1/TIX4plvgj7FgO2Vc7o5jzp/lrOwaY0czx/MLK24+VanWSR n/sL9E41gH8sFw/tafI+/GP3TXSZ11w4LR74ZtdQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728344AbgIBQK5 (ORCPT ); Wed, 2 Sep 2020 12:10:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:53932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728264AbgIBQKw (ORCPT ); Wed, 2 Sep 2020 12:10:52 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E6EAA21534; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=0QtwpM2+k4SGeByY3Ftq2AvC2KycTDYtoRM0Sll0Zyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O1UuCkxMnSHGR3+e2CxTm1Bscn95rjUO2I/9ujqY8rlD4cy8QWC73JtWyRo8b+V38 3vzz9lSPfHDk17cPuPCv7lHJPqy3kFlXOmXNfeFSp0xYEYrV4OxYzPy6N5tpTgGM7a xidpW4EfMziDy0I08qcUd2U6eYtBX/wz/2Pku9p0= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLP-000tAB-V6; Wed, 02 Sep 2020 18:10:43 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 12/38] media: vivid: place dt timings init code on a separate function Date: Wed, 2 Sep 2020 18:10:15 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Move those out of the big vivid_create_instance() function. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/test-drivers/vivid/vivid-core.c | 76 +++++++++++-------- 1 file changed, 44 insertions(+), 32 deletions(-) diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c index e3ffc2566623..3340b61e68c0 100644 --- a/drivers/media/test-drivers/vivid/vivid-core.c +++ b/drivers/media/test-drivers/vivid/vivid-core.c @@ -1177,6 +1177,48 @@ static void vivid_disable_unused_ioctls(struct vivid_dev *dev, v4l2_disable_ioctl(&dev->touch_cap_dev, VIDIOC_ENUM_FRAMEINTERVALS); } +static int vivid_init_dv_timings(struct vivid_dev *dev) +{ + int i; + + while (v4l2_dv_timings_presets[dev->query_dv_timings_size].bt.width) + dev->query_dv_timings_size++; + + /* + * Create a char pointer array that points to the names of all the + * preset timings + */ + dev->query_dv_timings_qmenu = kmalloc_array(dev->query_dv_timings_size, + sizeof(char *), GFP_KERNEL); + /* + * Create a string array containing the names of all the preset + * timings. Each name is max 31 chars long (+ terminating 0). + */ + dev->query_dv_timings_qmenu_strings = + kmalloc_array(dev->query_dv_timings_size, 32, GFP_KERNEL); + + if (!dev->query_dv_timings_qmenu || + !dev->query_dv_timings_qmenu_strings) + return -ENOMEM; + + for (i = 0; i < dev->query_dv_timings_size; i++) { + const struct v4l2_bt_timings *bt = &v4l2_dv_timings_presets[i].bt; + char *p = dev->query_dv_timings_qmenu_strings + i * 32; + u32 htot, vtot; + + dev->query_dv_timings_qmenu[i] = p; + + htot = V4L2_DV_BT_FRAME_WIDTH(bt); + vtot = V4L2_DV_BT_FRAME_HEIGHT(bt); + snprintf(p, 32, "%ux%u%s%u", + bt->width, bt->height, bt->interlaced ? "i" : "p", + (u32)bt->pixelclock / (htot * vtot)); + } + + return 0; +} + + static int vivid_create_instance(struct platform_device *pdev, int inst) { static const struct v4l2_dv_timings def_dv_timings = @@ -1254,40 +1296,10 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) if (!dev->edid) goto free_dev; - while (v4l2_dv_timings_presets[dev->query_dv_timings_size].bt.width) - dev->query_dv_timings_size++; - - /* - * Create a char pointer array that points to the names of all the - * preset timings - */ - dev->query_dv_timings_qmenu = kmalloc_array(dev->query_dv_timings_size, - sizeof(char *), GFP_KERNEL); - /* - * Create a string array containing the names of all the preset - * timings. Each name is max 31 chars long (+ terminating 0). - */ - dev->query_dv_timings_qmenu_strings = - kmalloc_array(dev->query_dv_timings_size, 32, GFP_KERNEL); - - if (!dev->query_dv_timings_qmenu || - !dev->query_dv_timings_qmenu_strings) + ret = vivid_init_dv_timings(dev); + if (ret < 0) goto free_dev; - for (i = 0; i < dev->query_dv_timings_size; i++) { - const struct v4l2_bt_timings *bt = &v4l2_dv_timings_presets[i].bt; - char *p = dev->query_dv_timings_qmenu_strings + i * 32; - u32 htot, vtot; - - dev->query_dv_timings_qmenu[i] = p; - - htot = V4L2_DV_BT_FRAME_WIDTH(bt); - vtot = V4L2_DV_BT_FRAME_HEIGHT(bt); - snprintf(p, 32, "%ux%u%s%u", - bt->width, bt->height, bt->interlaced ? "i" : "p", - (u32)bt->pixelclock / (htot * vtot)); - } - vivid_disable_unused_ioctls(dev, has_tuner, has_modulator, in_type_counter, out_type_counter); From patchwork Wed Sep 2 16:10:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751239 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7DCFB14E3 for ; Wed, 2 Sep 2020 16:19:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 65A3A20829 for ; Wed, 2 Sep 2020 16:19:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063549; bh=20rwtaupDb1aKHEooDzQl/rU/dgCpdJe5nG7WDKkIQo=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=bxe6ucK4+eNowxrP2A9Svl6exMG3mxuqY7530dkPhX42UpXiiNYBzjf5rE3Oua5lE fvoozFWBgppo19P3L1B77nCjcFhpShaiIGeOd5ZvPcwWcm/owrWG/hDfUZGUO8Q/pb MK6AVgkkLuCeBwApcfiQ7vMUqaS9nxfg7mO3xGfY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728708AbgIBQSm (ORCPT ); Wed, 2 Sep 2020 12:18:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:53510 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727944AbgIBQKr (ORCPT ); Wed, 2 Sep 2020 12:10:47 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D8B2C20BED; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=20rwtaupDb1aKHEooDzQl/rU/dgCpdJe5nG7WDKkIQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C7Ydg7tr6cIAabckT8QZ+dQywwCWAHNr54q6yEDZ0ogV5DvrWeCuEL/fTKSPZNE7l dvQddlUG516QXmMdSznl9IbkJAB9a+D3AlMk8bpcJ+Lkg0qYDNg6YNbbZd3UpOJgxz FdqXwEsrpFrojPjmeXXodDfrFizyaFHu8ZeuD084= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLP-000tAD-Vy; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 13/38] media: vivid: move the create queues to a separate function Date: Wed, 2 Sep 2020 18:10:16 +0200 Message-Id: <42219ecf5014d677d6fb65ae70086b7ae3b36931.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Instead of placing everything inside vivid_create_instance(), we can move the part which creates per-type video queues into a separate function. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/test-drivers/vivid/vivid-core.c | 175 +++++++++--------- 1 file changed, 92 insertions(+), 83 deletions(-) diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c index 3340b61e68c0..69cc8456a323 100644 --- a/drivers/media/test-drivers/vivid/vivid-core.c +++ b/drivers/media/test-drivers/vivid/vivid-core.c @@ -1218,6 +1218,93 @@ static int vivid_init_dv_timings(struct vivid_dev *dev) return 0; } +static int vivid_create_queues(struct vivid_dev *dev) +{ + int ret; + + /* start creating the vb2 queues */ + if (dev->has_vid_cap) { + /* initialize vid_cap queue */ + ret = vivid_create_queue(dev, &dev->vb_vid_cap_q, + V4L2_BUF_TYPE_VIDEO_CAPTURE, 2, + &vivid_vid_cap_qops); + if (ret) + return ret; + } + + if (dev->has_vid_out) { + /* initialize vid_out queue */ + ret = vivid_create_queue(dev, &dev->vb_vid_out_q, + V4L2_BUF_TYPE_VIDEO_OUTPUT, 2, + &vivid_vid_out_qops); + if (ret) + return ret; + } + + if (dev->has_vbi_cap) { + /* initialize vbi_cap queue */ + ret = vivid_create_queue(dev, &dev->vb_vbi_cap_q, + V4L2_BUF_TYPE_VBI_CAPTURE, 2, + &vivid_vbi_cap_qops); + if (ret) + return ret; + } + + if (dev->has_vbi_out) { + /* initialize vbi_out queue */ + ret = vivid_create_queue(dev, &dev->vb_vbi_out_q, + V4L2_BUF_TYPE_VBI_OUTPUT, 2, + &vivid_vbi_out_qops); + if (ret) + return ret; + } + + if (dev->has_sdr_cap) { + /* initialize sdr_cap queue */ + ret = vivid_create_queue(dev, &dev->vb_sdr_cap_q, + V4L2_BUF_TYPE_SDR_CAPTURE, 8, + &vivid_sdr_cap_qops); + if (ret) + return ret; + } + + if (dev->has_meta_cap) { + /* initialize meta_cap queue */ + ret = vivid_create_queue(dev, &dev->vb_meta_cap_q, + V4L2_BUF_TYPE_META_CAPTURE, 2, + &vivid_meta_cap_qops); + if (ret) + return ret; + } + + if (dev->has_meta_out) { + /* initialize meta_out queue */ + ret = vivid_create_queue(dev, &dev->vb_meta_out_q, + V4L2_BUF_TYPE_META_OUTPUT, 1, + &vivid_meta_out_qops); + if (ret) + return ret; + } + + if (dev->has_touch_cap) { + /* initialize touch_cap queue */ + ret = vivid_create_queue(dev, &dev->vb_touch_cap_q, + V4L2_BUF_TYPE_VIDEO_CAPTURE, 1, + &vivid_touch_cap_qops); + if (ret) + return ret; + } + + if (dev->has_fb) { + /* Create framebuffer for testing capture/output overlay */ + ret = vivid_fb_init(dev); + if (ret) + return ret; + v4l2_info(&dev->v4l2_dev, "Framebuffer device registered as fb%d\n", + dev->fb_info.node); + } + return 0; +} static int vivid_create_instance(struct platform_device *pdev, int inst) { @@ -1399,8 +1486,8 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) * Same as create_singlethread_workqueue, but now I can use the * string formatting of alloc_ordered_workqueue. */ - dev->cec_workqueue = - alloc_ordered_workqueue("vivid-%03d-cec", WQ_MEM_RECLAIM, inst); + dev->cec_workqueue = alloc_ordered_workqueue("vivid-%03d-cec", + WQ_MEM_RECLAIM, inst); if (!dev->cec_workqueue) { ret = -ENOMEM; goto unreg_dev; @@ -1409,87 +1496,9 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) if (allocators[inst] == 1) dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); - /* start creating the vb2 queues */ - if (dev->has_vid_cap) { - /* initialize vid_cap queue */ - ret = vivid_create_queue(dev, &dev->vb_vid_cap_q, - V4L2_BUF_TYPE_VIDEO_CAPTURE, 2, - &vivid_vid_cap_qops); - if (ret) - goto unreg_dev; - } - - if (dev->has_vid_out) { - /* initialize vid_out queue */ - ret = vivid_create_queue(dev, &dev->vb_vid_out_q, - V4L2_BUF_TYPE_VIDEO_OUTPUT, 2, - &vivid_vid_out_qops); - if (ret) - goto unreg_dev; - } - - if (dev->has_vbi_cap) { - /* initialize vbi_cap queue */ - ret = vivid_create_queue(dev, &dev->vb_vbi_cap_q, - V4L2_BUF_TYPE_VBI_CAPTURE, 2, - &vivid_vbi_cap_qops); - if (ret) - goto unreg_dev; - } - - if (dev->has_vbi_out) { - /* initialize vbi_out queue */ - ret = vivid_create_queue(dev, &dev->vb_vbi_out_q, - V4L2_BUF_TYPE_VBI_OUTPUT, 2, - &vivid_vbi_out_qops); - if (ret) - goto unreg_dev; - } - - if (dev->has_sdr_cap) { - /* initialize sdr_cap queue */ - ret = vivid_create_queue(dev, &dev->vb_sdr_cap_q, - V4L2_BUF_TYPE_SDR_CAPTURE, 8, - &vivid_sdr_cap_qops); - if (ret) - goto unreg_dev; - } - - if (dev->has_meta_cap) { - /* initialize meta_cap queue */ - ret = vivid_create_queue(dev, &dev->vb_meta_cap_q, - V4L2_BUF_TYPE_META_CAPTURE, 2, - &vivid_meta_cap_qops); - if (ret) - goto unreg_dev; - } - - if (dev->has_meta_out) { - /* initialize meta_out queue */ - ret = vivid_create_queue(dev, &dev->vb_meta_out_q, - V4L2_BUF_TYPE_META_OUTPUT, 1, - &vivid_meta_out_qops); - if (ret) - goto unreg_dev; - } - - if (dev->has_touch_cap) { - /* initialize touch_cap queue */ - ret = vivid_create_queue(dev, &dev->vb_touch_cap_q, - V4L2_BUF_TYPE_VIDEO_CAPTURE, 1, - &vivid_touch_cap_qops); - if (ret) - goto unreg_dev; - } - - if (dev->has_fb) { - /* Create framebuffer for testing capture/output overlay */ - ret = vivid_fb_init(dev); - if (ret) - goto unreg_dev; - v4l2_info(&dev->v4l2_dev, "Framebuffer device registered as fb%d\n", - dev->fb_info.node); - } + ret = vivid_create_queues(dev); + if (ret) + goto unreg_dev; #ifdef CONFIG_VIDEO_VIVID_CEC if (dev->has_vid_cap && in_type_counter[HDMI]) { From patchwork Wed Sep 2 16:10:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751195 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 46A79109B for ; Wed, 2 Sep 2020 16:15:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1DA24208C7 for ; Wed, 2 Sep 2020 16:15:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063351; bh=KwVlb9jXQVsTVDCwEJ3VRaXpsjBUKtkFKKDHPsqYn9A=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=h8gjBK8DgDx4dJw4DvF1vhIqgVXn2WpRER2bgCT+PpwaYQvQRvWy3mdLIcrYfHaeW sjNDw+29conJhKOCqQBslRhoXwwJ1ambZ0YqUeHjQ5KQ2R9shx3e9kvH6tAu7UTdHX DGuLFMpH3yF6tNipb8ws5u8lidJeSaTUWiG6p+7U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728730AbgIBQNv (ORCPT ); Wed, 2 Sep 2020 12:13:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:53894 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728303AbgIBQK5 (ORCPT ); Wed, 2 Sep 2020 12:10:57 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D97D520C56; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=KwVlb9jXQVsTVDCwEJ3VRaXpsjBUKtkFKKDHPsqYn9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xc6+jjJ2YLvdP1dZKe9voVuwNa3SZMEK+MYtdrM0i1d811hrTGS8hqZkPL7Gck0vR dMA69pT/bT6/laJG7498EgOgPYiG4nRkgvItEkNRtgd42y1wZRKn6YdM9GUWuSyWK7 6TgCyQ7rvjxqATyI8R3hLhX2+GZjL8dwryUUjIQA= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tAH-0b; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 14/38] media: vivid: move the devnode creation logic to a separate function Date: Wed, 2 Sep 2020 18:10:17 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org In order to reduce even further the size of the big vivid_create_instance() function, let's place the part of the logic which creates the device nodes into a separate function. With this and the past patches, those warnings finally vanishes: drivers/media/test-drivers/vivid/vivid-core.c: drivers/media/test-drivers/vivid/vivid-core.c:1189 vivid_create_instance() parse error: turning off implications after 60 seconds drivers/media/test-drivers/vivid/vivid-core.c: drivers/media/test-drivers/vivid/vivid-core.c:1257 vivid_create_instance() parse error: __split_smt: function too hairy. Giving up after 303 seconds The init code also seems more organized after breaking the long function into a smaller set. Signed-off-by: Mauro Carvalho Chehab Reported-by: kernel test robot Reported-by: kernel test robot --- drivers/media/test-drivers/vivid/vivid-core.c | 670 +++++++++--------- 1 file changed, 344 insertions(+), 326 deletions(-) diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c index 69cc8456a323..54df7e0c13fc 100644 --- a/drivers/media/test-drivers/vivid/vivid-core.c +++ b/drivers/media/test-drivers/vivid/vivid-core.c @@ -1306,6 +1306,346 @@ static int vivid_create_queues(struct vivid_dev *dev) return 0; } +static int vivid_create_devnodes(struct platform_device *pdev, + struct vivid_dev *dev, int inst, + unsigned int cec_tx_bus_cnt, + v4l2_std_id tvnorms_cap, + v4l2_std_id tvnorms_out, + unsigned in_type_counter[4], + unsigned out_type_counter[4]) +{ + struct video_device *vfd; + int ret, i; + + if (dev->has_vid_cap) { + vfd = &dev->vid_cap_dev; + snprintf(vfd->name, sizeof(vfd->name), + "vivid-%03d-vid-cap", inst); + vfd->fops = &vivid_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->vid_cap_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->queue = &dev->vb_vid_cap_q; + vfd->tvnorms = tvnorms_cap; + + /* + * Provide a mutex to v4l2 core. It will be used to protect + * all fops and v4l2 ioctls. + */ + vfd->lock = &dev->mutex; + video_set_drvdata(vfd, dev); + +#ifdef CONFIG_MEDIA_CONTROLLER + dev->vid_cap_pad.flags = MEDIA_PAD_FL_SINK; + ret = media_entity_pads_init(&vfd->entity, 1, &dev->vid_cap_pad); + if (ret) + return ret; +#endif + +#ifdef CONFIG_VIDEO_VIVID_CEC + if (in_type_counter[HDMI]) { + ret = cec_register_adapter(dev->cec_rx_adap, &pdev->dev); + if (ret < 0) { + cec_delete_adapter(dev->cec_rx_adap); + dev->cec_rx_adap = NULL; + return ret; + } + cec_s_phys_addr(dev->cec_rx_adap, 0, false); + v4l2_info(&dev->v4l2_dev, "CEC adapter %s registered for HDMI input 0\n", + dev_name(&dev->cec_rx_adap->devnode.dev)); + } +#endif + + ret = video_register_device(vfd, VFL_TYPE_VIDEO, vid_cap_nr[inst]); + if (ret < 0) + return ret; + v4l2_info(&dev->v4l2_dev, "V4L2 capture device registered as %s\n", + video_device_node_name(vfd)); + } + + if (dev->has_vid_out) { + vfd = &dev->vid_out_dev; + snprintf(vfd->name, sizeof(vfd->name), + "vivid-%03d-vid-out", inst); + vfd->vfl_dir = VFL_DIR_TX; + vfd->fops = &vivid_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->vid_out_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->queue = &dev->vb_vid_out_q; + vfd->tvnorms = tvnorms_out; + + /* + * Provide a mutex to v4l2 core. It will be used to protect + * all fops and v4l2 ioctls. + */ + vfd->lock = &dev->mutex; + video_set_drvdata(vfd, dev); + +#ifdef CONFIG_MEDIA_CONTROLLER + dev->vid_out_pad.flags = MEDIA_PAD_FL_SOURCE; + ret = media_entity_pads_init(&vfd->entity, 1, &dev->vid_out_pad); + if (ret) + return ret; +#endif + +#ifdef CONFIG_VIDEO_VIVID_CEC + for (i = 0; i < cec_tx_bus_cnt; i++) { + ret = cec_register_adapter(dev->cec_tx_adap[i], &pdev->dev); + if (ret < 0) { + for (; i < cec_tx_bus_cnt; i++) { + cec_delete_adapter(dev->cec_tx_adap[i]); + dev->cec_tx_adap[i] = NULL; + } + return ret; + } + v4l2_info(&dev->v4l2_dev, "CEC adapter %s registered for HDMI output %d\n", + dev_name(&dev->cec_tx_adap[i]->devnode.dev), i); + if (i < out_type_counter[HDMI]) + cec_s_phys_addr(dev->cec_tx_adap[i], (i + 1) << 12, false); + else + cec_s_phys_addr(dev->cec_tx_adap[i], 0x1000, false); + } +#endif + + ret = video_register_device(vfd, VFL_TYPE_VIDEO, vid_out_nr[inst]); + if (ret < 0) + return ret; + v4l2_info(&dev->v4l2_dev, "V4L2 output device registered as %s\n", + video_device_node_name(vfd)); + } + + if (dev->has_vbi_cap) { + vfd = &dev->vbi_cap_dev; + snprintf(vfd->name, sizeof(vfd->name), + "vivid-%03d-vbi-cap", inst); + vfd->fops = &vivid_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->vbi_cap_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->queue = &dev->vb_vbi_cap_q; + vfd->lock = &dev->mutex; + vfd->tvnorms = tvnorms_cap; + video_set_drvdata(vfd, dev); + +#ifdef CONFIG_MEDIA_CONTROLLER + dev->vbi_cap_pad.flags = MEDIA_PAD_FL_SINK; + ret = media_entity_pads_init(&vfd->entity, 1, &dev->vbi_cap_pad); + if (ret) + return ret; +#endif + + ret = video_register_device(vfd, VFL_TYPE_VBI, vbi_cap_nr[inst]); + if (ret < 0) + return ret; + v4l2_info(&dev->v4l2_dev, "V4L2 capture device registered as %s, supports %s VBI\n", + video_device_node_name(vfd), + (dev->has_raw_vbi_cap && dev->has_sliced_vbi_cap) ? + "raw and sliced" : + (dev->has_raw_vbi_cap ? "raw" : "sliced")); + } + + if (dev->has_vbi_out) { + vfd = &dev->vbi_out_dev; + snprintf(vfd->name, sizeof(vfd->name), + "vivid-%03d-vbi-out", inst); + vfd->vfl_dir = VFL_DIR_TX; + vfd->fops = &vivid_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->vbi_out_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->queue = &dev->vb_vbi_out_q; + vfd->lock = &dev->mutex; + vfd->tvnorms = tvnorms_out; + video_set_drvdata(vfd, dev); + +#ifdef CONFIG_MEDIA_CONTROLLER + dev->vbi_out_pad.flags = MEDIA_PAD_FL_SOURCE; + ret = media_entity_pads_init(&vfd->entity, 1, &dev->vbi_out_pad); + if (ret) + return ret; +#endif + + ret = video_register_device(vfd, VFL_TYPE_VBI, vbi_out_nr[inst]); + if (ret < 0) + return ret; + v4l2_info(&dev->v4l2_dev, "V4L2 output device registered as %s, supports %s VBI\n", + video_device_node_name(vfd), + (dev->has_raw_vbi_out && dev->has_sliced_vbi_out) ? + "raw and sliced" : + (dev->has_raw_vbi_out ? "raw" : "sliced")); + } + + if (dev->has_sdr_cap) { + vfd = &dev->sdr_cap_dev; + snprintf(vfd->name, sizeof(vfd->name), + "vivid-%03d-sdr-cap", inst); + vfd->fops = &vivid_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->sdr_cap_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->queue = &dev->vb_sdr_cap_q; + vfd->lock = &dev->mutex; + video_set_drvdata(vfd, dev); + +#ifdef CONFIG_MEDIA_CONTROLLER + dev->sdr_cap_pad.flags = MEDIA_PAD_FL_SINK; + ret = media_entity_pads_init(&vfd->entity, 1, &dev->sdr_cap_pad); + if (ret) + return ret; +#endif + + ret = video_register_device(vfd, VFL_TYPE_SDR, sdr_cap_nr[inst]); + if (ret < 0) + return ret; + v4l2_info(&dev->v4l2_dev, "V4L2 capture device registered as %s\n", + video_device_node_name(vfd)); + } + + if (dev->has_radio_rx) { + vfd = &dev->radio_rx_dev; + snprintf(vfd->name, sizeof(vfd->name), + "vivid-%03d-rad-rx", inst); + vfd->fops = &vivid_radio_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->radio_rx_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->lock = &dev->mutex; + video_set_drvdata(vfd, dev); + + ret = video_register_device(vfd, VFL_TYPE_RADIO, radio_rx_nr[inst]); + if (ret < 0) + return ret; + v4l2_info(&dev->v4l2_dev, "V4L2 receiver device registered as %s\n", + video_device_node_name(vfd)); + } + + if (dev->has_radio_tx) { + vfd = &dev->radio_tx_dev; + snprintf(vfd->name, sizeof(vfd->name), + "vivid-%03d-rad-tx", inst); + vfd->vfl_dir = VFL_DIR_TX; + vfd->fops = &vivid_radio_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->radio_tx_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->lock = &dev->mutex; + video_set_drvdata(vfd, dev); + + ret = video_register_device(vfd, VFL_TYPE_RADIO, radio_tx_nr[inst]); + if (ret < 0) + return ret; + v4l2_info(&dev->v4l2_dev, "V4L2 transmitter device registered as %s\n", + video_device_node_name(vfd)); + } + + if (dev->has_meta_cap) { + vfd = &dev->meta_cap_dev; + snprintf(vfd->name, sizeof(vfd->name), + "vivid-%03d-meta-cap", inst); + vfd->fops = &vivid_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->meta_cap_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->queue = &dev->vb_meta_cap_q; + vfd->lock = &dev->mutex; + vfd->tvnorms = tvnorms_cap; + video_set_drvdata(vfd, dev); +#ifdef CONFIG_MEDIA_CONTROLLER + dev->meta_cap_pad.flags = MEDIA_PAD_FL_SINK; + ret = media_entity_pads_init(&vfd->entity, 1, + &dev->meta_cap_pad); + if (ret) + return ret; +#endif + ret = video_register_device(vfd, VFL_TYPE_VIDEO, + meta_cap_nr[inst]); + if (ret < 0) + return ret; + v4l2_info(&dev->v4l2_dev, + "V4L2 metadata capture device registered as %s\n", + video_device_node_name(vfd)); + } + + if (dev->has_meta_out) { + vfd = &dev->meta_out_dev; + snprintf(vfd->name, sizeof(vfd->name), + "vivid-%03d-meta-out", inst); + vfd->vfl_dir = VFL_DIR_TX; + vfd->fops = &vivid_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->meta_out_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->queue = &dev->vb_meta_out_q; + vfd->lock = &dev->mutex; + vfd->tvnorms = tvnorms_out; + video_set_drvdata(vfd, dev); +#ifdef CONFIG_MEDIA_CONTROLLER + dev->meta_out_pad.flags = MEDIA_PAD_FL_SOURCE; + ret = media_entity_pads_init(&vfd->entity, 1, + &dev->meta_out_pad); + if (ret) + return ret; +#endif + ret = video_register_device(vfd, VFL_TYPE_VIDEO, + meta_out_nr[inst]); + if (ret < 0) + return ret; + v4l2_info(&dev->v4l2_dev, + "V4L2 metadata output device registered as %s\n", + video_device_node_name(vfd)); + } + + if (dev->has_touch_cap) { + vfd = &dev->touch_cap_dev; + snprintf(vfd->name, sizeof(vfd->name), + "vivid-%03d-touch-cap", inst); + vfd->fops = &vivid_fops; + vfd->ioctl_ops = &vivid_ioctl_ops; + vfd->device_caps = dev->touch_cap_caps; + vfd->release = video_device_release_empty; + vfd->v4l2_dev = &dev->v4l2_dev; + vfd->queue = &dev->vb_touch_cap_q; + vfd->tvnorms = tvnorms_cap; + vfd->lock = &dev->mutex; + video_set_drvdata(vfd, dev); +#ifdef CONFIG_MEDIA_CONTROLLER + dev->touch_cap_pad.flags = MEDIA_PAD_FL_SINK; + ret = media_entity_pads_init(&vfd->entity, 1, + &dev->touch_cap_pad); + if (ret) + return ret; +#endif + ret = video_register_device(vfd, VFL_TYPE_TOUCH, + touch_cap_nr[inst]); + if (ret < 0) + return ret; + v4l2_info(&dev->v4l2_dev, + "V4L2 touch capture device registered as %s\n", + video_device_node_name(vfd)); + } + +#ifdef CONFIG_MEDIA_CONTROLLER + /* Register the media device */ + ret = media_device_register(&dev->mdev); + if (ret) { + dev_err(dev->mdev.dev, + "media device register failed (err=%d)\n", ret); + return ret; + } +#endif + return 0; +} + static int vivid_create_instance(struct platform_device *pdev, int inst) { static const struct v4l2_dv_timings def_dv_timings = @@ -1317,7 +1657,6 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) bool has_tuner; bool has_modulator; struct vivid_dev *dev; - struct video_device *vfd; unsigned node_type = node_types[inst]; v4l2_std_id tvnorms_cap = 0, tvnorms_out = 0; int ret; @@ -1545,332 +1884,11 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) v4l2_ctrl_handler_setup(&dev->ctrl_hdl_touch_cap); /* finally start creating the device nodes */ - if (dev->has_vid_cap) { - vfd = &dev->vid_cap_dev; - snprintf(vfd->name, sizeof(vfd->name), - "vivid-%03d-vid-cap", inst); - vfd->fops = &vivid_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->vid_cap_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->queue = &dev->vb_vid_cap_q; - vfd->tvnorms = tvnorms_cap; - - /* - * Provide a mutex to v4l2 core. It will be used to protect - * all fops and v4l2 ioctls. - */ - vfd->lock = &dev->mutex; - video_set_drvdata(vfd, dev); - -#ifdef CONFIG_MEDIA_CONTROLLER - dev->vid_cap_pad.flags = MEDIA_PAD_FL_SINK; - ret = media_entity_pads_init(&vfd->entity, 1, &dev->vid_cap_pad); - if (ret) - goto unreg_dev; -#endif - -#ifdef CONFIG_VIDEO_VIVID_CEC - if (in_type_counter[HDMI]) { - ret = cec_register_adapter(dev->cec_rx_adap, &pdev->dev); - if (ret < 0) { - cec_delete_adapter(dev->cec_rx_adap); - dev->cec_rx_adap = NULL; - goto unreg_dev; - } - cec_s_phys_addr(dev->cec_rx_adap, 0, false); - v4l2_info(&dev->v4l2_dev, "CEC adapter %s registered for HDMI input 0\n", - dev_name(&dev->cec_rx_adap->devnode.dev)); - } -#endif - - ret = video_register_device(vfd, VFL_TYPE_VIDEO, vid_cap_nr[inst]); - if (ret < 0) - goto unreg_dev; - v4l2_info(&dev->v4l2_dev, "V4L2 capture device registered as %s\n", - video_device_node_name(vfd)); - } - - if (dev->has_vid_out) { - vfd = &dev->vid_out_dev; - snprintf(vfd->name, sizeof(vfd->name), - "vivid-%03d-vid-out", inst); - vfd->vfl_dir = VFL_DIR_TX; - vfd->fops = &vivid_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->vid_out_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->queue = &dev->vb_vid_out_q; - vfd->tvnorms = tvnorms_out; - - /* - * Provide a mutex to v4l2 core. It will be used to protect - * all fops and v4l2 ioctls. - */ - vfd->lock = &dev->mutex; - video_set_drvdata(vfd, dev); - -#ifdef CONFIG_MEDIA_CONTROLLER - dev->vid_out_pad.flags = MEDIA_PAD_FL_SOURCE; - ret = media_entity_pads_init(&vfd->entity, 1, &dev->vid_out_pad); - if (ret) - goto unreg_dev; -#endif - -#ifdef CONFIG_VIDEO_VIVID_CEC - for (i = 0; i < cec_tx_bus_cnt; i++) { - ret = cec_register_adapter(dev->cec_tx_adap[i], &pdev->dev); - if (ret < 0) { - for (; i < cec_tx_bus_cnt; i++) { - cec_delete_adapter(dev->cec_tx_adap[i]); - dev->cec_tx_adap[i] = NULL; - } - goto unreg_dev; - } - v4l2_info(&dev->v4l2_dev, "CEC adapter %s registered for HDMI output %d\n", - dev_name(&dev->cec_tx_adap[i]->devnode.dev), i); - if (i < out_type_counter[HDMI]) - cec_s_phys_addr(dev->cec_tx_adap[i], (i + 1) << 12, false); - else - cec_s_phys_addr(dev->cec_tx_adap[i], 0x1000, false); - } -#endif - - ret = video_register_device(vfd, VFL_TYPE_VIDEO, vid_out_nr[inst]); - if (ret < 0) - goto unreg_dev; - v4l2_info(&dev->v4l2_dev, "V4L2 output device registered as %s\n", - video_device_node_name(vfd)); - } - - if (dev->has_vbi_cap) { - vfd = &dev->vbi_cap_dev; - snprintf(vfd->name, sizeof(vfd->name), - "vivid-%03d-vbi-cap", inst); - vfd->fops = &vivid_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->vbi_cap_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->queue = &dev->vb_vbi_cap_q; - vfd->lock = &dev->mutex; - vfd->tvnorms = tvnorms_cap; - video_set_drvdata(vfd, dev); - -#ifdef CONFIG_MEDIA_CONTROLLER - dev->vbi_cap_pad.flags = MEDIA_PAD_FL_SINK; - ret = media_entity_pads_init(&vfd->entity, 1, &dev->vbi_cap_pad); - if (ret) - goto unreg_dev; -#endif - - ret = video_register_device(vfd, VFL_TYPE_VBI, vbi_cap_nr[inst]); - if (ret < 0) - goto unreg_dev; - v4l2_info(&dev->v4l2_dev, "V4L2 capture device registered as %s, supports %s VBI\n", - video_device_node_name(vfd), - (dev->has_raw_vbi_cap && dev->has_sliced_vbi_cap) ? - "raw and sliced" : - (dev->has_raw_vbi_cap ? "raw" : "sliced")); - } - - if (dev->has_vbi_out) { - vfd = &dev->vbi_out_dev; - snprintf(vfd->name, sizeof(vfd->name), - "vivid-%03d-vbi-out", inst); - vfd->vfl_dir = VFL_DIR_TX; - vfd->fops = &vivid_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->vbi_out_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->queue = &dev->vb_vbi_out_q; - vfd->lock = &dev->mutex; - vfd->tvnorms = tvnorms_out; - video_set_drvdata(vfd, dev); - -#ifdef CONFIG_MEDIA_CONTROLLER - dev->vbi_out_pad.flags = MEDIA_PAD_FL_SOURCE; - ret = media_entity_pads_init(&vfd->entity, 1, &dev->vbi_out_pad); - if (ret) - goto unreg_dev; -#endif - - ret = video_register_device(vfd, VFL_TYPE_VBI, vbi_out_nr[inst]); - if (ret < 0) - goto unreg_dev; - v4l2_info(&dev->v4l2_dev, "V4L2 output device registered as %s, supports %s VBI\n", - video_device_node_name(vfd), - (dev->has_raw_vbi_out && dev->has_sliced_vbi_out) ? - "raw and sliced" : - (dev->has_raw_vbi_out ? "raw" : "sliced")); - } - - if (dev->has_sdr_cap) { - vfd = &dev->sdr_cap_dev; - snprintf(vfd->name, sizeof(vfd->name), - "vivid-%03d-sdr-cap", inst); - vfd->fops = &vivid_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->sdr_cap_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->queue = &dev->vb_sdr_cap_q; - vfd->lock = &dev->mutex; - video_set_drvdata(vfd, dev); - -#ifdef CONFIG_MEDIA_CONTROLLER - dev->sdr_cap_pad.flags = MEDIA_PAD_FL_SINK; - ret = media_entity_pads_init(&vfd->entity, 1, &dev->sdr_cap_pad); - if (ret) - goto unreg_dev; -#endif - - ret = video_register_device(vfd, VFL_TYPE_SDR, sdr_cap_nr[inst]); - if (ret < 0) - goto unreg_dev; - v4l2_info(&dev->v4l2_dev, "V4L2 capture device registered as %s\n", - video_device_node_name(vfd)); - } - - if (dev->has_radio_rx) { - vfd = &dev->radio_rx_dev; - snprintf(vfd->name, sizeof(vfd->name), - "vivid-%03d-rad-rx", inst); - vfd->fops = &vivid_radio_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->radio_rx_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->lock = &dev->mutex; - video_set_drvdata(vfd, dev); - - ret = video_register_device(vfd, VFL_TYPE_RADIO, radio_rx_nr[inst]); - if (ret < 0) - goto unreg_dev; - v4l2_info(&dev->v4l2_dev, "V4L2 receiver device registered as %s\n", - video_device_node_name(vfd)); - } - - if (dev->has_radio_tx) { - vfd = &dev->radio_tx_dev; - snprintf(vfd->name, sizeof(vfd->name), - "vivid-%03d-rad-tx", inst); - vfd->vfl_dir = VFL_DIR_TX; - vfd->fops = &vivid_radio_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->radio_tx_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->lock = &dev->mutex; - video_set_drvdata(vfd, dev); - - ret = video_register_device(vfd, VFL_TYPE_RADIO, radio_tx_nr[inst]); - if (ret < 0) - goto unreg_dev; - v4l2_info(&dev->v4l2_dev, "V4L2 transmitter device registered as %s\n", - video_device_node_name(vfd)); - } - - if (dev->has_meta_cap) { - vfd = &dev->meta_cap_dev; - snprintf(vfd->name, sizeof(vfd->name), - "vivid-%03d-meta-cap", inst); - vfd->fops = &vivid_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->meta_cap_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->queue = &dev->vb_meta_cap_q; - vfd->lock = &dev->mutex; - vfd->tvnorms = tvnorms_cap; - video_set_drvdata(vfd, dev); -#ifdef CONFIG_MEDIA_CONTROLLER - dev->meta_cap_pad.flags = MEDIA_PAD_FL_SINK; - ret = media_entity_pads_init(&vfd->entity, 1, - &dev->meta_cap_pad); - if (ret) - goto unreg_dev; -#endif - ret = video_register_device(vfd, VFL_TYPE_VIDEO, - meta_cap_nr[inst]); - if (ret < 0) - goto unreg_dev; - v4l2_info(&dev->v4l2_dev, - "V4L2 metadata capture device registered as %s\n", - video_device_node_name(vfd)); - } - - if (dev->has_meta_out) { - vfd = &dev->meta_out_dev; - snprintf(vfd->name, sizeof(vfd->name), - "vivid-%03d-meta-out", inst); - vfd->vfl_dir = VFL_DIR_TX; - vfd->fops = &vivid_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->meta_out_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->queue = &dev->vb_meta_out_q; - vfd->lock = &dev->mutex; - vfd->tvnorms = tvnorms_out; - video_set_drvdata(vfd, dev); -#ifdef CONFIG_MEDIA_CONTROLLER - dev->meta_out_pad.flags = MEDIA_PAD_FL_SOURCE; - ret = media_entity_pads_init(&vfd->entity, 1, - &dev->meta_out_pad); - if (ret) - goto unreg_dev; -#endif - ret = video_register_device(vfd, VFL_TYPE_VIDEO, - meta_out_nr[inst]); - if (ret < 0) - goto unreg_dev; - v4l2_info(&dev->v4l2_dev, - "V4L2 metadata output device registered as %s\n", - video_device_node_name(vfd)); - } - - if (dev->has_touch_cap) { - vfd = &dev->touch_cap_dev; - snprintf(vfd->name, sizeof(vfd->name), - "vivid-%03d-touch-cap", inst); - vfd->fops = &vivid_fops; - vfd->ioctl_ops = &vivid_ioctl_ops; - vfd->device_caps = dev->touch_cap_caps; - vfd->release = video_device_release_empty; - vfd->v4l2_dev = &dev->v4l2_dev; - vfd->queue = &dev->vb_touch_cap_q; - vfd->tvnorms = tvnorms_cap; - vfd->lock = &dev->mutex; - video_set_drvdata(vfd, dev); -#ifdef CONFIG_MEDIA_CONTROLLER - dev->touch_cap_pad.flags = MEDIA_PAD_FL_SINK; - ret = media_entity_pads_init(&vfd->entity, 1, - &dev->touch_cap_pad); - if (ret) - goto unreg_dev; -#endif - ret = video_register_device(vfd, VFL_TYPE_TOUCH, - touch_cap_nr[inst]); - if (ret < 0) - goto unreg_dev; - v4l2_info(&dev->v4l2_dev, - "V4L2 touch capture device registered as %s\n", - video_device_node_name(vfd)); - } - -#ifdef CONFIG_MEDIA_CONTROLLER - /* Register the media device */ - ret = media_device_register(&dev->mdev); - if (ret) { - dev_err(dev->mdev.dev, - "media device register failed (err=%d)\n", ret); + ret = vivid_create_devnodes(pdev, dev, inst, cec_tx_bus_cnt, + tvnorms_cap, tvnorms_out, + in_type_counter, out_type_counter); + if (ret) goto unreg_dev; - } -#endif /* Now that everything is fine, let's add it to device list */ vivid_devs[inst] = dev; From patchwork Wed Sep 2 16:10:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751219 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3FFCA14E3 for ; Wed, 2 Sep 2020 16:17:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1961120829 for ; Wed, 2 Sep 2020 16:17:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063452; bh=+2RR6roDnn65j3iO36CYLbDLclz+0rrWulMZeG9XTOk=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=ktWlwE79OBWqu7GTC3+Yx+F2QeuRGVklAFgNZ2PH1GqAVcwCiBxU0ZHsjn8VYs5D/ WErE7oZ0Yp8SQ79QmDSrnsOtFgaJWoS2Dgdx76e922x1KN24vBULLjwoSQ/jzeY5vv HLvDHJYN3FZPXiWOyqU5cS/30XMdIHT2sCuEg7Io= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728724AbgIBQRa (ORCPT ); Wed, 2 Sep 2020 12:17:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:53922 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728152AbgIBQKv (ORCPT ); Wed, 2 Sep 2020 12:10:51 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E355221527; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=+2RR6roDnn65j3iO36CYLbDLclz+0rrWulMZeG9XTOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y4CnJRus8XbEmh08o5k7WLby+AoyTlP/estB+zYDEA8ccRF3QXheYEh094E8DV+oD bhyXKWq1gnCqgoieLbaTEjMlSLl1StG435UgWv8JT1y1mDhyYMRvJY0nGXouLtiEH7 HGxkbVHeoqZR6rVHIdjZ6uzjJmqTYNiqoCkXUTKE= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tAL-1s; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 15/38] media: vivid: fix error path Date: Wed, 2 Sep 2020 18:10:18 +0200 Message-Id: <276afb2977c68e7d9e8d8d90237abff8ed2cd21c.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org If something fails after calling v4l2_device_register(), it should call v4l2_device_put(). Signed-off-by: Mauro Carvalho Chehab --- drivers/media/test-drivers/vivid/vivid-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c index 54df7e0c13fc..48809991f037 100644 --- a/drivers/media/test-drivers/vivid/vivid-core.c +++ b/drivers/media/test-drivers/vivid/vivid-core.c @@ -1698,10 +1698,8 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) &has_tuner, &has_modulator, &ccs_cap, &ccs_out, in_type_counter, out_type_counter); - if (ret) { - kfree(dev); - return ret; - } + if (ret) + goto free_dev; vivid_set_capabilities(dev); From patchwork Wed Sep 2 16:10:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751215 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A0F914E3 for ; Wed, 2 Sep 2020 16:17:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF28B20639 for ; Wed, 2 Sep 2020 16:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063445; bh=zeOoW6dBDPMUDQNPabBvfdWG+dRh4/f7I9v8bSFs3WU=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=XHV1J7ZvHS/D1jr3eHejX8SZ2SK6z9B70guoereAx1n3yHBo70UhesyZz8Bfk0SbB MAiudzfZW9/JjL6OFLtxVJJGeRr2rKuUp0X10w76GELs5rhvR1klf/8tBDUKHJSdDN YkqELb58GGBVtAf2L5ai7TFaLPlEGr/rXvj61ngk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728348AbgIBQQ7 (ORCPT ); Wed, 2 Sep 2020 12:16:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:53872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728266AbgIBQK4 (ORCPT ); Wed, 2 Sep 2020 12:10:56 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ECCF621556; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=zeOoW6dBDPMUDQNPabBvfdWG+dRh4/f7I9v8bSFs3WU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bUdyaiYuY4fZeMpztbPCKFVt02npNMo5lxJyYxiEKUaImzANWtGLusfTdrnT4hEI7 No5KX2tAIiSX13BpwOpL4RafsKwyMsqn2lJBcOemc7RnQjAjHWiqaloew7JP8kepMV iw7tXQglb/M6ZOc0gKp2B2rT6X3PC/bSr5V6eWIc= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tAN-2d; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Andrew Morton , John Hubbard , Hans Verkuil , Michel Lespinasse , Mike Rapoport , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 16/38] media: videobuf-dma-sg: number of pages should be unsigned long Date: Wed, 2 Sep 2020 18:10:19 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As reported by smatch: drivers/media/v4l2-core/videobuf-dma-sg.c:245 videobuf_dma_init_kernel() warn: should 'nr_pages << 12' be a 64 bit type? The printk should not be using %d for the number of pages. After looking better, the real problem here is that the number of pages should be long int. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/videobuf-dma-sg.c | 22 ++++++++++++---------- include/media/videobuf-dma-sg.h | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c b/drivers/media/v4l2-core/videobuf-dma-sg.c index 46ff19df9f53..8dd0562de287 100644 --- a/drivers/media/v4l2-core/videobuf-dma-sg.c +++ b/drivers/media/v4l2-core/videobuf-dma-sg.c @@ -180,7 +180,7 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma, if (rw == READ) flags |= FOLL_WRITE; - dprintk(1, "init user [0x%lx+0x%lx => %d pages]\n", + dprintk(1, "init user [0x%lx+0x%lx => %lu pages]\n", data, size, dma->nr_pages); err = pin_user_pages(data & PAGE_MASK, dma->nr_pages, @@ -188,7 +188,7 @@ static int videobuf_dma_init_user_locked(struct videobuf_dmabuf *dma, if (err != dma->nr_pages) { dma->nr_pages = (err >= 0) ? err : 0; - dprintk(1, "pin_user_pages: err=%d [%d]\n", err, + dprintk(1, "pin_user_pages: err=%d [%lu]\n", err, dma->nr_pages); return err < 0 ? err : -EINVAL; } @@ -208,11 +208,11 @@ static int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction, } static int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, - int nr_pages) + unsigned long nr_pages) { int i; - dprintk(1, "init kernel [%d pages]\n", nr_pages); + dprintk(1, "init kernel [%lu pages]\n", nr_pages); dma->direction = direction; dma->vaddr_pages = kcalloc(nr_pages, sizeof(*dma->vaddr_pages), @@ -238,11 +238,11 @@ static int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, dma->vaddr = vmap(dma->vaddr_pages, nr_pages, VM_MAP | VM_IOREMAP, PAGE_KERNEL); if (NULL == dma->vaddr) { - dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages); + dprintk(1, "vmalloc_32(%lu pages) failed\n", nr_pages); goto out_free_pages; } - dprintk(1, "vmalloc is at addr %p, size=%d\n", + dprintk(1, "vmalloc is at addr %p, size=%lu\n", dma->vaddr, nr_pages << PAGE_SHIFT); memset(dma->vaddr, 0, nr_pages << PAGE_SHIFT); @@ -267,9 +267,9 @@ static int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, } static int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, - dma_addr_t addr, int nr_pages) + dma_addr_t addr, unsigned long nr_pages) { - dprintk(1, "init overlay [%d pages @ bus 0x%lx]\n", + dprintk(1, "init overlay [%lu pages @ bus 0x%lx]\n", nr_pages, (unsigned long)addr); dma->direction = direction; @@ -500,9 +500,11 @@ static int __videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb, struct v4l2_framebuffer *fbuf) { - int err, pages; - dma_addr_t bus; struct videobuf_dma_sg_memory *mem = vb->priv; + unsigned long pages; + dma_addr_t bus; + int err; + BUG_ON(!mem); MAGIC_CHECK(mem->magic, MAGIC_SG_MEM); diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h index 34450f7ad510..930ff8d454fc 100644 --- a/include/media/videobuf-dma-sg.h +++ b/include/media/videobuf-dma-sg.h @@ -60,7 +60,7 @@ struct videobuf_dmabuf { /* common */ struct scatterlist *sglist; int sglen; - int nr_pages; + unsigned long nr_pages; int direction; }; From patchwork Wed Sep 2 16:10:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751203 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 916AD14E3 for ; Wed, 2 Sep 2020 16:16:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B23F20829 for ; Wed, 2 Sep 2020 16:16:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063361; bh=VKstAS5TMtenxpJXpzEKD/xHPc8x0PyHzvTyd/dAajI=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=2qYxqDkCXOkgX0v1IeDKlhOAj8Z6cW3XpLCWyQ1aqiM4xLXRiBU0uVZQHtrKQumEr MQ/URDtpxCvJuJ7l6RDURIhUx+cT2qhMy+PAWa929TOiLUTOcLbIMzHQ39W7MLaY4K PQwVGfyX+H2ISp/bIFWVgPwHyS4VGCStK2n4+JFI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728822AbgIBQP7 (ORCPT ); Wed, 2 Sep 2020 12:15:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:54036 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728273AbgIBQK4 (ORCPT ); Wed, 2 Sep 2020 12:10:56 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EA50D21548; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=VKstAS5TMtenxpJXpzEKD/xHPc8x0PyHzvTyd/dAajI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KIJmLcONeHMe8ISzWaqErJcYQgpqR/EhQJg7T5LzEYOYAyoidk+2Mz4zRsx5chtpd 9FJIkrhioeF9jtNXDrcpjVrCRiUOlfomOSToSTUYIrWhPHedtk9caZTMF2SB+K8I11 xIWW513/t8pNLafhXRHf4YfGhZ7y6N4zs1Q0TAnc= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tAR-3Z; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Hans Verkuil , Takashi Iwai , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 17/38] media: cx25821-alsa: number of pages should be unsigned long Date: Wed, 2 Sep 2020 18:10:20 +0200 Message-Id: <1294201cb66aad5c7646d662e3699aadeeaa215b.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As reported by smatch: drivers/media/pci/cx25821/cx25821-alsa.c:146 cx25821_alsa_dma_init() warn: should 'nr_pages << 12' be a 64 bit type? the number of patches should be unsigned long. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx25821/cx25821-alsa.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/media/pci/cx25821/cx25821-alsa.c b/drivers/media/pci/cx25821/cx25821-alsa.c index 301616426d8a..49892a88f528 100644 --- a/drivers/media/pci/cx25821/cx25821-alsa.c +++ b/drivers/media/pci/cx25821/cx25821-alsa.c @@ -53,8 +53,8 @@ struct cx25821_audio_buffer { struct cx25821_riscmem risc; void *vaddr; struct scatterlist *sglist; - int sglen; - int nr_pages; + int sglen; + unsigned long nr_pages; }; struct cx25821_audio_dev { @@ -131,7 +131,8 @@ MODULE_PARM_DESC(debug, "enable debug messages"); #define PCI_MSK_AUD_EXT (1 << 4) #define PCI_MSK_AUD_INT (1 << 3) -static int cx25821_alsa_dma_init(struct cx25821_audio_dev *chip, int nr_pages) +static int cx25821_alsa_dma_init(struct cx25821_audio_dev *chip, + unsigned long nr_pages) { struct cx25821_audio_buffer *buf = chip->buf; struct page *pg; @@ -139,11 +140,11 @@ static int cx25821_alsa_dma_init(struct cx25821_audio_dev *chip, int nr_pages) buf->vaddr = vmalloc_32(nr_pages << PAGE_SHIFT); if (NULL == buf->vaddr) { - dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages); + dprintk(1, "vmalloc_32(%lu pages) failed\n", nr_pages); return -ENOMEM; } - dprintk(1, "vmalloc is at addr 0x%p, size=%d\n", + dprintk(1, "vmalloc is at addr 0x%p, size=%lu\n", buf->vaddr, nr_pages << PAGE_SHIFT); From patchwork Wed Sep 2 16:10:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751209 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A29BE14E3 for ; Wed, 2 Sep 2020 16:16:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A9E620829 for ; Wed, 2 Sep 2020 16:16:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063414; bh=TyB5qk7Sh1O8/duNBsCmd6m1J0cmxULTBPs5i10qCv4=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=VRHjlUHLqnG967Wc2jiTQfK1eZz0SViRDzIXDxFtDl9gtBE3SZdIM7QvcqiIV9q/G NHq8BnKEkOzZhVjE/Beld1GQPnPsTO348m9kLX/UYRVx6LTiFPr41L2QTYg7wTNahe Ix6jZhZjxMWbUG7MjISiwYRd3oHI/iGRckzlb0hs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728811AbgIBQP4 (ORCPT ); Wed, 2 Sep 2020 12:15:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:53930 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728283AbgIBQK4 (ORCPT ); Wed, 2 Sep 2020 12:10:56 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F2CCB2158C; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=TyB5qk7Sh1O8/duNBsCmd6m1J0cmxULTBPs5i10qCv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X8hl2OM2sVEtfrkk2thA9m4OvAG754Js57hqXJuQYYiDQRMEp/L5O536GhFLyEuAG wyCt/12joTSh/IBm7vFAom7koT/laCTuUl3snPaaqWVoVZCBGdQA8wcSDbIcQK1I+V kQzB5Vm/BZvEO9kbiyYfPjkeH2rPum7INZiNN498= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tAU-4J; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Takashi Iwai , Hans Verkuil , Forest Crossman , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 18/38] media: cx23885-alsa: number of pages should be unsigned long Date: Wed, 2 Sep 2020 18:10:21 +0200 Message-Id: <1ca468a8b0b6b0e6a1843a9eed04568902833b68.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As reported by smatch: drivers/media//pci/cx23885/cx23885-alsa.c:83 cx23885_alsa_dma_init() warn: should 'nr_pages << 12' be a 64 bit type? the number of patches should be unsigned long. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx23885/cx23885-alsa.c | 7 ++++--- drivers/media/pci/cx23885/cx23885.h | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/media/pci/cx23885/cx23885-alsa.c b/drivers/media/pci/cx23885/cx23885-alsa.c index df44ed7393a0..141852f02236 100644 --- a/drivers/media/pci/cx23885/cx23885-alsa.c +++ b/drivers/media/pci/cx23885/cx23885-alsa.c @@ -68,7 +68,8 @@ MODULE_PARM_DESC(audio_debug, "enable debug messages [analog audio]"); #define AUD_INT_MCHG_IRQ (1 << 21) #define GP_COUNT_CONTROL_RESET 0x3 -static int cx23885_alsa_dma_init(struct cx23885_audio_dev *chip, int nr_pages) +static int cx23885_alsa_dma_init(struct cx23885_audio_dev *chip, + unsigned long nr_pages) { struct cx23885_audio_buffer *buf = chip->buf; struct page *pg; @@ -76,11 +77,11 @@ static int cx23885_alsa_dma_init(struct cx23885_audio_dev *chip, int nr_pages) buf->vaddr = vmalloc_32(nr_pages << PAGE_SHIFT); if (NULL == buf->vaddr) { - dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages); + dprintk(1, "vmalloc_32(%lu pages) failed\n", nr_pages); return -ENOMEM; } - dprintk(1, "vmalloc is at addr %p, size=%d\n", + dprintk(1, "vmalloc is at addr %p, size=%lu\n", buf->vaddr, nr_pages << PAGE_SHIFT); memset(buf->vaddr, 0, nr_pages << PAGE_SHIFT); diff --git a/drivers/media/pci/cx23885/cx23885.h b/drivers/media/pci/cx23885/cx23885.h index c472498e57c4..349462ee2c48 100644 --- a/drivers/media/pci/cx23885/cx23885.h +++ b/drivers/media/pci/cx23885/cx23885.h @@ -325,8 +325,8 @@ struct cx23885_audio_buffer { struct cx23885_riscmem risc; void *vaddr; struct scatterlist *sglist; - int sglen; - int nr_pages; + int sglen; + unsigned long nr_pages; }; struct cx23885_audio_dev { From patchwork Wed Sep 2 16:10:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751153 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C2A3014E3 for ; Wed, 2 Sep 2020 16:11:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F2DB2072A for ; Wed, 2 Sep 2020 16:11:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063073; bh=jLwPewIQn+pgFUopzBjLSNLeLllS2zvZWT+HqHEkCss=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=ZaVpfLwg3553np2yHODxxrLFHV20xg1bP6ott9LfXvVStoW6gflD3sGqZdta46jw7 +FY0PysBeWrPPuI1s812CERHI2tVMfMNj+A1jVzFo2A1fQs2/yHgKeYkQcqyyh8/PD nVMIr+4gmQmoOcLvtWIeYRb5fq/Fqcxd+G8c5IM4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728371AbgIBQLD (ORCPT ); Wed, 2 Sep 2020 12:11:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:53930 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728261AbgIBQKw (ORCPT ); Wed, 2 Sep 2020 12:10:52 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E524B21532; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=jLwPewIQn+pgFUopzBjLSNLeLllS2zvZWT+HqHEkCss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mfGsMbIFHQAtssLyUM73TwAZkAt+2AAhZnlAsVA0zni6U3JNgnIdJRkMEb6bziIrR oF6+7psEzCsO8jJDQG4mZM5t8RKmSqk380rORMbIeuv+TkiN0XD6Ew56MyX5C/EjSI aLle/FcBysGu2c9nmQCpppgffNzQqbkndQ+F0lDc= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tAW-57; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Takashi Iwai , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 19/38] media: cx88-alsa: number of pages should be unsigned long Date: Wed, 2 Sep 2020 18:10:22 +0200 Message-Id: <0f391afa1692b65fa61f795e192fcef43e1779ba.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As reported by smatch: drivers/media/pci/cx88/cx88-alsa.c:286 cx88_alsa_dma_init() warn: should 'nr_pages << 12' be a 64 bit type? the number of patches should be unsigned long. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx88/cx88-alsa.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/media/pci/cx88/cx88-alsa.c b/drivers/media/pci/cx88/cx88-alsa.c index 7d7aceecc985..aec60ebb010f 100644 --- a/drivers/media/pci/cx88/cx88-alsa.c +++ b/drivers/media/pci/cx88/cx88-alsa.c @@ -42,12 +42,12 @@ */ struct cx88_audio_buffer { - unsigned int bpl; - struct cx88_riscmem risc; + unsigned int bpl; + struct cx88_riscmem risc; void *vaddr; struct scatterlist *sglist; int sglen; - int nr_pages; + unsigned long nr_pages; }; struct cx88_audio_dev { @@ -271,7 +271,8 @@ static irqreturn_t cx8801_irq(int irq, void *dev_id) return IRQ_RETVAL(handled); } -static int cx88_alsa_dma_init(struct cx88_audio_dev *chip, int nr_pages) +static int cx88_alsa_dma_init(struct cx88_audio_dev *chip, + unsigned long nr_pages) { struct cx88_audio_buffer *buf = chip->buf; struct page *pg; @@ -279,11 +280,11 @@ static int cx88_alsa_dma_init(struct cx88_audio_dev *chip, int nr_pages) buf->vaddr = vmalloc_32(nr_pages << PAGE_SHIFT); if (!buf->vaddr) { - dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages); + dprintk(1, "vmalloc_32(%lu pages) failed\n", nr_pages); return -ENOMEM; } - dprintk(1, "vmalloc is at addr %p, size=%d\n", + dprintk(1, "vmalloc is at addr %p, size=%lu\n", buf->vaddr, nr_pages << PAGE_SHIFT); memset(buf->vaddr, 0, nr_pages << PAGE_SHIFT); From patchwork Wed Sep 2 16:10:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751201 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B567114E3 for ; Wed, 2 Sep 2020 16:16:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B0A520BED for ; Wed, 2 Sep 2020 16:16:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063360; bh=b420j7CBfw+D7BCOVF5+bODRBG1RaeqpINVSfggl6cE=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=EtzvQhxtBJSp4NdNpdwVfQkln1zEWC67vkX2wkSD5VmkOFBzi3ViivNQaV0b9tJwu KmdoLD5F8QFPQhM/9xPKzcDtjbg7r54drlBoGh5k3VAhoyqzPoZ4EDqr2ADT11lWkO 0Fc3I475ffVrO1xRTdwevPUPQgNv/ndFtSvBY3qM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728817AbgIBQP5 (ORCPT ); Wed, 2 Sep 2020 12:15:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:53920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728298AbgIBQK4 (ORCPT ); Wed, 2 Sep 2020 12:10:56 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 01CC121655; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=b420j7CBfw+D7BCOVF5+bODRBG1RaeqpINVSfggl6cE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KPXDst8O/wmDHu+mZOBICcXK6SsLeS4lRAFzqVEjNvhkxaSPDWpQK5psdnjLg83uC YLbpql3wJ8xPR3VGyuVWxIayNGl0w0PgSCzn/CrzkYHQVfaO/jjT4qjWo7DI+7nvo2 kzRYXviFdwBL/aozuC3oVeBV9lmVTvIwalEd33P0= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tAZ-5s; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Takashi Iwai , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 20/38] media: saa7134-alsa.c: number of pages should be unsigned long Date: Wed, 2 Sep 2020 18:10:23 +0200 Message-Id: <7e9ce5335675f4e81fd28e2e57451c58d2ebb5bb.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As reported by smatch: drivers/media/pci/saa7134/saa7134-alsa.c:267 saa7134_alsa_dma_init() warn: should 'nr_pages << 12' be a 64 bit type? the number of patches should be unsigned long. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/saa7134/saa7134-alsa.c | 7 ++++--- drivers/media/pci/saa7134/saa7134.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/media/pci/saa7134/saa7134-alsa.c b/drivers/media/pci/saa7134/saa7134-alsa.c index 544ca57eee75..347ecb0bab2f 100644 --- a/drivers/media/pci/saa7134/saa7134-alsa.c +++ b/drivers/media/pci/saa7134/saa7134-alsa.c @@ -252,7 +252,8 @@ static int snd_card_saa7134_capture_trigger(struct snd_pcm_substream * substream return err; } -static int saa7134_alsa_dma_init(struct saa7134_dev *dev, int nr_pages) +static int saa7134_alsa_dma_init(struct saa7134_dev *dev, + unsigned long nr_pages) { struct saa7134_dmasound *dma = &dev->dmasound; struct page *pg; @@ -260,11 +261,11 @@ static int saa7134_alsa_dma_init(struct saa7134_dev *dev, int nr_pages) dma->vaddr = vmalloc_32(nr_pages << PAGE_SHIFT); if (NULL == dma->vaddr) { - pr_debug("vmalloc_32(%d pages) failed\n", nr_pages); + pr_debug("vmalloc_32(%lu pages) failed\n", nr_pages); return -ENOMEM; } - pr_debug("vmalloc is at addr %p, size=%d\n", + pr_debug("vmalloc is at addr %p, size=%lu\n", dma->vaddr, nr_pages << PAGE_SHIFT); memset(dma->vaddr, 0, nr_pages << PAGE_SHIFT); diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h index 77c325e64a97..d29499cd7370 100644 --- a/drivers/media/pci/saa7134/saa7134.h +++ b/drivers/media/pci/saa7134/saa7134.h @@ -509,7 +509,7 @@ struct saa7134_dmasound { void *vaddr; struct scatterlist *sglist; int sglen; - int nr_pages; + unsigned long nr_pages; unsigned int dma_blk; unsigned int read_offset; unsigned int read_count; From patchwork Wed Sep 2 16:10:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751187 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B7C1814E3 for ; Wed, 2 Sep 2020 16:14:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 954F0207EA for ; Wed, 2 Sep 2020 16:14:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063296; bh=MAam3szAvyQjlLkEQdoK5/MrRc6oip9fFC54zFOdGNA=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=jUBh4+UrTOuPI6Pb8C7+g0vL//0xwYfWNN9KLMaBSbLLxdUaEhRVNhOiSQ1pPdN2C 7XqOJ7vv16HS0p2yTNxqc3f0SUm+LqJ8wf5m5gwx3iY25bECJOUSlHexkbUvJK4+o4 sDUMIsSnGW67Pe38lVEheltbemT5Qs6cd3clVce4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728746AbgIBQNx (ORCPT ); Wed, 2 Sep 2020 12:13:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:53932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728281AbgIBQK4 (ORCPT ); Wed, 2 Sep 2020 12:10:56 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F0E5A21582; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=MAam3szAvyQjlLkEQdoK5/MrRc6oip9fFC54zFOdGNA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sHvO+/fkSkVARvG1XOXU+M3HD+f0y6SgRHkfLSx8v73wfnmnM4zeK5oZt+2IM2zp0 pb/6gW5TtMHWB8xCLAXiU2lAHd1mgM7QgEXpgQbRCs0bIkkFNZjPjFtNGe1IjUffwl Hdol4IbSkXK99JphCsUwq29eW1SpWRYtlfVnYabQ= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tAd-6l; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 21/38] media: dvb-ttusb-budget: don't use stack for USB transfers Date: Wed, 2 Sep 2020 18:10:24 +0200 Message-Id: <214db6f0cc80506ac2ade13475e1f359ae1ff7b4.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As reported by smatch: drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:311 ttusb_boot_dsp() error: doing dma on the stack (b) drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:321 ttusb_boot_dsp() error: doing dma on the stack (b) drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:330 ttusb_boot_dsp() error: doing dma on the stack (b) drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:351 ttusb_set_channel() error: doing dma on the stack (b) drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:361 ttusb_del_channel() error: doing dma on the stack (b) drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:412 ttusb_init_controller() error: doing dma on the stack (b0) drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:416 ttusb_init_controller() error: doing dma on the stack (b1) drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:422 ttusb_init_controller() error: doing dma on the stack (b2) drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:425 ttusb_init_controller() error: doing dma on the stack (b3) drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c:430 ttusb_init_controller() error: doing dma on the stack (get_version) This driver still uses the USB stack for DMA transfers, which is broken for a long time. I almost dropped this driver, as there's a high chance that nobody is using it with upstream Kernels, as we didn't receive any bug reports. As fixing this won't be hard, I ended opting to fix. While here, I dropped an ugly hack that implemented read via a separate function that was just doing a memcpy(). It should be noticed that, during the init phase, there's a "b4" register that were never initialized, as its buffer were used just to store the results of "b3" initialization. Signed-off-by: Mauro Carvalho Chehab --- .../media/usb/ttusb-budget/dvb-ttusb-budget.c | 83 +++++++------------ 1 file changed, 30 insertions(+), 53 deletions(-) diff --git a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c index 4e56ff83566b..2582a62184fd 100644 --- a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c @@ -72,6 +72,9 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); #define TTUSB_REV_2_2 0x22 #define TTUSB_BUDGET_NAME "ttusb_stc_fw" +#define MAX_SEND 0x28 +#define MAX_RCV 0x20 + /* * since we're casting (struct ttusb*) <-> (struct dvb_demux*) around * the dvb_demux field must be the first in struct!! @@ -119,87 +122,72 @@ struct ttusb { int cc; /* MuxCounter - will increment on EVERY MUX PACKET */ /* (including stuffing. yes. really.) */ - u8 last_result[32]; + u8 send_buf[MAX_SEND]; + u8 last_result[MAX_RCV]; int revision; struct dvb_frontend* fe; }; -/* ugly workaround ... don't know why it's necessary to read */ -/* all result codes. */ - -static int ttusb_cmd(struct ttusb *ttusb, - const u8 * data, int len, int needresult) +static int ttusb_cmd(struct ttusb *ttusb, u8 *data, int len, int len_result) { int actual_len; int err; - int i; - - if (debug >= 3) { - printk(KERN_DEBUG ">"); - for (i = 0; i < len; ++i) - printk(KERN_CONT " %02x", data[i]); - printk(KERN_CONT "\n"); - } if (mutex_lock_interruptible(&ttusb->semusb) < 0) return -EAGAIN; + if (debug >= 3) + printk(KERN_DEBUG "> %*ph\n", len, data); + + memcpy(data, ttusb->send_buf, len); + err = usb_bulk_msg(ttusb->dev, ttusb->bulk_out_pipe, - (u8 *) data, len, &actual_len, 1000); + ttusb->send_buf, len, &actual_len, 1000); if (err != 0) { dprintk("%s: usb_bulk_msg(send) failed, err == %i!\n", __func__, err); - mutex_unlock(&ttusb->semusb); - return err; + goto err; } if (actual_len != len) { + err = -EIO; dprintk("%s: only wrote %d of %d bytes\n", __func__, actual_len, len); - mutex_unlock(&ttusb->semusb); - return -1; + goto err; } err = usb_bulk_msg(ttusb->dev, ttusb->bulk_in_pipe, - ttusb->last_result, 32, &actual_len, 1000); + ttusb->last_result, MAX_RCV, &actual_len, 1000); if (err != 0) { printk("%s: failed, receive error %d\n", __func__, err); - mutex_unlock(&ttusb->semusb); - return err; + goto err; } if (debug >= 3) { actual_len = ttusb->last_result[3] + 4; - printk(KERN_DEBUG "<"); - for (i = 0; i < actual_len; ++i) - printk(KERN_CONT " %02x", ttusb->last_result[i]); - printk(KERN_CONT "\n"); + printk(KERN_DEBUG "< %*ph\n", actual_len, ttusb->last_result); } - if (!needresult) - mutex_unlock(&ttusb->semusb); - return 0; -} + if (len_result) + memcpy(ttusb->send_buf, ttusb->last_result, len_result); -static int ttusb_result(struct ttusb *ttusb, u8 * data, int len) -{ - memcpy(data, ttusb->last_result, len); +err: mutex_unlock(&ttusb->semusb); - return 0; + return err; } static int ttusb_i2c_msg(struct ttusb *ttusb, u8 addr, u8 * snd_buf, u8 snd_len, u8 * rcv_buf, u8 rcv_len) { - u8 b[0x28]; + u8 b[MAX_SEND]; u8 id = ++ttusb->c; int i, err; - if (snd_len > 0x28 - 7 || rcv_len > 0x20 - 7) + if (snd_len > MAX_SEND - 7 || rcv_len > MAX_RCV - 7) return -EINVAL; b[0] = 0xaa; @@ -213,13 +201,11 @@ static int ttusb_i2c_msg(struct ttusb *ttusb, for (i = 0; i < snd_len; i++) b[7 + i] = snd_buf[i]; - err = ttusb_cmd(ttusb, b, snd_len + 7, 1); + err = ttusb_cmd(ttusb, b, snd_len + 7, MAX_RCV); if (err) return -EREMOTEIO; - err = ttusb_result(ttusb, b, 0x20); - /* check if the i2c transaction was successful */ if ((snd_len != b[5]) || (rcv_len != b[6])) return -EREMOTEIO; @@ -400,8 +386,6 @@ static int ttusb_init_controller(struct ttusb *ttusb) /* i2c write read: 5 bytes, addr 0x10, 0x02 bytes write, 1 bytes read. */ u8 b3[] = { 0xaa, ++ttusb->c, 0x31, 5, 0x10, 0x02, 0x01, 0x00, 0x1e }; - u8 b4[] = - { 0x55, ttusb->c, 0x31, 4, 0x10, 0x02, 0x01, 0x00, 0x1e }; u8 get_version[] = { 0xaa, ++ttusb->c, 0x17, 5, 0, 0, 0, 0, 0 }; u8 get_dsp_version[0x20] = @@ -422,15 +406,11 @@ static int ttusb_init_controller(struct ttusb *ttusb) if ((err = ttusb_cmd(ttusb, b2, sizeof(b2), 0))) return err; - if ((err = ttusb_cmd(ttusb, b3, sizeof(b3), 1))) + if ((err = ttusb_cmd(ttusb, b3, sizeof(b3), 0))) return err; - err = ttusb_result(ttusb, b4, sizeof(b4)); - - if ((err = ttusb_cmd(ttusb, get_version, sizeof(get_version), 1))) - return err; - - if ((err = ttusb_result(ttusb, get_version, sizeof(get_version)))) + if ((err = ttusb_cmd(ttusb, get_version, + sizeof(get_version), sizeof(get_version)))) return err; dprintk("%s: stc-version: %c%c%c%c%c\n", __func__, @@ -451,14 +431,11 @@ static int ttusb_init_controller(struct ttusb *ttusb) (get_version[8] - '0'); err = - ttusb_cmd(ttusb, get_dsp_version, sizeof(get_dsp_version), 1); + ttusb_cmd(ttusb, get_dsp_version, + sizeof(get_dsp_version), sizeof(get_dsp_version)); if (err) return err; - err = - ttusb_result(ttusb, get_dsp_version, sizeof(get_dsp_version)); - if (err) - return err; printk("%s: dsp-version: %c%c%c\n", __func__, get_dsp_version[4], get_dsp_version[5], get_dsp_version[6]); return 0; From patchwork Wed Sep 2 16:10:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751177 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB86014E3 for ; Wed, 2 Sep 2020 16:13:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7FDA820773 for ; Wed, 2 Sep 2020 16:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063222; bh=Crii9zss/HZ1UcVRUShIpUPNP+IW9zZh29dqczIXem8=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=vMr9VWy2FyXiY6yIfrHM20AbfV7uQau8hpZe33Zv0X+kS88LfI3aND2I/M/5wKYBO o+I8mdD55fVFjVj6+o1JoscUjI8HiSMBdU7KkRsiXO/KsvVyX3ZGmKgFTOm3Eool/o YbFH2EdCbLzNIb4enPKXC9GkAm3k0U1XE4PasvLw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728685AbgIBQNY (ORCPT ); Wed, 2 Sep 2020 12:13:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:53922 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728304AbgIBQK5 (ORCPT ); Wed, 2 Sep 2020 12:10:57 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 03C6B2166E; Wed, 2 Sep 2020 16:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=Crii9zss/HZ1UcVRUShIpUPNP+IW9zZh29dqczIXem8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f+Y77m1KqKONqr7VRNPiLD8yGveoSH2QDvoVUyi6JnCM+lfu9C2B/13kDHwlC1ZBJ zGXSB9Bmu7vAMWypMd+6Ue6Y5sTiH/dJ9Jaqzu+jh3mn/mv0wXPcjUtHSzBxNFDIyg kf15GarNHar7fYwjZHT7NhtJ/LqCTLwuVg0nkVi0= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tAf-7g; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 22/38] media: dvb-ttusb-budget: cleanup printk logic Date: Wed, 2 Sep 2020 18:10:25 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Instead of calling printk(), use pr_foo() macros. While here, do some cleanup at the printed messages, as some has __func__, while others have the module name (sometimes spelled as "ttusb_dvb"). Signed-off-by: Mauro Carvalho Chehab --- .../media/usb/ttusb-budget/dvb-ttusb-budget.c | 118 ++++++++---------- 1 file changed, 52 insertions(+), 66 deletions(-) diff --git a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c index 2582a62184fd..9e016b71aa91 100644 --- a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c @@ -5,6 +5,9 @@ * Copyright (c) 2002 Holger Waechtler * Copyright (c) 2003 Felix Domke */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include #include @@ -59,7 +62,12 @@ MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); -#define dprintk(x...) do { if (debug) printk(KERN_DEBUG x); } while (0) +#define dprintk(fmt, arg...) do { \ + if (debug) \ + printk(KERN_DEBUG pr_fmt("%s: " fmt), \ + __func__, ##arg); \ +} while (0) + #define ISO_BUF_COUNT 4 #define FRAMES_PER_ISO_BUF 4 @@ -139,20 +147,19 @@ static int ttusb_cmd(struct ttusb *ttusb, u8 *data, int len, int len_result) return -EAGAIN; if (debug >= 3) - printk(KERN_DEBUG "> %*ph\n", len, data); + dprintk("> %*ph\n", len, data); memcpy(data, ttusb->send_buf, len); err = usb_bulk_msg(ttusb->dev, ttusb->bulk_out_pipe, ttusb->send_buf, len, &actual_len, 1000); if (err != 0) { - dprintk("%s: usb_bulk_msg(send) failed, err == %i!\n", - __func__, err); + dprintk("usb_bulk_msg(send) failed, err == %i!\n", err); goto err; } if (actual_len != len) { err = -EIO; - dprintk("%s: only wrote %d of %d bytes\n", __func__, + dprintk("only wrote %d of %d bytes\n", actual_len, len); goto err; } @@ -161,14 +168,13 @@ static int ttusb_cmd(struct ttusb *ttusb, u8 *data, int len, int len_result) ttusb->last_result, MAX_RCV, &actual_len, 1000); if (err != 0) { - printk("%s: failed, receive error %d\n", __func__, - err); + pr_err("cmd xter failed, receive error %d\n", err); goto err; } if (debug >= 3) { actual_len = ttusb->last_result[3] + 4; - printk(KERN_DEBUG "< %*ph\n", actual_len, ttusb->last_result); + dprintk("< %*ph\n", actual_len, ttusb->last_result); } if (len_result) @@ -212,9 +218,8 @@ static int ttusb_i2c_msg(struct ttusb *ttusb, if (rcv_len > 0) { if (err || b[0] != 0x55 || b[1] != id) { - dprintk - ("%s: usb_bulk_msg(recv) failed, err == %i, id == %02x, b == ", - __func__, err, id); + dprintk("usb_bulk_msg(recv) failed, err == %i, id == %02x, b == ", + err, id); return -EREMOTEIO; } @@ -258,7 +263,7 @@ static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num snd_buf, snd_len, rcv_buf, rcv_len); if (err < rcv_len) { - dprintk("%s: i == %i\n", __func__, i); + dprintk("i == %i\n", i); break; } @@ -278,7 +283,7 @@ static int ttusb_boot_dsp(struct ttusb *ttusb) err = request_firmware(&fw, "ttusb-budget/dspbootcode.bin", &ttusb->dev->dev); if (err) { - printk(KERN_ERR "ttusb-budget: failed to request firmware\n"); + pr_err("failed to request firmware\n"); return err; } @@ -318,8 +323,7 @@ static int ttusb_boot_dsp(struct ttusb *ttusb) done: release_firmware(fw); if (err) { - dprintk("%s: usb_bulk_msg() failed, return value %i!\n", - __func__, err); + dprintk("usb_bulk_msg() failed, return value %i!\n", err); } return err; @@ -413,18 +417,16 @@ static int ttusb_init_controller(struct ttusb *ttusb) sizeof(get_version), sizeof(get_version)))) return err; - dprintk("%s: stc-version: %c%c%c%c%c\n", __func__, - get_version[4], get_version[5], get_version[6], - get_version[7], get_version[8]); + dprintk("stc-version: %c%c%c%c%c\n", get_version[4], get_version[5], + get_version[6], get_version[7], get_version[8]); if (memcmp(get_version + 4, "V 0.0", 5) && memcmp(get_version + 4, "V 1.1", 5) && memcmp(get_version + 4, "V 2.1", 5) && memcmp(get_version + 4, "V 2.2", 5)) { - printk - ("%s: unknown STC version %c%c%c%c%c, please report!\n", - __func__, get_version[4], get_version[5], - get_version[6], get_version[7], get_version[8]); + pr_err("unknown STC version %c%c%c%c%c, please report!\n", + get_version[4], get_version[5], + get_version[6], get_version[7], get_version[8]); } ttusb->revision = ((get_version[6] - '0') << 4) | @@ -436,7 +438,7 @@ static int ttusb_init_controller(struct ttusb *ttusb) if (err) return err; - printk("%s: dsp-version: %c%c%c\n", __func__, + pr_info("dsp-version: %c%c%c\n", get_dsp_version[4], get_dsp_version[5], get_dsp_version[6]); return 0; } @@ -458,8 +460,7 @@ static int ttusb_send_diseqc(struct dvb_frontend* fe, /* Diseqc */ if ((err = ttusb_cmd(ttusb, b, 4 + b[3], 0))) { - dprintk("%s: usb_bulk_msg() failed, return value %i!\n", - __func__, err); + dprintk("usb_bulk_msg() failed, return value %i!\n", err); } return err; @@ -476,8 +477,7 @@ static int ttusb_update_lnb(struct ttusb *ttusb) /* SetLNB */ if ((err = ttusb_cmd(ttusb, b, sizeof(b), 0))) { - dprintk("%s: usb_bulk_msg() failed, return value %i!\n", - __func__, err); + dprintk("usb_bulk_msg() failed, return value %i!\n", err); } return err; @@ -511,8 +511,7 @@ static void ttusb_set_led_freq(struct ttusb *ttusb, u8 freq) err = ttusb_cmd(ttusb, b, sizeof(b), 0); if (err) { - dprintk("%s: usb_bulk_msg() failed, return value %i!\n", - __func__, err); + dprintk("usb_bulk_msg() failed, return value %i!\n", err); } } #endif @@ -536,7 +535,7 @@ static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack, int i; if (len < 4 || len & 0x1) { - pr_warn("%s: muxpack has invalid len %d\n", __func__, len); + pr_warn("muxpack has invalid len %d\n", len); numinvalid++; return; } @@ -544,8 +543,7 @@ static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack, for (i = 0; i < len; i += 2) csum ^= le16_to_cpup((__le16 *) (muxpack + i)); if (csum) { - printk("%s: muxpack with incorrect checksum, ignoring\n", - __func__); + pr_warn("muxpack with incorrect checksum, ignoring\n"); numinvalid++; return; } @@ -553,8 +551,8 @@ static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack, cc = (muxpack[len - 4] << 8) | muxpack[len - 3]; cc &= 0x7FFF; if ((cc != ttusb->cc) && (ttusb->cc != -1)) - printk("%s: cc discontinuity (%d frames missing)\n", - __func__, (cc - ttusb->cc) & 0x7FFF); + pr_warn("cc discontinuity (%d frames missing)\n", + (cc - ttusb->cc) & 0x7FFF); ttusb->cc = (cc + 1) & 0x7FFF; if (muxpack[0] & 0x80) { #ifdef TTUSB_HWSECTIONS @@ -575,7 +573,7 @@ static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack, !!(ttusb->muxpack[1] & 1)) data++; #warning TODO: pusi - printk("cc: %04x\n", (data[0] << 8) | data[1]); + dprintk("cc: %04x\n", (data[0] << 8) | data[1]); #endif numsec++; } else if (muxpack[0] == 0x47) { @@ -594,7 +592,7 @@ static void ttusb_process_muxpack(struct ttusb *ttusb, const u8 * muxpack, dvb_dmx_swfilter_packets(&ttusb->dvb_demux, muxpack, 1); } else if (muxpack[0] != 0) { numinvalid++; - printk("illegal muxpack type %02x\n", muxpack[0]); + pr_err("illegal muxpack type %02x\n", muxpack[0]); } else numstuff++; } @@ -604,7 +602,7 @@ static void ttusb_process_frame(struct ttusb *ttusb, u8 * data, int len) int maxwork = 1024; while (len) { if (!(maxwork--)) { - printk("%s: too much work\n", __func__); + pr_err("too much work\n"); break; } @@ -618,10 +616,7 @@ static void ttusb_process_frame(struct ttusb *ttusb, u8 * data, int len) else { ttusb->mux_state = 0; if (ttusb->insync) { - dprintk("%s: %02x\n", - __func__, data[-1]); - printk(KERN_INFO "%s: lost sync.\n", - __func__); + pr_info("lost sync.\n"); ttusb->insync = 0; } } @@ -677,10 +672,8 @@ static void ttusb_process_frame(struct ttusb *ttusb, u8 * data, int len) ttusb->muxpack[1] + 2 + 4; else { - dprintk - ("%s: invalid state: first byte is %x\n", - __func__, - ttusb->muxpack[0]); + dprintk("invalid state: first byte is %x\n", + ttusb->muxpack[0]); ttusb->mux_state = 0; } } @@ -729,12 +722,6 @@ static void ttusb_iso_irq(struct urb *urb) if (!ttusb->iso_streaming) return; -#if 0 - printk("%s: status %d, errcount == %d, length == %i\n", - __func__, - urb->status, urb->error_count, urb->actual_length); -#endif - if (!urb->status) { for (i = 0; i < urb->number_of_packets; ++i) { numpkt++; @@ -807,7 +794,7 @@ static int ttusb_start_iso_xfer(struct ttusb *ttusb) int i, j, err, buffer_offset = 0; if (ttusb->iso_streaming) { - printk("%s: iso xfer already running!\n", __func__); + pr_err("iso xfer already running!\n"); return 0; } @@ -841,9 +828,8 @@ static int ttusb_start_iso_xfer(struct ttusb *ttusb) for (i = 0; i < ISO_BUF_COUNT; i++) { if ((err = usb_submit_urb(ttusb->iso_urb[i], GFP_ATOMIC))) { ttusb_stop_iso_xfer(ttusb); - printk - ("%s: failed urb submission (%i: err = %i)!\n", - __func__, i, err); + pr_err("failed urb submission (%i: err = %i)!\n", + i, err); return err; } } @@ -1403,7 +1389,7 @@ static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe) if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) { - printk("dvb-ttusb-budget: dvbc_philips_tdm1316l_pll_set Error 1\n"); + pr_err("dvbc_philips_tdm1316l_pll_set Error 1\n"); return -EIO; } @@ -1412,7 +1398,7 @@ static int dvbc_philips_tdm1316l_tuner_set_params(struct dvb_frontend *fe) if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); if (i2c_transfer(&ttusb->i2c_adap, &tuner_msg, 1) != 1) { - printk("dvb-ttusb-budget: dvbc_philips_tdm1316l_pll_set Error 2\n"); + pr_err("dvbc_philips_tdm1316l_pll_set Error 2\n"); return -EIO; } @@ -1589,12 +1575,12 @@ static void frontend_init(struct ttusb* ttusb) } if (ttusb->fe == NULL) { - printk("dvb-ttusb-budget: A frontend driver was not found for device [%04x:%04x]\n", + pr_err("no frontend driver found for device [%04x:%04x]\n", le16_to_cpu(ttusb->dev->descriptor.idVendor), le16_to_cpu(ttusb->dev->descriptor.idProduct)); } else { if (dvb_register_frontend(&ttusb->adapter, ttusb->fe)) { - printk("dvb-ttusb-budget: Frontend registration failed!\n"); + pr_err("Frontend registration failed!\n"); dvb_frontend_detach(ttusb->fe); ttusb->fe = NULL; } @@ -1614,7 +1600,7 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i struct ttusb *ttusb; int result; - dprintk("%s: TTUSB DVB connected\n", __func__); + dprintk("TTUSB DVB connected\n"); udev = interface_to_usbdev(intf); @@ -1636,14 +1622,14 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i result = ttusb_alloc_iso_urbs(ttusb); if (result < 0) { - dprintk("%s: ttusb_alloc_iso_urbs - failed\n", __func__); + dprintk("ttusb_alloc_iso_urbs - failed\n"); mutex_unlock(&ttusb->semi2c); kfree(ttusb); return result; } if (ttusb_init_controller(ttusb)) - printk("ttusb_init_controller: error\n"); + pr_err("ttusb_init_controller: error\n"); mutex_unlock(&ttusb->semi2c); @@ -1688,7 +1674,7 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i result = dvb_dmx_init(&ttusb->dvb_demux); if (result < 0) { - printk("ttusb_dvb: dvb_dmx_init failed (errno = %d)\n", result); + pr_err("dvb_dmx_init failed (errno = %d)\n", result); result = -ENODEV; goto err_i2c_del_adapter; } @@ -1699,14 +1685,14 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i result = dvb_dmxdev_init(&ttusb->dmxdev, &ttusb->adapter); if (result < 0) { - printk("ttusb_dvb: dvb_dmxdev_init failed (errno = %d)\n", + pr_err("dvb_dmxdev_init failed (errno = %d)\n", result); result = -ENODEV; goto err_release_dmx; } if (dvb_net_init(&ttusb->adapter, &ttusb->dvbnet, &ttusb->dvb_demux.dmx)) { - printk("ttusb_dvb: dvb_net_init failed!\n"); + pr_err("dvb_net_init failed!\n"); result = -ENODEV; goto err_release_dmxdev; } @@ -1755,7 +1741,7 @@ static void ttusb_disconnect(struct usb_interface *intf) kfree(ttusb); - dprintk("%s: TTUSB DVB disconnected\n", __func__); + dprintk("TTUSB DVB disconnected\n"); } static const struct usb_device_id ttusb_table[] = { From patchwork Wed Sep 2 16:10:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751211 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8019109B for ; Wed, 2 Sep 2020 16:17:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B3DD9208C7 for ; Wed, 2 Sep 2020 16:17:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063427; bh=vbQF66iKfyJ7E6H+ff93dGs/2GYrxlcC/G916kKGy4E=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=OE3cOIV12LhwGIMZEfBx+zCtEbcbXL8zkn1uCsjRiLSHxpVlpSSeSgs/QPLijKNEf +4q1xOLfVqS0aRlY3SyYj51Tp8mFMKZ9qOYlnirNOkKGvxtdsI/adnnBG6gfOj+Y/7 cxkFJ18LABI9225GHqYTr7nynvIEvE6oOCpUYFOY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728703AbgIBQRA (ORCPT ); Wed, 2 Sep 2020 12:17:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:53892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728291AbgIBQK4 (ORCPT ); Wed, 2 Sep 2020 12:10:56 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0766D2168B; Wed, 2 Sep 2020 16:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=vbQF66iKfyJ7E6H+ff93dGs/2GYrxlcC/G916kKGy4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=geuusIYWolZAHBYtCkbEgiXNwSPLwg11C84pGwBvD5aeWsskXpag5zZz1chnORRY6 1vcg2vjCMlpdpCfC20sFlrjtKdIl3KxMGDp/+Rglaer+0YI+XkqSGFL7zQQteCPDRD nvTAQ9Io/mXWnvuvdSZpyNQRnTmrJI4mB3NJiYFA= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tAh-8s; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 23/38] media: saa7134: avoid a shift overflow Date: Wed, 2 Sep 2020 18:10:26 +0200 Message-Id: <6ee0a9ec8855f0388fee8cd183abeb60e28b293f.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As reported by smatch: drivers/media/pci/saa7134//saa7134-tvaudio.c:686 saa_dsp_writel() warn: should 'reg << 2' be a 64 bit type? On a 64-bits Kernel, the shift might be bigger than 32 bits. In real, this should never happen, but let's shut up the warning. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/saa7134/saa7134-tvaudio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/saa7134/saa7134-tvaudio.c b/drivers/media/pci/saa7134/saa7134-tvaudio.c index 79e1afb71075..5cc4ef21f9d3 100644 --- a/drivers/media/pci/saa7134/saa7134-tvaudio.c +++ b/drivers/media/pci/saa7134/saa7134-tvaudio.c @@ -683,7 +683,8 @@ int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value) { int err; - audio_dbg(2, "dsp write reg 0x%x = 0x%06x\n", reg << 2, value); + audio_dbg(2, "dsp write reg 0x%x = 0x%06x\n", + (reg << 2) & 0xffffffff, value); err = saa_dsp_wait_bit(dev,SAA7135_DSP_RWSTATE_WRR); if (err < 0) return err; From patchwork Wed Sep 2 16:10:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751179 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A99C14E3 for ; Wed, 2 Sep 2020 16:13:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5495A20773 for ; Wed, 2 Sep 2020 16:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063230; bh=1rYSiFR3IJ0WRBD3O988H5WFm4sGhmAqjZGJZ9WwYjU=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=TFpgWgg3ATyR+elbW/4SyzEd/aBjuTtbXP3OkUpWhGbJXcGPKveftKOWs0GOEYfj2 FJmEsY2YnHgPghdPaFfXWLzgTxPVRZZehfs5MFAFzyR6QTEieU09z1YwvqOnjh64yM bhgRPCL7mHhlG9s7zWoYQrjOZJgSE5F6Ymz5xMIc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728491AbgIBQNr (ORCPT ); Wed, 2 Sep 2020 12:13:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:53874 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728307AbgIBQK5 (ORCPT ); Wed, 2 Sep 2020 12:10:57 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1DFD221707; Wed, 2 Sep 2020 16:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=1rYSiFR3IJ0WRBD3O988H5WFm4sGhmAqjZGJZ9WwYjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1TRjuZhLRoasadr80vwGc4GRSVQ1QvS0v6W4Dgk1RZzI7z5txpN/jowIENK2J2Ooj MrXzTtWGl/p2cpJWNZm2LX9GSWPtPb9LKfcnscdcKFrIVjZ6pdTSorwhLR84fh5zBk YaoIbaaltd97p4knZRLUBmVOKhjZJIPZ7BQGjlv0= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tAk-9i; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 24/38] media: atomisp: fix casts at atomisp_compat_ioctl32.c Date: Wed, 2 Sep 2020 18:10:27 +0200 Message-Id: <56c880b7f36d594104649135644355efeee45f48.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There are several warnings reported by sparse with regards to wrong typecasts: drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:73:13: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:73:13: expected void *__pu_val drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:73:13: got void [noderef] __user * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:247:13: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:247:13: expected unsigned int [usertype] *__pu_val drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:247:13: got void [noderef] __user * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:248:13: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:248:13: expected unsigned int [usertype] *__pu_val drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:248:13: got void [noderef] __user * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:249:13: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:249:13: expected unsigned int [usertype] *__pu_val drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:249:13: got void [noderef] __user * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:250:13: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:250:13: expected unsigned int [usertype] *__pu_val drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:250:13: got void [noderef] __user * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:282:30: warning: incorrect type in argument 2 (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:282:30: expected void const *from drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:282:30: got struct atomisp_3a_statistics [noderef] __user *kp drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:308:13: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:308:13: expected unsigned int [usertype] *__pu_val drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:308:13: got void [noderef] __user * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:327:13: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:327:13: expected void [noderef] __user *effective_width drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:327:13: got unsigned int [usertype] * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:348:13: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:348:13: expected void [noderef] __user *effective_width drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:348:13: got unsigned int [usertype] * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:372:13: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:372:13: expected unsigned int [usertype] *__pu_val drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:372:13: got void [noderef] __user * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:433:13: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:433:13: expected struct v4l2_framebuffer *__pu_val drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:433:13: got void [noderef] __user * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:462:13: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:462:13: expected void [noderef] __user *frame drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:462:13: got struct v4l2_framebuffer * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:496:13: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:496:13: expected unsigned short *__pu_val drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:496:13: got void [noderef] __user * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:511:13: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:511:13: expected void [noderef] __user *calb_grp_values drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:511:13: got unsigned short * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:630:21: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:630:21: expected unsigned short [usertype] *__pu_val drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:630:21: got void [noderef] __user * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:715:27: warning: cast removes address space '__user' of expression drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:715:27: warning: incorrect type in initializer (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:715:27: expected struct [noderef] __user *karg drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:715:27: got void * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:721:39: warning: cast removes address space '__user' of expression drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:21: warning: incorrect type in argument 1 (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:21: expected void const volatile [noderef] __user * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:21: got unsigned int [usertype] *src drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:43: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:43: expected void *__pu_val drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:725:43: got void [noderef] __user * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:741:21: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:741:21: expected struct atomisp_shading_table *__pu_val drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:741:21: got struct atomisp_shading_table [noderef] __user * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:747:21: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:747:21: expected struct atomisp_morph_table *__pu_val drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:747:21: got struct atomisp_morph_table [noderef] __user * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:753:21: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:753:21: expected struct atomisp_dis_coefficients *__pu_val drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:753:21: got struct atomisp_dis_coefficients [noderef] __user * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:760:14: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:760:14: expected struct atomisp_dvs_6axis_config *__pu_val drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:760:14: got struct atomisp_dvs_6axis_config [noderef] __user * drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:817:13: warning: incorrect type in assignment (different address spaces) drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:817:13: expected struct atomisp_sensor_ae_bracketing_lut_entry *__pu_val drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c:817:13: got void [noderef] __user * Use the same strategies used at v4l2-compat32.c, in order to solve them and avoid warnings. Signed-off-by: Mauro Carvalho Chehab --- .../atomisp/pci/atomisp_compat_ioctl32.c | 84 +++++++++++-------- 1 file changed, 48 insertions(+), 36 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c b/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c index fa5918270614..e5553df5bad4 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c +++ b/drivers/staging/media/atomisp/pci/atomisp_compat_ioctl32.c @@ -25,16 +25,26 @@ #include "atomisp_ioctl.h" #include "atomisp_compat_ioctl32.h" -/* Macro borrowed from v4l2-compat-ioctl32.c */ +/* Macros borrowed from v4l2-compat-ioctl32.c */ + +#define get_user_cast(__x, __ptr) \ +({ \ + get_user(__x, (typeof(*__ptr) __user *)(__ptr)); \ +}) + +#define put_user_force(__x, __ptr) \ +({ \ + put_user((typeof(*__x) __force *)(__x), __ptr); \ +}) + /* Use the same argument order as copy_in_user */ -#define assign_in_user(to, from) \ -({ \ - typeof(*from) __assign_tmp; \ - \ - get_user(__assign_tmp, from) || put_user(__assign_tmp, to); \ +#define assign_in_user(to, from) \ +({ \ + typeof(*from) __assign_tmp; \ + \ + get_user_cast(__assign_tmp, from) || put_user(__assign_tmp, to);\ }) - static int get_atomisp_histogram32(struct atomisp_histogram __user *kp, struct atomisp_histogram32 __user *up) { @@ -64,13 +74,13 @@ static int put_atomisp_histogram32(struct atomisp_histogram __user *kp, } static int get_v4l2_framebuffer32(struct v4l2_framebuffer __user *kp, - struct v4l2_framebuffer32 __user *up) + struct v4l2_framebuffer32 __user *up) { compat_uptr_t tmp; if (!access_ok(up, sizeof(struct v4l2_framebuffer32)) || get_user(tmp, &up->base) || - put_user(compat_ptr(tmp), &kp->base) || + put_user_force(compat_ptr(tmp), &kp->base) || assign_in_user(&kp->capability, &up->capability) || assign_in_user(&kp->flags, &up->flags) || copy_in_user(&kp->fmt, &up->fmt, sizeof(kp->fmt))) @@ -244,10 +254,10 @@ static int get_atomisp_dvs_6axis_config32(struct atomisp_dvs_6axis_config __user get_user(ycoords_y, &up->ycoords_y) || get_user(xcoords_uv, &up->xcoords_uv) || get_user(ycoords_uv, &up->ycoords_uv) || - put_user(compat_ptr(xcoords_y), &kp->xcoords_y) || - put_user(compat_ptr(ycoords_y), &kp->ycoords_y) || - put_user(compat_ptr(xcoords_uv), &kp->xcoords_uv) || - put_user(compat_ptr(ycoords_uv), &kp->ycoords_uv)) + put_user_force(compat_ptr(xcoords_y), &kp->xcoords_y) || + put_user_force(compat_ptr(ycoords_y), &kp->ycoords_y) || + put_user_force(compat_ptr(xcoords_uv), &kp->xcoords_uv) || + put_user_force(compat_ptr(ycoords_uv), &kp->ycoords_uv)) return -EFAULT; return 0; @@ -279,7 +289,7 @@ static int put_atomisp_3a_statistics32(struct atomisp_3a_statistics __user *kp, void __user *rgby_data; if (!access_ok(up, sizeof(struct atomisp_3a_statistics32)) || - copy_to_user(up, kp, sizeof(struct atomisp_grid_info)) || + copy_in_user(up, kp, sizeof(struct atomisp_grid_info)) || get_user(rgby_data, &kp->rgby_data) || put_user(ptr_to_compat(rgby_data), &up->rgby_data) || get_user(data, &kp->data) || @@ -305,7 +315,7 @@ static int get_atomisp_metadata_stat32(struct atomisp_metadata __user *kp, assign_in_user(&kp->stride, &up->stride) || assign_in_user(&kp->exp_id, &up->exp_id) || get_user(effective_width, &up->effective_width) || - put_user(compat_ptr(effective_width), &kp->effective_width)) + put_user_force(compat_ptr(effective_width), &kp->effective_width)) return -EFAULT; return 0; @@ -315,7 +325,7 @@ static int put_atomisp_metadata_stat32(struct atomisp_metadata __user *kp, struct atomisp_metadata32 __user *up) { void __user *data; - void __user *effective_width; + void *effective_width; if (!access_ok(up, sizeof(struct atomisp_metadata32)) || get_user(data, &kp->data) || @@ -325,7 +335,8 @@ static int put_atomisp_metadata_stat32(struct atomisp_metadata __user *kp, assign_in_user(&up->stride, &kp->stride) || assign_in_user(&up->exp_id, &kp->exp_id) || get_user(effective_width, &kp->effective_width) || - put_user(ptr_to_compat(effective_width), &up->effective_width)) + put_user(ptr_to_compat((void __user *)effective_width), + &up->effective_width)) return -EFAULT; return 0; @@ -336,7 +347,7 @@ put_atomisp_metadata_by_type_stat32(struct atomisp_metadata_with_type __user *kp struct atomisp_metadata_with_type32 __user *up) { void __user *data; - void __user *effective_width; + u32 *effective_width; if (!access_ok(up, sizeof(struct atomisp_metadata_with_type32)) || get_user(data, &kp->data) || @@ -346,7 +357,7 @@ put_atomisp_metadata_by_type_stat32(struct atomisp_metadata_with_type __user *kp assign_in_user(&up->stride, &kp->stride) || assign_in_user(&up->exp_id, &kp->exp_id) || get_user(effective_width, &kp->effective_width) || - put_user(ptr_to_compat(effective_width), + put_user(ptr_to_compat((void __user *)effective_width), &up->effective_width) || assign_in_user(&up->type, &kp->type)) return -EFAULT; @@ -369,7 +380,7 @@ get_atomisp_metadata_by_type_stat32(struct atomisp_metadata_with_type __user *kp assign_in_user(&kp->stride, &up->stride) || assign_in_user(&kp->exp_id, &up->exp_id) || get_user(effective_width, &up->effective_width) || - put_user(compat_ptr(effective_width), &kp->effective_width) || + put_user_force(compat_ptr(effective_width), &kp->effective_width) || assign_in_user(&kp->type, &up->type)) return -EFAULT; @@ -430,7 +441,7 @@ static int get_atomisp_overlay32(struct atomisp_overlay __user *kp, if (!access_ok(up, sizeof(struct atomisp_overlay32)) || get_user(frame, &up->frame) || - put_user(compat_ptr(frame), &kp->frame) || + put_user_force(compat_ptr(frame), &kp->frame) || assign_in_user(&kp->bg_y, &up->bg_y) || assign_in_user(&kp->bg_u, &up->bg_u) || assign_in_user(&kp->bg_v, &up->bg_v) || @@ -456,11 +467,11 @@ static int get_atomisp_overlay32(struct atomisp_overlay __user *kp, static int put_atomisp_overlay32(struct atomisp_overlay __user *kp, struct atomisp_overlay32 __user *up) { - void __user *frame; + void *frame; if (!access_ok(up, sizeof(struct atomisp_overlay32)) || get_user(frame, &kp->frame) || - put_user(ptr_to_compat(frame), &up->frame) || + put_user(ptr_to_compat((void __user *)frame), &up->frame) || assign_in_user(&up->bg_y, &kp->bg_y) || assign_in_user(&up->bg_u, &kp->bg_u) || assign_in_user(&up->bg_v, &kp->bg_v) || @@ -493,7 +504,7 @@ get_atomisp_calibration_group32(struct atomisp_calibration_group __user *kp, assign_in_user(&kp->size, &up->size) || assign_in_user(&kp->type, &up->type) || get_user(calb_grp_values, &up->calb_grp_values) || - put_user(compat_ptr(calb_grp_values), &kp->calb_grp_values)) + put_user_force(compat_ptr(calb_grp_values), &kp->calb_grp_values)) return -EFAULT; return 0; @@ -503,13 +514,14 @@ static int put_atomisp_calibration_group32(struct atomisp_calibration_group __user *kp, struct atomisp_calibration_group32 __user *up) { - void __user *calb_grp_values; + void *calb_grp_values; if (!access_ok(up, sizeof(struct atomisp_calibration_group32)) || assign_in_user(&up->size, &kp->size) || assign_in_user(&up->type, &kp->type) || get_user(calb_grp_values, &kp->calb_grp_values) || - put_user(ptr_to_compat(calb_grp_values), &up->calb_grp_values)) + put_user(ptr_to_compat((void __user *)calb_grp_values), + &up->calb_grp_values)) return -EFAULT; return 0; @@ -523,7 +535,7 @@ static int get_atomisp_acc_fw_load32(struct atomisp_acc_fw_load __user *kp, if (!access_ok(up, sizeof(struct atomisp_acc_fw_load32)) || assign_in_user(&kp->size, &up->size) || assign_in_user(&kp->fw_handle, &up->fw_handle) || - get_user(data, &up->data) || + get_user_cast(data, &up->data) || put_user(compat_ptr(data), &kp->data)) return -EFAULT; @@ -627,7 +639,7 @@ static int get_atomisp_shading_table32(struct atomisp_shading_table __user *kp, compat_uptr_t tmp; if (get_user(tmp, &up->data[n]) || - put_user(compat_ptr(tmp), &kp->data[n])) + put_user_force(compat_ptr(tmp), &kp->data[n])) return -EFAULT; } return 0; @@ -712,17 +724,17 @@ static int get_atomisp_parameters32(struct atomisp_parameters __user *kp, struct atomisp_morph_table morph_table; struct atomisp_dis_coefficients dvs2_coefs; struct atomisp_dvs_6axis_config dvs_6axis_config; - } __user *karg = (void *)(kp + 1); + } __user *karg = (void __user *)(kp + 1); if (!access_ok(up, sizeof(struct atomisp_parameters32))) return -EFAULT; while (n >= 0) { - compat_uptr_t *src = (compat_uptr_t *)up + n; + compat_uptr_t __user *src = (compat_uptr_t __user *)up + n; void * __user *dst = (void * __user *)kp + n; compat_uptr_t tmp; - if (get_user(tmp, src) || put_user(compat_ptr(tmp), dst)) + if (get_user_cast(tmp, src) || put_user_force(compat_ptr(tmp), dst)) return -EFAULT; n--; } @@ -738,26 +750,26 @@ static int get_atomisp_parameters32(struct atomisp_parameters __user *kp, /* handle shading table */ if (stp && (get_atomisp_shading_table32(&karg->shading_table, compat_ptr(stp)) || - put_user(&karg->shading_table, &kp->shading_table))) + put_user_force(&karg->shading_table, &kp->shading_table))) return -EFAULT; /* handle morph table */ if (mtp && (get_atomisp_morph_table32(&karg->morph_table, compat_ptr(mtp)) || - put_user(&karg->morph_table, &kp->morph_table))) + put_user_force(&karg->morph_table, &kp->morph_table))) return -EFAULT; /* handle dvs2 coefficients */ if (dcp && (get_atomisp_dis_coefficients32(&karg->dvs2_coefs, compat_ptr(dcp)) || - put_user(&karg->dvs2_coefs, &kp->dvs2_coefs))) + put_user_force(&karg->dvs2_coefs, &kp->dvs2_coefs))) return -EFAULT; /* handle dvs 6axis configuration */ if (dscp && (get_atomisp_dvs_6axis_config32(&karg->dvs_6axis_config, compat_ptr(dscp)) || - put_user(&karg->dvs_6axis_config, &kp->dvs_6axis_config))) + put_user_force(&karg->dvs_6axis_config, &kp->dvs_6axis_config))) return -EFAULT; return 0; @@ -814,7 +826,7 @@ get_atomisp_sensor_ae_bracketing_lut(struct atomisp_sensor_ae_bracketing_lut __u if (!access_ok(up, sizeof(struct atomisp_sensor_ae_bracketing_lut32)) || assign_in_user(&kp->lut_size, &up->lut_size) || get_user(lut, &up->lut) || - put_user(compat_ptr(lut), &kp->lut)) + put_user_force(compat_ptr(lut), &kp->lut)) return -EFAULT; return 0; From patchwork Wed Sep 2 16:10:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751173 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 88EE314E3 for ; Wed, 2 Sep 2020 16:13:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55AA3207EA for ; Wed, 2 Sep 2020 16:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063204; bh=jSk32XhcmRVIOqD2bfZbAXJErvyzCfjDzpTi89YbsDU=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=WBKzwzEvnJDPBX0+XU+6gqusWqwD6A7n8O81EB5ou8dCJ1QQKQZN8d2irpRoyzoxV iidAF7rJ/+u5LG/vE1lIYKx+3doi4cIC105zvf0J4aAvOxkT8Hi/ePj4LTJ/AvmuKe iN539G0w5fHC7tGw01r2wTvsy+vASwNMwqoMYHOE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728678AbgIBQNX (ORCPT ); Wed, 2 Sep 2020 12:13:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:54042 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728330AbgIBQK6 (ORCPT ); Wed, 2 Sep 2020 12:10:58 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 36680218AC; Wed, 2 Sep 2020 16:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=jSk32XhcmRVIOqD2bfZbAXJErvyzCfjDzpTi89YbsDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ptarS6dJ5cE8SjpT6guawefwJ5FmDQBZDUHq66mqyqJ/WMcNo2MTMXbL0LYx712hS tRBTaFInrPPki2XCysArGRpvWKfBAc96K+aVgXNL8GdI2auBSYC9UzoxziXqmhnHc2 jeQrAVAm+nwL8Ej+LGn4Ubqbb9GYxNiDn2xwjaVM= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tAs-BE; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , Arnd Bergmann , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 25/38] media: atomisp: get rid of some unused code Date: Wed, 2 Sep 2020 18:10:28 +0200 Message-Id: <4e128262fa297767984dc2a1504f78be12bbe96c.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Now that the defines which are common for both ISP2400 and ISP2401 are at system_global.h, we can get rid of the code not used by those versions. Signed-off-by: Mauro Carvalho Chehab --- .../staging/media/atomisp/pci/ia_css_mipi.h | 2 - .../staging/media/atomisp/pci/ia_css_stream.h | 4 +- .../kernels/ctc/ctc_1.0/ia_css_ctc_param.h | 7 - .../ctc/ctc_1.0/ia_css_ctc_table.host.c | 145 ------------------ .../kernels/gc/gc_1.0/ia_css_gc_table.host.c | 144 ----------------- .../kernels/gc/gc_2/ia_css_gc2_table.host.c | 53 ------- .../kernels/xnr/xnr_1.0/ia_css_xnr_param.h | 7 - .../xnr/xnr_1.0/ia_css_xnr_table.host.c | 31 ---- .../runtime/bufq/interface/ia_css_bufq_comm.h | 6 +- .../media/atomisp/pci/runtime/bufq/src/bufq.c | 23 --- .../pci/runtime/debug/src/ia_css_debug.c | 22 +-- .../pci/runtime/inputfifo/src/inputfifo.c | 10 -- .../atomisp/pci/runtime/isys/src/isys_init.c | 2 - .../media/atomisp/pci/runtime/isys/src/rx.c | 10 -- .../pci/runtime/pipeline/src/pipeline.c | 2 - drivers/staging/media/atomisp/pci/sh_css.c | 93 ++--------- .../staging/media/atomisp/pci/sh_css_hrt.c | 4 - .../media/atomisp/pci/sh_css_internal.h | 8 +- .../staging/media/atomisp/pci/sh_css_mipi.c | 2 +- .../staging/media/atomisp/pci/sh_css_params.c | 5 - .../media/atomisp/pci/sh_css_properties.c | 10 -- drivers/staging/media/atomisp/pci/sh_css_sp.c | 19 +-- drivers/staging/media/atomisp/pci/sh_css_sp.h | 2 - 23 files changed, 33 insertions(+), 578 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/ia_css_mipi.h b/drivers/staging/media/atomisp/pci/ia_css_mipi.h index 56a2fca8117f..7b6d796d6ee0 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_mipi.h +++ b/drivers/staging/media/atomisp/pci/ia_css_mipi.h @@ -42,7 +42,6 @@ int ia_css_mipi_frame_specify(const unsigned int size_mem_words, const bool contiguous); -#if !defined(HAS_NO_INPUT_SYSTEM) /* @brief Register size of a CSS MIPI frame for check during capturing. * * @param[in] port CSI-2 port this check is registered. @@ -58,7 +57,6 @@ ia_css_mipi_frame_specify(const unsigned int size_mem_words, int ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port, const unsigned int size_mem_words); -#endif /* @brief Calculate the size of a mipi frame. * diff --git a/drivers/staging/media/atomisp/pci/ia_css_stream.h b/drivers/staging/media/atomisp/pci/ia_css_stream.h index e3e7a8a03b04..4dffc6d7c8d8 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_stream.h +++ b/drivers/staging/media/atomisp/pci/ia_css_stream.h @@ -18,7 +18,7 @@ #include #include -#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(USE_INPUT_SYSTEM_VERSION_2401) #include #endif #include "ia_css_types.h" @@ -30,7 +30,7 @@ struct ia_css_stream { struct ia_css_stream_config config; struct ia_css_stream_info info; -#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(USE_INPUT_SYSTEM_VERSION_2401) rx_cfg_t csi_rx_config; #endif bool reconfigure_css_rx; diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h index 7e2fa192a0fe..eaad708c611c 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h +++ b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h @@ -22,15 +22,8 @@ #include "ia_css_ctc_types.h" #ifndef PIPE_GENERATION -#if defined(HAS_VAMEM_VERSION_2) #define SH_CSS_ISP_CTC_TABLE_SIZE_LOG2 IA_CSS_VAMEM_2_CTC_TABLE_SIZE_LOG2 #define SH_CSS_ISP_CTC_TABLE_SIZE IA_CSS_VAMEM_2_CTC_TABLE_SIZE -#elif defined(HAS_VAMEM_VERSION_1) -#define SH_CSS_ISP_CTC_TABLE_SIZE_LOG2 IA_CSS_VAMEM_1_CTC_TABLE_SIZE_LOG2 -#define SH_CSS_ISP_CTC_TABLE_SIZE IA_CSS_VAMEM_1_CTC_TABLE_SIZE -#else -#error "VAMEM should be {VERSION1, VERSION2}" -#endif #else /* For pipe generation, the size is not relevant */ diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c index f13b79586963..6a7925c8493a 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c @@ -23,7 +23,6 @@ struct ia_css_ctc_table default_ctc_table; -#if defined(HAS_VAMEM_VERSION_2) static const uint16_t default_ctc_table_data[IA_CSS_VAMEM_2_CTC_TABLE_SIZE] = { @@ -62,155 +61,11 @@ default_ctc_table_data[IA_CSS_VAMEM_2_CTC_TABLE_SIZE] = { 0 }; -#elif defined(HAS_VAMEM_VERSION_1) - -/* Default Parameters */ -static const uint16_t -default_ctc_table_data[IA_CSS_VAMEM_1_CTC_TABLE_SIZE] = { - 0, 0, 256, 384, 384, 497, 765, 806, - 837, 851, 888, 901, 957, 981, 993, 1001, - 1011, 1029, 1028, 1039, 1062, 1059, 1073, 1080, - 1083, 1085, 1085, 1098, 1080, 1084, 1085, 1093, - 1078, 1073, 1070, 1069, 1077, 1066, 1072, 1063, - 1053, 1044, 1046, 1053, 1039, 1028, 1025, 1024, - 1012, 1013, 1016, 996, 992, 990, 990, 980, - 969, 968, 961, 955, 951, 949, 933, 930, - 929, 925, 921, 916, 906, 901, 895, 893, - 886, 877, 872, 869, 866, 861, 857, 849, - 845, 838, 836, 832, 823, 821, 815, 813, - 809, 805, 796, 793, 790, 785, 784, 778, - 772, 768, 766, 763, 758, 752, 749, 745, - 741, 740, 736, 730, 726, 724, 723, 718, - 711, 709, 706, 704, 701, 698, 691, 689, - 688, 683, 683, 678, 675, 673, 671, 669, - 666, 663, 661, 660, 656, 656, 653, 650, - 648, 647, 646, 643, 639, 638, 637, 635, - 633, 632, 629, 627, 626, 625, 622, 621, - 618, 618, 614, 614, 612, 609, 606, 606, - 603, 600, 600, 597, 594, 591, 590, 586, - 582, 581, 578, 575, 572, 569, 563, 560, - 557, 554, 551, 548, 545, 539, 536, 533, - 529, 527, 524, 519, 516, 513, 510, 507, - 504, 501, 498, 493, 491, 488, 485, 484, - 480, 476, 474, 471, 467, 466, 464, 460, - 459, 455, 453, 449, 447, 446, 443, 441, - 438, 435, 432, 432, 429, 427, 426, 422, - 419, 418, 416, 414, 412, 410, 408, 406, - 404, 402, 401, 398, 397, 395, 393, 390, - 389, 388, 387, 384, 382, 380, 378, 377, - 376, 375, 372, 370, 368, 368, 366, 364, - 363, 361, 360, 358, 357, 355, 354, 352, - 351, 350, 349, 346, 345, 344, 344, 342, - 340, 339, 337, 337, 336, 335, 333, 331, - 330, 329, 328, 326, 326, 324, 324, 322, - 321, 320, 318, 318, 318, 317, 315, 313, - 312, 311, 311, 310, 308, 307, 306, 306, - 304, 304, 302, 301, 300, 300, 299, 297, - 297, 296, 296, 294, 294, 292, 291, 291, - 291, 290, 288, 287, 286, 286, 287, 285, - 284, 283, 282, 282, 281, 281, 279, 278, - 278, 278, 276, 276, 275, 274, 274, 273, - 271, 270, 269, 268, 268, 267, 265, 262, - 261, 260, 260, 259, 257, 254, 252, 252, - 251, 251, 249, 246, 245, 244, 243, 242, - 240, 239, 239, 237, 235, 235, 233, 231, - 232, 230, 229, 226, 225, 224, 225, 224, - 223, 220, 219, 219, 218, 217, 217, 214, - 213, 213, 212, 211, 209, 209, 209, 208, - 206, 205, 204, 203, 204, 203, 201, 200, - 199, 197, 198, 198, 197, 195, 194, 194, - 193, 192, 192, 191, 189, 190, 189, 188, - 186, 187, 186, 185, 185, 184, 183, 181, - 183, 182, 181, 180, 179, 178, 178, 178, - 177, 176, 175, 176, 175, 174, 174, 173, - 172, 173, 172, 171, 170, 170, 169, 169, - 169, 168, 167, 166, 167, 167, 166, 165, - 164, 164, 164, 163, 164, 163, 162, 163, - 162, 161, 160, 161, 160, 160, 160, 159, - 158, 157, 158, 158, 157, 157, 156, 156, - 156, 156, 155, 155, 154, 154, 154, 154, - 154, 153, 152, 153, 152, 152, 151, 152, - 151, 152, 151, 150, 150, 149, 149, 150, - 149, 149, 148, 148, 148, 149, 148, 147, - 146, 146, 147, 146, 147, 146, 145, 146, - 146, 145, 144, 145, 144, 145, 144, 144, - 143, 143, 143, 144, 143, 142, 142, 142, - 142, 142, 142, 141, 141, 141, 141, 140, - 140, 141, 140, 140, 141, 140, 139, 139, - 139, 140, 139, 139, 138, 138, 137, 139, - 138, 138, 138, 137, 138, 137, 137, 137, - 137, 136, 137, 136, 136, 136, 136, 135, - 136, 135, 135, 135, 135, 136, 135, 135, - 134, 134, 133, 135, 134, 134, 134, 133, - 134, 133, 134, 133, 133, 132, 133, 133, - 132, 133, 132, 132, 132, 132, 131, 131, - 131, 132, 131, 131, 130, 131, 130, 132, - 131, 130, 130, 129, 130, 129, 130, 129, - 129, 129, 130, 129, 128, 128, 128, 128, - 129, 128, 128, 127, 127, 128, 128, 127, - 127, 126, 126, 127, 127, 126, 126, 126, - 127, 126, 126, 126, 125, 125, 126, 125, - 125, 124, 124, 124, 125, 125, 124, 124, - 123, 124, 124, 123, 123, 122, 122, 122, - 122, 122, 121, 120, 120, 119, 118, 118, - 118, 117, 117, 116, 115, 115, 115, 114, - 114, 113, 113, 112, 111, 111, 111, 110, - 110, 109, 109, 108, 108, 108, 107, 107, - 106, 106, 105, 105, 105, 104, 104, 103, - 103, 102, 102, 102, 102, 101, 101, 100, - 100, 99, 99, 99, 99, 99, 99, 98, - 97, 98, 97, 97, 97, 96, 96, 95, - 96, 95, 96, 95, 95, 94, 94, 95, - 94, 94, 94, 93, 93, 92, 93, 93, - 93, 93, 92, 92, 91, 92, 92, 92, - 91, 91, 90, 90, 91, 91, 91, 90, - 90, 90, 90, 91, 90, 90, 90, 89, - 89, 89, 90, 89, 89, 89, 89, 89, - 88, 89, 89, 88, 88, 88, 88, 87, - 89, 88, 88, 88, 88, 88, 87, 88, - 88, 88, 87, 87, 87, 87, 87, 88, - 87, 87, 87, 87, 87, 87, 88, 87, - 87, 87, 87, 86, 86, 87, 87, 87, - 87, 86, 86, 86, 87, 87, 86, 87, - 86, 86, 86, 87, 87, 86, 86, 86, - 86, 86, 87, 87, 86, 85, 85, 85, - 84, 85, 85, 84, 84, 83, 83, 82, - 82, 82, 81, 81, 80, 79, 79, 79, - 78, 77, 77, 76, 76, 76, 75, 74, - 74, 74, 73, 73, 72, 71, 71, 71, - 70, 70, 69, 69, 68, 68, 67, 67, - 67, 66, 66, 65, 65, 64, 64, 63, - 62, 62, 62, 61, 60, 60, 59, 59, - 58, 58, 57, 57, 56, 56, 56, 55, - 55, 54, 55, 55, 54, 53, 53, 52, - 53, 53, 52, 51, 51, 50, 51, 50, - 49, 49, 50, 49, 49, 48, 48, 47, - 47, 48, 46, 45, 45, 45, 46, 45, - 45, 44, 45, 45, 45, 43, 42, 42, - 41, 43, 41, 40, 40, 39, 40, 41, - 39, 39, 39, 39, 39, 38, 35, 35, - 34, 37, 36, 34, 33, 33, 33, 35, - 34, 32, 32, 31, 32, 30, 29, 26, - 25, 25, 27, 26, 23, 23, 23, 25, - 24, 24, 22, 21, 20, 19, 16, 14, - 13, 13, 13, 10, 9, 7, 7, 7, - 12, 12, 12, 7, 0, 0, 0, 0 -}; - -#else -#error "VAMEM version must be one of {VAMEM_VERSION_1, VAMEM_VERSION_2}" -#endif void ia_css_config_ctc_table(void) { -#if defined(HAS_VAMEM_VERSION_2) memcpy(default_ctc_table.data.vamem_2, default_ctc_table_data, sizeof(default_ctc_table_data)); default_ctc_table.vamem_type = IA_CSS_VAMEM_TYPE_2; -#else - memcpy(default_ctc_table.data.vamem_1, default_ctc_table_data, - sizeof(default_ctc_table_data)); - default_ctc_table.vamem_type = 1IA_CSS_VAMEM_TYPE_1; -#endif } diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c index f48f876777dc..7dbe2dc0591d 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c @@ -21,7 +21,6 @@ #include "ia_css_types.h" #include "ia_css_gc_table.host.h" -#if defined(HAS_VAMEM_VERSION_2) struct ia_css_gamma_table default_gamma_table; @@ -62,154 +61,11 @@ default_gamma_table_data[IA_CSS_VAMEM_2_GAMMA_TABLE_SIZE] = { 255 }; -#elif defined(HAS_VAMEM_VERSION_1) - -static const uint16_t -default_gamma_table_data[IA_CSS_VAMEM_1_GAMMA_TABLE_SIZE] = { - 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 16, - 17, 18, 19, 20, 21, 23, 24, 25, - 27, 28, 29, 31, 32, 33, 35, 36, - 38, 39, 41, 42, 44, 45, 47, 48, - 49, 51, 52, 54, 55, 57, 58, 60, - 61, 62, 64, 65, 66, 68, 69, 70, - 71, 72, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 93, 94, - 95, 96, 97, 98, 98, 99, 100, 101, - 102, 102, 103, 104, 105, 105, 106, 107, - 108, 108, 109, 110, 110, 111, 112, 112, - 113, 114, 114, 115, 116, 116, 117, 118, - 118, 119, 120, 120, 121, 121, 122, 123, - 123, 124, 125, 125, 126, 126, 127, 127, /* 128 */ - 128, 129, 129, 130, 130, 131, 131, 132, - 132, 133, 134, 134, 135, 135, 136, 136, - 137, 137, 138, 138, 139, 139, 140, 140, - 141, 141, 142, 142, 143, 143, 144, 144, - 145, 145, 145, 146, 146, 147, 147, 148, - 148, 149, 149, 150, 150, 150, 151, 151, - 152, 152, 152, 153, 153, 154, 154, 155, - 155, 155, 156, 156, 156, 157, 157, 158, - 158, 158, 159, 159, 160, 160, 160, 161, - 161, 161, 162, 162, 162, 163, 163, 163, - 164, 164, 164, 165, 165, 165, 166, 166, - 166, 167, 167, 167, 168, 168, 168, 169, - 169, 169, 170, 170, 170, 170, 171, 171, - 171, 172, 172, 172, 172, 173, 173, 173, - 174, 174, 174, 174, 175, 175, 175, 176, - 176, 176, 176, 177, 177, 177, 177, 178, /* 256 */ - 178, 178, 178, 179, 179, 179, 179, 180, - 180, 180, 180, 181, 181, 181, 181, 182, - 182, 182, 182, 182, 183, 183, 183, 183, - 184, 184, 184, 184, 184, 185, 185, 185, - 185, 186, 186, 186, 186, 186, 187, 187, - 187, 187, 187, 188, 188, 188, 188, 188, - 189, 189, 189, 189, 189, 190, 190, 190, - 190, 190, 191, 191, 191, 191, 191, 192, - 192, 192, 192, 192, 192, 193, 193, 193, - 193, 193, 194, 194, 194, 194, 194, 194, - 195, 195, 195, 195, 195, 195, 196, 196, - 196, 196, 196, 196, 197, 197, 197, 197, - 197, 197, 198, 198, 198, 198, 198, 198, - 198, 199, 199, 199, 199, 199, 199, 200, - 200, 200, 200, 200, 200, 200, 201, 201, - 201, 201, 201, 201, 201, 202, 202, 202, /* 384 */ - 202, 202, 202, 202, 203, 203, 203, 203, - 203, 203, 203, 204, 204, 204, 204, 204, - 204, 204, 204, 205, 205, 205, 205, 205, - 205, 205, 205, 206, 206, 206, 206, 206, - 206, 206, 206, 207, 207, 207, 207, 207, - 207, 207, 207, 208, 208, 208, 208, 208, - 208, 208, 208, 209, 209, 209, 209, 209, - 209, 209, 209, 209, 210, 210, 210, 210, - 210, 210, 210, 210, 210, 211, 211, 211, - 211, 211, 211, 211, 211, 211, 212, 212, - 212, 212, 212, 212, 212, 212, 212, 213, - 213, 213, 213, 213, 213, 213, 213, 213, - 214, 214, 214, 214, 214, 214, 214, 214, - 214, 214, 215, 215, 215, 215, 215, 215, - 215, 215, 215, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 217, 217, 217, /* 512 */ - 217, 217, 217, 217, 217, 217, 217, 218, - 218, 218, 218, 218, 218, 218, 218, 218, - 218, 219, 219, 219, 219, 219, 219, 219, - 219, 219, 219, 220, 220, 220, 220, 220, - 220, 220, 220, 220, 220, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, - 222, 222, 222, 222, 222, 222, 222, 222, - 222, 222, 223, 223, 223, 223, 223, 223, - 223, 223, 223, 223, 223, 224, 224, 224, - 224, 224, 224, 224, 224, 224, 224, 224, - 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 226, 226, 226, 226, 226, - 226, 226, 226, 226, 226, 226, 226, 227, - 227, 227, 227, 227, 227, 227, 227, 227, - 227, 227, 228, 228, 228, 228, 228, 228, - 228, 228, 228, 228, 228, 228, 229, 229, - 229, 229, 229, 229, 229, 229, 229, 229, - 229, 229, 230, 230, 230, 230, 230, 230, - 230, 230, 230, 230, 230, 230, 231, 231, - 231, 231, 231, 231, 231, 231, 231, 231, - 231, 231, 231, 232, 232, 232, 232, 232, - 232, 232, 232, 232, 232, 232, 232, 233, - 233, 233, 233, 233, 233, 233, 233, 233, - 233, 233, 233, 233, 234, 234, 234, 234, - 234, 234, 234, 234, 234, 234, 234, 234, - 234, 235, 235, 235, 235, 235, 235, 235, - 235, 235, 235, 235, 235, 235, 236, 236, - 236, 236, 236, 236, 236, 236, 236, 236, - 236, 236, 236, 236, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, - 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 240, 240, - 240, 240, 240, 240, 240, 240, 240, 240, - 240, 240, 240, 240, 241, 241, 241, 241, - 241, 241, 241, 241, 241, 241, 241, 241, - 241, 241, 241, 242, 242, 242, 242, 242, - 242, 242, 242, 242, 242, 242, 242, 242, - 242, 242, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, - 243, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 244, 244, - 245, 245, 245, 245, 245, 245, 245, 245, - 245, 245, 245, 245, 245, 245, 245, 246, - 246, 246, 246, 246, 246, 246, 246, 246, - 246, 246, 246, 246, 246, 246, 246, 247, - 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 247, 247, 247, 247, 247, 248, - 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 249, - 249, 249, 249, 249, 249, 249, 249, 249, - 249, 249, 249, 249, 249, 249, 249, 250, - 250, 250, 250, 250, 250, 250, 250, 250, - 250, 250, 250, 250, 250, 250, 250, 251, - 251, 251, 251, 251, 251, 251, 251, 251, - 251, 251, 251, 251, 251, 251, 251, 252, - 252, 252, 252, 252, 252, 252, 252, 252, - 252, 252, 252, 252, 252, 252, 252, 253, - 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, - 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, - 255, 255, 255, 255, 255, 255, 255, 255 -}; - -#else -#error "VAMEM version must be one of {VAMEM_VERSION_1, VAMEM_VERSION_2}" -#endif void ia_css_config_gamma_table(void) { -#if defined(HAS_VAMEM_VERSION_2) memcpy(default_gamma_table.data.vamem_2, default_gamma_table_data, sizeof(default_gamma_table_data)); default_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_2; -#else - memcpy(default_gamma_table.data.vamem_1, default_gamma_table_data, - sizeof(default_gamma_table_data)); - default_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_1; -#endif } diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c index 7eadb31268eb..34795011907a 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c @@ -27,7 +27,6 @@ struct ia_css_rgb_gamma_table default_b_gamma_table; /* Identical default gamma table for R, G, and B. */ -#if defined(HAS_VAMEM_VERSION_2) static const uint16_t default_gamma_table_data[IA_CSS_VAMEM_2_RGB_GAMMA_TABLE_SIZE] = { @@ -65,51 +64,10 @@ default_gamma_table_data[IA_CSS_VAMEM_2_RGB_GAMMA_TABLE_SIZE] = { 4032, 4040, 4048, 4056, 4064, 4072, 4080, 4088, 4095 }; -#elif defined(HAS_VAMEM_VERSION_1) - -static const uint16_t -default_gamma_table_data[IA_CSS_VAMEM_1_RGB_GAMMA_TABLE_SIZE] = { - 0, 72, 144, 216, 288, 360, 426, 486, - 541, 592, 641, 687, 730, 772, 812, 850, - 887, 923, 958, 991, 1024, 1055, 1086, 1117, - 1146, 1175, 1203, 1230, 1257, 1284, 1310, 1335, - 1360, 1385, 1409, 1433, 1457, 1480, 1502, 1525, - 1547, 1569, 1590, 1612, 1632, 1653, 1674, 1694, - 1714, 1734, 1753, 1772, 1792, 1811, 1829, 1848, - 1866, 1884, 1902, 1920, 1938, 1955, 1973, 1990, - 2007, 2024, 2040, 2057, 2074, 2090, 2106, 2122, - 2138, 2154, 2170, 2185, 2201, 2216, 2231, 2247, - 2262, 2277, 2291, 2306, 2321, 2335, 2350, 2364, - 2378, 2393, 2407, 2421, 2435, 2449, 2462, 2476, - 2490, 2503, 2517, 2530, 2543, 2557, 2570, 2583, - 2596, 2609, 2622, 2634, 2647, 2660, 2673, 2685, - 2698, 2710, 2722, 2735, 2747, 2759, 2771, 2783, - 2795, 2807, 2819, 2831, 2843, 2855, 2867, 2878, - 2890, 2901, 2913, 2924, 2936, 2947, 2958, 2970, - 2981, 2992, 3003, 3014, 3025, 3036, 3047, 3058, - 3069, 3080, 3091, 3102, 3112, 3123, 3134, 3144, - 3155, 3165, 3176, 3186, 3197, 3207, 3217, 3228, - 3238, 3248, 3258, 3268, 3279, 3289, 3299, 3309, - 3319, 3329, 3339, 3349, 3358, 3368, 3378, 3388, - 3398, 3407, 3417, 3427, 3436, 3446, 3455, 3465, - 3474, 3484, 3493, 3503, 3512, 3521, 3531, 3540, - 3549, 3559, 3568, 3577, 3586, 3595, 3605, 3614, - 3623, 3632, 3641, 3650, 3659, 3668, 3677, 3686, - 3694, 3703, 3712, 3721, 3730, 3739, 3747, 3756, - 3765, 3773, 3782, 3791, 3799, 3808, 3816, 3825, - 3833, 3842, 3850, 3859, 3867, 3876, 3884, 3893, - 3901, 3909, 3918, 3926, 3934, 3942, 3951, 3959, - 3967, 3975, 3984, 3992, 4000, 4008, 4016, 4024, - 4032, 4040, 4048, 4056, 4064, 4072, 4080, 4088 -}; -#else -#error "VAMEM version must be one of {VAMEM_VERSION_1, VAMEM_VERSION_2}" -#endif void ia_css_config_rgb_gamma_tables(void) { -#if defined(HAS_VAMEM_VERSION_2) default_r_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_2; default_g_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_2; default_b_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_2; @@ -119,15 +77,4 @@ ia_css_config_rgb_gamma_tables(void) sizeof(default_gamma_table_data)); memcpy(default_b_gamma_table.data.vamem_2, default_gamma_table_data, sizeof(default_gamma_table_data)); -#else - memcpy(default_r_gamma_table.data.vamem_1, default_gamma_table_data, - sizeof(default_gamma_table_data)); - memcpy(default_g_gamma_table.data.vamem_1, default_gamma_table_data, - sizeof(default_gamma_table_data)); - memcpy(default_b_gamma_table.data.vamem_1, default_gamma_table_data, - sizeof(default_gamma_table_data)); - default_r_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_1; - default_g_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_1; - default_b_gamma_table.vamem_type = IA_CSS_VAMEM_TYPE_1; -#endif } diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_param.h b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_param.h index 7ebf139f3618..93754f7c797d 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_param.h +++ b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_param.h @@ -20,15 +20,8 @@ #include #ifndef PIPE_GENERATION -#if defined(HAS_VAMEM_VERSION_2) #define SH_CSS_ISP_XNR_TABLE_SIZE_LOG2 IA_CSS_VAMEM_2_XNR_TABLE_SIZE_LOG2 #define SH_CSS_ISP_XNR_TABLE_SIZE IA_CSS_VAMEM_2_XNR_TABLE_SIZE -#elif defined(HAS_VAMEM_VERSION_1) -#define SH_CSS_ISP_XNR_TABLE_SIZE_LOG2 IA_CSS_VAMEM_1_XNR_TABLE_SIZE_LOG2 -#define SH_CSS_ISP_XNR_TABLE_SIZE IA_CSS_VAMEM_1_XNR_TABLE_SIZE -#else -#error "Unknown vamem type" -#endif #else /* For pipe generation, the size is not relevant */ diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c index 5566f3c16aac..e5c15308693d 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c @@ -23,7 +23,6 @@ struct ia_css_xnr_table default_xnr_table; -#if defined(HAS_VAMEM_VERSION_2) static const uint16_t default_xnr_table_data[IA_CSS_VAMEM_2_XNR_TABLE_SIZE] = { @@ -43,41 +42,11 @@ default_xnr_table_data[IA_CSS_VAMEM_2_XNR_TABLE_SIZE] = { 167 >> 1, 163 >> 1, 160 >> 1, 157 >> 1, 154 >> 1, 151 >> 1, 148 >> 1, 146 >> 1, 143 >> 1, 141 >> 1, 138 >> 1, 136 >> 1, 134 >> 1, 132 >> 1, 130 >> 1, 128 >> 1 }; -#elif defined(HAS_VAMEM_VERSION_1) - -static const uint16_t -default_xnr_table_data[IA_CSS_VAMEM_1_XNR_TABLE_SIZE] = { - /* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */ - 8191 >> 1, 4096 >> 1, 2730 >> 1, 2048 >> 1, 1638 >> 1, 1365 >> 1, 1170 >> 1, 1024 >> 1, 910 >> 1, 819 >> 1, 744 >> 1, 682 >> 1, 630 >> 1, 585 >> 1, - 546 >> 1, 512 >> 1, - - /* 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 */ - 481 >> 1, 455 >> 1, 431 >> 1, 409 >> 1, 390 >> 1, 372 >> 1, 356 >> 1, 341 >> 1, 327 >> 1, 315 >> 1, 303 >> 1, 292 >> 1, 282 >> 1, 273 >> 1, 264 >> 1, - 256 >> 1, - - /* 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 */ - 248 >> 1, 240 >> 1, 234 >> 1, 227 >> 1, 221 >> 1, 215 >> 1, 210 >> 1, 204 >> 1, 199 >> 1, 195 >> 1, 190 >> 1, 186 >> 1, 182 >> 1, 178 >> 1, 174 >> 1, - 170 >> 1, - - /* 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 */ - 167 >> 1, 163 >> 1, 160 >> 1, 157 >> 1, 154 >> 1, 151 >> 1, 148 >> 1, 146 >> 1, 143 >> 1, 141 >> 1, 138 >> 1, 136 >> 1, 134 >> 1, 132 >> 1, 130 >> 1, 128 >> 1 -}; - -#else -#error "sh_css_params.c: VAMEM version must \ -be one of {VAMEM_VERSION_1, VAMEM_VERSION_2}" -#endif void ia_css_config_xnr_table(void) { -#if defined(HAS_VAMEM_VERSION_2) memcpy(default_xnr_table.data.vamem_2, default_xnr_table_data, sizeof(default_xnr_table_data)); default_xnr_table.vamem_type = IA_CSS_VAMEM_TYPE_2; -#else - memcpy(default_xnr_table.data.vamem_1, default_xnr_table_data, - sizeof(default_xnr_table_data)); - default_xnr_table.vamem_type = IA_CSS_VAMEM_TYPE_1; -#endif } diff --git a/drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h b/drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h index cddf5882b76a..35f4528b724f 100644 --- a/drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h +++ b/drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h @@ -27,15 +27,11 @@ enum sh_css_queue_id { SH_CSS_QUEUE_E_ID, SH_CSS_QUEUE_F_ID, SH_CSS_QUEUE_G_ID, -#if defined(HAS_NO_INPUT_SYSTEM) - /* input frame queue for skycam */ - SH_CSS_QUEUE_H_ID, -#endif #if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) SH_CSS_QUEUE_H_ID, /* for metadata */ #endif -#if defined(HAS_NO_INPUT_SYSTEM) || defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) #define SH_CSS_MAX_NUM_QUEUES (SH_CSS_QUEUE_H_ID + 1) #else #define SH_CSS_MAX_NUM_QUEUES (SH_CSS_QUEUE_G_ID + 1) diff --git a/drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c b/drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c index 38e85735293b..0901c932bf28 100644 --- a/drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c +++ b/drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c @@ -47,13 +47,11 @@ struct sh_css_queues { /* SP2Host event queue */ ia_css_queue_t sp2host_psys_event_queue_handle; -#if !defined(HAS_NO_INPUT_SYSTEM) /* Host2SP ISYS event queue */ ia_css_queue_t host2sp_isys_event_queue_handle; /* SP2Host ISYS event queue */ ia_css_queue_t sp2host_isys_event_queue_handle; -#endif /* Tagger command queue */ ia_css_queue_t host2sp_tag_cmd_queue_handle; }; @@ -231,14 +229,12 @@ static ia_css_queue_t *bufq_get_qhandle( case sh_css_sp2host_psys_event_queue: q = &css_queues.sp2host_psys_event_queue_handle; break; -#if !defined(HAS_NO_INPUT_SYSTEM) case sh_css_host2sp_isys_event_queue: q = &css_queues.host2sp_isys_event_queue_handle; break; case sh_css_sp2host_isys_event_queue: q = &css_queues.sp2host_isys_event_queue_handle; break; -#endif case sh_css_host2sp_tag_cmd_queue: q = &css_queues.host2sp_tag_cmd_queue_handle; break; @@ -307,7 +303,6 @@ void ia_css_bufq_init(void) (uint32_t)offsetof(struct host_sp_queues, sp2host_psys_event_queue_elems), &css_queues.sp2host_psys_event_queue_handle); -#if !defined(HAS_NO_INPUT_SYSTEM) /* Host2SP ISYS event queue */ init_bufq((uint32_t)offsetof(struct host_sp_queues, host2sp_isys_event_queue_desc), @@ -324,7 +319,6 @@ void ia_css_bufq_init(void) init_bufq((uint32_t)offsetof(struct host_sp_queues, host2sp_tag_cmd_queue_desc), (uint32_t)offsetof(struct host_sp_queues, host2sp_tag_cmd_queue_elems), &css_queues.host2sp_tag_cmd_queue_handle); -#endif IA_CSS_LEAVE_PRIVATE(""); } @@ -434,7 +428,6 @@ int ia_css_bufq_dequeue_psys_event( int ia_css_bufq_dequeue_isys_event( u8 item[BUFQ_EVENT_SIZE]) { -#if !defined(HAS_NO_INPUT_SYSTEM) int error = 0; ia_css_queue_t *q; @@ -451,15 +444,10 @@ int ia_css_bufq_dequeue_isys_event( } error = ia_css_eventq_recv(q, item); return error; -#else - (void)item; - return -EBUSY; -#endif } int ia_css_bufq_enqueue_isys_event(uint8_t evt_id) { -#if !defined(HAS_NO_INPUT_SYSTEM) int error = 0; ia_css_queue_t *q; @@ -474,16 +462,11 @@ int ia_css_bufq_enqueue_isys_event(uint8_t evt_id) IA_CSS_LEAVE_ERR_PRIVATE(error); return error; -#else - (void)evt_id; - return -EBUSY; -#endif } int ia_css_bufq_enqueue_tag_cmd( uint32_t item) { -#if !defined(HAS_NO_INPUT_SYSTEM) int error; ia_css_queue_t *q; @@ -497,10 +480,6 @@ int ia_css_bufq_enqueue_tag_cmd( IA_CSS_LEAVE_ERR_PRIVATE(error); return error; -#else - (void)item; - return -EBUSY; -#endif } int ia_css_bufq_deinit(void) @@ -545,12 +524,10 @@ void ia_css_bufq_dump_queue_info(void) bufq_dump_queue_info("sp2host_psys_event", &css_queues.sp2host_psys_event_queue_handle); -#if !defined(HAS_NO_INPUT_SYSTEM) bufq_dump_queue_info("host2sp_isys_event", &css_queues.host2sp_isys_event_queue_handle); bufq_dump_queue_info("sp2host_isys_event", &css_queues.sp2host_isys_event_queue_handle); bufq_dump_queue_info("host2sp_tag_cmd", &css_queues.host2sp_tag_cmd_queue_handle); -#endif } diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c index 2bca27a04b02..56d5d90634fa 100644 --- a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c @@ -62,17 +62,13 @@ #include "isp.h" #include "type_support.h" #include "math_support.h" /* CEIL_DIV */ -#if defined(HAS_INPUT_FORMATTER_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) #include "input_system.h" /* input_formatter_reg_load */ -#endif #if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) #include "ia_css_tagger_common.h" #endif #include "sh_css_internal.h" -#if !defined(HAS_NO_INPUT_SYSTEM) #include "ia_css_isys.h" -#endif #include "sh_css_sp.h" /* sh_css_sp_get_debug_state() */ #include "css_trace.h" /* tracer */ @@ -501,12 +497,10 @@ void ia_css_debug_dump_sp_state(void) sp_get_state(SP0_ID, &state, &stall); debug_print_sp_state(&state, "SP"); if (state.is_stalling) { -#if !defined(HAS_NO_INPUT_SYSTEM) ia_css_debug_dtrace(2, "\t%-32s: %d\n", "isys_FIFO stalled", stall.fifo0); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "if_sec_FIFO stalled", stall.fifo1); -#endif ia_css_debug_dtrace(2, "\t%-32s: %d\n", "str_to_mem_FIFO stalled", stall.fifo2); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "dma_FIFO stalled", @@ -674,7 +668,6 @@ static void debug_print_if_state(input_formatter_state_t *state, const char *id) ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "Block when no request", st_block_fifo_when_no_req); -#if defined(HAS_INPUT_FORMATTER_VERSION_2) ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "IF_BLOCKED_FIFO_NO_REQ_ADDRESS", input_formatter_reg_load(INPUT_FORMATTER0_ID, @@ -737,7 +730,6 @@ static void debug_print_if_state(input_formatter_state_t *state, const char *id) "_REG_GP_IFMT_slv_reg_srst", gp_device_reg_load(GP_DEVICE0_ID, _REG_GP_IFMT_slv_reg_srst)); -#endif ia_css_debug_dtrace(2, "\tFSM Status:\n"); @@ -1704,7 +1696,7 @@ void ia_css_debug_print_sp_debug_state(const struct sh_css_sp_debug_state } #endif -#if defined(HAS_INPUT_FORMATTER_VERSION_2) && !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(HAS_NO_INPUT_FORMATTER) static void debug_print_rx_mipi_port_state(mipi_port_state_t *state) { int i; @@ -1901,10 +1893,10 @@ static void debug_print_rx_state(receiver_state_t *state) } #endif -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if defined(USE_INPUT_SYSTEM_VERSION_2) void ia_css_debug_dump_rx_state(void) { -#if defined(HAS_INPUT_FORMATTER_VERSION_2) && !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(HAS_NO_INPUT_FORMATTER) receiver_state_t state; receiver_get_state(RX0_ID, &state); @@ -2174,7 +2166,7 @@ void ia_css_debug_dump_isys_state(void) return; } #endif -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(USE_INPUT_SYSTEM_VERSION_2401) void ia_css_debug_dump_isys_state(void) { /* Android compilation fails if made a local variable @@ -2195,7 +2187,7 @@ void ia_css_debug_dump_debug_info(const char *context) context = "No Context provided"; ia_css_debug_dtrace(2, "CSS Debug Info dump [Context = %s]\n", context); -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if defined(USE_INPUT_SYSTEM_VERSION_2) ia_css_debug_dump_rx_state(); #endif #if !defined(HAS_NO_INPUT_FORMATTER) && defined(USE_INPUT_SYSTEM_VERSION_2) @@ -2243,7 +2235,7 @@ void ia_css_debug_dump_debug_info(const char *context) state.irq_level_not_pulse); } #endif -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(USE_INPUT_SYSTEM_VERSION_2401) ia_css_debug_dump_isys_state(); #endif #if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) @@ -2449,7 +2441,7 @@ void ia_css_debug_dump_isp_binary(void) void ia_css_debug_dump_perf_counters(void) { -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if defined(USE_INPUT_SYSTEM_VERSION_2) const struct ia_css_fw_info *fw; int i; unsigned int HIVE_ADDR_ia_css_isys_sp_error_cnt; diff --git a/drivers/staging/media/atomisp/pci/runtime/inputfifo/src/inputfifo.c b/drivers/staging/media/atomisp/pci/runtime/inputfifo/src/inputfifo.c index 38712530f566..2d06e124007e 100644 --- a/drivers/staging/media/atomisp/pci/runtime/inputfifo/src/inputfifo.c +++ b/drivers/staging/media/atomisp/pci/runtime/inputfifo/src/inputfifo.c @@ -32,24 +32,18 @@ #include "event_fifo.h" #define __INLINE_SP__ -#if !defined(HAS_NO_INPUT_SYSTEM) #include "input_system.h" /* MIPI_PREDICTOR_NONE,... */ -#endif #include "assert_support.h" /* System independent */ #include "sh_css_internal.h" -#if !defined(HAS_NO_INPUT_SYSTEM) #include "ia_css_isys.h" -#endif #define HBLANK_CYCLES (187) #define MARKER_CYCLES (6) -#if !defined(HAS_NO_INPUT_SYSTEM) #include -#endif /* The data type is used to send special cases: * yuv420: odd lines (1, 3 etc) are twice as wide as even @@ -67,9 +61,7 @@ enum inputfifo_mipi_data_type { inputfifo_mipi_data_type_rgb, }; -#if !defined(HAS_NO_INPUT_SYSTEM) static unsigned int inputfifo_curr_ch_id, inputfifo_curr_fmt_type; -#endif struct inputfifo_instance { unsigned int ch_id; enum atomisp_input_format input_format; @@ -81,7 +73,6 @@ struct inputfifo_instance { enum inputfifo_mipi_data_type type; }; -#if !defined(HAS_NO_INPUT_SYSTEM) /* * Maintain a basic streaming to Mipi administration with ch_id as index * ch_id maps on the "Mipi virtual channel ID" and can have value 0..3 @@ -536,4 +527,3 @@ void ia_css_inputfifo_end_frame( s2mi->streaming = false; return; } -#endif /* #if !defined(HAS_NO_INPUT_SYSTEM) */ diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c index de442f1fa6ba..13cb02ac2651 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c @@ -15,7 +15,6 @@ #include "input_system.h" -#ifdef HAS_INPUT_SYSTEM_VERSION_2 #include "ia_css_isys.h" #include "platform_support.h" @@ -121,4 +120,3 @@ void ia_css_isys_uninit(void) } #endif -#endif diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c index 4f0dcdfa13be..fa87afaff6e5 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c @@ -28,9 +28,7 @@ void ia_css_isys_rx_enable_all_interrupts(enum mipi_port_id port) _HRT_CSS_RECEIVER_IRQ_ENABLE_REG_IDX); bits |= (1U << _HRT_CSS_RECEIVER_IRQ_OVERRUN_BIT) | -#if defined(HAS_RX_VERSION_2) (1U << _HRT_CSS_RECEIVER_IRQ_INIT_TIMEOUT_BIT) | -#endif (1U << _HRT_CSS_RECEIVER_IRQ_SLEEP_MODE_ENTRY_BIT) | (1U << _HRT_CSS_RECEIVER_IRQ_SLEEP_MODE_EXIT_BIT) | (1U << _HRT_CSS_RECEIVER_IRQ_ERR_SOT_HS_BIT) | @@ -117,10 +115,8 @@ unsigned int ia_css_isys_rx_translate_irq_infos(unsigned int bits) if (bits & (1U << _HRT_CSS_RECEIVER_IRQ_OVERRUN_BIT)) infos |= IA_CSS_RX_IRQ_INFO_BUFFER_OVERRUN; -#if defined(HAS_RX_VERSION_2) if (bits & (1U << _HRT_CSS_RECEIVER_IRQ_INIT_TIMEOUT_BIT)) infos |= IA_CSS_RX_IRQ_INFO_INIT_TIMEOUT; -#endif if (bits & (1U << _HRT_CSS_RECEIVER_IRQ_SLEEP_MODE_ENTRY_BIT)) infos |= IA_CSS_RX_IRQ_INFO_ENTER_SLEEP_MODE; if (bits & (1U << _HRT_CSS_RECEIVER_IRQ_SLEEP_MODE_EXIT_BIT)) @@ -176,10 +172,8 @@ void ia_css_isys_rx_clear_irq_info(enum mipi_port_id port, /* MW: Why do we remap the receiver bitmap */ if (irq_infos & IA_CSS_RX_IRQ_INFO_BUFFER_OVERRUN) bits |= 1U << _HRT_CSS_RECEIVER_IRQ_OVERRUN_BIT; -#if defined(HAS_RX_VERSION_2) if (irq_infos & IA_CSS_RX_IRQ_INFO_INIT_TIMEOUT) bits |= 1U << _HRT_CSS_RECEIVER_IRQ_INIT_TIMEOUT_BIT; -#endif if (irq_infos & IA_CSS_RX_IRQ_INFO_ENTER_SLEEP_MODE) bits |= 1U << _HRT_CSS_RECEIVER_IRQ_SLEEP_MODE_ENTRY_BIT; if (irq_infos & IA_CSS_RX_IRQ_INFO_EXIT_SLEEP_MODE) @@ -484,7 +478,6 @@ unsigned int ia_css_csi2_calculate_input_system_alignment( void ia_css_isys_rx_configure(const rx_cfg_t *config, const enum ia_css_input_mode input_mode) { -#if defined(HAS_RX_VERSION_2) bool port_enabled[N_MIPI_PORT_ID]; bool any_port_enabled = false; enum mipi_port_id port; @@ -580,9 +573,6 @@ void ia_css_isys_rx_configure(const rx_cfg_t *config, * INPUT_SYSTEM_CSI_RECEIVER_SELECT_BACKENG, 1); */ input_system_reg_store(INPUT_SYSTEM0_ID, 0x207, 1); -#else -#error "rx.c: RX version must be one of {RX_VERSION_2}" -#endif return; } diff --git a/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c b/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c index 4b8e85bc2122..e34df58b124a 100644 --- a/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c +++ b/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c @@ -140,9 +140,7 @@ void ia_css_pipeline_start(enum ia_css_pipe_id pipe_id, false, false, false, true, SH_CSS_BDS_FACTOR_1_00, SH_CSS_PIPE_CONFIG_OVRD_NO_OVRD, IA_CSS_INPUT_MODE_MEMORY, NULL, NULL, -#if !defined(HAS_NO_INPUT_SYSTEM) (enum mipi_port_id)0, -#endif NULL, NULL); ia_css_pipeline_get_sp_thread_id(pipe_num, &thread_id); diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index 8473e1437074..4f7984b75abc 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -27,9 +27,7 @@ #include "sh_css_internal.h" #include "sh_css_mipi.h" #include "sh_css_sp.h" /* sh_css_sp_group */ -#if !defined(HAS_NO_INPUT_SYSTEM) #include "ia_css_isys.h" -#endif #include "ia_css_frame.h" #include "sh_css_defs.h" #include "sh_css_firmware.h" @@ -62,9 +60,7 @@ #if !defined(HAS_NO_INPUT_FORMATTER) #include "ia_css_ifmtr.h" #endif -#if !defined(HAS_NO_INPUT_SYSTEM) #include "input_system.h" -#endif #include "mmu_device.h" /* mmu_set_page_table_base_index(), ... */ #include "ia_css_mmu_private.h" /* sh_css_mmu_set_page_table_base_index() */ #include "gdc_device.h" /* HRT_GDC_N */ @@ -533,7 +529,7 @@ ia_css_stream_input_format_bits_per_pixel(struct ia_css_stream *stream) #define GP_ISEL_TPG_MODE 0x90058 -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if defined(USE_INPUT_SYSTEM_VERSION_2) static int sh_css_config_input_network(struct ia_css_stream *stream) { unsigned int fmt_type; @@ -594,7 +590,7 @@ sh_css_config_input_network(struct ia_css_stream *stream) { "sh_css_config_input_network() leave:\n"); return 0; } -#elif !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401) +#elif defined(USE_INPUT_SYSTEM_VERSION_2401) static unsigned int csi2_protocol_calculate_max_subpixels_per_line( enum atomisp_input_format format, unsigned int pixels_per_line) @@ -1375,12 +1371,7 @@ start_binary(struct ia_css_pipe *pipe, (void)binary; -#if !defined(HAS_NO_INPUT_SYSTEM) stream = pipe->stream; -#else - (void)pipe; - (void)stream; -#endif if (binary) sh_css_metrics_start_binary(&binary->metrics); @@ -1395,7 +1386,7 @@ start_binary(struct ia_css_pipe *pipe, sh_binary_running = true; #endif -#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(USE_INPUT_SYSTEM_VERSION_2401) if (stream->reconfigure_css_rx) { ia_css_isys_rx_configure(&pipe->stream->csi_rx_config, pipe->stream->config.mode); @@ -1415,7 +1406,7 @@ start_copy_on_sp(struct ia_css_pipe *pipe, if ((!pipe) || (!pipe->stream)) return -EINVAL; -#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(USE_INPUT_SYSTEM_VERSION_2401) if (pipe->stream->reconfigure_css_rx) ia_css_isys_rx_disable(); #endif @@ -1424,7 +1415,7 @@ start_copy_on_sp(struct ia_css_pipe *pipe, return -EINVAL; sh_css_sp_start_binary_copy(ia_css_pipe_get_pipe_num(pipe), out_frame, pipe->stream->config.pixels_per_clock == 2); -#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(USE_INPUT_SYSTEM_VERSION_2401) if (pipe->stream->reconfigure_css_rx) { ia_css_isys_rx_configure(&pipe->stream->csi_rx_config, @@ -1461,9 +1452,6 @@ static void start_pipe( const struct ia_css_coordinate *coord = NULL; const struct ia_css_isp_parameters *params = NULL; -#if defined(HAS_NO_INPUT_SYSTEM) - (void)input_mode; -#endif IA_CSS_ENTER_PRIVATE("me = %p, copy_ovrd = %d, input_mode = %d", me, copy_ovrd, input_mode); @@ -1487,11 +1475,9 @@ static void start_pipe( input_mode, &me->stream->config.metadata_config, &me->stream->info.metadata_info -#if !defined(HAS_NO_INPUT_SYSTEM) , (input_mode == IA_CSS_INPUT_MODE_MEMORY) ? (enum mipi_port_id)0 : me->stream->config.source.port.port, -#endif coord, params); @@ -1551,13 +1537,6 @@ enable_interrupts(enum ia_css_irq_type irq_type) cnd_virq_enable_channel( (enum virq_id)(IRQ_SW_CHANNEL1_ID + IRQ_SW_CHANNEL_OFFSET), true); -#if !defined(HAS_IRQ_MAP_VERSION_2) - /* IRQ_SW_CHANNEL2_ID does not exist on 240x systems */ - cnd_virq_enable_channel( - (enum virq_id)(IRQ_SW_CHANNEL2_ID + IRQ_SW_CHANNEL_OFFSET), - true); - virq_clear_all(); -#endif #ifdef USE_INPUT_SYSTEM_VERSION_2 for (port = 0; port < N_MIPI_PORT_ID; port++) @@ -1832,15 +1811,10 @@ ia_css_init(struct device *dev, const struct ia_css_env *env, sh_css_init_buffer_queues(); */ -#if defined(HAS_INPUT_SYSTEM_VERSION_2) && defined(HAS_INPUT_SYSTEM_VERSION_2401) -#if defined(USE_INPUT_SYSTEM_VERSION_2) - gp_device_reg_store(GP_DEVICE0_ID, _REG_GP_SWITCH_ISYS2401_ADDR, 0); -#elif defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(HAS_INPUT_SYSTEM_VERSION_2401) gp_device_reg_store(GP_DEVICE0_ID, _REG_GP_SWITCH_ISYS2401_ADDR, 1); #endif -#endif -#if !defined(HAS_NO_INPUT_SYSTEM) if (!IS_ISP2401) dma_set_max_burst_size(DMA0_ID, HIVE_DMA_BUS_DDR_CONN, @@ -1851,7 +1825,6 @@ ia_css_init(struct device *dev, const struct ia_css_env *env, if (ia_css_isys_init() != INPUT_SYSTEM_ERR_NO_ERROR) err = -EINVAL; -#endif sh_css_params_map_and_store_default_gdc_lut(); @@ -2542,14 +2515,11 @@ ia_css_uninit(void) sh_css_sp_reset_global_vars(); -#if !defined(HAS_NO_INPUT_SYSTEM) ia_css_isys_uninit(); -#endif ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_uninit() leave: return_void\n"); } -#if defined(HAS_IRQ_MAP_VERSION_2) int ia_css_irq_translate( unsigned int *irq_infos) { @@ -2581,7 +2551,6 @@ int ia_css_irq_translate( break; case virq_isp: break; -#if !defined(HAS_NO_INPUT_SYSTEM) case virq_isys_sof: infos |= IA_CSS_IRQ_INFO_CSS_RECEIVER_SOF; break; @@ -2591,7 +2560,6 @@ int ia_css_irq_translate( case virq_isys_csi: infos |= IA_CSS_IRQ_INFO_INPUT_SYSTEM_ERROR; break; -#endif #if !defined(HAS_NO_INPUT_FORMATTER) case virq_ifmt0_id: infos |= IA_CSS_IRQ_INFO_IF_ERROR; @@ -2672,9 +2640,6 @@ int ia_css_irq_enable( return 0; } -#else -#error "sh_css.c: IRQ MAP must be one of { IRQ_MAP_VERSION_2 }" -#endif static unsigned int sh_css_get_sw_interrupt_value(unsigned int irq) @@ -4050,9 +4015,7 @@ preview_start(struct ia_css_pipe *pipe) { pipe->stream->config.mode, &pipe->stream->config.metadata_config, &pipe->stream->info.metadata_info, -#if !defined(HAS_NO_INPUT_SYSTEM) pipe->stream->config.source.port.port, -#endif coord, params); @@ -4076,9 +4039,7 @@ preview_start(struct ia_css_pipe *pipe) { IA_CSS_INPUT_MODE_MEMORY, &pipe->stream->config.metadata_config, &pipe->stream->info.metadata_info, -#if !defined(HAS_NO_INPUT_SYSTEM) (enum mipi_port_id)0, -#endif coord, params); } @@ -4097,9 +4058,7 @@ preview_start(struct ia_css_pipe *pipe) { IA_CSS_INPUT_MODE_MEMORY, NULL, NULL, -#if !defined(HAS_NO_INPUT_SYSTEM) (enum mipi_port_id)0, -#endif coord, params); } @@ -5286,7 +5245,7 @@ sh_css_pipes_have_stopped(struct ia_css_stream *stream) return rval; } -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if defined(USE_INPUT_SYSTEM_VERSION_2) unsigned int sh_css_get_mipi_sizes_for_check(const unsigned int port, const unsigned int idx) { @@ -5413,13 +5372,7 @@ sh_css_pipe_get_grid_info(struct ia_css_pipe *pipe, info->isp_in_height = binary->internal_frame_info.res.height; } -#if defined(HAS_VAMEM_VERSION_2) info->vamem_type = IA_CSS_VAMEM_TYPE_2; -#elif defined(HAS_VAMEM_VERSION_1) - info->vamem_type = IA_CSS_VAMEM_TYPE_1; -#else -#error "Unknown VAMEM version" -#endif ERR : IA_CSS_LEAVE_ERR_PRIVATE(err); @@ -5867,9 +5820,7 @@ static int video_start(struct ia_css_pipe *pipe) pipe->stream->config.mode, &pipe->stream->config.metadata_config, &pipe->stream->info.metadata_info, -#if !defined(HAS_NO_INPUT_SYSTEM) pipe->stream->config.source.port.port, -#endif coord, params); @@ -5892,9 +5843,7 @@ static int video_start(struct ia_css_pipe *pipe) IA_CSS_INPUT_MODE_MEMORY, &pipe->stream->config.metadata_config, &pipe->stream->info.metadata_info, -#if !defined(HAS_NO_INPUT_SYSTEM) (enum mipi_port_id)0, -#endif coord, params); } @@ -6754,7 +6703,7 @@ static int load_capture_binaries( switch (pipe->config.default_capture_config.mode) { case IA_CSS_CAPTURE_MODE_RAW: err = load_copy_binaries(pipe); -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(USE_INPUT_SYSTEM_VERSION_2401) if (!err) pipe->pipe_settings.capture.copy_binary.online = pipe->stream->config.online; #endif @@ -7409,7 +7358,7 @@ static int yuvpp_start(struct ia_css_pipe *pipe) /* multi stream video needs mipi buffers */ -#if !defined(HAS_NO_INPUT_SYSTEM) && (defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)) +#if (defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)) err = send_mipi_frames(pipe); if (err) { IA_CSS_LEAVE_ERR_PRIVATE(err); @@ -7989,7 +7938,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) { { if (raw) { ia_css_pipe_util_set_output_frames(out_frames, 0, out_frame); -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(USE_INPUT_SYSTEM_VERSION_2401) if (!continuous) { ia_css_pipe_get_generic_stage_desc(&stage_desc, copy_binary, out_frames, in_frame, NULL); @@ -8282,7 +8231,7 @@ static int capture_start( } start_pipe(pipe, copy_ovrd, pipe->stream->config.mode); -#if !defined(HAS_NO_INPUT_SYSTEM) && !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(USE_INPUT_SYSTEM_VERSION_2401) /* * old isys: for IA_CSS_PIPE_MODE_COPY pipe, isys rx has to be configured, * which is currently done in start_binary(); but COPY pipe contains no binary, @@ -8332,7 +8281,6 @@ sh_css_pipe_get_output_frame_info(struct ia_css_pipe *pipe, return 0; } -#if !defined(HAS_NO_INPUT_SYSTEM) void ia_css_stream_send_input_frame(const struct ia_css_stream *stream, const unsigned short *data, @@ -8387,7 +8335,6 @@ ia_css_stream_end_input_frame(const struct ia_css_stream *stream) { ia_css_inputfifo_end_frame(stream->config.channel_id); } -#endif static void append_firmware(struct ia_css_fw_info **l, struct ia_css_fw_info *firmware) { @@ -8762,12 +8709,10 @@ sh_css_init_host_sp_control_vars(void) { #endif store_sp_array_uint(host_sp_com, o, host2sp_cmd_ready); -#if !defined(HAS_NO_INPUT_SYSTEM) for (i = 0; i < N_CSI_PORTS; i++) { sh_css_update_host2sp_num_mipi_frames (my_css.num_mipi_frames[i]); } -#endif ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "sh_css_init_host_sp_control_vars() leave: return_void\n"); @@ -9363,7 +9308,6 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, } #endif -#if !defined(HAS_NO_INPUT_SYSTEM) ia_css_debug_pipe_graph_dump_stream_config(stream_config); /* check if mipi size specified */ @@ -9408,7 +9352,6 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, return err; } } -#endif /* Currently we only supported metadata up to a certain size. */ err = metadata_info_init(&stream_config->metadata_config, &md_info); @@ -9484,7 +9427,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, #endif break; case IA_CSS_INPUT_MODE_TPG: -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if defined(USE_INPUT_SYSTEM_VERSION_2) IA_CSS_LOG("tpg_configuration: x_mask=%d, y_mask=%d, x_delta=%d, y_delta=%d, xy_mask=%d", curr_stream->config.source.tpg.x_mask, curr_stream->config.source.tpg.y_mask, @@ -9501,7 +9444,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, #endif break; case IA_CSS_INPUT_MODE_PRBS: -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if defined(USE_INPUT_SYSTEM_VERSION_2) IA_CSS_LOG("mode prbs"); sh_css_sp_configure_prbs(curr_stream->config.source.prbs.seed); #endif @@ -10003,15 +9946,13 @@ ia_css_stream_start(struct ia_css_stream *stream) { return err; } -#if !defined(HAS_NO_INPUT_SYSTEM) #if defined(USE_INPUT_SYSTEM_VERSION_2401) if ((stream->config.mode == IA_CSS_INPUT_MODE_SENSOR) || (stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR)) stream_register_with_csi_rx(stream); #endif -#endif -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if defined(USE_INPUT_SYSTEM_VERSION_2) /* Initialize mipi size checks */ if (stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR) { @@ -10025,14 +9966,12 @@ ia_css_stream_start(struct ia_css_stream *stream) { } #endif -#if !defined(HAS_NO_INPUT_SYSTEM) if (stream->config.mode != IA_CSS_INPUT_MODE_MEMORY) { err = sh_css_config_input_network(stream); if (err) return err; } -#endif /* !HAS_NO_INPUT_SYSTEM */ err = sh_css_pipe_start(stream); IA_CSS_LEAVE_ERR(err); @@ -10049,7 +9988,7 @@ ia_css_stream_stop(struct ia_css_stream *stream) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_stream_stop: stopping %d\n", stream->last_pipe->mode); -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if defined(USE_INPUT_SYSTEM_VERSION_2) /* De-initialize mipi size checks */ if (stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR) { @@ -10527,7 +10466,7 @@ void ia_css_pipe_map_queue(struct ia_css_pipe *pipe, bool map) ia_css_pipeline_get_sp_thread_id(pipe_num, &thread_id); -#if defined(HAS_NO_INPUT_SYSTEM) || defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(USE_INPUT_SYSTEM_VERSION_2401) need_input_queue = true; #else need_input_queue = pipe->stream->config.mode == IA_CSS_INPUT_MODE_MEMORY; diff --git a/drivers/staging/media/atomisp/pci/sh_css_hrt.c b/drivers/staging/media/atomisp/pci/sh_css_hrt.c index 06b502151af9..879c85311038 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_hrt.c +++ b/drivers/staging/media/atomisp/pci/sh_css_hrt.c @@ -64,11 +64,7 @@ bool sh_css_hrt_system_is_idle(void) int sh_css_hrt_sp_wait(void) { -#if defined(HAS_IRQ_MAP_VERSION_2) irq_sw_channel_id_t irq_id = IRQ_SW_CHANNEL0_ID; -#else - irq_sw_channel_id_t irq_id = IRQ_SW_CHANNEL2_ID; -#endif /* * Wait till SP is idle or till there is a SW2 interrupt * The SW2 interrupt will be used when frameloop runs on SP diff --git a/drivers/staging/media/atomisp/pci/sh_css_internal.h b/drivers/staging/media/atomisp/pci/sh_css_internal.h index 5c25a25dce92..54847abf667a 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_internal.h +++ b/drivers/staging/media/atomisp/pci/sh_css_internal.h @@ -400,7 +400,7 @@ struct sh_css_sp_config { set[SH_CSS_MAX_IF_CONFIGS]; /* CSI-2 port is used as index. */ } input_formatter; #endif -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if defined(USE_INPUT_SYSTEM_VERSION_2) sync_generator_cfg_t sync_gen; tpg_cfg_t tpg; prbs_cfg_t prbs; @@ -423,7 +423,7 @@ enum sh_css_stage_type { #define SH_CSS_PIPE_CONFIG_SAMPLE_PARAMS_MASK \ ((SH_CSS_PIPE_CONFIG_SAMPLE_PARAMS << SH_CSS_MAX_SP_THREADS) - 1) -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(USE_INPUT_SYSTEM_VERSION_2401) struct sh_css_sp_pipeline_terminal { union { /* Input System 2401 */ @@ -679,7 +679,7 @@ struct sh_css_sp_stage { struct sh_css_sp_group { struct sh_css_sp_config config; struct sh_css_sp_pipeline pipe[SH_CSS_MAX_SP_THREADS]; -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(USE_INPUT_SYSTEM_VERSION_2401) struct sh_css_sp_pipeline_io pipe_io[SH_CSS_MAX_SP_THREADS]; struct sh_css_sp_pipeline_io_status pipe_io_status; #endif @@ -987,7 +987,7 @@ sh_css_frame_info_set_width(struct ia_css_frame_info *info, unsigned int width, unsigned int aligned); -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if defined(USE_INPUT_SYSTEM_VERSION_2) unsigned int sh_css_get_mipi_sizes_for_check(const unsigned int port, diff --git a/drivers/staging/media/atomisp/pci/sh_css_mipi.c b/drivers/staging/media/atomisp/pci/sh_css_mipi.c index 2ef5dbd62a6d..a0be171fba83 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_mipi.c +++ b/drivers/staging/media/atomisp/pci/sh_css_mipi.c @@ -246,7 +246,7 @@ ia_css_mipi_frame_calculate_size(const unsigned int width, return err; } -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if defined(USE_INPUT_SYSTEM_VERSION_2) int ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port, const unsigned int size_mem_words) { diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c index ba42be9b06eb..6d827ec67192 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c @@ -143,7 +143,6 @@ static int interleaved_lut_temp[4][HRT_GDC_N]; /* Digital Zoom lookup table. See documentation for more details about the * contents of this table. */ -#if defined(HAS_GDC_VERSION_2) #if defined(CONFIG_CSI2_PLUS) /* * Coefficients from @@ -1196,10 +1195,6 @@ static const int zoom_table[4][HRT_GDC_N] = { } }; #endif -#else -#error "sh_css_params.c: GDC version must be \ -one of {GDC_VERSION_2}" -#endif static const struct ia_css_dz_config default_dz_config = { HRT_GDC_N, diff --git a/drivers/staging/media/atomisp/pci/sh_css_properties.c b/drivers/staging/media/atomisp/pci/sh_css_properties.c index de588f9bd540..8ecd93d65a68 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_properties.c +++ b/drivers/staging/media/atomisp/pci/sh_css_properties.c @@ -22,23 +22,13 @@ void ia_css_get_properties(struct ia_css_properties *properties) { assert(properties); -#if defined(HAS_GDC_VERSION_2) || defined(HAS_GDC_VERSION_3) /* * MW: We don't want to store the coordinates * full range in memory: Truncate */ properties->gdc_coord_one = gdc_get_unity(GDC0_ID) / HRT_GDC_COORD_SCALE; -#else -#error "Unknown GDC version" -#endif properties->l1_base_is_index = true; -#if defined(HAS_VAMEM_VERSION_1) - properties->vamem_type = IA_CSS_VAMEM_TYPE_1; -#elif defined(HAS_VAMEM_VERSION_2) properties->vamem_type = IA_CSS_VAMEM_TYPE_2; -#else -#error "Unknown VAMEM version" -#endif } diff --git a/drivers/staging/media/atomisp/pci/sh_css_sp.c b/drivers/staging/media/atomisp/pci/sh_css_sp.c index a26680b1d0b0..9f681b2e9f99 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_sp.c +++ b/drivers/staging/media/atomisp/pci/sh_css_sp.c @@ -38,9 +38,7 @@ #include "sh_css_params.h" #include "sh_css_legacy.h" #include "ia_css_frame_comm.h" -#if !defined(HAS_NO_INPUT_SYSTEM) #include "ia_css_isys.h" -#endif #include "gdc_device.h" /* HRT_GDC_N */ @@ -662,7 +660,7 @@ void sh_css_sp_set_if_configs( } #endif -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if defined(USE_INPUT_SYSTEM_VERSION_2) void sh_css_sp_program_input_circuit(int fmt_type, int ch_id, @@ -681,7 +679,7 @@ sh_css_sp_program_input_circuit(int fmt_type, } #endif -#if !defined(HAS_NO_INPUT_SYSTEM) && defined(USE_INPUT_SYSTEM_VERSION_2) +#if defined(USE_INPUT_SYSTEM_VERSION_2) void sh_css_sp_configure_sync_gen(int width, int height, int hblank_cycles, @@ -724,11 +722,7 @@ sh_css_sp_configure_enable_raw_pool_locking(bool lock_all) void sh_css_sp_enable_isys_event_queue(bool enable) { -#if !defined(HAS_NO_INPUT_SYSTEM) sh_css_sp_group.config.enable_isys_event_queue = enable; -#else - (void)enable; -#endif } void @@ -1206,9 +1200,7 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me, enum ia_css_input_mode input_mode, const struct ia_css_metadata_config *md_config, const struct ia_css_metadata_info *md_info, -#if !defined(HAS_NO_INPUT_SYSTEM) const enum mipi_port_id port_id, -#endif const struct ia_css_coordinate *internal_frame_origin_bqs_on_sctbl, /* Origin of internal frame positioned on shading table at shading correction in ISP. */ @@ -1226,7 +1218,6 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me, assert(me); -#if !defined(HAS_NO_INPUT_SYSTEM) assert(me->stages); first_binary = me->stages->binary; @@ -1245,10 +1236,6 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me, { if_config_index = 0x0; } -#else - (void)input_mode; - if_config_index = SH_CSS_IF_CONFIG_NOT_NEEDED; -#endif ia_css_pipeline_get_sp_thread_id(pipe_num, &thread_id); memset(&sh_css_sp_group.pipe[thread_id], 0, sizeof(struct sh_css_sp_pipeline)); @@ -1285,11 +1272,9 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me, sh_css_sp_group.pipe[thread_id].num_execs = me->num_execs; sh_css_sp_group.pipe[thread_id].pipe_qos_config = me->pipe_qos_config; sh_css_sp_group.pipe[thread_id].required_bds_factor = required_bds_factor; -#if !defined(HAS_NO_INPUT_SYSTEM) sh_css_sp_group.pipe[thread_id].input_system_mode = (uint32_t)input_mode; sh_css_sp_group.pipe[thread_id].port_id = port_id; -#endif sh_css_sp_group.pipe[thread_id].dvs_frame_delay = (uint32_t)me->dvs_frame_delay; /* TODO: next indicates from which queues parameters need to be diff --git a/drivers/staging/media/atomisp/pci/sh_css_sp.h b/drivers/staging/media/atomisp/pci/sh_css_sp.h index 153b005becda..18a1fefda4b5 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_sp.h +++ b/drivers/staging/media/atomisp/pci/sh_css_sp.h @@ -66,9 +66,7 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me, enum ia_css_input_mode input_mode, const struct ia_css_metadata_config *md_config, const struct ia_css_metadata_info *md_info, -#if !defined(HAS_NO_INPUT_SYSTEM) const enum mipi_port_id port_id, -#endif const struct ia_css_coordinate *internal_frame_origin_bqs_on_sctbl, /* Origin of internal frame positioned on shading table at shading correction in ISP. */ From patchwork Wed Sep 2 16:10:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751171 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2C480109A for ; Wed, 2 Sep 2020 16:13:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F237B20773 for ; Wed, 2 Sep 2020 16:13:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063204; bh=LlBArSVcBx9G5L28K5dHd7dtdCPvZewej8Keh2JV11E=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=PABTBABbCQVu7tLpn2RVdZrTOzJhVNV4u60Mo4sHpQNKHzONleukBimi1V+5yXCzi OtFQYWfzlb/REzkAeFygXQGEFE+8wH+MSAbrEV5+wUXzMLUrdEl8Rf2lYMqY6EUoYp B6eFvosqB0WF0oKTDFkV0xbqXYE5gWV2JoONp0NA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728659AbgIBQNX (ORCPT ); Wed, 2 Sep 2020 12:13:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:54038 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728327AbgIBQK6 (ORCPT ); Wed, 2 Sep 2020 12:10:58 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4358321974; Wed, 2 Sep 2020 16:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=LlBArSVcBx9G5L28K5dHd7dtdCPvZewej8Keh2JV11E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fj3GG+YyUYZUAvmRRSzFXmBxQFhwKXloFpI2nvQpJX0wGSAHK/AbSsv7M/M2U1kqP sjEB+4Xg+/hzjBt1wtvXGgEguXdAuWT/OWINZapqwRgi06OmnyrE/p7/P5iNMKs+pB OLkvCQKo+HwSg/ANSY/MI/d7FykG+r+YcRVSHy9Y= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tAw-DX; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 26/38] media: atomisp: cleanup ifdefs from ia_css_debug.c Date: Wed, 2 Sep 2020 18:10:29 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There are lots of code dependency there. Get rid of most of them. We can't remove everything, as there are some structs that are conditionally built if ISP2401. So, keep ifdefs only on such cases. Signed-off-by: Mauro Carvalho Chehab --- .../runtime/debug/interface/ia_css_debug.h | 6 - .../pci/runtime/debug/src/ia_css_debug.c | 187 ++++-------------- 2 files changed, 42 insertions(+), 151 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h b/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h index e04d2485ea75..0f9b7eb17647 100644 --- a/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h +++ b/drivers/staging/media/atomisp/pci/runtime/debug/interface/ia_css_debug.h @@ -158,12 +158,6 @@ void ia_css_debug_set_dtrace_level( */ unsigned int ia_css_debug_get_dtrace_level(void); -/*! @brief Dump input formatter state. - * Dumps the input formatter state to tracing output. - * @return None - */ -void ia_css_debug_dump_if_state(void); - /*! @brief Dump isp hardware state. * Dumps the isp hardware state to tracing output. * @return None diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c index 56d5d90634fa..ec598a1697b1 100644 --- a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c @@ -52,9 +52,7 @@ #include "fifo_monitor.h" -#if !defined(HAS_NO_INPUT_FORMATTER) #include "input_formatter.h" -#endif #include "dma.h" #include "irq.h" #include "gp_device.h" @@ -63,9 +61,7 @@ #include "type_support.h" #include "math_support.h" /* CEIL_DIV */ #include "input_system.h" /* input_formatter_reg_load */ -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) #include "ia_css_tagger_common.h" -#endif #include "sh_css_internal.h" #include "ia_css_isys.h" @@ -105,17 +101,6 @@ #define ENABLE_LINE_MAX_LENGTH (25) -#ifdef ISP2401 -#define DBG_EXT_CMD_TRACE_PNTS_DUMP BIT(8) -#define DBG_EXT_CMD_PUB_CFG_DUMP BIT(9) -#define DBG_EXT_CMD_GAC_REG_DUMP BIT(10) -#define DBG_EXT_CMD_GAC_ACB_REG_DUMP BIT(11) -#define DBG_EXT_CMD_FIFO_DUMP BIT(12) -#define DBG_EXT_CMD_QUEUE_DUMP BIT(13) -#define DBG_EXT_CMD_DMA_DUMP BIT(14) -#define DBG_EXT_CMD_MASK 0xAB0000CD - -#endif /* * TODO:SH_CSS_MAX_SP_THREADS is not the max number of sp threads * future rework should fix this and remove the define MAX_THREAD_NUM @@ -449,23 +434,21 @@ void ia_css_debug_dump_isp_state(void) debug_print_isp_state(&state, "ISP"); if (state.is_stalling) { -#if !defined(HAS_NO_INPUT_FORMATTER) - ia_css_debug_dtrace(2, "\t%-32s: %d\n", - "[0] if_prim_a_FIFO stalled", stall.fifo0); - ia_css_debug_dtrace(2, "\t%-32s: %d\n", - "[1] if_prim_b_FIFO stalled", stall.fifo1); -#endif + if (!IS_ISP2401) { + ia_css_debug_dtrace(2, "\t%-32s: %d\n", + "[0] if_prim_a_FIFO stalled", stall.fifo0); + ia_css_debug_dtrace(2, "\t%-32s: %d\n", + "[1] if_prim_b_FIFO stalled", stall.fifo1); + } ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[2] dma_FIFO stalled", stall.fifo2); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[3] gdc0_FIFO stalled", stall.fifo3); -#if !defined(IS_ISP_2500_SYSTEM) ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[4] gdc1_FIFO stalled", stall.fifo4); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[5] gpio_FIFO stalled", stall.fifo5); -#endif ia_css_debug_dtrace(2, "\t%-32s: %d\n", "[6] sp_FIFO stalled", stall.fifo6); ia_css_debug_dtrace(2, "\t%-32s: %d\n", @@ -505,24 +488,21 @@ void ia_css_debug_dump_sp_state(void) "str_to_mem_FIFO stalled", stall.fifo2); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "dma_FIFO stalled", stall.fifo3); -#if !defined(HAS_NO_INPUT_FORMATTER) - ia_css_debug_dtrace(2, "\t%-32s: %d\n", - "if_prim_a_FIFO stalled", stall.fifo4); -#endif + if (!IS_ISP2401) + ia_css_debug_dtrace(2, "\t%-32s: %d\n", + "if_prim_a_FIFO stalled", stall.fifo4); + ia_css_debug_dtrace(2, "\t%-32s: %d\n", "isp_FIFO stalled", stall.fifo5); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "gp_FIFO stalled", stall.fifo6); -#if !defined(HAS_NO_INPUT_FORMATTER) - ia_css_debug_dtrace(2, "\t%-32s: %d\n", - "if_prim_b_FIFO stalled", stall.fifo7); -#endif + if (!IS_ISP2401) + ia_css_debug_dtrace(2, "\t%-32s: %d\n", + "if_prim_b_FIFO stalled", stall.fifo7); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "gdc0_FIFO stalled", stall.fifo8); -#if !defined(IS_ISP_2500_SYSTEM) ia_css_debug_dtrace(2, "\t%-32s: %d\n", "gdc1_FIFO stalled", stall.fifo9); -#endif ia_css_debug_dtrace(2, "\t%-32s: %d\n", "irq FIFO stalled", stall.fifoa); ia_css_debug_dtrace(2, "\t%-32s: %d\n", "dmem stalled", @@ -556,7 +536,6 @@ static void debug_print_fifo_channel_state(const fifo_channel_state_t *state, return; } -#if !defined(HAS_NO_INPUT_FORMATTER) && defined(USE_INPUT_SYSTEM_VERSION_2) void ia_css_debug_dump_pif_a_isp_fifo_state(void) { fifo_channel_state_t pif_to_isp, isp_to_pif; @@ -593,13 +572,11 @@ void ia_css_debug_dump_str2mem_sp_fifo_state(void) debug_print_fifo_channel_state(&sp_to_s2m, "SP to stream-to-memory"); } +#ifndef ISP2401 static void debug_print_if_state(input_formatter_state_t *state, const char *id) { unsigned int val; -#if defined(HAS_INPUT_FORMATTER_VERSION_1) - const char *st_reset = (state->reset ? "Active" : "Not active"); -#endif const char *st_vsync_active_low = (state->vsync_active_low ? "low" : "high"); const char *st_hsync_active_low = @@ -631,9 +608,6 @@ static void debug_print_if_state(input_formatter_state_t *state, const char *id) ia_css_debug_dtrace(2, "\tConfiguration:\n"); -#if defined(HAS_INPUT_FORMATTER_VERSION_1) - ia_css_debug_dtrace(2, "\t\t%-32s: %s\n", "Software reset", st_reset); -#endif ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "Start line", st_stline); ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "Start column", st_stcol); ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "Cropped height", st_crpht); @@ -860,7 +834,6 @@ static void debug_print_if_state(input_formatter_state_t *state, const char *id) state->vector_support); ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "Fifo sensor data lost", state->sensor_data_lost); - return; } static void debug_print_if_bin_state(input_formatter_bin_state_t *state) @@ -883,7 +856,7 @@ static void debug_print_if_bin_state(input_formatter_bin_state_t *state) state->en_status_update); } -void ia_css_debug_dump_if_state(void) +static void ia_css_debug_dump_if_state(void) { input_formatter_state_t if_state; input_formatter_bin_state_t if_bin_state; @@ -1612,19 +1585,11 @@ void ia_css_debug_print_sp_debug_state(const struct sh_css_sp_debug_state "frame_buffer.sp.c" }; -#if 1 /* Example SH_CSS_SP_DBG_NR_OF_TRACES==1 */ /* Adjust this to your trace case */ static char const *trace_name[SH_CSS_SP_DBG_NR_OF_TRACES] = { "default" }; -#else - /* Example SH_CSS_SP_DBG_NR_OF_TRACES==4 */ - /* Adjust this to your trace case */ - static char const *trace_name[SH_CSS_SP_DBG_NR_OF_TRACES] = { - "copy", "preview/video", "capture", "acceleration" - }; -#endif /* Remember host_index_last because we only want to print new entries */ static int host_index_last[SH_CSS_SP_DBG_NR_OF_TRACES] = { 0 }; @@ -1696,7 +1661,7 @@ void ia_css_debug_print_sp_debug_state(const struct sh_css_sp_debug_state } #endif -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) static void debug_print_rx_mipi_port_state(mipi_port_state_t *state) { int i; @@ -1893,17 +1858,15 @@ static void debug_print_rx_state(receiver_state_t *state) } #endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) void ia_css_debug_dump_rx_state(void) { -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) receiver_state_t state; receiver_get_state(RX0_ID, &state); debug_print_rx_state(&state); #endif } -#endif void ia_css_debug_dump_sp_sw_debug_info(void) { @@ -1918,7 +1881,7 @@ void ia_css_debug_dump_sp_sw_debug_info(void) return; } -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) static void debug_print_isys_capture_unit_state(capture_unit_state_t *state) { assert(state); @@ -2155,31 +2118,20 @@ static void debug_print_isys_state(input_system_state_t *state) } /* end of control unit state */ } - -void ia_css_debug_dump_isys_state(void) -{ - input_system_state_t state; - - input_system_get_state(INPUT_SYSTEM0_ID, &state); - debug_print_isys_state(&state); - - return; -} #endif -#if defined(USE_INPUT_SYSTEM_VERSION_2401) + void ia_css_debug_dump_isys_state(void) { - /* Android compilation fails if made a local variable - stack size on android is limited to 2k and this structure - is around 3.5K, in place of static malloc can be done but - if this call is made too often it will lead to fragment memory - versus a fixed allocation */ static input_system_state_t state; input_system_get_state(INPUT_SYSTEM0_ID, &state); - input_system_dump_state(INPUT_SYSTEM0_ID, &state); -} + +#ifndef ISP2401 + debug_print_isys_state(&state); +#else + input_system_dump_state(INPUT_SYSTEM0_ID, &state); #endif +} void ia_css_debug_dump_debug_info(const char *context) { @@ -2187,10 +2139,10 @@ void ia_css_debug_dump_debug_info(const char *context) context = "No Context provided"; ia_css_debug_dtrace(2, "CSS Debug Info dump [Context = %s]\n", context); -#if defined(USE_INPUT_SYSTEM_VERSION_2) - ia_css_debug_dump_rx_state(); -#endif -#if !defined(HAS_NO_INPUT_FORMATTER) && defined(USE_INPUT_SYSTEM_VERSION_2) + if (!IS_ISP2401) + ia_css_debug_dump_rx_state(); + +#ifndef ISP2401 ia_css_debug_dump_if_state(); #endif ia_css_debug_dump_isp_state(); @@ -2207,12 +2159,12 @@ void ia_css_debug_dump_debug_info(const char *context) ia_css_debug_dump_dma_isp_fifo_state(); ia_css_debug_dump_dma_sp_fifo_state(); ia_css_debug_dump_dma_state(); -#if defined(USE_INPUT_SYSTEM_VERSION_2) - ia_css_debug_dump_isys_state(); - { + if (!IS_ISP2401) { struct irq_controller_state state; + ia_css_debug_dump_isys_state(); + irq_controller_get_state(IRQ2_ID, &state); ia_css_debug_dtrace(2, "\t%-32s:\n", @@ -2233,14 +2185,12 @@ void ia_css_debug_dump_debug_info(const char *context) ia_css_debug_dtrace(2, "\t\t%-32s: %d\n", "irq_level_not_pulse", state.irq_level_not_pulse); + } else { + ia_css_debug_dump_isys_state(); } -#endif -#if defined(USE_INPUT_SYSTEM_VERSION_2401) - ia_css_debug_dump_isys_state(); -#endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) + ia_css_debug_tagger_state(); -#endif + return; } @@ -2270,7 +2220,6 @@ void ia_css_debug_wake_up_sp(void) sp_ctrl_setbit(SP0_ID, SP_SC_REG, SP_START_BIT); } -#if !defined(IS_ISP_2500_SYSTEM) #define FIND_DMEM_PARAMS_TYPE(stream, kernel, type) \ (struct HRTCAT(HRTCAT(sh_css_isp_, type), _params) *) \ findf_dmem_params(stream, offsetof(struct ia_css_memory_offsets, dmem.kernel)) @@ -2302,16 +2251,11 @@ findf_dmem_params(struct ia_css_stream *stream, short idx) } return NULL; } -#endif void ia_css_debug_dump_isp_params(struct ia_css_stream *stream, unsigned int enable) { ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, "ISP PARAMETERS:\n"); -#if defined(IS_ISP_2500_SYSTEM) - (void)enable; - (void)stream; -#else assert(stream); if ((enable & IA_CSS_DEBUG_DUMP_FPN) @@ -2375,7 +2319,6 @@ void ia_css_debug_dump_isp_params(struct ia_css_stream *stream, || (enable & IA_CSS_DEBUG_DUMP_ALL)) { ia_css_ce_dump(FIND_DMEM_PARAMS(stream, ce), IA_CSS_DEBUG_VERBOSE); } -#endif } void sh_css_dump_sp_raw_copy_linecount(bool reduced) @@ -2441,12 +2384,14 @@ void ia_css_debug_dump_isp_binary(void) void ia_css_debug_dump_perf_counters(void) { -#if defined(USE_INPUT_SYSTEM_VERSION_2) const struct ia_css_fw_info *fw; int i; unsigned int HIVE_ADDR_ia_css_isys_sp_error_cnt; - s32 ia_css_sp_input_system_error_cnt[N_MIPI_PORT_ID + - 1]; /* 3 Capture Units and 1 Acquire Unit. */ + /* N_MIPI_PORT_ID + 1: 3 Capture Units and 1 Acquire Unit. */ + s32 ia_css_sp_input_system_error_cnt[N_MIPI_PORT_ID + 1]; + + if (IS_ISP2401) + return; ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, "Input System Error Counters:\n"); @@ -2465,48 +2410,8 @@ void ia_css_debug_dump_perf_counters(void) ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, "\tport[%d] = %d\n", i, ia_css_sp_input_system_error_cnt[i]); } -#endif } -/* - -void sh_css_init_ddr_debug_queue(void) -{ - ia_css_ptr ddr_debug_queue_addr = - hmm_alloc(sizeof(debug_data_ddr_t), HMM_BO_PRIVATE, 0, NULL, 0); - const struct ia_css_fw_info *fw; - unsigned int HIVE_ADDR_debug_buffer_ddr_address; - - fw = &sh_css_sp_fw; - HIVE_ADDR_debug_buffer_ddr_address = - fw->info.sp.debug_buffer_ddr_address; - - (void)HIVE_ADDR_debug_buffer_ddr_address; - - debug_buffer_ddr_init(ddr_debug_queue_addr); - - sp_dmem_store_uint32(SP0_ID, - (unsigned int)sp_address_of(debug_buffer_ddr_address), - (uint32_t)(ddr_debug_queue_addr)); -} - -void sh_css_load_ddr_debug_queue(void) -{ - debug_synch_queue_ddr(); -} - -void ia_css_debug_dump_ddr_debug_queue(void) -{ - int i; - sh_css_load_ddr_debug_queue(); - for (i = 0; i < DEBUG_BUF_SIZE; i++) { - ia_css_debug_dtrace(IA_CSS_DEBUG_VERBOSE, - "ddr_debug_queue[%d] = 0x%x\n", - i, debug_data_ptr->buf[i]); - } -} -*/ - /* * @brief Initialize the debug mode. * Refer to "ia_css_debug.h" for more details. @@ -3252,22 +3157,16 @@ ia_css_debug_dump_stream_config( byte 2-3: data */ #if TRACE_ENABLE_SP0 || TRACE_ENABLE_SP1 || TRACE_ENABLE_ISP -#ifndef ISP2401 -static void debug_dump_one_trace(TRACE_CORE_ID proc_id) -#else static void debug_dump_one_trace(enum TRACE_CORE_ID proc_id) -#endif { #if defined(HAS_TRACER_V2) u32 start_addr; u32 start_addr_data; u32 item_size; -#ifndef ISP2401 u32 tmp; -#else u8 tid_val; enum TRACE_DUMP_FORMAT dump_format; -#endif + int i, j, max_trace_points, point_num, limit = -1; /* using a static buffer here as the driver has issues allocating memory */ static u32 trace_read_buf[TRACE_BUFF_SIZE] = {0}; @@ -3471,7 +3370,6 @@ void ia_css_debug_dump_trace(void) #endif } -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) /* Tagger state dump function. The tagger is only available when the CSS * contains an input system (2400 or 2401). */ void ia_css_debug_tagger_state(void) @@ -3497,7 +3395,6 @@ void ia_css_debug_tagger_state(void) i, tbuf_frames[i].exp_id, tbuf_frames[i].mark, tbuf_frames[i].lock); } } -#endif /* defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) */ /* ISP2401 */ void ia_css_debug_pc_dump(sp_ID_t id, unsigned int num_of_dumps) From patchwork Wed Sep 2 16:10:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751159 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 829D214E3 for ; Wed, 2 Sep 2020 16:12:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 42ACB20773 for ; Wed, 2 Sep 2020 16:12:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063155; bh=EUf66YRYnbmCpIfd4wNfcVXQuvF5yJvPYose5VlYl/Q=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=ppLmIhkOXicmbzrzjaiNGUKio2qdzyNveauc/fo3K8kNi0WcmJ9mT+BuprENzgONB Zih9o84xvAzDjTtCeoavLGYIczO3TSKuTX2wOxRDJ3azyL1vgf9e+0ZOWpueprxkg4 NloT6SFHvtMbvJDjUTDeoHkX7dSanJq4z6JAtS0Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728400AbgIBQMe (ORCPT ); Wed, 2 Sep 2020 12:12:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:54076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728365AbgIBQLF (ORCPT ); Wed, 2 Sep 2020 12:11:05 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6B96521D91; Wed, 2 Sep 2020 16:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063047; bh=EUf66YRYnbmCpIfd4wNfcVXQuvF5yJvPYose5VlYl/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=davYzh1c5pIVnDS3mrHDJeAQFVKX6BFjlS+aBWng72nmzG9CI4sk/Szbb1HpEu0rB zTyyQ5CLSSTCH3qHFvEEO3Xjfkrey/EWIY9ZkRcSrBAlaLoyshhk7RA7HdKestsmE1 6lqbfhgPSfZwmbOtvnMyN/kOxGH2R71yN78nXJ50= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tAy-Eq; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , Nathan Chancellor , Arnd Bergmann , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, devel@driverdev.osuosl.org Subject: [PATCH 27/38] media: atomisp: get rid of version-dependent globals Date: Wed, 2 Sep 2020 18:10:30 +0200 Message-Id: <301c1ad689d4694e2858465ed055eee1b1a139e2.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Replace all occurrences along the atomisp tree for the conditional compilation macros found at system_global.h, replacing them by tests wheather ISP2401 is defined or not. Signed-off-by: Mauro Carvalho Chehab --- .../pci/css_2401_system/host/isys_irq_local.h | 4 +- .../css_2401_system/host/isys_irq_private.h | 4 +- .../pci/css_2401_system/isys_irq_global.h | 4 +- .../host/input_formatter.c | 2 +- .../hive_isp_css_common/host/input_system.c | 2 +- .../hive_isp_css_include/host/csi_rx_public.h | 4 +- .../host/ibuf_ctrl_public.h | 4 +- .../host/isys_dma_public.h | 4 +- .../host/isys_irq_public.h | 4 +- .../hive_isp_css_include/host/isys_public.h | 4 +- .../host/pixelgen_public.h | 4 +- .../pci/hive_isp_css_include/isys_irq.h | 4 +- .../staging/media/atomisp/pci/ia_css_stream.h | 4 +- .../isp/kernels/raw/raw_1.0/ia_css_raw.host.c | 4 +- .../atomisp/pci/isp2400_input_system_public.h | 4 +- .../media/atomisp/pci/isp2400_system_global.h | 16 - .../media/atomisp/pci/isp2401_system_global.h | 19 - .../atomisp/pci/runtime/binary/src/binary.c | 2 +- .../runtime/bufq/interface/ia_css_bufq_comm.h | 6 - .../atomisp/pci/runtime/ifmtr/src/ifmtr.c | 2 +- .../pci/runtime/isys/interface/ia_css_isys.h | 12 +- .../runtime/isys/interface/ia_css_isys_comm.h | 4 +- .../pci/runtime/isys/src/csi_rx_rmgr.c | 2 +- .../pci/runtime/isys/src/isys_dma_rmgr.c | 2 +- .../atomisp/pci/runtime/isys/src/isys_init.c | 10 +- .../runtime/isys/src/isys_stream2mmio_rmgr.c | 2 +- .../media/atomisp/pci/runtime/isys/src/rx.c | 12 +- .../pci/runtime/isys/src/virtual_isys.c | 2 +- .../pipeline/interface/ia_css_pipeline.h | 2 +- .../pci/runtime/pipeline/src/pipeline.c | 2 +- drivers/staging/media/atomisp/pci/sh_css.c | 158 +++--- .../staging/media/atomisp/pci/sh_css_defs.h | 4 - .../media/atomisp/pci/sh_css_internal.h | 36 +- .../staging/media/atomisp/pci/sh_css_mipi.c | 34 +- .../media/atomisp/pci/sh_css_param_shading.c | 2 +- .../staging/media/atomisp/pci/sh_css_params.c | 533 ------------------ drivers/staging/media/atomisp/pci/sh_css_sp.c | 24 +- drivers/staging/media/atomisp/pci/sh_css_sp.h | 6 +- .../staging/media/atomisp/pci/sh_css_struct.h | 2 - .../staging/media/atomisp/pci/system_global.h | 23 - 40 files changed, 155 insertions(+), 818 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/isp2400_system_global.h delete mode 100644 drivers/staging/media/atomisp/pci/isp2401_system_global.h diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_local.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_local.h index e3d6d5e1634e..a76987190292 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_local.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_local.h @@ -18,7 +18,7 @@ #include -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) typedef struct isys_irqc_state_s isys_irqc_state_t; @@ -31,6 +31,6 @@ struct isys_irqc_state_s { /*hrt_data clear; */ /* write-only register */ }; -#endif /* defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* defined(ISP2401) */ #endif /* __ISYS_IRQ_LOCAL_H__ */ diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h index 91ef000d76dc..1e96f0267ac0 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h @@ -19,7 +19,7 @@ #include "isys_irq_global.h" #include "isys_irq_local.h" -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /* -------------------------------------------------------+ | Native command interface (NCI) | @@ -102,6 +102,6 @@ STORAGE_CLASS_ISYS2401_IRQ_C hrt_data isys_irqc_reg_load( /* end of DLI */ -#endif /* defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* defined(ISP2401) */ #endif /* __ISYS_IRQ_PRIVATE_H__ */ diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/isys_irq_global.h b/drivers/staging/media/atomisp/pci/css_2401_system/isys_irq_global.h index 156b4c95277e..a81e4d13ac9f 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/isys_irq_global.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/isys_irq_global.h @@ -16,7 +16,7 @@ #ifndef __ISYS_IRQ_GLOBAL_H__ #define __ISYS_IRQ_GLOBAL_H__ -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /* Register offset/index from base location */ #define ISYS_IRQ_EDGE_REG_IDX (0) @@ -31,6 +31,6 @@ #define ISYS_IRQ_CLEAR_REG_VALUE (0xFFFF) #define ISYS_IRQ_ENABLE_REG_VALUE (0xFFFF) -#endif /* defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* defined(ISP2401) */ #endif /* __ISYS_IRQ_GLOBAL_H__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_formatter.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_formatter.c index bec9c7238a78..1b196cd265b9 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_formatter.c +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_formatter.c @@ -15,7 +15,7 @@ #include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2 +#ifndef ISP2401 #include "input_formatter.h" #include diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c index fc000af042dc..4f3d75fac3e3 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c @@ -15,7 +15,7 @@ #include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2 +#ifndef ISP2401 #include "input_system.h" #include diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/csi_rx_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/csi_rx_public.h index e6f695691407..3d6621f2fa96 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/csi_rx_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/csi_rx_public.h @@ -16,7 +16,7 @@ #ifndef __CSI_RX_PUBLIC_H_INCLUDED__ #define __CSI_RX_PUBLIC_H_INCLUDED__ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /***************************************************** * * Native command interface (NCI). @@ -132,5 +132,5 @@ void csi_rx_be_ctrl_reg_store( const hrt_address reg, const hrt_data value); /* end of DLI */ -#endif /* USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* ISP2401 */ #endif /* __CSI_RX_PUBLIC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h index 053803d2cae3..54982b15d9a9 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h @@ -16,7 +16,7 @@ #ifndef __IBUF_CTRL_PUBLIC_H_INCLUDED__ #define __IBUF_CTRL_PUBLIC_H_INCLUDED__ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /***************************************************** * * Native command interface (NCI). @@ -90,5 +90,5 @@ STORAGE_CLASS_IBUF_CTRL_H void ibuf_ctrl_reg_store( const hrt_data value); /* end of DLI */ -#endif /* USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* ISP2401 */ #endif /* __IBUF_CTRL_PUBLIC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h index 23a158b81b13..88ac78f69e7b 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h @@ -16,7 +16,7 @@ #ifndef __ISYS_DMA_PUBLIC_H_INCLUDED__ #define __ISYS_DMA_PUBLIC_H_INCLUDED__ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "system_local.h" #include "type_support.h" @@ -34,6 +34,6 @@ void isys2401_dma_set_max_burst_size( const isys2401_dma_ID_t dma_id, uint32_t max_burst_size); -#endif /* USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* ISP2401 */ #endif /* __ISYS_DMA_PUBLIC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h index b9befdd2508e..cd738f4b65a0 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h @@ -19,7 +19,7 @@ #include "isys_irq_global.h" #include "isys_irq_local.h" -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_state_get( const isys_irq_ID_t isys_irqc_id, @@ -41,6 +41,6 @@ STORAGE_CLASS_ISYS2401_IRQ_H hrt_data isys_irqc_reg_load( STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_status_enable( const isys_irq_ID_t isys_irqc_id); -#endif /* defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* defined(ISP2401) */ #endif /* __ISYS_IRQ_PUBLIC_H__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_public.h index 509f75fe025c..dac53e324118 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_public.h @@ -16,7 +16,7 @@ #ifndef __ISYS_PUBLIC_H_INCLUDED__ #define __ISYS_PUBLIC_H_INCLUDED__ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /*! Read the state of INPUT_SYSTEM[ID] \param ID[in] INPUT_SYSTEM identifier \param state[out] pointer to input system state structure @@ -34,5 +34,5 @@ STORAGE_CLASS_INPUT_SYSTEM_H input_system_err_t input_system_get_state( STORAGE_CLASS_INPUT_SYSTEM_H void input_system_dump_state( const input_system_ID_t ID, input_system_state_t *state); -#endif /* USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* ISP2401 */ #endif /* __ISYS_PUBLIC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/pixelgen_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/pixelgen_public.h index ded4dce06d09..40a9fb6d7761 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/pixelgen_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/pixelgen_public.h @@ -16,7 +16,7 @@ #ifndef __PIXELGEN_PUBLIC_H_INCLUDED__ #define __PIXELGEN_PUBLIC_H_INCLUDED__ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /***************************************************** * * Native command interface (NCI). @@ -76,5 +76,5 @@ STORAGE_CLASS_PIXELGEN_H void pixelgen_ctrl_reg_store( const hrt_data value); /* end of DLI */ -#endif /* USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* ISP2401 */ #endif /* __PIXELGEN_PUBLIC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h index d854124f4f97..06bc9e1450ec 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h @@ -19,7 +19,7 @@ #include #include -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) #ifndef __INLINE_ISYS2401_IRQ__ @@ -35,6 +35,6 @@ #endif /* __INLINE_ISYS2401_IRQ__ */ -#endif /* defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* defined(ISP2401) */ #endif /* __IA_CSS_ISYS_IRQ_H__ */ diff --git a/drivers/staging/media/atomisp/pci/ia_css_stream.h b/drivers/staging/media/atomisp/pci/ia_css_stream.h index 4dffc6d7c8d8..70b0378748f1 100644 --- a/drivers/staging/media/atomisp/pci/ia_css_stream.h +++ b/drivers/staging/media/atomisp/pci/ia_css_stream.h @@ -18,7 +18,7 @@ #include #include -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) #include #endif #include "ia_css_types.h" @@ -30,7 +30,7 @@ struct ia_css_stream { struct ia_css_stream_config config; struct ia_css_stream_info info; -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) rx_cfg_t csi_rx_config; #endif bool reconfigure_css_rx; diff --git a/drivers/staging/media/atomisp/pci/isp/kernels/raw/raw_1.0/ia_css_raw.host.c b/drivers/staging/media/atomisp/pci/isp/kernels/raw/raw_1.0/ia_css_raw.host.c index 1c6f6792d57b..c505c94a7241 100644 --- a/drivers/staging/media/atomisp/pci/isp/kernels/raw/raw_1.0/ia_css_raw.host.c +++ b/drivers/staging/media/atomisp/pci/isp/kernels/raw/raw_1.0/ia_css_raw.host.c @@ -81,7 +81,7 @@ ia_css_raw_config( const struct ia_css_frame_info *internal_info = from->internal_info; (void)size; -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) /* 2401 input system uses input width width */ in_info = internal_info; #else @@ -105,7 +105,7 @@ ia_css_raw_config( to->two_ppc = from->two_ppc; to->stream_format = css2isp_stream_format(from->stream_format); to->deinterleaved = from->deinterleaved; -#if (defined(USE_INPUT_SYSTEM_VERSION_2401) || defined(CONFIG_CSI2_PLUS)) +#if defined(ISP2401) to->start_column = in_info->crop_info.start_column; to->start_line = in_info->crop_info.start_line; to->enable_left_padding = from->enable_left_padding; diff --git a/drivers/staging/media/atomisp/pci/isp2400_input_system_public.h b/drivers/staging/media/atomisp/pci/isp2400_input_system_public.h index 689e451f1ce2..c6e5b17b3c40 100644 --- a/drivers/staging/media/atomisp/pci/isp2400_input_system_public.h +++ b/drivers/staging/media/atomisp/pci/isp2400_input_system_public.h @@ -17,7 +17,7 @@ #define __INPUT_SYSTEM_PUBLIC_H_INCLUDED__ #include -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "isys_public.h" #else @@ -365,6 +365,6 @@ input_system_error_t input_system_gpfifo_channel_cfg( u32 nof_frames, target_cfg2400_t target ); -#endif /* #ifdef USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* #ifdef ISP2401 */ #endif /* __INPUT_SYSTEM_PUBLIC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/isp2400_system_global.h b/drivers/staging/media/atomisp/pci/isp2400_system_global.h deleted file mode 100644 index 74fff465e8e8..000000000000 --- a/drivers/staging/media/atomisp/pci/isp2400_system_global.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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. - */ - -#define USE_INPUT_SYSTEM_VERSION_2 diff --git a/drivers/staging/media/atomisp/pci/isp2401_system_global.h b/drivers/staging/media/atomisp/pci/isp2401_system_global.h deleted file mode 100644 index 27cd2535bab8..000000000000 --- a/drivers/staging/media/atomisp/pci/isp2401_system_global.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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. - */ - -#define HAS_NO_INPUT_FORMATTER -#define USE_INPUT_SYSTEM_VERSION_2401 -#define HAS_INPUT_SYSTEM_VERSION_2401 -#define CSI2P_DISABLE_ISYS2401_ONLINE_MODE diff --git a/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c b/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c index 9813014c3fd3..a77c2072db13 100644 --- a/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c +++ b/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c @@ -1045,7 +1045,7 @@ binary_in_frame_padded_width(int in_frame_width, int rval; int nr_of_left_paddings; /* number of paddings pixels on the left of an image line */ -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /* the output image line of Input System 2401 does not have the left paddings */ nr_of_left_paddings = 0; #else diff --git a/drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h b/drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h index 35f4528b724f..567d94d91e3c 100644 --- a/drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h +++ b/drivers/staging/media/atomisp/pci/runtime/bufq/interface/ia_css_bufq_comm.h @@ -27,15 +27,9 @@ enum sh_css_queue_id { SH_CSS_QUEUE_E_ID, SH_CSS_QUEUE_F_ID, SH_CSS_QUEUE_G_ID, -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) SH_CSS_QUEUE_H_ID, /* for metadata */ -#endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) #define SH_CSS_MAX_NUM_QUEUES (SH_CSS_QUEUE_H_ID + 1) -#else -#define SH_CSS_MAX_NUM_QUEUES (SH_CSS_QUEUE_G_ID + 1) -#endif }; diff --git a/drivers/staging/media/atomisp/pci/runtime/ifmtr/src/ifmtr.c b/drivers/staging/media/atomisp/pci/runtime/ifmtr/src/ifmtr.c index 89cded6b6e2b..6d9f47629fbc 100644 --- a/drivers/staging/media/atomisp/pci/runtime/ifmtr/src/ifmtr.c +++ b/drivers/staging/media/atomisp/pci/runtime/ifmtr/src/ifmtr.c @@ -16,7 +16,7 @@ #include "system_global.h" #include -#ifdef USE_INPUT_SYSTEM_VERSION_2 +#ifndef ISP2401 #include "ia_css_ifmtr.h" #include diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h b/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h index f975429b8705..bd972d966fe2 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h +++ b/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h @@ -24,7 +24,7 @@ #include #include "ia_css_isys_comm.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /** * Virtual Input System. (Input System 2401) */ @@ -32,14 +32,12 @@ typedef input_system_cfg_t ia_css_isys_descr_t; /* end of Virtual Input System */ #endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) input_system_error_t ia_css_isys_init(void); void ia_css_isys_uninit(void); enum mipi_port_id ia_css_isys_port_to_mipi_port( enum mipi_port_id api_port); -#endif -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /** * @brief Register one (virtual) stream. This is used to track when all @@ -78,7 +76,7 @@ unsigned int ia_css_csi2_calculate_input_system_alignment( enum atomisp_input_format fmt_type); #endif -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) /* CSS Receiver */ void ia_css_isys_rx_configure( const rx_cfg_t *config, @@ -95,7 +93,7 @@ void ia_css_isys_rx_clear_irq_info(enum mipi_port_id port, unsigned int irq_infos); unsigned int ia_css_isys_rx_translate_irq_infos(unsigned int bits); -#endif /* #if !defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* #if !defined(ISP2401) */ /* @brief Translate format and compression to format type. * @@ -113,7 +111,7 @@ int ia_css_isys_convert_stream_format_to_mipi_format( mipi_predictor_t compression, unsigned int *fmt_type); -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /** * Virtual Input System. (Input System 2401) */ diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys_comm.h b/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys_comm.h index 6f1a86c81d7c..d80ef42c7a64 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys_comm.h +++ b/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys_comm.h @@ -19,7 +19,7 @@ #include #include -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include /* inline */ #include #include /* IA_CSS_STREAM_MAX_ISYS_STREAM_PER_CH */ @@ -50,5 +50,5 @@ static inline uint32_t ia_css_isys_generate_stream_id( return sp_thread_id * IA_CSS_STREAM_MAX_ISYS_STREAM_PER_CH + stream_id; } -#endif /* USE_INPUT_SYSTEM_VERSION_2401*/ +#endif /* ISP2401*/ #endif /*_IA_CSS_ISYS_COMM_H */ diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/csi_rx_rmgr.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/csi_rx_rmgr.c index 5a44d8f6c196..3fc9fed1e516 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/csi_rx_rmgr.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/csi_rx_rmgr.c @@ -15,7 +15,7 @@ #include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "assert_support.h" #include "platform_support.h" diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_dma_rmgr.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_dma_rmgr.c index 68baec78b1c4..261c6460e970 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_dma_rmgr.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_dma_rmgr.c @@ -15,7 +15,7 @@ #include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "assert_support.h" #include "platform_support.h" diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c index 13cb02ac2651..c88b14ce69a5 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c @@ -18,12 +18,12 @@ #include "ia_css_isys.h" #include "platform_support.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "isys_dma.h" /* isys2401_dma_set_max_burst_size() */ #include "isys_irq.h" #endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) input_system_error_t ia_css_isys_init(void) { backend_channel_cfg_t backend_ch0; @@ -86,7 +86,7 @@ input_system_error_t ia_css_isys_init(void) return error; } -#elif defined(USE_INPUT_SYSTEM_VERSION_2401) +#elif defined(ISP2401) input_system_error_t ia_css_isys_init(void) { ia_css_isys_csi_rx_lut_rmgr_init(); @@ -106,11 +106,11 @@ input_system_error_t ia_css_isys_init(void) } #endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) void ia_css_isys_uninit(void) { } -#elif defined(USE_INPUT_SYSTEM_VERSION_2401) +#elif defined(ISP2401) void ia_css_isys_uninit(void) { ia_css_isys_csi_rx_lut_rmgr_uninit(); diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_stream2mmio_rmgr.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_stream2mmio_rmgr.c index bc4a2ff3c0fc..fb0cb183f701 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_stream2mmio_rmgr.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_stream2mmio_rmgr.c @@ -15,7 +15,7 @@ #include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "assert_support.h" #include "platform_support.h" diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c index fa87afaff6e5..c4bb9fd9ce20 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c @@ -20,7 +20,7 @@ #include "ia_css_irq.h" #include "sh_css_internal.h" -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) void ia_css_isys_rx_enable_all_interrupts(enum mipi_port_id port) { hrt_data bits = receiver_port_reg_load(RX0_ID, @@ -209,7 +209,7 @@ void ia_css_isys_rx_clear_irq_info(enum mipi_port_id port, return; } -#endif /* #if !defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* #if !defined(ISP2401) */ int ia_css_isys_convert_stream_format_to_mipi_format( enum atomisp_input_format input_format, @@ -311,7 +311,7 @@ int ia_css_isys_convert_stream_format_to_mipi_format( case ATOMISP_INPUT_FORMAT_EMBEDDED: *fmt_type = MIPI_FORMAT_EMBEDDED; break; -#ifndef USE_INPUT_SYSTEM_VERSION_2401 +#ifndef ISP2401 case ATOMISP_INPUT_FORMAT_RAW_16: /* This is not specified by Arasan, so we use * 17 for now. @@ -356,7 +356,7 @@ int ia_css_isys_convert_stream_format_to_mipi_format( return 0; } -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) static mipi_predictor_t sh_css_csi2_compression_type_2_mipi_predictor( enum ia_css_csi2_compression_type type) { @@ -474,7 +474,7 @@ unsigned int ia_css_csi2_calculate_input_system_alignment( #endif -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) void ia_css_isys_rx_configure(const rx_cfg_t *config, const enum ia_css_input_mode input_mode) { @@ -588,4 +588,4 @@ void ia_css_isys_rx_disable(void) } return; } -#endif /* if !defined(USE_INPUT_SYSTEM_VERSION_2401) */ +#endif /* if !defined(ISP2401) */ diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c index b3c6831cb9e3..037b9e71a655 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c @@ -17,7 +17,7 @@ #include "system_global.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 #include "ia_css_isys.h" #include "ia_css_debug.h" diff --git a/drivers/staging/media/atomisp/pci/runtime/pipeline/interface/ia_css_pipeline.h b/drivers/staging/media/atomisp/pci/runtime/pipeline/interface/ia_css_pipeline.h index 18a7d18e197e..de2c526a58ae 100644 --- a/drivers/staging/media/atomisp/pci/runtime/pipeline/interface/ia_css_pipeline.h +++ b/drivers/staging/media/atomisp/pci/runtime/pipeline/interface/ia_css_pipeline.h @@ -243,7 +243,7 @@ bool ia_css_pipeline_uses_params(struct ia_css_pipeline *pipeline); */ bool ia_css_pipeline_get_sp_thread_id(unsigned int key, unsigned int *val); -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /** * @brief Get the pipeline io status * diff --git a/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c b/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c index e34df58b124a..d03957d1ecf4 100644 --- a/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c +++ b/drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c @@ -455,7 +455,7 @@ bool ia_css_pipeline_has_stopped(struct ia_css_pipeline *pipeline) return sp_group.pipe[thread_id].num_stages == 0; } -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) struct sh_css_sp_pipeline_io_status *ia_css_pipeline_get_pipe_io_status(void) { return(&sh_css_sp_group.pipe_io_status); diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index 4f7984b75abc..87347013b747 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -49,7 +49,7 @@ #include "ia_css_pipe_util.h" #include "ia_css_pipe_binarydesc.h" #include "ia_css_pipe_stagedesc.h" -#ifdef USE_INPUT_SYSTEM_VERSION_2 +#ifndef ISP2401 #include "ia_css_isys.h" #endif @@ -57,7 +57,7 @@ #include "assert_support.h" #include "math_support.h" #include "sw_event_global.h" /* Event IDs.*/ -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) #include "ia_css_ifmtr.h" #endif #include "input_system.h" @@ -393,7 +393,7 @@ static int set_config_on_frame_enqueue(struct ia_css_frame_info *info, struct frame_data_wrapper *frame); #endif -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 static unsigned int get_crop_lines_for_bayer_order(const struct ia_css_stream_config *config); static unsigned int get_crop_columns_for_bayer_order(const struct @@ -529,7 +529,7 @@ ia_css_stream_input_format_bits_per_pixel(struct ia_css_stream *stream) #define GP_ISEL_TPG_MODE 0x90058 -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) static int sh_css_config_input_network(struct ia_css_stream *stream) { unsigned int fmt_type; @@ -590,7 +590,7 @@ sh_css_config_input_network(struct ia_css_stream *stream) { "sh_css_config_input_network() leave:\n"); return 0; } -#elif defined(USE_INPUT_SYSTEM_VERSION_2401) +#elif defined(ISP2401) static unsigned int csi2_protocol_calculate_max_subpixels_per_line( enum atomisp_input_format format, unsigned int pixels_per_line) @@ -890,7 +890,7 @@ static bool sh_css_translate_stream_cfg_to_input_system_input_port_attr( stream_cfg->source.port.num_lanes; isys_stream_descr->csi_port_attr.fmt_type = fmt_type; isys_stream_descr->csi_port_attr.ch_id = stream_cfg->channel_id; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 isys_stream_descr->online = stream_cfg->online; #endif err |= ia_css_isys_convert_compressed_format( @@ -915,7 +915,7 @@ static bool sh_css_translate_stream_cfg_to_input_system_input_port_attr( stream_cfg->metadata_config.resolution.width; isys_stream_descr->metadata.lines_per_frame = stream_cfg->metadata_config.resolution.height; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* For new input system, number of str2mmio requests must be even. * So we round up number of metadata lines to be even. */ if (isys_stream_descr->metadata.lines_per_frame > 0) @@ -1386,7 +1386,7 @@ start_binary(struct ia_css_pipe *pipe, sh_binary_running = true; #endif -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) if (stream->reconfigure_css_rx) { ia_css_isys_rx_configure(&pipe->stream->csi_rx_config, pipe->stream->config.mode); @@ -1406,7 +1406,7 @@ start_copy_on_sp(struct ia_css_pipe *pipe, if ((!pipe) || (!pipe->stream)) return -EINVAL; -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) if (pipe->stream->reconfigure_css_rx) ia_css_isys_rx_disable(); #endif @@ -1415,7 +1415,7 @@ start_copy_on_sp(struct ia_css_pipe *pipe, return -EINVAL; sh_css_sp_start_binary_copy(ia_css_pipe_get_pipe_num(pipe), out_frame, pipe->stream->config.pixels_per_clock == 2); -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) if (pipe->stream->reconfigure_css_rx) { ia_css_isys_rx_configure(&pipe->stream->csi_rx_config, @@ -1515,7 +1515,7 @@ sh_css_invalidate_shading_tables(struct ia_css_stream *stream) static void enable_interrupts(enum ia_css_irq_type irq_type) { -#ifdef USE_INPUT_SYSTEM_VERSION_2 +#ifndef ISP2401 enum mipi_port_id port; #endif bool enable_pulse = irq_type != IA_CSS_IRQ_TYPE_EDGE; @@ -1538,7 +1538,7 @@ enable_interrupts(enum ia_css_irq_type irq_type) (enum virq_id)(IRQ_SW_CHANNEL1_ID + IRQ_SW_CHANNEL_OFFSET), true); -#ifdef USE_INPUT_SYSTEM_VERSION_2 +#ifndef ISP2401 for (port = 0; port < N_MIPI_PORT_ID; port++) ia_css_isys_rx_enable_all_interrupts(port); #endif @@ -1811,7 +1811,7 @@ ia_css_init(struct device *dev, const struct ia_css_env *env, sh_css_init_buffer_queues(); */ -#if defined(HAS_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) gp_device_reg_store(GP_DEVICE0_ID, _REG_GP_SWITCH_ISYS2401_ADDR, 1); #endif @@ -2076,7 +2076,7 @@ create_host_pipeline(struct ia_css_stream *stream) { } } -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) /* old isys: need to allocate_mipi_frames() even in IA_CSS_PIPE_MODE_COPY */ if (pipe_id != IA_CSS_PIPE_ID_ACC) { @@ -2084,7 +2084,7 @@ create_host_pipeline(struct ia_css_stream *stream) { if (err) goto ERR; } -#elif defined(USE_INPUT_SYSTEM_VERSION_2401) +#elif defined(ISP2401) if ((pipe_id != IA_CSS_PIPE_ID_ACC) && (main_pipe->config.mode != IA_CSS_PIPE_MODE_COPY)) { @@ -2498,7 +2498,7 @@ ia_css_uninit(void) ia_css_rmgr_uninit(); -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) /* needed for reprogramming the inputformatter after power cycle of css */ ifmtr_set_if_blocking_mode_reset = true; #endif @@ -2508,10 +2508,8 @@ ia_css_uninit(void) } ia_css_spctrl_unload_fw(SP0_ID); sh_css_sp_set_sp_running(false); -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) /* check and free any remaining mipi frames */ free_mipi_frames(NULL); -#endif sh_css_sp_reset_global_vars(); @@ -2560,7 +2558,7 @@ int ia_css_irq_translate( case virq_isys_csi: infos |= IA_CSS_IRQ_INFO_INPUT_SYSTEM_ERROR; break; -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) case virq_ifmt0_id: infos |= IA_CSS_IRQ_INFO_IF_ERROR; break; @@ -2599,7 +2597,7 @@ int ia_css_irq_enable( IA_CSS_ENTER("info=%d, enable=%d", info, enable); switch (info) { -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) case IA_CSS_IRQ_INFO_CSS_RECEIVER_SOF: irq = virq_isys_sof; break; @@ -2739,7 +2737,7 @@ alloc_continuous_frames( return -EINVAL; } -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /* For CSI2+, the continuous frame will hold the full input frame */ ref_info.res.width = pipe->stream->config.input_config.input_res.width; ref_info.res.height = pipe->stream->config.input_config.input_res.height; @@ -2832,7 +2830,7 @@ load_preview_binaries(struct ia_css_pipe *pipe) { int err = 0; bool continuous, need_vf_pp = false; bool need_isp_copy_binary = false; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 bool sensor = false; #endif /* preview only have 1 output pin now */ @@ -2846,7 +2844,7 @@ load_preview_binaries(struct ia_css_pipe *pipe) { online = pipe->stream->config.online; continuous = pipe->stream->config.continuous; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 sensor = pipe->stream->config.mode == IA_CSS_INPUT_MODE_SENSOR; #endif @@ -2967,7 +2965,7 @@ load_preview_binaries(struct ia_css_pipe *pipe) { return err; } -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* When the input system is 2401, only the Direct Sensor Mode * Offline Preview uses the ISP copy binary. */ @@ -3308,7 +3306,7 @@ init_vf_frameinfo_defaults(struct ia_css_pipe *pipe, return err; } -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 static unsigned int get_crop_lines_for_bayer_order( const struct ia_css_stream_config *config) @@ -3465,7 +3463,7 @@ init_in_frameinfo_memory_defaults(struct ia_css_pipe *pipe, in_frame->info.format = format; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 if (format == IA_CSS_FRAME_FORMAT_RAW) in_frame->info.format = (pipe->stream->config.pack_raw_pixels) ? IA_CSS_FRAME_FORMAT_RAW_PACKED : IA_CSS_FRAME_FORMAT_RAW; @@ -3482,7 +3480,7 @@ init_in_frameinfo_memory_defaults(struct ia_css_pipe *pipe, ia_css_query_internal_queue_id(IA_CSS_BUFFER_TYPE_INPUT_FRAME, thread_id, &queue_id); in_frame->dynamic_queue_id = queue_id; in_frame->buf_type = IA_CSS_BUFFER_TYPE_INPUT_FRAME; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 ia_css_get_crop_offsets(pipe, &in_frame->info); #endif err = ia_css_frame_init_planes(in_frame); @@ -3553,7 +3551,7 @@ static int create_host_video_pipeline(struct ia_css_pipe *pipe) me->dvs_frame_delay = pipe->dvs_frame_delay; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* When the input system is 2401, always enable 'in_frameinfo_memory' * except for the following: online or continuous */ @@ -3611,7 +3609,7 @@ static int create_host_video_pipeline(struct ia_css_pipe *pipe) goto ERR; in_frame = me->stages->args.out_frame[0]; } else if (pipe->stream->config.continuous) { -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* When continuous is enabled, configure in_frame with the * last pipe, which is the copy pipe. */ @@ -3783,7 +3781,7 @@ create_host_preview_pipeline(struct ia_css_pipe *pipe) { struct ia_css_frame *out_frame; struct ia_css_frame *out_frames[IA_CSS_BINARY_MAX_OUTPUT_PORTS]; bool need_in_frameinfo_memory = false; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 bool sensor = false; bool buffered_sensor = false; bool online = false; @@ -3802,7 +3800,7 @@ create_host_preview_pipeline(struct ia_css_pipe *pipe) { me = &pipe->pipeline; ia_css_pipeline_clean(me); -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* When the input system is 2401, always enable 'in_frameinfo_memory' * except for the following: * - Direct Sensor Mode Online Preview @@ -3854,14 +3852,8 @@ create_host_preview_pipeline(struct ia_css_pipe *pipe) { if (err) goto ERR; in_frame = me->stages->args.out_frame[0]; -#ifndef ISP2401 - } else - { -#else - } else if (pipe->stream->config.continuous) - { -#endif -#ifdef USE_INPUT_SYSTEM_VERSION_2401 + } else if (pipe->stream->config.continuous) { +#ifdef ISP2401 /* When continuous is enabled, configure in_frame with the * last pipe, which is the copy pipe. */ @@ -3973,14 +3965,12 @@ preview_start(struct ia_css_pipe *pipe) { sh_css_metrics_start_frame(); -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) /* multi stream video needs mipi buffers */ err = send_mipi_frames(pipe); if (err) { IA_CSS_LEAVE_ERR_PRIVATE(err); return err; } -#endif send_raw_frames(pipe); { @@ -4456,7 +4446,7 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe, case IA_CSS_BUFFER_TYPE_OUTPUT_FRAME: case IA_CSS_BUFFER_TYPE_SEC_OUTPUT_FRAME: if ((pipe) && (pipe->stop_requested == true)) { -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) /* free mipi frames only for old input system * for 2401 it is done in ia_css_stream_destroy call */ @@ -4488,7 +4478,7 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe, pipe->num_invalid_frames--; if (frame->info.format == IA_CSS_FRAME_FORMAT_BINARY_8) { -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 frame->planes.binary.size = frame->data_bytes; #else frame->planes.binary.size = @@ -5245,7 +5235,7 @@ sh_css_pipes_have_stopped(struct ia_css_stream *stream) return rval; } -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) unsigned int sh_css_get_mipi_sizes_for_check(const unsigned int port, const unsigned int idx) { @@ -5630,7 +5620,7 @@ static int load_video_binaries(struct ia_css_pipe *pipe) pipe->num_invalid_frames, pipe->dvs_frame_delay); /* pqiao TODO: temp hack for PO, should be removed after offline YUVPP is enabled */ -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) /* Copy */ if (!online && !continuous) { /* TODO: what exactly needs doing, prepend the copy binary to @@ -5783,11 +5773,9 @@ static int video_start(struct ia_css_pipe *pipe) /* multi stream video needs mipi buffers */ -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) err = send_mipi_frames(pipe); if (err) return err; -#endif send_raw_frames(pipe); { @@ -6027,7 +6015,7 @@ static int load_primary_binaries( bool need_pp = false; bool need_isp_copy_binary = false; bool need_ldc = false; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 bool sensor = false; #endif struct ia_css_frame_info prim_in_info, @@ -6051,7 +6039,7 @@ static int load_primary_binaries( online = pipe->stream->config.online; memory = pipe->stream->config.mode == IA_CSS_INPUT_MODE_MEMORY; continuous = pipe->stream->config.continuous; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 sensor = (pipe->stream->config.mode == IA_CSS_INPUT_MODE_SENSOR); #endif @@ -6269,7 +6257,7 @@ static int load_primary_binaries( if (err) return err; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* When the input system is 2401, only the Direct Sensor Mode * Offline Capture uses the ISP copy binary. */ @@ -6483,7 +6471,7 @@ static int load_advanced_binaries( } /* Copy */ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* For CSI2+, only the direct sensor mode/online requires ISP copy */ need_isp_copy = pipe->stream->config.mode == IA_CSS_INPUT_MODE_SENSOR; #endif @@ -6630,7 +6618,7 @@ static int load_low_light_binaries( } /* Copy */ -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* For CSI2+, only the direct sensor mode/online requires ISP copy */ need_isp_copy = pipe->stream->config.mode == IA_CSS_INPUT_MODE_SENSOR; #endif @@ -6703,7 +6691,7 @@ static int load_capture_binaries( switch (pipe->config.default_capture_config.mode) { case IA_CSS_CAPTURE_MODE_RAW: err = load_copy_binaries(pipe); -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) if (!err) pipe->pipe_settings.capture.copy_binary.online = pipe->stream->config.online; #endif @@ -7195,7 +7183,7 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) { next_binary = NULL; } -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /* * NOTES * - Why does the "yuvpp" pipe needs "isp_copy_binary" (i.e. ISP Copy) when @@ -7215,9 +7203,9 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) { */ need_isp_copy_binary = (pipe->stream->config.input_config.format == ATOMISP_INPUT_FORMAT_YUV422_8); -#else /* !USE_INPUT_SYSTEM_VERSION_2401 */ +#else /* !ISP2401 */ need_isp_copy_binary = true; -#endif /* USE_INPUT_SYSTEM_VERSION_2401 */ +#endif /* ISP2401 */ if (need_isp_copy_binary) { @@ -7358,13 +7346,11 @@ static int yuvpp_start(struct ia_css_pipe *pipe) /* multi stream video needs mipi buffers */ -#if (defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)) err = send_mipi_frames(pipe); if (err) { IA_CSS_LEAVE_ERR_PRIVATE(err); return err; } -#endif { unsigned int thread_id; @@ -7480,7 +7466,7 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) { struct ia_css_frame *vf_frame[IA_CSS_PIPE_MAX_OUTPUT_STAGE]; struct ia_css_pipeline_stage_desc stage_desc; bool need_in_frameinfo_memory = false; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 bool sensor = false; bool buffered_sensor = false; bool online = false; @@ -7505,7 +7491,7 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) { num_vf_pp_stage = pipe->pipe_settings.yuvpp.num_vf_pp; num_output_stage = pipe->pipe_settings.yuvpp.num_output; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* When the input system is 2401, always enable 'in_frameinfo_memory' * except for the following: * - Direct Sensor Mode Online Capture @@ -7612,7 +7598,7 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) { { struct ia_css_frame *in_frame_local = NULL; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* After isp copy is enabled in_frame needs to be passed. */ if (!online) in_frame_local = in_frame; @@ -7829,7 +7815,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) { struct ia_css_frame *vf_frame; struct ia_css_pipeline_stage_desc stage_desc; bool need_in_frameinfo_memory = false; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 bool sensor = false; bool buffered_sensor = false; bool online = false; @@ -7851,7 +7837,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) { ia_css_pipeline_clean(me); ia_css_pipe_util_create_output_frames(out_frames); -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 /* When the input system is 2401, always enable 'in_frameinfo_memory' * except for the following: * - Direct Sensor Mode Online Capture @@ -7938,7 +7924,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) { { if (raw) { ia_css_pipe_util_set_output_frames(out_frames, 0, out_frame); -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) if (!continuous) { ia_css_pipe_get_generic_stage_desc(&stage_desc, copy_binary, out_frames, in_frame, NULL); @@ -8205,14 +8191,14 @@ static int capture_start( } } -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) /* old isys: need to send_mipi_frames() in all pipe modes */ err = send_mipi_frames(pipe); if (err) { IA_CSS_LEAVE_ERR_PRIVATE(err); return err; } -#elif defined(USE_INPUT_SYSTEM_VERSION_2401) +#elif defined(ISP2401) if (pipe->config.mode != IA_CSS_PIPE_MODE_COPY) { err = send_mipi_frames(pipe); if (err) { @@ -8231,7 +8217,7 @@ static int capture_start( } start_pipe(pipe, copy_ovrd, pipe->stream->config.mode); -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) /* * old isys: for IA_CSS_PIPE_MODE_COPY pipe, isys rx has to be configured, * which is currently done in start_binary(); but COPY pipe contains no binary, @@ -8661,9 +8647,7 @@ sh_css_init_host_sp_control_vars(void) { unsigned int o = offsetof(struct host_sp_communication, host2sp_command) / sizeof(int); -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) unsigned int i; -#endif ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "sh_css_init_host_sp_control_vars() enter: void\n"); @@ -9080,7 +9064,7 @@ ia_css_pipe_override_frame_format(struct ia_css_pipe *pipe, return err; } -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) /* Configuration of INPUT_SYSTEM_VERSION_2401 is done on SP */ static int ia_css_stream_configure_rx(struct ia_css_stream *stream) { @@ -9270,7 +9254,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, int err = -EINVAL; struct ia_css_metadata_info md_info; struct ia_css_resolution effective_res; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 bool aspect_ratio_crop_enabled = false; #endif @@ -9287,7 +9271,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, return err; } -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) /* We don't support metadata for JPEG stream, since they both use str2mem */ if (stream_config->input_config.format == ATOMISP_INPUT_FORMAT_BINARY_8 && stream_config->metadata_config.resolution.height > 0) @@ -9298,7 +9282,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, } #endif -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 if (stream_config->online && stream_config->pack_raw_pixels) { IA_CSS_LOG("online and pack raw is invalid on input system 2401"); @@ -9312,7 +9296,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, /* check if mipi size specified */ if (stream_config->mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR) -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 if (!stream_config->online) #endif { @@ -9392,13 +9376,13 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, /* take over stream config */ curr_stream->config = *stream_config; -#if defined(USE_INPUT_SYSTEM_VERSION_2401) && defined(CSI2P_DISABLE_ISYS2401_ONLINE_MODE) +#if defined(ISP2401) if (stream_config->mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR && stream_config->online) curr_stream->config.online = false; #endif -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 if (curr_stream->config.online) { curr_stream->config.source.port.num_lanes = @@ -9422,12 +9406,12 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, { case IA_CSS_INPUT_MODE_SENSOR: case IA_CSS_INPUT_MODE_BUFFERED_SENSOR: -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) ia_css_stream_configure_rx(curr_stream); #endif break; case IA_CSS_INPUT_MODE_TPG: -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) IA_CSS_LOG("tpg_configuration: x_mask=%d, y_mask=%d, x_delta=%d, y_delta=%d, xy_mask=%d", curr_stream->config.source.tpg.x_mask, curr_stream->config.source.tpg.y_mask, @@ -9444,7 +9428,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, #endif break; case IA_CSS_INPUT_MODE_PRBS: -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) IA_CSS_LOG("mode prbs"); sh_css_sp_configure_prbs(curr_stream->config.source.prbs.seed); #endif @@ -9457,7 +9441,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, IA_CSS_LOG("mode sensor/default"); } -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 err = aspect_ratio_crop_init(curr_stream, pipes, &aspect_ratio_crop_enabled); @@ -9480,7 +9464,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, if (effective_res.height == 0 || effective_res.width == 0) { effective_res = curr_pipe->stream->config.input_config.effective_res; -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /* The aspect ratio cropping is currently only * supported on the new input system. */ if (aspect_ratio_crop_check(aspect_ratio_crop_enabled, curr_pipe)) { @@ -9754,7 +9738,7 @@ ia_css_stream_destroy(struct ia_css_stream *stream) { if ((stream->last_pipe) && ia_css_pipeline_is_mapped(stream->last_pipe->pipe_num)) { -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) bool free_mpi; for (i = 0; i < stream->num_pipes; i++) { @@ -9946,13 +9930,13 @@ ia_css_stream_start(struct ia_css_stream *stream) { return err; } -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) if ((stream->config.mode == IA_CSS_INPUT_MODE_SENSOR) || (stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR)) stream_register_with_csi_rx(stream); #endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) /* Initialize mipi size checks */ if (stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR) { @@ -9988,7 +9972,7 @@ ia_css_stream_stop(struct ia_css_stream *stream) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_stream_stop: stopping %d\n", stream->last_pipe->mode); -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) /* De-initialize mipi size checks */ if (stream->config.mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR) { @@ -10466,7 +10450,7 @@ void ia_css_pipe_map_queue(struct ia_css_pipe *pipe, bool map) ia_css_pipeline_get_sp_thread_id(pipe_num, &thread_id); -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) need_input_queue = true; #else need_input_queue = pipe->stream->config.mode == IA_CSS_INPUT_MODE_MEMORY; @@ -10795,7 +10779,7 @@ ia_css_pipe_update_qos_ext_mapped_arg(struct ia_css_pipe *pipe, return err; } -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 static int aspect_ratio_crop_init(struct ia_css_stream *curr_stream, struct ia_css_pipe *pipes[], diff --git a/drivers/staging/media/atomisp/pci/sh_css_defs.h b/drivers/staging/media/atomisp/pci/sh_css_defs.h index 92d80213860f..30a84a587b2a 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_defs.h +++ b/drivers/staging/media/atomisp/pci/sh_css_defs.h @@ -397,10 +397,6 @@ RGB[0,8191],coef[-8192,8191] -> RGB[0,8191] #define SH_CSS_MAX_STAGES 8 /* primary_stage[1-6], capture_pp, vf_pp */ /* For CSI2+ input system, it requires extra paddinga from vmem */ -#ifdef CONFIG_CSI2_PLUS -#define _ISP_EXTRA_PADDING_VECS 2 -#else #define _ISP_EXTRA_PADDING_VECS 0 -#endif /* CONFIG_CSI2_PLUS */ #endif /* _SH_CSS_DEFS_H_ */ diff --git a/drivers/staging/media/atomisp/pci/sh_css_internal.h b/drivers/staging/media/atomisp/pci/sh_css_internal.h index 54847abf667a..415353ceb7f6 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_internal.h +++ b/drivers/staging/media/atomisp/pci/sh_css_internal.h @@ -22,7 +22,7 @@ #include #include -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) #include "input_formatter.h" #endif #include "input_system.h" @@ -86,11 +86,9 @@ #define SH_CSS_MAX_IF_CONFIGS 3 /* Must match with IA_CSS_NR_OF_CONFIGS (not defined yet).*/ #define SH_CSS_IF_CONFIG_NOT_NEEDED 0xFF -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) #define SH_CSS_ENABLE_METADATA -#endif -#if defined(SH_CSS_ENABLE_METADATA) && !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(SH_CSS_ENABLE_METADATA) && !defined(ISP2401) #define SH_CSS_ENABLE_METADATA_THREAD #endif @@ -320,15 +318,9 @@ struct sh_css_sp_debug_state { #elif SP_DEBUG == SP_DEBUG_TRACE -#if 1 /* Example of just one global trace */ #define SH_CSS_SP_DBG_NR_OF_TRACES (1) #define SH_CSS_SP_DBG_TRACE_DEPTH (40) -#else -/* E.g. if you like separate traces for 4 threads */ -#define SH_CSS_SP_DBG_NR_OF_TRACES (4) -#define SH_CSS_SP_DBG_TRACE_DEPTH (10) -#endif #define SH_CSS_SP_DBG_TRACE_FILE_ID_BIT_POS (13) @@ -371,7 +363,7 @@ struct sh_css_sp_debug_command { u32 dma_sw_reg; }; -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) /* SP input formatter configuration.*/ struct sh_css_sp_input_formatter_set { u32 stream_format; @@ -391,7 +383,7 @@ struct sh_css_sp_config { frames are locked when their EOF event is successfully sent to the host (true) or when they are passed to the preview/video pipe (false). */ -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) struct { u8 a_changed; u8 b_changed; @@ -400,7 +392,7 @@ struct sh_css_sp_config { set[SH_CSS_MAX_IF_CONFIGS]; /* CSI-2 port is used as index. */ } input_formatter; #endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) sync_generator_cfg_t sync_gen; tpg_cfg_t tpg; prbs_cfg_t prbs; @@ -423,7 +415,7 @@ enum sh_css_stage_type { #define SH_CSS_PIPE_CONFIG_SAMPLE_PARAMS_MASK \ ((SH_CSS_PIPE_CONFIG_SAMPLE_PARAMS << SH_CSS_MAX_SP_THREADS) - 1) -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) struct sh_css_sp_pipeline_terminal { union { /* Input System 2401 */ @@ -679,7 +671,7 @@ struct sh_css_sp_stage { struct sh_css_sp_group { struct sh_css_sp_config config; struct sh_css_sp_pipeline pipe[SH_CSS_MAX_SP_THREADS]; -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) struct sh_css_sp_pipeline_io pipe_io[SH_CSS_MAX_SP_THREADS]; struct sh_css_sp_pipeline_io_status pipe_io_status; #endif @@ -828,11 +820,9 @@ struct host_sp_communication { ia_css_ptr host2sp_offline_frames[NUM_CONTINUOUS_FRAMES]; ia_css_ptr host2sp_offline_metadata[NUM_CONTINUOUS_FRAMES]; -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) ia_css_ptr host2sp_mipi_frames[N_CSI_PORTS][NUM_MIPI_FRAMES_PER_STREAM]; ia_css_ptr host2sp_mipi_metadata[N_CSI_PORTS][NUM_MIPI_FRAMES_PER_STREAM]; u32 host2sp_num_mipi_frames[N_CSI_PORTS]; -#endif u32 host2sp_cont_avail_num_raw_frames; u32 host2sp_cont_extra_num_raw_frames; u32 host2sp_cont_target_num_raw_frames; @@ -840,20 +830,12 @@ struct host_sp_communication { }; -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) #define SIZE_OF_HOST_SP_COMMUNICATION_STRUCT \ (sizeof(uint32_t) + \ (NUM_CONTINUOUS_FRAMES * SIZE_OF_HRT_VADDRESS * 2) + \ (N_CSI_PORTS * NUM_MIPI_FRAMES_PER_STREAM * SIZE_OF_HRT_VADDRESS * 2) + \ ((3 + N_CSI_PORTS) * sizeof(uint32_t)) + \ (NR_OF_PIPELINES * SIZE_OF_SH_CSS_EVENT_IRQ_MASK_STRUCT)) -#else -#define SIZE_OF_HOST_SP_COMMUNICATION_STRUCT \ - (sizeof(uint32_t) + \ - (NUM_CONTINUOUS_FRAMES * SIZE_OF_HRT_VADDRESS * 2) + \ - (3 * sizeof(uint32_t)) + \ - (NR_OF_PIPELINES * SIZE_OF_SH_CSS_EVENT_IRQ_MASK_STRUCT)) -#endif struct host_sp_queues { /* @@ -987,7 +969,7 @@ sh_css_frame_info_set_width(struct ia_css_frame_info *info, unsigned int width, unsigned int aligned); -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) unsigned int sh_css_get_mipi_sizes_for_check(const unsigned int port, @@ -1036,7 +1018,7 @@ sh_css_continuous_is_enabled(uint8_t pipe_num); struct ia_css_pipe * find_pipe_by_num(uint32_t pipe_num); -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 void ia_css_get_crop_offsets( struct ia_css_pipe *pipe, diff --git a/drivers/staging/media/atomisp/pci/sh_css_mipi.c b/drivers/staging/media/atomisp/pci/sh_css_mipi.c index a0be171fba83..ba7d406bcc10 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_mipi.c +++ b/drivers/staging/media/atomisp/pci/sh_css_mipi.c @@ -30,10 +30,8 @@ #include "sh_css_sp.h" /* sh_css_update_host2sp_mipi_frame sh_css_update_host2sp_num_mipi_frames ... */ #include "sw_event_global.h" /* IA_CSS_PSYS_SW_EVENT_MIPI_BUFFERS_READY */ -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) static u32 ref_count_mipi_allocation[N_CSI_PORTS]; /* Initialized in mipi_init */ -#endif int ia_css_mipi_frame_specify(const unsigned int size_mem_words, @@ -120,7 +118,7 @@ ia_css_mipi_frame_calculate_size(const unsigned int width, unsigned int mem_words = 0; unsigned int width_padded = width; -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) /* The changes will be reverted as soon as RAW * Buffers are deployed by the 2401 Input System * in the non-continuous use scenario. @@ -246,7 +244,7 @@ ia_css_mipi_frame_calculate_size(const unsigned int width, return err; } -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) int ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port, const unsigned int size_mem_words) { @@ -275,19 +273,17 @@ ia_css_mipi_frame_enable_check_on_size(const enum mipi_port_id port, void mipi_init(void) { -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) unsigned int i; for (i = 0; i < N_CSI_PORTS; i++) ref_count_mipi_allocation[i] = 0; -#endif } int calculate_mipi_buff_size( struct ia_css_stream_config *stream_cfg, unsigned int *size_mem_words) { -#if !defined(USE_INPUT_SYSTEM_VERSION_2401) +#if !defined(ISP2401) int err = -EINVAL; (void)stream_cfg; (void)size_mem_words; @@ -409,7 +405,6 @@ static bool buffers_needed(struct ia_css_pipe *pipe) int allocate_mipi_frames(struct ia_css_pipe *pipe, struct ia_css_stream_info *info) { -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) int err = -EINVAL; unsigned int port; struct ia_css_frame_info mipi_intermediate_info; @@ -427,7 +422,7 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, return -EINVAL; } -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 if (pipe->stream->config.online) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, @@ -459,13 +454,13 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, return -EINVAL; } -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 err = calculate_mipi_buff_size( &pipe->stream->config, &my_css.mipi_frame_size[port]); #endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) if (ref_count_mipi_allocation[port] != 0) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, @@ -560,16 +555,10 @@ allocate_mipi_frames(struct ia_css_pipe *pipe, "allocate_mipi_frames(%p) exit:\n", pipe); return err; -#else - (void)pipe; - (void)info; - return 0; -#endif } int free_mipi_frames(struct ia_css_pipe *pipe) { -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) int err = -EINVAL; unsigned int port; @@ -609,7 +598,7 @@ free_mipi_frames(struct ia_css_pipe *pipe) { } if (ref_count_mipi_allocation[port] > 0) { -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) assert(ref_count_mipi_allocation[port] == 1); if (ref_count_mipi_allocation[port] != 1) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, @@ -641,7 +630,7 @@ free_mipi_frames(struct ia_css_pipe *pipe) { ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE_PRIVATE, "free_mipi_frames(%p) exit (deallocated).\n", pipe); } -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) else { /* 2401 system allows multiple streams to use same physical port. This is not * true for 2400 system. Currently 2401 uses MIPI buffers as a temporary solution. @@ -675,15 +664,11 @@ free_mipi_frames(struct ia_css_pipe *pipe) { ref_count_mipi_allocation[port] = 0; } } -#else - (void)pipe; -#endif return 0; } int send_mipi_frames(struct ia_css_pipe *pipe) { -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) int err = -EINVAL; unsigned int i; #ifndef ISP2401 @@ -751,8 +736,5 @@ send_mipi_frames(struct ia_css_pipe *pipe) { (uint8_t)my_css.num_mipi_frames[port], 0 /* not used */); IA_CSS_LEAVE_ERR_PRIVATE(0); -#else - (void)pipe; -#endif return 0; } diff --git a/drivers/staging/media/atomisp/pci/sh_css_param_shading.c b/drivers/staging/media/atomisp/pci/sh_css_param_shading.c index 046f34857891..ed496f6d28f0 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_param_shading.c +++ b/drivers/staging/media/atomisp/pci/sh_css_param_shading.c @@ -258,7 +258,7 @@ prepare_shading_table(const struct ia_css_shading_table *in_table, /* We use the ISP input resolution for the shading table because shading correction is performed in the bayer domain (before bayer down scaling). */ -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) padded_width = CEIL_MUL(binary->effective_in_frame_res.width + 2 * ISP_VEC_NELEMS, 2 * ISP_VEC_NELEMS); diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c index 6d827ec67192..fa0158c190a7 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_params.c +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c @@ -55,9 +55,6 @@ #include "ia_css_host_data.h" #include "ia_css_pipe.h" #include "ia_css_pipe_binarydesc.h" -#if 0 -#include "ia_css_system_ctrl.h" -#endif /* Include all kernel host interfaces for ISP1 */ @@ -143,535 +140,6 @@ static int interleaved_lut_temp[4][HRT_GDC_N]; /* Digital Zoom lookup table. See documentation for more details about the * contents of this table. */ -#if defined(CONFIG_CSI2_PLUS) -/* - * Coefficients from - * Css_Mizuchi/regressions/20140424_0930/all/applications/common/gdc_v2_common/lut.h - */ - -static const int zoom_table[4][HRT_GDC_N] = { - { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -2, -2, -2, -2, -2, -2, -2, - -3, -3, -3, -3, -3, -3, -3, -4, - -4, -4, -4, -4, -5, -5, -5, -5, - -5, -5, -6, -6, -6, -6, -7, -7, - -7, -7, -7, -8, -8, -8, -8, -9, - -9, -9, -9, -10, -10, -10, -10, -11, - -11, -11, -12, -12, -12, -12, -13, -13, - -13, -14, -14, -14, -15, -15, -15, -15, - -16, -16, -16, -17, -17, -17, -18, -18, - -18, -19, -19, -20, -20, -20, -21, -21, - -21, -22, -22, -22, -23, -23, -24, -24, - -24, -25, -25, -25, -26, -26, -27, -27, - -28, -28, -28, -29, -29, -30, -30, -30, - -31, -31, -32, -32, -33, -33, -33, -34, - -34, -35, -35, -36, -36, -37, -37, -37, - -38, -38, -39, -39, -40, -40, -41, -41, - -42, -42, -43, -43, -44, -44, -45, -45, - -46, -46, -47, -47, -48, -48, -49, -49, - -50, -50, -51, -51, -52, -52, -53, -53, - -54, -54, -55, -55, -56, -56, -57, -57, - -58, -59, -59, -60, -60, -61, -61, -62, - -62, -63, -63, -64, -65, -65, -66, -66, - -67, -67, -68, -69, -69, -70, -70, -71, - -71, -72, -73, -73, -74, -74, -75, -75, - -76, -77, -77, -78, -78, -79, -80, -80, - -81, -81, -82, -83, -83, -84, -84, -85, - -86, -86, -87, -87, -88, -89, -89, -90, - -91, -91, -92, -92, -93, -94, -94, -95, - -96, -96, -97, -97, -98, -99, -99, -100, - -101, -101, -102, -102, -103, -104, -104, -105, - -106, -106, -107, -108, -108, -109, -109, -110, - -111, -111, -112, -113, -113, -114, -115, -115, - -116, -117, -117, -118, -119, -119, -120, -121, - -121, -122, -122, -123, -124, -124, -125, -126, - -126, -127, -128, -128, -129, -130, -130, -131, - -132, -132, -133, -134, -134, -135, -136, -136, - -137, -138, -138, -139, -140, -140, -141, -142, - -142, -143, -144, -144, -145, -146, -146, -147, - -148, -148, -149, -150, -150, -151, -152, -152, - -153, -154, -154, -155, -156, -156, -157, -158, - -158, -159, -160, -160, -161, -162, -162, -163, - -164, -164, -165, -166, -166, -167, -168, -168, - -169, -170, -170, -171, -172, -172, -173, -174, - -174, -175, -176, -176, -177, -178, -178, -179, - -180, -180, -181, -181, -182, -183, -183, -184, - -185, -185, -186, -187, -187, -188, -189, -189, - -190, -191, -191, -192, -193, -193, -194, -194, - -195, -196, -196, -197, -198, -198, -199, -200, - -200, -201, -201, -202, -203, -203, -204, -205, - -205, -206, -206, -207, -208, -208, -209, -210, - -210, -211, -211, -212, -213, -213, -214, -215, - -215, -216, -216, -217, -218, -218, -219, -219, - -220, -221, -221, -222, -222, -223, -224, -224, - -225, -225, -226, -227, -227, -228, -228, -229, - -229, -230, -231, -231, -232, -232, -233, -233, - -234, -235, -235, -236, -236, -237, -237, -238, - -239, -239, -240, -240, -241, -241, -242, -242, - -243, -244, -244, -245, -245, -246, -246, -247, - -247, -248, -248, -249, -249, -250, -250, -251, - -251, -252, -252, -253, -253, -254, -254, -255, - -256, -256, -256, -257, -257, -258, -258, -259, - -259, -260, -260, -261, -261, -262, -262, -263, - -263, -264, -264, -265, -265, -266, -266, -266, - -267, -267, -268, -268, -269, -269, -270, -270, - -270, -271, -271, -272, -272, -273, -273, -273, - -274, -274, -275, -275, -275, -276, -276, -277, - -277, -277, -278, -278, -279, -279, -279, -280, - -280, -280, -281, -281, -282, -282, -282, -283, - -283, -283, -284, -284, -284, -285, -285, -285, - -286, -286, -286, -287, -287, -287, -288, -288, - -288, -289, -289, -289, -289, -290, -290, -290, - -291, -291, -291, -291, -292, -292, -292, -293, - -293, -293, -293, -294, -294, -294, -294, -295, - -295, -295, -295, -295, -296, -296, -296, -296, - -297, -297, -297, -297, -297, -298, -298, -298, - -298, -298, -299, -299, -299, -299, -299, -299, - -300, -300, -300, -300, -300, -300, -300, -301, - -301, -301, -301, -301, -301, -301, -301, -301, - -302, -302, -302, -302, -302, -302, -302, -302, - -302, -302, -302, -302, -302, -303, -303, -303, - -303, -303, -303, -303, -303, -303, -303, -303, - -303, -303, -303, -303, -303, -303, -303, -303, - -303, -303, -303, -303, -303, -303, -303, -303, - -303, -303, -302, -302, -302, -302, -302, -302, - -302, -302, -302, -302, -302, -302, -301, -301, - -301, -301, -301, -301, -301, -301, -300, -300, - -300, -300, -300, -300, -299, -299, -299, -299, - -299, -299, -298, -298, -298, -298, -298, -297, - -297, -297, -297, -296, -296, -296, -296, -295, - -295, -295, -295, -294, -294, -294, -293, -293, - -293, -293, -292, -292, -292, -291, -291, -291, - -290, -290, -290, -289, -289, -289, -288, -288, - -288, -287, -287, -286, -286, -286, -285, -285, - -284, -284, -284, -283, -283, -282, -282, -281, - -281, -280, -280, -279, -279, -279, -278, -278, - -277, -277, -276, -276, -275, -275, -274, -273, - -273, -272, -272, -271, -271, -270, -270, -269, - -268, -268, -267, -267, -266, -266, -265, -264, - -264, -263, -262, -262, -261, -260, -260, -259, - -259, -258, -257, -256, -256, -255, -254, -254, - -253, -252, -252, -251, -250, -249, -249, -248, - -247, -246, -246, -245, -244, -243, -242, -242, - -241, -240, -239, -238, -238, -237, -236, -235, - -234, -233, -233, -232, -231, -230, -229, -228, - -227, -226, -226, -225, -224, -223, -222, -221, - -220, -219, -218, -217, -216, -215, -214, -213, - -212, -211, -210, -209, -208, -207, -206, -205, - -204, -203, -202, -201, -200, -199, -198, -197, - -196, -194, -193, -192, -191, -190, -189, -188, - -187, -185, -184, -183, -182, -181, -180, -178, - -177, -176, -175, -174, -172, -171, -170, -169, - -167, -166, -165, -164, -162, -161, -160, -158, - -157, -156, -155, -153, -152, -151, -149, -148, - -147, -145, -144, -142, -141, -140, -138, -137, - -135, -134, -133, -131, -130, -128, -127, -125, - -124, -122, -121, -120, -118, -117, -115, -114, - -112, -110, -109, -107, -106, -104, -103, -101, - -100, -98, -96, -95, -93, -92, -90, -88, - -87, -85, -83, -82, -80, -78, -77, -75, - -73, -72, -70, -68, -67, -65, -63, -61, - -60, -58, -56, -54, -52, -51, -49, -47, - -45, -43, -42, -40, -38, -36, -34, -32, - -31, -29, -27, -25, -23, -21, -19, -17, - -15, -13, -11, -9, -7, -5, -3, -1 - }, - { - 0, 2, 4, 6, 8, 10, 12, 14, - 16, 18, 20, 22, 25, 27, 29, 31, - 33, 36, 38, 40, 43, 45, 47, 50, - 52, 54, 57, 59, 61, 64, 66, 69, - 71, 74, 76, 79, 81, 84, 86, 89, - 92, 94, 97, 99, 102, 105, 107, 110, - 113, 116, 118, 121, 124, 127, 129, 132, - 135, 138, 141, 144, 146, 149, 152, 155, - 158, 161, 164, 167, 170, 173, 176, 179, - 182, 185, 188, 191, 194, 197, 200, 203, - 207, 210, 213, 216, 219, 222, 226, 229, - 232, 235, 239, 242, 245, 248, 252, 255, - 258, 262, 265, 269, 272, 275, 279, 282, - 286, 289, 292, 296, 299, 303, 306, 310, - 313, 317, 321, 324, 328, 331, 335, 338, - 342, 346, 349, 353, 357, 360, 364, 368, - 372, 375, 379, 383, 386, 390, 394, 398, - 402, 405, 409, 413, 417, 421, 425, 429, - 432, 436, 440, 444, 448, 452, 456, 460, - 464, 468, 472, 476, 480, 484, 488, 492, - 496, 500, 504, 508, 512, 516, 521, 525, - 529, 533, 537, 541, 546, 550, 554, 558, - 562, 567, 571, 575, 579, 584, 588, 592, - 596, 601, 605, 609, 614, 618, 622, 627, - 631, 635, 640, 644, 649, 653, 657, 662, - 666, 671, 675, 680, 684, 689, 693, 698, - 702, 707, 711, 716, 720, 725, 729, 734, - 738, 743, 747, 752, 757, 761, 766, 771, - 775, 780, 784, 789, 794, 798, 803, 808, - 813, 817, 822, 827, 831, 836, 841, 846, - 850, 855, 860, 865, 870, 874, 879, 884, - 889, 894, 898, 903, 908, 913, 918, 923, - 928, 932, 937, 942, 947, 952, 957, 962, - 967, 972, 977, 982, 986, 991, 996, 1001, - 1006, 1011, 1016, 1021, 1026, 1031, 1036, 1041, - 1046, 1051, 1056, 1062, 1067, 1072, 1077, 1082, - 1087, 1092, 1097, 1102, 1107, 1112, 1117, 1122, - 1128, 1133, 1138, 1143, 1148, 1153, 1158, 1164, - 1169, 1174, 1179, 1184, 1189, 1195, 1200, 1205, - 1210, 1215, 1221, 1226, 1231, 1236, 1242, 1247, - 1252, 1257, 1262, 1268, 1273, 1278, 1284, 1289, - 1294, 1299, 1305, 1310, 1315, 1321, 1326, 1331, - 1336, 1342, 1347, 1352, 1358, 1363, 1368, 1374, - 1379, 1384, 1390, 1395, 1400, 1406, 1411, 1417, - 1422, 1427, 1433, 1438, 1443, 1449, 1454, 1460, - 1465, 1470, 1476, 1481, 1487, 1492, 1497, 1503, - 1508, 1514, 1519, 1525, 1530, 1535, 1541, 1546, - 1552, 1557, 1563, 1568, 1574, 1579, 1585, 1590, - 1596, 1601, 1606, 1612, 1617, 1623, 1628, 1634, - 1639, 1645, 1650, 1656, 1661, 1667, 1672, 1678, - 1683, 1689, 1694, 1700, 1705, 1711, 1716, 1722, - 1727, 1733, 1738, 1744, 1749, 1755, 1761, 1766, - 1772, 1777, 1783, 1788, 1794, 1799, 1805, 1810, - 1816, 1821, 1827, 1832, 1838, 1844, 1849, 1855, - 1860, 1866, 1871, 1877, 1882, 1888, 1893, 1899, - 1905, 1910, 1916, 1921, 1927, 1932, 1938, 1943, - 1949, 1955, 1960, 1966, 1971, 1977, 1982, 1988, - 1993, 1999, 2005, 2010, 2016, 2021, 2027, 2032, - 2038, 2043, 2049, 2055, 2060, 2066, 2071, 2077, - 2082, 2088, 2093, 2099, 2105, 2110, 2116, 2121, - 2127, 2132, 2138, 2143, 2149, 2154, 2160, 2165, - 2171, 2177, 2182, 2188, 2193, 2199, 2204, 2210, - 2215, 2221, 2226, 2232, 2237, 2243, 2248, 2254, - 2259, 2265, 2270, 2276, 2281, 2287, 2292, 2298, - 2304, 2309, 2314, 2320, 2325, 2331, 2336, 2342, - 2347, 2353, 2358, 2364, 2369, 2375, 2380, 2386, - 2391, 2397, 2402, 2408, 2413, 2419, 2424, 2429, - 2435, 2440, 2446, 2451, 2457, 2462, 2467, 2473, - 2478, 2484, 2489, 2495, 2500, 2505, 2511, 2516, - 2522, 2527, 2532, 2538, 2543, 2549, 2554, 2559, - 2565, 2570, 2575, 2581, 2586, 2591, 2597, 2602, - 2607, 2613, 2618, 2623, 2629, 2634, 2639, 2645, - 2650, 2655, 2661, 2666, 2671, 2676, 2682, 2687, - 2692, 2698, 2703, 2708, 2713, 2719, 2724, 2729, - 2734, 2740, 2745, 2750, 2755, 2760, 2766, 2771, - 2776, 2781, 2786, 2792, 2797, 2802, 2807, 2812, - 2817, 2823, 2828, 2833, 2838, 2843, 2848, 2853, - 2859, 2864, 2869, 2874, 2879, 2884, 2889, 2894, - 2899, 2904, 2909, 2914, 2919, 2924, 2930, 2935, - 2940, 2945, 2950, 2955, 2960, 2965, 2970, 2975, - 2980, 2984, 2989, 2994, 2999, 3004, 3009, 3014, - 3019, 3024, 3029, 3034, 3039, 3044, 3048, 3053, - 3058, 3063, 3068, 3073, 3078, 3082, 3087, 3092, - 3097, 3102, 3106, 3111, 3116, 3121, 3126, 3130, - 3135, 3140, 3145, 3149, 3154, 3159, 3163, 3168, - 3173, 3177, 3182, 3187, 3191, 3196, 3201, 3205, - 3210, 3215, 3219, 3224, 3228, 3233, 3238, 3242, - 3247, 3251, 3256, 3260, 3265, 3269, 3274, 3279, - 3283, 3287, 3292, 3296, 3301, 3305, 3310, 3314, - 3319, 3323, 3327, 3332, 3336, 3341, 3345, 3349, - 3354, 3358, 3362, 3367, 3371, 3375, 3380, 3384, - 3388, 3393, 3397, 3401, 3405, 3410, 3414, 3418, - 3422, 3426, 3431, 3435, 3439, 3443, 3447, 3451, - 3455, 3460, 3464, 3468, 3472, 3476, 3480, 3484, - 3488, 3492, 3496, 3500, 3504, 3508, 3512, 3516, - 3520, 3524, 3528, 3532, 3536, 3540, 3544, 3548, - 3552, 3555, 3559, 3563, 3567, 3571, 3575, 3578, - 3582, 3586, 3590, 3593, 3597, 3601, 3605, 3608, - 3612, 3616, 3619, 3623, 3627, 3630, 3634, 3638, - 3641, 3645, 3649, 3652, 3656, 3659, 3663, 3666, - 3670, 3673, 3677, 3680, 3684, 3687, 3691, 3694, - 3698, 3701, 3704, 3708, 3711, 3714, 3718, 3721, - 3724, 3728, 3731, 3734, 3738, 3741, 3744, 3747, - 3751, 3754, 3757, 3760, 3763, 3767, 3770, 3773, - 3776, 3779, 3782, 3785, 3788, 3791, 3794, 3798, - 3801, 3804, 3807, 3809, 3812, 3815, 3818, 3821, - 3824, 3827, 3830, 3833, 3836, 3839, 3841, 3844, - 3847, 3850, 3853, 3855, 3858, 3861, 3864, 3866, - 3869, 3872, 3874, 3877, 3880, 3882, 3885, 3887, - 3890, 3893, 3895, 3898, 3900, 3903, 3905, 3908, - 3910, 3913, 3915, 3917, 3920, 3922, 3925, 3927, - 3929, 3932, 3934, 3936, 3939, 3941, 3943, 3945, - 3948, 3950, 3952, 3954, 3956, 3958, 3961, 3963, - 3965, 3967, 3969, 3971, 3973, 3975, 3977, 3979, - 3981, 3983, 3985, 3987, 3989, 3991, 3993, 3994, - 3996, 3998, 4000, 4002, 4004, 4005, 4007, 4009, - 4011, 4012, 4014, 4016, 4017, 4019, 4021, 4022, - 4024, 4025, 4027, 4028, 4030, 4031, 4033, 4034, - 4036, 4037, 4039, 4040, 4042, 4043, 4044, 4046, - 4047, 4048, 4050, 4051, 4052, 4053, 4055, 4056, - 4057, 4058, 4059, 4060, 4062, 4063, 4064, 4065, - 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, - 4074, 4075, 4075, 4076, 4077, 4078, 4079, 4079, - 4080, 4081, 4082, 4082, 4083, 4084, 4084, 4085, - 4086, 4086, 4087, 4087, 4088, 4088, 4089, 4089, - 4090, 4090, 4091, 4091, 4092, 4092, 4092, 4093, - 4093, 4093, 4094, 4094, 4094, 4094, 4095, 4095, - 4095, 4095, 4095, 4095, 4095, 4095, 4095, 4095 - }, - { - 4096, 4095, 4095, 4095, 4095, 4095, 4095, 4095, - 4095, 4095, 4095, 4094, 4094, 4094, 4094, 4093, - 4093, 4093, 4092, 4092, 4092, 4091, 4091, 4090, - 4090, 4089, 4089, 4088, 4088, 4087, 4087, 4086, - 4086, 4085, 4084, 4084, 4083, 4082, 4082, 4081, - 4080, 4079, 4079, 4078, 4077, 4076, 4075, 4075, - 4074, 4073, 4072, 4071, 4070, 4069, 4068, 4067, - 4066, 4065, 4064, 4063, 4062, 4060, 4059, 4058, - 4057, 4056, 4055, 4053, 4052, 4051, 4050, 4048, - 4047, 4046, 4044, 4043, 4042, 4040, 4039, 4037, - 4036, 4034, 4033, 4031, 4030, 4028, 4027, 4025, - 4024, 4022, 4021, 4019, 4017, 4016, 4014, 4012, - 4011, 4009, 4007, 4005, 4004, 4002, 4000, 3998, - 3996, 3994, 3993, 3991, 3989, 3987, 3985, 3983, - 3981, 3979, 3977, 3975, 3973, 3971, 3969, 3967, - 3965, 3963, 3961, 3958, 3956, 3954, 3952, 3950, - 3948, 3945, 3943, 3941, 3939, 3936, 3934, 3932, - 3929, 3927, 3925, 3922, 3920, 3917, 3915, 3913, - 3910, 3908, 3905, 3903, 3900, 3898, 3895, 3893, - 3890, 3887, 3885, 3882, 3880, 3877, 3874, 3872, - 3869, 3866, 3864, 3861, 3858, 3855, 3853, 3850, - 3847, 3844, 3841, 3839, 3836, 3833, 3830, 3827, - 3824, 3821, 3818, 3815, 3812, 3809, 3807, 3804, - 3801, 3798, 3794, 3791, 3788, 3785, 3782, 3779, - 3776, 3773, 3770, 3767, 3763, 3760, 3757, 3754, - 3751, 3747, 3744, 3741, 3738, 3734, 3731, 3728, - 3724, 3721, 3718, 3714, 3711, 3708, 3704, 3701, - 3698, 3694, 3691, 3687, 3684, 3680, 3677, 3673, - 3670, 3666, 3663, 3659, 3656, 3652, 3649, 3645, - 3641, 3638, 3634, 3630, 3627, 3623, 3619, 3616, - 3612, 3608, 3605, 3601, 3597, 3593, 3590, 3586, - 3582, 3578, 3575, 3571, 3567, 3563, 3559, 3555, - 3552, 3548, 3544, 3540, 3536, 3532, 3528, 3524, - 3520, 3516, 3512, 3508, 3504, 3500, 3496, 3492, - 3488, 3484, 3480, 3476, 3472, 3468, 3464, 3460, - 3455, 3451, 3447, 3443, 3439, 3435, 3431, 3426, - 3422, 3418, 3414, 3410, 3405, 3401, 3397, 3393, - 3388, 3384, 3380, 3375, 3371, 3367, 3362, 3358, - 3354, 3349, 3345, 3341, 3336, 3332, 3327, 3323, - 3319, 3314, 3310, 3305, 3301, 3296, 3292, 3287, - 3283, 3279, 3274, 3269, 3265, 3260, 3256, 3251, - 3247, 3242, 3238, 3233, 3228, 3224, 3219, 3215, - 3210, 3205, 3201, 3196, 3191, 3187, 3182, 3177, - 3173, 3168, 3163, 3159, 3154, 3149, 3145, 3140, - 3135, 3130, 3126, 3121, 3116, 3111, 3106, 3102, - 3097, 3092, 3087, 3082, 3078, 3073, 3068, 3063, - 3058, 3053, 3048, 3044, 3039, 3034, 3029, 3024, - 3019, 3014, 3009, 3004, 2999, 2994, 2989, 2984, - 2980, 2975, 2970, 2965, 2960, 2955, 2950, 2945, - 2940, 2935, 2930, 2924, 2919, 2914, 2909, 2904, - 2899, 2894, 2889, 2884, 2879, 2874, 2869, 2864, - 2859, 2853, 2848, 2843, 2838, 2833, 2828, 2823, - 2817, 2812, 2807, 2802, 2797, 2792, 2786, 2781, - 2776, 2771, 2766, 2760, 2755, 2750, 2745, 2740, - 2734, 2729, 2724, 2719, 2713, 2708, 2703, 2698, - 2692, 2687, 2682, 2676, 2671, 2666, 2661, 2655, - 2650, 2645, 2639, 2634, 2629, 2623, 2618, 2613, - 2607, 2602, 2597, 2591, 2586, 2581, 2575, 2570, - 2565, 2559, 2554, 2549, 2543, 2538, 2532, 2527, - 2522, 2516, 2511, 2505, 2500, 2495, 2489, 2484, - 2478, 2473, 2467, 2462, 2457, 2451, 2446, 2440, - 2435, 2429, 2424, 2419, 2413, 2408, 2402, 2397, - 2391, 2386, 2380, 2375, 2369, 2364, 2358, 2353, - 2347, 2342, 2336, 2331, 2325, 2320, 2314, 2309, - 2304, 2298, 2292, 2287, 2281, 2276, 2270, 2265, - 2259, 2254, 2248, 2243, 2237, 2232, 2226, 2221, - 2215, 2210, 2204, 2199, 2193, 2188, 2182, 2177, - 2171, 2165, 2160, 2154, 2149, 2143, 2138, 2132, - 2127, 2121, 2116, 2110, 2105, 2099, 2093, 2088, - 2082, 2077, 2071, 2066, 2060, 2055, 2049, 2043, - 2038, 2032, 2027, 2021, 2016, 2010, 2005, 1999, - 1993, 1988, 1982, 1977, 1971, 1966, 1960, 1955, - 1949, 1943, 1938, 1932, 1927, 1921, 1916, 1910, - 1905, 1899, 1893, 1888, 1882, 1877, 1871, 1866, - 1860, 1855, 1849, 1844, 1838, 1832, 1827, 1821, - 1816, 1810, 1805, 1799, 1794, 1788, 1783, 1777, - 1772, 1766, 1761, 1755, 1749, 1744, 1738, 1733, - 1727, 1722, 1716, 1711, 1705, 1700, 1694, 1689, - 1683, 1678, 1672, 1667, 1661, 1656, 1650, 1645, - 1639, 1634, 1628, 1623, 1617, 1612, 1606, 1601, - 1596, 1590, 1585, 1579, 1574, 1568, 1563, 1557, - 1552, 1546, 1541, 1535, 1530, 1525, 1519, 1514, - 1508, 1503, 1497, 1492, 1487, 1481, 1476, 1470, - 1465, 1460, 1454, 1449, 1443, 1438, 1433, 1427, - 1422, 1417, 1411, 1406, 1400, 1395, 1390, 1384, - 1379, 1374, 1368, 1363, 1358, 1352, 1347, 1342, - 1336, 1331, 1326, 1321, 1315, 1310, 1305, 1299, - 1294, 1289, 1284, 1278, 1273, 1268, 1262, 1257, - 1252, 1247, 1242, 1236, 1231, 1226, 1221, 1215, - 1210, 1205, 1200, 1195, 1189, 1184, 1179, 1174, - 1169, 1164, 1158, 1153, 1148, 1143, 1138, 1133, - 1128, 1122, 1117, 1112, 1107, 1102, 1097, 1092, - 1087, 1082, 1077, 1072, 1067, 1062, 1056, 1051, - 1046, 1041, 1036, 1031, 1026, 1021, 1016, 1011, - 1006, 1001, 996, 991, 986, 982, 977, 972, - 967, 962, 957, 952, 947, 942, 937, 932, - 928, 923, 918, 913, 908, 903, 898, 894, - 889, 884, 879, 874, 870, 865, 860, 855, - 850, 846, 841, 836, 831, 827, 822, 817, - 813, 808, 803, 798, 794, 789, 784, 780, - 775, 771, 766, 761, 757, 752, 747, 743, - 738, 734, 729, 725, 720, 716, 711, 707, - 702, 698, 693, 689, 684, 680, 675, 671, - 666, 662, 657, 653, 649, 644, 640, 635, - 631, 627, 622, 618, 614, 609, 605, 601, - 596, 592, 588, 584, 579, 575, 571, 567, - 562, 558, 554, 550, 546, 541, 537, 533, - 529, 525, 521, 516, 512, 508, 504, 500, - 496, 492, 488, 484, 480, 476, 472, 468, - 464, 460, 456, 452, 448, 444, 440, 436, - 432, 429, 425, 421, 417, 413, 409, 405, - 402, 398, 394, 390, 386, 383, 379, 375, - 372, 368, 364, 360, 357, 353, 349, 346, - 342, 338, 335, 331, 328, 324, 321, 317, - 313, 310, 306, 303, 299, 296, 292, 289, - 286, 282, 279, 275, 272, 269, 265, 262, - 258, 255, 252, 248, 245, 242, 239, 235, - 232, 229, 226, 222, 219, 216, 213, 210, - 207, 203, 200, 197, 194, 191, 188, 185, - 182, 179, 176, 173, 170, 167, 164, 161, - 158, 155, 152, 149, 146, 144, 141, 138, - 135, 132, 129, 127, 124, 121, 118, 116, - 113, 110, 107, 105, 102, 99, 97, 94, - 92, 89, 86, 84, 81, 79, 76, 74, - 71, 69, 66, 64, 61, 59, 57, 54, - 52, 50, 47, 45, 43, 40, 38, 36, - 33, 31, 29, 27, 25, 22, 20, 18, - 16, 14, 12, 10, 8, 6, 4, 2 - }, - { - 0, -1, -3, -5, -7, -9, -11, -13, - -15, -17, -19, -20, -23, -25, -27, -28, - -30, -33, -34, -36, -39, -40, -42, -43, - -45, -46, -49, -50, -52, -54, -56, -58, - -60, -61, -62, -65, -66, -68, -70, -72, - -73, -74, -77, -78, -80, -82, -83, -85, - -87, -89, -90, -92, -93, -95, -96, -98, - -100, -102, -103, -105, -106, -107, -108, -110, - -112, -114, -116, -116, -118, -120, -122, -122, - -124, -126, -127, -128, -130, -131, -133, -133, - -136, -137, -138, -139, -141, -142, -144, -145, - -147, -147, -150, -151, -151, -153, -155, -156, - -157, -159, -160, -161, -163, -164, -165, -166, - -168, -168, -170, -171, -172, -174, -174, -176, - -177, -178, -180, -181, -182, -183, -184, -185, - -187, -188, -189, -190, -191, -192, -193, -195, - -196, -196, -198, -199, -200, -200, -202, -204, - -204, -205, -206, -207, -208, -209, -211, -212, - -212, -213, -214, -215, -216, -217, -218, -220, - -220, -221, -222, -223, -224, -225, -225, -227, - -227, -228, -229, -230, -230, -231, -233, -234, - -234, -235, -235, -237, -238, -239, -239, -240, - -240, -242, -242, -243, -243, -245, -246, -247, - -247, -249, -248, -249, -250, -251, -251, -253, - -253, -253, -255, -255, -256, -256, -257, -258, - -259, -259, -260, -261, -261, -262, -262, -264, - -263, -265, -265, -265, -266, -267, -267, -268, - -269, -269, -269, -270, -271, -271, -272, -273, - -273, -273, -274, -274, -276, -275, -276, -277, - -277, -278, -278, -278, -279, -279, -280, -281, - -280, -281, -282, -283, -283, -282, -284, -284, - -284, -285, -285, -286, -286, -286, -287, -287, - -288, -288, -288, -289, -289, -289, -290, -290, - -290, -291, -291, -292, -291, -291, -292, -292, - -292, -293, -293, -293, -294, -294, -295, -295, - -294, -295, -295, -296, -297, -297, -297, -297, - -297, -297, -298, -298, -297, -298, -298, -298, - -299, -299, -300, -299, -299, -300, -299, -300, - -301, -300, -300, -301, -300, -301, -301, -301, - -301, -301, -302, -301, -302, -301, -302, -302, - -302, -302, -302, -302, -302, -302, -303, -302, - -303, -302, -303, -303, -302, -303, -303, -303, - -302, -303, -303, -302, -303, -303, -302, -303, - -303, -302, -303, -303, -302, -303, -303, -303, - -303, -302, -303, -303, -302, -302, -302, -303, - -302, -302, -302, -301, -303, -302, -301, -302, - -301, -301, -301, -302, -301, -301, -301, -300, - -301, -300, -300, -300, -300, -299, -300, -299, - -300, -300, -299, -300, -299, -299, -299, -299, - -298, -299, -298, -297, -297, -297, -296, -297, - -296, -296, -296, -296, -295, -296, -295, -296, - -295, -294, -294, -294, -293, -294, -294, -293, - -293, -292, -293, -292, -292, -292, -291, -290, - -291, -290, -291, -289, -289, -290, -289, -289, - -288, -288, -288, -288, -286, -287, -286, -286, - -286, -285, -286, -284, -284, -284, -284, -283, - -283, -283, -282, -282, -282, -281, -280, -281, - -279, -280, -280, -278, -279, -278, -278, -277, - -278, -276, -276, -277, -275, -276, -274, -275, - -274, -273, -273, -272, -273, -272, -272, -271, - -270, -270, -269, -269, -269, -268, -268, -267, - -267, -266, -266, -266, -265, -265, -264, -264, - -263, -263, -262, -262, -261, -261, -260, -260, - -259, -259, -258, -258, -257, -257, -256, -256, - -256, -255, -254, -254, -253, -253, -252, -252, - -251, -251, -250, -250, -249, -249, -248, -248, - -247, -247, -246, -246, -245, -245, -244, -244, - -243, -242, -242, -241, -241, -240, -239, -239, - -239, -238, -238, -237, -237, -235, -235, -235, - -234, -234, -232, -233, -232, -232, -231, -229, - -230, -229, -228, -228, -227, -226, -227, -225, - -224, -225, -223, -223, -222, -222, -221, -221, - -220, -219, -219, -218, -218, -216, -217, -216, - -215, -215, -214, -213, -212, -213, -211, -211, - -210, -210, -209, -209, -208, -206, -207, -206, - -205, -204, -204, -204, -203, -202, -202, -200, - -200, -200, -200, -198, -197, -197, -196, -195, - -195, -195, -194, -194, -192, -192, -191, -191, - -189, -189, -188, -188, -187, -186, -186, -186, - -185, -185, -183, -183, -182, -182, -181, -181, - -180, -178, -178, -177, -177, -176, -176, -174, - -174, -173, -173, -172, -172, -172, -170, -170, - -168, -168, -167, -167, -167, -165, -165, -164, - -164, -164, -162, -162, -161, -160, -160, -158, - -158, -158, -157, -156, -155, -155, -154, -153, - -153, -152, -151, -151, -150, -149, -149, -148, - -147, -147, -146, -146, -144, -144, -144, -142, - -142, -141, -142, -140, -140, -139, -138, -138, - -137, -136, -136, -134, -134, -133, -134, -132, - -132, -131, -130, -130, -128, -128, -128, -127, - -127, -126, -124, -124, -124, -123, -123, -122, - -121, -120, -120, -119, -118, -118, -117, -117, - -116, -115, -115, -115, -114, -113, -111, -111, - -110, -110, -109, -109, -108, -107, -107, -106, - -105, -104, -104, -103, -102, -103, -102, -101, - -101, -100, -99, -99, -98, -97, -97, -96, - -96, -95, -94, -94, -93, -92, -92, -91, - -91, -90, -89, -88, -88, -88, -87, -86, - -85, -86, -84, -84, -83, -82, -82, -81, - -81, -80, -80, -78, -79, -77, -77, -77, - -76, -76, -75, -74, -74, -73, -72, -72, - -72, -71, -70, -70, -69, -68, -68, -68, - -66, -67, -66, -65, -65, -65, -63, -63, - -62, -62, -61, -61, -60, -60, -60, -58, - -58, -58, -56, -56, -56, -55, -54, -55, - -54, -54, -53, -52, -51, -51, -51, -50, - -49, -49, -49, -49, -48, -47, -46, -46, - -46, -46, -45, -43, -43, -43, -43, -42, - -42, -42, -40, -40, -40, -39, -39, -38, - -38, -38, -37, -37, -36, -36, -35, -35, - -34, -35, -34, -33, -33, -32, -32, -31, - -31, -31, -30, -29, -29, -29, -28, -27, - -28, -28, -27, -26, -26, -25, -25, -25, - -24, -24, -24, -23, -23, -22, -22, -22, - -21, -21, -20, -20, -20, -20, -19, -18, - -19, -18, -18, -17, -18, -17, -16, -17, - -16, -15, -15, -15, -14, -14, -15, -13, - -13, -13, -13, -12, -12, -11, -12, -11, - -12, -10, -10, -10, -10, -10, -9, -10, - -9, -9, -9, -8, -8, -7, -8, -7, - -7, -7, -6, -6, -6, -7, -6, -6, - -5, -5, -5, -5, -5, -4, -4, -5, - -4, -4, -3, -3, -3, -3, -3, -2, - -3, -2, -2, -2, -1, -2, -1, -2, - -1, -1, -1, -1, -1, 0, -1, 0, - -1, -1, 0, 0, -1, 0, 0, -1, - 1, 1, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 - } -}; -#else /* defined(CONFIG_CSI2_PLUS) */ static const int zoom_table[4][HRT_GDC_N] = { { 0 << 4, 0 << 4, 0 << 4, 0 << 4, 0 << 4, 0 << 4, 0 << 4, 0 << 4, @@ -1194,7 +662,6 @@ static const int zoom_table[4][HRT_GDC_N] = { 0 << 4, 0 << 4, 0 << 4, 0 << 4, 0 << 4, 0 << 4, 0 << 4, 0 << 4 } }; -#endif static const struct ia_css_dz_config default_dz_config = { HRT_GDC_N, diff --git a/drivers/staging/media/atomisp/pci/sh_css_sp.c b/drivers/staging/media/atomisp/pci/sh_css_sp.c index 9f681b2e9f99..02f5a73b4096 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_sp.c +++ b/drivers/staging/media/atomisp/pci/sh_css_sp.c @@ -17,7 +17,7 @@ #include "sh_css_sp.h" -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) #include "input_formatter.h" #endif @@ -227,7 +227,7 @@ sh_css_sp_start_binary_copy(unsigned int pipe_num, IA_CSS_LOG("pipe_id %d port_config %08x", pipe->pipe_id, pipe->inout_port_config); -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) sh_css_sp_group.config.input_formatter.isp_2ppc = (uint8_t)two_ppc; #else (void)two_ppc; @@ -305,7 +305,7 @@ sh_css_sp_start_raw_copy(struct ia_css_frame *out_frame, IA_CSS_LOG("pipe_id %d port_config %08x", pipe->pipe_id, pipe->inout_port_config); -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) sh_css_sp_group.config.input_formatter.isp_2ppc = (uint8_t)two_ppc; #else (void)two_ppc; @@ -636,7 +636,7 @@ set_view_finder_buffer(const struct ia_css_frame *frame) { return 0; } -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) void sh_css_sp_set_if_configs( const input_formatter_cfg_t *config_a, const input_formatter_cfg_t *config_b, @@ -660,7 +660,7 @@ void sh_css_sp_set_if_configs( } #endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) void sh_css_sp_program_input_circuit(int fmt_type, int ch_id, @@ -679,7 +679,7 @@ sh_css_sp_program_input_circuit(int fmt_type, } #endif -#if defined(USE_INPUT_SYSTEM_VERSION_2) +#if !defined(ISP2401) void sh_css_sp_configure_sync_gen(int width, int height, int hblank_cycles, @@ -760,7 +760,7 @@ sh_css_sp_init_group(bool two_ppc, bool no_isp_sync, uint8_t if_config_index) { -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) sh_css_sp_group.config.input_formatter.isp_2ppc = two_ppc; #else (void)two_ppc; @@ -769,7 +769,7 @@ sh_css_sp_init_group(bool two_ppc, sh_css_sp_group.config.no_isp_sync = (uint8_t)no_isp_sync; /* decide whether the frame is processed online or offline */ if (if_config_index == SH_CSS_IF_CONFIG_NOT_NEEDED) return; -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) assert(if_config_index < SH_CSS_MAX_IF_CONFIGS); sh_css_sp_group.config.input_formatter.set[if_config_index].stream_format = input_format; @@ -934,7 +934,7 @@ sh_css_sp_init_stage(struct ia_css_binary *binary, return 0; } -#if defined(USE_INPUT_SYSTEM_VERSION_2401) +#if defined(ISP2401) (void)continuous; sh_css_sp_stage.deinterleaved = 0; #else @@ -1019,7 +1019,7 @@ sh_css_sp_init_stage(struct ia_css_binary *binary, if (err) return err; -#ifdef USE_INPUT_SYSTEM_VERSION_2401 +#ifdef ISP2401 if (stage == 0) { pipe = find_pipe_by_num(sh_css_sp_group.pipe[thread_id].pipe_num); if (!pipe) @@ -1255,12 +1255,10 @@ sh_css_sp_init_pipeline(struct ia_css_pipeline *me, offline, if_config_index); } /* if (first_binary != NULL) */ -#if defined(USE_INPUT_SYSTEM_VERSION_2401) || defined(USE_INPUT_SYSTEM_VERSION_2) /* Signal the host immediately after start for SP_ISYS_COPY only */ if ((me->num_stages == 1) && me->stages && (me->stages->sp_func == IA_CSS_PIPELINE_ISYS_COPY)) sh_css_sp_group.config.no_isp_sync = true; -#endif /* Init stage data */ sh_css_init_host2sp_frame_data(); @@ -1467,7 +1465,6 @@ sh_css_update_host2sp_offline_frame( store_sp_array_uint(host_sp_com, offset, metadata ? metadata->address : 0); } -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) /* * @brief Update the mipi frame information in host_sp_communication. * Refer to "sh_css_sp.h" for more details. @@ -1532,7 +1529,6 @@ sh_css_update_host2sp_num_mipi_frames(unsigned int num_frames) store_sp_array_uint(host_sp_com, offset, num_frames); } -#endif void sh_css_update_host2sp_cont_num_raw_frames(unsigned int num_frames, diff --git a/drivers/staging/media/atomisp/pci/sh_css_sp.h b/drivers/staging/media/atomisp/pci/sh_css_sp.h index 18a1fefda4b5..832eed711525 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_sp.h +++ b/drivers/staging/media/atomisp/pci/sh_css_sp.h @@ -18,7 +18,7 @@ #include #include -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) #include "input_formatter.h" #endif @@ -96,7 +96,6 @@ sh_css_update_host2sp_offline_frame( struct ia_css_frame *frame, struct ia_css_metadata *metadata); -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) /** * @brief Update the mipi frame information in host_sp_communication. * @@ -126,7 +125,6 @@ sh_css_update_host2sp_mipi_metadata( */ void sh_css_update_host2sp_num_mipi_frames(unsigned int num_frames); -#endif /** * @brief Update the nr of offline frames to use in host_sp_communication. @@ -156,7 +154,7 @@ sh_css_sp_get_debug_state(struct sh_css_sp_debug_state *state); #endif -#if !defined(HAS_NO_INPUT_FORMATTER) +#if !defined(ISP2401) void sh_css_sp_set_if_configs( const input_formatter_cfg_t *config_a, diff --git a/drivers/staging/media/atomisp/pci/sh_css_struct.h b/drivers/staging/media/atomisp/pci/sh_css_struct.h index bd260252317a..eb8960ebae34 100644 --- a/drivers/staging/media/atomisp/pci/sh_css_struct.h +++ b/drivers/staging/media/atomisp/pci/sh_css_struct.h @@ -55,7 +55,6 @@ struct sh_css { bool check_system_idle; unsigned int num_cont_raw_frames; -#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401) unsigned int num_mipi_frames[N_CSI_PORTS]; struct ia_css_frame *mipi_frames[N_CSI_PORTS][NUM_MIPI_FRAMES_PER_STREAM]; @@ -64,7 +63,6 @@ struct sh_css { unsigned int mipi_sizes_for_check[N_CSI_PORTS][IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES_PER_PORT]; unsigned int mipi_frame_size[N_CSI_PORTS]; -#endif ia_css_ptr sp_bin_addr; hrt_data page_table_base_index; diff --git a/drivers/staging/media/atomisp/pci/system_global.h b/drivers/staging/media/atomisp/pci/system_global.h index 90210f6943d2..9b22b8c168be 100644 --- a/drivers/staging/media/atomisp/pci/system_global.h +++ b/drivers/staging/media/atomisp/pci/system_global.h @@ -25,23 +25,6 @@ * N.B. the 3 input formatters are of 2 different classess */ -#define HAS_MMU_VERSION_2 -#define HAS_DMA_VERSION_2 -#define HAS_GDC_VERSION_2 -#define HAS_VAMEM_VERSION_2 -#define HAS_HMEM_VERSION_1 -#define HAS_BAMEM_VERSION_2 -#define HAS_IRQ_VERSION_2 -#define HAS_IRQ_MAP_VERSION_2 -#define HAS_INPUT_FORMATTER_VERSION_2 -#define HAS_INPUT_SYSTEM_VERSION_2 -#define HAS_BUFFERED_SENSOR -#define HAS_FIFO_MONITORS_VERSION_2 -#define HAS_GP_DEVICE_VERSION_2 -#define HAS_GPIO_VERSION_1 -#define HAS_TIMED_CTRL_VERSION_1 -#define HAS_RX_VERSION_2 - /* per-frame parameter handling support */ #define SH_CSS_ENABLE_PER_FRAME_PARAMS @@ -64,12 +47,6 @@ #define ISP2400_DMA_MAX_BURST_LENGTH 128 #define ISP2401_DMA_MAX_BURST_LENGTH 2 -#ifdef ISP2401 -# include "isp2401_system_global.h" -#else -# include "isp2400_system_global.h" -#endif - #include #include From patchwork Wed Sep 2 16:10:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751193 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C1FDB14E3 for ; Wed, 2 Sep 2020 16:15:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5F5420FC3 for ; Wed, 2 Sep 2020 16:15:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063349; bh=EERb3EiHYgV+kjoeUIa1qghfUpQCDCfNMYKTD1gr61w=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=tsKNCsDNzk8dz0HQgfcFedSwDhyQv51QCj6FYlHDOoaBuPrUDZDzCkfuQdwCiNRiL aIk1oLRm5gaDvOSxGrCXrUcJnp3M3AAGqINoYpOx88vD99ku6c31/MWkNdlfE0+Mj3 18lSZBL5yBEu0I2fsrGLFKuOgeBw5B4VGYPDxW2A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728737AbgIBQNv (ORCPT ); Wed, 2 Sep 2020 12:13:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:53840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728308AbgIBQK4 (ORCPT ); Wed, 2 Sep 2020 12:10:56 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6927C21D90; Wed, 2 Sep 2020 16:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=EERb3EiHYgV+kjoeUIa1qghfUpQCDCfNMYKTD1gr61w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kww1qjzBj12rxsBQlAPH4J1DJfhRyBctOFqrkl+9DzFmV9keKOc3OvN9WVnd3WESM IQtIIkG8m5YjLySb0Akn8UoDYJCw8H4sGHVH97rUgRMO2Kkk7DUgcFwFKzuvAMD0NE 8Bq7gKZEvc6qXTp2QFbtGeKM/HDh+7UEkm0vEy1Q= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tB1-IN; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, devel@driverdev.osuosl.org Subject: [PATCH 28/38] media: atomisp: get rid of isys_dma.h and isys_dma_local.h Date: Wed, 2 Sep 2020 18:10:31 +0200 Message-Id: <5904ab04523f4d6e863e615b2a56f9734aa8a5ee.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There aren't much on this abstraction. Just move the defines to isys_dma_private.h and isys_dma_public.h, cleaning up the includes. Signed-off-by: Mauro Carvalho Chehab --- .../pci/css_2401_system/host/isys_dma.c | 10 +--- .../pci/css_2401_system/host/isys_dma_local.h | 21 --------- .../css_2401_system/host/isys_dma_private.h | 12 ++--- .../host/isys_dma_public.h | 4 +- .../pci/hive_isp_css_include/isys_dma.h | 47 ------------------- .../atomisp/pci/isp2401_input_system_global.h | 3 +- .../atomisp/pci/runtime/isys/src/isys_init.c | 2 +- 7 files changed, 12 insertions(+), 87 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_local.h delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_dma.h diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma.c b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma.c index 5809dbb6e5aa..2a5159945a44 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma.c +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma.c @@ -13,16 +13,10 @@ * more details. */ -#include "isys_dma.h" +#include "system_local.h" +#include "isys_dma_global.h" #include "assert_support.h" - -#ifndef __INLINE_ISYS2401_DMA__ -/* - * Include definitions for isys dma register access functions. isys_dma.h - * includes declarations of these functions by including isys_dma_public.h. - */ #include "isys_dma_private.h" -#endif const isys2401_dma_channel N_ISYS2401_DMA_CHANNEL_PROCS[N_ISYS2401_DMA_ID] = { N_ISYS2401_DMA_CHANNEL diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_local.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_local.h deleted file mode 100644 index 878933261a43..000000000000 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_local.h +++ /dev/null @@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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. - */ - -#ifndef __ISYS_DMA_LOCAL_H_INCLUDED__ -#define __ISYS_DMA_LOCAL_H_INCLUDED__ - -#include "isys_dma_global.h" - -#endif /* __ISYS_DMA_LOCAL_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_private.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_private.h index eb35b7bcead4..a313e1dc7c71 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_private.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_dma_private.h @@ -23,10 +23,9 @@ #include "dma_v2_defs.h" #include "print_support.h" -STORAGE_CLASS_ISYS2401_DMA_C void isys2401_dma_reg_store( - const isys2401_dma_ID_t dma_id, - const unsigned int reg, - const hrt_data value) +void isys2401_dma_reg_store(const isys2401_dma_ID_t dma_id, + const unsigned int reg, + const hrt_data value) { unsigned int reg_loc; @@ -40,9 +39,8 @@ STORAGE_CLASS_ISYS2401_DMA_C void isys2401_dma_reg_store( ia_css_device_store_uint32(reg_loc, value); } -STORAGE_CLASS_ISYS2401_DMA_C hrt_data isys2401_dma_reg_load( - const isys2401_dma_ID_t dma_id, - const unsigned int reg) +hrt_data isys2401_dma_reg_load(const isys2401_dma_ID_t dma_id, + const unsigned int reg) { unsigned int reg_loc; hrt_data value; diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h index 88ac78f69e7b..d9b6af898c06 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_dma_public.h @@ -21,12 +21,12 @@ #include "system_local.h" #include "type_support.h" -STORAGE_CLASS_ISYS2401_DMA_H void isys2401_dma_reg_store( +extern void isys2401_dma_reg_store( const isys2401_dma_ID_t dma_id, const unsigned int reg, const hrt_data value); -STORAGE_CLASS_ISYS2401_DMA_H hrt_data isys2401_dma_reg_load( +extern hrt_data isys2401_dma_reg_load( const isys2401_dma_ID_t dma_id, const unsigned int reg); diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_dma.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_dma.h deleted file mode 100644 index 6a759142eda8..000000000000 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_dma.h +++ /dev/null @@ -1,47 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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. - */ - -#ifndef __ISYS_DMA_H_INCLUDED__ -#define __ISYS_DMA_H_INCLUDED__ - -/* - * This file is included on every cell {SP,ISP,host} and on every system - * that uses the input system device(s). It defines the API to DLI bridge - * - * System and cell specific interfaces and inline code are included - * conditionally through Makefile path settings. - * - * - system and cell agnostic interfaces, constants and identifiers - * - public: system agnostic, cell specific interfaces - * - private: system dependent, cell specific interfaces & - * inline implementations - * - global: system specific constants and identifiers - * - local: system and cell specific constants and identifiers - */ - -#include "system_local.h" -#include "isys_dma_local.h" - -#ifndef __INLINE_ISYS2401_DMA__ -#define STORAGE_CLASS_ISYS2401_DMA_H extern -#define STORAGE_CLASS_ISYS2401_DMA_C -#include "isys_dma_public.h" -#else /* __INLINE_ISYS2401_DMA__ */ -#define STORAGE_CLASS_ISYS2401_DMA_H static inline -#define STORAGE_CLASS_ISYS2401_DMA_C static inline -#include "isys_dma_private.h" -#endif /* __INLINE_ISYS2401_DMA__ */ - -#endif /* __ISYS_DMA_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h b/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h index 5070e651f7c4..6407be9331ae 100644 --- a/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h +++ b/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h @@ -21,7 +21,8 @@ /* CSI reveiver has 3 ports. */ #define N_CSI_PORTS (3) -#include "isys_dma.h" /* isys2401_dma_channel, +#include "system_local.h" +#include "isys_dma_global.h" /* isys2401_dma_channel, * isys2401_dma_cfg_t */ diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c index c88b14ce69a5..484c5967ad1c 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c @@ -19,7 +19,7 @@ #include "platform_support.h" #ifdef ISP2401 -#include "isys_dma.h" /* isys2401_dma_set_max_burst_size() */ +#include "isys_dma_public.h" /* isys2401_dma_set_max_burst_size() */ #include "isys_irq.h" #endif From patchwork Wed Sep 2 16:10:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751199 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ADED6166C for ; Wed, 2 Sep 2020 16:15:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8431820639 for ; Wed, 2 Sep 2020 16:15:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063354; bh=CS2SHY+dbcTlueJOlO3filVCadd3G4vfWcrT58KY7cQ=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=Ga8zbyyv/WcN2x+6ixtavuEeRpyoaLw6r6TK0Xl6i/BiYbXnkTeEbSi3o3OIWgBjw Oz9sJoG1kLRLF/aqryf6QTvqIEF/EKFulcz7PYok7fva+PXSyCNSrs+MVdY/3yVlds uY2ysEp+k6pMhWgiRRD6LgaIR1UOroUUGo54/8vg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728719AbgIBQNu (ORCPT ); Wed, 2 Sep 2020 12:13:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:54046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728333AbgIBQK5 (ORCPT ); Wed, 2 Sep 2020 12:10:57 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6C8C721D92; Wed, 2 Sep 2020 16:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=CS2SHY+dbcTlueJOlO3filVCadd3G4vfWcrT58KY7cQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jHGC0erCkaJGvX12SWypynDoBZOLIMbuVWaaScNFhFHMv48SY5hkqjCqX0zhCtIxg c1gZijHBzZt0PgYI+G6pleRLU5sttlfilhnGfZHCpasPmqk7UxHAoAVQ+F+TgAHUdP XxZalMJxnQPIAd15tldkjWhtZC3hSU2KQhspaAuU= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tB5-JX; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, devel@driverdev.osuosl.org Subject: [PATCH 29/38] media: atomisp: get rid of ibuf_ctrl abstraction Date: Wed, 2 Sep 2020 18:10:32 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Just move the stuff there to the places where this header is included. Signed-off-by: Mauro Carvalho Chehab --- .../css_2401_system/host/ibuf_ctrl_local.h | 1 + .../css_2401_system/host/ibuf_ctrl_private.h | 268 ------------------ .../host/ibuf_ctrl_public.h | 94 ------ .../pci/hive_isp_css_include/ibuf_ctrl.h | 47 --- .../atomisp/pci/isp2401_input_system_global.h | 2 +- .../atomisp/pci/isp2401_input_system_local.h | 1 - .../pci/isp2401_input_system_private.h | 224 ++++++++++++++- 7 files changed, 220 insertions(+), 417 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_private.h delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h delete mode 100644 drivers/staging/media/atomisp/pci/hive_isp_css_include/ibuf_ctrl.h diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_local.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_local.h index 4952b42d8191..f71841195ac1 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_local.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_local.h @@ -17,6 +17,7 @@ #define __IBUF_CTRL_LOCAL_H_INCLUDED__ #include "ibuf_ctrl_global.h" +#include "ibuf_ctrl_local.h" typedef struct ibuf_ctrl_proc_state_s ibuf_ctrl_proc_state_t; typedef struct ibuf_ctrl_state_s ibuf_ctrl_state_t; diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_private.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_private.h deleted file mode 100644 index a58e8477da6e..000000000000 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl_private.h +++ /dev/null @@ -1,268 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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. - */ - -#ifndef __IBUF_CTRL_PRIVATE_H_INCLUDED__ -#define __IBUF_CTRL_PRIVATE_H_INCLUDED__ - -#include "ibuf_ctrl_public.h" - -#include "device_access.h" /* ia_css_device_load_uint32 */ - -#include "assert_support.h" /* assert */ -#include "print_support.h" /* print */ - -/***************************************************** - * - * Native command interface (NCI). - * - *****************************************************/ -/** - * @brief Get the ibuf-controller state. - * Refer to "ibuf_ctrl_public.h" for details. - */ -STORAGE_CLASS_IBUF_CTRL_C void ibuf_ctrl_get_state( - const ibuf_ctrl_ID_t ID, - ibuf_ctrl_state_t *state) -{ - u32 i; - - state->recalc_words = - ibuf_ctrl_reg_load(ID, _IBUF_CNTRL_RECALC_WORDS_STATUS); - state->arbiters = - ibuf_ctrl_reg_load(ID, _IBUF_CNTRL_ARBITERS_STATUS); - - /* - * Get the values of the register-set per - * ibuf-controller process. - */ - for (i = 0; i < N_IBUF_CTRL_PROCS[ID]; i++) { - ibuf_ctrl_get_proc_state( - ID, - i, - &state->proc_state[i]); - } -} - -/** - * @brief Get the state of the ibuf-controller process. - * Refer to "ibuf_ctrl_public.h" for details. - */ -STORAGE_CLASS_IBUF_CTRL_C void ibuf_ctrl_get_proc_state( - const ibuf_ctrl_ID_t ID, - const u32 proc_id, - ibuf_ctrl_proc_state_t *state) -{ - hrt_address reg_bank_offset; - - reg_bank_offset = - _IBUF_CNTRL_PROC_REG_ALIGN * (1 + proc_id); - - state->num_items = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_NUM_ITEMS_PER_STORE); - - state->num_stores = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_NUM_STORES_PER_FRAME); - - state->dma_channel = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_CHANNEL); - - state->dma_command = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_CMD); - - state->ibuf_st_addr = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_START_ADDRESS); - - state->ibuf_stride = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_STRIDE); - - state->ibuf_end_addr = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_END_ADDRESS); - - state->dest_st_addr = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_START_ADDRESS); - - state->dest_stride = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_STRIDE); - - state->dest_end_addr = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_END_ADDRESS); - - state->sync_frame = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_SYNC_FRAME); - - state->sync_command = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_STR2MMIO_SYNC_CMD); - - state->store_command = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_STR2MMIO_STORE_CMD); - - state->shift_returned_items = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_SHIFT_ITEMS); - - state->elems_ibuf = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ELEMS_P_WORD_IBUF); - - state->elems_dest = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ELEMS_P_WORD_DEST); - - state->cur_stores = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_STORES); - - state->cur_acks = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_ACKS); - - state->cur_s2m_ibuf_addr = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_S2M_IBUF_ADDR); - - state->cur_dma_ibuf_addr = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_DMA_IBUF_ADDR); - - state->cur_dma_dest_addr = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_DMA_DEST_ADDR); - - state->cur_isp_dest_addr = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_ISP_DEST_ADDR); - - state->dma_cmds_send = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_NR_DMA_CMDS_SEND); - - state->main_cntrl_state = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_MAIN_CNTRL_STATE); - - state->dma_sync_state = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_SYNC_STATE); - - state->isp_sync_state = - ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ISP_SYNC_STATE); -} - -/** - * @brief Dump the ibuf-controller state. - * Refer to "ibuf_ctrl_public.h" for details. - */ -STORAGE_CLASS_IBUF_CTRL_C void ibuf_ctrl_dump_state( - const ibuf_ctrl_ID_t ID, - ibuf_ctrl_state_t *state) -{ - u32 i; - - ia_css_print("IBUF controller ID %d recalculate words 0x%x\n", ID, - state->recalc_words); - ia_css_print("IBUF controller ID %d arbiters 0x%x\n", ID, state->arbiters); - - /* - * Dump the values of the register-set per - * ibuf-controller process. - */ - for (i = 0; i < N_IBUF_CTRL_PROCS[ID]; i++) { - ia_css_print("IBUF controller ID %d Process ID %d num_items 0x%x\n", ID, i, - state->proc_state[i].num_items); - ia_css_print("IBUF controller ID %d Process ID %d num_stores 0x%x\n", ID, i, - state->proc_state[i].num_stores); - ia_css_print("IBUF controller ID %d Process ID %d dma_channel 0x%x\n", ID, i, - state->proc_state[i].dma_channel); - ia_css_print("IBUF controller ID %d Process ID %d dma_command 0x%x\n", ID, i, - state->proc_state[i].dma_command); - ia_css_print("IBUF controller ID %d Process ID %d ibuf_st_addr 0x%x\n", ID, i, - state->proc_state[i].ibuf_st_addr); - ia_css_print("IBUF controller ID %d Process ID %d ibuf_stride 0x%x\n", ID, i, - state->proc_state[i].ibuf_stride); - ia_css_print("IBUF controller ID %d Process ID %d ibuf_end_addr 0x%x\n", ID, i, - state->proc_state[i].ibuf_end_addr); - ia_css_print("IBUF controller ID %d Process ID %d dest_st_addr 0x%x\n", ID, i, - state->proc_state[i].dest_st_addr); - ia_css_print("IBUF controller ID %d Process ID %d dest_stride 0x%x\n", ID, i, - state->proc_state[i].dest_stride); - ia_css_print("IBUF controller ID %d Process ID %d dest_end_addr 0x%x\n", ID, i, - state->proc_state[i].dest_end_addr); - ia_css_print("IBUF controller ID %d Process ID %d sync_frame 0x%x\n", ID, i, - state->proc_state[i].sync_frame); - ia_css_print("IBUF controller ID %d Process ID %d sync_command 0x%x\n", ID, i, - state->proc_state[i].sync_command); - ia_css_print("IBUF controller ID %d Process ID %d store_command 0x%x\n", ID, i, - state->proc_state[i].store_command); - ia_css_print("IBUF controller ID %d Process ID %d shift_returned_items 0x%x\n", - ID, i, - state->proc_state[i].shift_returned_items); - ia_css_print("IBUF controller ID %d Process ID %d elems_ibuf 0x%x\n", ID, i, - state->proc_state[i].elems_ibuf); - ia_css_print("IBUF controller ID %d Process ID %d elems_dest 0x%x\n", ID, i, - state->proc_state[i].elems_dest); - ia_css_print("IBUF controller ID %d Process ID %d cur_stores 0x%x\n", ID, i, - state->proc_state[i].cur_stores); - ia_css_print("IBUF controller ID %d Process ID %d cur_acks 0x%x\n", ID, i, - state->proc_state[i].cur_acks); - ia_css_print("IBUF controller ID %d Process ID %d cur_s2m_ibuf_addr 0x%x\n", ID, - i, - state->proc_state[i].cur_s2m_ibuf_addr); - ia_css_print("IBUF controller ID %d Process ID %d cur_dma_ibuf_addr 0x%x\n", ID, - i, - state->proc_state[i].cur_dma_ibuf_addr); - ia_css_print("IBUF controller ID %d Process ID %d cur_dma_dest_addr 0x%x\n", ID, - i, - state->proc_state[i].cur_dma_dest_addr); - ia_css_print("IBUF controller ID %d Process ID %d cur_isp_dest_addr 0x%x\n", ID, - i, - state->proc_state[i].cur_isp_dest_addr); - ia_css_print("IBUF controller ID %d Process ID %d dma_cmds_send 0x%x\n", ID, i, - state->proc_state[i].dma_cmds_send); - ia_css_print("IBUF controller ID %d Process ID %d main_cntrl_state 0x%x\n", ID, - i, - state->proc_state[i].main_cntrl_state); - ia_css_print("IBUF controller ID %d Process ID %d dma_sync_state 0x%x\n", ID, i, - state->proc_state[i].dma_sync_state); - ia_css_print("IBUF controller ID %d Process ID %d isp_sync_state 0x%x\n", ID, i, - state->proc_state[i].isp_sync_state); - } -} - -/* end of NCI */ - -/***************************************************** - * - * Device level interface (DLI). - * - *****************************************************/ -/** - * @brief Load the register value. - * Refer to "ibuf_ctrl_public.h" for details. - */ -STORAGE_CLASS_IBUF_CTRL_C hrt_data ibuf_ctrl_reg_load( - const ibuf_ctrl_ID_t ID, - const hrt_address reg) -{ - assert(ID < N_IBUF_CTRL_ID); - assert(IBUF_CTRL_BASE[ID] != (hrt_address)-1); - return ia_css_device_load_uint32(IBUF_CTRL_BASE[ID] + reg * sizeof(hrt_data)); -} - -/** - * @brief Store a value to the register. - * Refer to "ibuf_ctrl_public.h" for details. - */ -STORAGE_CLASS_IBUF_CTRL_C void ibuf_ctrl_reg_store( - const ibuf_ctrl_ID_t ID, - const hrt_address reg, - const hrt_data value) -{ - assert(ID < N_IBUF_CTRL_ID); - assert(IBUF_CTRL_BASE[ID] != (hrt_address)-1); - - ia_css_device_store_uint32(IBUF_CTRL_BASE[ID] + reg * sizeof(hrt_data), value); -} - -/* end of DLI */ - -#endif /* __IBUF_CTRL_PRIVATE_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h deleted file mode 100644 index 54982b15d9a9..000000000000 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/ibuf_ctrl_public.h +++ /dev/null @@ -1,94 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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. - */ - -#ifndef __IBUF_CTRL_PUBLIC_H_INCLUDED__ -#define __IBUF_CTRL_PUBLIC_H_INCLUDED__ - -#ifdef ISP2401 -/***************************************************** - * - * Native command interface (NCI). - * - *****************************************************/ -/** - * @brief Get the ibuf-controller state. - * Get the state of the ibuf-controller regiester-set. - * - * @param[in] id The global unique ID of the input-buffer controller. - * @param[out] state Point to the register-state. - */ -STORAGE_CLASS_IBUF_CTRL_H void ibuf_ctrl_get_state( - const ibuf_ctrl_ID_t ID, - ibuf_ctrl_state_t *state); - -/** - * @brief Get the state of the ibuf-controller process. - * Get the state of the register set per buf-controller process. - * - * @param[in] id The global unique ID of the input-buffer controller. - * @param[in] proc_id The process ID. - * @param[out] state Point to the process state. - */ -STORAGE_CLASS_IBUF_CTRL_H void ibuf_ctrl_get_proc_state( - const ibuf_ctrl_ID_t ID, - const u32 proc_id, - ibuf_ctrl_proc_state_t *state); -/** - * @brief Dump the ibuf-controller state. - * Dump the state of the ibuf-controller regiester-set. - * - * @param[in] id The global unique ID of the input-buffer controller. - * @param[in] state Pointer to the register-state. - */ -STORAGE_CLASS_IBUF_CTRL_H void ibuf_ctrl_dump_state( - const ibuf_ctrl_ID_t ID, - ibuf_ctrl_state_t *state); -/* end of NCI */ - -/***************************************************** - * - * Device level interface (DLI). - * - *****************************************************/ -/** - * @brief Load the register value. - * Load the value of the register of the ibuf-controller. - * - * @param[in] ID The global unique ID for the ibuf-controller instance. - * @param[in] reg The offset address of the register. - * - * @return the value of the register. - */ -STORAGE_CLASS_IBUF_CTRL_H hrt_data ibuf_ctrl_reg_load( - const ibuf_ctrl_ID_t ID, - const hrt_address reg); - -/** - * @brief Store a value to the register. - * Store a value to the registe of the ibuf-controller. - * - * @param[in] ID The global unique ID for the ibuf-controller instance. - * @param[in] reg The offset address of the register. - * @param[in] value The value to be stored. - * - */ -STORAGE_CLASS_IBUF_CTRL_H void ibuf_ctrl_reg_store( - const ibuf_ctrl_ID_t ID, - const hrt_address reg, - const hrt_data value); -/* end of DLI */ - -#endif /* ISP2401 */ -#endif /* __IBUF_CTRL_PUBLIC_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/ibuf_ctrl.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/ibuf_ctrl.h deleted file mode 100644 index 218341041811..000000000000 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/ibuf_ctrl.h +++ /dev/null @@ -1,47 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Support for Intel Camera Imaging ISP subsystem. - * Copyright (c) 2015, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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. - */ - -#ifndef __IBUF_CTRL_H_INCLUDED__ -#define __IBUF_CTRL_H_INCLUDED__ - -/* - * This file is included on every cell {SP,ISP,host} and on every system - * that uses the input system device(s). It defines the API to DLI bridge - * - * System and cell specific interfaces and inline code are included - * conditionally through Makefile path settings. - * - * - system and cell agnostic interfaces, constants and identifiers - * - public: system agnostic, cell specific interfaces - * - private: system dependent, cell specific interfaces & - * inline implementations - * - global: system specific constants and identifiers - * - local: system and cell specific constants and identifiers - */ - -#include "system_local.h" -#include "ibuf_ctrl_local.h" - -#ifndef __INLINE_IBUF_CTRL__ -#define STORAGE_CLASS_IBUF_CTRL_H extern -#define STORAGE_CLASS_IBUF_CTRL_C -#include "ibuf_ctrl_public.h" -#else /* __INLINE_IBUF_CTRL__ */ -#define STORAGE_CLASS_IBUF_CTRL_H static inline -#define STORAGE_CLASS_IBUF_CTRL_C static inline -#include "ibuf_ctrl_private.h" -#endif /* __INLINE_IBUF_CTRL__ */ - -#endif /* __IBUF_CTRL_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h b/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h index 6407be9331ae..362644856a6c 100644 --- a/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h +++ b/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h @@ -26,7 +26,7 @@ * isys2401_dma_cfg_t */ -#include "ibuf_ctrl.h" /* ibuf_cfg_t, +#include "ibuf_ctrl_local.h" /* ibuf_cfg_t, * ibuf_ctrl_cfg_t */ diff --git a/drivers/staging/media/atomisp/pci/isp2401_input_system_local.h b/drivers/staging/media/atomisp/pci/isp2401_input_system_local.h index f52a8ca5f86b..c33b0341ce16 100644 --- a/drivers/staging/media/atomisp/pci/isp2401_input_system_local.h +++ b/drivers/staging/media/atomisp/pci/isp2401_input_system_local.h @@ -19,7 +19,6 @@ #include "type_support.h" #include "input_system_global.h" -#include "ibuf_ctrl.h" #include "csi_rx.h" #include "pixelgen.h" #include "isys_stream2mmio.h" diff --git a/drivers/staging/media/atomisp/pci/isp2401_input_system_private.h b/drivers/staging/media/atomisp/pci/isp2401_input_system_private.h index f3ca5d1bcb01..e4c76428f6dd 100644 --- a/drivers/staging/media/atomisp/pci/isp2401_input_system_private.h +++ b/drivers/staging/media/atomisp/pci/isp2401_input_system_private.h @@ -18,9 +18,222 @@ #include "input_system_public.h" -STORAGE_CLASS_INPUT_SYSTEM_C input_system_err_t input_system_get_state( - const input_system_ID_t ID, - input_system_state_t *state) +#include "device_access.h" /* ia_css_device_load_uint32 */ + +#include "assert_support.h" /* assert */ +#include "print_support.h" /* print */ + +/* Load the register value */ +static inline hrt_data ibuf_ctrl_reg_load(const ibuf_ctrl_ID_t ID, + const hrt_address reg) +{ + assert(ID < N_IBUF_CTRL_ID); + assert(IBUF_CTRL_BASE[ID] != (hrt_address)-1); + return ia_css_device_load_uint32(IBUF_CTRL_BASE[ID] + reg * sizeof(hrt_data)); +} + +/* Store a value to the register */ +static inline void ibuf_ctrl_reg_store(const ibuf_ctrl_ID_t ID, + const hrt_address reg, + const hrt_data value) +{ + assert(ID < N_IBUF_CTRL_ID); + assert(IBUF_CTRL_BASE[ID] != (hrt_address)-1); + + ia_css_device_store_uint32(IBUF_CTRL_BASE[ID] + reg * sizeof(hrt_data), value); +} + +/* Get the state of the ibuf-controller process */ +static inline void ibuf_ctrl_get_proc_state(const ibuf_ctrl_ID_t ID, + const u32 proc_id, + ibuf_ctrl_proc_state_t *state) +{ + hrt_address reg_bank_offset; + + reg_bank_offset = + _IBUF_CNTRL_PROC_REG_ALIGN * (1 + proc_id); + + state->num_items = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_NUM_ITEMS_PER_STORE); + + state->num_stores = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_NUM_STORES_PER_FRAME); + + state->dma_channel = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_CHANNEL); + + state->dma_command = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_CMD); + + state->ibuf_st_addr = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_START_ADDRESS); + + state->ibuf_stride = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_STRIDE); + + state->ibuf_end_addr = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_END_ADDRESS); + + state->dest_st_addr = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_START_ADDRESS); + + state->dest_stride = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_STRIDE); + + state->dest_end_addr = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_END_ADDRESS); + + state->sync_frame = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_SYNC_FRAME); + + state->sync_command = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_STR2MMIO_SYNC_CMD); + + state->store_command = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_STR2MMIO_STORE_CMD); + + state->shift_returned_items = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_SHIFT_ITEMS); + + state->elems_ibuf = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ELEMS_P_WORD_IBUF); + + state->elems_dest = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ELEMS_P_WORD_DEST); + + state->cur_stores = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_STORES); + + state->cur_acks = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_ACKS); + + state->cur_s2m_ibuf_addr = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_S2M_IBUF_ADDR); + + state->cur_dma_ibuf_addr = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_DMA_IBUF_ADDR); + + state->cur_dma_dest_addr = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_DMA_DEST_ADDR); + + state->cur_isp_dest_addr = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_ISP_DEST_ADDR); + + state->dma_cmds_send = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_NR_DMA_CMDS_SEND); + + state->main_cntrl_state = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_MAIN_CNTRL_STATE); + + state->dma_sync_state = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_SYNC_STATE); + + state->isp_sync_state = + ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ISP_SYNC_STATE); +} + +/* Get the ibuf-controller state. */ +static inline void ibuf_ctrl_get_state(const ibuf_ctrl_ID_t ID, + ibuf_ctrl_state_t *state) +{ + u32 i; + + state->recalc_words = + ibuf_ctrl_reg_load(ID, _IBUF_CNTRL_RECALC_WORDS_STATUS); + state->arbiters = + ibuf_ctrl_reg_load(ID, _IBUF_CNTRL_ARBITERS_STATUS); + + /* + * Get the values of the register-set per + * ibuf-controller process. + */ + for (i = 0; i < N_IBUF_CTRL_PROCS[ID]; i++) { + ibuf_ctrl_get_proc_state( + ID, + i, + &state->proc_state[i]); + } +} + +/* Dump the ibuf-controller state */ +static inline void ibuf_ctrl_dump_state(const ibuf_ctrl_ID_t ID, + ibuf_ctrl_state_t *state) +{ + u32 i; + + ia_css_print("IBUF controller ID %d recalculate words 0x%x\n", ID, + state->recalc_words); + ia_css_print("IBUF controller ID %d arbiters 0x%x\n", ID, state->arbiters); + + /* + * Dump the values of the register-set per + * ibuf-controller process. + */ + for (i = 0; i < N_IBUF_CTRL_PROCS[ID]; i++) { + ia_css_print("IBUF controller ID %d Process ID %d num_items 0x%x\n", ID, i, + state->proc_state[i].num_items); + ia_css_print("IBUF controller ID %d Process ID %d num_stores 0x%x\n", ID, i, + state->proc_state[i].num_stores); + ia_css_print("IBUF controller ID %d Process ID %d dma_channel 0x%x\n", ID, i, + state->proc_state[i].dma_channel); + ia_css_print("IBUF controller ID %d Process ID %d dma_command 0x%x\n", ID, i, + state->proc_state[i].dma_command); + ia_css_print("IBUF controller ID %d Process ID %d ibuf_st_addr 0x%x\n", ID, i, + state->proc_state[i].ibuf_st_addr); + ia_css_print("IBUF controller ID %d Process ID %d ibuf_stride 0x%x\n", ID, i, + state->proc_state[i].ibuf_stride); + ia_css_print("IBUF controller ID %d Process ID %d ibuf_end_addr 0x%x\n", ID, i, + state->proc_state[i].ibuf_end_addr); + ia_css_print("IBUF controller ID %d Process ID %d dest_st_addr 0x%x\n", ID, i, + state->proc_state[i].dest_st_addr); + ia_css_print("IBUF controller ID %d Process ID %d dest_stride 0x%x\n", ID, i, + state->proc_state[i].dest_stride); + ia_css_print("IBUF controller ID %d Process ID %d dest_end_addr 0x%x\n", ID, i, + state->proc_state[i].dest_end_addr); + ia_css_print("IBUF controller ID %d Process ID %d sync_frame 0x%x\n", ID, i, + state->proc_state[i].sync_frame); + ia_css_print("IBUF controller ID %d Process ID %d sync_command 0x%x\n", ID, i, + state->proc_state[i].sync_command); + ia_css_print("IBUF controller ID %d Process ID %d store_command 0x%x\n", ID, i, + state->proc_state[i].store_command); + ia_css_print("IBUF controller ID %d Process ID %d shift_returned_items 0x%x\n", + ID, i, + state->proc_state[i].shift_returned_items); + ia_css_print("IBUF controller ID %d Process ID %d elems_ibuf 0x%x\n", ID, i, + state->proc_state[i].elems_ibuf); + ia_css_print("IBUF controller ID %d Process ID %d elems_dest 0x%x\n", ID, i, + state->proc_state[i].elems_dest); + ia_css_print("IBUF controller ID %d Process ID %d cur_stores 0x%x\n", ID, i, + state->proc_state[i].cur_stores); + ia_css_print("IBUF controller ID %d Process ID %d cur_acks 0x%x\n", ID, i, + state->proc_state[i].cur_acks); + ia_css_print("IBUF controller ID %d Process ID %d cur_s2m_ibuf_addr 0x%x\n", ID, + i, + state->proc_state[i].cur_s2m_ibuf_addr); + ia_css_print("IBUF controller ID %d Process ID %d cur_dma_ibuf_addr 0x%x\n", ID, + i, + state->proc_state[i].cur_dma_ibuf_addr); + ia_css_print("IBUF controller ID %d Process ID %d cur_dma_dest_addr 0x%x\n", ID, + i, + state->proc_state[i].cur_dma_dest_addr); + ia_css_print("IBUF controller ID %d Process ID %d cur_isp_dest_addr 0x%x\n", ID, + i, + state->proc_state[i].cur_isp_dest_addr); + ia_css_print("IBUF controller ID %d Process ID %d dma_cmds_send 0x%x\n", ID, i, + state->proc_state[i].dma_cmds_send); + ia_css_print("IBUF controller ID %d Process ID %d main_cntrl_state 0x%x\n", ID, + i, + state->proc_state[i].main_cntrl_state); + ia_css_print("IBUF controller ID %d Process ID %d dma_sync_state 0x%x\n", ID, i, + state->proc_state[i].dma_sync_state); + ia_css_print("IBUF controller ID %d Process ID %d isp_sync_state 0x%x\n", ID, i, + state->proc_state[i].isp_sync_state); + } +} + +static inline input_system_err_t +input_system_get_state(const input_system_ID_t ID, + input_system_state_t *state) { u32 i; @@ -73,9 +286,8 @@ STORAGE_CLASS_INPUT_SYSTEM_C input_system_err_t input_system_get_state( return INPUT_SYSTEM_ERR_NO_ERROR; } -STORAGE_CLASS_INPUT_SYSTEM_C void input_system_dump_state( - const input_system_ID_t ID, - input_system_state_t *state) +static inline void input_system_dump_state(const input_system_ID_t ID, + input_system_state_t *state) { u32 i; From patchwork Wed Sep 2 16:10:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751185 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 001C114E3 for ; Wed, 2 Sep 2020 16:14:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DB8D1208C7 for ; Wed, 2 Sep 2020 16:14:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063242; bh=QRcYkbu7JvtjVp54e+chCMVF4TavZnBWpxUSfCm0mkI=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=sn8+C9tcv7v/aBtLtRClYg5qGSBm9c2cm3LG+tn5c62OkdNqUNWtnSZNOn+/eC70O 0tOIEm/JEMd9bidwO5WNSPsW6qr1NHIeam+u9BdFoGG5Gx0SvcXz4tbVT4lJe8HbMm q3a87acV9kpwkBgjhh4PSPg28bUJZz9TwxsRJ9fA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728754AbgIBQNy (ORCPT ); Wed, 2 Sep 2020 12:13:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:54040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728328AbgIBQK4 (ORCPT ); Wed, 2 Sep 2020 12:10:56 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7352A21D93; Wed, 2 Sep 2020 16:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=QRcYkbu7JvtjVp54e+chCMVF4TavZnBWpxUSfCm0mkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z5UQUpl/qc1DM1RcLM0MuJiiLxCHWujkZzq6lqMLt3BtfVDuZrQGWuqCiJZwH1/TY Dle5y4L+H+sWF+JhO49ZQnXBzDy1UI0n8r1PIyfcXaVywKsUR+p7JZF6pBkaJjjB57 /Ln8X10C8Q4dXSKQPyNe9IlYUaQrLPm41QOj0uj4= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tB7-L4; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 30/38] media: atomisp: don't check for ISP version for includes Date: Wed, 2 Sep 2020 18:10:33 +0200 Message-Id: <7f589c4f14c767228278e0dd029faa037ce00bcf.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As there aren't duplicated names anymore, and the end goal is to do runtime checks between ISP2400 and ISP2401, remove the part of the Makefile which changes the include places based on the compile-time version. This shouldn't cause any effect, but it will make easier for further patches meant to remove conditional compiler decisions between ISP versions to be replaced by runtime ones. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/Makefile | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/staging/media/atomisp/Makefile b/drivers/staging/media/atomisp/Makefile index 205d0f8cc2e1..1dfad0dd02d0 100644 --- a/drivers/staging/media/atomisp/Makefile +++ b/drivers/staging/media/atomisp/Makefile @@ -307,18 +307,12 @@ INCLUDES += \ -I$(atomisp)/pci/runtime/queue/src/ \ -I$(atomisp)/pci/runtime/rmgr/interface/ \ -I$(atomisp)/pci/runtime/spctrl/interface/ \ - -I$(atomisp)/pci/runtime/tagger/interface/ - -INCLUDES_byt += \ + -I$(atomisp)/pci/runtime/tagger/interface/ \ -I$(atomisp)/pci/css_2400_system/hive/ \ - -INCLUDES_cht += \ -I$(atomisp)/pci/css_2401_system/ \ -I$(atomisp)/pci/css_2401_system/host/ \ -I$(atomisp)/pci/css_2401_system/hive/ \ - -I$(atomisp)/pci/css_2401_system/hrt/ \ - -# -I$(atomisp)/pci/css_2401_system/hive_isp_css_2401_system_generated/ \ + -I$(atomisp)/pci/css_2401_system/hrt/ DEFINES := -DHRT_HW -DHRT_ISP_CSS_CUSTOM_HOST -DHRT_USE_VIR_ADDRS -D__HOST__ #DEFINES += -DUSE_DYNAMIC_BIN @@ -330,11 +324,9 @@ DEFINES := -DHRT_HW -DHRT_ISP_CSS_CUSTOM_HOST -DHRT_USE_VIR_ADDRS -D__HOST__ ifeq ($(CONFIG_VIDEO_ATOMISP_ISP2401),y) atomisp-objs += $(obj-cht) -INCLUDES += $(INCLUDES_cht) DEFINES += -DISP2401 -DISP2401_NEW_INPUT_SYSTEM -DSYSTEM_hive_isp_css_2401_system else atomisp-objs += $(obj-byt) -INCLUDES += $(INCLUDES_byt) DEFINES += -DISP2400 -DSYSTEM_hive_isp_css_2400_system endif From patchwork Wed Sep 2 16:10:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751167 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DAB2614E3 for ; Wed, 2 Sep 2020 16:13:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A8CF620773 for ; Wed, 2 Sep 2020 16:13:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063198; bh=nIwf2Irhblv49+pQhNmKTUAi1wh7eY9UFjQPwAVsjOw=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=GtCn6YiMITgB9/r9jZzrPGQF8N3h2XVntBVz6YSTR1gtClnKJCTU8gtx1x/M9siMr GyKGPb671awaWM32kGhnISkOkoz6mjjfCWklGmxc8IqcnS6H5ImFX5W9N5sRUxKvB6 SAgQDtQZUoOB82kIPXdsWzkL4051Ou3PzupbG2MA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728651AbgIBQNJ (ORCPT ); Wed, 2 Sep 2020 12:13:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:53872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728031AbgIBQK7 (ORCPT ); Wed, 2 Sep 2020 12:10:59 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8514B221E5; Wed, 2 Sep 2020 16:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=nIwf2Irhblv49+pQhNmKTUAi1wh7eY9UFjQPwAVsjOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eL5MloL/sCMawoCSdjUStXLspXZdtLurNHTZVop/sJM/4FWmp23sHhJ9Y4qU8e+7X OSgdybQsgfhhpe6pjdAEsd1dn5Ths0T4ckayoA8YQntlLHlxWn5WDJSX1Av1wzOe9n 1mDhvacnSori5x3ls21NH/Hd8/2FqiOkicgDScjw= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tB9-Lt; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , Arnd Bergmann , Nathan Chancellor , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 31/38] media: atomisp: unify INPUT error return type Date: Wed, 2 Sep 2020 18:10:34 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There is a typedef for INPUT errors. This is different between ISP2401 and ISP2400. Place both at the same struct, at the global header file. Signed-off-by: Mauro Carvalho Chehab --- .../pci/css_2401_system/ibuf_ctrl_global.h | 2 +- .../hive_isp_css_common/host/input_system.c | 56 +++++++++---------- .../media/atomisp/pci/input_system_global.h | 22 ++++++++ .../atomisp/pci/isp2400_input_system_global.h | 7 --- .../atomisp/pci/isp2400_input_system_local.h | 9 --- .../atomisp/pci/isp2400_input_system_public.h | 22 ++++---- .../atomisp/pci/isp2401_input_system_global.h | 19 ------- .../atomisp/pci/isp2401_input_system_local.h | 2 - .../pci/runtime/isys/interface/ia_css_isys.h | 2 +- .../atomisp/pci/runtime/isys/src/isys_init.c | 6 +- 10 files changed, 66 insertions(+), 81 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h b/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h index 1b9f03d57659..ce7b06b3f3c8 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h @@ -33,7 +33,6 @@ #define _IBUF_CNTRL_DMA_SYNC_WAIT_FOR_SYNC 1 #define _IBUF_CNTRL_DMA_SYNC_FSM_WAIT_FOR_ACK (0x3 << 1) -typedef struct ib_buffer_s ib_buffer_t; struct ib_buffer_s { u32 start_addr; /* start address of the buffer in the * "input-buffer hardware block" @@ -42,6 +41,7 @@ struct ib_buffer_s { u32 stride; /* stride per buffer line (in bytes) */ u32 lines; /* lines in the buffer */ }; +typedef struct ib_buffer_s ib_buffer_t; typedef struct ibuf_ctrl_cfg_s ibuf_ctrl_cfg_t; struct ibuf_ctrl_cfg_s { diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c index 4f3d75fac3e3..cd516e4554fb 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c @@ -32,15 +32,15 @@ static const ib_buffer_t IB_BUFFER_NULL = {0, 0, 0 }; -static input_system_error_t input_system_configure_channel( +static input_system_err_t input_system_configure_channel( const channel_cfg_t channel); -static input_system_error_t input_system_configure_channel_sensor( +static input_system_err_t input_system_configure_channel_sensor( const channel_cfg_t channel); -static input_system_error_t input_buffer_configuration(void); +static input_system_err_t input_buffer_configuration(void); -static input_system_error_t configuration_to_registers(void); +static input_system_err_t configuration_to_registers(void); static void receiver_rst(const rx_ID_t ID); static void input_system_network_rst(const input_system_ID_t ID); @@ -65,17 +65,17 @@ static void input_system_network_configure( const input_system_network_cfg_t *const cfg); // MW: CSI is previously named as "rx" short for "receiver" -static input_system_error_t set_csi_cfg( +static input_system_err_t set_csi_cfg( csi_cfg_t *const lhs, const csi_cfg_t *const rhs, input_system_config_flags_t *const flags); -static input_system_error_t set_source_type( +static input_system_err_t set_source_type( input_system_source_t *const lhs, const input_system_source_t rhs, input_system_config_flags_t *const flags); -static input_system_error_t input_system_multiplexer_cfg( +static input_system_err_t input_system_multiplexer_cfg( input_system_multiplex_t *const lhs, const input_system_multiplex_t rhs, input_system_config_flags_t *const flags); @@ -848,7 +848,7 @@ static void input_system_network_rst(const input_system_ID_t ID) } // Function that resets current configuration. -input_system_error_t input_system_configuration_reset(void) +input_system_err_t input_system_configuration_reset(void) { unsigned int i; @@ -890,10 +890,10 @@ input_system_error_t input_system_configuration_reset(void) // MW: Comments are good, but doxygen is required, place it at the declaration // Function that appends the channel to current configuration. -static input_system_error_t input_system_configure_channel( +static input_system_err_t input_system_configure_channel( const channel_cfg_t channel) { - input_system_error_t error = INPUT_SYSTEM_ERR_NO_ERROR; + input_system_err_t error = INPUT_SYSTEM_ERR_NO_ERROR; // Check if channel is not already configured. if (config.ch_flags[channel.ch_id] & INPUT_SYSTEM_CFG_FLAG_SET) { return INPUT_SYSTEM_ERR_CHANNEL_ALREADY_SET; @@ -948,7 +948,7 @@ static input_system_error_t input_system_configure_channel( } // Function that partitions input buffer space with determining addresses. -static input_system_error_t input_buffer_configuration(void) +static input_system_err_t input_buffer_configuration(void) { u32 current_address = 0; u32 unallocated_memory = IB_CAPACITY_IN_WORDS; @@ -1236,7 +1236,7 @@ static void input_system_network_configure( return; } -static input_system_error_t configuration_to_registers(void) +static input_system_err_t configuration_to_registers(void) { input_system_network_cfg_t input_system_network_cfg; int i; @@ -1335,10 +1335,10 @@ static input_system_error_t configuration_to_registers(void) } // Function that applies the whole configuration. -input_system_error_t input_system_configuration_commit(void) +input_system_err_t input_system_configuration_commit(void) { // The last configuration step is to configure the input buffer. - input_system_error_t error = input_buffer_configuration(); + input_system_err_t error = input_buffer_configuration(); if (error != INPUT_SYSTEM_ERR_NO_ERROR) { return error; @@ -1357,7 +1357,7 @@ input_system_error_t input_system_configuration_commit(void) // FIFO -input_system_error_t input_system_csi_fifo_channel_cfg( +input_system_err_t input_system_csi_fifo_channel_cfg( u32 ch_id, input_system_csi_port_t port, backend_channel_cfg_t backend_ch, @@ -1380,7 +1380,7 @@ input_system_error_t input_system_csi_fifo_channel_cfg( return input_system_configure_channel(channel); } -input_system_error_t input_system_csi_fifo_channel_with_counting_cfg( +input_system_err_t input_system_csi_fifo_channel_with_counting_cfg( u32 ch_id, u32 nof_frames, input_system_csi_port_t port, @@ -1411,7 +1411,7 @@ input_system_error_t input_system_csi_fifo_channel_with_counting_cfg( // SRAM -input_system_error_t input_system_csi_sram_channel_cfg( +input_system_err_t input_system_csi_sram_channel_cfg( u32 ch_id, input_system_csi_port_t port, backend_channel_cfg_t backend_ch, @@ -1443,7 +1443,7 @@ input_system_error_t input_system_csi_sram_channel_cfg( //XMEM // Collects all parameters and puts them in channel_cfg_t. -input_system_error_t input_system_csi_xmem_channel_cfg( +input_system_err_t input_system_csi_xmem_channel_cfg( u32 ch_id, input_system_csi_port_t port, backend_channel_cfg_t backend_ch, @@ -1475,7 +1475,7 @@ input_system_error_t input_system_csi_xmem_channel_cfg( return input_system_configure_channel(channel); } -input_system_error_t input_system_csi_xmem_acquire_only_channel_cfg( +input_system_err_t input_system_csi_xmem_acquire_only_channel_cfg( u32 ch_id, u32 nof_frames, input_system_csi_port_t port, @@ -1502,7 +1502,7 @@ input_system_error_t input_system_csi_xmem_acquire_only_channel_cfg( return input_system_configure_channel(channel); } -input_system_error_t input_system_csi_xmem_capture_only_channel_cfg( +input_system_err_t input_system_csi_xmem_capture_only_channel_cfg( u32 ch_id, u32 nof_frames, input_system_csi_port_t port, @@ -1535,7 +1535,7 @@ input_system_error_t input_system_csi_xmem_capture_only_channel_cfg( // Non - CSI -input_system_error_t input_system_prbs_channel_cfg( +input_system_err_t input_system_prbs_channel_cfg( u32 ch_id, u32 nof_frames,//not used yet u32 seed, @@ -1564,7 +1564,7 @@ input_system_error_t input_system_prbs_channel_cfg( return input_system_configure_channel(channel); } -input_system_error_t input_system_tpg_channel_cfg( +input_system_err_t input_system_tpg_channel_cfg( u32 ch_id, u32 nof_frames,//not used yet u32 x_mask, @@ -1601,7 +1601,7 @@ input_system_error_t input_system_tpg_channel_cfg( } // MW: Don't use system specific names, (even in system specific files) "cfg2400" -> cfg -input_system_error_t input_system_gpfifo_channel_cfg( +input_system_err_t input_system_gpfifo_channel_cfg( u32 ch_id, u32 nof_frames, //not used yet @@ -1625,11 +1625,11 @@ input_system_error_t input_system_gpfifo_channel_cfg( /////////////////////////////////////////////////////////////////////////// // Fills the parameters to config.csi_value[port] -static input_system_error_t input_system_configure_channel_sensor( +static input_system_err_t input_system_configure_channel_sensor( const channel_cfg_t channel) { const u32 port = channel.source_cfg.csi_cfg.csi_port; - input_system_error_t status = INPUT_SYSTEM_ERR_NO_ERROR; + input_system_err_t status = INPUT_SYSTEM_ERR_NO_ERROR; input_system_multiplex_t mux; @@ -1711,7 +1711,7 @@ static input_system_error_t input_system_configure_channel_sensor( } // Test flags and set structure. -static input_system_error_t set_source_type( +static input_system_err_t set_source_type( input_system_source_t *const lhs, const input_system_source_t rhs, input_system_config_flags_t *const flags) @@ -1747,7 +1747,7 @@ static input_system_error_t set_source_type( } // Test flags and set structure. -static input_system_error_t set_csi_cfg( +static input_system_err_t set_csi_cfg( csi_cfg_t *const lhs, const csi_cfg_t *const rhs, input_system_config_flags_t *const flags) @@ -1814,7 +1814,7 @@ static input_system_error_t set_csi_cfg( } // Test flags and set structure. -static input_system_error_t input_system_multiplexer_cfg( +static input_system_err_t input_system_multiplexer_cfg( input_system_multiplex_t *const lhs, const input_system_multiplex_t rhs, input_system_config_flags_t *const flags) diff --git a/drivers/staging/media/atomisp/pci/input_system_global.h b/drivers/staging/media/atomisp/pci/input_system_global.h index 5ac580ce64ed..5929d529950b 100644 --- a/drivers/staging/media/atomisp/pci/input_system_global.h +++ b/drivers/staging/media/atomisp/pci/input_system_global.h @@ -4,8 +4,30 @@ * (c) 2020 Mauro Carvalho Chehab */ + +#ifndef __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ +#define __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ +typedef enum { + INPUT_SYSTEM_ERR_NO_ERROR = 0, + /* ISP2401 */ + INPUT_SYSTEM_ERR_CREATE_CHANNEL_FAIL, + INPUT_SYSTEM_ERR_CONFIGURE_CHANNEL_FAIL, + INPUT_SYSTEM_ERR_OPEN_CHANNEL_FAIL, + INPUT_SYSTEM_ERR_TRANSFER_FAIL, + INPUT_SYSTEM_ERR_CREATE_INPUT_PORT_FAIL, + INPUT_SYSTEM_ERR_CONFIGURE_INPUT_PORT_FAIL, + INPUT_SYSTEM_ERR_OPEN_INPUT_PORT_FAIL, + /* ISP2400 */ + INPUT_SYSTEM_ERR_GENERIC, + INPUT_SYSTEM_ERR_CHANNEL_ALREADY_SET, + INPUT_SYSTEM_ERR_CONFLICT_ON_RESOURCE, + INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED, +} input_system_err_t; + #ifdef ISP2401 # include "isp2401_input_system_global.h" #else # include "isp2400_input_system_global.h" #endif + +#endif /* __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/isp2400_input_system_global.h b/drivers/staging/media/atomisp/pci/isp2400_input_system_global.h index b4142bdde51b..54dc53cf1528 100644 --- a/drivers/staging/media/atomisp/pci/isp2400_input_system_global.h +++ b/drivers/staging/media/atomisp/pci/isp2400_input_system_global.h @@ -13,11 +13,6 @@ * more details. */ -#ifndef __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ -#define __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ - -#define IS_INPUT_SYSTEM_VERSION_2 - #include //CSI reveiver has 3 ports. @@ -152,5 +147,3 @@ typedef enum { } input_system_cfg_flag_t; typedef u32 input_system_config_flags_t; - -#endif /* __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/isp2400_input_system_local.h b/drivers/staging/media/atomisp/pci/isp2400_input_system_local.h index 33ebf89ca053..b26c07478914 100644 --- a/drivers/staging/media/atomisp/pci/isp2400_input_system_local.h +++ b/drivers/staging/media/atomisp/pci/isp2400_input_system_local.h @@ -33,15 +33,6 @@ #include "isp_acquisition_defs.h" #include "input_system_ctrl_defs.h" -typedef enum { - INPUT_SYSTEM_ERR_NO_ERROR = 0, - INPUT_SYSTEM_ERR_GENERIC, - INPUT_SYSTEM_ERR_CHANNEL_ALREADY_SET, - INPUT_SYSTEM_ERR_CONFLICT_ON_RESOURCE, - INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED, - N_INPUT_SYSTEM_ERR -} input_system_error_t; - typedef enum { INPUT_SYSTEM_PORT_A = 0, INPUT_SYSTEM_PORT_B, diff --git a/drivers/staging/media/atomisp/pci/isp2400_input_system_public.h b/drivers/staging/media/atomisp/pci/isp2400_input_system_public.h index c6e5b17b3c40..85cb61e34192 100644 --- a/drivers/staging/media/atomisp/pci/isp2400_input_system_public.h +++ b/drivers/staging/media/atomisp/pci/isp2400_input_system_public.h @@ -251,11 +251,11 @@ STORAGE_CLASS_INPUT_SYSTEM_H hrt_data input_system_sub_system_reg_load( // Function that resets current configuration. // remove the argument since it should be private. -input_system_error_t input_system_configuration_reset(void); +input_system_err_t input_system_configuration_reset(void); // Function that commits current configuration. // remove the argument since it should be private. -input_system_error_t input_system_configuration_commit(void); +input_system_err_t input_system_configuration_commit(void); /////////////////////////////////////////////////////////////////////////// // @@ -269,14 +269,14 @@ input_system_error_t input_system_configuration_commit(void); // FIFO channel config function user -input_system_error_t input_system_csi_fifo_channel_cfg( +input_system_err_t input_system_csi_fifo_channel_cfg( u32 ch_id, input_system_csi_port_t port, backend_channel_cfg_t backend_ch, target_cfg2400_t target ); -input_system_error_t input_system_csi_fifo_channel_with_counting_cfg( +input_system_err_t input_system_csi_fifo_channel_with_counting_cfg( u32 ch_id, u32 nof_frame, input_system_csi_port_t port, @@ -288,7 +288,7 @@ input_system_error_t input_system_csi_fifo_channel_with_counting_cfg( // SRAM channel config function user -input_system_error_t input_system_csi_sram_channel_cfg( +input_system_err_t input_system_csi_sram_channel_cfg( u32 ch_id, input_system_csi_port_t port, backend_channel_cfg_t backend_ch, @@ -299,7 +299,7 @@ input_system_error_t input_system_csi_sram_channel_cfg( //XMEM channel config function user -input_system_error_t input_system_csi_xmem_channel_cfg( +input_system_err_t input_system_csi_xmem_channel_cfg( u32 ch_id, input_system_csi_port_t port, backend_channel_cfg_t backend_ch, @@ -311,7 +311,7 @@ input_system_error_t input_system_csi_xmem_channel_cfg( uint32_t nof_xmem_buffers ); -input_system_error_t input_system_csi_xmem_capture_only_channel_cfg( +input_system_err_t input_system_csi_xmem_capture_only_channel_cfg( u32 ch_id, u32 nof_frames, input_system_csi_port_t port, @@ -322,7 +322,7 @@ input_system_error_t input_system_csi_xmem_capture_only_channel_cfg( target_cfg2400_t target ); -input_system_error_t input_system_csi_xmem_acquire_only_channel_cfg( +input_system_err_t input_system_csi_xmem_acquire_only_channel_cfg( u32 ch_id, u32 nof_frames, input_system_csi_port_t port, @@ -334,7 +334,7 @@ input_system_error_t input_system_csi_xmem_acquire_only_channel_cfg( // Non - CSI channel config function user -input_system_error_t input_system_prbs_channel_cfg( +input_system_err_t input_system_prbs_channel_cfg( u32 ch_id, u32 nof_frames, u32 seed, @@ -345,7 +345,7 @@ input_system_error_t input_system_prbs_channel_cfg( target_cfg2400_t target ); -input_system_error_t input_system_tpg_channel_cfg( +input_system_err_t input_system_tpg_channel_cfg( u32 ch_id, u32 nof_frames,//not used yet u32 x_mask, @@ -360,7 +360,7 @@ input_system_error_t input_system_tpg_channel_cfg( target_cfg2400_t target ); -input_system_error_t input_system_gpfifo_channel_cfg( +input_system_err_t input_system_gpfifo_channel_cfg( u32 ch_id, u32 nof_frames, target_cfg2400_t target diff --git a/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h b/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h index 362644856a6c..29bffaa07ee8 100644 --- a/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h +++ b/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h @@ -13,11 +13,6 @@ * more details. */ -#ifndef __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ -#define __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ - -#define IS_INPUT_SYSTEM_VERSION_VERSION_2401 - /* CSI reveiver has 3 ports. */ #define N_CSI_PORTS (3) @@ -41,18 +36,6 @@ #define INPUT_SYSTEM_N_STREAM_ID 6 /* maximum number of simultaneous virtual channels supported*/ -typedef enum { - INPUT_SYSTEM_ERR_NO_ERROR = 0, - INPUT_SYSTEM_ERR_CREATE_CHANNEL_FAIL, - INPUT_SYSTEM_ERR_CONFIGURE_CHANNEL_FAIL, - INPUT_SYSTEM_ERR_OPEN_CHANNEL_FAIL, - INPUT_SYSTEM_ERR_TRANSFER_FAIL, - INPUT_SYSTEM_ERR_CREATE_INPUT_PORT_FAIL, - INPUT_SYSTEM_ERR_CONFIGURE_INPUT_PORT_FAIL, - INPUT_SYSTEM_ERR_OPEN_INPUT_PORT_FAIL, - N_INPUT_SYSTEM_ERR -} input_system_err_t; - typedef enum { INPUT_SYSTEM_SOURCE_TYPE_UNDEFINED = 0, INPUT_SYSTEM_SOURCE_TYPE_SENSOR, @@ -203,5 +186,3 @@ struct virtual_input_system_stream_cfg_s { #define NUM_OF_LINES_PER_BUF 2 #define LINES_OF_ISP_INPUT_BUF (NUM_OF_INPUT_BUF * NUM_OF_LINES_PER_BUF) #define ISP_INPUT_BUF_STRIDE SH_CSS_MAX_SENSOR_WIDTH - -#endif /* __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ */ diff --git a/drivers/staging/media/atomisp/pci/isp2401_input_system_local.h b/drivers/staging/media/atomisp/pci/isp2401_input_system_local.h index c33b0341ce16..24026090cd35 100644 --- a/drivers/staging/media/atomisp/pci/isp2401_input_system_local.h +++ b/drivers/staging/media/atomisp/pci/isp2401_input_system_local.h @@ -24,8 +24,6 @@ #include "isys_stream2mmio.h" #include "isys_irq.h" -typedef input_system_err_t input_system_error_t; - typedef enum { MIPI_FORMAT_SHORT1 = 0x08, MIPI_FORMAT_SHORT2, diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h b/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h index bd972d966fe2..ea0b518e80c6 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h +++ b/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h @@ -32,7 +32,7 @@ typedef input_system_cfg_t ia_css_isys_descr_t; /* end of Virtual Input System */ #endif -input_system_error_t ia_css_isys_init(void); +input_system_err_t ia_css_isys_init(void); void ia_css_isys_uninit(void); enum mipi_port_id ia_css_isys_port_to_mipi_port( enum mipi_port_id api_port); diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c index 484c5967ad1c..d0a43c44963c 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c @@ -24,7 +24,7 @@ #endif #if !defined(ISP2401) -input_system_error_t ia_css_isys_init(void) +input_system_err_t ia_css_isys_init(void) { backend_channel_cfg_t backend_ch0; backend_channel_cfg_t backend_ch1; @@ -32,7 +32,7 @@ input_system_error_t ia_css_isys_init(void) target_cfg2400_t targetC; u32 acq_mem_region_size = 24; u32 acq_nof_mem_regions = 2; - input_system_error_t error = INPUT_SYSTEM_ERR_NO_ERROR; + input_system_err_t error = INPUT_SYSTEM_ERR_NO_ERROR; memset(&backend_ch0, 0, sizeof(backend_channel_cfg_t)); memset(&backend_ch1, 0, sizeof(backend_channel_cfg_t)); @@ -87,7 +87,7 @@ input_system_error_t ia_css_isys_init(void) return error; } #elif defined(ISP2401) -input_system_error_t ia_css_isys_init(void) +input_system_err_t ia_css_isys_init(void) { ia_css_isys_csi_rx_lut_rmgr_init(); ia_css_isys_ibuf_rmgr_init(); From patchwork Wed Sep 2 16:10:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751169 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E8BBE109A for ; Wed, 2 Sep 2020 16:13:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BE09C20773 for ; Wed, 2 Sep 2020 16:13:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063200; bh=gll70D6GU5P8UxfSQJbH5W1Oo/6tkhIxKgLxAVOiR3k=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=z213z4NgcpF8DW70rMf2HTLz2Cpp6YiOwzeT43TOmC+H4U7vp+omjL5fjO0PygQB4 0yH/8Ycu3FHu8m6bMDSbJLWV3bnyDwHSUKYhDhD6fBWLudzmp8+Oc4qMEm5uaJjAoY oNqSuwADQ0Y/LAeCxqZoHBjlt8NopKY+MzMrxeNI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728637AbgIBQNJ (ORCPT ); Wed, 2 Sep 2020 12:13:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:54060 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728348AbgIBQLA (ORCPT ); Wed, 2 Sep 2020 12:11:00 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8E6C8221E7; Wed, 2 Sep 2020 16:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=gll70D6GU5P8UxfSQJbH5W1Oo/6tkhIxKgLxAVOiR3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qk72ISxc1pOlH7TIicg8byDtrLhGffpeuLMixdWiaAp8z30tYFaC6ZgfQD7cLBgEQ SfUIjAejg8WgKlK53Qa6r4lOeWKm//lLp5VgEvoF6hcwZwchBeYxA7MCqIBtC8OqZH 3MQ6/8Va7hJtqNn9lU+MMpuu1JKDrHlR0qH5cZD0= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tBB-N8; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , Nathan Chancellor , Arnd Bergmann , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 32/38] media: atomisp: de-duplicate names at *_input_system_global.h Date: Wed, 2 Sep 2020 18:10:35 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There are some duplicated names between the ISP2401 and ISP2400 for the input system, with different meanings. In order to avoid ubiquity, let's prepend those with the name of the ISP. Signed-off-by: Mauro Carvalho Chehab --- .../pci/css_2401_system/ibuf_ctrl_global.h | 6 +- .../pci/css_2401_system/pixelgen_global.h | 8 +-- .../hive_isp_css_common/host/input_system.c | 12 ++-- .../atomisp/pci/isp2400_input_system_global.h | 14 ++--- .../atomisp/pci/isp2400_input_system_local.h | 8 +-- .../atomisp/pci/isp2401_input_system_global.h | 6 +- .../pci/runtime/isys/interface/ia_css_isys.h | 4 +- .../media/atomisp/pci/runtime/isys/src/rx.c | 2 +- .../pci/runtime/isys/src/virtual_isys.c | 56 +++++++++---------- 9 files changed, 58 insertions(+), 58 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h b/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h index ce7b06b3f3c8..56c5ed89b3cc 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/ibuf_ctrl_global.h @@ -33,7 +33,7 @@ #define _IBUF_CNTRL_DMA_SYNC_WAIT_FOR_SYNC 1 #define _IBUF_CNTRL_DMA_SYNC_FSM_WAIT_FOR_ACK (0x3 << 1) -struct ib_buffer_s { +struct isp2401_ib_buffer_s { u32 start_addr; /* start address of the buffer in the * "input-buffer hardware block" */ @@ -41,7 +41,7 @@ struct ib_buffer_s { u32 stride; /* stride per buffer line (in bytes) */ u32 lines; /* lines in the buffer */ }; -typedef struct ib_buffer_s ib_buffer_t; +typedef struct isp2401_ib_buffer_s isp2401_ib_buffer_t; typedef struct ibuf_ctrl_cfg_s ibuf_ctrl_cfg_t; struct ibuf_ctrl_cfg_s { @@ -58,7 +58,7 @@ struct ibuf_ctrl_cfg_s { u32 elems_per_word_in_dest; } dma_cfg; - ib_buffer_t ib_buffer; + isp2401_ib_buffer_t ib_buffer; struct { u32 stride; diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/pixelgen_global.h b/drivers/staging/media/atomisp/pci/css_2401_system/pixelgen_global.h index 75722ef572d0..f131f03cb8fa 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/pixelgen_global.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/pixelgen_global.h @@ -24,8 +24,8 @@ /* * Duplicates "sync_generator_cfg_t" in "input_system_global.h". */ -typedef struct sync_generator_cfg_s sync_generator_cfg_t; -struct sync_generator_cfg_s { +typedef struct isp2401_sync_generator_cfg_s isp2401_sync_generator_cfg_t; +struct isp2401_sync_generator_cfg_s { u32 hblank_cycles; u32 vblank_cycles; u32 pixels_per_clock; @@ -72,7 +72,7 @@ struct pixelgen_tpg_cfg_s { s32 v_delta; /* vertical delta? */ } delta_cfg; - sync_generator_cfg_t sync_gen_cfg; + isp2401_sync_generator_cfg_t sync_gen_cfg; }; /* @@ -84,7 +84,7 @@ struct pixelgen_prbs_cfg_s { s32 seed0; s32 seed1; - sync_generator_cfg_t sync_gen_cfg; + isp2401_sync_generator_cfg_t sync_gen_cfg; }; /* end of Pixel-generator: TPG. ("pixelgen_global.h") */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c index cd516e4554fb..0f5a231672a8 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c @@ -30,7 +30,7 @@ #define ZERO (0x0) #define ONE (1U) -static const ib_buffer_t IB_BUFFER_NULL = {0, 0, 0 }; +static const isp2400_ib_buffer_t IB_BUFFER_NULL = {0, 0, 0 }; static input_system_err_t input_system_configure_channel( const channel_cfg_t channel); @@ -48,12 +48,12 @@ static void input_system_network_rst(const input_system_ID_t ID); static void capture_unit_configure( const input_system_ID_t ID, const sub_system_ID_t sub_id, - const ib_buffer_t *const cfg); + const isp2400_ib_buffer_t *const cfg); static void acquisition_unit_configure( const input_system_ID_t ID, const sub_system_ID_t sub_id, - const ib_buffer_t *const cfg); + const isp2400_ib_buffer_t *const cfg); static void ctrl_unit_configure( const input_system_ID_t ID, @@ -953,7 +953,7 @@ static input_system_err_t input_buffer_configuration(void) u32 current_address = 0; u32 unallocated_memory = IB_CAPACITY_IN_WORDS; - ib_buffer_t candidate_buffer_acq = IB_BUFFER_NULL; + isp2400_ib_buffer_t candidate_buffer_acq = IB_BUFFER_NULL; u32 size_requested; input_system_config_flags_t acq_already_specified = INPUT_SYSTEM_CFG_FLAG_RESET; input_system_csi_port_t port; @@ -1062,7 +1062,7 @@ static input_system_err_t input_buffer_configuration(void) static void capture_unit_configure( const input_system_ID_t ID, const sub_system_ID_t sub_id, - const ib_buffer_t *const cfg) + const isp2400_ib_buffer_t *const cfg) { assert(ID < N_INPUT_SYSTEM_ID); assert(/*(sub_id >= CAPTURE_UNIT0_ID) &&*/ (sub_id <= @@ -1088,7 +1088,7 @@ static void capture_unit_configure( static void acquisition_unit_configure( const input_system_ID_t ID, const sub_system_ID_t sub_id, - const ib_buffer_t *const cfg) + const isp2400_ib_buffer_t *const cfg) { assert(ID < N_INPUT_SYSTEM_ID); assert(sub_id == ACQUISITION_UNIT0_ID); diff --git a/drivers/staging/media/atomisp/pci/isp2400_input_system_global.h b/drivers/staging/media/atomisp/pci/isp2400_input_system_global.h index 54dc53cf1528..61f23814e2fd 100644 --- a/drivers/staging/media/atomisp/pci/isp2400_input_system_global.h +++ b/drivers/staging/media/atomisp/pci/isp2400_input_system_global.h @@ -75,13 +75,13 @@ typedef enum { N_INPUT_SYSTEM_BUFFERING_MODE } buffering_mode_t; -typedef struct input_system_cfg_s input_system_cfg_t; +typedef struct isp2400_input_system_cfg_s input_system_cfg_t; typedef struct sync_generator_cfg_s sync_generator_cfg_t; typedef struct tpg_cfg_s tpg_cfg_t; typedef struct prbs_cfg_s prbs_cfg_t; /* MW: uint16_t should be sufficient */ -struct input_system_cfg_s { +struct isp2400_input_system_cfg_s { u32 no_side_band; u32 fmt_type; u32 ch_id; @@ -118,7 +118,7 @@ struct gpfifo_cfg_s { typedef struct gpfifo_cfg_s gpfifo_cfg_t; //ALX:Commented out to pass the compilation. -//typedef struct input_system_cfg_s input_system_cfg_t; +//typedef struct isp2400_input_system_cfg_s input_system_cfg_t; struct ib_buffer_s { u32 mem_reg_size; @@ -126,13 +126,13 @@ struct ib_buffer_s { u32 mem_reg_addr; }; -typedef struct ib_buffer_s ib_buffer_t; +typedef struct ib_buffer_s isp2400_ib_buffer_t; struct csi_cfg_s { u32 csi_port; buffering_mode_t buffering_mode; - ib_buffer_t csi_buffer; - ib_buffer_t acquisition_buffer; + isp2400_ib_buffer_t csi_buffer; + isp2400_ib_buffer_t acquisition_buffer; u32 nof_xmem_buffers; }; @@ -144,6 +144,6 @@ typedef enum { INPUT_SYSTEM_CFG_FLAG_BLOCKED = 1U << 1, INPUT_SYSTEM_CFG_FLAG_REQUIRED = 1U << 2, INPUT_SYSTEM_CFG_FLAG_CONFLICT = 1U << 3 // To mark a conflicting configuration. -} input_system_cfg_flag_t; +} isp2400_input_system_cfg_flag_t; typedef u32 input_system_config_flags_t; diff --git a/drivers/staging/media/atomisp/pci/isp2400_input_system_local.h b/drivers/staging/media/atomisp/pci/isp2400_input_system_local.h index b26c07478914..072a92199e05 100644 --- a/drivers/staging/media/atomisp/pci/isp2400_input_system_local.h +++ b/drivers/staging/media/atomisp/pci/isp2400_input_system_local.h @@ -52,8 +52,8 @@ typedef struct input_switch_cfg_channel_s input_switch_cfg_channel_t; typedef struct input_switch_cfg_s input_switch_cfg_t; struct ctrl_unit_cfg_s { - ib_buffer_t buffer_mipi[N_CAPTURE_UNIT_ID]; - ib_buffer_t buffer_acquire[N_ACQUISITION_UNIT_ID]; + isp2400_ib_buffer_t buffer_mipi[N_CAPTURE_UNIT_ID]; + isp2400_ib_buffer_t buffer_acquire[N_ACQUISITION_UNIT_ID]; }; struct input_system_network_cfg_s { @@ -128,9 +128,9 @@ struct input_system_cfg2400_s { // Possible another struct for ib. // This buffers set at the end, based on the all configurations. - ib_buffer_t csi_buffer[N_CSI_PORTS]; + isp2400_ib_buffer_t csi_buffer[N_CSI_PORTS]; input_system_config_flags_t csi_buffer_flags[N_CSI_PORTS]; - ib_buffer_t acquisition_buffer_unique; + isp2400_ib_buffer_t acquisition_buffer_unique; input_system_config_flags_t acquisition_buffer_unique_flags; u32 unallocated_ib_mem_words; // Used for check.DEFAULT = IB_CAPACITY_IN_WORDS. //uint32_t acq_allocated_ib_mem_words; diff --git a/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h b/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h index 29bffaa07ee8..f38773842646 100644 --- a/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h +++ b/drivers/staging/media/atomisp/pci/isp2401_input_system_global.h @@ -55,7 +55,7 @@ struct input_system_channel_s { stream2mmio_sid_ID_t stream2mmio_sid_id; ibuf_ctrl_ID_t ibuf_ctrl_id; - ib_buffer_t ib_buffer; + isp2401_ib_buffer_t ib_buffer; isys2401_dma_ID_t dma_id; isys2401_dma_channel dma_channel; @@ -105,8 +105,8 @@ struct input_system_input_port_cfg_s { } pixelgen_cfg; }; -typedef struct input_system_cfg_s input_system_cfg_t; -struct input_system_cfg_s { +typedef struct isp2401_input_system_cfg_s isp2401_input_system_cfg_t; +struct isp2401_input_system_cfg_s { input_system_input_port_ID_t input_port_id; input_system_source_type_t mode; diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h b/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h index ea0b518e80c6..711a321e9a3f 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h +++ b/drivers/staging/media/atomisp/pci/runtime/isys/interface/ia_css_isys.h @@ -28,7 +28,7 @@ /** * Virtual Input System. (Input System 2401) */ -typedef input_system_cfg_t ia_css_isys_descr_t; +typedef isp2401_input_system_cfg_t ia_css_isys_descr_t; /* end of Virtual Input System */ #endif @@ -71,7 +71,7 @@ int ia_css_isys_csi_rx_unregister_stream( int ia_css_isys_convert_compressed_format( struct ia_css_csi2_compression *comp, - struct input_system_cfg_s *cfg); + struct isp2401_input_system_cfg_s *cfg); unsigned int ia_css_csi2_calculate_input_system_alignment( enum atomisp_input_format fmt_type); #endif diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c index c4bb9fd9ce20..b4813cd50daa 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/rx.c @@ -376,7 +376,7 @@ static mipi_predictor_t sh_css_csi2_compression_type_2_mipi_predictor( int ia_css_isys_convert_compressed_format( struct ia_css_csi2_compression *comp, - struct input_system_cfg_s *cfg) + struct isp2401_input_system_cfg_s *cfg) { int err = 0; diff --git a/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c b/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c index 037b9e71a655..317ea30ede7a 100644 --- a/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c +++ b/drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c @@ -33,7 +33,7 @@ *************************************************/ static bool create_input_system_channel( - input_system_cfg_t *cfg, + isp2401_input_system_cfg_t *cfg, bool metadata, input_system_channel_t *channel); @@ -41,7 +41,7 @@ static void destroy_input_system_channel( input_system_channel_t *channel); static bool create_input_system_input_port( - input_system_cfg_t *cfg, + isp2401_input_system_cfg_t *cfg, input_system_input_port_t *input_port); static void destroy_input_system_input_port( @@ -50,14 +50,14 @@ static void destroy_input_system_input_port( static bool calculate_input_system_channel_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, - input_system_cfg_t *isys_cfg, + isp2401_input_system_cfg_t *isys_cfg, input_system_channel_cfg_t *channel_cfg, bool metadata); static bool calculate_input_system_input_port_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, - input_system_cfg_t *isys_cfg, + isp2401_input_system_cfg_t *isys_cfg, input_system_input_port_cfg_t *input_port_cfg); static bool acquire_sid( @@ -74,10 +74,10 @@ static bool acquire_ib_buffer( s32 lines_per_frame, s32 align_in_bytes, bool online, - ib_buffer_t *buf); + isp2401_ib_buffer_t *buf); static void release_ib_buffer( - ib_buffer_t *buf); + isp2401_ib_buffer_t *buf); static bool acquire_dma_channel( isys2401_dma_ID_t dma_id, @@ -100,43 +100,43 @@ static void release_be_lut_entry( static bool calculate_tpg_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, - input_system_cfg_t *isys_cfg, + isp2401_input_system_cfg_t *isys_cfg, pixelgen_tpg_cfg_t *cfg); static bool calculate_prbs_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, - input_system_cfg_t *isys_cfg, + isp2401_input_system_cfg_t *isys_cfg, pixelgen_prbs_cfg_t *cfg); static bool calculate_fe_cfg( - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, csi_rx_frontend_cfg_t *cfg); static bool calculate_be_cfg( const input_system_input_port_t *input_port, - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, bool metadata, csi_rx_backend_cfg_t *cfg); static bool calculate_stream2mmio_cfg( - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, bool metadata, stream2mmio_cfg_t *cfg); static bool calculate_ibuf_ctrl_cfg( const input_system_channel_t *channel, const input_system_input_port_t *input_port, - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, ibuf_ctrl_cfg_t *cfg); static bool calculate_isys2401_dma_cfg( const input_system_channel_t *channel, - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, isys2401_dma_cfg_t *cfg); static bool calculate_isys2401_dma_port_cfg( - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, bool raw_packed, bool metadata, isys2401_dma_port_cfg_t *cfg); @@ -287,7 +287,7 @@ ia_css_isys_error_t ia_css_isys_stream_calculate_cfg( * **************************************************/ static bool create_input_system_channel( - input_system_cfg_t *cfg, + isp2401_input_system_cfg_t *cfg, bool metadata, input_system_channel_t *me) { @@ -361,7 +361,7 @@ static void destroy_input_system_channel( } static bool create_input_system_input_port( - input_system_cfg_t *cfg, + isp2401_input_system_cfg_t *cfg, input_system_input_port_t *me) { csi_mipi_packet_type_t packet_type; @@ -457,7 +457,7 @@ static void destroy_input_system_input_port( static bool calculate_input_system_channel_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, - input_system_cfg_t *isys_cfg, + isp2401_input_system_cfg_t *isys_cfg, input_system_channel_cfg_t *channel_cfg, bool metadata) { @@ -508,7 +508,7 @@ static bool calculate_input_system_channel_cfg( static bool calculate_input_system_input_port_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, - input_system_cfg_t *isys_cfg, + isp2401_input_system_cfg_t *isys_cfg, input_system_input_port_cfg_t *input_port_cfg) { bool rc; @@ -595,7 +595,7 @@ static bool acquire_ib_buffer( s32 lines_per_frame, s32 align_in_bytes, bool online, - ib_buffer_t *buf) + isp2401_ib_buffer_t *buf) { buf->stride = calculate_stride(bits_per_pixel, pixels_per_line, false, align_in_bytes); @@ -610,7 +610,7 @@ static bool acquire_ib_buffer( } static void release_ib_buffer( - ib_buffer_t *buf) + isp2401_ib_buffer_t *buf) { ia_css_isys_ibuf_rmgr_release(&buf->start_addr); } @@ -648,7 +648,7 @@ static void release_be_lut_entry( static bool calculate_tpg_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, - input_system_cfg_t *isys_cfg, + isp2401_input_system_cfg_t *isys_cfg, pixelgen_tpg_cfg_t *cfg) { memcpy(cfg, &isys_cfg->tpg_port_attr, sizeof(pixelgen_tpg_cfg_t)); @@ -659,7 +659,7 @@ static bool calculate_tpg_cfg( static bool calculate_prbs_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port, - input_system_cfg_t *isys_cfg, + isp2401_input_system_cfg_t *isys_cfg, pixelgen_prbs_cfg_t *cfg) { memcpy(cfg, &isys_cfg->prbs_port_attr, sizeof(pixelgen_prbs_cfg_t)); @@ -668,7 +668,7 @@ static bool calculate_prbs_cfg( } static bool calculate_fe_cfg( - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, csi_rx_frontend_cfg_t *cfg) { cfg->active_lanes = isys_cfg->csi_port_attr.active_lanes; @@ -677,7 +677,7 @@ static bool calculate_fe_cfg( static bool calculate_be_cfg( const input_system_input_port_t *input_port, - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, bool metadata, csi_rx_backend_cfg_t *cfg) { @@ -707,7 +707,7 @@ static bool calculate_be_cfg( } static bool calculate_stream2mmio_cfg( - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, bool metadata, stream2mmio_cfg_t *cfg ) @@ -725,7 +725,7 @@ static bool calculate_stream2mmio_cfg( static bool calculate_ibuf_ctrl_cfg( const input_system_channel_t *channel, const input_system_input_port_t *input_port, - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, ibuf_ctrl_cfg_t *cfg) { const s32 bits_per_byte = 8; @@ -807,7 +807,7 @@ static bool calculate_ibuf_ctrl_cfg( static bool calculate_isys2401_dma_cfg( const input_system_channel_t *channel, - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, isys2401_dma_cfg_t *cfg) { cfg->channel = channel->dma_channel; @@ -827,7 +827,7 @@ static bool calculate_isys2401_dma_cfg( /* See also: ia_css_dma_configure_from_info() */ static bool calculate_isys2401_dma_port_cfg( - const input_system_cfg_t *isys_cfg, + const isp2401_input_system_cfg_t *isys_cfg, bool raw_packed, bool metadata, isys2401_dma_port_cfg_t *cfg) From patchwork Wed Sep 2 16:10:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751197 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F51D14E3 for ; Wed, 2 Sep 2020 16:15:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6725D208B3 for ; Wed, 2 Sep 2020 16:15:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063354; bh=ygOrs9/TbmE/SLDVqbxZuGdRzrY5tz+l2wQYXOLaHX8=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=SZHHkSVzP9bmkCP6XlfFbfNJ/bg2jTqQ14bvYp4DLoMfIBqOpBf/msfwZxf8SLIh2 KDI9U42ihOTjJmlOTjFtvVf0aZFPnMyN9nSEo/tDNqqPnGgHaSCZ60Luou9+joDZGX G8qqZv6K17vfAiN5ivpXi7Ot50lcnALDIj5aomds= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728723AbgIBQNu (ORCPT ); Wed, 2 Sep 2020 12:13:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:53892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728337AbgIBQK5 (ORCPT ); Wed, 2 Sep 2020 12:10:57 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 955EA221E9; Wed, 2 Sep 2020 16:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=ygOrs9/TbmE/SLDVqbxZuGdRzrY5tz+l2wQYXOLaHX8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qcn81GzS9uljGnPISviBx4p4SjOF+payyjuLCy1wTyowFB7aCMFHOqjuxeweKGsiO nXOkOG6H0hgBrP7lqlvedRme68Vp1opIap5GqEIcGCrhdbzp6+6wIGReqIgHMIrKNE O93L+9GzlzfxcfKY/fxb6PFSiFje3vfyppMhQ8mA= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tBD-OK; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , Colin Ian King , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 33/38] media: atomisp: reorder functions at pixelgen_private.h Date: Wed, 2 Sep 2020 18:10:36 +0200 Message-Id: <0e922e4d1f89b430585cb774fd92f00d4eb734d8.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Reorder functions in order to declare before usage. Signed-off-by: Mauro Carvalho Chehab --- .../css_2401_system/host/pixelgen_private.h | 73 ++++++++++--------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/pixelgen_private.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/pixelgen_private.h index 4faa519219ee..1c7938d8ccb5 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/pixelgen_private.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/pixelgen_private.h @@ -20,6 +20,43 @@ #include "device_access.h" /* ia_css_device_load_uint32 */ #include "assert_support.h" /* assert */ +/***************************************************** + * + * Device level interface (DLI). + * + *****************************************************/ +/** + * @brief Load the register value. + * Refer to "pixelgen_public.h" for details. + */ +STORAGE_CLASS_PIXELGEN_C hrt_data pixelgen_ctrl_reg_load( + const pixelgen_ID_t ID, + const hrt_address reg) +{ + assert(ID < N_PIXELGEN_ID); + assert(PIXELGEN_CTRL_BASE[ID] != (hrt_address) - 1); + return ia_css_device_load_uint32(PIXELGEN_CTRL_BASE[ID] + reg * sizeof( + hrt_data)); +} + +/** + * @brief Store a value to the register. + * Refer to "pixelgen_ctrl_public.h" for details. + */ +STORAGE_CLASS_PIXELGEN_C void pixelgen_ctrl_reg_store( + const pixelgen_ID_t ID, + const hrt_address reg, + const hrt_data value) +{ + assert(ID < N_PIXELGEN_ID); + assert(PIXELGEN_CTRL_BASE[ID] != (hrt_address)-1); + + ia_css_device_store_uint32(PIXELGEN_CTRL_BASE[ID] + reg * sizeof(hrt_data), + value); +} + +/* end of DLI */ + /***************************************************** * * Native command interface (NCI). @@ -144,40 +181,4 @@ STORAGE_CLASS_PIXELGEN_C void pixelgen_ctrl_dump_state( } /* end of NCI */ -/***************************************************** - * - * Device level interface (DLI). - * - *****************************************************/ -/** - * @brief Load the register value. - * Refer to "pixelgen_public.h" for details. - */ -STORAGE_CLASS_PIXELGEN_C hrt_data pixelgen_ctrl_reg_load( - const pixelgen_ID_t ID, - const hrt_address reg) -{ - assert(ID < N_PIXELGEN_ID); - assert(PIXELGEN_CTRL_BASE[ID] != (hrt_address) - 1); - return ia_css_device_load_uint32(PIXELGEN_CTRL_BASE[ID] + reg * sizeof( - hrt_data)); -} - -/** - * @brief Store a value to the register. - * Refer to "pixelgen_ctrl_public.h" for details. - */ -STORAGE_CLASS_PIXELGEN_C void pixelgen_ctrl_reg_store( - const pixelgen_ID_t ID, - const hrt_address reg, - const hrt_data value) -{ - assert(ID < N_PIXELGEN_ID); - assert(PIXELGEN_CTRL_BASE[ID] != (hrt_address)-1); - - ia_css_device_store_uint32(PIXELGEN_CTRL_BASE[ID] + reg * sizeof(hrt_data), - value); -} - -/* end of DLI */ #endif /* __PIXELGEN_PRIVATE_H_INCLUDED__ */ From patchwork Wed Sep 2 16:10:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751155 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AC38C14E3 for ; Wed, 2 Sep 2020 16:11:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B1BB2072A for ; Wed, 2 Sep 2020 16:11:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063076; bh=9dhD+Wjohk46Ke51HQQMWLMkqd0e9PqJih4Q6OfTONc=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=fO98QDuoALyM9xGxnKtVBmbwnhQE9a+RDdfJVjmLW/8XNlkWfWkp/yhTWzmRV9ZDr Z5Cy8tXqmHi5YQJABt1OfgR4dlAFjaPKnR4AFblUl+NfboXKsUiVtvzCYQcFV0Zvtc 6XIz6jEH3umLsj0gu+BjACsu8rkbgYh55LHSkgVQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726678AbgIBQLM (ORCPT ); Wed, 2 Sep 2020 12:11:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:54044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728332AbgIBQK4 (ORCPT ); Wed, 2 Sep 2020 12:10:56 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9164E221E8; Wed, 2 Sep 2020 16:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=9dhD+Wjohk46Ke51HQQMWLMkqd0e9PqJih4Q6OfTONc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k0VEbQoNKyc2Yz9vgdO8iQB/m3f1cvgbKN/GG6tSlHCa+1ucLPHyBu7SXJhxPS+ke G2yA/i8zGXE1gKJBhz5n59/tgjpWS8VOyNLEttP07h2JOEXy+cjR1SHV185qjv78+1 Niujss0KYm2fmxGeZEDRjEQqhXwa1gYSrLlaYAwg= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tBH-P7; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 34/38] media: atomisp: remove compile-time tests from input_system_global.h Date: Wed, 2 Sep 2020 18:10:37 +0200 Message-Id: <8154b39cf94a2aca6dfea194a63cc5acc3e0c2d1.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Now that there's no duplication between ISP2400 and ISP2401 input system functions, we can include both at the system global. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/input_system_global.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/input_system_global.h b/drivers/staging/media/atomisp/pci/input_system_global.h index 5929d529950b..1450964445f6 100644 --- a/drivers/staging/media/atomisp/pci/input_system_global.h +++ b/drivers/staging/media/atomisp/pci/input_system_global.h @@ -24,10 +24,7 @@ typedef enum { INPUT_SYSTEM_ERR_PARAMETER_NOT_SUPPORTED, } input_system_err_t; -#ifdef ISP2401 -# include "isp2401_input_system_global.h" -#else -# include "isp2400_input_system_global.h" -#endif +#include "isp2401_input_system_global.h" +#include "isp2400_input_system_global.h" #endif /* __INPUT_SYSTEM_GLOBAL_H_INCLUDED__ */ From patchwork Wed Sep 2 16:10:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751161 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D31D7109A for ; Wed, 2 Sep 2020 16:12:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A8662072A for ; Wed, 2 Sep 2020 16:12:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063158; bh=GAlwvOTWagFOHTqnAPoOMGOMg/mmP3hK//YYhZMJvZw=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=s8o2V2E9w2qx4MNML1Uz4OENcqAZELlnthS+Yv/QEGFrwUm7gBorAvkAmFLfflu/+ ifuRQrzPfxCBe4b0Yug7dovHeublr25jt54gBvI/Z/dgblTMSCbHBERZH6NmFli02v SmkPFXG0LdFcKn3jpQuTiGVkOSYdUAG/NBgl1l7E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727035AbgIBQMe (ORCPT ); Wed, 2 Sep 2020 12:12:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:54078 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728360AbgIBQLD (ORCPT ); Wed, 2 Sep 2020 12:11:03 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B6881221ED; Wed, 2 Sep 2020 16:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063047; bh=GAlwvOTWagFOHTqnAPoOMGOMg/mmP3hK//YYhZMJvZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1m9XVSPHBFmbcM4uqnEyjOVSrsYNS0XaIkpqZzFcRUaJ4sETi7oQ3ZzJR98Go51nW 3lJP1cPWenHTWeslBaBUDc0tgUReoFwQZ1rauzO+TAp0tlP3X/iLtDS2pxo0Y/ekxi 9uYfWF8IBHjTrfTvwz876ZzGN6adE9Yt2kPLLP4U= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tBJ-Pz; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , Nicolas Boichat , Nathan Chancellor , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 35/38] media: atomisp: fix some bad indents Date: Wed, 2 Sep 2020 18:10:38 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As smatch reports, there are several bad indents: drivers/staging/media/atomisp/pci/hmm/hmm.c:271 hmm_alloc() warn: inconsistent indenting drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c:390 ia_css_bufq_enqueue_psys_event() warn: inconsistent indenting drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2132 ia_css_debug_dump_isys_state() warn: inconsistent indenting drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c:246 sh_css_binary_get_sc_requirements() warn: inconsistent indenting drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c:565 ia_css_binary_get_shading_info_type_1() warn: inconsistent indenting drivers/staging/media/atomisp/pci/sh_css.c:5109 sh_css_pipes_stop() warn: inconsistent indenting drivers/staging/media/atomisp/pci/sh_css.c:8791 ia_css_pipe_create() warn: inconsistent indenting Some of them are due to ifdefs. Get rid of them by either getting a common code that would work for both ISP2400 and ISP2401 or by creating separate functions, one for each ISP version. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/hmm/hmm.c | 6 +- .../atomisp/pci/runtime/binary/src/binary.c | 917 +++++++++--------- .../media/atomisp/pci/runtime/bufq/src/bufq.c | 3 +- .../pci/runtime/debug/src/ia_css_debug.c | 4 +- drivers/staging/media/atomisp/pci/sh_css.c | 77 +- 5 files changed, 489 insertions(+), 518 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c b/drivers/staging/media/atomisp/pci/hmm/hmm.c index 2bd39b4939f1..e0eaff0f8a22 100644 --- a/drivers/staging/media/atomisp/pci/hmm/hmm.c +++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c @@ -268,9 +268,9 @@ ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type, if (attrs & ATOMISP_MAP_FLAG_CLEARED) hmm_set(bo->start, 0, bytes); - dev_dbg(atomisp_dev, - "%s: pages: 0x%08x (%ld bytes), type: %d from highmem %d, user ptr %p, cached %d\n", - __func__, bo->start, bytes, type, from_highmem, userptr, cached); + dev_dbg(atomisp_dev, + "%s: pages: 0x%08x (%ld bytes), type: %d from highmem %d, user ptr %p, cached %d\n", + __func__, bo->start, bytes, type, from_highmem, userptr, cached); return bo->start; diff --git a/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c b/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c index a77c2072db13..060d38749570 100644 --- a/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c +++ b/drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c @@ -135,52 +135,30 @@ struct sh_css_binary_sc_requirements { at shading correction. */ }; -/* Get the requirements for the shading correction. */ +/* ISP2400: Get the requirements for the shading correction. */ static int -#ifndef ISP2401 ia_css_binary_compute_shading_table_bayer_origin( const struct ia_css_binary *binary, /* [in] */ unsigned int required_bds_factor, /* [in] */ const struct ia_css_stream_config *stream_config, /* [in] */ struct sh_css_shading_table_bayer_origin_compute_results *res) /* [out] */ -#else -sh_css_binary_get_sc_requirements( - const struct ia_css_binary *binary, /* [in] */ - unsigned int required_bds_factor, /* [in] */ - const struct ia_css_stream_config *stream_config, /* [in] */ - struct sh_css_binary_sc_requirements *scr) /* [out] */ -#endif { int err; -#ifndef ISP2401 /* Numerator and denominator of the fixed bayer downscaling factor. (numerator >= denominator) */ -#else - /* Numerator and denominator of the fixed bayer downscaling factor. (numerator >= denominator) */ -#endif unsigned int bds_num, bds_den; -#ifndef ISP2401 /* Horizontal/Vertical ratio of bayer scaling between input area and output area. */ unsigned int bs_hor_ratio_in; unsigned int bs_hor_ratio_out; unsigned int bs_ver_ratio_in; unsigned int bs_ver_ratio_out; -#else - /* Horizontal/Vertical ratio of bayer scaling between input area and output area. */ - unsigned int bs_hor_ratio_in, bs_hor_ratio_out, bs_ver_ratio_in, bs_ver_ratio_out; -#endif /* Left padding set by InputFormatter. */ -#ifndef ISP2401 unsigned int left_padding_bqs; /* in bqs */ -#else - unsigned int left_padding_bqs; -#endif -#ifndef ISP2401 /* Flag for the NEED_BDS_FACTOR_2_00 macro defined in isp kernels. */ unsigned int need_bds_factor_2_00; @@ -201,7 +179,106 @@ sh_css_binary_get_sc_requirements( err = sh_css_bds_factor_get_numerator_denominator (required_bds_factor, &bds_num, &bds_den); if (err) -#else + return err; + + /* Set the horizontal/vertical ratio of bayer scaling + between input area and output area. */ + bs_hor_ratio_in = bds_num; + bs_hor_ratio_out = bds_den; + bs_ver_ratio_in = bds_num; + bs_ver_ratio_out = bds_den; + + /* Set the left padding set by InputFormatter. (ifmtr.c) */ + if (stream_config->left_padding == -1) + left_padding_bqs = _ISP_BQS(binary->left_padding); + else + left_padding_bqs = (unsigned int)((int)ISP_VEC_NELEMS + - _ISP_BQS(stream_config->left_padding)); + + /* Set the left padding adjusted inside the isp. + When bds_factor 2.00 is needed, some padding is added to left_padding + inside the isp, before bayer downscaling. (raw.isp.c) + (Hopefully, left_crop/left_padding/top_crop should be defined in css + appropriately, depending on bds_factor.) + */ + need_bds_factor_2_00 = ((binary->info->sp.bds.supported_bds_factors & + (PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_50) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_3_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_50) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_5_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_6_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_8_00))) != 0); + + if (need_bds_factor_2_00 && binary->info->sp.pipeline.left_cropping > 0) + left_padding_adjusted_bqs = left_padding_bqs + ISP_VEC_NELEMS; + else + left_padding_adjusted_bqs = left_padding_bqs; + + /* Currently, the bad pixel caused by filters before bayer scaling + is NOT considered, because the bad pixel is subtle. + When some large filter is used in the future, + we need to consider the bad pixel. + + Currently, when bds_factor isn't 1.00, 3x3 anti-alias filter is applied + to each color plane(Gr/R/B/Gb) before bayer downscaling. + This filter moves each color plane to right/bottom directions + by 1 pixel at the most, depending on downscaling factor. + */ + bad_bqs_on_left_before_bs = 0; + bad_bqs_on_top_before_bs = 0; + + /* Currently, the bad pixel caused by filters after bayer scaling + is NOT considered, because the bad pixel is subtle. + When some large filter is used in the future, + we need to consider the bad pixel. + + Currently, when DPC&BNR is processed between bayer scaling and + shading correction, DPC&BNR moves each color plane to + right/bottom directions by 1 pixel. + */ + bad_bqs_on_left_after_bs = 0; + bad_bqs_on_top_after_bs = 0; + + /* Calculate the origin of bayer (real sensor data area) + located on the shading table during the shading correction. */ + res->sc_bayer_origin_x_bqs_on_shading_table = + ((left_padding_adjusted_bqs + bad_bqs_on_left_before_bs) + * bs_hor_ratio_out + bs_hor_ratio_in / 2) / bs_hor_ratio_in + + bad_bqs_on_left_after_bs; + /* "+ bs_hor_ratio_in/2": rounding for division by bs_hor_ratio_in */ + res->sc_bayer_origin_y_bqs_on_shading_table = + (bad_bqs_on_top_before_bs * bs_ver_ratio_out + bs_ver_ratio_in / 2) / bs_ver_ratio_in + + bad_bqs_on_top_after_bs; + /* "+ bs_ver_ratio_in/2": rounding for division by bs_ver_ratio_in */ + + res->bayer_scale_hor_ratio_in = (uint32_t)bs_hor_ratio_in; + res->bayer_scale_hor_ratio_out = (uint32_t)bs_hor_ratio_out; + res->bayer_scale_ver_ratio_in = (uint32_t)bs_ver_ratio_in; + res->bayer_scale_ver_ratio_out = (uint32_t)bs_ver_ratio_out; + + return err; +} + +/* ISP2401: Get the requirements for the shading correction. */ +static int +sh_css_binary_get_sc_requirements(const struct ia_css_binary *binary, /* [in] */ + unsigned int required_bds_factor, /* [in] */ + const struct ia_css_stream_config *stream_config, /* [in] */ + struct sh_css_binary_sc_requirements *scr) /* [out] */ +{ + int err; + + /* Numerator and denominator of the fixed bayer downscaling factor. (numerator >= denominator) */ + unsigned int bds_num, bds_den; + + /* Horizontal/Vertical ratio of bayer scaling between input area and output area. */ + unsigned int bs_hor_ratio_in, bs_hor_ratio_out, bs_ver_ratio_in, bs_ver_ratio_out; + + /* Left padding set by InputFormatter. */ + unsigned int left_padding_bqs; + /* Flags corresponding to NEED_BDS_FACTOR_2_00/NEED_BDS_FACTOR_1_50/NEED_BDS_FACTOR_1_25 macros * defined in isp kernels. */ unsigned int need_bds_factor_2_00, need_bds_factor_1_50, need_bds_factor_1_25; @@ -225,318 +302,201 @@ sh_css_binary_get_sc_requirements( unsigned int sensor_data_origin_x_bqs_on_internal; unsigned int sensor_data_origin_y_bqs_on_internal; - IA_CSS_ENTER_PRIVATE("binary=%p, required_bds_factor=%d, stream_config=%p", - binary, required_bds_factor, stream_config); - - /* Get the numerator and denominator of the required bayer downscaling factor. */ - err = sh_css_bds_factor_get_numerator_denominator(required_bds_factor, &bds_num, &bds_den); - if (err) - { - IA_CSS_LEAVE_ERR_PRIVATE(err); -#endif - return err; -#ifdef ISP2401 -} -#endif - -#ifndef ISP2401 -/* Set the horizontal/vertical ratio of bayer scaling -between input area and output area. */ -#else -IA_CSS_LOG("bds_num=%d, bds_den=%d", bds_num, bds_den); - -/* Set the horizontal/vertical ratio of bayer scaling between input area and output area. */ -#endif -bs_hor_ratio_in = bds_num; -bs_hor_ratio_out = bds_den; -bs_ver_ratio_in = bds_num; -bs_ver_ratio_out = bds_den; - -#ifndef ISP2401 -/* Set the left padding set by InputFormatter. (ifmtr.c) */ -#else -/* Set the left padding set by InputFormatter. (ia_css_ifmtr_configure() in ifmtr.c) */ -#endif -if (stream_config->left_padding == -1) - left_padding_bqs = _ISP_BQS(binary->left_padding); -else -#ifndef ISP2401 - left_padding_bqs = (unsigned int)((int)ISP_VEC_NELEMS - - _ISP_BQS(stream_config->left_padding)); -#else - left_padding_bqs = (unsigned int)((int)ISP_VEC_NELEMS - _ISP_BQS(stream_config->left_padding)); -#endif - -#ifndef ISP2401 -/* Set the left padding adjusted inside the isp. -When bds_factor 2.00 is needed, some padding is added to left_padding -inside the isp, before bayer downscaling. (raw.isp.c) -(Hopefully, left_crop/left_padding/top_crop should be defined in css -appropriately, depending on bds_factor.) -*/ -#else -IA_CSS_LOG("stream.left_padding=%d, binary.left_padding=%d, left_padding_bqs=%d", - stream_config->left_padding, binary->left_padding, left_padding_bqs); - -/* Set the left padding adjusted inside the isp kernels. - * When the bds_factor isn't 1.00, the left padding size is adjusted inside the isp, - * before bayer downscaling. (scaled_hor_plane_index(), raw_compute_hphase() in raw.isp.c) - */ -#endif -need_bds_factor_2_00 = ((binary->info->sp.bds.supported_bds_factors & - (PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_00) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_50) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_3_00) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_00) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_50) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_5_00) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_6_00) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_8_00))) != 0); - -#ifndef ISP2401 -if (need_bds_factor_2_00 && binary->info->sp.pipeline.left_cropping > 0) - left_padding_adjusted_bqs = left_padding_bqs + ISP_VEC_NELEMS; -else -#else -need_bds_factor_1_50 = ((binary->info->sp.bds.supported_bds_factors & - (PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_1_50) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_25) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_3_00) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_50) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_6_00))) != 0); - -need_bds_factor_1_25 = ((binary->info->sp.bds.supported_bds_factors & - (PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_1_25) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_50) | - PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_5_00))) != 0); - -if (binary->info->sp.pipeline.left_cropping > 0 && - (need_bds_factor_2_00 || need_bds_factor_1_50 || need_bds_factor_1_25)) -{ - /* - * downscale 2.0 -> first_vec_adjusted_bqs = 128 - * downscale 1.5 -> first_vec_adjusted_bqs = 96 - * downscale 1.25 -> first_vec_adjusted_bqs = 80 - */ - unsigned int first_vec_adjusted_bqs - = ISP_VEC_NELEMS * bs_hor_ratio_in / bs_hor_ratio_out; - left_padding_adjusted_bqs = first_vec_adjusted_bqs - - _ISP_BQS(binary->info->sp.pipeline.left_cropping); -} else -#endif - left_padding_adjusted_bqs = left_padding_bqs; - -#ifndef ISP2401 -/* Currently, the bad pixel caused by filters before bayer scaling -is NOT considered, because the bad pixel is subtle. -When some large filter is used in the future, -we need to consider the bad pixel. - -Currently, when bds_factor isn't 1.00, 3x3 anti-alias filter is applied -to each color plane(Gr/R/B/Gb) before bayer downscaling. -This filter moves each color plane to right/bottom directions -by 1 pixel at the most, depending on downscaling factor. -*/ -bad_bqs_on_left_before_bs = 0; -bad_bqs_on_top_before_bs = 0; -#else -IA_CSS_LOG("supported_bds_factors=%d, need_bds_factor:2_00=%d, 1_50=%d, 1_25=%d", - binary->info->sp.bds.supported_bds_factors, - need_bds_factor_2_00, need_bds_factor_1_50, need_bds_factor_1_25); -IA_CSS_LOG("left_cropping=%d, left_padding_adjusted_bqs=%d", - binary->info->sp.pipeline.left_cropping, left_padding_adjusted_bqs); - -/* Set the top padding padded inside the isp kernel for bayer downscaling binaries. - * When the bds_factor isn't 1.00, the top padding is padded inside the isp - * before bayer downscaling, because the top cropping size (input margin) is not enough. - * (calculate_input_line(), raw_compute_vphase(), dma_read_raw() in raw.isp.c) - * NOTE: In dma_read_raw(), the factor passed to raw_compute_vphase() is got by get_bds_factor_for_dma_read(). - * This factor is BDS_FPVAL_100/BDS_FPVAL_125/BDS_FPVAL_150/BDS_FPVAL_200. - */ -top_padding_bqs = 0; -if (binary->info->sp.pipeline.top_cropping > 0 && - (required_bds_factor == SH_CSS_BDS_FACTOR_1_25 || - required_bds_factor == SH_CSS_BDS_FACTOR_1_50 || - required_bds_factor == SH_CSS_BDS_FACTOR_2_00)) -{ - /* Calculation from calculate_input_line() and raw_compute_vphase() in raw.isp.c. */ - int top_cropping_bqs = _ISP_BQS(binary->info->sp.pipeline.top_cropping); - /* top cropping (in bqs) */ - int factor = bds_num * bds_frac_acc / - bds_den; /* downscaling factor by fixed-point */ - int top_padding_bqsxfrac_acc = (top_cropping_bqs * factor - top_cropping_bqs * - bds_frac_acc) - + (2 * bds_frac_acc - factor); /* top padding by fixed-point (in bqs) */ - - top_padding_bqs = (unsigned int)((top_padding_bqsxfrac_acc + bds_frac_acc / 2 - - 1) / bds_frac_acc); -} - -IA_CSS_LOG("top_cropping=%d, top_padding_bqs=%d", binary->info->sp.pipeline.top_cropping, top_padding_bqs); - -/* Set the right/down shift amount caused by filters applied BEFORE bayer scaling, - * which scaling is applied BEFORE shading corrertion. - * - * When the bds_factor isn't 1.00, 3x3 anti-alias filter is applied to each color plane(Gr/R/B/Gb) - * before bayer downscaling. - * This filter shifts each color plane (Gr/R/B/Gb) to right/down directions by 1 pixel. - */ -right_shift_bqs_before_bs = 0; -down_shift_bqs_before_bs = 0; -#endif - -#ifndef ISP2401 -/* Currently, the bad pixel caused by filters after bayer scaling -is NOT considered, because the bad pixel is subtle. -When some large filter is used in the future, -we need to consider the bad pixel. - -Currently, when DPC&BNR is processed between bayer scaling and -shading correction, DPC&BNR moves each color plane to -right/bottom directions by 1 pixel. -*/ -bad_bqs_on_left_after_bs = 0; -bad_bqs_on_top_after_bs = 0; -#else -if (need_bds_factor_2_00 || need_bds_factor_1_50 || need_bds_factor_1_25) -{ - right_shift_bqs_before_bs = 1; - down_shift_bqs_before_bs = 1; -} - -IA_CSS_LOG("right_shift_bqs_before_bs=%d, down_shift_bqs_before_bs=%d", - right_shift_bqs_before_bs, down_shift_bqs_before_bs); - -/* Set the right/down shift amount caused by filters applied AFTER bayer scaling, - * which scaling is applied BEFORE shading corrertion. - * - * When DPC&BNR is processed between bayer scaling and shading correction, - * DPC&BNR moves each color plane (Gr/R/B/Gb) to right/down directions by 1 pixel. - */ -right_shift_bqs_after_bs = 0; -down_shift_bqs_after_bs = 0; -#endif - -#ifndef ISP2401 -/* Calculate the origin of bayer (real sensor data area) -located on the shading table during the shading correction. */ -res->sc_bayer_origin_x_bqs_on_shading_table -= ((left_padding_adjusted_bqs + bad_bqs_on_left_before_bs) - * bs_hor_ratio_out + bs_hor_ratio_in / 2) / bs_hor_ratio_in -+ bad_bqs_on_left_after_bs; -/* "+ bs_hor_ratio_in/2": rounding for division by bs_hor_ratio_in */ -res->sc_bayer_origin_y_bqs_on_shading_table -= (bad_bqs_on_top_before_bs - * bs_ver_ratio_out + bs_ver_ratio_in / 2) / bs_ver_ratio_in -+ bad_bqs_on_top_after_bs; -/* "+ bs_ver_ratio_in/2": rounding for division by bs_ver_ratio_in */ - -res->bayer_scale_hor_ratio_in = (uint32_t)bs_hor_ratio_in; -res->bayer_scale_hor_ratio_out = (uint32_t)bs_hor_ratio_out; -res->bayer_scale_ver_ratio_in = (uint32_t)bs_ver_ratio_in; -res->bayer_scale_ver_ratio_out = (uint32_t)bs_ver_ratio_out; -#else -if (binary->info->mem_offsets.offsets.param->dmem.dp.size != 0) /* if DPC&BNR is enabled in the binary */ -{ - right_shift_bqs_after_bs = 1; - down_shift_bqs_after_bs = 1; -} - -IA_CSS_LOG("right_shift_bqs_after_bs=%d, down_shift_bqs_after_bs=%d", - right_shift_bqs_after_bs, down_shift_bqs_after_bs); - -/* Set the origin of the sensor data area on the internal frame at shading correction. */ -{ unsigned int bs_frac = bds_frac_acc; /* scaling factor 1.0 in fixed point */ unsigned int bs_out, bs_in; /* scaling ratio in fixed point */ + IA_CSS_ENTER_PRIVATE("binary=%p, required_bds_factor=%d, stream_config=%p", + binary, required_bds_factor, stream_config); + + /* Get the numerator and denominator of the required bayer downscaling factor. */ + err = sh_css_bds_factor_get_numerator_denominator(required_bds_factor, + &bds_num, &bds_den); + if (err) { + IA_CSS_LEAVE_ERR_PRIVATE(err); + return err; + } + + IA_CSS_LOG("bds_num=%d, bds_den=%d", bds_num, bds_den); + + /* Set the horizontal/vertical ratio of bayer scaling between input area and output area. */ + bs_hor_ratio_in = bds_num; + bs_hor_ratio_out = bds_den; + bs_ver_ratio_in = bds_num; + bs_ver_ratio_out = bds_den; + + /* Set the left padding set by InputFormatter. (ia_css_ifmtr_configure() in ifmtr.c) */ + if (stream_config->left_padding == -1) + left_padding_bqs = _ISP_BQS(binary->left_padding); + else + left_padding_bqs = (unsigned int)((int)ISP_VEC_NELEMS - _ISP_BQS(stream_config->left_padding)); + + IA_CSS_LOG("stream.left_padding=%d, binary.left_padding=%d, left_padding_bqs=%d", + stream_config->left_padding, binary->left_padding, + left_padding_bqs); + + /* Set the left padding adjusted inside the isp kernels. + * When the bds_factor isn't 1.00, the left padding size is adjusted inside the isp, + * before bayer downscaling. (scaled_hor_plane_index(), raw_compute_hphase() in raw.isp.c) + */ + need_bds_factor_2_00 = ((binary->info->sp.bds.supported_bds_factors & + (PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_50) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_3_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_50) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_5_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_6_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_8_00))) != 0); + + need_bds_factor_1_50 = ((binary->info->sp.bds.supported_bds_factors & + (PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_1_50) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_25) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_3_00) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_4_50) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_6_00))) != 0); + + need_bds_factor_1_25 = ((binary->info->sp.bds.supported_bds_factors & + (PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_1_25) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_2_50) | + PACK_BDS_FACTOR(SH_CSS_BDS_FACTOR_5_00))) != 0); + + if (binary->info->sp.pipeline.left_cropping > 0 && + (need_bds_factor_2_00 || need_bds_factor_1_50 || need_bds_factor_1_25)) { + /* + * downscale 2.0 -> first_vec_adjusted_bqs = 128 + * downscale 1.5 -> first_vec_adjusted_bqs = 96 + * downscale 1.25 -> first_vec_adjusted_bqs = 80 + */ + unsigned int first_vec_adjusted_bqs = ISP_VEC_NELEMS * bs_hor_ratio_in / bs_hor_ratio_out; + left_padding_adjusted_bqs = first_vec_adjusted_bqs + - _ISP_BQS(binary->info->sp.pipeline.left_cropping); + } else { + left_padding_adjusted_bqs = left_padding_bqs; + } + + IA_CSS_LOG("supported_bds_factors=%d, need_bds_factor:2_00=%d, 1_50=%d, 1_25=%d", + binary->info->sp.bds.supported_bds_factors, + need_bds_factor_2_00, need_bds_factor_1_50, + need_bds_factor_1_25); + IA_CSS_LOG("left_cropping=%d, left_padding_adjusted_bqs=%d", + binary->info->sp.pipeline.left_cropping, + left_padding_adjusted_bqs); + + /* Set the top padding padded inside the isp kernel for bayer downscaling binaries. + * When the bds_factor isn't 1.00, the top padding is padded inside the isp + * before bayer downscaling, because the top cropping size (input margin) is not enough. + * (calculate_input_line(), raw_compute_vphase(), dma_read_raw() in raw.isp.c) + * NOTE: In dma_read_raw(), the factor passed to raw_compute_vphase() is got by get_bds_factor_for_dma_read(). + * This factor is BDS_FPVAL_100/BDS_FPVAL_125/BDS_FPVAL_150/BDS_FPVAL_200. + */ + top_padding_bqs = 0; + if (binary->info->sp.pipeline.top_cropping > 0 && + (required_bds_factor == SH_CSS_BDS_FACTOR_1_25 || + required_bds_factor == SH_CSS_BDS_FACTOR_1_50 || + required_bds_factor == SH_CSS_BDS_FACTOR_2_00)) { + /* Calculation from calculate_input_line() and raw_compute_vphase() in raw.isp.c. */ + int top_cropping_bqs = _ISP_BQS(binary->info->sp.pipeline.top_cropping); + /* top cropping (in bqs) */ + int factor = bds_num * bds_frac_acc / + bds_den; /* downscaling factor by fixed-point */ + int top_padding_bqsxfrac_acc = (top_cropping_bqs * factor - top_cropping_bqs * + bds_frac_acc) + + (2 * bds_frac_acc - factor); /* top padding by fixed-point (in bqs) */ + + top_padding_bqs = (unsigned int)((top_padding_bqsxfrac_acc + bds_frac_acc / 2 - + 1) / bds_frac_acc); + } + + IA_CSS_LOG("top_cropping=%d, top_padding_bqs=%d", + binary->info->sp.pipeline.top_cropping, top_padding_bqs); + + /* Set the right/down shift amount caused by filters applied BEFORE bayer scaling, + * which scaling is applied BEFORE shading corrertion. + * + * When the bds_factor isn't 1.00, 3x3 anti-alias filter is applied to each color plane(Gr/R/B/Gb) + * before bayer downscaling. + * This filter shifts each color plane (Gr/R/B/Gb) to right/down directions by 1 pixel. + */ + right_shift_bqs_before_bs = 0; + down_shift_bqs_before_bs = 0; + + if (need_bds_factor_2_00 || need_bds_factor_1_50 || need_bds_factor_1_25) { + right_shift_bqs_before_bs = 1; + down_shift_bqs_before_bs = 1; + } + + IA_CSS_LOG("right_shift_bqs_before_bs=%d, down_shift_bqs_before_bs=%d", + right_shift_bqs_before_bs, down_shift_bqs_before_bs); + + /* Set the right/down shift amount caused by filters applied AFTER bayer scaling, + * which scaling is applied BEFORE shading corrertion. + * + * When DPC&BNR is processed between bayer scaling and shading correction, + * DPC&BNR moves each color plane (Gr/R/B/Gb) to right/down directions by 1 pixel. + */ + right_shift_bqs_after_bs = 0; + down_shift_bqs_after_bs = 0; + + /* if DPC&BNR is enabled in the binary */ + if (binary->info->mem_offsets.offsets.param->dmem.dp.size != 0) { + right_shift_bqs_after_bs = 1; + down_shift_bqs_after_bs = 1; + } + + IA_CSS_LOG("right_shift_bqs_after_bs=%d, down_shift_bqs_after_bs=%d", + right_shift_bqs_after_bs, down_shift_bqs_after_bs); + bs_out = bs_hor_ratio_out * bs_frac; bs_in = bs_hor_ratio_in * bs_frac; - sensor_data_origin_x_bqs_on_internal - = ((left_padding_adjusted_bqs + right_shift_bqs_before_bs) * bs_out + bs_in / 2) / bs_in - + right_shift_bqs_after_bs; /* "+ bs_in/2": rounding */ + sensor_data_origin_x_bqs_on_internal = + ((left_padding_adjusted_bqs + right_shift_bqs_before_bs) * bs_out + bs_in / 2) / bs_in + + right_shift_bqs_after_bs; /* "+ bs_in/2": rounding */ bs_out = bs_ver_ratio_out * bs_frac; bs_in = bs_ver_ratio_in * bs_frac; - sensor_data_origin_y_bqs_on_internal - = ((top_padding_bqs + down_shift_bqs_before_bs) * bs_out + bs_in / 2) / bs_in - + down_shift_bqs_after_bs; /* "+ bs_in/2": rounding */ -} + sensor_data_origin_y_bqs_on_internal = + ((top_padding_bqs + down_shift_bqs_before_bs) * bs_out + bs_in / 2) / bs_in + + down_shift_bqs_after_bs; /* "+ bs_in/2": rounding */ -scr->bayer_scale_hor_ratio_in = (uint32_t)bs_hor_ratio_in; -scr->bayer_scale_hor_ratio_out = (uint32_t)bs_hor_ratio_out; -scr->bayer_scale_ver_ratio_in = (uint32_t)bs_ver_ratio_in; -scr->bayer_scale_ver_ratio_out = (uint32_t)bs_ver_ratio_out; -scr->sensor_data_origin_x_bqs_on_internal = (uint32_t)sensor_data_origin_x_bqs_on_internal; -scr->sensor_data_origin_y_bqs_on_internal = (uint32_t)sensor_data_origin_y_bqs_on_internal; + scr->bayer_scale_hor_ratio_in = (uint32_t)bs_hor_ratio_in; + scr->bayer_scale_hor_ratio_out = (uint32_t)bs_hor_ratio_out; + scr->bayer_scale_ver_ratio_in = (uint32_t)bs_ver_ratio_in; + scr->bayer_scale_ver_ratio_out = (uint32_t)bs_ver_ratio_out; + scr->sensor_data_origin_x_bqs_on_internal = (uint32_t)sensor_data_origin_x_bqs_on_internal; + scr->sensor_data_origin_y_bqs_on_internal = (uint32_t)sensor_data_origin_y_bqs_on_internal; -IA_CSS_LOG("sc_requirements: %d, %d, %d, %d, %d, %d", - scr->bayer_scale_hor_ratio_in, scr->bayer_scale_hor_ratio_out, - scr->bayer_scale_ver_ratio_in, scr->bayer_scale_ver_ratio_out, - scr->sensor_data_origin_x_bqs_on_internal, scr->sensor_data_origin_y_bqs_on_internal); -#endif + IA_CSS_LOG("sc_requirements: %d, %d, %d, %d, %d, %d", + scr->bayer_scale_hor_ratio_in, + scr->bayer_scale_hor_ratio_out, + scr->bayer_scale_ver_ratio_in, scr->bayer_scale_ver_ratio_out, + scr->sensor_data_origin_x_bqs_on_internal, + scr->sensor_data_origin_y_bqs_on_internal); -#ifdef ISP2401 -IA_CSS_LEAVE_ERR_PRIVATE(err); -#endif -return err; + IA_CSS_LEAVE_ERR_PRIVATE(err); + return err; } /* Get the shading information of Shading Correction Type 1. */ static int -ia_css_binary_get_shading_info_type_1(const struct ia_css_binary - *binary, /* [in] */ - unsigned int required_bds_factor, /* [in] */ - const struct ia_css_stream_config *stream_config, /* [in] */ -#ifndef ISP2401 - struct ia_css_shading_info *info) /* [out] */ -#else - struct ia_css_shading_info *shading_info, /* [out] */ - struct ia_css_pipe_config *pipe_config) /* [out] */ -#endif +isp2400_binary_get_shading_info_type_1(const struct ia_css_binary *binary, /* [in] */ + unsigned int required_bds_factor, /* [in] */ + const struct ia_css_stream_config *stream_config, /* [in] */ + struct ia_css_shading_info *info) /* [out] */ { int err; -#ifndef ISP2401 struct sh_css_shading_table_bayer_origin_compute_results res; -#else - struct sh_css_binary_sc_requirements scr; -#endif -#ifndef ISP2401 assert(binary); assert(info); -#else - u32 in_width_bqs, in_height_bqs, internal_width_bqs, internal_height_bqs; - u32 num_hor_grids, num_ver_grids, bqs_per_grid_cell, tbl_width_bqs, tbl_height_bqs; - u32 sensor_org_x_bqs_on_internal, sensor_org_y_bqs_on_internal, sensor_width_bqs, sensor_height_bqs; - u32 sensor_center_x_bqs_on_internal, sensor_center_y_bqs_on_internal; - u32 left, right, upper, lower; - u32 adjust_left, adjust_right, adjust_upper, adjust_lower, adjust_width_bqs, adjust_height_bqs; - u32 internal_org_x_bqs_on_tbl, internal_org_y_bqs_on_tbl; - u32 sensor_org_x_bqs_on_tbl, sensor_org_y_bqs_on_tbl; -#endif -#ifndef ISP2401 info->type = IA_CSS_SHADING_CORRECTION_TYPE_1; -#else - assert(binary); - assert(stream_config); - assert(shading_info); - assert(pipe_config); -#endif -#ifndef ISP2401 info->info.type_1.enable = binary->info->sp.enable.sc; info->info.type_1.num_hor_grids = binary->sctbl_width_per_color; info->info.type_1.num_ver_grids = binary->sctbl_height; info->info.type_1.bqs_per_grid_cell = (1 << binary->deci_factor_log2); -#else - IA_CSS_ENTER_PRIVATE("binary=%p, required_bds_factor=%d, stream_config=%p", - binary, required_bds_factor, stream_config); -#endif /* Initialize by default values. */ -#ifndef ISP2401 info->info.type_1.bayer_scale_hor_ratio_in = 1; info->info.type_1.bayer_scale_hor_ratio_out = 1; info->info.type_1.bayer_scale_ver_ratio_in = 1; @@ -550,157 +510,185 @@ ia_css_binary_get_shading_info_type_1(const struct ia_css_binary stream_config, &res); if (err) -#else + return err; + + info->info.type_1.bayer_scale_hor_ratio_in = res.bayer_scale_hor_ratio_in; + info->info.type_1.bayer_scale_hor_ratio_out = res.bayer_scale_hor_ratio_out; + info->info.type_1.bayer_scale_ver_ratio_in = res.bayer_scale_ver_ratio_in; + info->info.type_1.bayer_scale_ver_ratio_out = res.bayer_scale_ver_ratio_out; + info->info.type_1.sc_bayer_origin_x_bqs_on_shading_table = res.sc_bayer_origin_x_bqs_on_shading_table; + info->info.type_1.sc_bayer_origin_y_bqs_on_shading_table = res.sc_bayer_origin_y_bqs_on_shading_table; + + return err; +} + +/* Get the shading information of Shading Correction Type 1. */ +static int +isp2401_binary_get_shading_info_type_1(const struct ia_css_binary *binary, /* [in] */ + unsigned int required_bds_factor, /* [in] */ + const struct ia_css_stream_config *stream_config, /* [in] */ + struct ia_css_shading_info *shading_info, /* [out] */ + struct ia_css_pipe_config *pipe_config) /* [out] */ +{ + int err; + struct sh_css_binary_sc_requirements scr; + + u32 in_width_bqs, in_height_bqs, internal_width_bqs, internal_height_bqs; + u32 num_hor_grids, num_ver_grids, bqs_per_grid_cell, tbl_width_bqs, tbl_height_bqs; + u32 sensor_org_x_bqs_on_internal, sensor_org_y_bqs_on_internal, sensor_width_bqs, sensor_height_bqs; + u32 sensor_center_x_bqs_on_internal, sensor_center_y_bqs_on_internal; + u32 left, right, upper, lower; + u32 adjust_left, adjust_right, adjust_upper, adjust_lower, adjust_width_bqs, adjust_height_bqs; + u32 internal_org_x_bqs_on_tbl, internal_org_y_bqs_on_tbl; + u32 sensor_org_x_bqs_on_tbl, sensor_org_y_bqs_on_tbl; + + assert(binary); + assert(stream_config); + assert(shading_info); + assert(pipe_config); + + IA_CSS_ENTER_PRIVATE("binary=%p, required_bds_factor=%d, stream_config=%p", + binary, required_bds_factor, stream_config); + + /* Initialize by default values. */ *shading_info = DEFAULT_SHADING_INFO_TYPE_1; err = sh_css_binary_get_sc_requirements(binary, required_bds_factor, stream_config, &scr); - if (err) - { + if (err) { IA_CSS_LEAVE_ERR_PRIVATE(err); -#endif return err; -#ifdef ISP2401 + } + + IA_CSS_LOG("binary: id=%d, sctbl=%dx%d, deci=%d", + binary->info->sp.id, binary->sctbl_width_per_color, binary->sctbl_height, binary->deci_factor_log2); + IA_CSS_LOG("binary: in=%dx%d, in_padded_w=%d, int=%dx%d, int_padded_w=%d, out=%dx%d, out_padded_w=%d", + binary->in_frame_info.res.width, binary->in_frame_info.res.height, binary->in_frame_info.padded_width, + binary->internal_frame_info.res.width, binary->internal_frame_info.res.height, + binary->internal_frame_info.padded_width, + binary->out_frame_info[0].res.width, binary->out_frame_info[0].res.height, + binary->out_frame_info[0].padded_width); + + /* Set the input size from sensor, which includes left/top crop size. */ + in_width_bqs = _ISP_BQS(binary->in_frame_info.res.width); + in_height_bqs = _ISP_BQS(binary->in_frame_info.res.height); + + /* + * Frame size internally used in ISP, including sensor data and padding. + * This is the frame size, to which the shading correction is applied. + */ + internal_width_bqs = _ISP_BQS(binary->internal_frame_info.res.width); + internal_height_bqs = _ISP_BQS(binary->internal_frame_info.res.height); + + /* Shading table. */ + num_hor_grids = binary->sctbl_width_per_color; + num_ver_grids = binary->sctbl_height; + bqs_per_grid_cell = (1 << binary->deci_factor_log2); + tbl_width_bqs = (num_hor_grids - 1) * bqs_per_grid_cell; + tbl_height_bqs = (num_ver_grids - 1) * bqs_per_grid_cell; + + IA_CSS_LOG("tbl_width_bqs=%d, tbl_height_bqs=%d", tbl_width_bqs, tbl_height_bqs); + + /* + * Real sensor data area on the internal frame at shading correction. + * Filters and scaling are applied to the internal frame before + * shading correction, depending on the binary. + */ + sensor_org_x_bqs_on_internal = scr.sensor_data_origin_x_bqs_on_internal; + sensor_org_y_bqs_on_internal = scr.sensor_data_origin_y_bqs_on_internal; + { + unsigned int bs_frac = 8; /* scaling factor 1.0 in fixed point (8 == FRAC_ACC macro in ISP) */ + unsigned int bs_out, bs_in; /* scaling ratio in fixed point */ + + bs_out = scr.bayer_scale_hor_ratio_out * bs_frac; + bs_in = scr.bayer_scale_hor_ratio_in * bs_frac; + sensor_width_bqs = (in_width_bqs * bs_out + bs_in / 2) / bs_in; /* "+ bs_in/2": rounding */ + + bs_out = scr.bayer_scale_ver_ratio_out * bs_frac; + bs_in = scr.bayer_scale_ver_ratio_in * bs_frac; + sensor_height_bqs = (in_height_bqs * bs_out + bs_in / 2) / bs_in; /* "+ bs_in/2": rounding */ + } + + /* Center of the sensor data on the internal frame at shading correction. */ + sensor_center_x_bqs_on_internal = sensor_org_x_bqs_on_internal + sensor_width_bqs / 2; + sensor_center_y_bqs_on_internal = sensor_org_y_bqs_on_internal + sensor_height_bqs / 2; + + /* Size of left/right/upper/lower sides of the sensor center on the internal frame. */ + left = sensor_center_x_bqs_on_internal; + right = internal_width_bqs - sensor_center_x_bqs_on_internal; + upper = sensor_center_y_bqs_on_internal; + lower = internal_height_bqs - sensor_center_y_bqs_on_internal; + + /* Align the size of left/right/upper/lower sides to a multiple of the grid cell size. */ + adjust_left = CEIL_MUL(left, bqs_per_grid_cell); + adjust_right = CEIL_MUL(right, bqs_per_grid_cell); + adjust_upper = CEIL_MUL(upper, bqs_per_grid_cell); + adjust_lower = CEIL_MUL(lower, bqs_per_grid_cell); + + /* Shading table should cover the adjusted frame size. */ + adjust_width_bqs = adjust_left + adjust_right; + adjust_height_bqs = adjust_upper + adjust_lower; + + IA_CSS_LOG("adjust_width_bqs=%d, adjust_height_bqs=%d", adjust_width_bqs, adjust_height_bqs); + + if (adjust_width_bqs > tbl_width_bqs || adjust_height_bqs > tbl_height_bqs) { + IA_CSS_LEAVE_ERR_PRIVATE(-EINVAL); + return -EINVAL; + } + + /* Origin of the internal frame on the shading table. */ + internal_org_x_bqs_on_tbl = adjust_left - left; + internal_org_y_bqs_on_tbl = adjust_upper - upper; + + /* Origin of the real sensor data area on the shading table. */ + sensor_org_x_bqs_on_tbl = internal_org_x_bqs_on_tbl + sensor_org_x_bqs_on_internal; + sensor_org_y_bqs_on_tbl = internal_org_y_bqs_on_tbl + sensor_org_y_bqs_on_internal; + + /* The shading information necessary as API is stored in the shading_info. */ + shading_info->info.type_1.num_hor_grids = num_hor_grids; + shading_info->info.type_1.num_ver_grids = num_ver_grids; + shading_info->info.type_1.bqs_per_grid_cell = bqs_per_grid_cell; + + shading_info->info.type_1.bayer_scale_hor_ratio_in = scr.bayer_scale_hor_ratio_in; + shading_info->info.type_1.bayer_scale_hor_ratio_out = scr.bayer_scale_hor_ratio_out; + shading_info->info.type_1.bayer_scale_ver_ratio_in = scr.bayer_scale_ver_ratio_in; + shading_info->info.type_1.bayer_scale_ver_ratio_out = scr.bayer_scale_ver_ratio_out; + + shading_info->info.type_1.isp_input_sensor_data_res_bqs.width = in_width_bqs; + shading_info->info.type_1.isp_input_sensor_data_res_bqs.height = in_height_bqs; + + shading_info->info.type_1.sensor_data_res_bqs.width = sensor_width_bqs; + shading_info->info.type_1.sensor_data_res_bqs.height = sensor_height_bqs; + + shading_info->info.type_1.sensor_data_origin_bqs_on_sctbl.x = (int32_t)sensor_org_x_bqs_on_tbl; + shading_info->info.type_1.sensor_data_origin_bqs_on_sctbl.y = (int32_t)sensor_org_y_bqs_on_tbl; + + /* The shading information related to ISP (but, not necessary as API) is stored in the pipe_config. */ + pipe_config->internal_frame_origin_bqs_on_sctbl.x = (int32_t)internal_org_x_bqs_on_tbl; + pipe_config->internal_frame_origin_bqs_on_sctbl.y = (int32_t)internal_org_y_bqs_on_tbl; + + IA_CSS_LOG("shading_info: grids=%dx%d, cell=%d, scale=%d,%d,%d,%d, input=%dx%d, data=%dx%d, origin=(%d,%d)", + shading_info->info.type_1.num_hor_grids, + shading_info->info.type_1.num_ver_grids, + shading_info->info.type_1.bqs_per_grid_cell, + shading_info->info.type_1.bayer_scale_hor_ratio_in, + shading_info->info.type_1.bayer_scale_hor_ratio_out, + shading_info->info.type_1.bayer_scale_ver_ratio_in, + shading_info->info.type_1.bayer_scale_ver_ratio_out, + shading_info->info.type_1.isp_input_sensor_data_res_bqs.width, + shading_info->info.type_1.isp_input_sensor_data_res_bqs.height, + shading_info->info.type_1.sensor_data_res_bqs.width, + shading_info->info.type_1.sensor_data_res_bqs.height, + shading_info->info.type_1.sensor_data_origin_bqs_on_sctbl.x, + shading_info->info.type_1.sensor_data_origin_bqs_on_sctbl.y); + + IA_CSS_LOG("pipe_config: origin=(%d,%d)", + pipe_config->internal_frame_origin_bqs_on_sctbl.x, + pipe_config->internal_frame_origin_bqs_on_sctbl.y); + + IA_CSS_LEAVE_ERR_PRIVATE(err); + return err; } -IA_CSS_LOG("binary: id=%d, sctbl=%dx%d, deci=%d", - binary->info->sp.id, binary->sctbl_width_per_color, binary->sctbl_height, binary->deci_factor_log2); -IA_CSS_LOG("binary: in=%dx%d, in_padded_w=%d, int=%dx%d, int_padded_w=%d, out=%dx%d, out_padded_w=%d", - binary->in_frame_info.res.width, binary->in_frame_info.res.height, binary->in_frame_info.padded_width, - binary->internal_frame_info.res.width, binary->internal_frame_info.res.height, - binary->internal_frame_info.padded_width, - binary->out_frame_info[0].res.width, binary->out_frame_info[0].res.height, - binary->out_frame_info[0].padded_width); - -/* Set the input size from sensor, which includes left/top crop size. */ -in_width_bqs = _ISP_BQS(binary->in_frame_info.res.width); -in_height_bqs = _ISP_BQS(binary->in_frame_info.res.height); - -/* Frame size internally used in ISP, including sensor data and padding. - * This is the frame size, to which the shading correction is applied. - */ -internal_width_bqs = _ISP_BQS(binary->internal_frame_info.res.width); -internal_height_bqs = _ISP_BQS(binary->internal_frame_info.res.height); - -/* Shading table. */ -num_hor_grids = binary->sctbl_width_per_color; -num_ver_grids = binary->sctbl_height; -bqs_per_grid_cell = (1 << binary->deci_factor_log2); -tbl_width_bqs = (num_hor_grids - 1) * bqs_per_grid_cell; -tbl_height_bqs = (num_ver_grids - 1) * bqs_per_grid_cell; -#endif - -#ifndef ISP2401 -info->info.type_1.bayer_scale_hor_ratio_in = res.bayer_scale_hor_ratio_in; -info->info.type_1.bayer_scale_hor_ratio_out = res.bayer_scale_hor_ratio_out; -info->info.type_1.bayer_scale_ver_ratio_in = res.bayer_scale_ver_ratio_in; -info->info.type_1.bayer_scale_ver_ratio_out = res.bayer_scale_ver_ratio_out; -info->info.type_1.sc_bayer_origin_x_bqs_on_shading_table = res.sc_bayer_origin_x_bqs_on_shading_table; -info->info.type_1.sc_bayer_origin_y_bqs_on_shading_table = res.sc_bayer_origin_y_bqs_on_shading_table; -#else -IA_CSS_LOG("tbl_width_bqs=%d, tbl_height_bqs=%d", tbl_width_bqs, tbl_height_bqs); -#endif - -#ifdef ISP2401 -/* Real sensor data area on the internal frame at shading correction. - * Filters and scaling are applied to the internal frame before shading correction, depending on the binary. - */ -sensor_org_x_bqs_on_internal = scr.sensor_data_origin_x_bqs_on_internal; -sensor_org_y_bqs_on_internal = scr.sensor_data_origin_y_bqs_on_internal; -{ - unsigned int bs_frac = 8; /* scaling factor 1.0 in fixed point (8 == FRAC_ACC macro in ISP) */ - unsigned int bs_out, bs_in; /* scaling ratio in fixed point */ - - bs_out = scr.bayer_scale_hor_ratio_out * bs_frac; - bs_in = scr.bayer_scale_hor_ratio_in * bs_frac; - sensor_width_bqs = (in_width_bqs * bs_out + bs_in / 2) / bs_in; /* "+ bs_in/2": rounding */ - - bs_out = scr.bayer_scale_ver_ratio_out * bs_frac; - bs_in = scr.bayer_scale_ver_ratio_in * bs_frac; - sensor_height_bqs = (in_height_bqs * bs_out + bs_in / 2) / bs_in; /* "+ bs_in/2": rounding */ -} - -/* Center of the sensor data on the internal frame at shading correction. */ -sensor_center_x_bqs_on_internal = sensor_org_x_bqs_on_internal + sensor_width_bqs / 2; -sensor_center_y_bqs_on_internal = sensor_org_y_bqs_on_internal + sensor_height_bqs / 2; - -/* Size of left/right/upper/lower sides of the sensor center on the internal frame. */ -left = sensor_center_x_bqs_on_internal; -right = internal_width_bqs - sensor_center_x_bqs_on_internal; -upper = sensor_center_y_bqs_on_internal; -lower = internal_height_bqs - sensor_center_y_bqs_on_internal; - -/* Align the size of left/right/upper/lower sides to a multiple of the grid cell size. */ -adjust_left = CEIL_MUL(left, bqs_per_grid_cell); -adjust_right = CEIL_MUL(right, bqs_per_grid_cell); -adjust_upper = CEIL_MUL(upper, bqs_per_grid_cell); -adjust_lower = CEIL_MUL(lower, bqs_per_grid_cell); - -/* Shading table should cover the adjusted frame size. */ -adjust_width_bqs = adjust_left + adjust_right; -adjust_height_bqs = adjust_upper + adjust_lower; - -IA_CSS_LOG("adjust_width_bqs=%d, adjust_height_bqs=%d", adjust_width_bqs, adjust_height_bqs); - -if (adjust_width_bqs > tbl_width_bqs || adjust_height_bqs > tbl_height_bqs) -{ - IA_CSS_LEAVE_ERR_PRIVATE(-EINVAL); - return -EINVAL; -} - -/* Origin of the internal frame on the shading table. */ -internal_org_x_bqs_on_tbl = adjust_left - left; -internal_org_y_bqs_on_tbl = adjust_upper - upper; - -/* Origin of the real sensor data area on the shading table. */ -sensor_org_x_bqs_on_tbl = internal_org_x_bqs_on_tbl + sensor_org_x_bqs_on_internal; -sensor_org_y_bqs_on_tbl = internal_org_y_bqs_on_tbl + sensor_org_y_bqs_on_internal; - -/* The shading information necessary as API is stored in the shading_info. */ -shading_info->info.type_1.num_hor_grids = num_hor_grids; -shading_info->info.type_1.num_ver_grids = num_ver_grids; -shading_info->info.type_1.bqs_per_grid_cell = bqs_per_grid_cell; - -shading_info->info.type_1.bayer_scale_hor_ratio_in = scr.bayer_scale_hor_ratio_in; -shading_info->info.type_1.bayer_scale_hor_ratio_out = scr.bayer_scale_hor_ratio_out; -shading_info->info.type_1.bayer_scale_ver_ratio_in = scr.bayer_scale_ver_ratio_in; -shading_info->info.type_1.bayer_scale_ver_ratio_out = scr.bayer_scale_ver_ratio_out; - -shading_info->info.type_1.isp_input_sensor_data_res_bqs.width = in_width_bqs; -shading_info->info.type_1.isp_input_sensor_data_res_bqs.height = in_height_bqs; - -shading_info->info.type_1.sensor_data_res_bqs.width = sensor_width_bqs; -shading_info->info.type_1.sensor_data_res_bqs.height = sensor_height_bqs; - -shading_info->info.type_1.sensor_data_origin_bqs_on_sctbl.x = (int32_t)sensor_org_x_bqs_on_tbl; -shading_info->info.type_1.sensor_data_origin_bqs_on_sctbl.y = (int32_t)sensor_org_y_bqs_on_tbl; - -/* The shading information related to ISP (but, not necessary as API) is stored in the pipe_config. */ -pipe_config->internal_frame_origin_bqs_on_sctbl.x = (int32_t)internal_org_x_bqs_on_tbl; -pipe_config->internal_frame_origin_bqs_on_sctbl.y = (int32_t)internal_org_y_bqs_on_tbl; - -IA_CSS_LOG("shading_info: grids=%dx%d, cell=%d, scale=%d,%d,%d,%d, input=%dx%d, data=%dx%d, origin=(%d,%d)", - shading_info->info.type_1.num_hor_grids, - shading_info->info.type_1.num_ver_grids, - shading_info->info.type_1.bqs_per_grid_cell, - shading_info->info.type_1.bayer_scale_hor_ratio_in, - shading_info->info.type_1.bayer_scale_hor_ratio_out, - shading_info->info.type_1.bayer_scale_ver_ratio_in, - shading_info->info.type_1.bayer_scale_ver_ratio_out, - shading_info->info.type_1.isp_input_sensor_data_res_bqs.width, - shading_info->info.type_1.isp_input_sensor_data_res_bqs.height, - shading_info->info.type_1.sensor_data_res_bqs.width, - shading_info->info.type_1.sensor_data_res_bqs.height, - shading_info->info.type_1.sensor_data_origin_bqs_on_sctbl.x, - shading_info->info.type_1.sensor_data_origin_bqs_on_sctbl.y); - -IA_CSS_LOG("pipe_config: origin=(%d,%d)", - pipe_config->internal_frame_origin_bqs_on_sctbl.x, - pipe_config->internal_frame_origin_bqs_on_sctbl.y); - -IA_CSS_LEAVE_ERR_PRIVATE(err); -#endif -return err; -} int ia_css_binary_get_shading_info(const struct ia_css_binary *binary, /* [in] */ @@ -718,20 +706,25 @@ ia_css_binary_get_shading_info(const struct ia_css_binary *binary, /* [in] */ IA_CSS_ENTER_PRIVATE("binary=%p, type=%d, required_bds_factor=%d, stream_config=%p", binary, type, required_bds_factor, stream_config); - if (type == IA_CSS_SHADING_CORRECTION_TYPE_1) -#ifndef ISP2401 - err = ia_css_binary_get_shading_info_type_1(binary, required_bds_factor, stream_config, - shading_info); -#else - err = ia_css_binary_get_shading_info_type_1(binary, required_bds_factor, stream_config, - shading_info, pipe_config); -#endif - - /* Other function calls can be added here when other shading correction types will be added in the future. */ - - else + if (type != IA_CSS_SHADING_CORRECTION_TYPE_1) { err = -ENOTSUPP; + IA_CSS_LEAVE_ERR_PRIVATE(err); + return err; + } + + if (!IS_ISP2401) + err = isp2400_binary_get_shading_info_type_1(binary, + required_bds_factor, + stream_config, + shading_info); + else + err = isp2401_binary_get_shading_info_type_1(binary, + required_bds_factor, + stream_config, + shading_info, + pipe_config); + IA_CSS_LEAVE_ERR_PRIVATE(err); return err; } diff --git a/drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c b/drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c index 0901c932bf28..6a75cba4886f 100644 --- a/drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c +++ b/drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c @@ -385,8 +385,7 @@ int ia_css_bufq_enqueue_psys_event( u8 evt_payload_1, uint8_t evt_payload_2) { - - int error = 0; + int error = 0; ia_css_queue_t *q; IA_CSS_ENTER_PRIVATE("evt_id=%d", evt_id); diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c index ec598a1697b1..4f637e7219a6 100644 --- a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +++ b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c @@ -2127,9 +2127,9 @@ void ia_css_debug_dump_isys_state(void) input_system_get_state(INPUT_SYSTEM0_ID, &state); #ifndef ISP2401 - debug_print_isys_state(&state); + debug_print_isys_state(&state); #else - input_system_dump_state(INPUT_SYSTEM0_ID, &state); + input_system_dump_state(INPUT_SYSTEM0_ID, &state); #endif } diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index 87347013b747..2fb817e3d756 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -5091,24 +5091,23 @@ sh_css_pipes_stop(struct ia_css_stream *stream) stream->pipes[i]->pipeline.pipe_id); err = ia_css_pipeline_request_stop(&stream->pipes[i]->pipeline); - /* - * Exit this loop if "ia_css_pipeline_request_stop()" - * returns the error code. - * - * The error code would be generated in the following - * two cases: - * (1) The Scalar Processor has already been stopped. - * (2) The "Host->SP" event queue is full. - * - * As the convention of using CSS API 2.0/2.1, such CSS - * error code would be propogated from the CSS-internal - * API returned value to the CSS API returned value. Then - * the CSS driver should capture these error code and - * handle it in the driver exception handling mechanism. - */ - if (err) { - goto ERR; - } + /* + * Exit this loop if "ia_css_pipeline_request_stop()" + * returns the error code. + * + * The error code would be generated in the following + * two cases: + * (1) The Scalar Processor has already been stopped. + * (2) The "Host->SP" event queue is full. + * + * As the convention of using CSS API 2.0/2.1, such CSS + * error code would be propogated from the CSS-internal + * API returned value to the CSS API returned value. Then + * the CSS driver should capture these error code and + * handle it in the driver exception handling mechanism. + */ + if (err) + goto ERR; } /* @@ -8768,47 +8767,27 @@ ia_css_acc_pipe_create(struct ia_css_pipe *pipe) { return err; } -int -ia_css_pipe_create(const struct ia_css_pipe_config *config, - struct ia_css_pipe **pipe) { -#ifndef ISP2401 - if (!config) -#else +int ia_css_pipe_create(const struct ia_css_pipe_config *config, + struct ia_css_pipe **pipe) +{ int err = 0; IA_CSS_ENTER_PRIVATE("config = %p, pipe = %p", config, pipe); - if (!config) - { + if (!config || !pipe) { IA_CSS_LEAVE_ERR_PRIVATE(-EINVAL); -#endif return -EINVAL; -#ifndef ISP2401 - if (!pipe) -#else -} + } -if (!pipe) -{ - IA_CSS_LEAVE_ERR_PRIVATE(-EINVAL); -#endif - return -EINVAL; -#ifndef ISP2401 - return ia_css_pipe_create_extra(config, NULL, pipe); -#else -} - -err = ia_css_pipe_create_extra(config, NULL, pipe); + err = ia_css_pipe_create_extra(config, NULL, pipe); -if (err == 0) -{ - IA_CSS_LOG("pipe created successfully = %p", *pipe); -} + if (err == 0) { + IA_CSS_LOG("pipe created successfully = %p", *pipe); + } -IA_CSS_LEAVE_ERR_PRIVATE(err); + IA_CSS_LEAVE_ERR_PRIVATE(err); -return err; -#endif + return err; } int From patchwork Wed Sep 2 16:10:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751175 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 14E72109A for ; Wed, 2 Sep 2020 16:13:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF15B208C7 for ; Wed, 2 Sep 2020 16:13:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063221; bh=yoQ8zZE5m2/tDG9AeXtLxMJl3im46ZkFGZeqJRxitE4=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=Yv0vV3jWZ/O6z73OkOt12yB1w4G219Sn00Kh5UPt8ThP93vSO7OfSHWYdmqe3Z33v jzTSeYGYEsv+IKbXcsLVwl5jr0+iDntL0w+QwVLLcJcP9sC1ch6HSMa7lPIyy+Ku8W Yspj3b90v1i/riXunGKl9yOXwcbFsKADBcB25Nic= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728690AbgIBQNY (ORCPT ); Wed, 2 Sep 2020 12:13:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:54052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728338AbgIBQK5 (ORCPT ); Wed, 2 Sep 2020 12:10:57 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A47C5221EC; Wed, 2 Sep 2020 16:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=yoQ8zZE5m2/tDG9AeXtLxMJl3im46ZkFGZeqJRxitE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qaY1oFSYcDv+ogzDVXr3d5fhrEopUrBB+TvKnkK+8pPRIyrZ8YN7uilwgwszUJEYu WRNubUMqmwMnnz2wAm74KhVfPq/69qs8XxivES3DC8Tt01R7jCwS884wVvisuVIRoc 0xOgFDGhvUwe83zUer5g3Zi3hnxdtLbswSBjmiUY= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tBN-S2; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 36/38] media: atomisp: csi_rx.c: add a missing includes Date: Wed, 2 Sep 2020 18:10:39 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Due to that, smatch warns with: drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c:18:11: warning: symbol 'N_SHORT_PACKET_LUT_ENTRIES' was not declared. Should it be static? drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c:24:11: warning: symbol 'N_LONG_PACKET_LUT_ENTRIES' was not declared. Should it be static? drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c:30:11: warning: symbol 'N_CSI_RX_FE_CTRL_DLANES' was not declared. Should it be static? drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c:37:11: warning: symbol 'N_CSI_RX_BE_SID_WIDTH' was not declared. Should it be static? drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c:19:11: warning: symbol 'N_IBUF_CTRL_PROCS' was not declared. Should it be static? Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c | 1 + .../staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c b/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c index 8e661091f7d9..9a8d8f546da7 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/csi_rx.c @@ -14,6 +14,7 @@ */ #include "system_global.h" +#include "csi_rx_global.h" const u32 N_SHORT_PACKET_LUT_ENTRIES[N_CSI_RX_BACKEND_ID] = { 4, /* 4 entries at CSI_RX_BACKEND0_ID*/ diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c index 58fec54a914d..8d19c9875a71 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/ibuf_ctrl.c @@ -15,6 +15,7 @@ #include #include "system_global.h" +#include "ibuf_ctrl_global.h" const u32 N_IBUF_CTRL_PROCS[N_IBUF_CTRL_ID] = { 8, /* IBUF_CTRL0_ID supports at most 8 processes */ From patchwork Wed Sep 2 16:10:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751163 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0DD4614E3 for ; Wed, 2 Sep 2020 16:13:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D8D002072A for ; Wed, 2 Sep 2020 16:12:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063179; bh=Bybq2rNfz8+YFu+79t9vTEYCcLnK9U6RRVeZrJpy54M=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=t1R3sGbQCdddFsMGnMqcYBRj7S9gie5u6IutXpu21WksuRVG9UcPffw83Ib9pLtBm knQO+So8zMFd10pRInmJbM4iZbamxnjIZ0COVem7G3b9J2N0a5A8EruNpp/jY22csr HHqqiBcul9VrtAwwU2Yfw7YcFbQCsICRI1bmTtlI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728578AbgIBQMi (ORCPT ); Wed, 2 Sep 2020 12:12:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:54044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728356AbgIBQLB (ORCPT ); Wed, 2 Sep 2020 12:11:01 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B7F92221EE; Wed, 2 Sep 2020 16:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=Bybq2rNfz8+YFu+79t9vTEYCcLnK9U6RRVeZrJpy54M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zH/UCAIh8bJ9EuRI41MVaF3pj51wP/SxGs/N8KbuRrylHJyFovC5ocPUUQCVEpLo/ fr3wQ0HUKt/nzEp7Jx5gJU+a251Y2RQwY58GYhJBqLZjNfCbB3bZHOYdjDtfvnxgCn UM1YrCjIzdOCDEruGClldRk3AxV16j9CgNNrxObU= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tBP-Sq; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , Andy Shevchenko , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 37/38] media: atomisp: atomisp_gmin_platform: check before use Date: Wed, 2 Sep 2020 18:10:40 +0200 Message-Id: <7778f1f6c8cbc303f6f7377e0daca28a6825f862.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org solve this smatch warning: drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c:842 gmin_v1p8_ctrl() warn: variable dereferenced before check 'gs' (see line 832) By moving the check to happen before its usage. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c index c49d27038d27..8652f71dfff6 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c @@ -829,6 +829,9 @@ static int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on) int ret; int value; + if (!gs || gs->v1p8_on == on) + return 0; + if (gs->v1p8_gpio >= 0) { pr_info("atomisp_gmin_platform: 1.8v power on GPIO %d\n", gs->v1p8_gpio); @@ -839,8 +842,6 @@ static int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on) pr_err("V1P8 GPIO initialization failed\n"); } - if (!gs || gs->v1p8_on == on) - return 0; gs->v1p8_on = on; if (gs->v1p8_gpio >= 0) From patchwork Wed Sep 2 16:10:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 11751165 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 36DB6109A for ; Wed, 2 Sep 2020 16:13:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1B2F72072A for ; Wed, 2 Sep 2020 16:13:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063181; bh=J4JeDFYvwI7/t1R2PxhAwt3okUEpHkNnAbNmW1c47hA=; h=From:Cc:Subject:Date:In-Reply-To:References:To:List-ID:From; b=D3zvHHvtEnMBv1cWNf9lxn5kZrQtvgePWcQfh0Ijy97R7zcO0G0+GpLTqJZAipmxW 5yGIgxu7tkeZKWy+Wh+eiEJqlm5aIhhI7gb2XFQKuB6515TlJv1EUh/HzVv6qszXIO J+sBXbwHK4xSO08pukQrRMQ35UhxOkCbTwCybp4Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728573AbgIBQMf (ORCPT ); Wed, 2 Sep 2020 12:12:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:54036 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728358AbgIBQLB (ORCPT ); Wed, 2 Sep 2020 12:11:01 -0400 Received: from mail.kernel.org (ip5f5ad5c3.dynamic.kabel-deutschland.de [95.90.213.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BC9EF221EF; Wed, 2 Sep 2020 16:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599063046; bh=J4JeDFYvwI7/t1R2PxhAwt3okUEpHkNnAbNmW1c47hA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K9QP46W0wA2chHgniI6PTlNOKaxlUNhqnuFbzy8KfjuQIjFLWPnvAQVBhEFx2Grko JIv1YedwyWgOvWD600mc4Is4h4cgQnneDkHS4w4YF2tEQO219/wDIgvXKG3xGoCnS5 xT4/BxTXJhZU/2yryqoa2P6VqHPuh/CR/2n+b5q4= Received: from mchehab by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1kDVLQ-000tBR-Tb; Wed, 02 Sep 2020 18:10:44 +0200 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 38/38] media: atomisp: cleanup isys_irq headers Date: Wed, 2 Sep 2020 18:10:41 +0200 Message-Id: <652f59eef30ccd3dc12d8c3c61c632f24100d607.1599062230.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Don't need to declare those functions with extern: drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h:51:35: warning: function 'isys_irqc_state_dump' with external linkage has definition drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h:68:35: warning: function 'isys_irqc_reg_store' with external linkage has definition drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h:85:39: warning: function 'isys_irqc_reg_load' with external linkage has definition drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c:31:35: warning: function 'isys_irqc_status_enable' with external linkage has definition Signed-off-by: Mauro Carvalho Chehab --- .../pci/css_2401_system/host/isys_irq.c | 3 +-- .../css_2401_system/host/isys_irq_private.h | 8 +++--- .../host/isys_irq_public.h | 25 ++++++++----------- .../pci/hive_isp_css_include/isys_irq.h | 12 --------- 4 files changed, 15 insertions(+), 33 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c index 99576af4713c..b6135c4b6eea 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq.c @@ -28,8 +28,7 @@ #endif /* Public interface */ -STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_status_enable( - const isys_irq_ID_t isys_irqc_id) +void isys_irqc_status_enable(const isys_irq_ID_t isys_irqc_id) { assert(isys_irqc_id < N_ISYS_IRQ_ID); diff --git a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h index 1e96f0267ac0..fb168c25bdfc 100644 --- a/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h +++ b/drivers/staging/media/atomisp/pci/css_2401_system/host/isys_irq_private.h @@ -29,7 +29,7 @@ * @brief Get the isys irq status. * Refer to "isys_irq.h" for details. */ -STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_state_get( +void isys_irqc_state_get( const isys_irq_ID_t isys_irqc_id, isys_irqc_state_t *state) { @@ -48,7 +48,7 @@ STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_state_get( * @brief Dump the isys irq status. * Refer to "isys_irq.h" for details. */ -STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_state_dump( +void isys_irqc_state_dump( const isys_irq_ID_t isys_irqc_id, const isys_irqc_state_t *state) { @@ -65,7 +65,7 @@ STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_state_dump( + -------------------------------------------------------*/ /* Support functions */ -STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_reg_store( +void isys_irqc_reg_store( const isys_irq_ID_t isys_irqc_id, const unsigned int reg_idx, const hrt_data value) @@ -82,7 +82,7 @@ STORAGE_CLASS_ISYS2401_IRQ_C void isys_irqc_reg_store( ia_css_device_store_uint32(reg_addr, value); } -STORAGE_CLASS_ISYS2401_IRQ_C hrt_data isys_irqc_reg_load( +hrt_data isys_irqc_reg_load( const isys_irq_ID_t isys_irqc_id, const unsigned int reg_idx) { diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h index cd738f4b65a0..736cbc4e3705 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/host/isys_irq_public.h @@ -21,25 +21,20 @@ #if defined(ISP2401) -STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_state_get( - const isys_irq_ID_t isys_irqc_id, - isys_irqc_state_t *state); +void isys_irqc_state_get(const isys_irq_ID_t isys_irqc_id, + isys_irqc_state_t *state); -STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_state_dump( - const isys_irq_ID_t isys_irqc_id, - const isys_irqc_state_t *state); +void isys_irqc_state_dump(const isys_irq_ID_t isys_irqc_id, + const isys_irqc_state_t *state); -STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_reg_store( - const isys_irq_ID_t isys_irqc_id, - const unsigned int reg_idx, - const hrt_data value); +void isys_irqc_reg_store(const isys_irq_ID_t isys_irqc_id, + const unsigned int reg_idx, + const hrt_data value); -STORAGE_CLASS_ISYS2401_IRQ_H hrt_data isys_irqc_reg_load( - const isys_irq_ID_t isys_irqc_id, - const unsigned int reg_idx); +hrt_data isys_irqc_reg_load(const isys_irq_ID_t isys_irqc_id, + const unsigned int reg_idx); -STORAGE_CLASS_ISYS2401_IRQ_H void isys_irqc_status_enable( - const isys_irq_ID_t isys_irqc_id); +void isys_irqc_status_enable(const isys_irq_ID_t isys_irqc_id); #endif /* defined(ISP2401) */ diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h index 06bc9e1450ec..001c55ea970b 100644 --- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h +++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/isys_irq.h @@ -21,20 +21,8 @@ #if defined(ISP2401) -#ifndef __INLINE_ISYS2401_IRQ__ - -#define STORAGE_CLASS_ISYS2401_IRQ_H extern -#define STORAGE_CLASS_ISYS2401_IRQ_C extern #include "isys_irq_public.h" -#else /* __INLINE_ISYS2401_IRQ__ */ - -#define STORAGE_CLASS_ISYS2401_IRQ_H static inline -#define STORAGE_CLASS_ISYS2401_IRQ_C static inline -#include "isys_irq_private.h" - -#endif /* __INLINE_ISYS2401_IRQ__ */ - #endif /* defined(ISP2401) */ #endif /* __IA_CSS_ISYS_IRQ_H__ */