mb/intel/tglrvp: Enable MIPI camera

Add MIPI camera ACPI
Update GPIO pin mux for camera

BUG=none
BRANCH=none
TEST=Build and boot tigerlake rvp board and check camera

Simple test method to check camera: capture image by below commands from
OS console
>media-ctl -V "\"Intel IPU6 CSI-2 5\":0 [fmt:SGRBG10/3280x2464]"
>media-ctl -V "\"Intel IPU6 CSI-2 5\":1 [fmt:SGRBG10/3280x2464]"
>media-ctl -l "\"ov8856 18-0010\":0 -> \"Intel IPU6 CSI-2 5\":0[1]"
>media-ctl -V "\"Intel IPU6 CSI2 BE\":0 [fmt:SGRBG10/3280x2464]"
>media-ctl -V "\"Intel IPU6 CSI2 BE\":1 [crop:(0,0)/3280x2464]"
>media-ctl -V "\"Intel IPU6 CSI2 BE\":1 [fmt:SGRBG10/3280x2464]"
>media-ctl -l "\"Intel IPU6 CSI-2 5\":1 -> \"Intel IPU6 CSI2 BE\":0[1]"
>media-ctl -l "\"Intel IPU6 CSI2 BE\":1 -> \"Intel IPU6 CSI2 BE capture\":0[1]"
>yavta -u -c5 -n5 -I -s 3280x2464 --file=/tmp/frame-#.bin -f SGRBG10
$(media-ctl -e "Intel IPU6 CSI2 BE capture")

Signed-off-by: Wonkyu Kim <wonkyu.kim@intel.com>
Change-Id: I4189e96f68f0e64e0860405e00eeab84564b86be
Reviewed-on: https://review.coreboot.org/c/coreboot/+/37863
Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Wonkyu Kim 2019-12-19 19:27:34 -08:00 committed by Patrick Georgi
parent 161df738a7
commit f93c157a93
3 changed files with 532 additions and 0 deletions

View File

