public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	Tsuchiya Yuto <kitakar@gmail.com>,
	Andy Shevchenko <andy@kernel.org>,
	Yury Luneff <yury.lunev@gmail.com>,
	Nable <nable.maininbox@googlemail.com>,
	andrey.i.trufanov@gmail.com, Fabio Aiuto <fabioaiuto83@gmail.com>,
	linux-media@vger.kernel.org, linux-staging@lists.linux.dev
Subject: [PATCH 19/20] media: atomisp: Remove atomisp_ospm_dphy_up()/_down() functions
Date: Sun, 20 Nov 2022 23:41:00 +0100	[thread overview]
Message-ID: <20221120224101.746199-20-hdegoede@redhat.com> (raw)
In-Reply-To: <20221120224101.746199-1-hdegoede@redhat.com>

atomisp_ospm_dphy_up() is an empty function now and
atomisp_ospm_dphy_down() contains a couple of checks + goto done
statements which don't matter since the function always ends up at
the done label regardless and then it does 1 pci-config write.

Move the single pci-config write directly to atomisp_power_off()
and remove the atomisp_ospm_dphy_up()/_down() functions.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 .../staging/media/atomisp/pci/atomisp_cmd.c   | 34 -------------------
 .../staging/media/atomisp/pci/atomisp_cmd.h   |  2 --
 .../staging/media/atomisp/pci/atomisp_v4l2.c  | 24 ++++++-------
 3 files changed, 12 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
index 7821bbd1e8da..e9ce3b9b527c 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
@@ -5492,40 +5492,6 @@ int atomisp_set_shading_table(struct atomisp_sub_device *asd,
 	return ret;
 }
 
