Skip to contentSkip to conversation

smiapp: add CCP2 support

PATCH In review Pavel Machek 3 participants 6 messages Feb 8, 2017 – Feb 15, 2017 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smiapp: add CCP2 support

Add support for CCP2 connected SMIA sensors as found on the Nokia N900.

drivers/media/i2c/smiapp/smiapp-core.c +10 -4
index 44f8c7e..c217bc6 100644
@@ -2997,13 +2997,19 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
 	switch (bus_cfg->bus_type) {
 	case V4L2_MBUS_CSI2:
 		hwcfg->csi_signalling_mode = SMIAPP_CSI_SIGNALLING_MODE_CSI2;
+		hwcfg->lanes = bus_cfg->bus.mipi_csi2.num_data_lanes;
+		break;
+	case V4L2_MBUS_CCP2:
+		hwcfg->csi_signalling_mode = (bus_cfg->bus.mipi_csi1.strobe) ?
+		SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_STROBE :
+		SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_CLOCK;
+		hwcfg->lanes = 1;
 		break;
-		/* FIXME: add CCP2 support. */
 	default:
+		dev_err(dev, "unknown bus protocol\n");
 		goto out_err;
 	}
 
-	hwcfg->lanes = bus_cfg->bus.mipi_csi2.num_data_lanes;
 	dev_dbg(dev, "lanes %u\n", hwcfg->lanes);
 
 	/* NVM size is not mandatory */
@@ -3017,8 +3023,8 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
 		goto out_err;
 	}
 
-	dev_dbg(dev, "nvm %d, clk %d, csi %d\n", hwcfg->nvm_size,
-		hwcfg->ext_clk, hwcfg->csi_signalling_mode);
+	dev_dbg(dev, "nvm %d, clk %d, mode %d\n",
+		hwcfg->nvm_size, hwcfg->ext_clk, hwcfg->csi_signalling_mode);
 
 	if (!bus_cfg->nr_of_link_frequencies) {
 		dev_warn(dev, "no link frequencies defined\n");
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw

Thanks, Pavel! :-)

Besides this patch, what else is needed? The CSI-2 / CCP2 support is missing in V4L2 OF at least. It'd be better to have this all in the same set.

I pushed the two DT patches here:

<URL:https://git.linuxtv.org/sailus/media_tree.git/commit/?h=ccp2>

Quoted 17 lines · Pavel Machek

Add support for CCP2 connected SMIA sensors as found on the Nokia N900.

drivers/media/i2c/smiapp/smiapp-core.c +1 -0
index 44f8c7e..c217bc6 100644
@@ -2997,13 +2997,19 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
 	switch (bus_cfg->bus_type) {
 	case V4L2_MBUS_CSI2:
 		hwcfg->csi_signalling_mode = SMIAPP_CSI_SIGNALLING_MODE_CSI2;
+		hwcfg->lanes = bus_cfg->bus.mipi_csi2.num_data_lanes;

drivers/media/i2c/smiapp/smiapp-core.c static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev) · line 3009

Quoted 10 lines
drivers/media/i2c/smiapp/smiapp-core.c +7 -1
+		break;
+	case V4L2_MBUS_CCP2:
+		hwcfg->csi_signalling_mode = (bus_cfg->bus.mipi_csi1.strobe) ?
+		SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_STROBE :
+		SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_CLOCK;
+		hwcfg->lanes = 1;
 		break;
-		/* FIXME: add CCP2 support. */
 	default:
+		dev_err(dev, "unknown bus protocol\n");

It's rather unsupported --- V4L2 OF framework picks one from enum v4l2_mbus_type. You might want to print the value, too. Up to you.

Quoted 19 lines
drivers/media/i2c/smiapp/smiapp-core.c +2 -3
 		goto out_err;
 	}
 
-	hwcfg->lanes = bus_cfg->bus.mipi_csi2.num_data_lanes;
 	dev_dbg(dev, "lanes %u\n", hwcfg->lanes);
 
 	/* NVM size is not mandatory */
@@ -3017,8 +3023,8 @@ static struct smiapp_hwconfig *smiapp_get_hwconfig(struct device *dev)
 		goto out_err;
 	}
 
-	dev_dbg(dev, "nvm %d, clk %d, csi %d\n", hwcfg->nvm_size,
-		hwcfg->ext_clk, hwcfg->csi_signalling_mode);
+	dev_dbg(dev, "nvm %d, clk %d, mode %d\n",
+		hwcfg->nvm_size, hwcfg->ext_clk, hwcfg->csi_signalling_mode);
 
 	if (!bus_cfg->nr_of_link_frequencies) {
 		dev_warn(dev, "no link frequencies defined\n");
Signature · 4 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]		XMPP: [email protected]
#2 lore raw

Hi!

Quoted 3 lines

Besides this patch, what else is needed? The CSI-2 / CCP2 support is missing in V4L2 OF at least. It'd be better to have this all in the same set.

Quite a lot of is needed.

Quoted 3 lines

I pushed the two DT patches here:

<URL:https://git.linuxtv.org/sailus/media_tree.git/commit/?h=ccp2>

Thanks for a branch. If you could the two patches that look ok there, it would mean less work for me, I could just mark those two as applied here.

Core changes for CSI2 support are needed.

There are core changes in notifier locking, and subdev support.

