diff mbox

[10/10] ARM: davinci: add pdata-quirks for da850-evm vpif display

Message ID 1486485683-11427-11-git-send-email-bgolaszewski@baylibre.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bartosz Golaszewski Feb. 7, 2017, 4:41 p.m. UTC
Similarly to vpif capture: we need to register the vpif display driver
and the corresponding adv7343 encoder in pdata-quirks as the DT
support is not complete.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 arch/arm/mach-davinci/pdata-quirks.c | 86 +++++++++++++++++++++++++++++++++++-
 1 file changed, 85 insertions(+), 1 deletion(-)

Comments

Kevin Hilman Feb. 7, 2017, 6:20 p.m. UTC | #1
Bartosz Golaszewski <bgolaszewski@baylibre.com> writes:

> Similarly to vpif capture: we need to register the vpif display driver
> and the corresponding adv7343 encoder in pdata-quirks as the DT
> support is not complete.

To add a bit more detail to the changelog:  DT support is not complete
since there isn't currently a way to define the output_routing in the
V4L2 drivers (c.f. s_routing) via DT.

> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

minor nit below, otherwise

Reviewed-by: Kevin Hilman <khilman@baylibre.com>

> ---
>  arch/arm/mach-davinci/pdata-quirks.c | 86 +++++++++++++++++++++++++++++++++++-
>  1 file changed, 85 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-davinci/pdata-quirks.c b/arch/arm/mach-davinci/pdata-quirks.c
> index 09f62ac..0a55546 100644
> --- a/arch/arm/mach-davinci/pdata-quirks.c
> +++ b/arch/arm/mach-davinci/pdata-quirks.c
> @@ -9,13 +9,17 @@
>   */
>  #include <linux/kernel.h>
>  #include <linux/of_platform.h>
> +#include <linux/gpio.h>
>  
>  #include <media/i2c/tvp514x.h>
> +#include <media/i2c/adv7343.h>
>  
>  #include <mach/common.h>
>  #include <mach/da8xx.h>
>  #include <mach/mux.h>
>  
> +#define DA850_EVM_UI_EXP_SEL_VPIF_DISP 5
> +
>  struct pdata_init {
>  	const char *compatible;
>  	void (*fn)(void);
> @@ -107,7 +111,78 @@ static struct vpif_capture_config da850_vpif_capture_config = {
>  	},
>  	.card_name = "DA850/OMAP-L138 Video Capture",
>  };
> +#endif /* IS_ENABLED(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) */
> +
> +#if defined(CONFIG_DA850_UI_SD_VIDEO_PORT)

Why not IS_ENABLED(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) also here?

