Skip to contentSkip to conversation

Exynos4 SoC camera subsystem driver cleanups

PATCH Superseded Sylwester Nawrocki 3 participants 10 messages Apr 15, 2014 – May 8, 2014 2 messages not in the archive

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Exynos4 SoC camera subsystem driver cleanups

This patch series removes support for non-dt platforms from the Exynos4/S5P SoC camera interface drivers and removes (ab)use of "simple-bus" compatible string.

Sylwester Nawrocki (5):
ARM: S5PV210: Remove camera support from mach-goni.c
exynos4-is: Fix compilation for !CONFIG_COMMON_CLK
exynos4-is: Remove support for non-dt platforms
exynos4-is: Remove requirement for "simple-bus" compatible
ARM: dts: exynos4: Remove simple-bus compatible from camera subsystem
nodes

 .../devicetree/bindings/media/samsung-fimc.txt     |    6 +-
 Documentation/video4linux/fimc.txt                 |   30 --
 MAINTAINERS                                        |    1 -
 arch/arm/boot/dts/exynos4.dtsi                     |    2 +-
 arch/arm/boot/dts/exynos4x12.dtsi                  |    2 +-
 arch/arm/mach-s5pv210/mach-goni.c                  |   51 ---
 drivers/media/platform/exynos4-is/Kconfig          |    3 +-
 drivers/media/platform/exynos4-is/common.c         |   49 ++-
 drivers/media/platform/exynos4-is/common.h         |    6 +-
 drivers/media/platform/exynos4-is/fimc-core.h      |    2 +-
 drivers/media/platform/exynos4-is/fimc-is.c        |   12 +-
 drivers/media/platform/exynos4-is/fimc-isp-video.c |    2 +-
 drivers/media/platform/exynos4-is/fimc-isp.h       |    2 +-
 drivers/media/platform/exynos4-is/fimc-lite-reg.c  |    2 +-
 drivers/media/platform/exynos4-is/fimc-lite.c      |    2 +-
 drivers/media/platform/exynos4-is/fimc-lite.h      |    2 +-
 drivers/media/platform/exynos4-is/fimc-reg.c       |    2 +-
 drivers/media/platform/exynos4-is/media-dev.c      |  356 +++-----------------
 drivers/media/platform/exynos4-is/media-dev.h      |    2 +-
 drivers/media/platform/exynos4-is/mipi-csis.c      |   43 +--
 include/linux/platform_data/mipi-csis.h            |   28 --
 include/media/{s5p_fimc.h => exynos-fimc.h}        |   21 --
 22 files changed, 138 insertions(+), 488 deletions(-)
 delete mode 100644 include/linux/platform_data/mipi-csis.h
 rename include/media/{s5p_fimc.h => exynos-fimc.h} (87%)

--
1.7.9.5

#1 lore raw

PATCH 1/5 ARM: S5PV210: Remove camera support from mach-goni.c

S5PV210 is going to get DT support, so we can remove the camera bits from the only board using camera on S5PV210. This allows to clean the exynos4-is driver by dropping code for non-dt platforms. This patch can be dropped if a patch removing the whole board file is applied first.

---
 arch/arm/mach-s5pv210/mach-goni.c |   51 -------------------------------------
 1 file changed, 51 deletions(-)
arch/arm/mach-s5pv210/mach-goni.c +0 -51
index b41a38a..6c719ec 100644
@@ -49,11 +49,6 @@
 #include <plat/clock.h>
 #include <plat/samsung-time.h>
 #include <plat/mfc.h>
-#include <plat/camport.h>
-
-#include <media/v4l2-mediabus.h>
-#include <media/s5p_fimc.h>
-#include <media/noon010pc30.h>
 
 #include "common.h"
 
@@ -285,14 +280,6 @@ static void __init goni_tsp_init(void)
 /* USB OTG */
 static struct s3c_hsotg_plat goni_hsotg_pdata;
 
-static void goni_camera_init(void)
-{
-	s5pv210_fimc_setup_gpio(S5P_CAMPORT_A);
-
-	/* Set max driver strength on CAM_A_CLKOUT pin. */
-	s5p_gpio_set_drvstr(S5PV210_GPE1(3), S5P_GPIO_DRVSTR_LV4);
-}
-
 /* MAX8998 regulators */
 #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
 
