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: 255925 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 760D8C433E2 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 4E92F20639 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: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: 255924 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A1F0C433E2 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 537BB20639 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: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: 255923 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBD62C433E7 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 A1558208B3 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: 255940 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C56B9C43461 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 A4CFD2072A 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: 255922 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61C6AC43461 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 4171020639 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: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: 255926 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57C3AC433E7 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 1C4B2208B3 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: 255927 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F21DEC433E2 for ; Wed, 2 Sep 2020 16:17:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C26C820829 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: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: 255928 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0E7BC433E7 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 8ED91208C7 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: 255939 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0ABFC433E2 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 A1EE120773 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: 255929 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0A5EC43461 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 7BA1420639 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: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: 255933 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A17EEC433E2 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 71E2B208C7 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: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: 255935 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BFDDC433E7 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 F14AB2072A 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: 255938 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F936C433E2 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 26A3C2072A 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: 255931 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8B29C433E7 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 8A817208C7 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: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: 255932 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0817FC433E2 for ; Wed, 2 Sep 2020 16:14:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D650F20773 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: 255936 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5374C433E7 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 A8B4F2072A 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: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: 255930 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E968C433E7 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 EFCEF20639 for ; Wed, 2 Sep 2020 16:15:53 +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: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: 255934 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DDF4C433E2 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 F110920C56 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: 255937 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A250C433E7 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 DA56C20773 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)