Commit f1219d9e authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

media: atomisp: Remove sw_contex.power_state checks

Remove the unnecessary sw_contex.power_state checks:

1. atomisp_freq_scaling() and atomisp_stop_streaming() only run when the
   ISP is powered up through runtime-pm, so the checks are not necessary

2. atomisp_mrfld_pre_power_down() and atomisp_runtime_resume() are only
   called through the driver-core pm handling code which already
   guarantees they are not called when already powered down / up.

3. atomisp_isr() also checks isp->css_initialized which only gets set
   by atomisp_css_init() which runs *after* powering up the ISP and which
   gets cleared by atomisp_css_uninit() *before* powering down the ISP.

So all the checks are unnecessary, remove them as well as the
sw_contex.power_state field itself.
Reviewed-by: default avatarAndy Shevchenko <andy@kernel.org>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 586ef0c6
......@@ -207,11 +207,6 @@ int atomisp_freq_scaling(struct atomisp_device *isp,
int i, ret;
unsigned short fps = 0;
if (isp->sw_contex.power_state != ATOM_ISP_POWER_UP) {
dev_err(isp->dev, "DFS cannot proceed due to no power.\n");
return -EINVAL;
}
if ((pdev->device & ATOMISP_PCI_DEVICE_SOC_MASK) ==
ATOMISP_PCI_DEVICE_SOC_CHT && ATOMISP_USE_YUVPP(asd))
isp->dfs = &dfs_config_cht_soc;
......@@ -511,8 +506,8 @@ irqreturn_t atomisp_isr(int irq, void *dev)
int err;
spin_lock_irqsave(&isp->lock, flags);
if (isp->sw_contex.power_state != ATOM_ISP_POWER_UP ||
!isp->css_initialized) {
if (!isp->css_initialized) {
spin_unlock_irqrestore(&isp->lock, flags);
return IRQ_HANDLED;
}
......@@ -5503,7 +5498,6 @@ int atomisp_set_shading_table(struct atomisp_sub_device *asd,
int atomisp_ospm_dphy_down(struct atomisp_device *isp)
{
struct pci_dev *pdev = to_pci_dev(isp->dev);
unsigned long flags;
u32 reg;
dev_dbg(isp->dev, "%s\n", __func__);
......@@ -5515,9 +5509,6 @@ int atomisp_ospm_dphy_down(struct atomisp_device *isp)
if (!atomisp_dev_users(isp))
goto done;
spin_lock_irqsave(&isp->lock, flags);
isp->sw_contex.power_state = ATOM_ISP_POWER_DOWN;
spin_unlock_irqrestore(&isp->lock, flags);
done:
/*
* MRFLD IUNIT DPHY is located in an always-power-on island
......@@ -5533,14 +5524,7 @@ int atomisp_ospm_dphy_down(struct atomisp_device *isp)
/*Turn on ISP dphy */
int atomisp_ospm_dphy_up(struct atomisp_device *isp)
{
unsigned long flags;
dev_dbg(isp->dev, "%s\n", __func__);
spin_lock_irqsave(&isp->lock, flags);
isp->sw_contex.power_state = ATOM_ISP_POWER_UP;
spin_unlock_irqrestore(&isp->lock, flags);
return 0;
}
......
......@@ -195,7 +195,6 @@ struct atomisp_regs {
};
struct atomisp_sw_contex {
int power_state;
int running_freq;
};
......
......@@ -1461,10 +1461,11 @@ void atomisp_stop_streaming(struct vb2_queue *vq)
struct video_device *vdev = &pipe->vdev;
struct atomisp_device *isp = asd->isp;
struct pci_dev *pdev = to_pci_dev(isp->dev);
bool recreate_streams[MAX_STREAM_NUM] = {0};
enum ia_css_pipe_id css_pipe_id;
int ret;
unsigned long flags;
bool first_streamoff = false;
unsigned long flags;
int i, ret;
mutex_lock(&isp->mutex);
......@@ -1563,10 +1564,6 @@ void atomisp_stop_streaming(struct vb2_queue *vq)
* ISP work around, need to reset isp
* Is it correct time to reset ISP when first node does streamoff?
*/
if (isp->sw_contex.power_state == ATOM_ISP_POWER_UP) {
unsigned int i;
bool recreate_streams[MAX_STREAM_NUM] = {0};
if (isp->isp_timeout)
dev_err(isp->dev, "%s: Resetting with WA activated",
__func__);
......@@ -1580,8 +1577,7 @@ void atomisp_stop_streaming(struct vb2_queue *vq)
*/
for (i = 0; i < isp->num_of_streams; i++) {
if (isp->asd[i].stream_prepared) {
atomisp_destroy_pipes_stream_force(&isp->
asd[i]);
atomisp_destroy_pipes_stream_force(&isp->asd[i]);
recreate_streams[i] = true;
}
}
......@@ -1605,7 +1601,6 @@ void atomisp_stop_streaming(struct vb2_queue *vq)
}
}
isp->isp_timeout = false;
}
out_unlock:
mutex_unlock(&isp->mutex);
}
......
......@@ -573,11 +573,7 @@ static int atomisp_mrfld_pre_power_down(struct atomisp_device *isp)
unsigned long flags;
spin_lock_irqsave(&isp->lock, flags);
if (isp->sw_contex.power_state == ATOM_ISP_POWER_DOWN) {
spin_unlock_irqrestore(&isp->lock, flags);
dev_dbg(isp->dev, "<%s %d.\n", __func__, __LINE__);
return 0;
}
/*
* MRFLD HAS requirement: cannot power off i-unit if
* ISP has IRQ not serviced.
......@@ -753,14 +749,12 @@ int atomisp_runtime_resume(struct device *dev)
return ret;
cpu_latency_qos_update_request(&isp->pm_qos, isp->max_isr_latency);
if (isp->sw_contex.power_state == ATOM_ISP_POWER_DOWN) {
/*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)
......@@ -1447,7 +1441,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
isp->dev = &pdev->dev;
isp->base = pcim_iomap_table(pdev)[ATOM_ISP_PCI_BAR];
isp->sw_contex.power_state = ATOM_ISP_POWER_UP;
isp->saved_regs.ispmmadr = start;
dev_dbg(&pdev->dev, "atomisp mmio base: %p\n", isp->base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment