Commit 49b2f4c5 authored by Sylwester Nawrocki's avatar Sylwester Nawrocki Committed by Mauro Carvalho Chehab

[media] exynos4-is: Remove support for non-dt platforms

All platforms supported by this driver are going to get device tree
support in this kernel release so remove code that would have been
actually not used any more.
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 4073f942
...@@ -140,39 +140,9 @@ You can either grep through the kernel log to find relevant information, i.e. ...@@ -140,39 +140,9 @@ You can either grep through the kernel log to find relevant information, i.e.
or retrieve the information from /dev/media? with help of the media-ctl tool: or retrieve the information from /dev/media? with help of the media-ctl tool:
# media-ctl -p # media-ctl -p
6. Platform support
===================
The machine code (arch/arm/plat-samsung and arch/arm/mach-*) must select
following options:
CONFIG_S5P_DEV_FIMC0 mandatory
CONFIG_S5P_DEV_FIMC1 \
CONFIG_S5P_DEV_FIMC2 | optional
CONFIG_S5P_DEV_FIMC3 |
CONFIG_S5P_SETUP_FIMC /
CONFIG_S5P_DEV_CSIS0 \ optional for MIPI-CSI interface
CONFIG_S5P_DEV_CSIS1 /
Except that, relevant s5p_device_fimc? should be registered in the machine code
in addition to a "s5p-fimc-md" platform device to which the media device driver
is bound. The "s5p-fimc-md" device instance is required even if only mem-to-mem
operation is used.
The description of sensor(s) attached to FIMC/MIPI-CSIS camera inputs should be
passed as the "s5p-fimc-md" device platform_data. The platform data structure
is defined in file include/media/s5p_fimc.h.
7. Build 7. Build
======== ========
This driver depends on following config options:
PLAT_S5P,
PM_RUNTIME,
I2C,
REGULATOR,
VIDEO_V4L2_SUBDEV_API,
If the driver is built as a loadable kernel module (CONFIG_VIDEO_SAMSUNG_S5P_FIMC=m) If the driver is built as a loadable kernel module (CONFIG_VIDEO_SAMSUNG_S5P_FIMC=m)
two modules are created (in addition to the core v4l2 modules): s5p-fimc.ko and two modules are created (in addition to the core v4l2 modules): s5p-fimc.ko and
optional s5p-csis.ko (MIPI-CSI receiver subdev). optional s5p-csis.ko (MIPI-CSI receiver subdev).
...@@ -7654,7 +7654,6 @@ L: linux-media@vger.kernel.org ...@@ -7654,7 +7654,6 @@ L: linux-media@vger.kernel.org
Q: https://patchwork.linuxtv.org/project/linux-media/list/ Q: https://patchwork.linuxtv.org/project/linux-media/list/
S: Supported S: Supported
F: drivers/media/platform/exynos4-is/ F: drivers/media/platform/exynos4-is/
F: include/media/s5p_fimc.h
SAMSUNG S3C24XX/S3C64XX SOC SERIES CAMIF DRIVER SAMSUNG S3C24XX/S3C64XX SOC SERIES CAMIF DRIVER
M: Sylwester Nawrocki <sylvester.nawrocki@gmail.com> M: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
......
...@@ -3,6 +3,7 @@ config VIDEO_SAMSUNG_EXYNOS4_IS ...@@ -3,6 +3,7 @@ config VIDEO_SAMSUNG_EXYNOS4_IS
bool "Samsung S5P/EXYNOS4 SoC series Camera Subsystem driver" bool "Samsung S5P/EXYNOS4 SoC series Camera Subsystem driver"
depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
depends on (PLAT_S5P || ARCH_EXYNOS) depends on (PLAT_S5P || ARCH_EXYNOS)
depends on OF && COMMON_CLK
help help
Say Y here to enable camera host interface devices for Say Y here to enable camera host interface devices for
Samsung S5P and EXYNOS SoC series. Samsung S5P and EXYNOS SoC series.
...@@ -17,7 +18,7 @@ config VIDEO_S5P_FIMC ...@@ -17,7 +18,7 @@ config VIDEO_S5P_FIMC
depends on I2C depends on I2C
select VIDEOBUF2_DMA_CONTIG select VIDEOBUF2_DMA_CONTIG
select V4L2_MEM2MEM_DEV select V4L2_MEM2MEM_DEV
select MFD_SYSCON if OF select MFD_SYSCON
select VIDEO_EXYNOS4_IS_COMMON select VIDEO_EXYNOS4_IS_COMMON
help help
This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC camera host This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC camera host
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <media/s5p_fimc.h> #include <media/exynos-fimc.h>
#include "common.h" #include "common.h"
/* Called with the media graph mutex held or entity->stream_count > 0. */ /* Called with the media graph mutex held or entity->stream_count > 0. */
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <media/v4l2-device.h> #include <media/v4l2-device.h>
#include <media/v4l2-mem2mem.h> #include <media/v4l2-mem2mem.h>
#include <media/v4l2-mediabus.h> #include <media/v4l2-mediabus.h>
#include <media/s5p_fimc.h> #include <media/exynos-fimc.h>
#define dbg(fmt, args...) \ #define dbg(fmt, args...) \
pr_debug("%s:%d: " fmt "\n", __func__, __LINE__, ##args) pr_debug("%s:%d: " fmt "\n", __func__, __LINE__, ##args)
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <media/v4l2-ioctl.h> #include <media/v4l2-ioctl.h>
#include <media/videobuf2-core.h> #include <media/videobuf2-core.h>
#include <media/videobuf2-dma-contig.h> #include <media/videobuf2-dma-contig.h>
#include <media/s5p_fimc.h> #include <media/exynos-fimc.h>
#include "common.h" #include "common.h"
#include "media-dev.h" #include "media-dev.h"
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <media/videobuf2-core.h> #include <media/videobuf2-core.h>
#include <media/v4l2-device.h> #include <media/v4l2-device.h>
#include <media/v4l2-mediabus.h> #include <media/v4l2-mediabus.h>
#include <media/s5p_fimc.h> #include <media/exynos-fimc.h>
extern int fimc_isp_debug; extern int fimc_isp_debug;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/io.h> #include <linux/io.h>
#include <media/s5p_fimc.h> #include <media/exynos-fimc.h>
#include "fimc-lite-reg.h" #include "fimc-lite-reg.h"
#include "fimc-lite.h" #include "fimc-lite.h"
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <media/v4l2-mem2mem.h> #include <media/v4l2-mem2mem.h>
#include <media/videobuf2-core.h> #include <media/videobuf2-core.h>
#include <media/videobuf2-dma-contig.h> #include <media/videobuf2-dma-contig.h>
#include <media/s5p_fimc.h> #include <media/exynos-fimc.h>
#include "common.h" #include "common.h"
#include "fimc-core.h" #include "fimc-core.h"
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <media/v4l2-ctrls.h> #include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h> #include <media/v4l2-device.h>
#include <media/v4l2-mediabus.h> #include <media/v4l2-mediabus.h>
#include <media/s5p_fimc.h> #include <media/exynos-fimc.h>
#define FIMC_LITE_DRV_NAME "exynos-fimc-lite" #define FIMC_LITE_DRV_NAME "exynos-fimc-lite"
#define FLITE_CLK_NAME "flite" #define FLITE_CLK_NAME "flite"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <media/s5p_fimc.h> #include <media/exynos-fimc.h>
#include "media-dev.h" #include "media-dev.h"
#include "fimc-reg.h" #include "fimc-reg.h"
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <media/v4l2-ctrls.h> #include <media/v4l2-ctrls.h>
#include <media/v4l2-of.h> #include <media/v4l2-of.h>
#include <media/media-device.h> #include <media/media-device.h>
#include <media/s5p_fimc.h> #include <media/exynos-fimc.h>
#include "media-dev.h" #include "media-dev.h"
#include "fimc-core.h" #include "fimc-core.h"
...@@ -39,10 +39,6 @@ ...@@ -39,10 +39,6 @@
#include "fimc-lite.h" #include "fimc-lite.h"
#include "mipi-csis.h" #include "mipi-csis.h"
static int __fimc_md_set_camclk(struct fimc_md *fmd,
struct fimc_source_info *si,
bool on);
/* Set up image sensor subdev -> FIMC capture node notifications. */ /* Set up image sensor subdev -> FIMC capture node notifications. */
static void __setup_sensor_notification(struct fimc_md *fmd, static void __setup_sensor_notification(struct fimc_md *fmd,
struct v4l2_subdev *sensor, struct v4l2_subdev *sensor,
...@@ -223,17 +219,10 @@ static int __fimc_pipeline_open(struct exynos_media_pipeline *ep, ...@@ -223,17 +219,10 @@ static int __fimc_pipeline_open(struct exynos_media_pipeline *ep,
return ret; return ret;
} }
ret = fimc_md_set_camclk(sd, true);
if (ret < 0)
goto err_wbclk;
ret = fimc_pipeline_s_power(p, 1); ret = fimc_pipeline_s_power(p, 1);
if (!ret) if (!ret)
return 0; return 0;
fimc_md_set_camclk(sd, false);
err_wbclk:
if (!IS_ERR(fmd->wbclk[CLK_IDX_WB_B]) && p->subdevs[IDX_IS_ISP]) if (!IS_ERR(fmd->wbclk[CLK_IDX_WB_B]) && p->subdevs[IDX_IS_ISP])
clk_disable_unprepare(fmd->wbclk[CLK_IDX_WB_B]); clk_disable_unprepare(fmd->wbclk[CLK_IDX_WB_B]);
...@@ -259,7 +248,6 @@ static int __fimc_pipeline_close(struct exynos_media_pipeline *ep) ...@@ -259,7 +248,6 @@ static int __fimc_pipeline_close(struct exynos_media_pipeline *ep)
} }
ret = fimc_pipeline_s_power(p, 0); ret = fimc_pipeline_s_power(p, 0);
fimc_md_set_camclk(sd, false);
fmd = entity_to_fimc_mdev(&sd->entity); fmd = entity_to_fimc_mdev(&sd->entity);
...@@ -337,75 +325,14 @@ static void fimc_md_pipelines_free(struct fimc_md *fmd) ...@@ -337,75 +325,14 @@ static void fimc_md_pipelines_free(struct fimc_md *fmd)
} }
} }
/*
* Sensor subdevice helper functions
*/
static struct v4l2_subdev *fimc_md_register_sensor(struct fimc_md *fmd,
struct fimc_source_info *si)
{
struct i2c_adapter *adapter;
struct v4l2_subdev *sd = NULL;
if (!si || !fmd)
return NULL;
/*
* If FIMC bus type is not Writeback FIFO assume it is same
* as sensor_bus_type.
*/
si->fimc_bus_type = si->sensor_bus_type;
adapter = i2c_get_adapter(si->i2c_bus_num);
if (!adapter) {
v4l2_warn(&fmd->v4l2_dev,
"Failed to get I2C adapter %d, deferring probe\n",
si->i2c_bus_num);
return ERR_PTR(-EPROBE_DEFER);
}
sd = v4l2_i2c_new_subdev_board(&fmd->v4l2_dev, adapter,
si->board_info, NULL);
if (IS_ERR_OR_NULL(sd)) {
i2c_put_adapter(adapter);
v4l2_warn(&fmd->v4l2_dev,
"Failed to acquire subdev %s, deferring probe\n",
si->board_info->type);
return ERR_PTR(-EPROBE_DEFER);
}
v4l2_set_subdev_hostdata(sd, si);
sd->grp_id = GRP_ID_SENSOR;
v4l2_info(&fmd->v4l2_dev, "Registered sensor subdevice %s\n",
sd->name);
return sd;
}
static void fimc_md_unregister_sensor(struct v4l2_subdev *sd)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct i2c_adapter *adapter;
if (!client || client->dev.of_node)
return;
v4l2_device_unregister_subdev(sd);
adapter = client->adapter;
i2c_unregister_device(client);
if (adapter)
i2c_put_adapter(adapter);
}
#ifdef CONFIG_OF
/* Parse port node and register as a sub-device any sensor specified there. */ /* Parse port node and register as a sub-device any sensor specified there. */
static int fimc_md_parse_port_node(struct fimc_md *fmd, static int fimc_md_parse_port_node(struct fimc_md *fmd,
struct device_node *port, struct device_node *port,
unsigned int index) unsigned int index)
{ {
struct fimc_source_info *pd = &fmd->sensor[index].pdata;
struct device_node *rem, *ep, *np; struct device_node *rem, *ep, *np;
struct fimc_source_info *pd;
struct v4l2_of_endpoint endpoint; struct v4l2_of_endpoint endpoint;
u32 val;
pd = &fmd->sensor[index].pdata;
/* Assume here a port node can have only one endpoint node. */ /* Assume here a port node can have only one endpoint node. */
ep = of_get_next_child(port, NULL); ep = of_get_next_child(port, NULL);
...@@ -425,20 +352,6 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd, ...@@ -425,20 +352,6 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
ep->full_name); ep->full_name);
return 0; return 0;
} }
if (!of_property_read_u32(rem, "samsung,camclk-out", &val))
pd->clk_id = val;
if (!of_property_read_u32(rem, "clock-frequency", &val))
pd->clk_frequency = val;
else
pd->clk_frequency = DEFAULT_SENSOR_CLK_FREQ;
if (pd->clk_frequency == 0) {
v4l2_err(&fmd->v4l2_dev, "Wrong clock frequency at node %s\n",
rem->full_name);
of_node_put(rem);
return -EINVAL;
}
if (fimc_input_is_parallel(endpoint.base.port)) { if (fimc_input_is_parallel(endpoint.base.port)) {
if (endpoint.bus_type == V4L2_MBUS_PARALLEL) if (endpoint.bus_type == V4L2_MBUS_PARALLEL)
...@@ -485,14 +398,26 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd, ...@@ -485,14 +398,26 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
} }
/* Register all SoC external sub-devices */ /* Register all SoC external sub-devices */
static int fimc_md_of_sensors_register(struct fimc_md *fmd, static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
struct device_node *np)
{ {
struct device_node *parent = fmd->pdev->dev.of_node; struct device_node *parent = fmd->pdev->dev.of_node;
struct device_node *node, *ports; struct device_node *node, *ports;
int index = 0; int index = 0;
int ret; int ret;
/*
* Runtime resume one of the FIMC entities to make sure
* the sclk_cam clocks are not globally disabled.
*/
if (!fmd->pmf)
return -ENXIO;
ret = pm_runtime_get_sync(fmd->pmf);
if (ret < 0)
return ret;
fmd->num_sensors = 0;
/* Attach sensors linked to MIPI CSI-2 receivers */ /* Attach sensors linked to MIPI CSI-2 receivers */
for_each_available_child_of_node(parent, node) { for_each_available_child_of_node(parent, node) {
struct device_node *port; struct device_node *port;
...@@ -506,14 +431,14 @@ static int fimc_md_of_sensors_register(struct fimc_md *fmd, ...@@ -506,14 +431,14 @@ static int fimc_md_of_sensors_register(struct fimc_md *fmd,
ret = fimc_md_parse_port_node(fmd, port, index); ret = fimc_md_parse_port_node(fmd, port, index);
if (ret < 0) if (ret < 0)
return ret; goto rpm_put;
index++; index++;
} }
/* Attach sensors listed in the parallel-ports node */ /* Attach sensors listed in the parallel-ports node */
ports = of_get_child_by_name(parent, "parallel-ports"); ports = of_get_child_by_name(parent, "parallel-ports");
if (!ports) if (!ports)
return 0; goto rpm_put;
for_each_child_of_node(ports, node) { for_each_child_of_node(ports, node) {
ret = fimc_md_parse_port_node(fmd, node, index); ret = fimc_md_parse_port_node(fmd, node, index);
...@@ -521,8 +446,9 @@ static int fimc_md_of_sensors_register(struct fimc_md *fmd, ...@@ -521,8 +446,9 @@ static int fimc_md_of_sensors_register(struct fimc_md *fmd,
break; break;
index++; index++;
} }
rpm_put:
return 0; pm_runtime_put(fmd->pmf);
return ret;
} }
static int __of_get_csis_id(struct device_node *np) static int __of_get_csis_id(struct device_node *np)
...@@ -535,68 +461,10 @@ static int __of_get_csis_id(struct device_node *np) ...@@ -535,68 +461,10 @@ static int __of_get_csis_id(struct device_node *np)
of_property_read_u32(np, "reg", &reg); of_property_read_u32(np, "reg", &reg);
return reg - FIMC_INPUT_MIPI_CSI2_0; return reg - FIMC_INPUT_MIPI_CSI2_0;
} }
#else
#define fimc_md_of_sensors_register(fmd, np) (-ENOSYS)
#define __of_get_csis_id(np) (-ENOSYS)
#endif
static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
{
struct s5p_platform_fimc *pdata = fmd->pdev->dev.platform_data;
struct device_node *of_node = fmd->pdev->dev.of_node;
int num_clients = 0;
int ret, i;
/*
* Runtime resume one of the FIMC entities to make sure
* the sclk_cam clocks are not globally disabled.
*/
if (!fmd->pmf)
return -ENXIO;
ret = pm_runtime_get_sync(fmd->pmf);
if (ret < 0)
return ret;
if (of_node) {
fmd->num_sensors = 0;
ret = fimc_md_of_sensors_register(fmd, of_node);
} else if (pdata) {
WARN_ON(pdata->num_clients > ARRAY_SIZE(fmd->sensor));
num_clients = min_t(u32, pdata->num_clients,
ARRAY_SIZE(fmd->sensor));
fmd->num_sensors = num_clients;
for (i = 0; i < num_clients; i++) {
struct fimc_sensor_info *si = &fmd->sensor[i];
struct v4l2_subdev *sd;
si->pdata = pdata->source_info[i];
ret = __fimc_md_set_camclk(fmd, &si->pdata, true);
if (ret)
break;
sd = fimc_md_register_sensor(fmd, &si->pdata);
ret = __fimc_md_set_camclk(fmd, &si->pdata, false);
if (IS_ERR(sd)) {
si->subdev = NULL;
ret = PTR_ERR(sd);
break;
}
si->subdev = sd;
if (ret)
break;
}
}
pm_runtime_put(fmd->pmf);
return ret;
}
/* /*
* MIPI-CSIS, FIMC and FIMC-LITE platform devices registration. * MIPI-CSIS, FIMC and FIMC-LITE platform devices registration.
*/ */
static int register_fimc_lite_entity(struct fimc_md *fmd, static int register_fimc_lite_entity(struct fimc_md *fmd,
struct fimc_lite *fimc_lite) struct fimc_lite *fimc_lite)
{ {
...@@ -753,35 +621,9 @@ static int fimc_md_register_platform_entity(struct fimc_md *fmd, ...@@ -753,35 +621,9 @@ static int fimc_md_register_platform_entity(struct fimc_md *fmd,
return ret; return ret;
} }
static int fimc_md_pdev_match(struct device *dev, void *data)
{
struct platform_device *pdev = to_platform_device(dev);
int plat_entity = -1;
int ret;
char *p;
if (!get_device(dev))
return -ENODEV;
if (!strcmp(pdev->name, CSIS_DRIVER_NAME)) {
plat_entity = IDX_CSIS;
} else {
p = strstr(pdev->name, "fimc");
if (p && *(p + 4) == 0)
plat_entity = IDX_FIMC;
}
if (plat_entity >= 0)
ret = fimc_md_register_platform_entity(data, pdev,
plat_entity);
put_device(dev);
return 0;
}
/* Register FIMC, FIMC-LITE and CSIS media entities */ /* Register FIMC, FIMC-LITE and CSIS media entities */
#ifdef CONFIG_OF static int fimc_md_register_platform_entities(struct fimc_md *fmd,
static int fimc_md_register_of_platform_entities(struct fimc_md *fmd, struct device_node *parent)
struct device_node *parent)
{ {
struct device_node *node; struct device_node *node;
int ret = 0; int ret = 0;
...@@ -815,9 +657,6 @@ static int fimc_md_register_of_platform_entities(struct fimc_md *fmd, ...@@ -815,9 +657,6 @@ static int fimc_md_register_of_platform_entities(struct fimc_md *fmd,
return ret; return ret;
} }
#else
#define fimc_md_register_of_platform_entities(fmd, node) (-ENOSYS)
#endif
static void fimc_md_unregister_entities(struct fimc_md *fmd) static void fimc_md_unregister_entities(struct fimc_md *fmd)
{ {
...@@ -845,14 +684,6 @@ static void fimc_md_unregister_entities(struct fimc_md *fmd) ...@@ -845,14 +684,6 @@ static void fimc_md_unregister_entities(struct fimc_md *fmd)
v4l2_device_unregister_subdev(fmd->csis[i].sd); v4l2_device_unregister_subdev(fmd->csis[i].sd);
fmd->csis[i].sd = NULL; fmd->csis[i].sd = NULL;
} }
if (fmd->pdev->dev.of_node == NULL) {
for (i = 0; i < fmd->num_sensors; i++) {
if (fmd->sensor[i].subdev == NULL)
continue;
fimc_md_unregister_sensor(fmd->sensor[i].subdev);
fmd->sensor[i].subdev = NULL;
}
}
if (fmd->fimc_is) if (fmd->fimc_is)
v4l2_device_unregister_subdev(&fmd->fimc_is->isp.subdev); v4l2_device_unregister_subdev(&fmd->fimc_is->isp.subdev);
...@@ -1137,7 +968,7 @@ static void fimc_md_put_clocks(struct fimc_md *fmd) ...@@ -1137,7 +968,7 @@ static void fimc_md_put_clocks(struct fimc_md *fmd)
static int fimc_md_get_clocks(struct fimc_md *fmd) static int fimc_md_get_clocks(struct fimc_md *fmd)
{ {
struct device *dev = NULL; struct device *dev = &fmd->pdev->dev;
char clk_name[32]; char clk_name[32];
struct clk *clock; struct clk *clock;
int i, ret = 0; int i, ret = 0;
...@@ -1145,16 +976,12 @@ static int fimc_md_get_clocks(struct fimc_md *fmd) ...@@ -1145,16 +976,12 @@ static int fimc_md_get_clocks(struct fimc_md *fmd)
for (i = 0; i < FIMC_MAX_CAMCLKS; i++) for (i = 0; i < FIMC_MAX_CAMCLKS; i++)
fmd->camclk[i].clock = ERR_PTR(-EINVAL); fmd->camclk[i].clock = ERR_PTR(-EINVAL);
if (fmd->pdev->dev.of_node)
dev = &fmd->pdev->dev;
for (i = 0; i < FIMC_MAX_CAMCLKS; i++) { for (i = 0; i < FIMC_MAX_CAMCLKS; i++) {
snprintf(clk_name, sizeof(clk_name), "sclk_cam%u", i); snprintf(clk_name, sizeof(clk_name), "sclk_cam%u", i);
clock = clk_get(dev, clk_name); clock = clk_get(dev, clk_name);
if (IS_ERR(clock)) { if (IS_ERR(clock)) {
dev_err(&fmd->pdev->dev, "Failed to get clock: %s\n", dev_err(dev, "Failed to get clock: %s\n", clk_name);
clk_name);
ret = PTR_ERR(clock); ret = PTR_ERR(clock);
break; break;
} }
...@@ -1188,86 +1015,6 @@ static int fimc_md_get_clocks(struct fimc_md *fmd) ...@@ -1188,86 +1015,6 @@ static int fimc_md_get_clocks(struct fimc_md *fmd)
return ret; return ret;
} }
static int __fimc_md_set_camclk(struct fimc_md *fmd,
struct fimc_source_info *si,
bool on)
{
struct fimc_camclk_info *camclk;
int ret = 0;
/*
* When device tree is used the sensor drivers are supposed to
* control the clock themselves. This whole function will be
* removed once S5PV210 platform is converted to the device tree.
*/
if (fmd->pdev->dev.of_node)
return 0;
if (WARN_ON(si->clk_id >= FIMC_MAX_CAMCLKS) || !fmd || !fmd->pmf)
return -EINVAL;
camclk = &fmd->camclk[si->clk_id];
dbg("camclk %d, f: %lu, use_count: %d, on: %d",
si->clk_id, si->clk_frequency, camclk->use_count, on);
if (on) {
if (camclk->use_count > 0 &&
camclk->frequency != si->clk_frequency)
return -EINVAL;
if (camclk->use_count++ == 0) {
clk_set_rate(camclk->clock, si->clk_frequency);
camclk->frequency = si->clk_frequency;
ret = pm_runtime_get_sync(fmd->pmf);
if (ret < 0)
return ret;
ret = clk_prepare_enable(camclk->clock);
dbg("Enabled camclk %d: f: %lu", si->clk_id,
clk_get_rate(camclk->clock));
}
return ret;
}
if (WARN_ON(camclk->use_count == 0))
return 0;
if (--camclk->use_count == 0) {
clk_disable_unprepare(camclk->clock);
pm_runtime_put(fmd->pmf);
dbg("Disabled camclk %d", si->clk_id);
}
return ret;
}
/**
* fimc_md_set_camclk - peripheral sensor clock setup
* @sd: sensor subdev to configure sclk_cam clock for
* @on: 1 to enable or 0 to disable the clock
*
* There are 2 separate clock outputs available in the SoC for external
* image processors. These clocks are shared between all registered FIMC
* devices to which sensors can be attached, either directly or through
* the MIPI CSI receiver. The clock is allowed here to be used by
* multiple sensors concurrently if they use same frequency.
* This function should only be called when the graph mutex is held.
*/
int fimc_md_set_camclk(struct v4l2_subdev *sd, bool on)
{
struct fimc_source_info *si = v4l2_get_subdev_hostdata(sd);
struct fimc_md *fmd = entity_to_fimc_mdev(&sd->entity);
/*
* If there is a clock provider registered the sensors will
* handle their clock themselves, no need to control it on
* the host interface side.
*/
if (fmd->clk_provider.num_clocks > 0)
return 0;
return __fimc_md_set_camclk(fmd, si, on);
}
static int __fimc_md_modify_pipeline(struct media_entity *entity, bool enable) static int __fimc_md_modify_pipeline(struct media_entity *entity, bool enable)
{ {
struct exynos_video_entity *ve; struct exynos_video_entity *ve;
...@@ -1426,7 +1173,6 @@ static int fimc_md_get_pinctrl(struct fimc_md *fmd) ...@@ -1426,7 +1173,6 @@ static int fimc_md_get_pinctrl(struct fimc_md *fmd)
return 0; return 0;
} }
#ifdef CONFIG_OF
static int cam_clk_prepare(struct clk_hw *hw) static int cam_clk_prepare(struct clk_hw *hw)
{ {
struct cam_clk *camclk = to_cam_clk(hw); struct cam_clk *camclk = to_cam_clk(hw);
...@@ -1518,10 +1264,6 @@ static int fimc_md_register_clk_provider(struct fimc_md *fmd) ...@@ -1518,10 +1264,6 @@ static int fimc_md_register_clk_provider(struct fimc_md *fmd)
fimc_md_unregister_clk_provider(fmd); fimc_md_unregister_clk_provider(fmd);
return ret; return ret;
} }
#else
#define fimc_md_register_clk_provider(fmd) (0)
#define fimc_md_unregister_clk_provider(fmd)
#endif
static int subdev_notifier_bound(struct v4l2_async_notifier *notifier, static int subdev_notifier_bound(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *subdev, struct v4l2_subdev *subdev,
...@@ -1585,8 +1327,8 @@ static int fimc_md_probe(struct platform_device *pdev) ...@@ -1585,8 +1327,8 @@ static int fimc_md_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
spin_lock_init(&fmd->slock); spin_lock_init(&fmd->slock);
fmd->pdev = pdev;
INIT_LIST_HEAD(&fmd->pipelines); INIT_LIST_HEAD(&fmd->pipelines);
fmd->pdev = pdev;
strlcpy(fmd->media_dev.model, "SAMSUNG S5P FIMC", strlcpy(fmd->media_dev.model, "SAMSUNG S5P FIMC",
sizeof(fmd->media_dev.model)); sizeof(fmd->media_dev.model));
...@@ -1599,6 +1341,7 @@ static int fimc_md_probe(struct platform_device *pdev) ...@@ -1599,6 +1341,7 @@ static int fimc_md_probe(struct platform_device *pdev)
strlcpy(v4l2_dev->name, "s5p-fimc-md", sizeof(v4l2_dev->name)); strlcpy(v4l2_dev->name, "s5p-fimc-md", sizeof(v4l2_dev->name));
fmd->use_isp = fimc_md_is_isp_available(dev->of_node); fmd->use_isp = fimc_md_is_isp_available(dev->of_node);
fmd->user_subdev_api = true;
ret = v4l2_device_register(dev, &fmd->v4l2_dev); ret = v4l2_device_register(dev, &fmd->v4l2_dev);
if (ret < 0) { if (ret < 0) {
...@@ -1616,8 +1359,6 @@ static int fimc_md_probe(struct platform_device *pdev) ...@@ -1616,8 +1359,6 @@ static int fimc_md_probe(struct platform_device *pdev)
if (ret) if (ret)
goto err_md; goto err_md;
fmd->user_subdev_api = (dev->of_node != NULL);
ret = fimc_md_get_pinctrl(fmd); ret = fimc_md_get_pinctrl(fmd);
if (ret < 0) { if (ret < 0) {
if (ret != EPROBE_DEFER) if (ret != EPROBE_DEFER)
...@@ -1630,22 +1371,16 @@ static int fimc_md_probe(struct platform_device *pdev) ...@@ -1630,22 +1371,16 @@ static int fimc_md_probe(struct platform_device *pdev)
/* Protect the media graph while we're registering entities */ /* Protect the media graph while we're registering entities */
mutex_lock(&fmd->media_dev.graph_mutex); mutex_lock(&fmd->media_dev.graph_mutex);
if (dev->of_node) ret = fimc_md_register_platform_entities(fmd, dev->of_node);
ret = fimc_md_register_of_platform_entities(fmd, dev->of_node);
else
ret = bus_for_each_dev(&platform_bus_type, NULL, fmd,
fimc_md_pdev_match);
if (ret) { if (ret) {
mutex_unlock(&fmd->media_dev.graph_mutex); mutex_unlock(&fmd->media_dev.graph_mutex);
goto err_clk; goto err_clk;
} }
if (dev->platform_data || dev->of_node) { ret = fimc_md_register_sensor_entities(fmd);
ret = fimc_md_register_sensor_entities(fmd); if (ret) {
if (ret) { mutex_unlock(&fmd->media_dev.graph_mutex);
mutex_unlock(&fmd->media_dev.graph_mutex); goto err_m_ent;
goto err_m_ent;
}
} }
mutex_unlock(&fmd->media_dev.graph_mutex); mutex_unlock(&fmd->media_dev.graph_mutex);
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <media/media-entity.h> #include <media/media-entity.h>
#include <media/v4l2-device.h> #include <media/v4l2-device.h>
#include <media/v4l2-subdev.h> #include <media/v4l2-subdev.h>
#include <media/s5p_fimc.h> #include <media/exynos-fimc.h>
#include "fimc-core.h" #include "fimc-core.h"
#include "fimc-lite.h" #include "fimc-lite.h"
...@@ -94,9 +94,7 @@ struct fimc_sensor_info { ...@@ -94,9 +94,7 @@ struct fimc_sensor_info {
}; };
struct cam_clk { struct cam_clk {
#ifdef CONFIG_COMMON_CLK
struct clk_hw hw; struct clk_hw hw;
#endif
struct fimc_md *fmd; struct fimc_md *fmd;
}; };
#define to_cam_clk(_hw) container_of(_hw, struct cam_clk, hw) #define to_cam_clk(_hw) container_of(_hw, struct cam_clk, hw)
...@@ -144,9 +142,7 @@ struct fimc_md { ...@@ -144,9 +142,7 @@ struct fimc_md {
struct cam_clk_provider { struct cam_clk_provider {
struct clk *clks[FIMC_MAX_CAMCLKS]; struct clk *clks[FIMC_MAX_CAMCLKS];
#ifdef CONFIG_COMMON_CLK
struct clk_onecell_data clk_data; struct clk_onecell_data clk_data;
#endif
struct device_node *of_node; struct device_node *of_node;
struct cam_clk camclk[FIMC_MAX_CAMCLKS]; struct cam_clk camclk[FIMC_MAX_CAMCLKS];
int num_clocks; int num_clocks;
......
...@@ -22,14 +22,13 @@ ...@@ -22,14 +22,13 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_graph.h> #include <linux/of_graph.h>
#include <linux/phy/phy.h> #include <linux/phy/phy.h>
#include <linux/platform_data/mipi-csis.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/videodev2.h> #include <linux/videodev2.h>
#include <media/s5p_fimc.h> #include <media/exynos-fimc.h>
#include <media/v4l2-of.h> #include <media/v4l2-of.h>
#include <media/v4l2-subdev.h> #include <media/v4l2-subdev.h>
...@@ -730,26 +729,6 @@ static irqreturn_t s5pcsis_irq_handler(int irq, void *dev_id) ...@@ -730,26 +729,6 @@ static irqreturn_t s5pcsis_irq_handler(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int s5pcsis_get_platform_data(struct platform_device *pdev,
struct csis_state *state)
{
struct s5p_platform_mipi_csis *pdata = pdev->dev.platform_data;
if (pdata == NULL) {
dev_err(&pdev->dev, "Platform data not specified\n");
return -EINVAL;
}
state->clk_frequency = pdata->clk_rate;
state->num_lanes = pdata->lanes;
state->hs_settle = pdata->hs_settle;
state->index = max(0, pdev->id);
state->max_num_lanes = state->index ? CSIS1_MAX_LANES :
CSIS0_MAX_LANES;
return 0;
}
#ifdef CONFIG_OF
static int s5pcsis_parse_dt(struct platform_device *pdev, static int s5pcsis_parse_dt(struct platform_device *pdev,
struct csis_state *state) struct csis_state *state)
{ {
...@@ -787,9 +766,6 @@ static int s5pcsis_parse_dt(struct platform_device *pdev, ...@@ -787,9 +766,6 @@ static int s5pcsis_parse_dt(struct platform_device *pdev,
return 0; return 0;
} }
#else
#define s5pcsis_parse_dt(pdev, state) (-ENOSYS)
#endif
static int s5pcsis_pm_resume(struct device *dev, bool runtime); static int s5pcsis_pm_resume(struct device *dev, bool runtime);
static const struct of_device_id s5pcsis_of_match[]; static const struct of_device_id s5pcsis_of_match[];
...@@ -812,19 +788,14 @@ static int s5pcsis_probe(struct platform_device *pdev) ...@@ -812,19 +788,14 @@ static int s5pcsis_probe(struct platform_device *pdev)
spin_lock_init(&state->slock); spin_lock_init(&state->slock);
state->pdev = pdev; state->pdev = pdev;
if (dev->of_node) { of_id = of_match_node(s5pcsis_of_match, dev->of_node);
of_id = of_match_node(s5pcsis_of_match, dev->of_node); if (WARN_ON(of_id == NULL))
if (WARN_ON(of_id == NULL)) return -EINVAL;
return -EINVAL;
drv_data = of_id->data;
state->interrupt_mask = drv_data->interrupt_mask;
ret = s5pcsis_parse_dt(pdev, state); drv_data = of_id->data;
} else { state->interrupt_mask = drv_data->interrupt_mask;
ret = s5pcsis_get_platform_data(pdev, state);
}
ret = s5pcsis_parse_dt(pdev, state);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
/*
* Copyright (C) 2010 - 2012 Samsung Electronics Co., Ltd.
*
* Samsung S5P/Exynos SoC series MIPI CSIS device support
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __PLAT_SAMSUNG_MIPI_CSIS_H_
#define __PLAT_SAMSUNG_MIPI_CSIS_H_ __FILE__
/**
* struct s5p_platform_mipi_csis - platform data for S5P MIPI-CSIS driver
* @clk_rate: bus clock frequency
* @wclk_source: CSI wrapper clock selection: 0 - bus clock, 1 - ext. SCLK_CAM
* @lanes: number of data lanes used
* @hs_settle: HS-RX settle time
*/
struct s5p_platform_mipi_csis {
unsigned long clk_rate;
u8 wclk_source;
u8 lanes;
u8 hs_settle;
};
#endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */
...@@ -61,41 +61,20 @@ enum fimc_bus_type { ...@@ -61,41 +61,20 @@ enum fimc_bus_type {
#define GRP_ID_FLITE (1 << 13) #define GRP_ID_FLITE (1 << 13)
#define GRP_ID_FIMC_IS (1 << 14) #define GRP_ID_FIMC_IS (1 << 14)
struct i2c_board_info;
/** /**
* struct fimc_source_info - video source description required for the host * struct fimc_source_info - video source description required for the host
* interface configuration * interface configuration
* *
* @board_info: pointer to I2C subdevice's board info
* @clk_frequency: frequency of the clock the host interface provides to sensor
* @fimc_bus_type: FIMC camera input type * @fimc_bus_type: FIMC camera input type
* @sensor_bus_type: image sensor bus type, MIPI, ITU-R BT.601 etc. * @sensor_bus_type: image sensor bus type, MIPI, ITU-R BT.601 etc.
* @flags: the parallel sensor bus flags defining signals polarity (V4L2_MBUS_*) * @flags: the parallel sensor bus flags defining signals polarity (V4L2_MBUS_*)
* @i2c_bus_num: i2c control bus id the sensor is attached to
* @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU) * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU)
* @clk_id: index of the SoC peripheral clock for sensors
*/ */
struct fimc_source_info { struct fimc_source_info {
struct i2c_board_info *board_info;
unsigned long clk_frequency;
enum fimc_bus_type fimc_bus_type; enum fimc_bus_type fimc_bus_type;
enum fimc_bus_type sensor_bus_type; enum fimc_bus_type sensor_bus_type;
u16 flags; u16 flags;
u16 i2c_bus_num;
u16 mux_id; u16 mux_id;
u8 clk_id;
};
/**
* struct s5p_platform_fimc - camera host interface platform data
*
* @source_info: properties of an image source for the host interface setup
* @num_clients: the number of attached image sources
*/
struct s5p_platform_fimc {
struct fimc_source_info *source_info;
int num_clients;
}; };
/* /*
......
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