Beagleboard-xm and Aptina mt9p031

Hi all,
what is the latest kernel compatible with aptina mt9p031 sensor?
I installed the 5.0. with ubuntu 20.04 minimal but I’m not sure if this is ok.

Hi @Lorenzo,

At this point everything should be in mainline linux to support that combination. You will have to modify the xM’s device tree to enable the mt9p031 camera. I might have one of these Aptina sensors somewhere in my box of old stuff…

Regards,

Hi @RobertCNelson,
I found somewhere a patch containing the following device tree:

&i2c2 {
	clock-frequency = <100000>;

	mt9p031@48 {
		compatible = "aptina,mt9p031";
		reg = <0x48>;

		clocks = <&isp 0>;
		reset-gpios = <&gpio4 2 GPIO_ACTIVE_LOW>;

		vaa-supply = <&hsusb2_power>;
		vdd-supply = <&vaux3>;
		vdd_io-supply = <&vaux4>;

		port {
			mt9p031_out: endpoint {
				input-clock-frequency = <21000000>;
				pixel-clock-frequency = <48000000>;
				remote-endpoint = <&ccdc_ep>;
			};
		};
	};
};

&isp {
	#address-cells = <1>;
	#size-cells = <0>;

	ports {
		port@0 {
			reg = <0>;
			ccdc_ep: endpoint {
				remote-endpoint = <&mt9p031_out>;
				bus-width = <12>;
				hsync-active = <1>;
				vsync-active = <1>;
				pclk-sample = <0>;
			};
		};
	};
};

&vaux3 {
	regulator-name = "cam_core";
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <1800000>;
};

&vaux4 {
	regulator-name = "cam_io";
	regulator-min-microvolt = <1800000>;
	regulator-max-microvolt = <1800000>;
};

Is it still valid?
thank you
Lorenzo

Your patch should also have the pinmuxing…

Regards,

Do you mean for the camera connector?
I cannot find pin muxing for this connector inside the BeagleBoard XM revC - Manual.
Even omap3-beagle-xm.dts doesn’t containt the pin muxing… sorry I’m lost

Hi @RobertCNelson,
sorry if i’m boring you but after I’ve added the parch above, enabled mt9p031 support from menuconfig and put some traces inside the driver I’ve the following dmesg printed:
sorry if i’m boring you
[ 3.177642] mt9p031 1-0048: Linked as a consumer to regulator.5
[ 3.183837] mt9p031 1-0048: Linked as a consumer to regulator.6
[ 3.189880] mt9p031 1-0048: Failed to get supply ‘vaa’: -517
[ 3.195709] mt9p031 1-0048: Dropping the link to regulator.6
[ 3.201629] mt9p031 1-0048: Dropping the link to regulator.5
[ 3.207489] mt9p031 1-0048: Unable to get regulators
[ 3.722229] mt9p031 1-0048: Linked as a consumer to regulator.5
[ 3.728363] mt9p031 1-0048: Linked as a consumer to regulator.6
[ 3.734466] mt9p031 1-0048: Linked as a consumer to regulator.21
[ 3.740844] mt9p031 1-0048: Dropping the link to regulator.5
[ 3.746734] mt9p031 1-0048: Dropping the link to regulator.6
[ 3.752593] mt9p031 1-0048: Dropping the link to regulator.21
[ 3.800628] mt9p031 1-0048: Linked as a consumer to regulator.5
[ 3.806854] mt9p031 1-0048: Linked as a consumer to regulator.6
[ 3.812988] mt9p031 1-0048: Linked as a consumer to regulator.21
[ 3.819366] mt9p031 1-0048: Dropping the link to regulator.5
[ 3.825256] mt9p031 1-0048: Dropping the link to regulator.6
[ 3.831085] mt9p031 1-0048: Dropping the link to regulator.21
[ 3.854461] mt9p031 1-0048: Linked as a consumer to regulator.5
[ 3.860626] mt9p031 1-0048: Linked as a consumer to regulator.6
[ 3.866729] mt9p031 1-0048: Linked as a consumer to regulator.21
[ 3.873077] mt9p031 1-0048: Dropping the link to regulator.5
[ 3.878936] mt9p031 1-0048: Dropping the link to regulator.6
[ 3.884765] mt9p031 1-0048: Dropping the link to regulator.21
[ 4.024871] mt9p031 1-0048: Linked as a consumer to regulator.5
[ 4.031066] mt9p031 1-0048: Linked as a consumer to regulator.6
[ 4.037231] mt9p031 1-0048: Linked as a consumer to regulator.21
[ 4.073852] mt9p031 1-0048: MT9P031 detected at address 0x48

I think the sensor is correctly discovered (I can see it also with i2cdetect) but I’m don’t know if it is a real problem the fact that vaa is not found … is the message “Failed to get supply ‘vaa’: -517” a real problem?
thank you

Hi @RobertCNelson,
I couldn’t find the pin muxing information in the DM3730 TRM for camera connector.
I can capture images but I dont’t why the max value I see is 511 and not 4095 as I’m expecting being the connector 12 bit wide (the format is Y12 for monochrome, SGBRG12 for color). Where can I check the bus is correctly set to 12 bit?
Any hints or tips will be very appreciated
Lorenzo Salvemini
PS: I’m using monochrome sensor