> +static void vpif_evm_display_setup(void)
> +{
> +	int gpio = DAVINCI_N_GPIO + DA850_EVM_UI_EXP_SEL_VPIF_DISP, ret;
> +
> +	ret = gpio_request(gpio, "sel_c");
> +	if (ret) {
> +		pr_warn("Cannot open UI expander pin %d\n", gpio);
> +		return;
> +	}
> +
> +	gpio_direction_output(gpio, 0);
> +}
> +
> +static struct adv7343_platform_data adv7343_pdata = {
> +	.mode_config = {
> +		.dac = { 1, 1, 1 },
> +	},
> +	.sd_config = {
> +		.sd_dac_out = { 1 },
> +	},
> +};
> +
> +static struct vpif_subdev_info da850_vpif_subdev[] = {
> +	{
> +		.name = "adv7343",
> +		.board_info = {
> +			I2C_BOARD_INFO("adv7343", 0x2a),
> +			.platform_data = &adv7343_pdata,
> +		},
> +	},
> +};
>  
> +static const struct vpif_output da850_ch0_outputs[] = {
> +	{
> +		.output = {
> +			.index = 0,
> +			.name = "Composite",
> +			.type = V4L2_OUTPUT_TYPE_ANALOG,
> +			.capabilities = V4L2_OUT_CAP_STD,
> +			.std = V4L2_STD_ALL,
> +		},
> +		.subdev_name = "adv7343",
> +		.output_route = ADV7343_COMPOSITE_ID,
> +	},
> +	{
> +		.output = {
> +			.index = 1,
> +			.name = "S-Video",
> +			.type = V4L2_OUTPUT_TYPE_ANALOG,
> +			.capabilities = V4L2_OUT_CAP_STD,
> +			.std = V4L2_STD_ALL,
> +		},
> +		.subdev_name = "adv7343",
> +		.output_route = ADV7343_SVIDEO_ID,
> +	},
> +};
> +
> +static struct vpif_display_config da850_vpif_display_config = {
> +	.subdevinfo   = da850_vpif_subdev,
> +	.subdev_count = ARRAY_SIZE(da850_vpif_subdev),
> +	.chan_config[0] = {
> +		.outputs = da850_ch0_outputs,
> +		.output_count = ARRAY_SIZE(da850_ch0_outputs),
> +	},
> +	.card_name    = "DA850/OMAP-L138 Video Display",
> +};
> +#endif /* defined(CONFIG_DA850_UI_SD_VIDEO_PORT) */
> +
> +#if IS_ENABLED(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) || defined(CONFIG_DA850_UI_SD_VIDEO_PORT)
>  static void __init da850_vpif_legacy_init(void)
>  {
>  	int ret;
> @@ -120,8 +195,17 @@ static void __init da850_vpif_legacy_init(void)
>  	if (ret)
>  		pr_warn("%s: VPIF capture setup failed: %d\n",
>  			__func__, ret);
> +
> +	/* LCDK doesn't support VPIF display */
> +	if (of_machine_is_compatible("ti,da850-evm")) {
> +		vpif_evm_display_setup();
> +		ret = da850_register_vpif_display(&da850_vpif_display_config);
> +		if (ret)
> +			pr_warn("%s: VPIF display setup failed: %d\n",
> +				__func__, ret);
> +	}
>  }
> -#endif
> +#endif /* IS_ENABLED(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) || defined(CONFIG_DA850_UI_SD_VIDEO_PORT) */
>  
>  static void pdata_quirks_check(struct pdata_init *quirks)
>  {
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bartosz Golaszewski Feb. 8, 2017, 1:26 p.m. UTC | #2
2017-02-07 19:20 GMT+01:00 Kevin Hilman <khilman@baylibre.com>:
> Bartosz Golaszewski <bgolaszewski@baylibre.com> writes:
>
>> Similarly to vpif capture: we need to register the vpif display driver
>> and the corresponding adv7343 encoder in pdata-quirks as the DT
>> support is not complete.
>
> To add a bit more detail to the changelog:  DT support is not complete
> since there isn't currently a way to define the output_routing in the
> V4L2 drivers (c.f. s_routing) via DT.
>

I'll add this in v2.

>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> minor nit below, otherwise
>
> Reviewed-by: Kevin Hilman <khilman@baylibre.com>
>
>> ---
>>  arch/arm/mach-davinci/pdata-quirks.c | 86 +++++++++++++++++++++++++++++++++++-
>>  1 file changed, 85 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-davinci/pdata-quirks.c b/arch/arm/mach-davinci/pdata-quirks.c
>> index 09f62ac..0a55546 100644
>> --- a/arch/arm/mach-davinci/pdata-quirks.c
>> +++ b/arch/arm/mach-davinci/pdata-quirks.c
>> @@ -9,13 +9,17 @@
>>   */
>>  #include <linux/kernel.h>
>>  #include <linux/of_platform.h>
>> +#include <linux/gpio.h>
>>
>>  #include <media/i2c/tvp514x.h>
>> +#include <media/i2c/adv7343.h>
>>
>>  #include <mach/common.h>
>>  #include <mach/da8xx.h>
>>  #include <mach/mux.h>
>>
>> +#define DA850_EVM_UI_EXP_SEL_VPIF_DISP 5
>> +
>>  struct pdata_init {
>>       const char *compatible;
>>       void (*fn)(void);
>> @@ -107,7 +111,78 @@ static struct vpif_capture_config da850_vpif_capture_config = {
>>       },
>>       .card_name = "DA850/OMAP-L138 Video Capture",
>>  };
>> +#endif /* IS_ENABLED(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) */
>> +
>> +#if defined(CONFIG_DA850_UI_SD_VIDEO_PORT)
>
> Why not IS_ENABLED(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) also here?

Just a reflex ;)

I'll fix this too.

Thanks,
Bartosz
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kevin Hilman Feb. 10, 2017, 7:40 p.m. UTC | #3
Hi Bartosz,

Bartosz Golaszewski <bgolaszewski@baylibre.com> writes:

> Similarly to vpif capture: we need to register the vpif display driver
> and the corresponding adv7343 encoder in pdata-quirks as the DT
> support is not complete.
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  arch/arm/mach-davinci/pdata-quirks.c | 86 +++++++++++++++++++++++++++++++++++-
>  1 file changed, 85 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-davinci/pdata-quirks.c b/arch/arm/mach-davinci/pdata-quirks.c
> index 09f62ac..0a55546 100644
> --- a/arch/arm/mach-davinci/pdata-quirks.c
> +++ b/arch/arm/mach-davinci/pdata-quirks.c
> @@ -9,13 +9,17 @@
>   */
>  #include <linux/kernel.h>
>  #include <linux/of_platform.h>
> +#include <linux/gpio.h>
>  
>  #include <media/i2c/tvp514x.h>
> +#include <media/i2c/adv7343.h>
>  
>  #include <mach/common.h>
>  #include <mach/da8xx.h>
>  #include <mach/mux.h>
>  
> +#define DA850_EVM_UI_EXP_SEL_VPIF_DISP 5
> +
>  struct pdata_init {
>  	const char *compatible;
>  	void (*fn)(void);
> @@ -107,7 +111,78 @@ static struct vpif_capture_config da850_vpif_capture_config = {
>  	},
>  	.card_name = "DA850/OMAP-L138 Video Capture",
>  };
> +#endif /* IS_ENABLED(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) */
> +
> +#if defined(CONFIG_DA850_UI_SD_VIDEO_PORT)
> +static void vpif_evm_display_setup(void)
> +{
> +	int gpio = DAVINCI_N_GPIO + DA850_EVM_UI_EXP_SEL_VPIF_DISP, ret;
> +
> +	ret = gpio_request(gpio, "sel_c");
> +	if (ret) {
> +		pr_warn("Cannot open UI expander pin %d\n", gpio);
> +		return;
> +	}
> +
> +	gpio_direction_output(gpio, 0);
> +}