@@ -825,34 +812,6 @@ static void goni_setup_sdhci(void)
 	s3c_sdhci2_set_platdata(&goni_hsmmc2_data);
 };
 
-static struct noon010pc30_platform_data noon010pc30_pldata = {
-	.clk_rate	= 16000000UL,
-	.gpio_nreset	= S5PV210_GPB(2), /* CAM_CIF_NRST */
-	.gpio_nstby	= S5PV210_GPB(0), /* CAM_CIF_NSTBY */
-};
-
-static struct i2c_board_info noon010pc30_board_info = {
-	I2C_BOARD_INFO("NOON010PC30", 0x60 >> 1),
-	.platform_data = &noon010pc30_pldata,
-};
-
-static struct fimc_source_info goni_camera_sensors[] = {
-	{
-		.mux_id		= 0,
-		.flags		= V4L2_MBUS_PCLK_SAMPLE_FALLING |
-				  V4L2_MBUS_VSYNC_ACTIVE_LOW,
-		.fimc_bus_type	= FIMC_BUS_TYPE_ITU_601,
-		.board_info	= &noon010pc30_board_info,
-		.i2c_bus_num	= 0,
-		.clk_frequency	= 16000000UL,
-	},
-};
-
-static struct s5p_platform_fimc goni_fimc_md_platdata __initdata = {
-	.source_info	= goni_camera_sensors,
-	.num_clients	= ARRAY_SIZE(goni_camera_sensors),
-};
-
 /* Audio device */
 static struct platform_device goni_device_audio = {
 	.name = "smdk-audio",
@@ -874,10 +833,6 @@ static struct platform_device *goni_devices[] __initdata = {
 	&s5p_device_mixer,
 	&s5p_device_sdo,
 	&s3c_device_i2c0,
-	&s5p_device_fimc0,
-	&s5p_device_fimc1,
-	&s5p_device_fimc2,
-	&s5p_device_fimc_md,
 	&s3c_device_hsmmc0,
 	&s3c_device_hsmmc1,
 	&s3c_device_hsmmc2,
@@ -946,14 +901,8 @@ static void __init goni_machine_init(void)
 	/* FB */
 	s3c_fb_set_platdata(&goni_lcd_pdata);
 
-	/* FIMC */
-	s3c_set_platdata(&goni_fimc_md_platdata, sizeof(goni_fimc_md_platdata),
-			 &s5p_device_fimc_md);
-
 	s3c_hsotg_set_platdata(&goni_hsotg_pdata);
 
-	goni_camera_init();
-
 	/* SPI */
 	spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
 
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/5 ARM: S5PV210: Remove camera support from mach-goni.c

Quoted 9 lines · Sylwester Nawrocki

S5PV210 is going to get DT support, so we can remove the camera bits from the only board using camera on S5PV210. This allows to clean the exynos4-is driver by dropping code for non-dt platforms. This patch can be dropped if a patch removing the whole board file is applied first.

Hi Sylwester,

Cleanup is always welcome ;-)

I think, when this series is ready for mainline, this will be handled in media tree. So,

Thanks,
Kukjin

Quoted 2 lines
---
 arch/arm/mach-s5pv210/mach-goni.c |   51

---------------------------------

Quoted 101 lines

----

 1 file changed, 51 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-s5pv210/mach-goni.c +0 -0

s5pv210/mach-goni.c
index b41a38a..6c719ec 100644

arch/arm/mach-s5pv210/mach-goni.c +0 -45
@@ -49,11 +49,6 @@
 #include <plat/clock.h>
 #include <plat/samsung-time.h>
 #include <plat/mfc.h>
-#include <plat/camport.h>
-
-#include <media/v4l2-mediabus.h>
-#include <media/s5p_fimc.h>
-#include <media/noon010pc30.h>
 
 #include "common.h"
 
@@ -285,14 +280,6 @@ static void __init goni_tsp_init(void)
 /* USB OTG */
 static struct s3c_hsotg_plat goni_hsotg_pdata;
 
-static void goni_camera_init(void)
-{
-	s5pv210_fimc_setup_gpio(S5P_CAMPORT_A);
-
-	/* Set max driver strength on CAM_A_CLKOUT pin. */
-	s5p_gpio_set_drvstr(S5PV210_GPE1(3), S5P_GPIO_DRVSTR_LV4);
-}
-
 /* MAX8998 regulators */
 #if defined(CONFIG_REGULATOR_MAX8998) ||
 defined(CONFIG_REGULATOR_MAX8998_MODULE)
@@ -825,34 +812,6 @@ static void goni_setup_sdhci(void)
 	s3c_sdhci2_set_platdata(&goni_hsmmc2_data);
 };
 