-/*Turn off ISP dphy */
-int atomisp_ospm_dphy_down(struct atomisp_device *isp)
-{
-	struct pci_dev *pdev = to_pci_dev(isp->dev);
-	u32 reg;
-
-	dev_dbg(isp->dev, "%s\n", __func__);
-
-	/* if ISP timeout, we can force powerdown */
-	if (isp->isp_timeout)
-		goto done;
-
-	if (!atomisp_dev_users(isp))
-		goto done;
-
-done:
-	/*
-	 * MRFLD IUNIT DPHY is located in an always-power-on island
-	 * MRFLD HW design need all CSI ports are disabled before
-	 * powering down the IUNIT.
-	 */
-	pci_read_config_dword(pdev, MRFLD_PCI_CSI_CONTROL, &reg);
-	reg |= MRFLD_ALL_CSI_PORTS_OFF_MASK;
-	pci_write_config_dword(pdev, MRFLD_PCI_CSI_CONTROL, reg);
-	return 0;
-}
-
-/*Turn on ISP dphy */
-int atomisp_ospm_dphy_up(struct atomisp_device *isp)
-{
-	dev_dbg(isp->dev, "%s\n", __func__);
-	return 0;
-}
-
 int atomisp_exif_makernote(struct atomisp_sub_device *asd,
 			   struct atomisp_makernote_info *config)
 {
diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.h b/drivers/staging/media/atomisp/pci/atomisp_cmd.h
index f7647edb25fb..b8911491581a 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_cmd.h
+++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.h
@@ -273,8 +273,6 @@ int atomisp_set_shading_table(struct atomisp_sub_device *asd,
 int atomisp_offline_capture_configure(struct atomisp_sub_device *asd,
 				      struct atomisp_cont_capture_conf *cvf_config);
 
-int atomisp_ospm_dphy_down(struct atomisp_device *isp);
-int atomisp_ospm_dphy_up(struct atomisp_device *isp);
 int atomisp_exif_makernote(struct atomisp_sub_device *asd,
 			   struct atomisp_makernote_info *config);
 
diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
index 9cb1363abe72..e786b81921da 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
@@ -722,9 +722,10 @@ static int atomisp_mrfld_power(struct atomisp_device *isp, bool enable)
 
 int atomisp_power_off(struct device *dev)
 {
-	struct atomisp_device *isp = (struct atomisp_device *)
-				     dev_get_drvdata(dev);
+	struct atomisp_device *isp = dev_get_drvdata(dev);
+	struct pci_dev *pdev = to_pci_dev(dev);
 	int ret;
+	u32 reg;
 
 	atomisp_css_uninit(isp);
 
@@ -732,10 +733,15 @@ int atomisp_power_off(struct device *dev)
 	if (ret)
 		return ret;
 
-	/*Turn off the ISP d-phy*/
-	ret = atomisp_ospm_dphy_down(isp);
-	if (ret)
-		return ret;
+	/*
+	 * MRFLD IUNIT DPHY is located in an always-power-on island
+	 * MRFLD HW design need all CSI ports are disabled before
+	 * powering down the IUNIT.
+	 */
+	pci_read_config_dword(pdev, MRFLD_PCI_CSI_CONTROL, &reg);
+	reg |= MRFLD_ALL_CSI_PORTS_OFF_MASK;
+	pci_write_config_dword(pdev, MRFLD_PCI_CSI_CONTROL, reg);
+
 	cpu_latency_qos_update_request(&isp->pm_qos, PM_QOS_DEFAULT_VALUE);
 	return atomisp_mrfld_power(isp, false);
 }
@@ -751,12 +757,6 @@ int atomisp_power_on(struct device *dev)
 		return ret;
 
 	cpu_latency_qos_update_request(&isp->pm_qos, isp->max_isr_latency);
-	/*Turn on ISP d-phy */
-	ret = atomisp_ospm_dphy_up(isp);
-	if (ret) {
-		dev_err(isp->dev, "Failed to power up ISP!.\n");
-		return -EINVAL;
-	}
 
 	/*restore register values for iUnit and iUnitPHY registers*/
 	if (isp->saved_regs.pcicmdsts)
-- 
2.38.1


  parent reply	other threads:[~2022-11-20 22:41 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-20 22:40 [PATCH 00/20] media: atomisp: Misc. cleanups / fixes Hans de Goede
2022-11-20 22:40 ` [PATCH 01/20] media: atomisp: Silence: 'atomisp_q_one_s3a_buffer: drop one s3a stat which has exp_id xx' log messages Hans de Goede
2022-11-21  8:54   ` Andy Shevchenko
2022-11-21 12:27     ` Hans de Goede
2022-11-20 22:40 ` [PATCH 02/20] media: atomisp: Remove accelerator pipe creation code Hans de Goede
2022-11-20 22:40 ` [PATCH 03/20] media: atomisp: Remove unused QOS defines / structure member Hans de Goede
2022-11-20 22:40 ` [PATCH 04/20] media: atomisp: Flush queue on atomisp_css_start() error Hans de Goede
2022-11-20 22:40 ` [PATCH 05/20] media: atomisp: Log an error on failing to alloc private-mem Hans de Goede
2022-11-21  8:58   ` Andy Shevchenko
2022-11-21 12:29     ` Hans de Goede
2022-11-20 22:40 ` [PATCH 06/20] media: atomisp: Fix deadlock when the /dev/video# node is closed while still streaming Hans de Goede
2022-11-20 22:40 ` [PATCH 07/20] media: atomisp: Remove 2 unused accelerator mode related functions Hans de Goede
2022-11-20 22:40 ` [PATCH 08/20] media: atomisp: Remove atomisp_css_yuvpp_configure_viewfinder() function Hans de Goede
2022-11-20 22:40 ` [PATCH 09/20] media: atomisp: Remove unused ia_css_frame_*() functions Hans de Goede
2022-11-20 22:40 ` [PATCH 10/20] media: atomisp: Drop userptr support from hmm Hans de Goede
2022-11-21  9:01   ` Andy Shevchenko
2022-11-21 12:31     ` Hans de Goede
2022-11-20 22:40 ` [PATCH 11/20] media: atomisp: Remove double atomisp_mrfld_power_down()/_up() calls from atomisp_reset() Hans de Goede
2022-11-20 22:40 ` [PATCH 12/20] media: atomisp: Remove atomisp_mrfld_power_down()/_up() Hans de Goede
2022-11-20 22:40 ` [PATCH 13/20] media: atomisp: Remove clearing of config from atomisp_css_uninit() Hans de Goede
2022-11-20 22:40 ` [PATCH 14/20] media: atomisp: Remove atomisp_css_suspend()/_resume() Hans de Goede
2022-11-20 22:40 ` [PATCH 15/20] media: atomisp: Remove sw_contex.power_state checks Hans de Goede
2022-11-21  9:09   ` Andy Shevchenko
2022-11-21  9:16     ` Andy Shevchenko
2022-11-20 22:40 ` [PATCH 16/20] media: atomisp: Remove duplication between runtime-pm and normal-pm code Hans de Goede
2022-11-20 22:40 ` [PATCH 17/20] media: atomisp: Move calling of css_[un]init() to power_on()/_off() Hans de Goede
2022-11-21  9:14   ` Andy Shevchenko
2022-11-21 12:33     ` Hans de Goede
2022-11-20 22:40 ` [PATCH 18/20] media: atomisp: Remove atomisp_ospm_dphy_down() call from probe error path Hans de Goede
2022-11-20 22:41 ` Hans de Goede [this message]
2022-11-20 22:41 ` [PATCH 20/20] media: atomisp_ov2680: Fix 1280x720 -> 1296x736 resolution Hans de Goede
2022-11-21  9:20 ` [PATCH 00/20] media: atomisp: Misc. cleanups / fixes Andy Shevchenko
2022-11-21 12:40   ` Hans de Goede

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20221120224101.746199-20-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andrey.i.trufanov@gmail.com \
    --cc=andy@kernel.org \
    --cc=fabioaiuto83@gmail.com \
    --cc=kitakar@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=nable.maininbox@googlemail.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=yury.lunev@gmail.com \
    /path/to/YOUR_REPLY

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

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