I had a closer look at the UI board schematic, and it looks like the
SEL_C line of the GPIO exapander is actualy to select the VPIF *input*
source, not output, so I don't think it should be needed in this patch.

Can you test VPIF display works without calling this function?

Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/mach-davinci/pdata-quirks.c b/arch/arm/mach-davinci/pdata-quirks.c
index 09f62ac..0a55546 100644
--- a/arch/arm/mach-davinci/pdata-quirks.c
+++ b/arch/arm/mach-davinci/pdata-quirks.c
@@ -9,13 +9,17 @@ 
  */
 #include <linux/kernel.h>
 #include <linux/of_platform.h>
+#include <linux/gpio.h>
 
 #include <media/i2c/tvp514x.h>
+#include <media/i2c/adv7343.h>
 
 #include <mach/common.h>
 #include <mach/da8xx.h>
 #include <mach/mux.h>
 
+#define DA850_EVM_UI_EXP_SEL_VPIF_DISP 5
+
 struct pdata_init {
 	const char *compatible;
 	void (*fn)(void);
@@ -107,7 +111,78 @@  static struct vpif_capture_config da850_vpif_capture_config = {
 	},
 	.card_name = "DA850/OMAP-L138 Video Capture",
 };
+#endif /* IS_ENABLED(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) */
+
+#if defined(CONFIG_DA850_UI_SD_VIDEO_PORT)
+static void vpif_evm_display_setup(void)
+{
+	int gpio = DAVINCI_N_GPIO + DA850_EVM_UI_EXP_SEL_VPIF_DISP, ret;
+
+	ret = gpio_request(gpio, "sel_c");
+	if (ret) {
+		pr_warn("Cannot open UI expander pin %d\n", gpio);
+		return;
+	}
+
+	gpio_direction_output(gpio, 0);
+}
+
+static struct adv7343_platform_data adv7343_pdata = {
+	.mode_config = {
+		.dac = { 1, 1, 1 },
+	},
+	.sd_config = {
+		.sd_dac_out = { 1 },
+	},
+};
+
+static struct vpif_subdev_info da850_vpif_subdev[] = {
+	{
+		.name = "adv7343",
+		.board_info = {
+			I2C_BOARD_INFO("adv7343", 0x2a),
+			.platform_data = &adv7343_pdata,
+		},
+	},
+};
 
+static const struct vpif_output da850_ch0_outputs[] = {
+	{
+		.output = {
+			.index = 0,
+			.name = "Composite",
+			.type = V4L2_OUTPUT_TYPE_ANALOG,
+			.capabilities = V4L2_OUT_CAP_STD,
+			.std = V4L2_STD_ALL,
+		},
+		.subdev_name = "adv7343",
+		.output_route = ADV7343_COMPOSITE_ID,
+	},
+	{
+		.output = {
+			.index = 1,
+			.name = "S-Video",
+			.type = V4L2_OUTPUT_TYPE_ANALOG,
+			.capabilities = V4L2_OUT_CAP_STD,
+			.std = V4L2_STD_ALL,
+		},
+		.subdev_name = "adv7343",
+		.output_route = ADV7343_SVIDEO_ID,
+	},
+};
+
+static struct vpif_display_config da850_vpif_display_config = {
+	.subdevinfo   = da850_vpif_subdev,
+	.subdev_count = ARRAY_SIZE(da850_vpif_subdev),
+	.chan_config[0] = {
+		.outputs = da850_ch0_outputs,
+		.output_count = ARRAY_SIZE(da850_ch0_outputs),
+	},
+	.card_name    = "DA850/OMAP-L138 Video Display",
+};
+#endif /* defined(CONFIG_DA850_UI_SD_VIDEO_PORT) */
+
+#if IS_ENABLED(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) || defined(CONFIG_DA850_UI_SD_VIDEO_PORT)
 static void __init da850_vpif_legacy_init(void)
 {
 	int ret;
@@ -120,8 +195,17 @@  static void __init da850_vpif_legacy_init(void)
 	if (ret)
 		pr_warn("%s: VPIF capture setup failed: %d\n",
 			__func__, ret);
+
+	/* LCDK doesn't support VPIF display */
+	if (of_machine_is_compatible("ti,da850-evm")) {
+		vpif_evm_display_setup();
+		ret = da850_register_vpif_display(&da850_vpif_display_config);
+		if (ret)
+			pr_warn("%s: VPIF display setup failed: %d\n",
+				__func__, ret);
+	}
 }
-#endif
+#endif /* IS_ENABLED(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE) || defined(CONFIG_DA850_UI_SD_VIDEO_PORT) */
 
 static void pdata_quirks_check(struct pdata_init *quirks)
 {