-static struct noon010pc30_platform_data noon010pc30_pldata = {
-	.clk_rate	= 16000000UL,
-	.gpio_nreset	= S5PV210_GPB(2), /* CAM_CIF_NRST */
-	.gpio_nstby	= S5PV210_GPB(0), /* CAM_CIF_NSTBY */
-};
-
-static struct i2c_board_info noon010pc30_board_info = {
-	I2C_BOARD_INFO("NOON010PC30", 0x60 >> 1),
-	.platform_data = &noon010pc30_pldata,
-};
-
-static struct fimc_source_info goni_camera_sensors[] = {
-	{
-		.mux_id		= 0,
-		.flags		= V4L2_MBUS_PCLK_SAMPLE_FALLING |
-				  V4L2_MBUS_VSYNC_ACTIVE_LOW,
-		.fimc_bus_type	= FIMC_BUS_TYPE_ITU_601,
-		.board_info	= &noon010pc30_board_info,
-		.i2c_bus_num	= 0,
-		.clk_frequency	= 16000000UL,
-	},
-};
-
-static struct s5p_platform_fimc goni_fimc_md_platdata __initdata = {
-	.source_info	= goni_camera_sensors,
-	.num_clients	= ARRAY_SIZE(goni_camera_sensors),
-};
-
 /* Audio device */
 static struct platform_device goni_device_audio = {
 	.name = "smdk-audio",
@@ -874,10 +833,6 @@ static struct platform_device *goni_devices[]
 __initdata = {
 	&s5p_device_mixer,
 	&s5p_device_sdo,
 	&s3c_device_i2c0,
-	&s5p_device_fimc0,
-	&s5p_device_fimc1,
-	&s5p_device_fimc2,
-	&s5p_device_fimc_md,
 	&s3c_device_hsmmc0,
 	&s3c_device_hsmmc1,
arch/arm/mach-s5pv210/mach-goni.c +0 -7
 	&s3c_device_hsmmc2,
@@ -946,14 +901,8 @@ static void __init goni_machine_init(void)
 	/* FB */
 	s3c_fb_set_platdata(&goni_lcd_pdata);
 
-	/* FIMC */
-	s3c_set_platdata(&goni_fimc_md_platdata,
 sizeof(goni_fimc_md_platdata),
-			 &s5p_device_fimc_md);
-
 	s3c_hsotg_set_platdata(&goni_hsotg_pdata);
 
-	goni_camera_init();
-
 	/* SPI */
 	spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
 
--

1.7.9.5

#3 lore raw

PATCH 1/5 ARM: S5PV210: Remove camera support from mach-goni.c

Quoted 11 lines · Kukjin Kim
Quoted 9 lines · Sylwester Nawrocki
Quoted 9 lines

S5PV210 is going to get DT support, so we can remove the camera bits from the only board using camera on S5PV210. This allows to clean the exynos4-is driver by dropping code for non-dt platforms. This patch can be dropped if a patch removing the whole board file is applied first.

Quoted 8 lines

Hi Sylwester,

Cleanup is always welcome ;-)

I think, when this series is ready for mainline, this will be handled in media tree. So,

Hi Kukjin,

Thank you, patch queued up for the media tree!

--
Regards,
Sylwester

#4 lore raw

PATCH 2/5 exynos4-is: Fix compilation for !CONFIG_COMMON_CLK

In reply to Sylwester Nawrocki

CONFIG_COMMON_CLK is not enabled on S5PV210 platform, so include some clk API data structures conditionally to avoid compilation errors. These #ifdefs will be removed for next kernel release, when the S5PV210 platform moves to DT and the common clk API.

---
 drivers/media/platform/exynos4-is/media-dev.c |    2 +-
 drivers/media/platform/exynos4-is/media-dev.h |    4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/media/platform/exynos4-is/media-dev.c +1 -1
index 2a2d42e..002abbf 100644
@@ -1523,7 +1523,7 @@ err:
 }
 #else
 #define fimc_md_register_clk_provider(fmd) (0)
