mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-27 21:54:41 +00:00
[media] mx1-camera: move interface activation and deactivation to clock callbacks
When adding and removing a client, the mx1-camera driver only activates and deactivates its camera interface respectively, which doesn't include any client-specific actions. Move this functionality into .clock_start() and .clock_stop() callbacks. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
6b417c8970
commit
d71042c1fa
@ -399,7 +399,7 @@ static void mx1_camera_activate(struct mx1_camera_dev *pcdev)
|
|||||||
{
|
{
|
||||||
unsigned int csicr1 = CSICR1_EN;
|
unsigned int csicr1 = CSICR1_EN;
|
||||||
|
|
||||||
dev_dbg(pcdev->soc_host.icd->parent, "Activate device\n");
|
dev_dbg(pcdev->soc_host.v4l2_dev.dev, "Activate device\n");
|
||||||
|
|
||||||
clk_prepare_enable(pcdev->clk);
|
clk_prepare_enable(pcdev->clk);
|
||||||
|
|
||||||
@ -415,7 +415,7 @@ static void mx1_camera_activate(struct mx1_camera_dev *pcdev)
|
|||||||
|
|
||||||
static void mx1_camera_deactivate(struct mx1_camera_dev *pcdev)
|
static void mx1_camera_deactivate(struct mx1_camera_dev *pcdev)
|
||||||
{
|
{
|
||||||
dev_dbg(pcdev->soc_host.icd->parent, "Deactivate device\n");
|
dev_dbg(pcdev->soc_host.v4l2_dev.dev, "Deactivate device\n");
|
||||||
|
|
||||||
/* Disable all CSI interface */
|
/* Disable all CSI interface */
|
||||||
__raw_writel(0x00, pcdev->base + CSICR1);
|
__raw_writel(0x00, pcdev->base + CSICR1);
|
||||||
@ -423,26 +423,35 @@ static void mx1_camera_deactivate(struct mx1_camera_dev *pcdev)
|
|||||||
clk_disable_unprepare(pcdev->clk);
|
clk_disable_unprepare(pcdev->clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* The following two functions absolutely depend on the fact, that
|
|
||||||
* there can be only one camera on i.MX1/i.MXL camera sensor interface
|
|
||||||
*/
|
|
||||||
static int mx1_camera_add_device(struct soc_camera_device *icd)
|
static int mx1_camera_add_device(struct soc_camera_device *icd)
|
||||||
{
|
{
|
||||||
struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
|
|
||||||
struct mx1_camera_dev *pcdev = ici->priv;
|
|
||||||
|
|
||||||
dev_info(icd->parent, "MX1 Camera driver attached to camera %d\n",
|
dev_info(icd->parent, "MX1 Camera driver attached to camera %d\n",
|
||||||
icd->devnum);
|
icd->devnum);
|
||||||
|
|
||||||
mx1_camera_activate(pcdev);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mx1_camera_remove_device(struct soc_camera_device *icd)
|
static void mx1_camera_remove_device(struct soc_camera_device *icd)
|
||||||
{
|
{
|
||||||
struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
|
dev_info(icd->parent, "MX1 Camera driver detached from camera %d\n",
|
||||||
|
icd->devnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The following two functions absolutely depend on the fact, that
|
||||||
|
* there can be only one camera on i.MX1/i.MXL camera sensor interface
|
||||||
|
*/
|
||||||
|
static int mx1_camera_clock_start(struct soc_camera_host *ici)
|
||||||
|
{
|
||||||
|
struct mx1_camera_dev *pcdev = ici->priv;
|
||||||
|
|
||||||
|
mx1_camera_activate(pcdev);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void mx1_camera_clock_stop(struct soc_camera_host *ici)
|
||||||
|
{
|
||||||
struct mx1_camera_dev *pcdev = ici->priv;
|
struct mx1_camera_dev *pcdev = ici->priv;
|
||||||
unsigned int csicr1;
|
unsigned int csicr1;
|
||||||
|
|
||||||
@ -453,9 +462,6 @@ static void mx1_camera_remove_device(struct soc_camera_device *icd)
|
|||||||
/* Stop DMA engine */
|
/* Stop DMA engine */
|
||||||
imx_dma_disable(pcdev->dma_chan);
|
imx_dma_disable(pcdev->dma_chan);
|
||||||
|
|
||||||
dev_info(icd->parent, "MX1 Camera driver detached from camera %d\n",
|
|
||||||
icd->devnum);
|
|
||||||
|
|
||||||
mx1_camera_deactivate(pcdev);
|
mx1_camera_deactivate(pcdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -669,6 +675,8 @@ static struct soc_camera_host_ops mx1_soc_camera_host_ops = {
|
|||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.add = mx1_camera_add_device,
|
.add = mx1_camera_add_device,
|
||||||
.remove = mx1_camera_remove_device,
|
.remove = mx1_camera_remove_device,
|
||||||
|
.clock_start = mx1_camera_clock_start,
|
||||||
|
.clock_stop = mx1_camera_clock_stop,
|
||||||
.set_bus_param = mx1_camera_set_bus_param,
|
.set_bus_param = mx1_camera_set_bus_param,
|
||||||
.set_fmt = mx1_camera_set_fmt,
|
.set_fmt = mx1_camera_set_fmt,
|
||||||
.try_fmt = mx1_camera_try_fmt,
|
.try_fmt = mx1_camera_try_fmt,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user