diff mbox series

[06/11] media: exynos4-is: Properly set JPEG options when not using CSIS

Message ID BN6PR04MB06606F63C7ACE765B57331A1A3AE0@BN6PR04MB0660.namprd04.prod.outlook.com (mailing list archive)
State Not Applicable
Headers show
Series media: exynos4-is: Improve support for s5pv210 and parallel ports | expand

Commit Message

Jonathan Bakker April 26, 2020, 2:26 a.m. UTC
Commit ee7160e57c98 ("[media] s5p-fimc: Add support for JPEG capture")
added support for JPEG capture, but missed setting a register when the
CSIS device wasn't in use.

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
---
 drivers/media/platform/exynos4-is/fimc-reg.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Tomasz Figa July 7, 2020, 6:23 p.m. UTC | #1
Hi Jonathan,

On Sat, Apr 25, 2020 at 07:26:45PM -0700, Jonathan Bakker wrote:
> Commit ee7160e57c98 ("[media] s5p-fimc: Add support for JPEG capture")
> added support for JPEG capture, but missed setting a register when the
> CSIS device wasn't in use.

nit: Since this isn't really about using the CSIS device or not, but
rather about the interface that the sensor is connected with, could we
instead say "when a parallel interface is used"?

> 
> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
> ---
>  drivers/media/platform/exynos4-is/fimc-reg.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/media/platform/exynos4-is/fimc-reg.c b/drivers/media/platform/exynos4-is/fimc-reg.c
> index 5ce2bdebd424..269a98fca1e8 100644
> --- a/drivers/media/platform/exynos4-is/fimc-reg.c
> +++ b/drivers/media/platform/exynos4-is/fimc-reg.c
> @@ -606,6 +606,11 @@ int fimc_hw_set_camera_source(struct fimc_dev *fimc,
>  	switch (source->fimc_bus_type) {
>  	case FIMC_BUS_TYPE_ITU_601:
>  	case FIMC_BUS_TYPE_ITU_656:
> +		if (fimc_fmt_is_user_defined(f->fmt->color)) {
> +			cfg |= FIMC_REG_CISRCFMT_ITU601_8BIT;
> +			break;
> +		}
> +
>  		for (i = 0; i < ARRAY_SIZE(pix_desc); i++) {
>  			if (vc->ci_fmt.code == pix_desc[i].pixelcode) {
>  				cfg = pix_desc[i].cisrcfmt;
> @@ -707,6 +712,8 @@ int fimc_hw_set_camera_type(struct fimc_dev *fimc,
>  	case FIMC_BUS_TYPE_ITU_601...FIMC_BUS_TYPE_ITU_656:
>  		if (source->mux_id == 0) /* ITU-A, ITU-B: 0, 1 */
>  			cfg |= FIMC_REG_CIGCTRL_SELCAM_ITU_A;
> +		if (vid_cap->ci_fmt.code == MEDIA_BUS_FMT_JPEG_1X8)
> +			cfg |= FIMC_REG_CIGCTRL_CAM_JPEG;

Should we also handle MEDIA_BUS_FMT_S5C_UYVY_JPEG_1X8 as in the CSI
case? The S5C73M3 sensor supports the parallel interface as well.

Best regards,
Tomasz
Hi,

On 07.07.2020 20:23, Tomasz Figa wrote:
> On Sat, Apr 25, 2020 at 07:26:45PM -0700, Jonathan Bakker wrote:
>> Commit ee7160e57c98 ("[media] s5p-fimc: Add support for JPEG capture")
>> added support for JPEG capture, but missed setting a register when the
>> CSIS device wasn't in use.

> nit: Since this isn't really about using the CSIS device or not, but
> rather about the interface that the sensor is connected with, could we
> instead say "when a parallel interface is used"?

>> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
>> ---
>>  drivers/media/platform/exynos4-is/fimc-reg.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/media/platform/exynos4-is/fimc-reg.c b/drivers/media/platform/exynos4-is/fimc-reg.c
>> index 5ce2bdebd424..269a98fca1e8 100644
>> --- a/drivers/media/platform/exynos4-is/fimc-reg.c
>> +++ b/drivers/media/platform/exynos4-is/fimc-reg.c
>> @@ -606,6 +606,11 @@ int fimc_hw_set_camera_source(struct fimc_dev *fimc,
>>  	switch (source->fimc_bus_type) {
>>  	case FIMC_BUS_TYPE_ITU_601:
>>  	case FIMC_BUS_TYPE_ITU_656:
>> +		if (fimc_fmt_is_user_defined(f->fmt->color)) {
>> +			cfg |= FIMC_REG_CISRCFMT_ITU601_8BIT;
>> +			break;
>> +		}
>> +
>>  		for (i = 0; i < ARRAY_SIZE(pix_desc); i++) {
>>  			if (vc->ci_fmt.code == pix_desc[i].pixelcode) {
>>  				cfg = pix_desc[i].cisrcfmt;
>> @@ -707,6 +712,8 @@ int fimc_hw_set_camera_type(struct fimc_dev *fimc,
>>  	case FIMC_BUS_TYPE_ITU_601...FIMC_BUS_TYPE_ITU_656:
>>  		if (source->mux_id == 0) /* ITU-A, ITU-B: 0, 1 */
>>  			cfg |= FIMC_REG_CIGCTRL_SELCAM_ITU_A;
>> +		if (vid_cap->ci_fmt.code == MEDIA_BUS_FMT_JPEG_1X8)
>> +			cfg |= FIMC_REG_CIGCTRL_CAM_JPEG;
> 
> Should we also handle MEDIA_BUS_FMT_S5C_UYVY_JPEG_1X8 as in the CSI
> case? The S5C73M3 sensor supports the parallel interface as well.

The parallel interface has too low bandwidth to transfer image data
with the maximum supported resolution and frame rate, I doubt anyone would
ever use S5C73MC in such a configuration.
On 26.04.2020 04:26, Jonathan Bakker wrote:
> Commit ee7160e57c98 ("[media] s5p-fimc: Add support for JPEG capture")
> added support for JPEG capture, but missed setting a register when the
> CSIS device wasn't in use.
> 
> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>

Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Jonathan Bakker July 11, 2020, 4:43 p.m. UTC | #4
Hi Sylwester and Tomasz,

On 2020-07-08 8:45 a.m., Sylwester Nawrocki wrote:
> Hi,
> 
> On 07.07.2020 20:23, Tomasz Figa wrote:
>> On Sat, Apr 25, 2020 at 07:26:45PM -0700, Jonathan Bakker wrote:
>>> Commit ee7160e57c98 ("[media] s5p-fimc: Add support for JPEG capture")
>>> added support for JPEG capture, but missed setting a register when the
>>> CSIS device wasn't in use.
> 
>> nit: Since this isn't really about using the CSIS device or not, but
>> rather about the interface that the sensor is connected with, could we
>> instead say "when a parallel interface is used"?

Yes, that's a better way of stating it.  I'll reword the commit message.

> 
>>> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
>>> ---
>>>  drivers/media/platform/exynos4-is/fimc-reg.c | 7 +++++++
>>>  1 file changed, 7 insertions(+)
>>>
>>> diff --git a/drivers/media/platform/exynos4-is/fimc-reg.c b/drivers/media/platform/exynos4-is/fimc-reg.c
>>> index 5ce2bdebd424..269a98fca1e8 100644
>>> --- a/drivers/media/platform/exynos4-is/fimc-reg.c
>>> +++ b/drivers/media/platform/exynos4-is/fimc-reg.c
>>> @@ -606,6 +606,11 @@ int fimc_hw_set_camera_source(struct fimc_dev *fimc,
>>>  	switch (source->fimc_bus_type) {
>>>  	case FIMC_BUS_TYPE_ITU_601:
>>>  	case FIMC_BUS_TYPE_ITU_656:
>>> +		if (fimc_fmt_is_user_defined(f->fmt->color)) {
>>> +			cfg |= FIMC_REG_CISRCFMT_ITU601_8BIT;
>>> +			break;
>>> +		}
>>> +
>>>  		for (i = 0; i < ARRAY_SIZE(pix_desc); i++) {
>>>  			if (vc->ci_fmt.code == pix_desc[i].pixelcode) {
>>>  				cfg = pix_desc[i].cisrcfmt;
>>> @@ -707,6 +712,8 @@ int fimc_hw_set_camera_type(struct fimc_dev *fimc,
>>>  	case FIMC_BUS_TYPE_ITU_601...FIMC_BUS_TYPE_ITU_656:
>>>  		if (source->mux_id == 0) /* ITU-A, ITU-B: 0, 1 */
>>>  			cfg |= FIMC_REG_CIGCTRL_SELCAM_ITU_A;
>>> +		if (vid_cap->ci_fmt.code == MEDIA_BUS_FMT_JPEG_1X8)
>>> +			cfg |= FIMC_REG_CIGCTRL_CAM_JPEG;
>>
>> Should we also handle MEDIA_BUS_FMT_S5C_UYVY_JPEG_1X8 as in the CSI
>> case? The S5C73M3 sensor supports the parallel interface as well.
> 
> The parallel interface has too low bandwidth to transfer image data
> with the maximum supported resolution and frame rate, I doubt anyone would
> ever use S5C73MC in such a configuration.
> 

Ok, good to know.  I'll leave it as-is then.

Thanks,
Jonathan
diff mbox series

Patch

diff --git a/drivers/media/platform/exynos4-is/fimc-reg.c b/drivers/media/platform/exynos4-is/fimc-reg.c
index 5ce2bdebd424..269a98fca1e8 100644
--- a/drivers/media/platform/exynos4-is/fimc-reg.c
+++ b/drivers/media/platform/exynos4-is/fimc-reg.c
@@ -606,6 +606,11 @@  int fimc_hw_set_camera_source(struct fimc_dev *fimc,
 	switch (source->fimc_bus_type) {
 	case FIMC_BUS_TYPE_ITU_601:
 	case FIMC_BUS_TYPE_ITU_656:
+		if (fimc_fmt_is_user_defined(f->fmt->color)) {
+			cfg |= FIMC_REG_CISRCFMT_ITU601_8BIT;
+			break;
+		}
+
 		for (i = 0; i < ARRAY_SIZE(pix_desc); i++) {
 			if (vc->ci_fmt.code == pix_desc[i].pixelcode) {
 				cfg = pix_desc[i].cisrcfmt;
@@ -707,6 +712,8 @@  int fimc_hw_set_camera_type(struct fimc_dev *fimc,
 	case FIMC_BUS_TYPE_ITU_601...FIMC_BUS_TYPE_ITU_656:
 		if (source->mux_id == 0) /* ITU-A, ITU-B: 0, 1 */
 			cfg |= FIMC_REG_CIGCTRL_SELCAM_ITU_A;
+		if (vid_cap->ci_fmt.code == MEDIA_BUS_FMT_JPEG_1X8)
+			cfg |= FIMC_REG_CIGCTRL_CAM_JPEG;
 		break;
 	case FIMC_BUS_TYPE_LCD_WRITEBACK_A:
 		cfg |= FIMC_REG_CIGCTRL_CAMIF_SELWB;