@ -0,0 +1,523 @@
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2020 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
Scope (\_SB.PCI0.IPU0)
{
Name (_DSD, Package (0x02)
{
ToUUID ("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
Package (0x02)
{
Package (0x02)
{
"port0",
"PRT0"
},
Package (0x02)
{
"port1",
"PRT1"
}
}
})
Name (PRT0, Package (0x04)
{
ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package (0x01)
{
Package (0x02)
{
"port",
One
}
},
ToUUID ("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
Package (0x01)
{
Package (0x02)
{
"endpoint0",
"EP00"
}
}
})
Name (PRT1, Package (0x04)
{
ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package (0x01)
{
Package (0x02)
{
"port",
2
}
},
ToUUID ("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
Package (0x01)
{
Package (0x02)
{
"endpoint0",
"EP10"
}
}
})
}
Scope (_SB.PCI0.IPU0)
{
Name (EP00, Package (0x02)
{
ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package (0x04)
{
Package (0x02)
{
"endpoint",
Zero
},
Package (0x02)
{
"clock-lanes",
Zero
},
Package (0x02)
{
"data-lanes",
Package (0x04)
{
One,
0x02,
0x03,
0x04
}
},
Package (0x02)
{
"remote-endpoint",
Package (0x03)
{
^I2C3.CAM0,
Zero,
Zero
}
}
}
})
Name (EP10, Package (0x02)
{
ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package (0x04)
{
Package (0x02)
{
"endpoint",
Zero
},
Package (0x02)
{
"clock-lanes",
Zero
},
Package (0x02)
{
"data-lanes",
Package (0x04)
{
One,
0x02,
0x03,
0x04
}
},
Package (0x02)
{
"remote-endpoint",
Package (0x03)
{
^I2C5.CAM1,
Zero,
Zero
}
}
}
})
}
Scope (\_SB.PCI0.I2C3)
{
PowerResource (RCPR, 0x00, 0x0000)
{
Name (STA, Zero)
Method (_ON, 0, Serialized)
{
If ((STA == Zero))
{
/* Enable CLK0 with 19.2MHz */
MCCT(0,1,1)
/* Pull PWREN(GPIO B23) high */
STXS(GPP_B23)
Sleep(5)
/* Pull RST(GPIO C15) low */
CTXS(GPP_C15)
Sleep(5)
/* Pull RST high */
STXS(GPP_C15)
Sleep(5)
Store(1,STA)
}
}
Method (_OFF, 0, Serialized)
{
If ((STA == One))
{
/* Pull RST low */
CTXS(GPP_C15)
/* Pull PWREN low */
CTXS(GPP_B23)
/* Disable CLK0 */
MCCT(0,0,1)
Store(0,STA)
}
}
Method (_STA, 0, NotSerialized)
{
Return (STA)
}
}
Device (CAM0)
{
Name (_HID, "OVTI8856")
Name (_UID, Zero)
Name (_DDN, "Ov 8856 Camera")
Method (_STA, 0, NotSerialized)
{
Return (0x0F)
}
Name (_CRS, ResourceTemplate ()
{
I2cSerialBus (0x0010, ControllerInitiated, 0x00061A80,
AddressingMode7Bit, "\\_SB.PCI0.I2C3",
0x00, ResourceConsumer, ,
)
})
Name (_PR0, Package (0x01)
{
RCPR
})
Name (_PR3, Package (0x01)
{
RCPR
})
Name (_DSD, Package (0x04)
{
ToUUID ("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
Package (0x01)
{
Package (0x02)
{
"port0",
"PRT0"
}
},
ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package (0x02)
{
Package (0x02)
{
"clock-frequency",
0x0124F800
},
Package (0x02)
{
"lens-focus",
Package (0x01)
{
VCM0
}
}
}
})
Name (PRT0, Package (0x04)
{
ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package (0x01)
{
Package (0x02)
{
"port",
Zero
}
},
ToUUID ("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
Package (0x01)
{
Package (0x02)
{
"endpoint0",
"EP00"
}
}
})
Name (EP00, Package (0x02)
{
ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package (0x03)
{
Package (0x02)
{
"endpoint",
Zero
},
Package (0x02)
{
"link-frequencies",
Package (0x01)
{
0x325AA000
}
},
Package (0x02)
{
"remote-endpoint",
Package (0x03)
{
IPU0,
Zero,
Zero
}
}
}
})
}
Device (VCM0)
{
Name (_HID, "PRP0001")
Name (_UID, 0x03)
Name (_DDN, "DW9714 VCM")
Method (_STA, 0, NotSerialized)
{
Return (0x0F)
}
Name (_CRS, ResourceTemplate ()
{
I2cSerialBus (0x000C, ControllerInitiated, 0x00061A80,
AddressingMode7Bit, "\\_SB.PCI0.I2C3",
0x00, ResourceConsumer, ,
)
})
Name (_DEP, Package (0x01)
{
CAM0
})
Name (_PR0, Package (0x01)
{
RCPR
})
Name (_PR3, Package (0x01)
{
RCPR
})
Name (_DSD, Package (0x02)
{
ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package (0x01)
{
Package (0x02)
{
"compatible",
"dongwoon,dw9714"
}
}
})
}
}
Scope (\_SB.PCI0.I2C5)
{
PowerResource (FCPR, 0x00, 0x0000)
{
Name (STA, Zero)
Method (_ON, 0, Serialized)
{
If ((STA == Zero))
{
/* Enable CLK1 with 19.2MHz */
MCCT(1,1,1)
/* Pull PWREN(GPIO R6) high */
STXS(GPP_R6)
Sleep(5)
/* Pull RST(GPIO H12) low */
CTXS(GPP_H12)
Sleep(5)
/* Pull RST high */
STXS(GPP_H12)
Sleep(5)
Store(1,STA)
}
}
Method (_OFF, 0, Serialized)
{
If ((STA == One))
{
/* Pull RST low */
CTXS(GPP_H12)
/* Pull PWREN low */
CTXS(GPP_R6)
/* Disable CLK1 */
MCCT(1,0,1)
Store(0,STA)
}
}
Method (_STA, 0, NotSerialized) // _STA: Status
{
Return (STA)
}
}
Device (CAM1)
{
Name (_HID, "OVTI8856")
Name (_UID, Zero)
Name (_DDN, "Ov 8856 Camera")
Method (_STA, 0, NotSerialized)
{
Return (0x0F)
}
Name (_CRS, ResourceTemplate ()
{
I2cSerialBus (0x0010, ControllerInitiated, 0x00061A80,
AddressingMode7Bit, "\\_SB.PCI0.I2C5",
0x00, ResourceConsumer, ,
)
})
Name (_PR0, Package (0x01)
{
FCPR
})
Name (_PR3, Package (0x01)
{
FCPR
})
Name (_DSD, Package (0x04)
{
ToUUID ("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
Package (0x01)
{
Package (0x02)
{
"port0",
"PRT0"
}
},
ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package (0x01)
{
Package (0x02)
{
"clock-frequency",
0x0124F800
}
}
})
Name (PRT0, Package (0x04)
{
ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package (0x01)
{
Package (0x02)
{
"port",
Zero
}
},
ToUUID ("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
Package (0x01)
{
Package (0x02)
{
"endpoint0",
"EP00"
}
}
})
Name (EP00, Package (0x02)
{
ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package (0x03)
{
Package (0x02)
{
"endpoint",
Zero
},
Package (0x02)
{
"link-frequencies",
Package (0x01)
{
0x325AA000
}
},
Package (0x02)
{
"remote-endpoint",
Package (0x03)
{
IPU0,
One,
Zero
}
}
}
})
}
}

View File

@ -65,4 +65,7 @@ DefinitionBlock(
/* Mainboard specific */
#include "acpi/mainboard.asl"
/* Camera */
#include <soc/intel/tigerlake/acpi/ipu.asl>
#include "acpi/mipi_camera.asl"
}

View File

@ -22,6 +22,12 @@ static const struct pad_config gpio_table[] = {
/* PCH M.2 SSD */
PAD_CFG_GPO(GPP_B16, 1, PLTRST),
PAD_CFG_GPO(GPP_H0, 1, PLTRST),
/* Camera */
PAD_CFG_GPO(GPP_B23, 0, PLTRST),
PAD_CFG_GPO(GPP_C15, 0, PLTRST),
PAD_CFG_GPO(GPP_R6, 0, PLTRST),
PAD_CFG_GPO(GPP_H12, 0, PLTRST),
};
/* Early pad configuration in bootblock */