-#define fimc_md_unregister_clk_provider(fmd) (0)
+#define fimc_md_unregister_clk_provider(fmd)
 #endif
 
 static int subdev_notifier_bound(struct v4l2_async_notifier *notifier,
drivers/media/platform/exynos4-is/media-dev.h +4 -0
index ee1e251..58c4945 100644
@@ -94,7 +94,9 @@ struct fimc_sensor_info {
 };
 
 struct cam_clk {
+#ifdef CONFIG_COMMON_CLK
 	struct clk_hw hw;
+#endif
 	struct fimc_md *fmd;
 };
 #define to_cam_clk(_hw) container_of(_hw, struct cam_clk, hw)
@@ -142,7 +144,9 @@ struct fimc_md {
 
 	struct cam_clk_provider {
 		struct clk *clks[FIMC_MAX_CAMCLKS];
+#ifdef CONFIG_COMMON_CLK
 		struct clk_onecell_data clk_data;
+#endif
 		struct device_node *of_node;
 		struct cam_clk camclk[FIMC_MAX_CAMCLKS];
 		int num_clocks;
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 3/5 exynos4-is: Remove support for non-dt platforms

In reply to Sylwester Nawrocki

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.

---
 Documentation/video4linux/fimc.txt                 |   30 --
 MAINTAINERS                                        |    1 -
 drivers/media/platform/exynos4-is/Kconfig          |    3 +-
 drivers/media/platform/exynos4-is/common.c         |    2 +-
 drivers/media/platform/exynos4-is/fimc-core.h      |    2 +-
 drivers/media/platform/exynos4-is/fimc-isp-video.c |    2 +-
 drivers/media/platform/exynos4-is/fimc-isp.h       |    2 +-
 drivers/media/platform/exynos4-is/fimc-lite-reg.c  |    2 +-
 drivers/media/platform/exynos4-is/fimc-lite.c      |    2 +-
 drivers/media/platform/exynos4-is/fimc-lite.h      |    2 +-
 drivers/media/platform/exynos4-is/fimc-reg.c       |    2 +-
 drivers/media/platform/exynos4-is/media-dev.c      |  329 ++------------------
 drivers/media/platform/exynos4-is/media-dev.h      |    6 +-
 drivers/media/platform/exynos4-is/mipi-csis.c      |   43 +--
 include/linux/platform_data/mipi-csis.h            |   28 --
 include/media/{s5p_fimc.h => exynos-fimc.h}        |   21 --
 16 files changed, 50 insertions(+), 427 deletions(-)
 delete mode 100644 include/linux/platform_data/mipi-csis.h
 rename include/media/{s5p_fimc.h => exynos-fimc.h} (87%)
Documentation/video4linux/fimc.txt +0 -30
index 7d6e160..e0c6b8b 100644
@@ -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:
 # 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
 ========
 
-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)
 two modules are created (in addition to the core v4l2 modules): s5p-fimc.ko and
 optional s5p-csis.ko (MIPI-CSI receiver subdev).
MAINTAINERS +0 -1
index 6dc67b1..e2f5dfe 100644
@@ -7641,7 +7641,6 @@ L:	linux-media at vger.kernel.org
 Q:	https://patchwork.linuxtv.org/project/linux-media/list/
 S:	Supported
 F:	drivers/media/platform/exynos4-is/
-F:	include/media/s5p_fimc.h
 
 SAMSUNG S3C24XX/S3C64XX SOC SERIES CAMIF DRIVER
 M:	Sylwester Nawrocki <[email protected]>
drivers/media/platform/exynos4-is/Kconfig +2 -1
index e1b2ceb..5dcaa0a 100644
@@ -3,6 +3,7 @@ config VIDEO_SAMSUNG_EXYNOS4_IS
 	bool "Samsung S5P/EXYNOS4 SoC series Camera Subsystem driver"
 	depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
 	depends on (PLAT_S5P || ARCH_EXYNOS)
+	depends on OF && COMMON_CLK
 	help
 	  Say Y here to enable camera host interface devices for
 	  Samsung S5P and EXYNOS SoC series.
@@ -17,7 +18,7 @@ config VIDEO_S5P_FIMC
 	depends on I2C
 	select VIDEOBUF2_DMA_CONTIG
 	select V4L2_MEM2MEM_DEV
-	select MFD_SYSCON if OF
+	select MFD_SYSCON
 	select VIDEO_EXYNOS4_IS_COMMON
 	help
 	  This is a V4L2 driver for Samsung S5P and EXYNOS4 SoC camera host
drivers/media/platform/exynos4-is/common.c +1 -1
index 0ec210b..0eb34ec 100644
@@ -10,7 +10,7 @@
  */
 
 #include <linux/module.h>
-#include <media/s5p_fimc.h>
+#include <media/exynos-fimc.h>
 #include "common.h"
 
 /* Called with the media graph mutex held or entity->stream_count > 0. */
drivers/media/platform/exynos4-is/fimc-core.h +1 -1
index 1790fb4..6c75c6c 100644
@@ -27,7 +27,7 @@
 #include <media/v4l2-device.h>
 #include <media/v4l2-mem2mem.h>
 #include <media/v4l2-mediabus.h>
-#include <media/s5p_fimc.h>
+#include <media/exynos-fimc.h>
 
 #define dbg(fmt, args...) \
 	pr_debug("%s:%d: " fmt "\n", __func__, __LINE__, ##args)
drivers/media/platform/exynos4-is/fimc-isp-video.c +1 -1
index e92b4e1..3846613 100644
@@ -30,7 +30,7 @@
 #include <media/v4l2-ioctl.h>
 #include <media/videobuf2-core.h>
 #include <media/videobuf2-dma-contig.h>
-#include <media/s5p_fimc.h>
+#include <media/exynos-fimc.h>
 
 #include "common.h"
 #include "media-dev.h"
drivers/media/platform/exynos4-is/fimc-isp.h +1 -1
index 4dc55a1..b99be09 100644
@@ -24,7 +24,7 @@
 #include <media/videobuf2-core.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-mediabus.h>
-#include <media/s5p_fimc.h>
+#include <media/exynos-fimc.h>
 
 extern int fimc_isp_debug;
 
drivers/media/platform/exynos4-is/fimc-lite-reg.c +1 -1
index d0dc7ee..bc3ec7d 100644
@@ -12,7 +12,7 @@
 #include <linux/bitops.h>
 #include <linux/delay.h>
 #include <linux/io.h>
-#include <media/s5p_fimc.h>
+#include <media/exynos-fimc.h>
 
 #include "fimc-lite-reg.h"
 #include "fimc-lite.h"
drivers/media/platform/exynos4-is/fimc-lite.c +1 -1
index 3ad660b..9527e36 100644
@@ -30,7 +30,7 @@
 #include <media/v4l2-mem2mem.h>
 #include <media/videobuf2-core.h>
 #include <media/videobuf2-dma-contig.h>
-#include <media/s5p_fimc.h>
+#include <media/exynos-fimc.h>
 
 #include "common.h"
 #include "fimc-core.h"
drivers/media/platform/exynos4-is/fimc-lite.h +1 -1
index 7428b2d..ea19dc7 100644
@@ -23,7 +23,7 @@
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.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 FLITE_CLK_NAME		"flite"
drivers/media/platform/exynos4-is/fimc-reg.c +1 -1
index 1db8cb4..2d77fd8 100644
@@ -13,7 +13,7 @@
 #include <linux/io.h>
 #include <linux/regmap.h>
 
-#include <media/s5p_fimc.h>
+#include <media/exynos-fimc.h>
 #include "media-dev.h"
 
 #include "fimc-reg.h"
drivers/media/platform/exynos4-is/media-dev.c +32 -297

500 lines not on this page · raw message

drivers/media/platform/exynos4-is/media-dev.h +1 -5
index 58c4945..0321454 100644
@@ -19,7 +19,7 @@
 #include <media/media-entity.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-subdev.h>
-#include <media/s5p_fimc.h>
+#include <media/exynos-fimc.h>
 
 #include "fimc-core.h"
 #include "fimc-lite.h"
@@ -94,9 +94,7 @@ struct fimc_sensor_info {
 };
 
 struct cam_clk {
-#ifdef CONFIG_COMMON_CLK
 	struct clk_hw hw;
-#endif
 	struct fimc_md *fmd;
 };
 #define to_cam_clk(_hw) container_of(_hw, struct cam_clk, hw)
@@ -144,9 +142,7 @@ struct fimc_md {
 
 	struct cam_clk_provider {
 		struct clk *clks[FIMC_MAX_CAMCLKS];
-#ifdef CONFIG_COMMON_CLK
 		struct clk_onecell_data clk_data;
-#endif
 		struct device_node *of_node;
 		struct cam_clk camclk[FIMC_MAX_CAMCLKS];
 		int num_clocks;
drivers/media/platform/exynos4-is/mipi-csis.c +7 -36

75 lines not on this page · raw message

include/linux/platform_data/mipi-csis.h deleted +0 -28
deleted file mode 100644
index c2fd902..0000000
@@ -1,28 +0,0 @@
-/*
- * 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_ */
include/media/exynos-fimc.h renamed from include/media/s5p_fimc.h +0 -21
similarity index 87%
rename from include/media/s5p_fimc.h
rename to include/media/exynos-fimc.h
index b975c28..aa44660 100644
@@ -61,41 +61,20 @@ enum fimc_bus_type {
 #define GRP_ID_FLITE		(1 << 13)
 #define GRP_ID_FIMC_IS		(1 << 14)
 
-struct i2c_board_info;
-
 /**
  * struct fimc_source_info - video source description required for the host
  *			     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
  * @sensor_bus_type: image sensor bus type, MIPI, ITU-R BT.601 etc.
  * @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)
- * @clk_id: index of the SoC peripheral clock for sensors
  */
 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 sensor_bus_type;
 	u16 flags;
-	u16 i2c_bus_num;
 	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;
 };
 
 /*
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 4/5 exynos4-is: Remove requirement for "simple-bus" compatible

In reply to Sylwester Nawrocki

This patch makes the driver instantiating its child devices itself, rather than relying on an OS to instantiate devices as children of "simple-bus". This removes an incorrect usage of "simple-bus" compatible.

---
This patch addresses Mark's review comments:
https://patchwork.linuxtv.org/patch/23008/

---
 .../devicetree/bindings/media/samsung-fimc.txt     |    6 +--
 drivers/media/platform/exynos4-is/common.c         |   47 +++++++++++++++++++-
 drivers/media/platform/exynos4-is/common.h         |    6 ++-
 drivers/media/platform/exynos4-is/fimc-is.c        |   12 ++++-
 drivers/media/platform/exynos4-is/media-dev.c      |   33 ++++++++++----
 5 files changed, 89 insertions(+), 15 deletions(-)
Documentation/devicetree/bindings/media/samsung-fimc.txt +3 -3
index 922d6f8..8ce5984 100644
@@ -15,9 +15,9 @@ Common 'camera' node
 
 Required properties:
 
-- compatible: must be "samsung,fimc", "simple-bus"
+- compatible: should be "samsung,fimc",
 - clocks: list of clock specifiers, corresponding to entries in
-  the clock-names property;
+  the clock-names property,
 - clock-names : must contain "sclk_cam0", "sclk_cam1", "pxl_async0",
   "pxl_async1" entries, matching entries in the clocks property.
 
@@ -157,7 +157,7 @@ Example:
 	};
 
 	camera {
-		compatible = "samsung,fimc", "simple-bus";
+		compatible = "samsung,fimc";
 		clocks = <&clock 132>, <&clock 133>, <&clock 351>,
 			 <&clock 352>;
 		clock-names = "sclk_cam0", "sclk_cam1", "pxl_async0",
drivers/media/platform/exynos4-is/common.c +46 -1

63 lines not on this page · raw message

drivers/media/platform/exynos4-is/common.h +5 -1
index 75b9c71..1d06715 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Samsung Electronics Co., Ltd.
+ * Copyright (C) 2013 - 2014 Samsung Electronics Co., Ltd.
  *
  * 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
@@ -14,3 +14,7 @@
 struct v4l2_subdev *fimc_find_remote_sensor(struct media_entity *entity);
 void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap,
 			    unsigned int caps);
+struct platform_device *fimc_register_child_device(struct device_node *child,
+						   struct device *parent);
+int fimc_register_child_devices(struct device *parent);
+void fimc_unregister_child_devices(struct device *parent);
drivers/media/platform/exynos4-is/fimc-is.c +10 -2
index a875090..05eab0f 100644
@@ -33,6 +33,7 @@
 #include <linux/videodev2.h>
 #include <media/videobuf2-dma-contig.h>
 
+#include "common.h"
 #include "media-dev.h"
 #include "fimc-is.h"
 #include "fimc-is-command.h"
@@ -201,6 +202,13 @@ static int fimc_is_register_subdevs(struct fimc_is *is)
 	struct device_node *i2c_bus, *child;
 	int ret, index = 0;
 
+	/* Create child devices (FIMC-LITE, I2C...) */
+	if (!of_device_is_compatible(is->pdev->dev.of_node, "simple-bus")) {
+		ret = fimc_register_child_devices(&is->pdev->dev);
+		if (ret < 0)
+			return ret;
+	}
+
 	ret = fimc_isp_subdev_create(&is->isp);
 	if (ret < 0)
 		return ret;
@@ -222,10 +230,10 @@ static int fimc_is_register_subdevs(struct fimc_is *is)
 	return 0;
 }
 
-static int fimc_is_unregister_subdevs(struct fimc_is *is)
+static void fimc_is_unregister_subdevs(struct fimc_is *is)
 {
 	fimc_isp_subdev_destroy(&is->isp);
-	return 0;
+	fimc_unregister_child_devices(&is->pdev->dev);
 }
 
 static int fimc_is_load_setfile(struct fimc_is *is, char *file_name)
drivers/media/platform/exynos4-is/media-dev.c +25 -8
index 0b64ec8..975063c 100644
@@ -33,6 +33,7 @@
 #include <media/media-device.h>
 #include <media/exynos-fimc.h>
 
+#include "common.h"
 #include "media-dev.h"
 #include "fimc-core.h"
 #include "fimc-is.h"
@@ -625,19 +626,28 @@ dev_unlock:
 }
 
 /* Register FIMC, FIMC-LITE and CSIS media entities */
-static int fimc_md_register_platform_entities(struct fimc_md *fmd,
-					      struct device_node *parent)
+static int fimc_md_register_platform_entities(struct fimc_md *fmd)
 {
+	struct device *parent = &fmd->pdev->dev;
+	bool create_devices = !of_device_is_compatible(parent->of_node,
+						       "simple-bus");
 	struct device_node *node;
 	int ret = 0;
 
-	for_each_available_child_of_node(parent, node) {
+	for_each_available_child_of_node(parent->of_node, node) {
 		struct platform_device *pdev;
 		int plat_entity = -1;
 
-		pdev = of_find_device_by_node(node);
-		if (!pdev)
-			continue;
+		if (create_devices) {
+			pdev = fimc_register_child_device(node, parent);
+			if (!pdev)
+				return -ENXIO;
+		} else {
+			/* For backward compatibility with old dtb only */
+			pdev = of_find_device_by_node(node);
+			if (!pdev)
+				continue;
+		}
 
 		/* If driver of any entity isn't ready try all again later. */
 		if (!strcmp(node->name, CSIS_OF_NODE_NAME))
@@ -653,7 +663,9 @@ static int fimc_md_register_platform_entities(struct fimc_md *fmd,
 		if (plat_entity >= 0)
 			ret = fimc_md_register_platform_entity(fmd, pdev,
 							plat_entity);
-		put_device(&pdev->dev);
+		if (!create_devices)
+			put_device(&pdev->dev);
+
 		if (ret < 0)
 			break;
 	}
@@ -690,6 +702,11 @@ static void fimc_md_unregister_entities(struct fimc_md *fmd)
 
 	if (fmd->fimc_is)
 		v4l2_device_unregister_subdev(&fmd->fimc_is->isp.subdev);
+	/*
+	 * Free any registered devices corresponding to the camera node
+	 * child nodes.
+	 */
+	fimc_unregister_child_devices(&fmd->pdev->dev);
 
 	v4l2_info(&fmd->v4l2_dev, "Unregistered all entities\n");
 }
@@ -1374,7 +1391,7 @@ static int fimc_md_probe(struct platform_device *pdev)
 	/* Protect the media graph while we're registering entities */
 	mutex_lock(&fmd->media_dev.graph_mutex);
 
-	ret = fimc_md_register_platform_entities(fmd, dev->of_node);
+	ret = fimc_md_register_platform_entities(fmd);
 	if (ret) {
 		mutex_unlock(&fmd->media_dev.graph_mutex);
 		goto err_clk;
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 4/5 exynos4-is: Remove requirement for "simple-bus" compatible

Quoted 4 lines · Sylwester Nawrocki

This patch makes the driver instantiating its child devices itself, rather than relying on an OS to instantiate devices as children of "simple-bus". This removes an incorrect usage of "simple-bus" compatible.

Good, but why can't you use of_platform_populate with the root being the "samsung,fimc" node? The code to instantiate the devices belongs in the core OF code.

Rob

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAL_JsqKH8o-0H4+2jv-6xh96Twh9UCXZV+LtmiUGHJmhUxCUVA@mail.gmail.com

#10 lore raw

PATCH 4/5 exynos4-is: Remove requirement for "simple-bus" compatible

(restoring the Cc list I cleared accidentally in previous reply)

Quoted 21 lines · Rob Herring
Quoted 12 lines · Sylwester Nawrocki
Quoted 10 lines · Rob Herring
Quoted 4 lines · Sylwester Nawrocki
Quoted 4 lines

This patch makes the driver instantiating its child devices itself, rather than relying on an OS to instantiate devices as children of "simple-bus". This removes an incorrect usage of "simple-bus" compatible.

Good, but why can't you use of_platform_populate with the root being the "samsung,fimc" node? The code to instantiate the devices belongs in the core OF code.

Quoted 6 lines

As I mentioned in other thread, I couldn't see anything like of_platform_unpopulate(), which would allow to destroy any created devices. I can't have of_platform_populate() called as last thing in probe() as some drivers do, so at least deferred probe works. Anyway, it wouldn't be a solution since on a driver removal the created devices must be unregistered.

Quoted 2 lines

I think the deferred probe will get fixed in 3.16, but I'm not following how deferred probe is relevant here.

What I meant was that when something fails in the middle of probe() callback and of_platform_populate() was already called any devices created by it must be destroyed before returning an error from probe(). And some drivers seem to never free their devices created by of_platform_populate().

Quoted 4 lines
Quoted 4 lines

I read through thread [1] and I didn't immediately have an idea how to fix the core OF code. So I thought I'd come up with this partial solution.

Quoted 8 lines
Quoted 4 lines

I was wondering if creating functions like of_platform_device_delete(), of_amba_device_delete() and a function that would walk device tree and call them would be a way to go ? I could spend some time on that, any suggestions would be appreciated.

I need to look at the other removal case, but perhaps the way you did using children of the struct device parent is the right way. I'm fine with that, but I just want to see this in the core code.

All right, I'll have a closer look then if it can be done that way.

Quoted 8 lines

Rob

Quoted 6 lines

--
Regards,
Sylwester

[1] http://www.spinics.net/lists/linux-omap/msg94484.html

--
Thanks,
Sylwester

#11 lore raw

PATCH 5/5 ARM: dts: exynos4: Remove simple-bus compatible from camera subsystem nodes

In reply to Sylwester Nawrocki

The usage of "simple-bus" was incorrect and the drivers now will also work without it so remove it.

---
 arch/arm/boot/dts/exynos4.dtsi    |    2 +-
 arch/arm/boot/dts/exynos4x12.dtsi |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/exynos4.dtsi +1 -1
index 912fe72..ad06a1d 100644
@@ -125,7 +125,7 @@
 	};
 
 	camera {
-		compatible = "samsung,fimc", "simple-bus";
+		compatible = "samsung,fimc";
 		status = "disabled";
 		#address-cells = <1>;
 		#size-cells = <1>;
arch/arm/boot/dts/exynos4x12.dtsi +1 -1
index 192617b..3fec920 100644
@@ -190,7 +190,7 @@
 		};
 
 		fimc_is: fimc-is at 12000000 {
-			compatible = "samsung,exynos4212-fimc-is", "simple-bus";
+			compatible = "samsung,exynos4212-fimc-is";
 			reg = <0x12000000 0x260000>;
 			interrupts = <0 90 0>, <0 95 0>;
 			samsung,power-domain = <&pd_isp>;
Signature · 1 line
1.7.9.5