I need video-bus-switch, at least for testing.

I need subdev support for omap3isp, so that we can attach flash and focus devices.

Finally dts support on N900 can be enabled.

Thanks,

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#3 lore raw

Hi Pavel,

Quoted 8 lines · Pavel Machek

Hi!

Quoted 3 lines

Besides this patch, what else is needed? The CSI-2 / CCP2 support is missing in V4L2 OF at least. It'd be better to have this all in the same set.

Quite a lot of is needed.

Quoted 7 lines
Quoted 3 lines

I pushed the two DT patches here:

<URL:https://git.linuxtv.org/sailus/media_tree.git/commit/?h=ccp2>

Thanks for a branch. If you could the two patches that look ok there, it would mean less work for me, I could just mark those two as applied here.

I think a verb could be missing from the sentence. :-) I'll send a pull request for the entire set, containing more than just the DT changes. Feel free to base yours on top of this.

A word of warning: I have patches to replace the V4L2 OF framework by V4L2 fwnode. The preliminary set (which is still missing V4L2 OF removal) is here, I'll post a refresh soon:

<URL:http://www.spinics.net/lists/linux-media/msg106160.html>

Let's see what the order ends up to be in the end. If the fwnode set is applicable first, then I'd like to rebase the lane parsing changes on top of that rather than the other way around --- it's easier that way.

Quoted 2 lines

Core changes for CSI2 support are needed.

CCP2? We could get these and the smiapp and possibly also the omap3isp patches in first, to avoid having to manage a large patchset. What do you think?

The rest could come later.

Quoted 9 lines

There are core changes in notifier locking, and subdev support.

I need video-bus-switch, at least for testing.

I need subdev support for omap3isp, so that we can attach flash and focus devices.

Finally dts support on N900 can be enabled.

Yes! 8-)

I don't know if any euros were saved by using that video bus switch but it sure has caused a lot of hassle (and perhaps some gray hair) for software engineers. X-)

Signature · 4 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
#4 lore raw

Hi!

Quoted 23 lines
Quoted 7 lines
Quoted 3 lines

I pushed the two DT patches here:

<URL:https://git.linuxtv.org/sailus/media_tree.git/commit/?h=ccp2>

Thanks for a branch. If you could the two patches that look ok there, it would mean less work for me, I could just mark those two as applied here.

I think a verb could be missing from the sentence. :-) I'll send a pull request for the entire set, containing more than just the DT changes. Feel free to base yours on top of this.

A word of warning: I have patches to replace the V4L2 OF framework by V4L2 fwnode. The preliminary set (which is still missing V4L2 OF removal) is here, I'll post a refresh soon:

<URL:http://www.spinics.net/lists/linux-media/msg106160.html>

Let's see what the order ends up to be in the end. If the fwnode set is applicable first, then I'd like to rebase the lane parsing changes on top of that rather than the other way around --- it's easier that way.

Quoted 1 line
Quoted 5 lines
Quoted 1 line

Core changes for CSI2 support are needed.

CCP2? We could get these and the smiapp and possibly also the omap3isp patches in first, to avoid having to manage a large patchset. What do you think?

Well... anything that reduces the ammount of patches I need to maintain to keep camera working is welcome.

Quoted 7 lines
Quoted 7 lines

There are core changes in notifier locking, and subdev support.

I need video-bus-switch, at least for testing.

I need subdev support for omap3isp, so that we can attach flash and focus devices.

Quoted 7 lines
Quoted 1 line

Finally dts support on N900 can be enabled.

Yes! 8-)

I don't know if any euros were saved by using that video bus switch but it sure has caused a lot of hassle (and perhaps some gray hair) for software engineers. X-)

Yes, switch is one of the problems. OTOH... Nokia did a great thing by creating phone with reasonable design...

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#5 lore raw
In reply to Pavel Machek
reproduce:

Hi Pavel,

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.10-rc7 next-20170210]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Pavel-Machek/smiapp-add-CCP2-support/20170208-214729
base:   git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-it0-02122030 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

drivers/media/i2c/smiapp/smiapp-core.c: In function 'smiapp_get_hwconfig':
drivers/media/i2c/smiapp/smiapp-core.c:2812:7: error: 'V4L2_MBUS_CCP2' undeclared (first use in this function)

     case V4L2_MBUS_CCP2:
          ^
   drivers/media/i2c/smiapp/smiapp-core.c:2812:7: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/media/i2c/smiapp/smiapp-core.c:2813:45: error: 'union <anonymous>' has no member named 'mipi_csi1'
      hwcfg->csi_signalling_mode = (bus_cfg->bus.mipi_csi1.strobe) ?
                                                ^

vim +2813 drivers/media/i2c/smiapp/smiapp-core.c

2806
2807 switch (bus_cfg->bus_type) {
2808 case V4L2_MBUS_CSI2:
2809 hwcfg->csi_signalling_mode = SMIAPP_CSI_SIGNALLING_MODE_CSI2;
2810 hwcfg->lanes = bus_cfg->bus.mipi_csi2.num_data_lanes;
2811 break;

> 2812		case V4L2_MBUS_CCP2:
> 2813			hwcfg->csi_signalling_mode = (bus_cfg->bus.mipi_csi1.strobe) ?

2814 SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_STROBE :
2815 SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_CLOCK;
2816 hwcfg->lanes = 1;

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation