diff options
author | takeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp> | 2020-11-02 11:07:33 +0900 |
---|---|---|
committer | takeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp> | 2020-11-02 11:07:33 +0900 |
commit | 1c7d6584a7811b7785ae5c1e378f14b5ba0971cf (patch) | |
tree | cd70a267a5ef105ba32f200aa088e281fbd85747 /bsp/meta-renesas | |
parent | 4204309872da5cb401cbb2729d9e2d4869a87f42 (diff) |
basesystem-jjsandbox/ToshikazuOhiwa/master-jj
recipes
Diffstat (limited to 'bsp/meta-renesas')
219 files changed, 34611 insertions, 0 deletions
diff --git a/bsp/meta-renesas/.gitignore b/bsp/meta-renesas/.gitignore new file mode 100644 index 00000000..5cc4bc0a --- /dev/null +++ b/bsp/meta-renesas/.gitignore @@ -0,0 +1,2 @@ +*.tar.bz2 +*.tar.gz diff --git a/bsp/meta-renesas/COPYING.MIT b/bsp/meta-renesas/COPYING.MIT new file mode 100644 index 00000000..fb950dc6 --- /dev/null +++ b/bsp/meta-renesas/COPYING.MIT @@ -0,0 +1,17 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/bsp/meta-renesas/MAINTAINERS b/bsp/meta-renesas/MAINTAINERS new file mode 100644 index 00000000..4921617a --- /dev/null +++ b/bsp/meta-renesas/MAINTAINERS @@ -0,0 +1,28 @@ +This file contains a list of BSP maintainers for the BSPs contained in +the meta-renesas repository. + +Descriptions of section entries: + + M: Mail patches to: FullName <address@domain> + F: Files and directories with wildcard patterns. + A trailing slash includes all files and subdirectory files. + F: meta-XXXXX/ all files in and below meta-XXXXX + F: meta-XXXXX/* all files in meta-XXXXX, but not below + One pattern per line. Multiple F: lines acceptable. + +Please keep this list in alphabetical order. + +Maintainers List (try to look for most precise areas first) + + ----------------------------------- +Renesas ARM SoCs R-Car Generation 3 +M: Takamitsu Honda <takamitsu.honda.pv@renesas.com> +F: meta-rcar-gen3 + +Renesas ARM SoCs R-Car Generation 2 +M: Takamitsu Honda <takamitsu.honda.pv@renesas.com> +F: meta-rcar-gen2 + +COMMON +M: Takamitsu Honda <takamitsu.honda.pv@renesas.com> +F: common diff --git a/bsp/meta-renesas/README.md b/bsp/meta-renesas/README.md new file mode 100644 index 00000000..7eb9de96 --- /dev/null +++ b/bsp/meta-renesas/README.md @@ -0,0 +1,28 @@ +# OpenEmbedded/Yocto BSP layer for Renesas Electronics's SoCs + +This layer provides support for Renesas Electronics's platforms for use with +OpenEmbedded and/or Yocto. + +Layer maintainer: Takamitsu Honda <takamitsu.honda.pv@renesas.com> + +## Supported Boards/Machines + + +In addition, this also provides layer which supports boards using Renesas SoCs. +Layer and boards that support is the following: + + meta-rcar-gen3 + - Renesas Electronics Corporation. Salvator-X (R8A7795/R8A7796/R8A77965) + - Renesas Electronics Corporation. R-Car Starter Kit premier(H3ULCB) (R8A7795) + - Renesas Electronics Corporation. R-Car Starter Kit pro(M3ULCB) (R8A7796) + - Renesas Electronics Corporation. R-Car Starter Kit pro(M3NULCB) (R8A77965) + - Renesas Electronics Corporation. R-Car Ebisu (R8A77990) + +Please see README in the layer directory for the description of the board. + +## Original BSP image + +The meta-renesas layer provides original BSP image. The following: + +* core-image-minimal +* core-image-weston diff --git a/bsp/meta-renesas/meta-rcar-gen3/COPYING.MIT b/bsp/meta-renesas/meta-rcar-gen3/COPYING.MIT new file mode 100644 index 00000000..89de3547 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/COPYING.MIT @@ -0,0 +1,17 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/bsp/meta-renesas/meta-rcar-gen3/README.evaproprietary.md b/bsp/meta-renesas/meta-rcar-gen3/README.evaproprietary.md new file mode 100644 index 00000000..69a33d8c --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/README.evaproprietary.md @@ -0,0 +1,121 @@ +# R-Car Gen3 Evaluation Software Package for Linux + + +The meta-rcar-gen3 layer of meta-renesas supports the Click-through licensed +Linux Drivers and Gfx/MMP packages. + +This README describes how to use these features and setting local.conf. + +```bash + I/ Build configuration + II/ Obtain and Install Renesas Graphics Drivers +``` + +**NOTE:** + +* However, to have a completed local.conf, please also refer to Build +Instruction in [meta-renesas/meta-rcar-gen3/README.md](README.md). + +* In addition, these libraries are not provided with recipes. If you would like +to use, you will need to get them from Renesas. + +## I/ Build configuration + + +* Add the target board to local.conf + + * For Salvator-X board + + ```bash + MACHINE = "salvator-x" + ``` + + * For R-Car Starter Kit Premier(H3ULCB) board + + ```bash + MACHINE = "h3ulcb" + ``` + + * For R-Car Starter Kit Pro(M3ULCB) board + + ```bash + MACHINE = "m3ulcb" + ``` + + * For R-Car Starter Kit Pro(M3NULCB) board + + ```bash + MACHINE = "m3nulcb" + ``` + + * For Ebisu board + + ```bash + MACHINE = "ebisu" + ``` + +* Set SOC family name + + * For H3: r8a7795 + + ```bash + SOC_FAMILY = "r8a7795" + ``` + + * For M3: r8a7796 + + ```bash + SOC_FAMILY = "r8a7796" + ``` + + * For M3N: r8a77965 + + ```bash + SOC_FAMILY = "r8a77965" + ``` + + * For E3: r8a77990 + + ```bash + # Already added in machine config: ebisu.conf + SOC_FAMILY = "r8a77990" + ``` + +* When using the click-through version of the gfx/mmp packages, you need to add +the following to your local.conf + +```bash + DISTRO_FEATURES_append = " use_eva_pkg" +``` + +## II/ Obtain and Install Renesas Graphics Drivers + + +Before setting up the build environment, you need to download the proprietary +drivers. + +* Download Renesas graphic drivers with a "click through" license from +[Renesas website][rcar Linux Drivers] and unzip them into a folder. + +**NOTE:** + +* You have to register with a free account on MyRenesas and accept the license +conditions before downloading the drivers. +The operation is fast and simple nevertheless mandatory to access evaluation of +non open-source drivers for free. +Once you registered, you can download two zip files. + +```bash +$ cd <folder containing the two zip files> +$ unzip -o R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-*.zip +$ unzip -o R-Car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-*.zip +``` + +To install them into the correct place in the Yocto BSP, a copy script is used. + +```bash +$ cd ./meta-renesas +$ sh meta-rcar-gen3/docs/sample/copyscript/copy_evaproprietary_softwares.sh <path to the folder containing the packages> +``` + +[rcar Linux Drivers]: https://www.renesas.com/us/en/solutions/automotive/rcar-download/rcar-demoboard-2.html diff --git a/bsp/meta-renesas/meta-rcar-gen3/README.md b/bsp/meta-renesas/meta-rcar-gen3/README.md new file mode 100644 index 00000000..aabb63c9 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/README.md @@ -0,0 +1,233 @@ +# meta-rcar-gen3 + + +This layer provides the support for the evaluation board mounted ARM SoCs of +Renesas Electronics, called the R-Car Generation 3. + +Currently, this supports boards and the SoCs of the following: + +```bash + - Board: Salvator-X / SoC: R8A7795 (R-Car H3), R8A7796 (R-Car M3), R8A77965 (R-Car M3N) + - Board: R-Car Starter Kit premier(H3ULCB) / SoC: R8A7795 (R-Car H3) + - Board: R-Car Starter Kit pro(M3ULCB) / SoC: R8A7796 (R-Car M3) + - Board: R-Car Starter Kit pro(M3NULCB) / SoC: R8A77965 (R-Car M3N) + - Board: Ebisu / SoC: R8A77990 (R-Car E3) +``` + +## Branch Policy + + +* This is Community Yocto BSP to follow Yocto/Poky releases. + +* It is not supported to the level of the Customer Yocto BSP. + +## Tag Policy + + +* Releases are created from the respective working branch. + +* After a Customer Yocto BSP version releases, the Community Yocto BSP will be +rebased and released accordingly. + +* dunfell-X: + + * The versions used on dunfell (Yocto Project 3.1) will start on + dunfell-Yocto-v3.21.0 to keep the major version numbers in sync. + +## Contribution + + +* Please submit any patches for this layer to: takamitsu.honda.pv@renesas.com + +* Please see the MAINTAINERS file for more details. + +## Layer Dependencies + + +This layer depends on: + +* poky + +```bash + URI: git://git.yoctoproject.org/poky + layers: meta, meta-poky, meta-yocto-bsp + branch: dunfell +``` + +* meta-openembedded + +```bash + URI: git://git.openembedded.org/meta-openembedded + layers: meta-oe, meta-python + branch: dunfell +``` + +## Build Instructions + + +The following instructions require a Poky installation (or equivalent). + +* This also needs git user name and email defined: + +```bash + $ git config --global user.email "you@example.com" + $ git config --global user.name "Your Name" +``` + +* Initialize a build using the 'oe-init-build-env' script in Poky. e.g.: + +```bash + $ source poky/oe-init-build-env +``` + +* After that, initialized configure bblayers.conf by adding meta-rcar-gen3 layer. +e.g.: + +```bash + BBLAYERS ?= " \ + <path to layer>/poky/meta \ + <path to layer>/poky/meta-poky \ + <path to layer>/poky/meta-yocto-bsp \ + <path to layer>/meta-renesas/meta-rcar-gen3 \ + <path to layer>/meta-openembedded/meta-python \ + <path to layer>/meta-openembedded/meta-oe \ + " +``` + +* To build a specific target BSP, configure the associated machine in local.conf: + +```bash + MACHINE ??= "<supported board name>" +``` + +Board|MACHINE +-----|------- +Salvator-X/XS|MACHINE="salvator-x" +Ebisu|MACHINE="ebisu" +Starter Kit Pro (M3ULCB)|MACHINE="m3ulcb" +Starter Kit Pro (M3NULCB)|MACHINE="m3nulcb" +Starter Kit Premier (H3ULCB)|MACHINE="h3ulcb" + +* Select the SOC + + * For H3: r8a7795 + + ```bash + SOC_FAMILY = "r8a7795" + ``` + + * For M3: r8a7796 + + ```bash + SOC_FAMILY = "r8a7796" + ``` + + * For M3N: r8a77965 + + ```bash + SOC_FAMILY = "r8a77965" + ``` + + * For E3: r8a77990 + + ```bash + # Already added in machine config: ebisu.conf + SOC_FAMILY = "r8a77990" + ``` + +* Configure for systemd init in local.conf: + +```bash + DISTRO_FEATURES_append = " systemd" + VIRTUAL-RUNTIME_init_manager = "systemd" +``` + +* Configure for ivi-shell and ivi-extension + +```bash + DISTRO_FEATURES_append = " ivi-shell" +``` + +* Configure for USB 3.0 + +```bash + MACHINE_FEATURES_append = " usb3" +``` + +* Enable tuning support for Capacity Aware migration Strategy (CAS) + +```bash + MACHINE_FEATURES_append = " cas" +``` + +* For a list of sample local.conf file, please refer to: [docs/sample/conf/](docs/sample/conf/) + +* Build the target file system image using bitbake: + +```bash + $ bitbake core-image-minimal +``` + +After completing the images for the target machine will be available in the +output directory 'tmp/deploy/images/<supported board name>'. + +Images generated: + +* Image (generic Linux Kernel binary image file) + +* \<SoC\>-\<machine name\>.dtb (DTB for target machine) + +* core-image-minimal-\<machine name\>.tar.bz2 (rootfs tar+bzip2) + +* core-image-minimal-\<machine name\>.ext4 (rootfs ext4 format) + +## Build Instructions for SDK + + +NOTE: + +**This may be changed in the near feature. These instructions are tentative.** + +Should define the staticdev in SDK image feature for installing the static libs +to SDK in local.conf. + +```bash + SDKIMAGE_FEATURES_append = " staticdev-pkgs" +``` + +### For 64-bit target SDK (aarch64) + + +Use `bitbake -c populate_sdk` for generating the toolchain SDK + +```bash + $ bitbake core-image-minimal -c populate_sdk +``` + +The SDK can be found in the output directory `tmp/deploy/sdk` + +* `poky-glibc-x86_64-core-image-minimal-aarch64-toolchain-x.x.sh` + +### Usage of toolchain SDK + + +Install the SDK to the default: `/opt/poky/x.x` + +* For 64-bit target SDK + +```bash + $ sh poky-glibc-x86_64-core-image-minimal-aarch64-toolchain-x.x.sh +``` + +* For 64-bit application, using environment script in `/opt/poky/x.x` + +```bash + $ source /opt/poky/x.x/environment-setup-aarch64-poky-linux +``` + +## R-Car Generation 3 Information + + +Refer to the following for more information from eLinux website + +https://elinux.org/R-Car diff --git a/bsp/meta-renesas/meta-rcar-gen3/README.proprietary.md b/bsp/meta-renesas/meta-rcar-gen3/README.proprietary.md new file mode 100644 index 00000000..22da393d --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/README.proprietary.md @@ -0,0 +1,219 @@ +# Proprietary libraries for meta-rcar-gen3 + + +The meta-rcar-gen3 layer of meta-renesas is supported Graphic GLES(GSX) +libraries, proprietary library of multimedia, and ICCOM software. + +This README describes how to use these features and setting to local.conf. + +```bash + I/ Board configuration + II/ Build with GLES + III/ Build with Renesas multimedia libraries + IV/ Enable Linux ICCOM driver and Linux ICCOM library +``` + +There are 2 main paths: + +* Please check section II to config for GLES. +* Please check section III to enable Multimedia functions. + +If you would like to use Linux ICCOM driver and Linux ICCOM library, please +check section IV. + +**NOTE:** + +* However, to have a completed local.conf, please also refer to Build +Instruction in [meta-renesas/meta-rcar-gen3/README.md](README.md). + +* In addition, these libraries are not provided with recipes. If you would like +to use, you will need to get them from Renesas. + +## I/ Board configuration + + +* Add this line to local.conf + + * For Salvator-X board + + ```bash + MACHINE = "salvator-x" + ``` + + * For R-Car Starter Kit Premier(H3ULCB) board + + ```bash + MACHINE = "h3ulcb" + ``` + + * For R-Car Starter Kit Pro(M3ULCB) board + + ```bash + MACHINE = "m3ulcb" + ``` + + * For R-Car Starter Kit Pro(M3NULCB) board + + ```bash + MACHINE = "m3nulcb" + ``` + + * For Ebisu board + + ```bash + MACHINE = "ebisu" + ``` + +* Set SOC family name + + * For H3: r8a7795 + + ```bash + SOC_FAMILY = "r8a7795" + ``` + + * For M3: r8a7796 + + ```bash + SOC_FAMILY = "r8a7796" + ``` + + * For M3N: r8a77965 + + ```bash + SOC_FAMILY = "r8a77965" + ``` + + * For E3: r8a77990 + + ```bash + # Already added in machine config: ebisu.conf + SOC_FAMILY = "r8a77990" + ``` + +## II/ Build with GLES + + +For wayland with GSX + +* Please copy proprietary libraries to the directory of recipes. + +* Set local.conf the following. + +```bash + # Enable Gfx Pkgs + MACHINE_FEATURES_append = " gsx" + MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2" + + # for Wayland/Weston + DISTRO_FEATURES_NATIVESDK_append = " wayland" + DISTRO_FEATURES_append = " pam" + PREFERRED_PROVIDER_virtual/libgles1 = "" + PREFERRED_PROVIDER_virtual/libgles2 = "gles-user-module" + PREFERRED_PROVIDER_virtual/egl = "libegl" + PREFERRED_PROVIDER_virtual/libgl = "" + PREFERRED_PROVIDER_virtual/mesa = "" + PREFERRED_PROVIDER_libgbm = "libgbm" + PREFERRED_PROVIDER_libgbm-dev = "libgbm" + BBMASK = "mesa-gl" +``` + +* Run `bitbake core-image-weston` + +## III/ Build with Renesas multimedia libraries + + +Multimedia portions depend on GLES portions. + +### A/ Configuration for Multimedia features + + +* Please copy proprietary libraries to the directory of recipes. + +* Please set local.conf the following. + +```bash + # Enable multimedia features. + # This provides package group of plug-ins of the GStreamer, multimedia + # libraries and kernel drivers. + + MACHINE_FEATURES_append = " multimedia" +``` + +### B/ Configuration for optional codecs and middleware + + +* Please copy proprietary libraries to the directory of recipes. + +* Add features to DISTRO_FEATURES_append to local.conf + +```bash + # Additional configuration in OMX module + " h263dec_lib" - for OMX Media Component H263 Decoder Library + " h264dec_lib" - for OMX Media Component H264 Decoder Library + " h264enc_lib" - for OMX Media Component H.264 Encoder Library + " h265dec_lib" - for OMX Media Component H265 Decoder Library + " mpeg2dec_lib" - for OMX Media Component MPEG2 Decoder Library + " mpeg4dec_lib" - for OMX Media Component MPEG4 Decoder Library + " vc1dec_lib" - for OMX Media Component VC-1 Decoder Library + " divxdec_lib" - for OMX Media Component DivX Decoder Library + " rvdec_lib" - for OMX Media Component RealVideo Decoder Library + " alacdec_lib" - for OMX Media Component ALAC Decoder Library + " flacdec_lib" - for OMX Media Component FLAC Decoder Library + " aaclcdec_lib" - for OMX Media Component AAC-LC Decoder Library + " aaclcdec_mdw" - for AAC-LC 2ch Decoder Middleware for Linux + " aacpv2dec_lib" - for OMX Media Component aacPlus V2 Decoder Library + " aacpv2dec_mdw" - for aacPlus V2 Decoder Middleware for Linux + " mp3dec_lib" - for OMX Media Component MP3 Decoder Library + " mp3dec_mdw" - for MP3 Decoder Middleware for Linux + " wmadec_lib" - for OMX Media Component WMA Standard Decoder Library + " wmadec_mdw" - for WMA Standard Decoder Middleware for Linux + " dddec_lib" - for OMX Media Component Dolby(R) Digital Decoder Library + " dddec_mdw" - for Dolby(R) Digital Decoder Middleware for Linux + " aaclcenc_lib" - for OMX Media Component AAC-LC Encoder Library + " vp8dec_lib" - for OMX Media Component VP8 Decoder Library for Linux + " vp8enc_lib" - for OMX Media Component VP8 Encoder Library for Linux + " vp9dec_lib" - for OMX Media Component VP9 Decoder Library for Linux + " aaclcenc_mdw" - for AAC-LC Encoder Middleware for Linux + " cmsbcm" - for CMS Basic Color Management Middleware for Linux + " cmsblc" - for CMS CMM3 Backlight Control Middleware for Linux + " cmsdgc" - for CMS VSP2 Dynamic Gamma Correction Middleware for Linux + " dtv" - for ISDB-T DTV Software Package for Linux + " dvd" - for DVD Core-Middleware for Linux + " adsp" - for ADSP driver, ADSP interface and ADSP framework for Linux + " avb" - for AVB Software Package for Linux +``` + +Ex: +``` + DISTRO_FEATURES_append = " h264dec_lib h265dec_lib mpeg2dec_lib aaclcdec_lib aaclcdec_mdw" +``` + +### C/ Configuration for test packages + + +Must ensure that Multimedia features have been enabled. +(Please refer to III/A to enable Multimedia.) + +* Please add feature to DISTRO_FEATURES_append to local.conf. + +```bash + # Configuration for multimedia test package + + DISTRO_FEATURES_append = " mm-test" +``` + +## IV/ Enable Linux ICCOM driver and Linux ICCOM library + + +For Linux ICCOM driver and Linux ICCOM library + +* Please copy proprietary libraries to the directory of recipes. + +* Please set local.conf the following. + +```bash + DISTRO_FEATURES_append = " iccom" +``` +END. + diff --git a/bsp/meta-renesas/meta-rcar-gen3/conf/layer.conf b/bsp/meta-renesas/meta-rcar-gen3/conf/layer.conf new file mode 100644 index 00000000..5b57bd7a --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/conf/layer.conf @@ -0,0 +1,11 @@ +# We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have recipes-* directories, add to BBFILES +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILE_COLLECTIONS += "rcar-gen3" +BBFILE_PATTERN_rcar-gen3 = "^${LAYERDIR}/" +BBFILE_PRIORITY_rcar-gen3 = "6" +LAYERSERIES_COMPAT_rcar-gen3 = "dunfell" diff --git a/bsp/meta-renesas/meta-rcar-gen3/conf/machine/ebisu.conf b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/ebisu.conf new file mode 100644 index 00000000..59ded187 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/ebisu.conf @@ -0,0 +1,22 @@ +#@TYPE: Machine +#@NAME: Ebisu machine +#@DESCRIPTION: Machine configuration for running Ebisu + +SOC_FAMILY = "r8a77990" + +DEFAULTTUNE ?= "cortexa53" +require conf/machine/include/tune-cortexa53.inc +require conf/machine/include/rcar_common.inc + +# Device tree for E3 +KERNEL_DEVICETREE = " \ + renesas/r8a77990-ebisu.dtb \ + renesas/r8a77990-ebisu-4d.dtb \ + renesas/r8a77990-es10-ebisu.dtb \ + renesas/r8a77990-es10-ebisu-4d.dtb \ +" + +# E3 u-boot configure +UBOOT_CONFIG ??= "ebisu ebisu-4d" +UBOOT_CONFIG[ebisu] = "r8a77990_ebisu_defconfig" +UBOOT_CONFIG[ebisu-4d] = "r8a77990_ebisu-4d_defconfig" diff --git a/bsp/meta-renesas/meta-rcar-gen3/conf/machine/h3ulcb.conf b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/h3ulcb.conf new file mode 100644 index 00000000..78e6e4ff --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/h3ulcb.conf @@ -0,0 +1,21 @@ +#@TYPE: Machine +#@NAME: H3ULCB machine +#@DESCRIPTION: Machine configuration for running H3ULCB + +SOC_FAMILY = "r8a7795" + +DEFAULTTUNE ?= "cortexa57-cortexa53" +require conf/machine/include/tune-cortexa57-cortexa53.inc +require conf/machine/include/rcar_ulcb.inc + +# Device tree for H3ULCB +KERNEL_DEVICETREE = " \ + renesas/r8a7795-h3ulcb.dtb \ + renesas/r8a7795-es1-h3ulcb.dtb \ + renesas/r8a7795-h3ulcb-4x2g.dtb \ +" + +# H3ULCB u-boot configure +UBOOT_CONFIG ??= "h3ulcb h3ulcb-4x2g" +UBOOT_CONFIG[h3ulcb] = "r8a7795_ulcb_defconfig" +UBOOT_CONFIG[h3ulcb-4x2g] = "r8a7795_ulcb-4x2g_defconfig" diff --git a/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/r8a7795.inc b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/r8a7795.inc new file mode 100644 index 00000000..dda3d76d --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/r8a7795.inc @@ -0,0 +1,3 @@ +SOC_FAMILY =. "rcar-gen3:" +require conf/machine/include/soc-family.inc +LINUXLIBCVERSION = "4.14%" diff --git a/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/r8a7796.inc b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/r8a7796.inc new file mode 100644 index 00000000..dda3d76d --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/r8a7796.inc @@ -0,0 +1,3 @@ +SOC_FAMILY =. "rcar-gen3:" +require conf/machine/include/soc-family.inc +LINUXLIBCVERSION = "4.14%" diff --git a/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/r8a77965.inc b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/r8a77965.inc new file mode 100644 index 00000000..dda3d76d --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/r8a77965.inc @@ -0,0 +1,3 @@ +SOC_FAMILY =. "rcar-gen3:" +require conf/machine/include/soc-family.inc +LINUXLIBCVERSION = "4.14%" diff --git a/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/r8a77990.inc b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/r8a77990.inc new file mode 100644 index 00000000..dda3d76d --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/r8a77990.inc @@ -0,0 +1,3 @@ +SOC_FAMILY =. "rcar-gen3:" +require conf/machine/include/soc-family.inc +LINUXLIBCVERSION = "4.14%" diff --git a/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/rcar_common.inc b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/rcar_common.inc new file mode 100644 index 00000000..90b385c1 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/rcar_common.inc @@ -0,0 +1,33 @@ +require conf/machine/include/${SOC_FAMILY}.inc + +# 32BIT package install (default is disable) +# This variables can be used only in multilib. +USE_32BIT_PKGS ?= "0" +USE_32BIT_WAYLAND ?= "0" +USE_32BIT_MMP ?= "0" + +MACHINE_FEATURES = "" + +KERNEL_IMAGETYPE = "Image" +IMAGE_FSTYPES_append = " tar.bz2 ext4" + +SERIAL_CONSOLES = "115200;ttySC0" + +# Configuration for kernel +PREFERRED_PROVIDER_virtual/kernel = "linux-renesas" + +# Configuration for ARM Trusted Firmware +EXTRA_IMAGEDEPENDS += " arm-trusted-firmware optee-os" + +# u-boot +PREFERRED_VERSION_u-boot = "v2018.09%" +EXTRA_IMAGEDEPENDS += " u-boot" + +# libdrm +PREFERRED_VERSION_libdrm = "2.4.100" + +# Add variable to Build Configuration in build log +BUILDCFG_VARS_append = " SOC_FAMILY" + +# Command using to build kernel-module-gles +HOSTTOOLS += "sync" diff --git a/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/rcar_ulcb.inc b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/rcar_ulcb.inc new file mode 100644 index 00000000..1c107ef1 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/rcar_ulcb.inc @@ -0,0 +1,3 @@ +require conf/machine/include/rcar_common.inc + +MACHINEOVERRIDES .= ":ulcb" diff --git a/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/tune-cortexa57.inc b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/tune-cortexa57.inc new file mode 100644 index 00000000..b4944e0f --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/include/tune-cortexa57.inc @@ -0,0 +1,20 @@ +DEFAULTTUNE ?= "cortexa57" + +TUNEVALID[cortexa57] = "Enable Cortex-A57 specific processor optimizations" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa57', ' -mcpu=cortex-a57', '', d)}" + +MACHINEOVERRIDES =. "${@bb.utils.contains("TUNE_FEATURES", "cortexa57", "cortexa57:", "" ,d)}" +TUNECONFLICTS[aarch64] = "armv4 armv5 armv6 armv7 armv7a" + +require conf/machine/include/arm/arch-armv8a.inc + +# Little Endian base configs +AVAILTUNES += "cortexa57 cortexa57-crypto" +ARMPKGARCH_tune-cortexa57 = "cortexa57" +ARMPKGARCH_tune-cortexa57-crypto = "cortexa57" +TUNE_FEATURES_tune-cortexa57 = "aarch64 cortexa57 crc" +TUNE_FEATURES_tune-cortexa57-crypto = "aarch64 cortexa57 crc crypto" +PACKAGE_EXTRA_ARCHS_tune-cortexa57 = "${PACKAGE_EXTRA_ARCHS_tune-armv8a-crc} cortexa57" +PACKAGE_EXTRA_ARCHS_tune-cortexa57-crypto = "${PACKAGE_EXTRA_ARCHS_tune-armv8a-crc-crypto} cortexa57 cortexa57-crypto" +BASE_LIB_tune-cortexa57 = "lib64" +BASE_LIB_tune-cortexa57-crypto = "lib64" diff --git a/bsp/meta-renesas/meta-rcar-gen3/conf/machine/m3nulcb.conf b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/m3nulcb.conf new file mode 100644 index 00000000..a6054d7d --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/m3nulcb.conf @@ -0,0 +1,15 @@ +#@TYPE: Machine +#@NAME: M3NULCB machine +#@DESCRIPTION: Machine configuration for running M3NULCB + +SOC_FAMILY = "r8a77965" + +DEFAULTTUNE ?= "cortexa57" +require conf/machine/include/tune-cortexa57.inc +require conf/machine/include/rcar_ulcb.inc + +# Device tree for M3NULCB +KERNEL_DEVICETREE = "renesas/r8a77965-m3nulcb.dtb" + +# M3NULCB u-boot configure +UBOOT_MACHINE = "r8a77965_ulcb_defconfig" diff --git a/bsp/meta-renesas/meta-rcar-gen3/conf/machine/m3ulcb.conf b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/m3ulcb.conf new file mode 100644 index 00000000..80c4a6e8 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/m3ulcb.conf @@ -0,0 +1,20 @@ +#@TYPE: Machine +#@NAME: M3ULCB machine +#@DESCRIPTION: Machine configuration for running M3ULCB + +SOC_FAMILY = "r8a7796" + +DEFAULTTUNE ?= "cortexa57-cortexa53" +require conf/machine/include/tune-cortexa57-cortexa53.inc +require conf/machine/include/rcar_ulcb.inc + +# Device tree for M3ULCB +KERNEL_DEVICETREE = " \ + renesas/r8a7796-m3ulcb.dtb \ + renesas/r8a7796-m3ulcb-2x4g.dtb \ +" + +# M3ULCB u-boot configure +UBOOT_CONFIG ??= "m3ulcb m3ulcb-2x4g" +UBOOT_CONFIG[m3ulcb] = "r8a7796_ulcb_defconfig" +UBOOT_CONFIG[m3ulcb-2x4g] = "r8a7796_ulcb-2x4g_defconfig" diff --git a/bsp/meta-renesas/meta-rcar-gen3/conf/machine/salvator-x.conf b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/salvator-x.conf new file mode 100644 index 00000000..92a4f8d6 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/conf/machine/salvator-x.conf @@ -0,0 +1,52 @@ +#@TYPE: Machine +#@NAME: Salvator-X machine +#@DESCRIPTION: Machine configuration for running Salvator-X + +require conf/machine/include/rcar_common.inc + +# Add default tune for H3/M3 +DEFAULTTUNE ?= "cortexa57-cortexa53" +# Add default tune for M3N +DEFAULTTUNE_r8a77965 = "cortexa57" + +# Add tune configure file for M3N +TUNE_CONF ?= "conf/machine/include/tune-cortexa57-cortexa53.inc" +TUNE_CONF_r8a77965 = "conf/machine/include/tune-cortexa57.inc" + +require ${TUNE_CONF} + +# Device tree for H3 +KERNEL_DEVICETREE_r8a7795 = " \ + renesas/r8a7795-es1-salvator-x.dtb \ + renesas/r8a7795-salvator-x.dtb \ + renesas/r8a7795-salvator-xs.dtb \ + renesas/r8a7795-salvator-xs-2x2g.dtb \ + renesas/r8a7795-salvator-xs-4x2g.dtb \ +" +# Device tree for M3 +KERNEL_DEVICETREE_r8a7796 = " \ + renesas/r8a7796-salvator-x.dtb \ + renesas/r8a7796-salvator-xs.dtb \ + renesas/r8a7796-salvator-xs-2x4g.dtb \ +" +# Device tree for M3N +KERNEL_DEVICETREE_r8a77965 = " \ + renesas/r8a77965-salvator-x.dtb \ + renesas/r8a77965-salvator-xs.dtb \ +" + +# H3 u-boot configure +UBOOT_CONFIG_r8a7795 ??= "r8a7795_salvator-x r8a7795_salvator-xs r8a7795_salvator-xs-2x2g r8a7795_salvator-xs-4x2g" +UBOOT_CONFIG[r8a7795_salvator-x] = "r8a7795_salvator-x_defconfig" +UBOOT_CONFIG[r8a7795_salvator-xs] = "r8a7795_salvator-xs_defconfig" +UBOOT_CONFIG[r8a7795_salvator-xs-2x2g] = "r8a7795_salvator-xs-2x2g_defconfig" +UBOOT_CONFIG[r8a7795_salvator-xs-4x2g] = "r8a7795_salvator-xs-4x2g_defconfig" +# M3 u-boot configure +UBOOT_CONFIG_r8a7796 ??= "r8a7796_salvator-x r8a7796_salvator-xs r8a7796_salvator-xs-2x4g" +UBOOT_CONFIG[r8a7796_salvator-x] = "r8a7796_salvator-x_defconfig" +UBOOT_CONFIG[r8a7796_salvator-xs] = "r8a7796_salvator-xs_defconfig" +UBOOT_CONFIG[r8a7796_salvator-xs-2x4g] = "r8a7796_salvator-xs-2x4g_defconfig" +# M3N u-boot configure +UBOOT_CONFIG_r8a77965 ??= "r8a77965_salvator-x r8a77965_salvator-xs" +UBOOT_CONFIG[r8a77965_salvator-x] = "r8a77965_salvator-x_defconfig" +UBOOT_CONFIG[r8a77965_salvator-xs] = "r8a77965_salvator-xs_defconfig" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/bsp/bblayers.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/bsp/bblayers.conf new file mode 100644 index 00000000..d7ebf051 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/bsp/bblayers.conf @@ -0,0 +1,15 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ${TOPDIR}/../poky/meta \ + ${TOPDIR}/../poky/meta-poky \ + ${TOPDIR}/../poky/meta-yocto-bsp \ + ${TOPDIR}/../meta-renesas/meta-rcar-gen3 \ + ${TOPDIR}/../meta-openembedded/meta-oe \ + ${TOPDIR}/../meta-openembedded/meta-python \ + " diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/bsp/local-wayland.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/bsp/local-wayland.conf new file mode 100644 index 00000000..4edf3633 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/bsp/local-wayland.conf @@ -0,0 +1,305 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "ebisu" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# for Wayland/Weston weston-laucher +DISTRO_FEATURES_NATIVESDK_append = " wayland" +DISTRO_FEATURES_append = " pam" + +# Mask the wayland related to GFX +BBMASK = "gles-user-module|kernel-module-gles|wayland-kms|libgbm" +# Mask MMP recipes +BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" + +# Mask the gstreamer recipe for MMP +BBMASK .= "|meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer" + +# Add for gstreamer plugins ugly +LICENSE_FLAGS_WHITELIST = "commercial" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Configuration for USB 3.0 +MACHINE_FEATURES_append = " usb3" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/bsp/local.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/bsp/local.conf new file mode 100644 index 00000000..314b215b --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/bsp/local.conf @@ -0,0 +1,298 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "ebisu" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# Mask graphic Pkgs +BBMASK = "gles-user-module|kernel-module-gles|wayland-kms|libgbm" +# Mask MMP recipes +BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Enable pam distro feature +DISTRO_FEATURES_append = " pam" + +# Configuration for USB 3.0 +MACHINE_FEATURES_append = " usb3" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/gfx-only/bblayers.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/gfx-only/bblayers.conf new file mode 100644 index 00000000..70d19537 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/gfx-only/bblayers.conf @@ -0,0 +1,15 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ${TOPDIR}/../poky/meta \ + ${TOPDIR}/../poky/meta-poky \ + ${TOPDIR}/../poky/meta-yocto-bsp \ + ${TOPDIR}/../meta-renesas/meta-rcar-gen3 \ + ${TOPDIR}/../meta-openembedded/meta-python \ + ${TOPDIR}/../meta-openembedded/meta-oe \ + " diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/gfx-only/local-wayland.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/gfx-only/local-wayland.conf new file mode 100644 index 00000000..9dfc9cb8 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/gfx-only/local-wayland.conf @@ -0,0 +1,311 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "ebisu" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# Enable Gfx Pkgs +MACHINE_FEATURES_append = " gsx" +MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2" + +# for Wayland/Weston +DISTRO_FEATURES_NATIVESDK_append = " wayland" +DISTRO_FEATURES_append = " pam" +PREFERRED_PROVIDER_virtual/libgles1 = "" +PREFERRED_PROVIDER_virtual/libgles2 = "gles-user-module" +PREFERRED_PROVIDER_virtual/egl = "libegl" +PREFERRED_PROVIDER_virtual/libgl = "" +PREFERRED_PROVIDER_virtual/mesa = "" +PREFERRED_PROVIDER_virtual/libgbm = "libgbm" +PREFERRED_PROVIDER_libgbm-dev = "libgbm" +BBMASK = "mesa-gl" +# Mask MMP recipes +BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" + +# Add for gstreamer plugins ugly +LICENSE_FLAGS_WHITELIST = "commercial" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Configuration for USB 3.0 +MACHINE_FEATURES_append = " usb3" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/mmp/bblayers.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/mmp/bblayers.conf new file mode 100644 index 00000000..70d19537 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/mmp/bblayers.conf @@ -0,0 +1,15 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ${TOPDIR}/../poky/meta \ + ${TOPDIR}/../poky/meta-poky \ + ${TOPDIR}/../poky/meta-yocto-bsp \ + ${TOPDIR}/../meta-renesas/meta-rcar-gen3 \ + ${TOPDIR}/../meta-openembedded/meta-python \ + ${TOPDIR}/../meta-openembedded/meta-oe \ + " diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/mmp/local-wayland.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/mmp/local-wayland.conf new file mode 100644 index 00000000..61f03a80 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/ebisu/poky-gcc/mmp/local-wayland.conf @@ -0,0 +1,417 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "ebisu" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# Enable Gfx Pkgs +MACHINE_FEATURES_append = " gsx" +MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2" + +# for Wayland/Weston +DISTRO_FEATURES_NATIVESDK_append = " wayland" +DISTRO_FEATURES_append = " pam" +PREFERRED_PROVIDER_virtual/libgles1 = "" +PREFERRED_PROVIDER_virtual/libgles2 = "gles-user-module" +PREFERRED_PROVIDER_virtual/egl = "libegl" +PREFERRED_PROVIDER_virtual/libgl = "" +PREFERRED_PROVIDER_virtual/mesa = "" +PREFERRED_PROVIDER_virtual/libgbm = "libgbm" +PREFERRED_PROVIDER_libgbm-dev = "libgbm" +BBMASK = "mesa-gl" + +# Enable Multimedia features +MACHINE_FEATURES_append = " multimedia" + +# for gstreamer omx plugins +LICENSE_FLAGS_WHITELIST = "commercial" +# for mmp test program +DISTRO_FEATURES_append = " mm-test" + +# for weston v4l2 renderer +#DISTRO_FEATURES_append = " v4l2-renderer" + +# OMX H263 decoder library for Linux (RTM0AC0000XV263D30SL41C) +#DISTRO_FEATURES_append = " h263dec_lib" + +# OMX H264 decoder library for Linux (RTM0AC0000XV264D30SL41C) +DISTRO_FEATURES_append = " h264dec_lib" + +# OMX H264 encoder library for Linux (RTM0AC0000XV264E30SL41C) +#DISTRO_FEATURES_append = " h264enc_lib" + +# OMX H265 decoder library for Linux (RTM0AC0000XV265D30SL41C) +#DISTRO_FEATURES_append = " h265dec_lib" + +# OMX MPEG2 decoder library for Linux (RTM0AC0000XVM2VD30SL41C) +#DISTRO_FEATURES_append = " mpeg2dec_lib" + +# OMX Media Component MPEG4 Decoder Library for Linux (RTM0AC0000XVM4VD30SL41C) +#DISTRO_FEATURES_append = " mpeg4dec_lib" + +# OMX Media Component VC-1 Decoder Library for Linux (RTM0AC0000XVVC1D30SL41C) +#DISTRO_FEATURES_append = " vc1dec_lib" + +# OMX Media Component DivXD Decoder Library for Linux (RTM0AC0000XVDVXD30SL41C) +#DISTRO_FEATURES_append = " divxdec_lib" + +# OMX Media Component RealVideo Decoder Library for Linux (RTM0AC0000XVRLVD30SL41C) +#DISTRO_FEATURES_append = " rvdec_lib" + +# OMX Media Component ALAC Decoder Library for Linux (RTM0AC0000XAALAD30SL41C) +#DISTRO_FEATURES_append = " alacdec_lib" + +# OMX Media Component FLAC Decoder Library for Linux (RTM0AC0000XAFLAD30SL41C) +#DISTRO_FEATURES_append = " flacdec_lib" + +# OMX AAC-LC decoder library for Linux (RTM0AC0000XAAACD30SL41C), +# AAC-LC 2ch decoder middleware library for Linux (RTM0AC0000ADAACMZ1SL41C) +DISTRO_FEATURES_append = " aaclcdec_lib" +DISTRO_FEATURES_append = " aaclcdec_mdw" + +# OMX aacPlus V2 decoder library for Linux (RTM0AC0000XAAAPD30SL41C), +# aacPlus V2 decoder middleware library for Linux (RTM0AC0000ADAAPMZ1SL41C) +#DISTRO_FEATURES_append = " aacpv2dec_lib" +#DISTRO_FEATURES_append = " aacpv2dec_mdw" + +# OMX MP3 decoder library for Linux (RTM0AC0000XAMP3D30SL41C), +# MP3 decoder middleware library for Linux (RTM0AC0000ADMP3MZ1SL41C) +#DISTRO_FEATURES_append = " mp3dec_lib" +#DISTRO_FEATURES_append = " mp3dec_mdw" + +# OMX WMA decoder library for Linux (RTM0AC0000XAWMAD30SL41C), +# WMA decoder middleware library for Linux (RTM0AC0000ADWMAMZ1SL41C) +#DISTRO_FEATURES_append = " wmadec_lib" +#DISTRO_FEATURES_append = " wmadec_mdw" + +# OMX AAC-LC encoder library for Linux (RTM0AC0000XAAACE30SL41C) +# AAC-LC encoder middleware library for Linux (RTM0AC0000AEAACMZ1SL41C) +#DISTRO_FEATURES_append = " aaclcenc_lib" +#DISTRO_FEATURES_append = " aaclcenc_mdw" + +# OMX Dolby(R) Digital decoder library for Linux (RTM0AC0000XADD5D30SL41C), +# Dolby(R) Digital decoder middleware library for Linux (RTM0AC0000ADDD5MZ1SL41C) +#DISTRO_FEATURES_append = " dddec_lib" +#DISTRO_FEATURES_append = " dddec_mdw" + +# OMX Media Component VP8 Decoder Library for Linux (RTM0AC0000XVVP8D30SL41C) +#DISTRO_FEATURES_append = " vp8dec_lib" + +# OMX Media Component VP8 Encoder Library for Linux (RTM0AC0000XVVP8E30SL41C) +#DISTRO_FEATURES_append = " vp8enc_lib" + +# OMX Media Component VP9 Decoder Library for Linux (RTM0AC0000XVVP9D30SL41C) +#DISTRO_FEATURES_append = " vp9dec_lib" + +# CMS Basic Color Management Middleware for Linux (RTM0AC0000JRCMBCV0SL41C) +#DISTRO_FEATURES_append = " cmsbcm" + +# CMS CMM3 Backlight Control Middleware for Linux (RTM0AC0000JRCMBLC0SL41C) +#DISTRO_FEATURES_append = " cmsblc" + +# CMS VSP2 Dynamic Gamma Correction Middleware for Linux (RTM0AC0000JRCMDGV0SL41C) +#DISTRO_FEATURES_append = " cmsdgc" + +# DVD Core-Middleware for Linux (RTM0RC0000XDVDC301SL41C) +# DVD Encryption Library for Linux (RTM0RC0000XDVDF301SL41C) +#DISTRO_FEATURES_append = " dvd" +#DISTRO_FEATURES_append = " dvd_encryption_library" + +# ADSP Driver for Linux (RCG3AHPDL4101ZDO) +# ADSP Interface for Linux (RCG3AHIFL4101ZDP) +# ADSP Framework (RCG3AHFWN0201ZDP) +#DISTRO_FEATURES_append = " adsp" + +# AVB Software Package for Linux +#DISTRO_FEATURES_append = " avb" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Evaluation packages +#DISTRO_FEATURES_append = " use_eva_pkg" + +# Configuration for ivi-shell and ivi-extension +#DISTRO_FEATURES_append = " ivi-shell" + +# Configuration for USB 3.0 +MACHINE_FEATURES_append = " usb3" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/bsp/bblayers.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/bsp/bblayers.conf new file mode 100644 index 00000000..d7ebf051 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/bsp/bblayers.conf @@ -0,0 +1,15 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ${TOPDIR}/../poky/meta \ + ${TOPDIR}/../poky/meta-poky \ + ${TOPDIR}/../poky/meta-yocto-bsp \ + ${TOPDIR}/../meta-renesas/meta-rcar-gen3 \ + ${TOPDIR}/../meta-openembedded/meta-oe \ + ${TOPDIR}/../meta-openembedded/meta-python \ + " diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/bsp/local-wayland.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/bsp/local-wayland.conf new file mode 100644 index 00000000..7885e6f2 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/bsp/local-wayland.conf @@ -0,0 +1,305 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "h3ulcb" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# for Wayland/Weston weston-laucher +DISTRO_FEATURES_NATIVESDK_append = " wayland" +DISTRO_FEATURES_append = " pam" + +# Mask the wayland related to GFX +BBMASK = "gles-user-module|kernel-module-gles|wayland-kms|libgbm" +# Mask MMP recipes +BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" + +# Mask the gstreamer recipe for MMP +BBMASK .= "|meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer" + +# Add for gstreamer plugins ugly +LICENSE_FLAGS_WHITELIST = "commercial" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Add Capacity Aware migration Strategy (CAS) +MACHINE_FEATURES_append = " cas" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/bsp/local.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/bsp/local.conf new file mode 100644 index 00000000..7ebd5c99 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/bsp/local.conf @@ -0,0 +1,298 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "h3ulcb" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# Mask graphic Pkgs +BBMASK = "gles-user-module|kernel-module-gles|wayland-kms|libgbm" +# Mask MMP recipes +BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Enable pam distro feature +DISTRO_FEATURES_append = " pam" + +# Add Capacity Aware migration Strategy (CAS) +MACHINE_FEATURES_append = " cas" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/gfx-only/bblayers.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/gfx-only/bblayers.conf new file mode 100644 index 00000000..70d19537 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/gfx-only/bblayers.conf @@ -0,0 +1,15 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ${TOPDIR}/../poky/meta \ + ${TOPDIR}/../poky/meta-poky \ + ${TOPDIR}/../poky/meta-yocto-bsp \ + ${TOPDIR}/../meta-renesas/meta-rcar-gen3 \ + ${TOPDIR}/../meta-openembedded/meta-python \ + ${TOPDIR}/../meta-openembedded/meta-oe \ + " diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/gfx-only/local-wayland.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/gfx-only/local-wayland.conf new file mode 100644 index 00000000..18f3e4e6 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/gfx-only/local-wayland.conf @@ -0,0 +1,311 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "h3ulcb" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# Enable Gfx Pkgs +MACHINE_FEATURES_append = " gsx" +MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2" + +# for Wayland/Weston +DISTRO_FEATURES_NATIVESDK_append = " wayland" +DISTRO_FEATURES_append = " pam" +PREFERRED_PROVIDER_virtual/libgles1 = "" +PREFERRED_PROVIDER_virtual/libgles2 = "gles-user-module" +PREFERRED_PROVIDER_virtual/egl = "libegl" +PREFERRED_PROVIDER_virtual/libgl = "" +PREFERRED_PROVIDER_virtual/mesa = "" +PREFERRED_PROVIDER_virtual/libgbm = "libgbm" +PREFERRED_PROVIDER_libgbm-dev = "libgbm" +BBMASK = "mesa-gl" +# Mask MMP recipes +BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" + +# Add for gstreamer plugins ugly +LICENSE_FLAGS_WHITELIST = "commercial" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Add Capacity Aware migration Strategy (CAS) +MACHINE_FEATURES_append = " cas" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/mmp/bblayers.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/mmp/bblayers.conf new file mode 100644 index 00000000..70d19537 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/mmp/bblayers.conf @@ -0,0 +1,15 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ${TOPDIR}/../poky/meta \ + ${TOPDIR}/../poky/meta-poky \ + ${TOPDIR}/../poky/meta-yocto-bsp \ + ${TOPDIR}/../meta-renesas/meta-rcar-gen3 \ + ${TOPDIR}/../meta-openembedded/meta-python \ + ${TOPDIR}/../meta-openembedded/meta-oe \ + " diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/mmp/local-wayland.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/mmp/local-wayland.conf new file mode 100644 index 00000000..cd6cca96 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/h3ulcb/poky-gcc/mmp/local-wayland.conf @@ -0,0 +1,417 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "h3ulcb" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# Enable Gfx Pkgs +MACHINE_FEATURES_append = " gsx" +MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2" + +# for Wayland/Weston +DISTRO_FEATURES_NATIVESDK_append = " wayland" +DISTRO_FEATURES_append = " pam" +PREFERRED_PROVIDER_virtual/libgles1 = "" +PREFERRED_PROVIDER_virtual/libgles2 = "gles-user-module" +PREFERRED_PROVIDER_virtual/egl = "libegl" +PREFERRED_PROVIDER_virtual/libgl = "" +PREFERRED_PROVIDER_virtual/mesa = "" +PREFERRED_PROVIDER_virtual/libgbm = "libgbm" +PREFERRED_PROVIDER_libgbm-dev = "libgbm" +BBMASK = "mesa-gl" + +# Enable Multimedia features +MACHINE_FEATURES_append = " multimedia" + +# for gstreamer omx plugins +LICENSE_FLAGS_WHITELIST = "commercial" +# for mmp test program +DISTRO_FEATURES_append = " mm-test" + +# for weston v4l2 renderer +#DISTRO_FEATURES_append = " v4l2-renderer" + +# OMX H263 decoder library for Linux (RTM0AC0000XV263D30SL41C) +#DISTRO_FEATURES_append = " h263dec_lib" + +# OMX H264 decoder library for Linux (RTM0AC0000XV264D30SL41C) +DISTRO_FEATURES_append = " h264dec_lib" + +# OMX H264 encoder library for Linux (RTM0AC0000XV264E30SL41C) +#DISTRO_FEATURES_append = " h264enc_lib" + +# OMX H265 decoder library for Linux (RTM0AC0000XV265D30SL41C) +#DISTRO_FEATURES_append = " h265dec_lib" + +# OMX MPEG2 decoder library for Linux (RTM0AC0000XVM2VD30SL41C) +#DISTRO_FEATURES_append = " mpeg2dec_lib" + +# OMX Media Component MPEG4 Decoder Library for Linux (RTM0AC0000XVM4VD30SL41C) +#DISTRO_FEATURES_append = " mpeg4dec_lib" + +# OMX Media Component VC-1 Decoder Library for Linux (RTM0AC0000XVVC1D30SL41C) +#DISTRO_FEATURES_append = " vc1dec_lib" + +# OMX Media Component DivXD Decoder Library for Linux (RTM0AC0000XVDVXD30SL41C) +#DISTRO_FEATURES_append = " divxdec_lib" + +# OMX Media Component RealVideo Decoder Library for Linux (RTM0AC0000XVRLVD30SL41C) +#DISTRO_FEATURES_append = " rvdec_lib" + +# OMX Media Component ALAC Decoder Library for Linux (RTM0AC0000XAALAD30SL41C) +#DISTRO_FEATURES_append = " alacdec_lib" + +# OMX Media Component FLAC Decoder Library for Linux (RTM0AC0000XAFLAD30SL41C) +#DISTRO_FEATURES_append = " flacdec_lib" + +# OMX AAC-LC decoder library for Linux (RTM0AC0000XAAACD30SL41C), +# AAC-LC 2ch decoder middleware library for Linux (RTM0AC0000ADAACMZ1SL41C) +DISTRO_FEATURES_append = " aaclcdec_lib" +DISTRO_FEATURES_append = " aaclcdec_mdw" + +# OMX aacPlus V2 decoder library for Linux (RTM0AC0000XAAAPD30SL41C), +# aacPlus V2 decoder middleware library for Linux (RTM0AC0000ADAAPMZ1SL41C) +#DISTRO_FEATURES_append = " aacpv2dec_lib" +#DISTRO_FEATURES_append = " aacpv2dec_mdw" + +# OMX MP3 decoder library for Linux (RTM0AC0000XAMP3D30SL41C), +# MP3 decoder middleware library for Linux (RTM0AC0000ADMP3MZ1SL41C) +#DISTRO_FEATURES_append = " mp3dec_lib" +#DISTRO_FEATURES_append = " mp3dec_mdw" + +# OMX WMA decoder library for Linux (RTM0AC0000XAWMAD30SL41C), +# WMA decoder middleware library for Linux (RTM0AC0000ADWMAMZ1SL41C) +#DISTRO_FEATURES_append = " wmadec_lib" +#DISTRO_FEATURES_append = " wmadec_mdw" + +# OMX AAC-LC encoder library for Linux (RTM0AC0000XAAACE30SL41C) +# AAC-LC encoder middleware library for Linux (RTM0AC0000AEAACMZ1SL41C) +#DISTRO_FEATURES_append = " aaclcenc_lib" +#DISTRO_FEATURES_append = " aaclcenc_mdw" + +# OMX Dolby(R) Digital decoder library for Linux (RTM0AC0000XADD5D30SL41C), +# Dolby(R) Digital decoder middleware library for Linux (RTM0AC0000ADDD5MZ1SL41C) +#DISTRO_FEATURES_append = " dddec_lib" +#DISTRO_FEATURES_append = " dddec_mdw" + +# OMX Media Component VP8 Decoder Library for Linux (RTM0AC0000XVVP8D30SL41C) +#DISTRO_FEATURES_append = " vp8dec_lib" + +# OMX Media Component VP8 Encoder Library for Linux (RTM0AC0000XVVP8E30SL41C) +#DISTRO_FEATURES_append = " vp8enc_lib" + +# CMS Basic Color Management Middleware for Linux (RTM0AC0000JRCMBCV0SL41C) +#DISTRO_FEATURES_append = " cmsbcm" + +# CMS CMM3 Backlight Control Middleware for Linux (RTM0AC0000JRCMBLC0SL41C) +#DISTRO_FEATURES_append = " cmsblc" + +# CMS VSP2 Dynamic Gamma Correction Middleware for Linux (RTM0AC0000JRCMDGV0SL41C) +#DISTRO_FEATURES_append = " cmsdgc" + +# ISDB-T DTV Software Package for Linux (RTM0RC0000TE020000SL41C) +#DISTRO_FEATURES_append = " dtv" + +# DVD Core-Middleware for Linux (RTM0RC0000XDVDC301SL41C) +# DVD Encryption Library for Linux (RTM0RC0000XDVDF301SL41C) +#DISTRO_FEATURES_append = " dvd" +#DISTRO_FEATURES_append = " dvd_encryption_library" + +# ADSP Driver for Linux (RCG3AHPDL4101ZDO) +# ADSP Interface for Linux (RCG3AHIFL4101ZDP) +# ADSP Framework (RCG3AHFWN0201ZDP) +#DISTRO_FEATURES_append = " adsp" + +# AVB Software Package for Linux +#DISTRO_FEATURES_append = " avb" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Evaluation packages +#DISTRO_FEATURES_append = " use_eva_pkg" + +# Configuration for ivi-shell and ivi-extension +#DISTRO_FEATURES_append = " ivi-shell" + +# Add Capacity Aware migration Strategy (CAS) +MACHINE_FEATURES_append = " cas" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/bsp/bblayers.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/bsp/bblayers.conf new file mode 100644 index 00000000..d7ebf051 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/bsp/bblayers.conf @@ -0,0 +1,15 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ${TOPDIR}/../poky/meta \ + ${TOPDIR}/../poky/meta-poky \ + ${TOPDIR}/../poky/meta-yocto-bsp \ + ${TOPDIR}/../meta-renesas/meta-rcar-gen3 \ + ${TOPDIR}/../meta-openembedded/meta-oe \ + ${TOPDIR}/../meta-openembedded/meta-python \ + " diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/bsp/local-wayland.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/bsp/local-wayland.conf new file mode 100644 index 00000000..01fdc941 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/bsp/local-wayland.conf @@ -0,0 +1,302 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "m3nulcb" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# for Wayland/Weston weston-laucher +DISTRO_FEATURES_NATIVESDK_append = " wayland" +DISTRO_FEATURES_append = " pam" + +# Mask the wayland related to GFX +BBMASK = "gles-user-module|kernel-module-gles|wayland-kms|libgbm" +# Mask MMP recipes +BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" + +# Mask the gstreamer recipe for MMP +BBMASK .= "|meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer" + +# Add for gstreamer plugins ugly +LICENSE_FLAGS_WHITELIST = "commercial" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/bsp/local.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/bsp/local.conf new file mode 100644 index 00000000..74ef129e --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/bsp/local.conf @@ -0,0 +1,295 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "m3nulcb" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# Mask graphic Pkgs +BBMASK = "gles-user-module|kernel-module-gles|wayland-kms|libgbm" +# Mask MMP recipes +BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Enable pam distro feature +DISTRO_FEATURES_append = " pam" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/gfx-only/bblayers.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/gfx-only/bblayers.conf new file mode 100644 index 00000000..70d19537 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/gfx-only/bblayers.conf @@ -0,0 +1,15 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ${TOPDIR}/../poky/meta \ + ${TOPDIR}/../poky/meta-poky \ + ${TOPDIR}/../poky/meta-yocto-bsp \ + ${TOPDIR}/../meta-renesas/meta-rcar-gen3 \ + ${TOPDIR}/../meta-openembedded/meta-python \ + ${TOPDIR}/../meta-openembedded/meta-oe \ + " diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/gfx-only/local-wayland.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/gfx-only/local-wayland.conf new file mode 100644 index 00000000..b54fb86c --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/gfx-only/local-wayland.conf @@ -0,0 +1,308 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "m3nulcb" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# Enable Gfx Pkgs +MACHINE_FEATURES_append = " gsx" +MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2" + +# for Wayland/Weston +DISTRO_FEATURES_NATIVESDK_append = " wayland" +DISTRO_FEATURES_append = " pam" +PREFERRED_PROVIDER_virtual/libgles1 = "" +PREFERRED_PROVIDER_virtual/libgles2 = "gles-user-module" +PREFERRED_PROVIDER_virtual/egl = "libegl" +PREFERRED_PROVIDER_virtual/libgl = "" +PREFERRED_PROVIDER_virtual/mesa = "" +PREFERRED_PROVIDER_virtual/libgbm = "libgbm" +PREFERRED_PROVIDER_libgbm-dev = "libgbm" +BBMASK = "mesa-gl" +# Mask MMP recipes +BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" + +# Add for gstreamer plugins ugly +LICENSE_FLAGS_WHITELIST = "commercial" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/mmp/bblayers.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/mmp/bblayers.conf new file mode 100644 index 00000000..70d19537 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/mmp/bblayers.conf @@ -0,0 +1,15 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ${TOPDIR}/../poky/meta \ + ${TOPDIR}/../poky/meta-poky \ + ${TOPDIR}/../poky/meta-yocto-bsp \ + ${TOPDIR}/../meta-renesas/meta-rcar-gen3 \ + ${TOPDIR}/../meta-openembedded/meta-python \ + ${TOPDIR}/../meta-openembedded/meta-oe \ + " diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/mmp/local-wayland.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/mmp/local-wayland.conf new file mode 100644 index 00000000..238b9191 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3nulcb/poky-gcc/mmp/local-wayland.conf @@ -0,0 +1,414 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "m3nulcb" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# Enable Gfx Pkgs +MACHINE_FEATURES_append = " gsx" +MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2" + +# for Wayland/Weston +DISTRO_FEATURES_NATIVESDK_append = " wayland" +DISTRO_FEATURES_append = " pam" +PREFERRED_PROVIDER_virtual/libgles1 = "" +PREFERRED_PROVIDER_virtual/libgles2 = "gles-user-module" +PREFERRED_PROVIDER_virtual/egl = "libegl" +PREFERRED_PROVIDER_virtual/libgl = "" +PREFERRED_PROVIDER_virtual/mesa = "" +PREFERRED_PROVIDER_virtual/libgbm = "libgbm" +PREFERRED_PROVIDER_libgbm-dev = "libgbm" +BBMASK = "mesa-gl" + +# Enable Multimedia features +MACHINE_FEATURES_append = " multimedia" + +# for gstreamer omx plugins +LICENSE_FLAGS_WHITELIST = "commercial" +# for mmp test program +DISTRO_FEATURES_append = " mm-test" + +# for weston v4l2 renderer +#DISTRO_FEATURES_append = " v4l2-renderer" + +# OMX H263 decoder library for Linux (RTM0AC0000XV263D30SL41C) +#DISTRO_FEATURES_append = " h263dec_lib" + +# OMX H264 decoder library for Linux (RTM0AC0000XV264D30SL41C) +DISTRO_FEATURES_append = " h264dec_lib" + +# OMX H264 encoder library for Linux (RTM0AC0000XV264E30SL41C) +#DISTRO_FEATURES_append = " h264enc_lib" + +# OMX H265 decoder library for Linux (RTM0AC0000XV265D30SL41C) +#DISTRO_FEATURES_append = " h265dec_lib" + +# OMX MPEG2 decoder library for Linux (RTM0AC0000XVM2VD30SL41C) +#DISTRO_FEATURES_append = " mpeg2dec_lib" + +# OMX Media Component MPEG4 Decoder Library for Linux (RTM0AC0000XVM4VD30SL41C) +#DISTRO_FEATURES_append = " mpeg4dec_lib" + +# OMX Media Component VC-1 Decoder Library for Linux (RTM0AC0000XVVC1D30SL41C) +#DISTRO_FEATURES_append = " vc1dec_lib" + +# OMX Media Component DivXD Decoder Library for Linux (RTM0AC0000XVDVXD30SL41C) +#DISTRO_FEATURES_append = " divxdec_lib" + +# OMX Media Component RealVideo Decoder Library for Linux (RTM0AC0000XVRLVD30SL41C) +#DISTRO_FEATURES_append = " rvdec_lib" + +# OMX Media Component ALAC Decoder Library for Linux (RTM0AC0000XAALAD30SL41C) +#DISTRO_FEATURES_append = " alacdec_lib" + +# OMX Media Component FLAC Decoder Library for Linux (RTM0AC0000XAFLAD30SL41C) +#DISTRO_FEATURES_append = " flacdec_lib" + +# OMX AAC-LC decoder library for Linux (RTM0AC0000XAAACD30SL41C), +# AAC-LC 2ch decoder middleware library for Linux (RTM0AC0000ADAACMZ1SL41C) +DISTRO_FEATURES_append = " aaclcdec_lib" +DISTRO_FEATURES_append = " aaclcdec_mdw" + +# OMX aacPlus V2 decoder library for Linux (RTM0AC0000XAAAPD30SL41C), +# aacPlus V2 decoder middleware library for Linux (RTM0AC0000ADAAPMZ1SL41C) +#DISTRO_FEATURES_append = " aacpv2dec_lib" +#DISTRO_FEATURES_append = " aacpv2dec_mdw" + +# OMX MP3 decoder library for Linux (RTM0AC0000XAMP3D30SL41C), +# MP3 decoder middleware library for Linux (RTM0AC0000ADMP3MZ1SL41C) +#DISTRO_FEATURES_append = " mp3dec_lib" +#DISTRO_FEATURES_append = " mp3dec_mdw" + +# OMX WMA decoder library for Linux (RTM0AC0000XAWMAD30SL41C), +# WMA decoder middleware library for Linux (RTM0AC0000ADWMAMZ1SL41C) +#DISTRO_FEATURES_append = " wmadec_lib" +#DISTRO_FEATURES_append = " wmadec_mdw" + +# OMX AAC-LC encoder library for Linux (RTM0AC0000XAAACE30SL41C) +# AAC-LC encoder middleware library for Linux (RTM0AC0000AEAACMZ1SL41C) +#DISTRO_FEATURES_append = " aaclcenc_lib" +#DISTRO_FEATURES_append = " aaclcenc_mdw" + +# OMX Dolby(R) Digital decoder library for Linux (RTM0AC0000XADD5D30SL41C), +# Dolby(R) Digital decoder middleware library for Linux (RTM0AC0000ADDD5MZ1SL41C) +#DISTRO_FEATURES_append = " dddec_lib" +#DISTRO_FEATURES_append = " dddec_mdw" + +# OMX Media Component VP8 Decoder Library for Linux (RTM0AC0000XVVP8D30SL41C) +#DISTRO_FEATURES_append = " vp8dec_lib" + +# OMX Media Component VP8 Encoder Library for Linux (RTM0AC0000XVVP8E30SL41C) +#DISTRO_FEATURES_append = " vp8enc_lib" + +# OMX Media Component VP9 Decoder Library for Linux (RTM0AC0000XVVP9D30SL41C) +#DISTRO_FEATURES_append = " vp9dec_lib" + +# CMS Basic Color Management Middleware for Linux (RTM0AC0000JRCMBCV0SL41C) +#DISTRO_FEATURES_append = " cmsbcm" + +# CMS CMM3 Backlight Control Middleware for Linux (RTM0AC0000JRCMBLC0SL41C) +#DISTRO_FEATURES_append = " cmsblc" + +# CMS VSP2 Dynamic Gamma Correction Middleware for Linux (RTM0AC0000JRCMDGV0SL41C) +#DISTRO_FEATURES_append = " cmsdgc" + +# ISDB-T DTV Software Package for Linux (RTM0RC0000TE020000SL41C) +#DISTRO_FEATURES_append = " dtv" + +# DVD Core-Middleware for Linux (RTM0RC0000XDVDC301SL41C) +# DVD Encryption Library for Linux (RTM0RC0000XDVDF301SL41C) +#DISTRO_FEATURES_append = " dvd" +#DISTRO_FEATURES_append = " dvd_encryption_library" + +# ADSP Driver for Linux (RCG3AHPDL4101ZDO) +# ADSP Interface for Linux (RCG3AHIFL4101ZDP) +# ADSP Framework (RCG3AHFWN0201ZDP) +#DISTRO_FEATURES_append = " adsp" + +# AVB Software Package for Linux +#DISTRO_FEATURES_append = " avb" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Configuration for ivi-shell and ivi-extension +#DISTRO_FEATURES_append = " ivi-shell" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/bsp/bblayers.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/bsp/bblayers.conf new file mode 100644 index 00000000..d7ebf051 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/bsp/bblayers.conf @@ -0,0 +1,15 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ${TOPDIR}/../poky/meta \ + ${TOPDIR}/../poky/meta-poky \ + ${TOPDIR}/../poky/meta-yocto-bsp \ + ${TOPDIR}/../meta-renesas/meta-rcar-gen3 \ + ${TOPDIR}/../meta-openembedded/meta-oe \ + ${TOPDIR}/../meta-openembedded/meta-python \ + " diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/bsp/local-wayland.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/bsp/local-wayland.conf new file mode 100644 index 00000000..2009fcb7 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/bsp/local-wayland.conf @@ -0,0 +1,305 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "m3ulcb" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# for Wayland/Weston weston-laucher +DISTRO_FEATURES_NATIVESDK_append = " wayland" +DISTRO_FEATURES_append = " pam" + +# Mask the wayland related to GFX +BBMASK = "gles-user-module|kernel-module-gles|wayland-kms|libgbm" +# Mask MMP recipes +BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" + +# Mask the gstreamer recipe for MMP +BBMASK .= "|meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer" + +# Add for gstreamer plugins ugly +LICENSE_FLAGS_WHITELIST = "commercial" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Add Capacity Aware migration Strategy (CAS) +MACHINE_FEATURES_append = " cas" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/bsp/local.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/bsp/local.conf new file mode 100644 index 00000000..01ba6b19 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/bsp/local.conf @@ -0,0 +1,298 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "m3ulcb" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# Mask graphic Pkgs +BBMASK = "gles-user-module|kernel-module-gles|wayland-kms|libgbm" +# Mask MMP recipes +BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Enable pam distro feature +DISTRO_FEATURES_append = " pam" + +# Add Capacity Aware migration Strategy (CAS) +MACHINE_FEATURES_append = " cas" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/gfx-only/bblayers.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/gfx-only/bblayers.conf new file mode 100644 index 00000000..70d19537 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/gfx-only/bblayers.conf @@ -0,0 +1,15 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ${TOPDIR}/../poky/meta \ + ${TOPDIR}/../poky/meta-poky \ + ${TOPDIR}/../poky/meta-yocto-bsp \ + ${TOPDIR}/../meta-renesas/meta-rcar-gen3 \ + ${TOPDIR}/../meta-openembedded/meta-python \ + ${TOPDIR}/../meta-openembedded/meta-oe \ + " diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/gfx-only/local-wayland.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/gfx-only/local-wayland.conf new file mode 100644 index 00000000..7927e247 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/gfx-only/local-wayland.conf @@ -0,0 +1,311 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "m3ulcb" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# Enable Gfx Pkgs +MACHINE_FEATURES_append = " gsx" +MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2" + +# for Wayland/Weston +DISTRO_FEATURES_NATIVESDK_append = " wayland" +DISTRO_FEATURES_append = " pam" +PREFERRED_PROVIDER_virtual/libgles1 = "" +PREFERRED_PROVIDER_virtual/libgles2 = "gles-user-module" +PREFERRED_PROVIDER_virtual/egl = "libegl" +PREFERRED_PROVIDER_virtual/libgl = "" +PREFERRED_PROVIDER_virtual/mesa = "" +PREFERRED_PROVIDER_virtual/libgbm = "libgbm" +PREFERRED_PROVIDER_libgbm-dev = "libgbm" +BBMASK = "mesa-gl" +# Mask MMP recipes +BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" + +# Add for gstreamer plugins ugly +LICENSE_FLAGS_WHITELIST = "commercial" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Add Capacity Aware migration Strategy (CAS) +MACHINE_FEATURES_append = " cas" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/mmp/bblayers.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/mmp/bblayers.conf new file mode 100644 index 00000000..70d19537 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/mmp/bblayers.conf @@ -0,0 +1,15 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ${TOPDIR}/../poky/meta \ + ${TOPDIR}/../poky/meta-poky \ + ${TOPDIR}/../poky/meta-yocto-bsp \ + ${TOPDIR}/../meta-renesas/meta-rcar-gen3 \ + ${TOPDIR}/../meta-openembedded/meta-python \ + ${TOPDIR}/../meta-openembedded/meta-oe \ + " diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/mmp/local-wayland.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/mmp/local-wayland.conf new file mode 100644 index 00000000..549c4bb3 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/m3ulcb/poky-gcc/mmp/local-wayland.conf @@ -0,0 +1,417 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "m3ulcb" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# Enable Gfx Pkgs +MACHINE_FEATURES_append = " gsx" +MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2" + +# for Wayland/Weston +DISTRO_FEATURES_NATIVESDK_append = " wayland" +DISTRO_FEATURES_append = " pam" +PREFERRED_PROVIDER_virtual/libgles1 = "" +PREFERRED_PROVIDER_virtual/libgles2 = "gles-user-module" +PREFERRED_PROVIDER_virtual/egl = "libegl" +PREFERRED_PROVIDER_virtual/libgl = "" +PREFERRED_PROVIDER_virtual/mesa = "" +PREFERRED_PROVIDER_virtual/libgbm = "libgbm" +PREFERRED_PROVIDER_libgbm-dev = "libgbm" +BBMASK = "mesa-gl" + +# Enable Multimedia features +MACHINE_FEATURES_append = " multimedia" + +# for gstreamer omx plugins +LICENSE_FLAGS_WHITELIST = "commercial" +# for mmp test program +DISTRO_FEATURES_append = " mm-test" + +# for weston v4l2 renderer +#DISTRO_FEATURES_append = " v4l2-renderer" + +# OMX H263 decoder library for Linux (RTM0AC0000XV263D30SL41C) +#DISTRO_FEATURES_append = " h263dec_lib" + +# OMX H264 decoder library for Linux (RTM0AC0000XV264D30SL41C) +DISTRO_FEATURES_append = " h264dec_lib" + +# OMX H264 encoder library for Linux (RTM0AC0000XV264E30SL41C) +#DISTRO_FEATURES_append = " h264enc_lib" + +# OMX H265 decoder library for Linux (RTM0AC0000XV265D30SL41C) +#DISTRO_FEATURES_append = " h265dec_lib" + +# OMX MPEG2 decoder library for Linux (RTM0AC0000XVM2VD30SL41C) +#DISTRO_FEATURES_append = " mpeg2dec_lib" + +# OMX Media Component MPEG4 Decoder Library for Linux (RTM0AC0000XVM4VD30SL41C) +#DISTRO_FEATURES_append = " mpeg4dec_lib" + +# OMX Media Component VC-1 Decoder Library for Linux (RTM0AC0000XVVC1D30SL41C) +#DISTRO_FEATURES_append = " vc1dec_lib" + +# OMX Media Component DivXD Decoder Library for Linux (RTM0AC0000XVDVXD30SL41C) +#DISTRO_FEATURES_append = " divxdec_lib" + +# OMX Media Component RealVideo Decoder Library for Linux (RTM0AC0000XVRLVD30SL41C) +#DISTRO_FEATURES_append = " rvdec_lib" + +# OMX Media Component ALAC Decoder Library for Linux (RTM0AC0000XAALAD30SL41C) +#DISTRO_FEATURES_append = " alacdec_lib" + +# OMX Media Component FLAC Decoder Library for Linux (RTM0AC0000XAFLAD30SL41C) +#DISTRO_FEATURES_append = " flacdec_lib" + +# OMX AAC-LC decoder library for Linux (RTM0AC0000XAAACD30SL41C), +# AAC-LC 2ch decoder middleware library for Linux (RTM0AC0000ADAACMZ1SL41C) +DISTRO_FEATURES_append = " aaclcdec_lib" +DISTRO_FEATURES_append = " aaclcdec_mdw" + +# OMX aacPlus V2 decoder library for Linux (RTM0AC0000XAAAPD30SL41C), +# aacPlus V2 decoder middleware library for Linux (RTM0AC0000ADAAPMZ1SL41C) +#DISTRO_FEATURES_append = " aacpv2dec_lib" +#DISTRO_FEATURES_append = " aacpv2dec_mdw" + +# OMX MP3 decoder library for Linux (RTM0AC0000XAMP3D30SL41C), +# MP3 decoder middleware library for Linux (RTM0AC0000ADMP3MZ1SL41C) +#DISTRO_FEATURES_append = " mp3dec_lib" +#DISTRO_FEATURES_append = " mp3dec_mdw" + +# OMX WMA decoder library for Linux (RTM0AC0000XAWMAD30SL41C), +# WMA decoder middleware library for Linux (RTM0AC0000ADWMAMZ1SL41C) +#DISTRO_FEATURES_append = " wmadec_lib" +#DISTRO_FEATURES_append = " wmadec_mdw" + +# OMX AAC-LC encoder library for Linux (RTM0AC0000XAAACE30SL41C) +# AAC-LC encoder middleware library for Linux (RTM0AC0000AEAACMZ1SL41C) +#DISTRO_FEATURES_append = " aaclcenc_lib" +#DISTRO_FEATURES_append = " aaclcenc_mdw" + +# OMX Dolby(R) Digital decoder library for Linux (RTM0AC0000XADD5D30SL41C), +# Dolby(R) Digital decoder middleware library for Linux (RTM0AC0000ADDD5MZ1SL41C) +#DISTRO_FEATURES_append = " dddec_lib" +#DISTRO_FEATURES_append = " dddec_mdw" + +# OMX Media Component VP8 Decoder Library for Linux (RTM0AC0000XVVP8D30SL41C) +#DISTRO_FEATURES_append = " vp8dec_lib" + +# OMX Media Component VP8 Encoder Library for Linux (RTM0AC0000XVVP8E30SL41C) +#DISTRO_FEATURES_append = " vp8enc_lib" + +# CMS Basic Color Management Middleware for Linux (RTM0AC0000JRCMBCV0SL41C) +#DISTRO_FEATURES_append = " cmsbcm" + +# CMS CMM3 Backlight Control Middleware for Linux (RTM0AC0000JRCMBLC0SL41C) +#DISTRO_FEATURES_append = " cmsblc" + +# CMS VSP2 Dynamic Gamma Correction Middleware for Linux (RTM0AC0000JRCMDGV0SL41C) +#DISTRO_FEATURES_append = " cmsdgc" + +# ISDB-T DTV Software Package for Linux (RTM0RC0000TE020000SL41C) +#DISTRO_FEATURES_append = " dtv" + +# DVD Core-Middleware for Linux (RTM0RC0000XDVDC301SL41C) +# DVD Encryption Library for Linux (RTM0RC0000XDVDF301SL41C) +#DISTRO_FEATURES_append = " dvd" +#DISTRO_FEATURES_append = " dvd_encryption_library" + +# ADSP Driver for Linux (RCG3AHPDL4101ZDO) +# ADSP Interface for Linux (RCG3AHIFL4101ZDP) +# ADSP Framework (RCG3AHFWN0201ZDP) +#DISTRO_FEATURES_append = " adsp" + +# AVB Software Package for Linux +#DISTRO_FEATURES_append = " avb" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Evaluation packages +#DISTRO_FEATURES_append = " use_eva_pkg" + +# Configuration for ivi-shell and ivi-extension +#DISTRO_FEATURES_append = " ivi-shell" + +# Add Capacity Aware migration Strategy (CAS) +MACHINE_FEATURES_append = " cas" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/bsp/bblayers.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/bsp/bblayers.conf new file mode 100644 index 00000000..d7ebf051 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/bsp/bblayers.conf @@ -0,0 +1,15 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ${TOPDIR}/../poky/meta \ + ${TOPDIR}/../poky/meta-poky \ + ${TOPDIR}/../poky/meta-yocto-bsp \ + ${TOPDIR}/../meta-renesas/meta-rcar-gen3 \ + ${TOPDIR}/../meta-openembedded/meta-oe \ + ${TOPDIR}/../meta-openembedded/meta-python \ + " diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/bsp/local-ltp.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/bsp/local-ltp.conf new file mode 100644 index 00000000..c56623ba --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/bsp/local-ltp.conf @@ -0,0 +1,309 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "salvator-x" + +# This sets the SoC +# H3: r8a7795, M3: r8a7796, M3N: r8a77965 +SOC_FAMILY = "r8a7795" +#SOC_FAMILY = "r8a7796" +#SOC_FAMILY = "r8a77965" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# Mask graphic Pkgs +BBMASK = "gles-user-module|kernel-module-gles|wayland-kms|libgbm" +# Mask MMP recipes +BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Configuration for USB 3.0 +#MACHINE_FEATURES_append = " usb3" + +# Add Capacity Aware migration Strategy (CAS) +MACHINE_FEATURES_append = " cas" + +# Additional packages for LTP +DISTRO_FEATURES_append = " pam" +CORE_IMAGE_EXTRA_INSTALL_append = " ltp" +IMAGE_INSTALL_append = " binutils elfutils file quota tar bzip2 sudo shadow glibc-utils net-tools procps cdrkit kernel-modules" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/bsp/local-wayland.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/bsp/local-wayland.conf new file mode 100644 index 00000000..80d6cddc --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/bsp/local-wayland.conf @@ -0,0 +1,314 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "salvator-x" + +# This sets the SoC +# H3: r8a7795, M3: r8a7796, M3N: r8a77965 +SOC_FAMILY = "r8a7795" +#SOC_FAMILY = "r8a7796" +#SOC_FAMILY = "r8a77965" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# for Wayland/Weston weston-laucher +DISTRO_FEATURES_NATIVESDK_append = " wayland" +DISTRO_FEATURES_append = " pam" + +# Mask the wayland related to GFX +BBMASK = "gles-user-module|kernel-module-gles|wayland-kms|libgbm" +# Mask MMP recipes +BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" + +# Mask the gstreamer recipe for MMP +BBMASK .= "|meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer" + +# Add for gstreamer plugins ugly +LICENSE_FLAGS_WHITELIST = "commercial" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Configuration for USB 3.0 +#MACHINE_FEATURES_append = " usb3" + +# Add Capacity Aware migration Strategy (CAS) +MACHINE_FEATURES_append = " cas" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/bsp/local.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/bsp/local.conf new file mode 100644 index 00000000..f57972ae --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/bsp/local.conf @@ -0,0 +1,307 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "salvator-x" + +# This sets the SoC +# H3: r8a7795, M3: r8a7796, M3N: r8a77965 +SOC_FAMILY = "r8a7795" +#SOC_FAMILY = "r8a7796" +#SOC_FAMILY = "r8a77965" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# Mask graphic Pkgs +BBMASK = "gles-user-module|kernel-module-gles|wayland-kms|libgbm" +# Mask MMP recipes +BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Enable pam distro feature +DISTRO_FEATURES_append = " pam" + +# Configuration for USB 3.0 +#MACHINE_FEATURES_append = " usb3" + +# Add Capacity Aware migration Strategy (CAS) +MACHINE_FEATURES_append = " cas" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/gfx-only/bblayers.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/gfx-only/bblayers.conf new file mode 100644 index 00000000..70d19537 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/gfx-only/bblayers.conf @@ -0,0 +1,15 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ${TOPDIR}/../poky/meta \ + ${TOPDIR}/../poky/meta-poky \ + ${TOPDIR}/../poky/meta-yocto-bsp \ + ${TOPDIR}/../meta-renesas/meta-rcar-gen3 \ + ${TOPDIR}/../meta-openembedded/meta-python \ + ${TOPDIR}/../meta-openembedded/meta-oe \ + " diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/gfx-only/local-wayland.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/gfx-only/local-wayland.conf new file mode 100644 index 00000000..23876c25 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/gfx-only/local-wayland.conf @@ -0,0 +1,320 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "salvator-x" + +# This sets the SoC +# H3: r8a7795, M3: r8a7796, M3N: r8a77965 +SOC_FAMILY = "r8a7795" +#SOC_FAMILY = "r8a7796" +#SOC_FAMILY = "r8a77965" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# Enable Gfx Pkgs +MACHINE_FEATURES_append = " gsx" +MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2" + +# for Wayland/Weston +DISTRO_FEATURES_NATIVESDK_append = " wayland" +DISTRO_FEATURES_append = " pam" +PREFERRED_PROVIDER_virtual/libgles1 = "" +PREFERRED_PROVIDER_virtual/libgles2 = "gles-user-module" +PREFERRED_PROVIDER_virtual/egl = "libegl" +PREFERRED_PROVIDER_virtual/libgl = "" +PREFERRED_PROVIDER_virtual/mesa = "" +PREFERRED_PROVIDER_virtual/libgbm = "libgbm" +PREFERRED_PROVIDER_libgbm-dev = "libgbm" +BBMASK = "mesa-gl" +# Mask MMP recipes +BBMASK .= "|kernel-module-uvcs-drv|omx-user-module" + +# Add for gstreamer plugins ugly +LICENSE_FLAGS_WHITELIST = "commercial" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Configuration for USB 3.0 +#MACHINE_FEATURES_append = " usb3" + +# Add Capacity Aware migration Strategy (CAS) +MACHINE_FEATURES_append = " cas" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/mmp/bblayers.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/mmp/bblayers.conf new file mode 100644 index 00000000..70d19537 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/mmp/bblayers.conf @@ -0,0 +1,15 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ${TOPDIR}/../poky/meta \ + ${TOPDIR}/../poky/meta-poky \ + ${TOPDIR}/../poky/meta-yocto-bsp \ + ${TOPDIR}/../meta-renesas/meta-rcar-gen3 \ + ${TOPDIR}/../meta-openembedded/meta-python \ + ${TOPDIR}/../meta-openembedded/meta-oe \ + " diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/mmp/local-wayland.conf b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/mmp/local-wayland.conf new file mode 100644 index 00000000..55301425 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/conf/salvator-x/poky-gcc/mmp/local-wayland.conf @@ -0,0 +1,429 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "salvator-x" + +# This sets the SoC +# H3: r8a7795, M3: r8a7796, M3N: r8a77965 +SOC_FAMILY = "r8a7795" +#SOC_FAMILY = "r8a7796" +#SOC_FAMILY = "r8a77965" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +USER_CLASSES ?= "buildstats image-mklibs image-prelink" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting the following line. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# equally, it will also speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG_append_pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with "<HOSTNAME>:<PORT>" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" + +# Add systemd configuration +DISTRO_FEATURES_append = " systemd" +VIRTUAL-RUNTIME_init_manager = "systemd" + +# add the static lib to SDK toolchain +SDKIMAGE_FEATURES_append = " staticdev-pkgs" + +# Enable Gfx Pkgs +MACHINE_FEATURES_append = " gsx" +MULTI_PROVIDER_WHITELIST += "virtual/libgl virtual/egl virtual/libgles1 virtual/libgles2" + +# for Wayland/Weston +DISTRO_FEATURES_NATIVESDK_append = " wayland" +DISTRO_FEATURES_append = " pam" +PREFERRED_PROVIDER_virtual/libgles1 = "" +PREFERRED_PROVIDER_virtual/libgles2 = "gles-user-module" +PREFERRED_PROVIDER_virtual/egl = "libegl" +PREFERRED_PROVIDER_virtual/libgl = "" +PREFERRED_PROVIDER_virtual/mesa = "" +PREFERRED_PROVIDER_virtual/libgbm = "libgbm" +PREFERRED_PROVIDER_libgbm-dev = "libgbm" +BBMASK = "mesa-gl" + +# Enable Multimedia features +MACHINE_FEATURES_append = " multimedia" + +# for gstreamer omx plugins +LICENSE_FLAGS_WHITELIST = "commercial" +# for mmp test program +DISTRO_FEATURES_append = " mm-test" + +# for weston v4l2 renderer +#DISTRO_FEATURES_append = " v4l2-renderer" + +# OMX H263 decoder library for Linux (RTM0AC0000XV263D30SL41C) +#DISTRO_FEATURES_append = " h263dec_lib" + +# OMX H264 decoder library for Linux (RTM0AC0000XV264D30SL41C) +DISTRO_FEATURES_append = " h264dec_lib" + +# OMX H264 encoder library for Linux (RTM0AC0000XV264E30SL41C) +#DISTRO_FEATURES_append = " h264enc_lib" + +# OMX H265 decoder library for Linux (RTM0AC0000XV265D30SL41C) +#DISTRO_FEATURES_append = " h265dec_lib" + +# OMX MPEG2 decoder library for Linux (RTM0AC0000XVM2VD30SL41C) +#DISTRO_FEATURES_append = " mpeg2dec_lib" + +# OMX Media Component MPEG4 Decoder Library for Linux (RTM0AC0000XVM4VD30SL41C) +#DISTRO_FEATURES_append = " mpeg4dec_lib" + +# OMX Media Component VC-1 Decoder Library for Linux (RTM0AC0000XVVC1D30SL41C) +#DISTRO_FEATURES_append = " vc1dec_lib" + +# OMX Media Component DivXD Decoder Library for Linux (RTM0AC0000XVDVXD30SL41C) +#DISTRO_FEATURES_append = " divxdec_lib" + +# OMX Media Component RealVideo Decoder Library for Linux (RTM0AC0000XVRLVD30SL41C) +#DISTRO_FEATURES_append = " rvdec_lib" + +# OMX Media Component ALAC Decoder Library for Linux (RTM0AC0000XAALAD30SL41C) +#DISTRO_FEATURES_append = " alacdec_lib" + +# OMX Media Component FLAC Decoder Library for Linux (RTM0AC0000XAFLAD30SL41C) +#DISTRO_FEATURES_append = " flacdec_lib" + +# OMX AAC-LC decoder library for Linux (RTM0AC0000XAAACD30SL41C), +# AAC-LC 2ch decoder middleware library for Linux (RTM0AC0000ADAACMZ1SL41C) +DISTRO_FEATURES_append = " aaclcdec_lib" +DISTRO_FEATURES_append = " aaclcdec_mdw" + +# OMX aacPlus V2 decoder library for Linux (RTM0AC0000XAAAPD30SL41C), +# aacPlus V2 decoder middleware library for Linux (RTM0AC0000ADAAPMZ1SL41C) +#DISTRO_FEATURES_append = " aacpv2dec_lib" +#DISTRO_FEATURES_append = " aacpv2dec_mdw" + +# OMX MP3 decoder library for Linux (RTM0AC0000XAMP3D30SL41C), +# MP3 decoder middleware library for Linux (RTM0AC0000ADMP3MZ1SL41C) +#DISTRO_FEATURES_append = " mp3dec_lib" +#DISTRO_FEATURES_append = " mp3dec_mdw" + +# OMX WMA decoder library for Linux (RTM0AC0000XAWMAD30SL41C), +# WMA decoder middleware library for Linux (RTM0AC0000ADWMAMZ1SL41C) +#DISTRO_FEATURES_append = " wmadec_lib" +#DISTRO_FEATURES_append = " wmadec_mdw" + +# OMX AAC-LC encoder library for Linux (RTM0AC0000XAAACE30SL41C) +# AAC-LC encoder middleware library for Linux (RTM0AC0000AEAACMZ1SL41C) +#DISTRO_FEATURES_append = " aaclcenc_lib" +#DISTRO_FEATURES_append = " aaclcenc_mdw" + +# OMX Dolby(R) Digital decoder library for Linux (RTM0AC0000XADD5D30SL41C), +# Dolby(R) Digital decoder middleware library for Linux (RTM0AC0000ADDD5MZ1SL41C) +#DISTRO_FEATURES_append = " dddec_lib" +#DISTRO_FEATURES_append = " dddec_mdw" + +# OMX Media Component VP8 Decoder Library for Linux (RTM0AC0000XVVP8D30SL41C) +#DISTRO_FEATURES_append = " vp8dec_lib" + +# OMX Media Component VP8 Encoder Library for Linux (RTM0AC0000XVVP8E30SL41C) +#DISTRO_FEATURES_append = " vp8enc_lib" + +# OMX Media Component VP9 Decoder Library for Linux (RTM0AC0000XVVP9D30SL41C) +#DISTRO_FEATURES_append = " vp9dec_lib" + +# CMS Basic Color Management Middleware for Linux (RTM0AC0000JRCMBCV0SL41C) +#DISTRO_FEATURES_append = " cmsbcm" + +# CMS CMM3 Backlight Control Middleware for Linux (RTM0AC0000JRCMBLC0SL41C) +#DISTRO_FEATURES_append = " cmsblc" + +# CMS VSP2 Dynamic Gamma Correction Middleware for Linux (RTM0AC0000JRCMDGV0SL41C) +#DISTRO_FEATURES_append = " cmsdgc" + +# ISDB-T DTV Software Package for Linux (RTM0RC0000TE020000SL41C) +#DISTRO_FEATURES_append = " dtv" + +# DVD Core-Middleware for Linux (RTM0RC0000XDVDC301SL41C) +# DVD Encryption Library for Linux (RTM0RC0000XDVDF301SL41C) +#DISTRO_FEATURES_append = " dvd" +#DISTRO_FEATURES_append = " dvd_encryption_library" + +# ADSP Driver for Linux (RCG3AHPDL4101ZDO) +# ADSP Interface for Linux (RCG3AHIFL4101ZDP) +# ADSP Framework (RCG3AHFWN0201ZDP) +#DISTRO_FEATURES_append = " adsp" + +# AVB Software Package for Linux +#DISTRO_FEATURES_append = " avb" + +# Linux ICCOM driver (RCG3ZLIDL4101ZNO) +# Linux ICCOM library (RCG3ZLILL4101ZNO) +#DISTRO_FEATURES_append = " iccom" + +# Evaluation packages +#DISTRO_FEATURES_append = " use_eva_pkg" + +# Configuration for ivi-shell and ivi-extension +#DISTRO_FEATURES_append = " ivi-shell" + +# Configuration for USB 3.0 +#MACHINE_FEATURES_append = " usb3" + +# Add Capacity Aware migration Strategy (CAS) +MACHINE_FEATURES_append = " cas" + +# Remove ptest to reduce the build time +DISTRO_FEATURES_remove = "ptest" + +# Reproducible Builds +# Set Timestamps at the build start +export SOURCE_DATE_EPOCH = "${@time.strftime('%s', time.localtime())}" +REPRODUCIBLE_TIMESTAMP_ROOTFS = "${@time.strftime('%s', time.localtime())}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/copyscript/copy_evaproprietary_softwares.sh b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/copyscript/copy_evaproprietary_softwares.sh new file mode 100755 index 00000000..fd867b34 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/copyscript/copy_evaproprietary_softwares.sh @@ -0,0 +1,1032 @@ +#!/bin/sh + +# Copyright (C) Renesas Electronics Corporation 2016-2018 All rights reserved. + +usage() +{ +cat << EOF + usage: `basename $0` [-f] [-d] source-directory + -f: fource copy. ignore md5check + -d: debug mode + + Ex) + `basename $0` -f my_package_dir +EOF +} + +##### MD5 list ##### +. `dirname $0`/md5list.txt + +##### Library List ##### +# Audio Library +# Please add omx audio library to "_audio_list" +# Don't use space in xxx_name. +# audio_list="<software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name>" +_audio_list="AAC-LC_decoder_lib,EVARTM0AC0000XAAACD30SL41C,RTM0AC0000XAAACD30SL41C.tar.gz \ + AAC-LC_encoder_lib,EVARTM0AC0000XAAACE30SL41C,RTM0AC0000XAAACE30SL41C.tar.gz" + +# Audio M/W Library +# Please add omx audio library to "_audio_mw_list" +# Don't use space in xxx_name. +# audio_mw_list="<software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name>" +_audio_mw_list="AAC-LC_decoder_M/W,EVARTM0AC0000ADAACMZ1SL41C,RTM0AC0000ADAACMZ1SL41C.tar.gz \ + AAC-LC_encoder_M/W,EVARTM0AC0000AEAACMZ1SL41C,RTM0AC0000AEAACMZ1SL41C.tar.gz" + +# Video Decoder Library +# Please add omx video decoder library to "_video_dec_list" +# Don't use space in xxx_name. +# video_dec_list="<software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name>" +_video_dec_list="H264_decoder,EVARTM0AC0000XV264D30SL41C,EVARTM0AC0000XV264D30SL41C.tar.bz2" + +# Video Encoder Library +# Please add omx video encoder library to "_video_enc_list" +# Don't use space in xxx_name. +# video_enc_list="<software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name>" +_video_enc_list="H264_encoder,EVARTM0AC0000XV264E30SL41C,EVARTM0AC0000XV264E30SL41C.tar.bz2" + +# Common library packages +# Don't use space in xxx_name. +# XXX_list="<software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name>" +_omx_common_list="omx_common_lib,EVARTM0AC0000XCMCTL30SL41C,EVARTM0AC0000XCMCTL30SL41C.tar.bz2" +_uvcs_list="uvcs_lib,RCG3VUDRL4101ZDO,RCG3VUDRL4101ZDO.tar.bz2" +_video_enc_common_list="video_enc_common,EVARTM0AC0000XVCMNE30SL41C,EVARTM0AC0000XVCMNE30SL41C.tar.bz2" +_video_dec_common_list="video_dec_common,EVARTM0AC0000XVCMND30SL41C,EVARTM0AC0000XVCMND30SL41C.tar.bz2" +_audio_common_list="audio_common,EVARTM0AC0000XACMND30SL41C,RTM0AC0000XACMND30SL41C.tar.gz" + +# GFX +# Please add GFX to "_gfx_list" +# Don't use space in xxx_name. +# gfx_list="<package_name(user)>,<copy_file_name(user)>,<package_name(kernel)>,<copy_file_name(kernel)> \ +# <package_name(user)>,<copy_file_name(user)>,<package_name(kernel)>,<copy_file_name(kernel)> \ +# <package_name(user)>,<copy_file_name(user)>,<package_name(kernel)>,<copy_file_name(kernel)>" +_gfx_list="EVARTM0RC7795GLPG0001SL41C,EVA_r8a77951_linux_gsx_binaries_gles.tar.bz2,RCH3G001L4101ZDO,GSX_KM_H3.tar.bz2 \ + EVARTM0RC7796GLPG0001SL41C,EVA_r8a77960_linux_gsx_binaries_gles.tar.bz2,RCM3G001L4101ZDO,GSX_KM_M3.tar.bz2" + +##### static value +_MODE_ZIP=1 +_MODE_TAR=2 +_GFX_KM_INST_DIR="../meta-rcar-gen3/recipes-kernel/kernel-module-gles/kernel-module-gles" +_GFX_UM_INST_DIR="../meta-rcar-gen3/recipes-graphics/gles-module/gles-user-module" +_UVCS_INST_DIR="../meta-rcar-gen3/recipes-kernel/kernel-module-uvcs/kernel-module-uvcs-drv" +_OMX_UM_INST_DIR="../meta-rcar-gen3/recipes-multimedia/omx-module/omx-user-module" + +##### common function + +# $1: search file name +# $2: search directory +# return global variable +# _find_filename: find filename +# _extract_mode: _MODE_ZIP or _MODE_TAR +func_cmn_find_file() +{ +# echo "$1" +# echo "$2" + if [ -z "$1" ]; then + func_error "ERROR: func_cmn_find_file: empty filename" + fi + + if [ -z "$2" ]; then + _search_dir=${_src_full} + else + _search_dir=$2 + fi + + # search zip file +# zip_count=`find ${_search_dir} -maxdepth 1 -name "$1*.zip" | wc -l` + zip_count=`ls ${_search_dir}/$1*.zip 2>/dev/null | wc -l` + + # search tar file +# tar_count=`find ${_search_dir} -maxdepth 1 -name "$1*.tar.*" | wc -l` + tar_count=`ls ${_search_dir}/$1*.tar.* 2>/dev/null | wc -l` + + # duplicate file check + if [ 1 -lt `expr $zip_count + $tar_count` ]; then + echo "file1_zip = $zip_count" + echo "file1_tar = $tar_count" + func_error "ERROR: $1: too many files" + fi + + # set result + if [ 1 = $zip_count ]; then + _find_filename=$(ls ${_search_dir}/$1*.zip) + _extract_mode=${_MODE_ZIP} + elif [ 1 = $tar_count ]; then + _find_filename=$(ls ${_search_dir}/$1*.tar.*) + _extract_mode=${_MODE_TAR} + else + _find_filename="" + fi +} + +# $1: Mode +# $2: archive file name +func_cmn_extract_archive() +{ + case $1 in + $_MODE_ZIP) +# echo "Zip mode" + unzip -oq $2 + ;; + $_MODE_TAR) +# echo "Tar mode" + tar xf $2 + ;; + *) + func_error "ERROR: func_cmn_extract_archive: mode error." + exit 1 + ;; + esac +} + +# $1: set target filename. +# $2: set MD5 expectation value. +func_cmn_md5_check() +{ + _md5_func_param_filename=$1 + _md5_func_param_expectation=$2 + if [ ! -e ${_md5_func_param_filename} ]; then + func_error "func_cmn_md5_check : ERROR ${_md5_func_param_filename} not found." + fi + + _calc_md5=$(md5sum ${_md5_func_param_filename} | cut -d " " -f1) + + if [ -n "${_no_md5check}" ] || [ -z ${_md5_func_param_expectation} ]; then + echo "Skip MD5 : `basename ${_md5_func_param_filename}`" + return + fi + + if [ -n "${_debug}" ]; then + echo "MD5 target file = ${_md5_func_param_filename}" + echo "calc_md5 = ${_calc_md5}" + echo "expect_value = ${_md5_func_param_expectation}" + fi + + if [ ${_calc_md5} = ${_md5_func_param_expectation} ]; then + echo "MD5 OK : `basename ${_md5_func_param_filename}`" + else + echo "calc_md5 = ${_calc_md5}" + echo "expect_value = ${_md5_func_param_expectation}" + func_error "MD5 ERROR : ${_md5_func_param_filename}" + fi +} + +##### Error function +# $1: error message +func_error() +{ + echo "$1" + # cleanup temp directory. + func_clean_tempdir + exit 1 +} + +##### cleanup temp directory +func_clean_tempdir() +{ + echo "cleanup temp directory" + rm -rf ${TMPWORK} +} + +##### Template function for Single package + +# $1: package name +# $2: search target filename +# $3: search directory (full path) +# return +# _find_filename : the found file (full path) +# _extract_top_dir_name +func_search_file_in_package() +{ + # search package file + func_cmn_find_file $1 $3 + if [ -n "${_debug}" ]; then + echo "" + echo "FileName = ${_find_filename}" + echo "Mode = ${_extract_mode}" + fi + + if [ -z "${_find_filename}" ]; then + return + fi + + # extract + func_cmn_extract_archive ${_extract_mode} "${_find_filename}" + + # Get directory name + # {PATH}/Package_Version.tar.gz or XXXX.zip --> Package_Version + top_dir=$(basename ${_find_filename}) + top_dir=${top_dir%.*} + + # search file + num=`find ${top_dir} -name $2 | wc -l` + if [ ${num} -eq 1 ]; then + _find_filename=`find ${top_dir} -name $2` + else + # same filename exists. + _find_filename=`find ${top_dir} -name $2 | grep Software` + fi + + # set mode + if [ `echo ${_find_filename} | grep '\.'zip` ]; then + _extract_mode=${_MODE_ZIP} + else + _extract_mode=${_MODE_TAR} + fi + + # set return value + _extract_top_dir_name=${top_dir} +} + +# $1: package name +# $2: copy filename (md5 target) +# $3: expect MD5 value +# $4: search directory (full path) +# return +# _find_file_name +# _extract_top_dir_name +func_search_and_md5check() +{ + # search package file + func_cmn_find_file $1 $4 + if [ -n "${_debug}" ]; then + echo "" + echo "FileName = ${_find_filename}" + echo "Mode = ${_extract_mode}" + fi + + if [ -z "${_find_filename}" ]; then + return + fi + + # extract + func_cmn_extract_archive ${_extract_mode} "${_find_filename}" + + # MD5 + # Get directory name + # {PATH}/Package_Version.tar.gz or XXXX.zip --> Package_Version + top_dir=$(basename ${_find_filename}) + top_dir=${top_dir%.*} + + # call func_cmn_md5_check +# func_cmn_md5_check "${top_dir}/$1/Software/$2" "$3" + + # set return value + _extract_top_dir_name=${top_dir} +} + +##### Template function for Group package +# $1: group package name +# $2: single package name +# $3: copy filename (md5 target) +# $4: expect MD5 value +# $5: search directory (full path) +# return +# _find_file_name +# _extract_top_dir_name +# +# NOTE) This function support level1 packaging. "grp pkg in grp pkg" dose note support. +func_search_and_md5check_grp() +{ + # search group package @SRCDIR + func_cmn_find_file $1 $5 + if [ -n "${_debug}" ]; then + echo "search group package" + echo "FileName = ${_find_filename}" + echo "Mode = ${_extract_mode}" + echo "" + fi + + if [ -z "${_find_filename}" ]; then + return + fi + + # extract group package @TMPWORK + func_cmn_extract_archive ${_extract_mode} "${_find_filename}" + + cd ${_find_filename} + # check group pachage structure + # <Package name>_<version>/Package_Info.txt + top_dir=$(basename ${_find_filename}) + top_dir=${top_dir%.*} + + if [ ! -e ${top_dir}/Package_Info.txt ]; then + echo "grp package = $1" + echo "single package = $2" + func_error "ERROR: Package_Info.txt not found in Group package." + fi + + # search single package @TMPWORK/TOPDIR/<Group Package name>/ + func_cmn_find_file $2 "${TMPWORK}/${top_dir}/$1" + if [ -n "${_debug}" ]; then + echo "search single package" + echo "FileName = ${_find_filename}" + echo "Mode = ${_extract_mode}" + echo "" + fi + + if [ -z "${_find_filename}" ]; then + return + fi + + # mv <single package> TMPWORK/. + mv ${_find_filename} ${TMPWORK}/. + + # delete group package + rm -rf ${TMPWORK}/${top_dir} + + # call search and md5check @TMPWORK + func_search_and_md5check $2 $3 $4 ${TMPWORK} +} + +##### File search and MD5check for Package list +# $1: package list +# $2: rigid flag (1: true, other: false) +# +# return +# 1: [Success] One or more files were found. +# 0: [Fail] File not found +# +# package list format +# list ="<software_name>,<package_name>,<copy_file_name>,<md5_variable_name> \ +# <software_name>,<package_name>,<copy_file_name>,<md5_variable_name> \ +# <software_name>,<package_name>,<copy_file_name>,<md5_variable_name>" +# +# Note) Don't use space in xxx_name. +# Note) md5_variable_name is defined in md5list.txt. +# Prefix "_MD5_" is added automaticary. ex) FOO --> _MD5_FOO +# It is omissible. The default is "_MD5_<package_name>". +func_list_search_and_md5check () +{ + find_flag=0 + + for i in $1 + do + sw_name=`echo $i | cut -d "," -f 1` + pkg_name=`echo $i | cut -d "," -f 2` + copyfile_name=`echo $i | cut -d "," -f 3` + md5_val=`echo $i | cut -d "," -f 4` + + # <MD5_name> is empty. Default MD5 name is "_MD5_<pkg_name>" + if [ -z "${md5_val}" ]; then + md5_val=`eval echo '$_MD5_'${pkg_name}` + else + md5_val=`eval echo '$_MD5_'${md5_val}` + fi + + if [ -n "${_debug}" ]; then + echo "" + echo "sw_name = $sw_name" + echo "pkg_name = $pkg_name" + echo "copyfile_name = $copyfile_name" + echo "md5_val = $md5_val" + fi + + func_search_and_md5check "${pkg_name}" "${copyfile_name}" "${md5_val}" "${_src_full}" + if [ -z "${_find_filename}" ]; then + echo "${sw_name} not found!" + # rigid flag = TRUE. Not found = ERROR + if [ "X$2" = "X1" ]; then + return 0 + fi + else + find_flag=1 + fi + done + + return ${find_flag} +} + +##### File search and install (without MD5check) for Package list +# +# $1: package list +# $2: install directory +# +# return +# 1: [Success] One or more files were installed. +# 0: [Fail] File not found +# +# package list format +# list ="<software_name>,<package_name>,<copy_file_name>,<md5_variable_name> \ +# <software_name>,<package_name>,<copy_file_name>,<md5_variable_name> \ +# <software_name>,<package_name>,<copy_file_name>,<md5_variable_name>" +# +# Note) Don't use space in xxx_name. +# Note) md5_variable_name is defined in md5list.txt. +# Prefix "_MD5_" is added automaticary. ex) FOO --> _MD5_FOO +# It is omissible. The default is "_MD5_<package_name>". +func_list_search_and_install_wo_md5check() +{ + find_flag=0 + + for i in $1 + do + sw_name=`echo $i | cut -d "," -f 1` + pkg_name=`echo $i | cut -d "," -f 2` + copyfile_name=`echo $i | cut -d "," -f 3` + md5_val=`echo $i | cut -d "," -f 4` + + # <MD5_name> is empty. Default MD5 name is "_MD5_<pkg_name>" + if [ -z "${md5_val}" ]; then + md5_val=`eval echo '$_MD5_'$pkg_name` + else + md5_val=`eval echo '$_MD5_'${md5_val}` + fi + + copyfile_name=$(basename ${copyfile_name}) + + if [ -n "${_debug}" ]; then + echo "" + echo "sw_name = $sw_name" + echo "pkg_name = $pkg_name" + echo "copyfile_name = $copyfile_name" + echo "md5_val = $md5_val" + fi + + # file search + func_search_file_in_package "${pkg_name}" "${copyfile_name}" "${_src_full}" + if [ -z "${_find_filename}" ]; then + echo "${sw_name} not found!" + else + find_flag=1 + + # install + install -d $2 + install -m 0644 ${_find_filename} $2 + echo "Installed $sw_name" + echo " : ${pkg_name}" + fi + done + + return ${find_flag} +} + +##### File search and install for Package list +# +# $1: package list +# $2: install directory +# +# return +# 1: [Success] One or more files were installed. +# 0: [Fail] File not found +# +# package list format +# list ="<software_name>,<package_name>,<copy_file_name>,<md5_variable_name> \ +# <software_name>,<package_name>,<copy_file_name>,<md5_variable_name> \ +# <software_name>,<package_name>,<copy_file_name>,<md5_variable_name>" +# +# Note) Don't use space in xxx_name. +# Note) md5_variable_name is defined in md5list.txt. +# Prefix "_MD5_" is added automaticary. ex) FOO --> _MD5_FOO +# It is omissible. The default is "_MD5_<package_name>". +func_list_search_and_install() +{ + find_flag=0 + + for i in $1 + do + sw_name=`echo $i | cut -d "," -f 1` + pkg_name=`echo $i | cut -d "," -f 2` + copyfile_name=`echo $i | cut -d "," -f 3` + md5_val=`echo $i | cut -d "," -f 4` + + # <MD5_name> is empty. Default MD5 name is "_MD5_<pkg_name>" + if [ -z "${md5_val}" ]; then + md5_val=`eval echo '$_MD5_'$pkg_name` + else + md5_val=`eval echo '$_MD5_'${md5_val}` + fi + + if [ -n "${_debug}" ]; then + echo "" + echo "sw_name = $sw_name" + echo "pkg_name = $pkg_name" + echo "copyfile_name = $copyfile_name" + echo "md5_val = $md5_val" + fi + + # seach & MD5 check + func_search_and_md5check "${pkg_name}" "${copyfile_name}" "${md5_val}" "${_src_full}" + if [ -z "${_find_filename}" ]; then + echo "${sw_name} not found!" + else + find_flag=1 + + # Get directory name + # _find_filename = pkg file (full path). It is not copyfile. + top_dir=$(basename ${_find_filename}) + top_dir=${top_dir%.*} + + # install + install -d $2 + install -m 0644 ${top_dir}/${pkg_name}/Software/${copyfile_name} $2 + echo "Installed $sw_name" + echo " : ${pkg_name}" + fi + done + + return ${find_flag} +} + +##### Package function + +# For 3D graphics packages +func_gfx() +{ + echo "" + echo "Copying for Graphic Packages" + + copy_flag=0 + + for i in ${_gfx_list} + do + user_pkg_name=`echo $i | cut -d "," -f 1` + user_copyfile_name=`echo $i | cut -d "," -f 2` + user_md5_val=`eval echo '$_MD5_'${user_pkg_name}` + kern_pkg_name=`echo $i | cut -d "," -f 3` + kern_copyfile_name=`echo $i | cut -d "," -f 4` + kern_md5_val=`eval echo '$_MD5_'${kern_pkg_name}` + + if [ -n "${_debug}" ]; then + echo "" + echo "user_pkg_name = ${user_pkg_name}" + echo "user_copyfile_name= ${user_copyfile_name}" + echo "user_md5_val = ${user_md5_val}" + echo "kern_pkg_name = ${kern_pkg_name}" + echo "kern_copyfile_name= ${kern_copyfile_name}" + echo "kern_md5_val = ${kern_md5_val}" + fi + + # user module (file1) + func_search_and_md5check "${user_pkg_name}" "${user_copyfile_name}" "${user_md5_val}" "${_src_full}" + + if [ -z "${_find_filename}" ]; then + echo "${user_pkg_name} not found!" + continue + fi + + file1_top_dir=${_extract_top_dir_name} + echo "file1 top : ${file1_top_dir}" + + # kernel module (file2) + func_search_and_md5check "${kern_pkg_name}" "${kern_copyfile_name}" "${kern_md5_val}" "${_src_full}" + + # file1 exist, but file2 not exist + if [ -z "${_find_filename}" ]; then + func_error "ERROR: func_gfx: package file for Graphic is incomplete." + fi + + file2_top_dir=${_extract_top_dir_name} + echo "file2 top : ${file2_top_dir}" + + # Finally copy is performed + copy_flag=1 + install -d ${_GFX_UM_INST_DIR} + install -m 0644 ${file1_top_dir}/${user_pkg_name}/Software/${user_copyfile_name} ${_GFX_UM_INST_DIR}/`echo ${user_copyfile_name} | cut -b 5-200` + install -d ${_GFX_KM_INST_DIR} + install -m 0644 ${file2_top_dir}/${kern_pkg_name}/Software/${kern_copyfile_name} ${_GFX_KM_INST_DIR} + echo "Installed GFX package" + echo " : ${user_pkg_name}" + echo " : ${kern_pkg_name}" + echo "" + done + + if [ ${copy_flag} -eq 0 ]; then + return + fi + + echo "" + echo "Packages for GFX module were found and copied." + echo /=======================================================/ +} + +##### For Multi Media + +# For Audio library copy +# +# Global +# _audio_list: audio library list +# Return +# 0: Not found +# 1: Success +func_audio_lib() +{ + # MD5 check: OMX Media Component Audio Common Library for Linux + func_list_search_and_md5check "${_audio_common_list}" "1" + if [ $? -eq 0 ]; then + echo "Audio Common Library not found!" + echo "" + return 0 + fi + + # MD5 check: audio library. + func_list_search_and_md5check "${_audio_list}" + if [ $? -eq 0 ]; then + # library not found. + echo "" + echo "Audio library not found." + return 0 + fi + + # Add audio common library to list + _audio_list="${_audio_common_list} ${_audio_list}" + + # Install omx common lib (if not installed) + func_install_omx_common + + # Install Audio library packages + func_list_search_and_install_wo_md5check "${_audio_list}" "${_OMX_UM_INST_DIR}" + _audio_common_install=1 + + return 1 +} + +# For Audio library +func_audio() +{ + echo "" + echo "Copying for Audio Common Packages" + + _audio_common_install=0 + + # Audio requires OMX common library + if [ ${_omx_common_install} -eq 0 ]; then + # MD5 check (rigid flag=TRUE) + func_list_search_and_md5check "${_omx_common_list}" "1" + if [ $? -eq 0 ]; then + echo "OMX Common Library not found!" + echo "" + return + fi + else + echo "OMX Common Library already installed" + fi + + # Audio Library + func_audio_lib + if [ $? -eq 0 ]; then + echo "" + echo "Skip Audio Packages" + echo "" + return + fi + + echo "" + echo "Packages for Audio module were found and copied." + echo /=======================================================/ +} + +# For Audio M/W +# Global +# _audio_mw_list: audio M/W library list +# Return +# 0: Not found +# 1: Success +func_audio_mw() +{ + echo "" + echo "Copying for Audio M/W Packages" + + # MD5 check + func_list_search_and_md5check "${_audio_mw_list}" + if [ $? -eq 0 ]; then + # library not found. + echo "" + echo "Packages for Audio M/W module were not found." + return 0 + fi + + # Install Audio M/W library packages + func_list_search_and_install_wo_md5check "${_audio_mw_list}" "${_OMX_UM_INST_DIR}" + + echo "" + echo "Packages for Audio M/W module were found and copied." + echo /=======================================================/ + + return 1 +} + +# install OMX common library +func_install_omx_common() +{ + if [ ${_omx_common_install} -eq 0 ]; then + echo "" + echo "Install for OMX Common Packages" + func_list_search_and_install_wo_md5check "${_omx_common_list}" "${_OMX_UM_INST_DIR}" + _omx_common_install=1 + fi +} + +# install uvcs driver +func_install_uvcs() +{ + if [ ${_uvcs_install} -eq 0 ]; then + echo "" + echo "Installed UVCS driver" + func_list_search_and_install_wo_md5check "${_uvcs_list}" "${_UVCS_INST_DIR}" + _uvcs_install=1 + fi +} + +# search & MD5 check for OMX Video Decoder library +# Global +# _video_dec_list: video decoder list +# Return +# 0: Not found +# 1: Success +func_video_decoder_lib() +{ + echo "" + echo "Copying for Video Decoder Library Packages" + + # MD5 check: Decoder Common Library (rigid flag=TRUE) + func_list_search_and_md5check "${_video_dec_common_list}" "1" + if [ $? -eq 0 ]; then + echo "OMX Video Decoder Common Library not found!" + return 0 + fi + + # MD5 check: Video Decoder Library + func_list_search_and_md5check "${_video_dec_list}" + if [ $? -eq 0 ]; then + # library not found. + return 0 + fi + + # install OMX common lib (if not installed) + func_install_omx_common + + # install UVCS driver (if not installed) + func_install_uvcs + + # Add video decoder common lib to list + _video_dec_list="${_video_dec_common_list} ${_video_dec_list}" + + # install searched library + func_list_search_and_install_wo_md5check "${_video_dec_list}" "${_OMX_UM_INST_DIR}" + _video_decoder_common_install=1 + + return 1 +} + +# search & MD5 check for OMX Video Encoder library +# Global +# _video_enc_list: video encoder list +# Return +# 0: Not found +# 1: Success +func_video_encoder_lib() +{ + echo "" + echo "Copying for Video Encoder Library Packages" + + + # MD5 check Encoder Common Library (rigid flag=TRUE) + func_list_search_and_md5check "${_video_enc_common_list}" "1" + if [ $? -eq 0 ]; then + echo "OMX Video Encoder Common Library not found!" + return 0 + fi + _video_encoder_common_install=0 + + # Video Encoder Library + # MD5 check + func_list_search_and_md5check "${_video_enc_list}" + if [ $? -eq 0 ]; then + # library not found. + return 0 + fi + + # install common lib (if not installed) + func_install_omx_common + + # install UVCS driver (if not installed) + func_install_uvcs + + # Add Video encoder common library to list + _video_enc_list="${_video_enc_common_list} ${_video_enc_list}" + + # install searched library + func_list_search_and_install_wo_md5check "${_video_enc_list}" "${_OMX_UM_INST_DIR}" + _video_encoder_common_install=1 + + return 1 +} + +# For Video decoder +# Global +# _video_dec_list: video decoder list +# Return +# 0: Not found +# 1: Success +func_video_decoder() +{ + echo "" + echo "Copying for Video Decoder Packages" + + # OMX Common library + if [ ${_omx_common_install} -eq 0 ]; then + # MD5 check (rigid flag=TRUE) + func_list_search_and_md5check "${_omx_common_list}" "1" + if [ $? -eq 0 ]; then + echo "OMX Common Library not found!" + echo "" + return + fi + else + echo "OMX Common Library already installed" + fi + + # UVCS driver + if [ ${_uvcs_install} -eq 0 ]; then + # MD5 check (rigid flag=TRUE) + func_list_search_and_md5check "${_uvcs_list}" "1" + if [ $? -eq 0 ]; then + echo "UVCS driver not found!" + echo "" + return + fi + else + echo "UVCS driver already installed" + fi + + # OMX Decoder + # Decoder common Lib + func_video_decoder_lib + if [ $? -eq 0 ]; then + echo "" + echo "Skip Video Decoder Packages" + echo "" + return + fi + + echo "" + echo "Packages for video decoder module were found and copied." + echo /=======================================================/ +} + +# For Video encoder +func_video_encoder() +{ + echo "" + echo "Copying for Video Encoder Packages" + + # OMX Common library + if [ ${_omx_common_install} -eq 0 ]; then + # MD5 check (rigid flag=TRUE) + func_list_search_and_md5check "${_omx_common_list}" "1" + if [ $? -eq 0 ]; then + echo "OMX Common Library not found!" + echo "" + return + fi + else + echo "OMX Common Library already installed" + fi + + # UVCS driver + if [ ${_uvcs_install} -eq 0 ]; then + # MD5 check (rigid flag=TRUE) + func_list_search_and_md5check "${_uvcs_list}" "1" + if [ $? -eq 0 ]; then + echo "UVCS driver not found!" + echo "" + return + fi + else + echo "UVCS driver already installed" + fi + + # OMX Encoder + # Encoder common Lib + func_video_encoder_lib + if [ $? -eq 0 ]; then + echo "" + echo "Skip Video Encoder Packages" + echo "" + return + fi + + echo "" + echo "Packages for video encoder module were found and copied." + echo /=======================================================/ +} + +################################ +# Copy Script Main routine +################################ +echo "Copyscript for R-Car Gen3" +echo +#### 1) Checking current directory +if [ ! -d meta-rcar-gen3 ]; then + echo "ERROR: Please extract meta-renesas and cd to it, before execute $0" + exit 1 +fi + +#### 2) Checking Arguments +if [ "X$1" = "X" ]; then + usage + exit 1 +fi + +while [ $# -gt 0 ] ; do + case "$1" in + -f|--force) + _no_md5check=1 + ;; + -d|--debug) + _debug=1 + ;; + *) + _src_dirname=$(basename $1) + _src_path=$(cd $(dirname $1) && pwd) + _src_full=${_src_path}/${_src_dirname} + ;; + esac + shift +done + +#### 3) Checking ClickThrough present + +COUNTFILE=$(ls ${_src_full}/R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-*.zip 2>/dev/null | wc --lines) +if [ ${COUNTFILE} -eq 0 ]; then + echo "R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-*.zip not found!" + usage + exit 1 +fi +if [ ${COUNTFILE} -gt 1 ]; then + echo "More than one (${COUNTFILE}) R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-*.zip file found!" + echo "Clean your directory \"${_src_full}\"" + exit 1 +fi + +COUNTFILE=$(ls ${_src_full}/R-Car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-*.zip 2>/dev/null | wc --lines) +if [ ${COUNTFILE} -eq 0 ]; then + echo "R-Car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-*.zip not found!" + exit 1 +fi +if [ ${COUNTFILE} -gt 1 ]; then + echo "More than one (${COUNTFILE}) R-Car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-*.zip file found!" + echo "Clean your directory \"${_src_full}\"" + usage + exit 1 +fi + +unzip -d ${_src_full} -oq ${_src_full}/R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-*.zip +unzip -d ${_src_full} -oq ${_src_full}/R-Car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-*.zip + +tar -C ${_src_full} -zxf ${_src_full}/R-Car_Gen3_Series_Evaluation_Software_Package_for_Linux-*.tar.gz --strip-components 2 +tar -C ${_src_full} -zxf ${_src_full}/R-Car_Gen3_Series_Evaluation_Software_Package_of_Linux_Drivers-*.tar.gz --strip-components 2 + +# source directory check +if [ ! -d ${_src_path}/${_src_dirname} ]; then + echo "${_src_path}/${_src_dirname} not found." + usage + exit 1 +fi + +if [ -n "${_debug}" ]; then + echo "src = ${_src_dirname}" + echo "src_path = ${_src_path}" + echo "src_full = ${_src_full}" + echo "no_md5check = ${_no_md5check}" + echo "" +fi + +##### 3) create temp directory +TMPWORK=${PWD}/CP_SCRIPT_TEMP +if [ -d ${TMPWORK} ]; then + echo "ERROR: Work directory already exist." + exit 1 +fi +install -d -m 700 ${TMPWORK} +cd ${TMPWORK} + +##### 4) copy +# initialize flag +_omx_common_install=0 +_uvcs_install=0 +_audio_common_install=0 +_video_decoder_common_install=0 +_video_encoder_common_install=0 + +func_gfx +func_audio +func_audio_mw +func_video_decoder +func_video_encoder + +##### 5) cleanup temp directory +func_clean_tempdir + +##### End +echo "Complete copying !" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/copyscript/copy_proprietary_softwares.sh b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/copyscript/copy_proprietary_softwares.sh new file mode 100755 index 00000000..2ce4148b --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/copyscript/copy_proprietary_softwares.sh @@ -0,0 +1,1329 @@ +#!/bin/sh + +# Copyright (C) Renesas Electronics Corporation 2015-2018 All rights reserved. + +usage() +{ +cat << EOF + usage: `basename $0` [-f] [-d] source-directory + -f: fource copy. ignore md5check + -d: debug mode + + Ex) + `basename $0` -f my_package_dir +EOF +} + +##### MD5 list ##### +. `dirname $0`/md5list.txt + +##### Library List ##### +# Audio Library +# Please add omx audio library to "_audio_list" +# Don't use space in xxx_name. +# audio_list="<software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name>" +_audio_list="AAC-LC_decoder_lib,RTM0AC0000XAAACD30SL41C,RTM0AC0000XAAACD30SL41C.tar.gz \ + aacPlusV2_decoder_lib,RTM0AC0000XAAAPD30SL41C,RTM0AC0000XAAAPD30SL41C.tar.gz \ + MP3_decoder_lib,RTM0AC0000XAMP3D30SL41C,RTM0AC0000XAMP3D30SL41C.tar.gz \ + WMA_decoder_lib,RTM0AC0000XAWMAD30SL41C,RTM0AC0000XAWMAD30SL41C.tar.gz \ + AAC-LC_encoder_lib,RTM0AC0000XAAACE30SL41C,RTM0AC0000XAAACE30SL41C.tar.gz \ + ALAC_decoder_lib,RTM0AC0000XAALAD30SL41C,RTM0AC0000XAALAD30SL41C.tar.gz \ + FLAC_decoder_lib,RTM0AC0000XAFLAD30SL41C,RTM0AC0000XAFLAD30SL41C.tar.gz \ + Dolby_decoder_lib,RTM0AC0000XADD5D30SL41C,RTM0AC0000XADD5D30SL41C.tar.gz" + +# Audio M/W Library +# Please add omx audio library to "_audio_mw_list" +# Don't use space in xxx_name. +# audio_mw_list="<software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name>" +_audio_mw_list="AAC-LC_decoder_M/W,RTM0AC0000ADAACMZ1SL41C,RTM0AC0000ADAACMZ1SL41C.tar.gz \ + aacPlusV2_decoder_M/W,RTM0AC0000ADAAPMZ1SL41C,RTM0AC0000ADAAPMZ1SL41C.tar.gz \ + MP3_decoder_M/W,RTM0AC0000ADMP3MZ1SL41C,RTM0AC0000ADMP3MZ1SL41C.tar.gz \ + WMA_decoder_M/W,RTM0AC0000ADWMAMZ1SL41C,RTM0AC0000ADWMAMZ1SL41C.tar.gz \ + AAC-LC_encoder_M/W,RTM0AC0000AEAACMZ1SL41C,RTM0AC0000AEAACMZ1SL41C.tar.gz \ + DDD_decoder_M/W,RTM0AC0000ADDD5MZ1SL41C,RTM0AC0000ADDD5MZ1SL41C.tar.gz" + +# Video Decoder Library +# Please add omx video decoder library to "_video_dec_list" +# Don't use space in xxx_name. +# video_dec_list="<software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name>" +_video_dec_list="H263_decoder,RTM0AC0000XV263D30SL41C,RTM0AC0000XV263D30SL41C.tar.bz2 \ + H264_decoder,RTM0AC0000XV264D30SL41C,RTM0AC0000XV264D30SL41C.tar.bz2 \ + H265_decoder,RTM0AC0000XV265D30SL41C,RTM0AC0000XV265D30SL41C.tar.bz2 \ + MPEG2_decoder,RTM0AC0000XVM2VD30SL41C,RTM0AC0000XVM2VD30SL41C.tar.bz2 \ + MPEG4_decoder,RTM0AC0000XVM4VD30SL41C,RTM0AC0000XVM4VD30SL41C.tar.bz2 \ + VC1_decoder,RTM0AC0000XVVC1D30SL41C,RTM0AC0000XVVC1D30SL41C.tar.bz2 \ + DivX_decoder,RTM0AC0000XVDVXD30SL41C,RTM0AC0000XVDVXD30SL41C.tar.bz2 \ + RealVideo_decoder,RTM0AC0000XVRLVD30SL41C,RTM0AC0000XVRLVD30SL41C.tar.bz2 \ + VP8_decoder,RTM0AC0000XVVP8D30SL41C,RTM0AC0000XVVP8D30SL41C.tar.bz2 \ + VP9_decoder,RTM0AC0000XVVP9D30SL41C,RTM0AC0000XVVP9D30SL41C.tar.bz2" + +# Video Encoder Library +# Please add omx video encoder library to "_video_enc_list" +# Don't use space in xxx_name. +# video_enc_list="<software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name>" +_video_enc_list="H264_encoder,RTM0AC0000XV264E30SL41C,RTM0AC0000XV264E30SL41C.tar.bz2 \ + VP8_encoder,RTM0AC0000XVVP8E30SL41C,RTM0AC0000XVVP8E30SL41C.tar.bz2" + +# Common library packages +# Don't use space in xxx_name. +# XXX_list="<software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name>" +_omx_common_list="omx_common_lib,RTM0AC0000XCMCTL30SL41C,RTM0AC0000XCMCTL30SL41C.tar.bz2" +_uvcs_list="uvcs_lib,RCG3VUDRL4101ZDO,RCG3VUDRL4101ZDO.tar.bz2" +_video_enc_common_list="video_enc_common,RTM0AC0000XVCMNE30SL41C,RTM0AC0000XVCMNE30SL41C.tar.bz2" +_video_dec_common_list="video_dec_common,RTM0AC0000XVCMND30SL41C,RTM0AC0000XVCMND30SL41C.tar.bz2" +_audio_common_list="audio_common,RTM0AC0000XACMND30SL41C,RTM0AC0000XACMND30SL41C.tar.gz" + + +# DTV Library +# Please add DTV library to "_dtv_list" +# Don't use space in xxx_name. +# dtv_xx_list="<software_name>,<package_name>,<copy_file_name>,<MD5_name> \ +# <software_name>,<package_name>,<copy_file_name>,<MD5_name> \ +# <software_name>,<package_name>,<copy_file_name>,<MD5_name>" +_dtv_km_list="dtv_km,RCG3T001L4101ZDO,Software.tar.gz" +_dtv_um_list="dtv_lib,RTM0RC0000TE020000SL41C,Software.tar.gz,RTM0RC0000TE020000SL41C1 \ + dtv_userfunc,RTM0RC0000TE020000SL41C,../Reference/Reference.tar.gz,RTM0RC0000TE020000SL41C2" + +# DVD Library +# Please add DVD library to "_dvd_list" +# Don't use space in xxx_name. +# dvd_list="<software_name>,<package_name>,<copy_file_name>,<MD5_name> \ +# <software_name>,<package_name>,<copy_file_name>,<MD5_name> \ +# <software_name>,<package_name>,<copy_file_name>,<MD5_name>" +_dvd_list="dvd_lib,RTM0RC0000XDVDC301SL41C,Software.tar.gz \ + dvd_encrypt_lib,RTM0RC0000XDVDF301SL41C,Software.tar.gz" + +# CMS Library +# Please add CMS library to "_cms_list" +# Don't use space in xxx_name. +# cms_list="<software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name>" +_cms_list="bcm,RTM0AC0000JRCMBCV0SL41C,RTM0AC0000JRCMBCV0SL41C.tar.gz \ + blc,RTM0AC0000JRCMBLC0SL41C,RTM0AC0000JRCMBLC0SL41C.tar.gz \ + dgc,RTM0AC0000JRCMDGV0SL41C,RTM0AC0000JRCMDGV0SL41C.tar.gz" + +# ADSP +# Please add ADSP to "_adsp_list" +# Don't use space in xxx_name. +# adsp_xx_list="<software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name> \ +# <software_name>,<package_name>,<copy_file_name>" +_adsp_um_list="adsp_fw,RCG3AHFWN0201ZDP,RCG3AHFWN0201ZDP.tar.gz \ + adsp_if,RCG3AHIFL4101ZDP,RCG3AHIFL4101ZDP.tar.gz" +_adsp_km_list="adsp_driver,RCG3AHPDL4101ZDO,RCG3AHPDL4101ZDO.tar.gz" + +# GFX +# Please add GFX to "_gfx_list" +# Don't use space in xxx_name. +# gfx_list="<package_name(user)>,<copy_file_name(user)>,<package_name(kernel)>,<copy_file_name(kernel)> \ +# <package_name(user)>,<copy_file_name(user)>,<package_name(kernel)>,<copy_file_name(kernel)> \ +# <package_name(user)>,<copy_file_name(user)>,<package_name(kernel)>,<copy_file_name(kernel)>" +_gfx_list="RTM0RC7795GLPG0001SL41C,r8a77951_linux_gsx_binaries_gles.tar.bz2,RCH3G001L4101ZDO,GSX_KM_H3.tar.bz2 \ + RTM0RC7796GLPG0001SL41C,r8a77960_linux_gsx_binaries_gles.tar.bz2,RCM3G001L4101ZDO,GSX_KM_M3.tar.bz2 \ + RTM0RC7796GLPGB001SL41C,r8a77965_linux_gsx_binaries_gles.tar.bz2,RCN3G001L4101ZDO,GSX_KM_M3N.tar.bz2 \ + RTM0RC7799GLPG0001SL41C,r8a77990_linux_gsx_binaries_gles.tar.bz2,RCE3G001L4101ZDO,GSX_KM_E3.tar.bz2 \ + INFRTM0RC7795GLPG0001SL41C,INF_r8a77951_linux_gsx_binaries_gles.tar.bz2,RCH3G001L4101ZDO,GSX_KM_H3.tar.bz2 \ + INFRTM0RC7796GLPG0001SL41C,INF_r8a77960_linux_gsx_binaries_gles.tar.bz2,RCM3G001L4101ZDO,GSX_KM_M3.tar.bz2 \ + INFRTM0RC7796GLPGB001SL41C,INF_r8a77965_linux_gsx_binaries_gles.tar.bz2,RCN3G001L4101ZDO,GSX_KM_M3N.tar.bz2 \ + INFRTM0RC7799GLPG0001SL41C,INF_r8a77990_linux_gsx_binaries_gles.tar.bz2,RCE3G001L4101ZDO,GSX_KM_E3.tar.bz2" + +# ICCOM +# Please add ICCOM to "_iccom_list" +# Don't use space in xxx_name. +# iccom_xx_list="<software_name>,<package_name>,<copy_file_name>,<MD5_name> \ +# <software_name>,<package_name>,<copy_file_name>,<MD5_name> \ +# <software_name>,<package_name>,<copy_file_name>,<MD5_name>" +_iccom_km_list="iccom_mfis,RCG3ZLIDL4101ZNO,iccom-mfis.tar.bz2,RCG3ZLIDL4101ZNO1 \ + iccom_sample,RCG3ZLIDL4101ZNO,iccom-hwspinlock-sample.tar.bz2,RCG3ZLIDL4101ZNO2" +_iccom_um_list="iccom_lib,RCG3ZLILL4101ZNO,libiccom.tar.bz2,RCG3ZLILL4101ZNO" + +# Crypto Package list +# Please add crypto (zip) package name to "_crypto_pkg_list" +# Don't use space in xxx_name. +# crypto_pkg_list="<packgae name> <packgae name> <packgae name>" +_crypto_pkg_list="RTM0AC0000ADDD5MZ1SL41C" + +##### static value +_MODE_ZIP=1 +_MODE_TAR=2 +_MODE_CRYPTO_ZIP=3 +_GFX_KM_INST_DIR="../meta-rcar-gen3/recipes-kernel/kernel-module-gles/kernel-module-gles" +_GFX_UM_INST_DIR="../meta-rcar-gen3/recipes-graphics/gles-module/gles-user-module" +_UVCS_INST_DIR="../meta-rcar-gen3/recipes-kernel/kernel-module-uvcs/kernel-module-uvcs-drv" +_OMX_UM_INST_DIR="../meta-rcar-gen3/recipes-multimedia/omx-module/omx-user-module" +_DTV_KM_INST_DIR="../meta-rcar-gen3/recipes-kernel/kernel-module-dtv/files" +_DTV_UM_INST_DIR="../meta-rcar-gen3/recipes-multimedia/dtv-module/dtv-user-module" +_DVD_UM_INST_DIR="../meta-rcar-gen3/recipes-multimedia/dvd-module/dvd-user-module \ + ../meta-rcar-gen3/recipes-multimedia/dvd-module/dvd-encryption-module" +_CMS_UM_INST_DIR="../meta-rcar-gen3/recipes-multimedia/cms-module/cms-user-module" +_ADSP_KM_INST_DIR="../meta-rcar-gen3/recipes-kernel/kernel-module-adsp/xtensa-hifi" +_ADSP_UM_INST_DIR="../meta-rcar-gen3/recipes-multimedia/adsp-module/files" +_ICCOM_KM_INST_DIR="../meta-rcar-gen3/recipes-kernel/kernel-module-iccom/files" +_ICCOM_UM_INST_DIR="../meta-rcar-gen3/recipes-connectivity/iccom-module/files" + +##### common function + +# $1: search file name +# $2: search directory +# return global variable +# _find_filename: find filename +# _extract_mode: _MODE_ZIP or _MODE_TAR +func_cmn_find_file() +{ +# echo "$1" +# echo "$2" + if [ -z "$1" ]; then + func_error "ERROR: func_cmn_find_file: empty filename" + fi + + if [ -z "$2" ]; then + _search_dir=${_src_full} + else + _search_dir=$2 + fi + + # search zip file +# zip_count=`find ${_search_dir} -maxdepth 1 -name "$1*.zip" | wc -l` + zip_count=`ls ${_search_dir}/$1*.zip 2>/dev/null | wc -l` + + # search tar file +# tar_count=`find ${_search_dir} -maxdepth 1 -name "$1*.tar.*" | wc -l` + tar_count=`ls ${_search_dir}/$1*.tar.* 2>/dev/null | wc -l` + + # duplicate file check + if [ 1 -lt `expr $zip_count + $tar_count` ]; then + echo "file1_zip = $zip_count" + echo "file1_tar = $tar_count" + func_error "ERROR: $1: too many files" + fi + + crypto_zip_count=0 + for i in ${_crypto_pkg_list} + do + if [ $1 = $i ]; then + crypto_zip_count=$zip_count + zip_count=0 + fi + done + + # set result + if [ 1 = $zip_count ]; then + _find_filename=$(ls ${_search_dir}/$1*.zip) + _extract_mode=${_MODE_ZIP} + elif [ 1 = $tar_count ]; then + _find_filename=$(ls ${_search_dir}/$1*.tar.*) + _extract_mode=${_MODE_TAR} + elif [ 1 = $crypto_zip_count ]; then + _find_filename=$(ls ${_search_dir}/$1*.zip) + _extract_mode=${_MODE_CRYPTO_ZIP} + else + _find_filename="" + fi +} + +# $1: Mode +# $2: archive file name +func_cmn_extract_archive() +{ + case $1 in + $_MODE_ZIP) +# echo "Zip mode" + unzip -oq $2 + ;; + $_MODE_TAR) +# echo "Tar mode" + tar xf $2 + ;; + $_MODE_CRYPTO_ZIP) +# echo "Crypto Zip mode" + unzip -oq $2 + top_dir=$(basename $2) + top_dir=${top_dir%.*} + cd ${top_dir} + unzip -oq *.zip + if [ $? -gt 0 ]; then + func_error "ERROR: FAILED ZIP PASSWORD" + fi + cd ${TMPWORK} + ;; + *) + func_error "ERROR: func_cmn_extract_archive: mode error." + exit 1 + ;; + esac +} + +# $1: set target filename. +# $2: set MD5 expectation value. +func_cmn_md5_check() +{ + _md5_func_param_filename=$1 + _md5_func_param_expectation=$2 + if [ ! -e ${_md5_func_param_filename} ]; then + func_error "func_cmn_md5_check : ERROR ${_md5_func_param_filename} not found." + fi + + _calc_md5=$(md5sum ${_md5_func_param_filename} | cut -d " " -f1) + + if [ -n "${_no_md5check}" ] || [ -z ${_md5_func_param_expectation} ]; then + echo "Skip MD5 : `basename ${_md5_func_param_filename}`" + return + fi + + if [ -n "${_debug}" ]; then + echo "MD5 target file = ${_md5_func_param_filename}" + echo "calc_md5 = ${_calc_md5}" + echo "expect_value = ${_md5_func_param_expectation}" + fi + + if [ ${_calc_md5} = ${_md5_func_param_expectation} ]; then + echo "MD5 OK : `basename ${_md5_func_param_filename}`" + else + echo "calc_md5 = ${_calc_md5}" + echo "expect_value = ${_md5_func_param_expectation}" + func_error "MD5 ERROR : ${_md5_func_param_filename}" + fi +} + +##### Error function +# $1: error message +func_error() +{ + echo "$1" + # cleanup temp directory. + func_clean_tempdir + exit 1 +} + +##### cleanup temp directory +func_clean_tempdir() +{ + echo "cleanup temp directory" + rm -rf ${TMPWORK} +} + +##### Template function for Single package + +# $1: package name +# $2: search target filename +# $3: search directory (full path) +# return +# _find_filename : the found file (full path) +# _extract_top_dir_name +func_search_file_in_package() +{ + # search package file + func_cmn_find_file $1 $3 + if [ -n "${_debug}" ]; then + echo "" + echo "FileName = ${_find_filename}" + echo "Mode = ${_extract_mode}" + fi + + if [ -z "${_find_filename}" ]; then + return + fi + + # extract + func_cmn_extract_archive ${_extract_mode} "${_find_filename}" + + # Get directory name + # {PATH}/Package_Version.tar.gz or XXXX.zip --> Package_Version + top_dir=$(basename ${_find_filename}) + top_dir=${top_dir%.*} + + # search file + num=`find ${top_dir} -name $2 | wc -l` + if [ ${num} -eq 1 ]; then + _find_filename=`find ${top_dir} -name $2` + else + # same filename exists. + _find_filename=`find ${top_dir} -name $2 | grep Software` + fi + + # set mode + if [ `echo ${_find_filename} | grep '\.'zip` ]; then + _extract_mode=${_MODE_ZIP} + else + _extract_mode=${_MODE_TAR} + fi + + # set return value + _extract_top_dir_name=${top_dir} +} + +# $1: package name +# $2: copy filename (md5 target) +# $3: expect MD5 value +# $4: search directory (full path) +# return +# _find_file_name +# _extract_top_dir_name +func_search_and_md5check() +{ + # search package file + func_cmn_find_file $1 $4 + if [ -n "${_debug}" ]; then + echo "" + echo "FileName = ${_find_filename}" + echo "Mode = ${_extract_mode}" + fi + + if [ -z "${_find_filename}" ]; then + return + fi + + # extract + func_cmn_extract_archive ${_extract_mode} "${_find_filename}" + + # MD5 + # Get directory name + # {PATH}/Package_Version.tar.gz or XXXX.zip --> Package_Version + top_dir=$(basename ${_find_filename}) + top_dir=${top_dir%.*} + + # call func_cmn_md5_check + func_cmn_md5_check "${top_dir}/$1/Software/$2" "$3" + + # set return value + _extract_top_dir_name=${top_dir} +} + +##### Template function for Group package +# $1: group package name +# $2: single package name +# $3: copy filename (md5 target) +# $4: expect MD5 value +# $5: search directory (full path) +# return +# _find_file_name +# _extract_top_dir_name +# +# NOTE) This function supports level1 packaging. Do not support "grp pkg in grp pkg". +func_search_and_md5check_grp() +{ + # search group package @SRCDIR + func_cmn_find_file $1 $5 + if [ -n "${_debug}" ]; then + echo "search group package" + echo "FileName = ${_find_filename}" + echo "Mode = ${_extract_mode}" + echo "" + fi + + if [ -z "${_find_filename}" ]; then + return + fi + + # extract group package @TMPWORK + func_cmn_extract_archive ${_extract_mode} "${_find_filename}" + + cd ${_find_filename} + # check group pachage structure + # <Package name>_<version>/Package_Info.txt + top_dir=$(basename ${_find_filename}) + top_dir=${top_dir%.*} + + if [ ! -e ${top_dir}/Package_Info.txt ]; then + echo "grp package = $1" + echo "single package = $2" + func_error "ERROR: Package_Info.txt not found in Group package." + fi + + # search single package @TMPWORK/TOPDIR/<Group Package name>/ + func_cmn_find_file $2 "${TMPWORK}/${top_dir}/$1" + if [ -n "${_debug}" ]; then + echo "search single package" + echo "FileName = ${_find_filename}" + echo "Mode = ${_extract_mode}" + echo "" + fi + + if [ -z "${_find_filename}" ]; then + return + fi + + # mv <single package> TMPWORK/. + mv ${_find_filename} ${TMPWORK}/. + + # delete group package + rm -rf ${TMPWORK}/${top_dir} + + # call search and md5check @TMPWORK + func_search_and_md5check $2 $3 $4 ${TMPWORK} +} + +##### File search and MD5check for Package list +# $1: package list +# $2: rigid flag (1: true, other: false) +# +# return +# 1: [Success] One or more files were found. +# 0: [Fail] File not found +# +# package list format +# list ="<software_name>,<package_name>,<copy_file_name>,<md5_variable_name> \ +# <software_name>,<package_name>,<copy_file_name>,<md5_variable_name> \ +# <software_name>,<package_name>,<copy_file_name>,<md5_variable_name>" +# +# Note) Don't use space in xxx_name. +# Note) md5_variable_name is defined in md5list.txt. +# Prefix "_MD5_" is added automaticary. ex) FOO --> _MD5_FOO +# It is omissible. The default is "_MD5_<package_name>". +func_list_search_and_md5check () +{ + find_flag=0 + + for i in $1 + do + sw_name=`echo $i | cut -d "," -f 1` + pkg_name=`echo $i | cut -d "," -f 2` + copyfile_name=`echo $i | cut -d "," -f 3` + md5_val=`echo $i | cut -d "," -f 4` + + # <MD5_name> is empty. Default MD5 name is "_MD5_<pkg_name>" + if [ -z "${md5_val}" ]; then + md5_val=`eval echo '$_MD5_'${pkg_name}` + else + md5_val=`eval echo '$_MD5_'${md5_val}` + fi + + if [ -n "${_debug}" ]; then + echo "" + echo "sw_name = $sw_name" + echo "pkg_name = $pkg_name" + echo "copyfile_name = $copyfile_name" + echo "md5_val = $md5_val" + fi + + func_search_and_md5check "${pkg_name}" "${copyfile_name}" "${md5_val}" "${_src_full}" + if [ -z "${_find_filename}" ]; then + echo "${sw_name} not found!" + # rigid flag = TRUE. Not found = ERROR + if [ "X$2" = "X1" ]; then + return 0 + fi + else + find_flag=1 + fi + done + + return ${find_flag} +} + +##### File search and install (without MD5check) for Package list +# +# $1: package list +# $2: install directory +# +# return +# 1: [Success] One or more files were installed. +# 0: [Fail] File not found +# +# package list format +# list ="<software_name>,<package_name>,<copy_file_name>,<md5_variable_name> \ +# <software_name>,<package_name>,<copy_file_name>,<md5_variable_name> \ +# <software_name>,<package_name>,<copy_file_name>,<md5_variable_name>" +# +# Note) Don't use space in xxx_name. +# Note) md5_variable_name is defined in md5list.txt. +# Prefix "_MD5_" is added automaticary. ex) FOO --> _MD5_FOO +# It is omissible. The default is "_MD5_<package_name>". +func_list_search_and_install_wo_md5check() +{ + find_flag=0 + + for i in $1 + do + sw_name=`echo $i | cut -d "," -f 1` + pkg_name=`echo $i | cut -d "," -f 2` + copyfile_name=`echo $i | cut -d "," -f 3` + md5_val=`echo $i | cut -d "," -f 4` + + # <MD5_name> is empty. Default MD5 name is "_MD5_<pkg_name>" + if [ -z "${md5_val}" ]; then + md5_val=`eval echo '$_MD5_'$pkg_name` + else + md5_val=`eval echo '$_MD5_'${md5_val}` + fi + + copyfile_name=$(basename ${copyfile_name}) + + if [ -n "${_debug}" ]; then + echo "" + echo "sw_name = $sw_name" + echo "pkg_name = $pkg_name" + echo "copyfile_name = $copyfile_name" + echo "md5_val = $md5_val" + fi + + # file search + func_search_file_in_package "${pkg_name}" "${copyfile_name}" "${_src_full}" + if [ -z "${_find_filename}" ]; then + echo "${sw_name} not found!" + else + find_flag=1 + + # install + install -d $2 + install -m 0644 ${_find_filename} $2 + echo "Installed $sw_name" + echo " : ${pkg_name}" + fi + done + + return ${find_flag} +} + +##### File search and install for Package list +# +# $1: package list +# $2: install directory +# +# return +# 1: [Success] One or more files were installed. +# 0: [Fail] File not found +# +# package list format +# list ="<software_name>,<package_name>,<copy_file_name>,<md5_variable_name> \ +# <software_name>,<package_name>,<copy_file_name>,<md5_variable_name> \ +# <software_name>,<package_name>,<copy_file_name>,<md5_variable_name>" +# +# Note) Don't use space in xxx_name. +# Note) md5_variable_name is defined in md5list.txt. +# Prefix "_MD5_" is added automaticary. ex) FOO --> _MD5_FOO +# It is omissible. The default is "_MD5_<package_name>". +func_list_search_and_install() +{ + find_flag=0 + + for i in $1 + do + sw_name=`echo $i | cut -d "," -f 1` + pkg_name=`echo $i | cut -d "," -f 2` + copyfile_name=`echo $i | cut -d "," -f 3` + md5_val=`echo $i | cut -d "," -f 4` + + # <MD5_name> is empty. Default MD5 name is "_MD5_<pkg_name>" + if [ -z "${md5_val}" ]; then + md5_val=`eval echo '$_MD5_'$pkg_name` + else + md5_val=`eval echo '$_MD5_'${md5_val}` + fi + + if [ -n "${_debug}" ]; then + echo "" + echo "sw_name = $sw_name" + echo "pkg_name = $pkg_name" + echo "copyfile_name = $copyfile_name" + echo "md5_val = $md5_val" + fi + + # seach & MD5 check + func_search_and_md5check "${pkg_name}" "${copyfile_name}" "${md5_val}" "${_src_full}" + if [ -z "${_find_filename}" ]; then + echo "${sw_name} not found!" + else + find_flag=1 + + # Get directory name + # _find_filename = pkg file (full path). It is not copyfile. + top_dir=$(basename ${_find_filename}) + top_dir=${top_dir%.*} + + # install + install -d $2 + install -m 0644 ${top_dir}/${pkg_name}/Software/${copyfile_name} $2 + echo "Installed $sw_name" + echo " : ${pkg_name}" + fi + done + + return ${find_flag} +} + +##### Package function + +# For 3D graphics packages +func_gfx() +{ + echo "" + echo "Copying for Graphic Packages" + + copy_flag=0 + + for i in ${_gfx_list} + do + user_pkg_name=`echo $i | cut -d "," -f 1` + user_copyfile_name=`echo $i | cut -d "," -f 2` + user_md5_val=`eval echo '$_MD5_'${user_pkg_name}` + kern_pkg_name=`echo $i | cut -d "," -f 3` + kern_copyfile_name=`echo $i | cut -d "," -f 4` + kern_md5_val=`eval echo '$_MD5_'${kern_pkg_name}` + + if [ -n "${_debug}" ]; then + echo "" + echo "user_pkg_name = ${user_pkg_name}" + echo "user_copyfile_name= ${user_copyfile_name}" + echo "user_md5_val = ${user_md5_val}" + echo "kern_pkg_name = ${kern_pkg_name}" + echo "kern_copyfile_name= ${kern_copyfile_name}" + echo "kern_md5_val = ${kern_md5_val}" + fi + + # user module (file1) + func_search_and_md5check "${user_pkg_name}" "${user_copyfile_name}" "${user_md5_val}" "${_src_full}" + + if [ -z "${_find_filename}" ]; then + echo "${user_pkg_name} not found!" + continue + fi + + file1_top_dir=${_extract_top_dir_name} + echo "file1 top : ${file1_top_dir}" + + # kernel module (file2) + func_search_and_md5check "${kern_pkg_name}" "${kern_copyfile_name}" "${kern_md5_val}" "${_src_full}" + + # file1 exist, but file2 not exist + if [ -z "${_find_filename}" ]; then + func_error "ERROR: func_gfx: package file for Graphic is incomplete." + fi + + file2_top_dir=${_extract_top_dir_name} + echo "file2 top : ${file2_top_dir}" + + # Finally copy is performed + copy_flag=1 + install -d ${_GFX_UM_INST_DIR} + install -m 0644 ${file1_top_dir}/${user_pkg_name}/Software/${user_copyfile_name} ${_GFX_UM_INST_DIR}/${user_copyfile_name##INF_} + install -d ${_GFX_KM_INST_DIR} + install -m 0644 ${file2_top_dir}/${kern_pkg_name}/Software/${kern_copyfile_name} ${_GFX_KM_INST_DIR} + echo "Installed GFX package" + echo " : ${user_pkg_name}" + echo " : ${kern_pkg_name}" + echo "" + done + + if [ ${copy_flag} -eq 0 ]; then + return + fi + + echo "" + echo "Packages for GFX module were found and copied." + echo /=======================================================/ +} + +##### For Multi Media + +# For Audio library copy +# +# Global +# _audio_list: audio library list +# Return +# 0: Not found +# 1: Success +func_audio_lib() +{ + # MD5 check: OMX Media Component Audio Common Library for Linux + func_list_search_and_md5check "${_audio_common_list}" "1" + if [ $? -eq 0 ]; then + echo "Audio Common Library not found!" + echo "" + return 0 + fi + + # MD5 check: audio library. + func_list_search_and_md5check "${_audio_list}" + if [ $? -eq 0 ]; then + # library not found. + echo "" + echo "Audio library not found." + return 0 + fi + + # Add audio common library to list + _audio_list="${_audio_common_list} ${_audio_list}" + + # Install omx common lib (if not installed) + func_install_omx_common + + # Install Audio library packages + func_list_search_and_install_wo_md5check "${_audio_list}" "${_OMX_UM_INST_DIR}" + _audio_common_install=1 + + return 1 +} + +# For Audio library +func_audio() +{ + echo "" + echo "Copying for Audio Common Packages" + + _audio_common_install=0 + + # Audio requires OMX common library + if [ ${_omx_common_install} -eq 0 ]; then + # MD5 check (rigid flag=TRUE) + func_list_search_and_md5check "${_omx_common_list}" "1" + if [ $? -eq 0 ]; then + echo "OMX Common Library not found!" + echo "" + return + fi + else + echo "OMX Common Library already installed" + fi + + # Audio Library + func_audio_lib + if [ $? -eq 0 ]; then + echo "" + echo "Skip Audio Packages" + echo "" + return + fi + + echo "" + echo "Packages for Audio module were found and copied." + echo /=======================================================/ +} + +# For Audio M/W +# Global +# _audio_mw_list: audio M/W library list +# Return +# 0: Not found +# 1: Success +func_audio_mw() +{ + echo "" + echo "Copying for Audio M/W Packages" + + # MD5 check + func_list_search_and_md5check "${_audio_mw_list}" + if [ $? -eq 0 ]; then + # library not found. + echo "" + echo "Packages for Audio M/W module were not found." + return 0 + fi + + # Install Audio M/W library packages + func_list_search_and_install_wo_md5check "${_audio_mw_list}" "${_OMX_UM_INST_DIR}" + + echo "" + echo "Packages for Audio M/W module were found and copied." + echo /=======================================================/ + + return 1 +} + +# install OMX common library +func_install_omx_common() +{ + if [ ${_omx_common_install} -eq 0 ]; then + echo "" + echo "Install for OMX Common Packages" + func_list_search_and_install_wo_md5check "${_omx_common_list}" "${_OMX_UM_INST_DIR}" + _omx_common_install=1 + fi +} + +# install uvcs driver +func_install_uvcs() +{ + if [ ${_uvcs_install} -eq 0 ]; then + echo "" + echo "Installed UVCS driver" + func_list_search_and_install_wo_md5check "${_uvcs_list}" "${_UVCS_INST_DIR}" + _uvcs_install=1 + fi +} + +# search & MD5 check for OMX Video Decoder library +# Global +# _video_dec_list: video decoder list +# Return +# 0: Not found +# 1: Success +func_video_decoder_lib() +{ + echo "" + echo "Copying for Video Decoder Library Packages" + + # MD5 check: Decoder Common Library (rigid flag=TRUE) + func_list_search_and_md5check "${_video_dec_common_list}" "1" + if [ $? -eq 0 ]; then + echo "OMX Video Decoder Common Library not found!" + return 0 + fi + + # MD5 check: Video Decoder Library + func_list_search_and_md5check "${_video_dec_list}" + if [ $? -eq 0 ]; then + # library not found. + return 0 + fi + + # install OMX common lib (if not installed) + func_install_omx_common + + # install UVCS driver (if not installed) + func_install_uvcs + + # Add video decoder common lib to list + _video_dec_list="${_video_dec_common_list} ${_video_dec_list}" + + # install searched library + func_list_search_and_install_wo_md5check "${_video_dec_list}" "${_OMX_UM_INST_DIR}" + _video_decoder_common_install=1 + + return 1 +} + +# search & MD5 check for OMX Video Encoder library +# Global +# _video_enc_list: video encoder list +# Return +# 0: Not found +# 1: Success +func_video_encoder_lib() +{ + echo "" + echo "Copying for Video Encoder Library Packages" + + + # MD5 check Encoder Common Library (rigid flag=TRUE) + func_list_search_and_md5check "${_video_enc_common_list}" "1" + if [ $? -eq 0 ]; then + echo "OMX Video Encoder Common Library not found!" + return 0 + fi + _video_encoder_common_install=0 + + # Video Encoder Library + # MD5 check + func_list_search_and_md5check "${_video_enc_list}" + if [ $? -eq 0 ]; then + # library not found. + return 0 + fi + + # install common lib (if not installed) + func_install_omx_common + + # install UVCS driver (if not installed) + func_install_uvcs + + # Add Video encoder common library to list + _video_enc_list="${_video_enc_common_list} ${_video_enc_list}" + + # install searched library + func_list_search_and_install_wo_md5check "${_video_enc_list}" "${_OMX_UM_INST_DIR}" + _video_encoder_common_install=1 + + return 1 +} + +# For Video decoder +# Global +# _video_dec_list: video decoder list +# Return +# 0: Not found +# 1: Success +func_video_decoder() +{ + echo "" + echo "Copying for Video Decoder Packages" + + # OMX Common library + if [ ${_omx_common_install} -eq 0 ]; then + # MD5 check (rigid flag=TRUE) + func_list_search_and_md5check "${_omx_common_list}" "1" + if [ $? -eq 0 ]; then + echo "OMX Common Library not found!" + echo "" + return + fi + else + echo "OMX Common Library already installed" + fi + + # UVCS driver + if [ ${_uvcs_install} -eq 0 ]; then + # MD5 check (rigid flag=TRUE) + func_list_search_and_md5check "${_uvcs_list}" "1" + if [ $? -eq 0 ]; then + echo "UVCS driver not found!" + echo "" + return + fi + else + echo "UVCS driver already installed" + fi + + # OMX Decoder + # Decoder common Lib + func_video_decoder_lib + if [ $? -eq 0 ]; then + echo "" + echo "Skip Video Decoder Packages" + echo "" + return + fi + + echo "" + echo "Packages for video decoder module were found and copied." + echo /=======================================================/ +} + +# For Video encoder +func_video_encoder() +{ + echo "" + echo "Copying for Video Encoder Packages" + + # OMX Common library + if [ ${_omx_common_install} -eq 0 ]; then + # MD5 check (rigid flag=TRUE) + func_list_search_and_md5check "${_omx_common_list}" "1" + if [ $? -eq 0 ]; then + echo "OMX Common Library not found!" + echo "" + return + fi + else + echo "OMX Common Library already installed" + fi + + # UVCS driver + if [ ${_uvcs_install} -eq 0 ]; then + # MD5 check (rigid flag=TRUE) + func_list_search_and_md5check "${_uvcs_list}" "1" + if [ $? -eq 0 ]; then + echo "UVCS driver not found!" + echo "" + return + fi + else + echo "UVCS driver already installed" + fi + + # OMX Encoder + # Encoder common Lib + func_video_encoder_lib + if [ $? -eq 0 ]; then + echo "" + echo "Skip Video Encoder Packages" + echo "" + return + fi + + echo "" + echo "Packages for video encoder module were found and copied." + echo /=======================================================/ +} + +# For DTV kernel module +func_dtv_kern() +{ + echo "" + echo "Copying for DTV kernel module" + + _dtv_kern_install=0 + + func_list_search_and_md5check "${_dtv_km_list}" + if [ $? -eq 0 ]; then + # library not found. + echo "" + echo "DTV kernel library not found!" + return + fi + + pkg_name=`echo ${_dtv_km_list} | cut -d "," -f 2` + copyfile_name=`echo ${_dtv_km_list} | cut -d "," -f 3` + + # extract --> archive --> copied + echo "Installed DTV kernel modules" + func_search_file_in_package "${pkg_name}" "${copyfile_name}" "${_src_full}" + func_cmn_extract_archive "${_extract_mode}" "${_find_filename}" + + dtv_driver_list="ssp_drv scu_src_drv tsif_drv tddmac_drv" + for i in ${dtv_driver_list} + do + tar cfz $i.tar.gz $i + install -d ${_DTV_KM_INST_DIR} + install -m 644 $i.tar.gz ${_DTV_KM_INST_DIR} + echo " : $i.tar.gz" + done + + _dtv_kern_install=1 + + echo "" + echo "DTV kernel module were found and copied." + echo /=======================================================/ +} + +# For DTV lib +func_dtv_lib() +{ + echo "" + echo "Copying for DTV Library Packages" + + # DTV kernel modules + if [ ${_dtv_kern_install} -eq 0 ]; then + echo "DTV kernel module not found!" + echo "Skip DTV Package" + echo "" + return + fi + + # MD5 check (rigid flag=TRUE) + func_list_search_and_md5check "${_dtv_um_list}" "1" + if [ $? -eq 0 ]; then + # library not found. + echo "" + echo "DTV library not found" + return + fi + + # install + func_list_search_and_install_wo_md5check "${_dtv_um_list}" "${_DTV_UM_INST_DIR}" + + echo "" + echo "DTV Package were found and copied." + echo /=======================================================/ +} + +# For DVD lib +func_dvd_lib() +{ + echo "" + echo "Copying for DVD Library Packages" + + # MD5 check (rigid flag=TRUE) + func_list_search_and_md5check "${_dvd_list}" + if [ $? -eq 0 ]; then + # library not found. + echo "" + echo "DVD library not found" + return + fi + + index="1" + # install searched library + for i in ${_dvd_list}; do + install_dir=`echo ${_DVD_UM_INST_DIR} | cut -d " " -f ${index}` + func_list_search_and_install_wo_md5check ${i} ${install_dir} + index=`expr ${index} + 1` + done + + echo "" + echo "DVD Package were found and copied." + echo /=======================================================/ +} + +# For DTV/DVD main routine +func_dtv_dvd() +{ + echo "" + echo "Copying for DTV/DVD Packages" + + # DTV package + func_dtv_kern + func_dtv_lib + + # DVD package + func_dvd_lib +} + +# For CMS main routine +func_cms() +{ + echo "" + echo "Copying for CMS Packages" + + copy_flag=0 + + # MD5 check + func_list_search_and_md5check "${_cms_list}" + if [ $? -eq 0 ]; then + # library not found. + echo "Skip CMS package" + echo "" + return + fi + + # Install library + func_list_search_and_install_wo_md5check "${_cms_list}" "${_CMS_UM_INST_DIR}" + + echo "" + echo "Packages for CMS were found and copied." + echo /=======================================================/ +} + +# For ADSP main routine +func_adsp() +{ + echo "" + echo "Copying for ADSP Packages" + + # MD5 check (rigid flag = TRUE) + # In ADSP, all files are necesarry + func_list_search_and_md5check "${_adsp_km_list}" "1" + if [ $? -eq 0 ]; then + # library not found. + echo "Skip ADSP Package" + echo "" + return + fi + + func_list_search_and_md5check "${_adsp_um_list}" "1" + if [ $? -eq 0 ]; then + # library not found. + echo "Skip ADSP Package" + echo "" + return + fi + + # Install kernel module + func_list_search_and_install_wo_md5check "${_adsp_km_list}" "${_ADSP_KM_INST_DIR}" + + # Install user module + func_list_search_and_install_wo_md5check "${_adsp_um_list}" "${_ADSP_UM_INST_DIR}" + + echo "" + echo "Packages for ADSP were found and copied." + echo /=======================================================/ +} + +# For ICCOM main routine +func_iccom() +{ + echo "" + echo "Copying for ICCOM Packages" + + # MD5 check (rigid flag = TRUE) + # In ICCOM, all files are necesarry + func_list_search_and_md5check "${_iccom_km_list}" "1" + if [ $? -eq 0 ]; then + # library not found. + echo "Skip ICCOM Package" + echo "" + return + fi + + func_list_search_and_md5check "${_iccom_um_list}" "1" + if [ $? -eq 0 ]; then + # library not found. + echo "Skip ICCOM Package" + echo "" + return + fi + + # Install kernel module + func_list_search_and_install_wo_md5check "${_iccom_km_list}" "${_ICCOM_KM_INST_DIR}" + + # Install user module + func_list_search_and_install_wo_md5check "${_iccom_um_list}" "${_ICCOM_UM_INST_DIR}" + + echo "" + echo "Packages for ICCOM were found and copied." + echo /=======================================================/ +} + +################################ +# Copy Script Main routine +################################ +echo "Copyscript for R-Car Gen3" +echo +#### 1) Checking current directory +if [ ! -d meta-rcar-gen3 ]; then + echo "ERROR: Please extract meta-renesas and cd to it, before execute $0" + exit 1 +fi + +#### 2) Checking Arguments +if [ "X$1" = "X" ]; then + usage + exit 1 +fi + +while [ $# -gt 0 ] ; do + case "$1" in + -f|--force) + _no_md5check=1 + ;; + -d|--debug) + _debug=1 + ;; + *) + _src_dirname=$(basename $1) + _src_path=$(cd $(dirname $1) && pwd) + _src_full=${_src_path}/${_src_dirname} + ;; + esac + shift +done + +# source directory check +if [ ! -d ${_src_path}/${_src_dirname} ]; then + echo "${_src_path}/${_src_dirname} not found." + usage + exit 1 +fi + +if [ -n "${_debug}" ]; then + echo "src = ${_src_dirname}" + echo "src_path = ${_src_path}" + echo "src_full = ${_src_full}" + echo "no_md5check = ${_no_md5check}" + echo "" +fi + +##### 3) create temp directory +TMPWORK=${PWD}/CP_SCRIPT_TEMP +if [ -d ${TMPWORK} ]; then + echo "ERROR: Work directory already exist." + exit 1 +fi +install -d -m 700 ${TMPWORK} +cd ${TMPWORK} + +##### 4) copy +# initialize flag +_omx_common_install=0 +_uvcs_install=0 +_audio_common_install=0 +_video_decoder_common_install=0 +_video_encoder_common_install=0 +_dtv_kern_install=0 + +func_gfx +func_audio +func_audio_mw +func_video_decoder +func_video_encoder +func_dtv_dvd +func_cms +func_adsp +func_iccom + +##### 5) cleanup temp directory +func_clean_tempdir + +##### End +echo "Complete copying !" diff --git a/bsp/meta-renesas/meta-rcar-gen3/docs/sample/copyscript/md5list.txt b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/copyscript/md5list.txt new file mode 100644 index 00000000..14a9cb74 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/docs/sample/copyscript/md5list.txt @@ -0,0 +1,64 @@ +# GFX +_MD5_RTM0RC7795GLPG0001SL41C="" +_MD5_RCH3G001L4101ZDO="" +_MD5_RTM0RC7796GLPG0001SL41C="" +_MD5_RCM3G001L4101ZDO="" +_MD5_RTM0RC7796GLPGB001SL41C="" +_MD5_RCN3G001L4101ZDO="" +_MD5_RTM0RC7799GLPG0001SL41C="" +_MD5_RCE3G001L4101ZDO="" +_MD5_INFRTM0RC7795GLPG0001SL41C="" +_MD5_INFRTM0RC7796GLPG0001SL41C="" +_MD5_INFRTM0RC7796GLPGB001SL41C="" +_MD5_INFRTM0RC7799GLPG0001SL41C="" +# OMX AUDIO +_MD5_RTM0AC0000ADAACMZ1SL41C="" +_MD5_RTM0AC0000XAAACD30SL41C="" +_MD5_RTM0AC0000XACMND30SL41C="" +_MD5_RTM0AC0000ADAAPMZ1SL41C="" +_MD5_RTM0AC0000ADMP3MZ1SL41C="" +_MD5_RTM0AC0000ADWMAMZ1SL41C="" +_MD5_RTM0AC0000XAAAPD30SL41C="" +_MD5_RTM0AC0000XAMP3D30SL41C="" +_MD5_RTM0AC0000XAWMAD30SL41C="" +_MD5_RTM0AC0000AEAACMZ1SL41C="" +_MD5_RTM0AC0000XAAACE30SL41C="" +_MD5_RTM0AC0000XAALAD30SL41C="" +_MD5_RTM0AC0000XAFLAD30SL41C="" +_MD5_RTM0AC0000XADD5D30SL41C="" +_MD5_RTM0AC0000ADDD5MZ1SL41C="" +# OMX VIDEO +_MD5_RTM0AC0000XV263D30SL41C="" +_MD5_RTM0AC0000XV264D30SL41C="" +_MD5_RTM0AC0000XCMCTL30SL41C="" +_MD5_RCG3VUDRL4101ZDO="" +_MD5_RTM0AC0000XVCMND30SL41C="" +_MD5_RTM0AC0000XV265D30SL41C="" +_MD5_RTM0AC0000XVM2VD30SL41C="" +_MD5_RTM0AC0000XVM4VD30SL41C="" +_MD5_RTM0AC0000XVVC1D30SL41C="" +_MD5_RTM0AC0000XVCMNE30SL41C="" +_MD5_RTM0AC0000XV264E30SL41C="" +_MD5_RTM0AC0000XVDVXD30SL41C="" +_MD5_RTM0AC0000XVRLVD30SL41C="" +_MD5_RTM0AC0000XVVP8D30SL41C="" +_MD5_RTM0AC0000XVVP8E30SL41C="" +_MD5_RTM0AC0000XVVP9D30SL41C="" +# DTV/DVD +_MD5_RCG3T001L4101ZDO="" +_MD5_RTM0RC0000TE020000SL41C1="" +_MD5_RTM0RC0000TE020000SL41C2="" +_MD5_RTM0RC0000XDVDC301SL41C="" +_MD5_RTM0RC0000XDVDF301SL41C="" +# CMS +_MD5_RTM0AC0000JRCMBCV0SL41C="" +_MD5_RTM0AC0000JRCMBLC0SL41C="" +_MD5_RTM0AC0000JRCMDGV0SL41C="" +# ADSP +_MD5_RCG3AHFWN0201ZDP="" +_MD5_RCG3AHIFL4101ZDP="" +_MD5_RCG3AHPDL4101ZDO="" +# ICCOM +_MD5_RCG3ZLIDL4101ZNO1="" +_MD5_RCG3ZLIDL4101ZNO2="" +_MD5_RCG3ZLILL4101ZNO="" diff --git a/bsp/meta-renesas/meta-rcar-gen3/include/adsp-control.inc b/bsp/meta-renesas/meta-rcar-gen3/include/adsp-control.inc new file mode 100644 index 00000000..44a8d146 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/include/adsp-control.inc @@ -0,0 +1,2 @@ +# USE_ADSP for Audio DSP +USE_ADSP = "${@bb.utils.contains('DISTRO_FEATURES', 'adsp', '1', '0', d)}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/include/arm-trusted-firmware-control.inc b/bsp/meta-renesas/meta-rcar-gen3/include/arm-trusted-firmware-control.inc new file mode 100644 index 00000000..013598df --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/include/arm-trusted-firmware-control.inc @@ -0,0 +1,58 @@ +# This function is to generate IPL binaries for H3/H3ULCB (SoC: r8a7795), E3 (SoC: r8a7790) + +# IPL build options for H3/E3/H3ULCB +EXTRA_ATFW_OPT ?= "" +EXTRA_ATFW_CONF ?= "" + +do_ipl_opt_compile () { + oe_runmake distclean + oe_runmake bl2 bl31 dummytool PLAT=${PLATFORM} ${EXTRA_ATFW_OPT} ${ATFW_OPT_LOSSY} +} + +do_ipl_opt_deploy () { + install -d ${DEPLOYDIR} + + # Copy IPL to deploy folder + install -m 0644 ${S}/build/${PLATFORM}/release/bl2/bl2.elf ${DEPLOYDIR}/bl2-${MACHINE}-${EXTRA_ATFW_CONF}.elf + install -m 0644 ${S}/build/${PLATFORM}/release/bl2.bin ${DEPLOYDIR}/bl2-${MACHINE}-${EXTRA_ATFW_CONF}.bin + install -m 0644 ${S}/build/${PLATFORM}/release/bl2.srec ${DEPLOYDIR}/bl2-${MACHINE}-${EXTRA_ATFW_CONF}.srec + install -m 0644 ${S}/build/${PLATFORM}/release/bl31/bl31.elf ${DEPLOYDIR}/bl31-${MACHINE}-${EXTRA_ATFW_CONF}.elf + install -m 0644 ${S}/build/${PLATFORM}/release/bl31.bin ${DEPLOYDIR}/bl31-${MACHINE}-${EXTRA_ATFW_CONF}.bin + install -m 0644 ${S}/build/${PLATFORM}/release/bl31.srec ${DEPLOYDIR}/bl31-${MACHINE}-${EXTRA_ATFW_CONF}.srec + install -m 0644 ${S}/tools/dummy_create/bootparam_sa0.srec ${DEPLOYDIR}/bootparam_sa0-${EXTRA_ATFW_CONF}.srec + install -m 0644 ${S}/tools/dummy_create/cert_header_sa6.srec ${DEPLOYDIR}/cert_header_sa6-${EXTRA_ATFW_CONF}.srec +} + +# For IPL compile options for H3/H3ULCB (SoC: r8a7795), E3 (SoC: r8a7790) +python do_extra_ipl_opt() { + soc = d.getVar('SOC_FAMILY') + soc = soc.split(':')[1] + machine = d.getVar('MACHINE_ARCH') + + if soc == "r8a7795": + # For H3 SiP DDR 4GiB (2GiB x 2ch) + if machine != "h3ulcb": + d.setVar('EXTRA_ATFW_CONF', '2x2g') + d.setVar('EXTRA_ATFW_OPT', ' LSI=H3 RCAR_DRAM_SPLIT=2 RCAR_DRAM_CHANNEL=5 ') + bb.build.exec_func('do_ipl_opt_compile', d) + bb.build.exec_func('do_ipl_opt_deploy', d) + + # For H3/H3ULCB SiP DDR 8GiB (2GiB x 4ch) + d.setVar('EXTRA_ATFW_CONF', '4x2g') + d.setVar('EXTRA_ATFW_OPT', ' LSI=H3 RCAR_DRAM_SPLIT=1 ') + d.setVar('EXTRA_ATFW_OPT_append_ulcb', ' RCAR_GEN3_ULCB=1 PMIC_LEVEL_MODE=0 ') + bb.build.exec_func('do_ipl_opt_compile', d) + bb.build.exec_func('do_ipl_opt_deploy', d) + + # For E3 SiP DDR 2GiB + if soc == "r8a77990": + d.setVar('EXTRA_ATFW_CONF', '4d') + d.setVar('EXTRA_ATFW_OPT', ' LSI=E3 RCAR_SA0_SIZE=0 RCAR_AVS_SETTING_ENABLE=0 RCAR_DRAM_DDR3L_MEMCONF=1 RCAR_DRAM_DDR3L_MEMDUAL=1 ') + bb.build.exec_func('do_ipl_opt_compile', d) + bb.build.exec_func('do_ipl_opt_deploy', d) +} + +do_ipl_opt_compile[dirs] = "${B}" +do_ipl_opt_deploy[dirs] = "${B}" + +addtask extra_ipl_opt after do_configure before do_compile diff --git a/bsp/meta-renesas/meta-rcar-gen3/include/avb-control.inc b/bsp/meta-renesas/meta-rcar-gen3/include/avb-control.inc new file mode 100644 index 00000000..6ed7f536 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/include/avb-control.inc @@ -0,0 +1,2 @@ +# USE_AVB for AVB Software Package for Linux +USE_AVB = "${@'1' if 'avb' in '${DISTRO_FEATURES}' else '0'}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/include/cas-control.inc b/bsp/meta-renesas/meta-rcar-gen3/include/cas-control.inc new file mode 100644 index 00000000..18ccc74d --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/include/cas-control.inc @@ -0,0 +1,17 @@ +SOC="${@d.getVar('SOC_FAMILY').split(':')[1]}" +CAS="${@'1' if 'cas' in '${MACHINE_FEATURES}' else '0'}" + +# USE_CAS for H3 (SoC: r8a7795) or M3 (SoC: r8a7796) +USE_CAS="${@'1' if '${CAS}' == '1' and ('${SOC}' == 'r8a7795' or '${SOC}' == 'r8a7796') else '0'}" + +# Trap incorrect CAS setting for M3N/E3 +WARN="${@'1' if '${CAS}' == '1' and '${USE_CAS}' == '0' else '0'}" + +# This function is to show a warning message when enabling CAS feature on M3N/E3 +python do_cas_checking() { + warn=d.getVar('WARN') + if warn == "1" : + bb.warn("CAS only supports H3 (SoC: r8a7795), M3 (SoC: r8a7796), this feature will be disabled automatically") +} + +addtask cas_checking before do_configure after do_patch diff --git a/bsp/meta-renesas/meta-rcar-gen3/include/cms-control.inc b/bsp/meta-renesas/meta-rcar-gen3/include/cms-control.inc new file mode 100644 index 00000000..2ebfa517 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/include/cms-control.inc @@ -0,0 +1,18 @@ +# USE_CMSBCM for Basic Color Management Middleware for Linux +USE_CMSBCM = "${@bb.utils.contains('DISTRO_FEATURES', 'cmsbcm', '1', '0', d)}" + +# USE_CMSBLC for Backlight Control Middleware for Linux +USE_CMSBLC = "${@bb.utils.contains('DISTRO_FEATURES', 'cmsblc', '1', '0', d)}" + +# USE_CMSDGC for Dynamic Gamma Correction Middleware for Linux +USE_CMSDGC = "${@bb.utils.contains('DISTRO_FEATURES', 'cmsdgc', '1', '0', d)}" + +# CMS Flag list +LIST_CMS_FLAG = " \ + ${USE_CMSBCM} \ + ${USE_CMSBLC} \ + ${USE_CMSDGC} \ +" + +# USE_CMS for Color Management Middleware +USE_CMS = "${@'1' if '1' in '${LIST_CMS_FLAG}' else '0'}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/include/dtv-dvd-control.inc b/bsp/meta-renesas/meta-rcar-gen3/include/dtv-dvd-control.inc new file mode 100644 index 00000000..07c4d5f0 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/include/dtv-dvd-control.inc @@ -0,0 +1,19 @@ +# USE_DTV for ISDB-T DTV Software Package +USE_DTV = "${@'1' if 'dtv' in '${DISTRO_FEATURES}' else '0'}" + +# USE_DVD for DVD Core-Middleware for Linux +USE_DVD = "${@'1' if 'dvd' in '${DISTRO_FEATURES}' else '0'}" + +# USE_DVD_ENCRYPTION_LIB for DVD Encryption Library for Linux +USE_DVD_ENCRYPTION_LIB = "${@'1' if 'dvd_encryption_library' in '${DISTRO_FEATURES}' else '0'}" + +# This function to prevent build DTV feature with E3 +python do_dtv_checking () { + soc = d.getVar('SOC_FAMILY') + soc = soc.split(':')[1] + use_dtv = d.getVar('USE_DTV') + if use_dtv == "1" and soc == "r8a77990": + bb.fatal("E3 (SoC: r8a77990) does not support SSP, please disable DTV feature in your local configuration") +} + +addtask dtv_checking before do_configure after do_patch diff --git a/bsp/meta-renesas/meta-rcar-gen3/include/gles-control.inc b/bsp/meta-renesas/meta-rcar-gen3/include/gles-control.inc new file mode 100644 index 00000000..045caa32 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/include/gles-control.inc @@ -0,0 +1,6 @@ +USE_GLES = "${@'1' if 'gsx' in '${MACHINE_FEATURES}' else '0'}" +USE_GLES_WAYLAND = \ + "${@'1' if '${USE_GLES}' == '1' and 'wayland' in '${DISTRO_FEATURES}' else '0'}" +USE_WAYLAND_IVI_SHELL = \ + "${@'1' if 'ivi-shell' in '${DISTRO_FEATURES}' and \ + 'wayland' in '${DISTRO_FEATURES}' else '0'}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/include/iccom-control.inc b/bsp/meta-renesas/meta-rcar-gen3/include/iccom-control.inc new file mode 100644 index 00000000..bb8bd2cc --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/include/iccom-control.inc @@ -0,0 +1,2 @@ +# USE_ICCOM for Linux ICCOM driver, Linux ICCOM library +USE_ICCOM = "${@'1' if 'iccom' in '${DISTRO_FEATURES}' else '0'}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/include/multimedia-control.inc b/bsp/meta-renesas/meta-rcar-gen3/include/multimedia-control.inc new file mode 100644 index 00000000..beeabc15 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/include/multimedia-control.inc @@ -0,0 +1,9 @@ +# USE_MULTIMEDIA for Renesas Multimedia package +USE_MULTIMEDIA = "${@'1' if 'multimedia' in '${MACHINE_FEATURES}' else '0'}" +USE_MULTIMEDIA_TP = "${@'1' if 'mm-test' in '${DISTRO_FEATURES}' else '0'}" + +# For wayland +USE_WAYLAND = "${@'1' if 'wayland' in '${DISTRO_FEATURES}' else '0'}" + +# USE_V4L2_RENDERER for weston v4l2-renderer +USE_V4L2_RENDERER = "${@'1' if 'v4l2-renderer' in '${DISTRO_FEATURES}' else '0'}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/include/omx-control.inc b/bsp/meta-renesas/meta-rcar-gen3/include/omx-control.inc new file mode 100644 index 00000000..69093e8f --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/include/omx-control.inc @@ -0,0 +1,156 @@ +## Additional configuration in OMX module, include +# USE_H263D_OMX for OMX Media Component H263 OMX Library +USE_H263D_OMX = "${@'1' if 'h263dec_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_H264D_OMX for OMX Media Component H264 OMX Library +USE_H264D_OMX = "${@'1' if 'h264dec_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_H264E_OMX for OMX Media Component H264 Encoder Library +USE_H264E_OMX = "${@'1' if 'h264enc_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_H265D_OMX for OMX Media Component H265 OMX Library +USE_H265D_OMX = "${@'1' if 'h265dec_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_MPEG2_OMX for OMX Media Component MPEG2 OMX Library +USE_MPEG2D_OMX = "${@'1' if 'mpeg2dec_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_MPEG4D_OMX for OMX Media Component MPEG4 Decoder Library +USE_MPEG4D_OMX = "${@'1' if 'mpeg4dec_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_VC1D_OMX for OMX Media Component VC-1 Decoder Library +USE_VC1D_OMX = "${@'1' if 'vc1dec_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_DIVXD_OMX for OMX Media Component DivX Decoder Library +USE_DIVXD_OMX = "${@'1' if 'divxdec_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_RVD_OMX for OMX Media Component RealVideo Decoder Library +USE_RVD_OMX = "${@'1' if 'rvdec_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_AACLCD_OMX for OMX Media Component AACLC OMX Library +USE_AACLCD_OMX = "${@'1' if 'aaclcdec_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_AACPV2D_OMX for OMX Media Component aacPlus V2 OMX Library +USE_AACPV2D_OMX = "${@'1' if 'aacpv2dec_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_MP3D_OMX for OMX Media Component MP3 OMX Library +USE_MP3D_OMX = "${@'1' if 'mp3dec_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_WMAD_OMX for OMX Media Component WMA OMX Library +USE_WMAD_OMX = "${@'1' if 'wmadec_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_ALACD_OMX for OMX Media Component ALAC decoder Library +USE_ALACD_OMX = "${@'1' if 'alacdec_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_FLACD_OMX for OMX Media Component FLAC decoder Library +USE_FLACD_OMX = "${@'1' if 'flacdec_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_DDD_OMX for OMX Media Component Dolby(R) Digital decoder Library +USE_DDD_OMX = "${@'1' if 'dddec_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_AACLCE_OMX for OMX Media Component AAC-LC encoder Library +USE_AACLCE_OMX = "${@'1' if 'aaclcenc_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_AACLC_MDW for AACLC MDW Library +USE_AACLC_MDW = "${@'1' if 'aaclcdec_mdw' in '${DISTRO_FEATURES}' else '0'}" + +# USE_AACPV2_MDW for aacPlus V2 MDW Library +USE_AACPV2_MDW = "${@'1' if 'aacpv2dec_mdw' in '${DISTRO_FEATURES}' else '0'}" + +# USE_MP3_MDW for MP3 MDW Library +USE_MP3_MDW = "${@'1' if 'mp3dec_mdw' in '${DISTRO_FEATURES}' else '0'}" + +# USE_WMA_MDW for WMA MDW Library +USE_WMA_MDW = "${@'1' if 'wmadec_mdw' in '${DISTRO_FEATURES}' else '0'}" + +# USE_DD_MDW for Dolby(R) Digital MDW Library +USE_DD_MDW = "${@'1' if 'dddec_mdw' in '${DISTRO_FEATURES}' else '0'}" + +# USE_AACLCE_OMX for AAC-LC encoder middleware Library +USE_AACLCE_MDW = "${@'1' if 'aaclcenc_mdw' in '${DISTRO_FEATURES}' else '0'}" + +# USE_VP8D_OMX for OMX Media Component VP8 Decoder Library +USE_VP8D_OMX = "${@'1' if 'vp8dec_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_VP8E_OMX for OMX Media Component VP8 Encoder Library +USE_VP8E_OMX = "${@'1' if 'vp8enc_lib' in '${DISTRO_FEATURES}' else '0'}" + +# USE_VP9D_OMX for OMX Media Component VP9 Decoder Library +USE_VP9D_OMX = "${@'1' if 'vp9dec_lib' in '${DISTRO_FEATURES}' else '0'}" + +# This function is to make sure vp9dec_lib only build with M3N or E3 +# and warns user to build vp9dec_lib for M3 v3.0 only +python () { + soc = d.getVar('SOC_FAMILY') + soc = soc.split(':')[1] + use_vp9d = d.getVar('USE_VP9D_OMX') + if use_vp9d == "1": + if soc != 'r8a77965' and soc != 'r8a77990': + if soc == 'r8a7796': + bb.warn("vp9dec_lib supports M3 v3.0 only, it does not work on other M3 versions.") + else: + bb.warn("vp9dec_lib only supports M3N (SoC: r8a77965), E3 (SoC: r8a77990), M3 v3.0 (SoC: r8a7796). Disabling.") + d.setVar('USE_VP9D_OMX', '0') +} + +# OMX Video Decoder Flag list +LIST_OMX_VIDEO_DEC_FLAG = " \ + ${USE_H263D_OMX} \ + ${USE_H264D_OMX} \ + ${USE_H265D_OMX} \ + ${USE_MPEG2D_OMX} \ + ${USE_MPEG4D_OMX} \ + ${USE_VC1D_OMX} \ + ${USE_DIVXD_OMX} \ + ${USE_RVD_OMX} \ + ${USE_VP8D_OMX} \ + ${USE_VP9D_OMX} \ +" + +# OMX Video Encoder Flag list +LIST_OMX_VIDEO_ENC_FLAG = " \ + ${USE_H264E_OMX} \ + ${USE_VP8E_OMX} \ +" + +# OMX Audio Flag list (except MDW) +LIST_OMX_AUDIO_FLAG = " \ + ${USE_AACLCD_OMX} \ + ${USE_AACPV2D_OMX} \ + ${USE_MP3D_OMX} \ + ${USE_WMAD_OMX} \ + ${USE_AACLCE_OMX} \ + ${USE_ALACD_OMX} \ + ${USE_FLACD_OMX} \ + ${USE_DDD_OMX} \ +" + +# Audio M/W Flag list +LIST_AUDIO_MDW_FLAG = " \ + ${USE_AACLC_MDW} \ + ${USE_AACPV2_MDW} \ + ${USE_MP3_MDW} \ + ${USE_WMA_MDW} \ + ${USE_DD_MDW} \ + ${USE_AACLCE_MDW} \ +" + +# USE_OMX_VIDEO_DEC for Video Decoder Common Libs +USE_VIDEO_DEC = "${@'1' if '1' in '${LIST_OMX_VIDEO_DEC_FLAG}' else '0'}" + +# USE_OMX_VIDEO_DEC for Video Encoder Common Libs +USE_VIDEO_ENC = "${@'1' if '1' in '${LIST_OMX_VIDEO_ENC_FLAG}' else '0'}" + +# USE_VIDEO_OMX for Enable/Disable OMX Video +USE_VIDEO_OMX = "${@'1' if '1' in '${USE_VIDEO_DEC} ${USE_VIDEO_ENC}' else '0'}" + +# USE_AUDIO_OMX for Audio Common Libs +USE_AUDIO_OMX = "${@'1' if '1' in '${LIST_OMX_AUDIO_FLAG}' else '0'}" + +# USE_OMX_COMMON for OMX Common Libs +USE_OMX_COMMON = "${@'1' if '1' in '${USE_VIDEO_OMX} ${USE_AUDIO_OMX}' else '0'}" + +# USE_OMX_USER_MODULE for OMX User Module +# Note) List of USE_OMX_COMMON = {USE_VIDEO_OMX} + {USE_AUDIO_OMX} +USE_OMX_USER_MODULE = "${@'1' if '1' in '${USE_OMX_COMMON} ${LIST_AUDIO_MDW_FLAG}' else '0'}" + +USE_OMX_EVA_PKG = "${@'1' if 'use_eva_pkg' in '${DISTRO_FEATURES}' else '0'}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/include/rcar-gen3-modules-common.inc b/bsp/meta-renesas/meta-rcar-gen3/include/rcar-gen3-modules-common.inc new file mode 100644 index 00000000..9805862a --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/include/rcar-gen3-modules-common.inc @@ -0,0 +1,11 @@ +export BUILDDIR = "${STAGING_INCDIR}/.." +export INCSHARED = "${STAGING_INCDIR}" +export LIBSHARED = "${STAGING_LIBDIR}" +export KERNELSRC = "${STAGING_KERNEL_DIR}" +export CROSS_COMPILE = "${TARGET_PREFIX}" +export KERNELDIR = "${STAGING_KERNEL_DIR}" +export LDFLAGS = "" +export CP = "cp" +require include/rcar-gen3-path-common.inc + +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" diff --git a/bsp/meta-renesas/meta-rcar-gen3/include/rcar-gen3-path-common.inc b/bsp/meta-renesas/meta-rcar-gen3/include/rcar-gen3-path-common.inc new file mode 100644 index 00000000..d3dcfffc --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/include/rcar-gen3-path-common.inc @@ -0,0 +1 @@ +RENESAS_DATADIR ?= "/usr/local" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-benchmark/glmark2/glmark2.inc b/bsp/meta-renesas/meta-rcar-gen3/recipes-benchmark/glmark2/glmark2.inc new file mode 100644 index 00000000..fa5ac272 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-benchmark/glmark2/glmark2.inc @@ -0,0 +1,3 @@ +PACKAGECONFIG[drm-gl] = ",,virtual/libgl libdrm libgbm" +PACKAGECONFIG[drm-gles2] = ",,virtual/libgles2 libdrm libgbm" + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-benchmark/glmark2/glmark2_git.bbappend b/bsp/meta-renesas/meta-rcar-gen3/recipes-benchmark/glmark2/glmark2_git.bbappend new file mode 100644 index 00000000..fdb7855d --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-benchmark/glmark2/glmark2_git.bbappend @@ -0,0 +1,2 @@ +require ${@"glmark2.inc" if "rcar-gen3" in d.getVar("OVERRIDES") else ""} + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_git.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_git.bb new file mode 100644 index 00000000..2fe6630c --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_git.bb @@ -0,0 +1,60 @@ +DESCRIPTION = "ARM Trusted Firmware" + +LICENSE = "BSD" +LIC_FILES_CHKSUM = "file://license.rst;md5=e927e02bca647e14efd87e9e914b2443" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit deploy +require include/multimedia-control.inc +require include/arm-trusted-firmware-control.inc + +S = "${WORKDIR}/git" + +BRANCH = "rcar_gen3" +SRC_URI = "git://github.com/renesas-rcar/arm-trusted-firmware.git;branch=${BRANCH}" +SRCREV = "af9f429a48b438e314289f17947ad5d8036f398e" + +PV = "v1.5+renesas+git${SRCPV}" + +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" +PLATFORM = "rcar" +ATFW_OPT_LOSSY = "${@oe.utils.conditional("USE_MULTIMEDIA", "1", "RCAR_LOSSY_ENABLE=1", "", d)}" +ATFW_OPT_r8a7795 = "LSI=H3 RCAR_DRAM_SPLIT=1 RCAR_DRAM_LPDDR4_MEMCONF=0 ${ATFW_OPT_LOSSY}" +ATFW_OPT_r8a7796 = "LSI=M3 RCAR_DRAM_SPLIT=2 ${ATFW_OPT_LOSSY}" +ATFW_OPT_r8a77965 = "LSI=M3N ${ATFW_OPT_LOSSY}" +ATFW_OPT_r8a77990 = "LSI=E3 RCAR_SA0_SIZE=0 RCAR_AVS_SETTING_ENABLE=0 RCAR_DRAM_DDR3L_MEMCONF=0 RCAR_DRAM_DDR3L_MEMDUAL=0" +ATFW_OPT_append_ulcb = " RCAR_GEN3_ULCB=1 PMIC_LEVEL_MODE=0" + +# requires CROSS_COMPILE set by hand as there is no configure script +export CROSS_COMPILE="${TARGET_PREFIX}" + +# Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application +CFLAGS[unexport] = "1" +LDFLAGS[unexport] = "1" +AS[unexport] = "1" +LD[unexport] = "1" + +do_compile() { + oe_runmake distclean + oe_runmake bl2 bl31 dummytool PLAT=${PLATFORM} ${ATFW_OPT} +} + +# do_install() nothing +do_install[noexec] = "1" + +do_deploy() { + # Create deploy folder + install -d ${DEPLOYDIR} + + # Copy IPL to deploy folder + install -m 0644 ${S}/build/${PLATFORM}/release/bl2/bl2.elf ${DEPLOYDIR}/bl2-${MACHINE}.elf + install -m 0644 ${S}/build/${PLATFORM}/release/bl2.bin ${DEPLOYDIR}/bl2-${MACHINE}.bin + install -m 0644 ${S}/build/${PLATFORM}/release/bl2.srec ${DEPLOYDIR}/bl2-${MACHINE}.srec + install -m 0644 ${S}/build/${PLATFORM}/release/bl31/bl31.elf ${DEPLOYDIR}/bl31-${MACHINE}.elf + install -m 0644 ${S}/build/${PLATFORM}/release/bl31.bin ${DEPLOYDIR}/bl31-${MACHINE}.bin + install -m 0644 ${S}/build/${PLATFORM}/release/bl31.srec ${DEPLOYDIR}/bl31-${MACHINE}.srec + install -m 0644 ${S}/tools/dummy_create/bootparam_sa0.srec ${DEPLOYDIR}/bootparam_sa0.srec + install -m 0644 ${S}/tools/dummy_create/cert_header_sa6.srec ${DEPLOYDIR}/cert_header_sa6.srec +} +addtask deploy before do_build after do_compile diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-client/0001-Fix-for-teec_trace.c-snprintf-Werror-format-truncati.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-client/0001-Fix-for-teec_trace.c-snprintf-Werror-format-truncati.patch new file mode 100644 index 00000000..db8bdace --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-client/0001-Fix-for-teec_trace.c-snprintf-Werror-format-truncati.patch @@ -0,0 +1,28 @@ +From 30dd2986fb64aba7ee78d4e231c344e2c39d7999 Mon Sep 17 00:00:00 2001 +From: Simon Hughes <simon.hughes@arm.com> +Date: Thu, 21 Jun 2018 17:22:23 +0100 +Subject: [PATCH] Fix for teec_trace.c snprintf -Werror=format-truncation= + error. + +Signed-off-by: Simon Hughes <simon.hughes@arm.com> +--- + libteec/src/teec_trace.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/libteec/src/teec_trace.c b/libteec/src/teec_trace.c +index 78b79d6..c91bc43 100644 +--- a/libteec/src/teec_trace.c ++++ b/libteec/src/teec_trace.c +@@ -106,7 +106,8 @@ int _dprintf(const char *function, int flen, int line, int level, + */ + int thread_id = syscall(SYS_gettid); /* perf issue ? */ + +- snprintf(prefixed, MAX_PRINT_SIZE, ++ int len = 0; ++ len = snprintf(prefixed+len, MAX_PRINT_SIZE, + "%s [%d] %s:%s:%d: %s", + trace_level_strings[level], thread_id, prefix, func, + line, raw); +-- +2.7.4 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-client/0001-tee-supplicant-use-MMC_IOC_MULTI_CMD-for-RPMB-access.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-client/0001-tee-supplicant-use-MMC_IOC_MULTI_CMD-for-RPMB-access.patch new file mode 100644 index 00000000..fddc7fc1 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-client/0001-tee-supplicant-use-MMC_IOC_MULTI_CMD-for-RPMB-access.patch @@ -0,0 +1,208 @@ +From 04a72e88f768722edff453694e70535d36a8b1b4 Mon Sep 17 00:00:00 2001 +From: Hiroki Negishi <hiroki.negishi.bx@renesas.com> +Date: Mon, 1 Apr 2019 13:10:57 +0900 +Subject: [PATCH] tee-supplicant: use MMC_IOC_MULTI_CMD for RPMB access + +To access RPMB, host should switch to RPMB partition. +And in RPMB partition, host should finish RPMB sequence. + +In case of using MMC_IOC_CMD as RPMB ioctl, eMMC driver switches +partition to user data area between WRITE command and READ command. +This may cause General failure. +In case of MMC_IOC_MULTI_CMD, eMMC driver keeps RPMB partition. + +This patch changes RPMB ioctl from MMC_IOC_CMD into MMC_IOC_MULTI_CMD +and changes ioctl parameters according to mmc utils. + +Signed-off-by: Hiroki Negishi <hiroki.negishi.bx@renesas.com> +--- + tee-supplicant/src/rpmb.c | 120 +++++++++++++++++++++++----------------------- + 1 file changed, 61 insertions(+), 59 deletions(-) + +diff --git a/tee-supplicant/src/rpmb.c b/tee-supplicant/src/rpmb.c +index cac9932..29da690 100644 +--- a/tee-supplicant/src/rpmb.c ++++ b/tee-supplicant/src/rpmb.c +@@ -114,6 +114,7 @@ static pthread_mutex_t rpmb_mutex = PTHREAD_MUTEX_INITIALIZER; + */ + + #define MMC_BLOCK_MAJOR 179 ++#define RPMB_MULTI_CMD_MAX_CMDS 3 + + /* mmc_ioc_cmd.opcode */ + #define MMC_SEND_EXT_CSD 8 +@@ -130,6 +131,9 @@ static pthread_mutex_t rpmb_mutex = PTHREAD_MUTEX_INITIALIZER; + + #define MMC_CMD_ADTC (1 << 5) /* Addressed data transfer command */ + ++#define MMC_RSP_SPI_S1 (1 << 7) /* one status byte */ ++#define MMC_RSP_SPI_R1 (MMC_RSP_SPI_S1) ++ + /* mmc_ioc_cmd.write_flag */ + #define MMC_CMD23_ARG_REL_WR (1 << 31) /* CMD23 reliable write */ + +@@ -610,26 +614,38 @@ static uint32_t read_ext_csd(int fd, uint8_t *ext_csd) + return TEEC_SUCCESS; + } + ++static inline void set_single_cmd(struct mmc_ioc_cmd *ioc, __u32 opcode, ++ int write_flag, unsigned int blocks) ++{ ++ ioc->opcode = opcode; ++ ioc->write_flag = write_flag; ++ ioc->arg = 0x0; ++ ioc->blksz = 512; ++ ioc->blocks = blocks; ++ ioc->flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; ++} ++ + static uint32_t rpmb_data_req(int fd, struct rpmb_data_frame *req_frm, + size_t req_nfrm, struct rpmb_data_frame *rsp_frm, + size_t rsp_nfrm) + { +- int st; ++ int err; + size_t i; + uint16_t msg_type = ntohs(req_frm->msg_type); +- struct mmc_ioc_cmd cmd; ++ struct mmc_ioc_cmd *ioc; ++ struct mmc_ioc_multi_cmd *mioc; ++ struct rpmb_data_frame frame_status = {0}; + +- memset(&cmd, 0, sizeof(cmd)); +- cmd.blksz = 512; +- cmd.blocks = req_nfrm; +- cmd.data_ptr = (uintptr_t)req_frm; +- cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC; +- cmd.opcode = MMC_WRITE_MULTIPLE_BLOCK; +- cmd.write_flag = 1; ++ mioc = (struct mmc_ioc_multi_cmd *) ++ malloc(sizeof(struct mmc_ioc_multi_cmd) + ++ RPMB_MULTI_CMD_MAX_CMDS * sizeof(struct mmc_ioc_cmd)); ++ if (!mioc) ++ return -ENOMEM; + + for (i = 1; i < req_nfrm; i++) { + if (req_frm[i].msg_type != msg_type) { + EMSG("All request frames shall be of the same type"); ++ free(mioc); + return TEEC_ERROR_BAD_PARAMETERS; + } + } +@@ -642,77 +658,63 @@ static uint32_t rpmb_data_req(int fd, struct rpmb_data_frame *req_frm, + case RPMB_MSG_TYPE_REQ_AUTH_DATA_WRITE: + if (rsp_nfrm != 1) { + EMSG("Expected only one response frame"); ++ free(mioc); + return TEEC_ERROR_BAD_PARAMETERS; + } + +- /* Send write request frame(s) */ +- cmd.write_flag |= MMC_CMD23_ARG_REL_WR; +- /* +- * Black magic: tested on a HiKey board with a HardKernel eMMC +- * module. When postsleep values are zero, the kernel logs +- * random errors: "mmc_blk_ioctl_cmd: Card Status=0x00000E00" +- * and ioctl() fails. +- */ +- cmd.postsleep_min_us = 20000; +- cmd.postsleep_max_us = 50000; +- st = IOCTL(fd, MMC_IOC_CMD, &cmd); +- if (st < 0) +- return TEEC_ERROR_GENERIC; +- cmd.postsleep_min_us = 0; +- cmd.postsleep_max_us = 0; +- +- /* Send result request frame */ +- memset(rsp_frm, 0, 1); +- rsp_frm->msg_type = htons(RPMB_MSG_TYPE_REQ_RESULT_READ); +- cmd.data_ptr = (uintptr_t)rsp_frm; +- cmd.write_flag &= ~MMC_CMD23_ARG_REL_WR; +- st = IOCTL(fd, MMC_IOC_CMD, &cmd); +- if (st < 0) +- return TEEC_ERROR_GENERIC; +- +- /* Read response frame */ +- cmd.opcode = MMC_READ_MULTIPLE_BLOCK; +- cmd.write_flag = 0; +- cmd.blocks = rsp_nfrm; +- st = IOCTL(fd, MMC_IOC_CMD, &cmd); +- if (st < 0) +- return TEEC_ERROR_GENERIC; ++ mioc->num_of_cmds = 3; ++ ++ /* Write request */ ++ ioc = &mioc->cmds[0]; ++ set_single_cmd(ioc, MMC_WRITE_MULTIPLE_BLOCK, (1 << 31) | 1, 1); ++ mmc_ioc_cmd_set_data((*ioc), req_frm); ++ ++ /* Result request */ ++ ioc = &mioc->cmds[1]; ++ frame_status.msg_type = htobe16(RPMB_MSG_TYPE_REQ_RESULT_READ); ++ set_single_cmd(ioc, MMC_WRITE_MULTIPLE_BLOCK, 1, 1); ++ mmc_ioc_cmd_set_data((*ioc), &frame_status); ++ ++ /* Get response */ ++ ioc = &mioc->cmds[2]; ++ set_single_cmd(ioc, MMC_READ_MULTIPLE_BLOCK, 0, 1); ++ mmc_ioc_cmd_set_data((*ioc), rsp_frm); ++ + break; + + case RPMB_MSG_TYPE_REQ_WRITE_COUNTER_VAL_READ: + if (rsp_nfrm != 1) { + EMSG("Expected only one response frame"); ++ free(mioc); + return TEEC_ERROR_BAD_PARAMETERS; + } + + /* Fall through */ + case RPMB_MSG_TYPE_REQ_AUTH_DATA_READ: +- if (req_nfrm != 1) { +- EMSG("Expected only one request frame"); +- return TEEC_ERROR_BAD_PARAMETERS; +- } ++ mioc->num_of_cmds = 2; ++ ++ /* Read request */ ++ ioc = &mioc->cmds[0]; ++ set_single_cmd(ioc, MMC_WRITE_MULTIPLE_BLOCK, 1, 1); ++ mmc_ioc_cmd_set_data((*ioc), req_frm); ++ ++ /* Get response */ ++ ioc = &mioc->cmds[1]; ++ set_single_cmd(ioc, MMC_READ_MULTIPLE_BLOCK, 0, rsp_nfrm); ++ mmc_ioc_cmd_set_data((*ioc), rsp_frm); + +- /* Send request frame */ +- st = IOCTL(fd, MMC_IOC_CMD, &cmd); +- if (st < 0) +- return TEEC_ERROR_GENERIC; +- +- /* Read response frames */ +- cmd.data_ptr = (uintptr_t)rsp_frm; +- cmd.opcode = MMC_READ_MULTIPLE_BLOCK; +- cmd.write_flag = 0; +- cmd.blocks = rsp_nfrm; +- st = IOCTL(fd, MMC_IOC_CMD, &cmd); +- if (st < 0) +- return TEEC_ERROR_GENERIC; + break; + + default: + EMSG("Unsupported message type: %d", msg_type); ++ free(mioc); + return TEEC_ERROR_GENERIC; + } + +- return TEEC_SUCCESS; ++ err = ioctl(fd, MMC_IOC_MULTI_CMD, mioc); ++ ++ free(mioc); ++ return err; + } + + static uint32_t rpmb_get_dev_info(uint16_t dev_id, struct rpmb_dev_info *info) +-- +2.7.4 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-client/optee.service b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-client/optee.service new file mode 100644 index 00000000..37fc4f75 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-client/optee.service @@ -0,0 +1,9 @@ +[Unit] +Description=optee services + +[Service] +ExecStart=/usr/bin/tee-supplicant +ExecStop=/usr/bin/killall -s KILL tee-supplicant + +[Install] +WantedBy=multi-user.target diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-client_git.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-client_git.bb new file mode 100644 index 00000000..0319f217 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-client_git.bb @@ -0,0 +1,63 @@ +DESCRIPTION = "OP-TEE Client" +LICENSE = "BSD-2-Clause" + +LIC_FILES_CHKSUM = "file://LICENSE;md5=69663ab153298557a59c67a60a743e5b" +PR = "r0" +PV = "3.1.0+renesas+git${SRCPV}" +BRANCH = "master" +SRC_URI = "git://github.com/OP-TEE/optee_client.git;branch=${BRANCH}" +SRCREV = "3f16662284a69fdec97b1712064be94d1fed7ae7" + +SRC_URI += " \ + file://optee.service \ + file://0001-tee-supplicant-use-MMC_IOC_MULTI_CMD-for-RPMB-access.patch \ + file://0001-Fix-for-teec_trace.c-snprintf-Werror-format-truncati.patch \ +" + +inherit python3native systemd +SYSTEMD_SERVICE_${PN} = "optee.service" + +COMPATIBLE_MACHINE = "salvator-x|h3ulcb|m3ulcb|m3nulcb|ebisu" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +S = "${WORKDIR}/git" + +# Recipe which fail to compile when enabling _FORTIFY_SOURCE=2 option +SECURITY_CFLAGS_pn-optee-client = "" + +EXTRA_OEMAKE = "RPMB_EMU=0" + +do_install () { + # Create destination directories + install -d ${D}/${libdir} + install -d ${D}/${includedir} + + # Install library + install -m 0755 ${S}/out/export/lib/libteec.so.1.0 ${D}/${libdir} + + # Create symbolic link + cd ${D}/${libdir} + ln -sf libteec.so.1.0 libteec.so.1 + ln -sf libteec.so.1 libteec.so + + # Install header files + install -m 0644 ${S}/out/export/include/* ${D}/${includedir} + + # Install systemd service configure file for OP-TEE client + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}/${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/optee.service ${D}/${systemd_system_unitdir} + fi +} + +# install the tee-supplicant for 64 bit only. +do_install_append_aarch64 () { + # Create destination directory + install -d ${D}/${bindir} + + # Install binary to bindir + install -m 0755 ${S}/out/export/bin/tee-supplicant ${D}/${bindir} +} + +RPROVIDES_${PN} += "optee-client" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-os/0001-core-define-syscall_t-as-void-void.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-os/0001-core-define-syscall_t-as-void-void.patch new file mode 100644 index 00000000..bad7b27c --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-os/0001-core-define-syscall_t-as-void-void.patch @@ -0,0 +1,75 @@ +From f6d17e33e7b95c90a2521cfd37cd5cb511909fc4 Mon Sep 17 00:00:00 2001 +From: Jerome Forissier <jerome.forissier@linaro.org> +Date: Thu, 5 Jul 2018 13:07:52 +0200 +Subject: [PATCH] core: define syscall_t as void (*)(void) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +syscall_t is currently typedef'ed as TEE_Result (*)(void). It is used to +represent a pointer to any system call, in the syscall table for instance. +As such, the exact type behind syscall_t cannot reflect all the syscalls +since they have different prototypes. The current declaration with a +TEE_Result return type was probably chosen because it was a common +characteristic of all syscalls to return a TEE_Result. + +However, this type causes compilation warnings with GCC 8.1: + +core/arch/arm/tee/arch_svc.c:43:36: warning: cast between incompatible function types from ‘void (*)(long unsigned int)’ to ‘TEE_Result (*)(void)’ {aka ‘unsigned int (*)(void)’} [-Wcast-function-type] + #define SYSCALL_ENTRY(_fn) { .fn = (syscall_t)_fn } + ^ +core/arch/arm/tee/arch_svc.c:50:2: note: in expansion of macro ‘SYSCALL_ENTRY’ + SYSCALL_ENTRY(syscall_sys_return), + ^~~~~~~~~~~~~ + +The solution is to use 'void (*)(void)' instead, as explained in the GCC +documentation: + + -Wcast-function-type + + Warn when a function pointer is cast to an incompatible function + pointer. [...] The function type void (*) (void) is special and matches + everything, which can be used to suppress this warning. [...] + +Link: [1] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html +Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> +Acked-by: Jens Wiklander <jens.wiklander@linaro.org> +--- + core/arch/arm/tee/arch_svc.c | 2 +- + core/arch/arm/tee/arch_svc_private.h | 7 +++++-- + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/core/arch/arm/tee/arch_svc.c b/core/arch/arm/tee/arch_svc.c +index eb142ec..b2dd193 100644 +--- a/core/arch/arm/tee/arch_svc.c ++++ b/core/arch/arm/tee/arch_svc.c +@@ -208,7 +208,7 @@ void __weak tee_svc_handler(struct thread_svc_regs *regs) + } + + if (scn > TEE_SCN_MAX) +- scf = syscall_not_supported; ++ scf = (syscall_t)syscall_not_supported; + else + scf = tee_svc_syscall_table[scn].fn; + +diff --git a/core/arch/arm/tee/arch_svc_private.h b/core/arch/arm/tee/arch_svc_private.h +index c0b3a73..695e733 100644 +--- a/core/arch/arm/tee/arch_svc_private.h ++++ b/core/arch/arm/tee/arch_svc_private.h +@@ -7,8 +7,11 @@ + + #include <tee_api_types.h> + +-/* void argument but in reality it can be any number of arguments */ +-typedef TEE_Result (*syscall_t)(void); ++/* ++ * Generic "pointer to function" type. Actual syscalls take zero or more ++ * arguments and return TEE_Result. ++ */ ++typedef void (*syscall_t)(void); + + /* Helper function for tee_svc_handler() */ + uint32_t tee_svc_do_call(struct thread_svc_regs *regs, syscall_t func); +-- +2.7.4 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-os/0001-scripts-update-scripts-to-use-python3.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-os/0001-scripts-update-scripts-to-use-python3.patch new file mode 100644 index 00000000..9621cf6c --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-os/0001-scripts-update-scripts-to-use-python3.patch @@ -0,0 +1,427 @@ +From 0d4941123b5a88351f5954f6de00892f85ed5abc Mon Sep 17 00:00:00 2001 +From: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com> +Date: Mon, 20 Jan 2020 22:32:13 +0000 +Subject: [PATCH] scripts: update scripts to use python3 + +Python2 is deprecated effective Jan. 2020, and is not available in +several distributions. + +Update scripts here to re-target then onto python version 3. + +Upstream-Status: Pending + +Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com> +--- + scripts/gen_hashed_bin.py | 282 ++++++++++++++++++++------------------ + scripts/gen_ld_sects.py | 8 +- + scripts/pem_to_pub_c.py | 2 +- + scripts/sign.py | 2 +- + scripts/symbolize.py | 2 +- + scripts/ta_bin_to_c.py | 2 +- + scripts/tee_bin_parser.py | 2 +- + 7 files changed, 157 insertions(+), 143 deletions(-) + +diff --git a/scripts/gen_hashed_bin.py b/scripts/gen_hashed_bin.py +index 32350a47..a76a62cc 100755 +--- a/scripts/gen_hashed_bin.py ++++ b/scripts/gen_hashed_bin.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # SPDX-License-Identifier: BSD-2-Clause + # + # Copyright (c) 2014-2017, Linaro Limited +@@ -14,163 +14,177 @@ import hashlib + arch_id = {'arm32': 0, 'arm64': 1} + image_id = {'pager': 0, 'paged': 1} + ++ + def write_header_v1(outf, init_size, args, paged_size): +- magic = 0x4554504f # 'OPTE' +- version = 1; +- outf.write(struct.pack('<IBBHIIIII', \ +- magic, version, arch_id[args.arch], args.flags, init_size, \ +- args.init_load_addr_hi, args.init_load_addr_lo, \ +- args.init_mem_usage, paged_size)) ++ magic = 0x4554504f # 'OPTE' ++ version = 1 ++ outf.write(struct.pack('<IBBHIIIII', ++ magic, ++ version, ++ arch_id[args.arch], ++ args.flags, ++ init_size, ++ args.init_load_addr_hi, ++ args.init_load_addr_lo, ++ args.init_mem_usage, ++ paged_size)) ++ + + def write_header_v2(outf, init_size, args, paged_size): +- magic = 0x4554504f # 'OPTE' +- version = 2 +- nb_images = 1 if paged_size == 0 else 2 +- outf.write(struct.pack('<IBBHI', \ +- magic, version, arch_id[args.arch], args.flags, nb_images)) +- outf.write(struct.pack('<IIII', \ +- args.init_load_addr_hi, args.init_load_addr_lo, \ +- image_id['pager'], init_size)) +- if nb_images == 2: +- outf.write(struct.pack('<IIII', \ +- 0xffffffff, 0xffffffff, image_id['paged'], paged_size)) ++ magic = 0x4554504f # 'OPTE' ++ version = 2 ++ nb_images = 1 if paged_size == 0 else 2 ++ outf.write(struct.pack('<IBBHI', magic, version, ++ arch_id[args.arch], args.flags, nb_images)) ++ outf.write(struct.pack('<IIII', ++ args.init_load_addr_hi, args.init_load_addr_lo, ++ image_id['pager'], init_size)) ++ if nb_images == 2: ++ outf.write( ++ struct.pack( ++ '<IIII', ++ 0xffffffff, ++ 0xffffffff, ++ image_id['paged'], ++ paged_size)) ++ + + def append_to(outf, start_offs, in_fname, max_bytes=0xffffffff): +- #print "Appending %s@0x%x 0x%x bytes at position 0x%x" % \ +- #( in_fname, start_offs, max_bytes, int(outf.tell()) ) +- inf = open(in_fname, 'rb'); +- inf.seek(start_offs) +- while True : +- nbytes = min(16 * 1024, max_bytes) +- if nbytes == 0 : +- break +- #print "Reading %s %d bytes" % (in_fname, nbytes) +- buf = inf.read(nbytes) +- if not buf : +- break +- outf.write(buf) +- max_bytes -= len(buf) +- inf.close() ++ inf = open(in_fname, 'rb') ++ inf.seek(start_offs) ++ while True: ++ nbytes = min(16 * 1024, max_bytes) ++ if nbytes == 0: ++ break ++ buf = inf.read(nbytes) ++ if not buf: ++ break ++ outf.write(buf) ++ max_bytes -= len(buf) ++ inf.close() ++ + + def append_hashes(outf, in_fname): +- page_size = 4 * 1024 +- +- inf = open(in_fname, 'r') +- while True : +- page = inf.read(page_size) +- if len(page) == page_size : +- #print "Writing hash at position 0x%x" % \ +- #int(outf.tell()) +- outf.write(hashlib.sha256(page).digest()) +- elif len(page) == 0 : +- break +- else : +- print("Error: short read, got " + repr(len(page))) +- sys.exit(1) +- +- inf.close() ++ page_size = 4 * 1024 ++ ++ inf = open(in_fname, 'rb') ++ while True: ++ page = inf.read(page_size) ++ if len(page) == page_size: ++ outf.write(hashlib.sha256(page).digest()) ++ elif len(page) == 0: ++ break ++ else: ++ print("Error: short read, got {}".format(len(page))) ++ sys.exit(1) ++ ++ inf.close() ++ + + def int_parse(str): +- return int(str, 0) ++ return int(str, 0) ++ + + def get_args(): +- parser = argparse.ArgumentParser() +- parser.add_argument('--arch', required=True, \ +- choices=arch_id.keys(), \ +- help='Architecture') ++ parser = argparse.ArgumentParser() ++ parser.add_argument('--arch', required=True, ++ choices=list(arch_id.keys()), ++ help='Architecture') + +- parser.add_argument('--flags', \ +- type=int, default=0, \ +- help='Flags, currently none defined') ++ parser.add_argument('--flags', ++ type=int, default=0, ++ help='Flags, currently none defined') + +- parser.add_argument('--init_size', \ +- required=True, type=int_parse, \ +- help='Size of initialization part of binary') ++ parser.add_argument('--init_size', ++ required=True, type=int_parse, ++ help='Size of initialization part of binary') + +- parser.add_argument('--init_load_addr_hi', \ +- type=int_parse, default=0, \ +- help='Upper 32 bits of load address of binary') ++ parser.add_argument('--init_load_addr_hi', ++ type=int_parse, default=0, ++ help='Upper 32 bits of load address of binary') + +- parser.add_argument('--init_load_addr_lo', \ +- required=True, type=int_parse, \ +- help='Lower 32 bits of load address of binary') ++ parser.add_argument('--init_load_addr_lo', ++ required=True, type=int_parse, ++ help='Lower 32 bits of load address of binary') + +- parser.add_argument('--init_mem_usage', \ +- required=True, type=int_parse, \ +- help='Total amount of used memory when initializing'); ++ parser.add_argument('--init_mem_usage', ++ required=True, type=int_parse, ++ help='Total amount of used memory when initializing') + +- parser.add_argument('--tee_pager_bin', \ +- required=True, \ +- help='The input tee_pager.bin') ++ parser.add_argument('--tee_pager_bin', ++ required=True, ++ help='The input tee_pager.bin') + +- parser.add_argument('--tee_pageable_bin', \ +- required=True, \ +- help='The input tee_pageable.bin') ++ parser.add_argument('--tee_pageable_bin', ++ required=True, ++ help='The input tee_pageable.bin') + +- parser.add_argument('--out', \ +- required=False, type=argparse.FileType('wb'), \ +- help='The output tee.bin') ++ parser.add_argument('--out', ++ required=False, type=argparse.FileType('wb'), ++ help='The output tee.bin') + +- parser.add_argument('--out_header_v2', \ +- required=False, type=argparse.FileType('wb'), \ +- help='The output tee_header_v2.bin') ++ parser.add_argument('--out_header_v2', ++ required=False, type=argparse.FileType('wb'), ++ help='The output tee_header_v2.bin') + +- parser.add_argument('--out_pager_v2', \ +- required=False, type=argparse.FileType('wb'), \ +- help='The output tee_pager_v2.bin') ++ parser.add_argument('--out_pager_v2', ++ required=False, type=argparse.FileType('wb'), ++ help='The output tee_pager_v2.bin') + +- parser.add_argument('--out_pageable_v2', \ +- required=False, type=argparse.FileType('wb'), \ +- help='The output tee_pageable_v2.bin') ++ parser.add_argument('--out_pageable_v2', ++ required=False, type=argparse.FileType('wb'), ++ help='The output tee_pageable_v2.bin') ++ ++ return parser.parse_args() + +- return parser.parse_args(); + + def main(): +- args = get_args() +- init_bin_size = args.init_size +- tee_pager_fname = args.tee_pager_bin +- tee_pageable_fname = args.tee_pageable_bin +- pager_input_size = os.path.getsize(tee_pager_fname); +- paged_input_size = os.path.getsize(tee_pageable_fname); +- hash_size = paged_input_size / (4 * 1024) * \ +- hashlib.sha256().digest_size +- +- if paged_input_size % (4 * 1024) != 0: +- print("Error: pageable size not a multiple of 4K:" + \ +- repr(paged_input_size)) +- sys.exit(1) +- +- init_size = pager_input_size + \ +- min(init_bin_size, paged_input_size) + \ +- hash_size +- paged_size = paged_input_size - \ +- min(init_bin_size, paged_input_size) +- +- if args.out is not None: +- outf = args.out +- write_header_v1(outf, init_size, args, paged_size) +- append_to(outf, 0, tee_pager_fname) +- append_to(outf, 0, tee_pageable_fname, init_bin_size) +- append_hashes(outf, tee_pageable_fname) +- append_to(outf, init_bin_size, tee_pageable_fname) +- outf.close() +- +- if args.out_header_v2 is not None: +- outf = args.out_header_v2 +- write_header_v2(outf, init_size, args, paged_size) +- outf.close() +- +- if args.out_pager_v2 is not None: +- outf = args.out_pager_v2 +- append_to(outf, 0, tee_pager_fname) +- append_to(outf, 0, tee_pageable_fname, init_bin_size) +- append_hashes(outf, tee_pageable_fname) +- outf.close() +- +- if args.out_pageable_v2 is not None: +- outf = args.out_pageable_v2 +- append_to(outf, init_bin_size, tee_pageable_fname) +- outf.close() ++ args = get_args() ++ init_bin_size = args.init_size ++ tee_pager_fname = args.tee_pager_bin ++ tee_pageable_fname = args.tee_pageable_bin ++ pager_input_size = os.path.getsize(tee_pager_fname) ++ paged_input_size = os.path.getsize(tee_pageable_fname) ++ hash_size = paged_input_size // (4 * 1024) * \ ++ hashlib.sha256().digest_size ++ ++ if paged_input_size % (4 * 1024) != 0: ++ print("Error: pageable size not a multiple of 4K: {}".format( ++ paged_input_size)) ++ sys.exit(1) ++ ++ init_size = pager_input_size + \ ++ min(init_bin_size, paged_input_size) + \ ++ hash_size ++ paged_size = paged_input_size - \ ++ min(init_bin_size, paged_input_size) ++ ++ if args.out is not None: ++ outf = args.out ++ write_header_v1(outf, init_size, args, paged_size) ++ append_to(outf, 0, tee_pager_fname) ++ append_to(outf, 0, tee_pageable_fname, init_bin_size) ++ append_hashes(outf, tee_pageable_fname) ++ append_to(outf, init_bin_size, tee_pageable_fname) ++ outf.close() ++ ++ if args.out_header_v2 is not None: ++ outf = args.out_header_v2 ++ write_header_v2(outf, init_size, args, paged_size) ++ outf.close() ++ ++ if args.out_pager_v2 is not None: ++ outf = args.out_pager_v2 ++ append_to(outf, 0, tee_pager_fname) ++ append_to(outf, 0, tee_pageable_fname, init_bin_size) ++ append_hashes(outf, tee_pageable_fname) ++ outf.close() ++ ++ if args.out_pageable_v2 is not None: ++ outf = args.out_pageable_v2 ++ append_to(outf, init_bin_size, tee_pageable_fname) ++ outf.close() ++ + + if __name__ == "__main__": +- main() ++ main() +diff --git a/scripts/gen_ld_sects.py b/scripts/gen_ld_sects.py +index c5dc3a7b..2bdbb192 100755 +--- a/scripts/gen_ld_sects.py ++++ b/scripts/gen_ld_sects.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # SPDX-License-Identifier: BSD-2-Clause + # + # Copyright (c) 2017, Linaro Limited +@@ -8,8 +8,8 @@ import sys + import re + + def usage(): +- print "Usage: {0} <section reg exp match> [<skip section>...]".format( \ +- sys.argv[0]) ++ print("Usage: {0} <section reg exp match> [<skip section>...]".format( \ ++ sys.argv[0])) + sys.exit (1) + + def main(): +@@ -55,7 +55,7 @@ def main(): + if sect_name in skip_sections : + continue + +- print '\t*({0})'.format(sect_name) ++ print ('\t*({0})'.format(sect_name)) + + if __name__ == "__main__": + main() +diff --git a/scripts/pem_to_pub_c.py b/scripts/pem_to_pub_c.py +index 6b8fa365..0b03d62e 100755 +--- a/scripts/pem_to_pub_c.py ++++ b/scripts/pem_to_pub_c.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # SPDX-License-Identifier: BSD-2-Clause + # + # Copyright (c) 2015, Linaro Limited +diff --git a/scripts/sign.py b/scripts/sign.py +index ad47479b..348b40a2 100755 +--- a/scripts/sign.py ++++ b/scripts/sign.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + # Copyright (c) 2015, 2017, Linaro Limited + # +diff --git a/scripts/symbolize.py b/scripts/symbolize.py +index 1eecf758..0e9bd3ed 100755 +--- a/scripts/symbolize.py ++++ b/scripts/symbolize.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # SPDX-License-Identifier: BSD-2-Clause + # + # Copyright (c) 2017, Linaro Limited +diff --git a/scripts/ta_bin_to_c.py b/scripts/ta_bin_to_c.py +index cabddbbd..f325fda0 100755 +--- a/scripts/ta_bin_to_c.py ++++ b/scripts/ta_bin_to_c.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # SPDX-License-Identifier: BSD-2-Clause + # + # Copyright (c) 2017, Linaro Limited +diff --git a/scripts/tee_bin_parser.py b/scripts/tee_bin_parser.py +index 5f7dd3f0..07da5791 100755 +--- a/scripts/tee_bin_parser.py ++++ b/scripts/tee_bin_parser.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # SPDX-License-Identifier: BSD-2-Clause + # + # Copyright (c) 2016, Linaro Limited +-- +2.17.1 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-os_git.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-os_git.bb new file mode 100644 index 00000000..23574e7a --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/optee/optee-os_git.bb @@ -0,0 +1,69 @@ +DESCRIPTION = "OP-TEE OS" + +LICENSE = "BSD-2-Clause & BSD-3-Clause" +LIC_FILES_CHKSUM = " \ + file://LICENSE;md5=69663ab153298557a59c67a60a743e5b \ + file://${WORKDIR}/git_official/LICENSE;md5=69663ab153298557a59c67a60a743e5b \ +" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit deploy python3native + +PV = "3.1.0+renesas+git${SRCPV}" + +BRANCH = "rcar_gen3" +SRCREV_renesas = "c20fa00ff94bb6c40c11330ca280aa3f2807b8e8" +SRCREV_officialgit = "e77020396508fc086d7a4d6137388b116e4a662f" +SRCREV_FORMAT = "renesas_officialgit" + +SRC_URI = " \ + git://github.com/renesas-rcar/optee_os.git;branch=${BRANCH};name=renesas \ + git://github.com/OP-TEE/optee_os.git;branch=master;name=officialgit;destsuffix=git_official \ +" + +SRC_URI_append = " \ + file://0001-core-define-syscall_t-as-void-void.patch \ + file://0001-scripts-update-scripts-to-use-python3.patch \ +" + +COMPATIBLE_MACHINE = "(salvator-x|h3ulcb|m3ulcb|m3nulcb|ebisu)" +PLATFORM = "rcar" + +DEPENDS = "python3-pycrypto-native" + +export CROSS_COMPILE64="${TARGET_PREFIX}" + +# Let the Makefile handle setting up the flags as it is a standalone application +LD[unexport] = "1" +LDFLAGS[unexport] = "1" +export CCcore="${CC}" +export LDcore="${LD}" +libdir[unexport] = "1" + +S = "${WORKDIR}/git" +EXTRA_OEMAKE = "-e MAKEFLAGS=" + +do_configure() { + git -C ${WORKDIR}/git_official checkout -B official 3.1.0 + git -C ${WORKDIR}/git_official cherry-pick -n ${SRCREV_officialgit} + cp -rn ${WORKDIR}/git_official/core/lib/libtomcrypt ${B}/core/lib/. +} + +do_compile() { + oe_runmake PLATFORM=${PLATFORM} CFG_ARM64_core=y +} + +# do_install() nothing +do_install[noexec] = "1" + +do_deploy() { + # Create deploy folder + install -d ${DEPLOYDIR} + + # Copy TEE OS to deploy folder + install -m 0644 ${S}/out/arm-plat-${PLATFORM}/core/tee.elf ${DEPLOYDIR}/tee-${MACHINE}.elf + install -m 0644 ${S}/out/arm-plat-${PLATFORM}/core/tee.bin ${DEPLOYDIR}/tee-${MACHINE}.bin + install -m 0644 ${S}/out/arm-plat-${PLATFORM}/core/tee.srec ${DEPLOYDIR}/tee-${MACHINE}.srec +} +addtask deploy before do_build after do_compile diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/qos/qosif-tp-user-module.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/qos/qosif-tp-user-module.bb new file mode 100644 index 00000000..8fb0198f --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/qos/qosif-tp-user-module.bb @@ -0,0 +1,36 @@ +DESCRIPTION = "QOS Interface test app for R-Car Gen3" + +require qosif.inc + +DEPENDS = "qosif-user-module" +PN = "qosif-tp-user-module" +PR = "r0" + +S = "${WORKDIR}/git" +QOSIF_TP_DIR = "qos_if-tp-user/files/qos_if" + +includedir = "${RENESAS_DATADIR}/include" + +do_compile() { + cd ${S}/${QOSIF_TP_DIR} + oe_runmake +} + +do_install() { + # Create destination directory + install -d ${D}${RENESAS_DATADIR}/bin/ + + # Copy user test program + install -m 755 ${S}/${QOSIF_TP_DIR}/qos_tp ${D}${RENESAS_DATADIR}/bin/ +} + +PACKAGES = " \ + ${PN} \ + ${PN}-dbg \ +" + +FILES_${PN} = "${RENESAS_DATADIR}/bin/qos_tp" + +FILES_${PN}-dbg = " \ + ${RENESAS_DATADIR}/bin/.debug/* \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/qos/qosif-user-module.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/qos/qosif-user-module.bb new file mode 100644 index 00000000..c836fe31 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/qos/qosif-user-module.bb @@ -0,0 +1,48 @@ +DESCRIPTION = "QOS Interface library for R-Car Gen3" + +require qosif.inc + +DEPENDS = "kernel-module-qos" +PN = "qosif-user-module" +PR = "r0" + +S = "${WORKDIR}/git" +QOSIF_LIB_DIR = "qos_if-module/files/qos_if" + +EXTRA_OEMAKE = "ARCH=${TARGET_ARCH}" + +includedir = "${RENESAS_DATADIR}/include" + +do_compile() { + # Build shared library + cd ${S}/${QOSIF_LIB_DIR}/if + rm -rf ${S}/${QOSIF_LIB_DIR}/if/libqos.so* + oe_runmake +} + +do_install() { + # Create destination directories + install -d ${D}/${libdir} + install -d ${D}/${includedir} + + # Copy shared library + install -m 755 ${S}/${QOSIF_LIB_DIR}/if/libqos.so* ${D}/${libdir}/ + cd ${D}/${libdir}/ + ln -sf libqos.so.1.0.0 libqos.so.1 + ln -sf libqos.so.1 libqos.so + + # Install shared header file + install -m 644 ${S}/${QOSIF_LIB_DIR}/include/qos_public.h ${D}/${includedir}/ +} + +PACKAGES = " \ + ${PN} \ + ${PN}-dev \ + ${PN}-dbg \ +" + +FILES_${PN} = " \ + ${libdir}/libqos.so* \ +" + +INSANE_SKIP_${PN} = "dev-so" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/qos/qosif.inc b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/qos/qosif.inc new file mode 100644 index 00000000..0b6cf905 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/qos/qosif.inc @@ -0,0 +1,15 @@ +LICENSE = "MIT" +LIC_FILES_CHKSUM = " \ + file://COPYING.MIT;md5=96659f2a7571bfa27483882a653c3bb9 \ +" + +require include/rcar-gen3-modules-common.inc + +QOSIF_LIB_URL = "git://github.com/renesas-rcar/qos_lib.git" +BRANCH = "rcar-gen3" +SRCREV = "84ea8d562a55d1fbd7b6acf08a498d33a92dc392" + +SRC_URI = "${QOSIF_LIB_URL};branch=${BRANCH}" + +# This module is machine specific. +PACKAGE_ARCH = "${MACHINE_ARCH}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/u-boot/u-boot-common_2018.09.inc b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/u-boot/u-boot-common_2018.09.inc new file mode 100644 index 00000000..f66ac8fb --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/u-boot/u-boot-common_2018.09.inc @@ -0,0 +1,9 @@ +HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome" +SECTION = "bootloaders" +DEPENDS += "flex-native bison-native" + +LICENSE = "GPLv2+" +LIC_FILES_CHKSUM = "file://Licenses/README;md5=30503fd321432fc713238f582193b78e" +PE = "1" + +S = "${WORKDIR}/git" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/u-boot/u-boot.inc b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/u-boot/u-boot.inc new file mode 100644 index 00000000..f009d18d --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/u-boot/u-boot.inc @@ -0,0 +1,310 @@ +SUMMARY = "Universal Boot Loader for embedded devices" +PROVIDES = "virtual/bootloader" + +B = "${WORKDIR}/build" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit uboot-config uboot-extlinux-config uboot-sign deploy + +DEPENDS += "swig-native python3-native" + +EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}" V=1' +EXTRA_OEMAKE += 'HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}"' +EXTRA_OEMAKE += 'PYTHON=nativepython STAGING_INCDIR=${STAGING_INCDIR_NATIVE} STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE}' + +PACKAGECONFIG ??= "openssl" +# u-boot will compile its own tools during the build, with specific +# configurations (aka when CONFIG_FIT_SIGNATURE is enabled) openssl is needed as +# a host build dependency. +PACKAGECONFIG[openssl] = ",,openssl-native" + +# Allow setting an additional version string that will be picked up by the +# u-boot build system and appended to the u-boot version. If the .scmversion +# file already exists it will not be overwritten. +UBOOT_LOCALVERSION ?= "" + +# Some versions of u-boot use .bin and others use .img. By default use .bin +# but enable individual recipes to change this value. +UBOOT_SUFFIX ??= "bin" +UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}" +UBOOT_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_SUFFIX}" +UBOOT_MAKE_TARGET ?= "all" + +# Output the ELF generated. Some platforms can use the ELF file and directly +# load it (JTAG booting, QEMU) additionally the ELF can be used for debugging +# purposes. +UBOOT_ELF ?= "" +UBOOT_ELF_SUFFIX ?= "elf" +UBOOT_ELF_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_ELF_SUFFIX}" +UBOOT_ELF_BINARY ?= "u-boot.${UBOOT_ELF_SUFFIX}" +UBOOT_ELF_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_ELF_SUFFIX}" + +# Some versions of u-boot build an SPL (Second Program Loader) image that +# should be packaged along with the u-boot binary as well as placed in the +# deploy directory. For those versions they can set the following variables +# to allow packaging the SPL. +SPL_BINARY ?= "" +SPL_BINARYNAME ?= "${@os.path.basename(d.getVar("SPL_BINARY"))}" +SPL_IMAGE ?= "${SPL_BINARYNAME}-${MACHINE}-${PV}-${PR}" +SPL_SYMLINK ?= "${SPL_BINARYNAME}-${MACHINE}" + +# Additional environment variables or a script can be installed alongside +# u-boot to be used automatically on boot. This file, typically 'uEnv.txt' +# or 'boot.scr', should be packaged along with u-boot as well as placed in the +# deploy directory. Machine configurations needing one of these files should +# include it in the SRC_URI and set the UBOOT_ENV parameter. +UBOOT_ENV_SUFFIX ?= "txt" +UBOOT_ENV ?= "" +UBOOT_ENV_BINARY ?= "${UBOOT_ENV}.${UBOOT_ENV_SUFFIX}" +UBOOT_ENV_IMAGE ?= "${UBOOT_ENV}-${MACHINE}-${PV}-${PR}.${UBOOT_ENV_SUFFIX}" +UBOOT_ENV_SYMLINK ?= "${UBOOT_ENV}-${MACHINE}.${UBOOT_ENV_SUFFIX}" + +# U-Boot EXTLINUX variables. U-Boot searches for /boot/extlinux/extlinux.conf +# to find EXTLINUX conf file. +UBOOT_EXTLINUX_INSTALL_DIR ?= "/boot/extlinux" +UBOOT_EXTLINUX_CONF_NAME ?= "extlinux.conf" +UBOOT_EXTLINUX_SYMLINK ?= "${UBOOT_EXTLINUX_CONF_NAME}-${MACHINE}-${PR}" + +do_compile () { + if [ "${@bb.utils.filter('DISTRO_FEATURES', 'ld-is-gold', d)}" ]; then + sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' ${S}/config.mk + fi + + unset LDFLAGS + unset CFLAGS + unset CPPFLAGS + + if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ] + then + echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion + echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion + fi + + if [ -n "${UBOOT_CONFIG}" ] + then + unset i j k + for config in ${UBOOT_MACHINE}; do + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do + j=$(expr $j + 1); + if [ $j -eq $i ] + then + oe_runmake -C ${S} O=${B}/${config} ${config} + oe_runmake -C ${S} O=${B}/${config} ${UBOOT_MAKE_TARGET} + for binary in ${UBOOT_BINARIES}; do + k=$(expr $k + 1); + if [ $k -eq $i ]; then + cp ${B}/${config}/${binary} ${B}/${config}/u-boot-${type}.${UBOOT_SUFFIX} + fi + done + unset k + fi + done + unset j + done + unset i + else + oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE} + oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_TARGET} + fi + +} + +do_install () { + if [ -n "${UBOOT_CONFIG}" ] + then + for config in ${UBOOT_MACHINE}; do + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do + j=$(expr $j + 1); + if [ $j -eq $i ] + then + install -d ${D}/boot + install -m 644 ${B}/${config}/u-boot-${type}.${UBOOT_SUFFIX} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY} + fi + done + unset j + done + unset i + else + install -d ${D}/boot + install -m 644 ${B}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE} + ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY} + fi + + if [ -n "${UBOOT_ELF}" ] + then + if [ -n "${UBOOT_CONFIG}" ] + then + for config in ${UBOOT_MACHINE}; do + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do + j=$(expr $j + 1); + if [ $j -eq $i ] + then + install -m 644 ${B}/${config}/${UBOOT_ELF} ${D}/boot/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY} + fi + done + unset j + done + unset i + else + install -m 644 ${B}/${UBOOT_ELF} ${D}/boot/${UBOOT_ELF_IMAGE} + ln -sf ${UBOOT_ELF_IMAGE} ${D}/boot/${UBOOT_ELF_BINARY} + fi + fi + + if [ -e ${WORKDIR}/fw_env.config ] ; then + install -d ${D}${sysconfdir} + install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config + fi + + if [ -n "${SPL_BINARY}" ] + then + if [ -n "${UBOOT_CONFIG}" ] + then + for config in ${UBOOT_MACHINE}; do + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do + j=$(expr $j + 1); + if [ $j -eq $i ] + then + install -m 644 ${B}/${config}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}-${type}-${PV}-${PR} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARYNAME}-${type} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${D}/boot/${SPL_BINARYNAME} + fi + done + unset j + done + unset i + else + install -m 644 ${B}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE} + ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARYNAME} + fi + fi + + if [ -n "${UBOOT_ENV}" ] + then + install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE} + ln -sf ${UBOOT_ENV_IMAGE} ${D}/boot/${UBOOT_ENV_BINARY} + fi + + if [ "${UBOOT_EXTLINUX}" = "1" ] + then + install -Dm 0644 ${UBOOT_EXTLINUX_CONFIG} ${D}/${UBOOT_EXTLINUX_INSTALL_DIR}/${UBOOT_EXTLINUX_CONF_NAME} + fi + +} + +FILES_${PN} = "/boot ${sysconfdir}" + +do_deploy () { + if [ -n "${UBOOT_CONFIG}" ] + then + for config in ${UBOOT_MACHINE}; do + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do + j=$(expr $j + 1); + if [ $j -eq $i ] + then + install -d ${DEPLOYDIR} + install -m 644 ${B}/${config}/u-boot-${type}.${UBOOT_SUFFIX} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} + cd ${DEPLOYDIR} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_SUFFIX} ${UBOOT_BINARY} + fi + done + unset j + done + unset i + else + install -d ${DEPLOYDIR} + install -m 644 ${B}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE} + cd ${DEPLOYDIR} + rm -f ${UBOOT_BINARY} ${UBOOT_SYMLINK} + ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK} + ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY} + fi + + if [ -n "${UBOOT_ELF}" ] + then + if [ -n "${UBOOT_CONFIG}" ] + then + for config in ${UBOOT_MACHINE}; do + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do + j=$(expr $j + 1); + if [ $j -eq $i ] + then + install -m 644 ${B}/${config}/${UBOOT_ELF} ${DEPLOYDIR}/u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}-${type} + ln -sf u-boot-${type}-${PV}-${PR}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK} + fi + done + unset j + done + unset i + else + install -m 644 ${B}/${UBOOT_ELF} ${DEPLOYDIR}/${UBOOT_ELF_IMAGE} + ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_BINARY} + ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK} + fi + fi + + + if [ -n "${SPL_BINARY}" ] + then + if [ -n "${UBOOT_CONFIG}" ] + then + for config in ${UBOOT_MACHINE}; do + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do + j=$(expr $j + 1); + if [ $j -eq $i ] + then + install -m 644 ${B}/${config}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}-${type}-${PV}-${PR} + rm -f ${DEPLOYDIR}/${SPL_BINARYNAME} ${DEPLOYDIR}/${SPL_SYMLINK}-${type} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARYNAME}-${type} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_BINARYNAME} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK}-${type} + ln -sf ${SPL_IMAGE}-${type}-${PV}-${PR} ${DEPLOYDIR}/${SPL_SYMLINK} + fi + done + unset j + done + unset i + else + install -m 644 ${B}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE} + rm -f ${DEPLOYDIR}/${SPL_BINARYNAME} ${DEPLOYDIR}/${SPL_SYMLINK} + ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_BINARYNAME} + ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_SYMLINK} + fi + fi + + + if [ -n "${UBOOT_ENV}" ] + then + install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE} + rm -f ${DEPLOYDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK} + ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_BINARY} + ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK} + fi + + if [ "${UBOOT_EXTLINUX}" = "1" ] + then + install -m 644 ${UBOOT_EXTLINUX_CONFIG} ${DEPLOYDIR}/${UBOOT_EXTLINUX_SYMLINK} + ln -sf ${UBOOT_EXTLINUX_SYMLINK} ${DEPLOYDIR}/${UBOOT_EXTLINUX_CONF_NAME}-${MACHINE} + ln -sf ${UBOOT_EXTLINUX_SYMLINK} ${DEPLOYDIR}/${UBOOT_EXTLINUX_CONF_NAME} + fi +} + +addtask deploy before do_build after do_compile diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/u-boot/u-boot_2018.09.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/u-boot/u-boot_2018.09.bb new file mode 100644 index 00000000..ed416608 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-bsp/u-boot/u-boot_2018.09.bb @@ -0,0 +1,43 @@ +require u-boot-common_${PV}.inc +require u-boot.inc + +DEPENDS += "bc-native dtc-native" + +UBOOT_URL = "git://github.com/renesas-rcar/u-boot.git" +BRANCH = "v2018.09/rcar-3.9.9" + +SRC_URI = "${UBOOT_URL};branch=${BRANCH}" +SRCREV = "6ea9ca82bb31dd1784d23a85dcdbaa0924bbfeee" +PV = "v2018.09+git${SRCPV}" + +UBOOT_SREC_SUFFIX = "srec" +UBOOT_SREC ?= "u-boot-elf.${UBOOT_SREC_SUFFIX}" +UBOOT_SREC_IMAGE ?= "u-boot-elf-${MACHINE}-${PV}-${PR}.${UBOOT_SREC_SUFFIX}" +UBOOT_SREC_SYMLINK ?= "u-boot-elf-${MACHINE}.${UBOOT_SREC_SUFFIX}" + +do_deploy_append() { + if [ -n "${UBOOT_CONFIG}" ] + then + for config in ${UBOOT_MACHINE}; do + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do + j=$(expr $j + 1); + if [ $j -eq $i ] + then + type=${type#*_} + install -m 644 ${B}/${config}/${UBOOT_SREC} ${DEPLOYDIR}/u-boot-elf-${type}-${PV}-${PR}.${UBOOT_SREC_SUFFIX} + cd ${DEPLOYDIR} + ln -sf u-boot-elf-${type}-${PV}-${PR}.${UBOOT_SREC_SUFFIX} u-boot-elf-${type}.${UBOOT_SREC_SUFFIX} + fi + done + unset j + done + unset i + else + install -m 644 ${B}/${UBOOT_SREC} ${DEPLOYDIR}/${UBOOT_SREC_IMAGE} + cd ${DEPLOYDIR} + rm -f ${UBOOT_SREC} ${UBOOT_SREC_SYMLINK} + ln -sf ${UBOOT_SREC_IMAGE} ${UBOOT_SREC_SYMLINK} + ln -sf ${UBOOT_SREC_IMAGE} ${UBOOT_SREC} + fi +} diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-connectivity/iccom-module/iccom-tp-user-module.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-connectivity/iccom-module/iccom-tp-user-module.bb new file mode 100644 index 00000000..ed4401f8 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-connectivity/iccom-module/iccom-tp-user-module.bb @@ -0,0 +1,58 @@ +DESCRIPTION = "Linux ICCOM library test applications for Renesas R-Car Gen3" + +require iccom-user-module.inc +require include/multimedia-control.inc +require include/rcar-gen3-path-common.inc + +DEPENDS = " \ + kernel-module-iccom-mfis \ + iccom-user-module \ + ${@oe.utils.conditional('USE_MULTIMEDIA', '1', 'mmngr-user-module', '', d )} \ +" + +export USE_MMNGR="${USE_MULTIMEDIA}" + +PN = "iccom-tp-user-module" +PR = "r0" + +S = "${WORKDIR}/libiccom" + +do_compile() { + cd ${S}/sample_test + make + + cd ${S}/sample_test_fatal + make + + cd ${S}/sample_sharedmem + make + + cd ${S}/sample_lock + make + + cd ${S}/sample_pvconv + make +} + +do_install() { + # Create destination directory + install -d ${D}${RENESAS_DATADIR}/bin + + # Install test applications + install -m 755 ${S}/sample_test/sample_test ${D}${RENESAS_DATADIR}/bin/ + install -m 755 ${S}/sample_test_fatal/sample_test_fatal ${D}${RENESAS_DATADIR}/bin/ + install -m 755 ${S}/sample_sharedmem/sample_sharedmem ${D}${RENESAS_DATADIR}/bin/ + install -m 755 ${S}/sample_lock/sample_lock ${D}${RENESAS_DATADIR}/bin/ + install -m 755 ${S}/sample_pvconv/sample_pvconv ${D}${RENESAS_DATADIR}/bin/ +} + +FILES_${PN} = " \ + ${RENESAS_DATADIR}/bin/sample_test \ + ${RENESAS_DATADIR}/bin/sample_test_fatal \ + ${RENESAS_DATADIR}/bin/sample_sharedmem \ + ${RENESAS_DATADIR}/bin/sample_lock \ + ${RENESAS_DATADIR}/bin/sample_pvconv \ +" + +# Skip debug split +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-connectivity/iccom-module/iccom-user-module.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-connectivity/iccom-module/iccom-user-module.bb new file mode 100644 index 00000000..d943f0c7 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-connectivity/iccom-module/iccom-user-module.bb @@ -0,0 +1,43 @@ +DESCRIPTION = "Linux ICCOM library for Renesas R-Car Gen3" + +require iccom-user-module.inc +require include/rcar-gen3-path-common.inc + +DEPENDS = " \ + kernel-module-iccom-mfis \ +" + +PN = "iccom-user-module" +PR = "r0" + +# log output level : INFO=0 LOW=1 MED=2 HIGH=3 ERROR=4 FATAL=5 NONE=255 +# (the setting of 4 means that ERROR and FATAL log are output) +export MEG_LEV="4" + +S = "${WORKDIR}/libiccom" +B = "${S}/source" + +includedir = "${RENESAS_DATADIR}/include" + +do_install() { + # Create destination directories + install -d ${D}/${libdir} + install -d ${D}${RENESAS_DATADIR}/include + + # Install library + install -m 755 ${B}/libiccom.so ${D}/${libdir}/ + + # Install shared header file + install -m 644 ${S}/include/iccom_if_app.h ${D}${RENESAS_DATADIR}/include/ +} + +FILES_${PN} = " \ + ${libdir}/libiccom.so \ +" + +FILES_${PN}-dev = " \ + ${RENESAS_DATADIR}/include/iccom_if_app.h \ +" + +# Skip debug split +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-connectivity/iccom-module/iccom-user-module.inc b/bsp/meta-renesas/meta-rcar-gen3/recipes-connectivity/iccom-module/iccom-user-module.inc new file mode 100644 index 00000000..e9945cec --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-connectivity/iccom-module/iccom-user-module.inc @@ -0,0 +1,8 @@ +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING.MIT;md5=442d4e9f738ff4d05ae6215ae20caa6c" + +inherit features_check + +REQUIRED_DISTRO_FEATURES = "iccom" + +SRC_URI = "file://libiccom.tar.bz2" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-core/base-files/base-files/fstab b/bsp/meta-renesas/meta-rcar-gen3/recipes-core/base-files/base-files/fstab new file mode 100644 index 00000000..30898a42 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-core/base-files/base-files/fstab @@ -0,0 +1,11 @@ +# stock fstab - you probably want to override this with a machine specific one + +/dev/root / auto defaults 1 1 +proc /proc proc defaults 0 0 +devpts /dev/pts devpts mode=0620,gid=5 0 0 +tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0 +tmpfs /var/volatile tmpfs uid=65534,gid=65534 0 0 + +# uncomment this if your device has a SD/MMC/Transflash slot +#/dev/mmcblk0p1 /media/card auto defaults,sync,noauto 0 0 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-core/base-files/base-files_%.bbappend b/bsp/meta-renesas/meta-rcar-gen3/recipes-core/base-files/base-files_%.bbappend new file mode 100644 index 00000000..0dca3d62 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-core/base-files/base-files_%.bbappend @@ -0,0 +1,11 @@ +require include/rcar-gen3-path-common.inc + +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}/:" + +SRC_URI_append_rcar-gen3 = " \ + file://fstab \ +" + +do_install_append_rcar-gen3 () { + echo "export LD_LIBRARY_PATH=\"\${LD_LIBRARY_PATH}:${RENESAS_DATADIR}/lib\"" >> ${D}${sysconfdir}/profile +} diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-core/images/core-image-minimal.bbappend b/bsp/meta-renesas/meta-rcar-gen3/recipes-core/images/core-image-minimal.bbappend new file mode 100644 index 00000000..70688000 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-core/images/core-image-minimal.bbappend @@ -0,0 +1 @@ +require ${@"recipes-graphics/images/core-image-renesas-base.inc" if "rcar-gen3" in d.getVar("OVERRIDES") else ""} diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-core/ncurses/ncurses_%.bbappend b/bsp/meta-renesas/meta-rcar-gen3/recipes-core/ncurses/ncurses_%.bbappend new file mode 100644 index 00000000..7efa4695 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-core/ncurses/ncurses_%.bbappend @@ -0,0 +1,2 @@ +# nativesdk don't generally look in base_libdir +base_libdir_class-nativesdk = "${libdir}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend b/bsp/meta-renesas/meta-rcar-gen3/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend new file mode 100644 index 00000000..84eca35f --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-core/packagegroups/nativesdk-packagegroup-sdk-host.bbappend @@ -0,0 +1,6 @@ +# In YP2.1.2, nativesdk-wayland is lacking. +RDEPENDS_${PN}_append = " \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'nativesdk-wayland nativesdk-wayland-dev', '', d)} \ + nativesdk-perl nativesdk-perl-dev \ + nativesdk-perl-modules \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-core/systemd/systemd/add-non-owned-item-for-safe-transitioning.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-core/systemd/systemd/add-non-owned-item-for-safe-transitioning.patch new file mode 100644 index 00000000..631db30e --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-core/systemd/systemd/add-non-owned-item-for-safe-transitioning.patch @@ -0,0 +1,14 @@ +diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c +index b2ac648..553a77a 100644 +--- a/src/basic/fs-util.c ++++ b/src/basic/fs-util.c +@@ -668,6 +668,9 @@ static bool unsafe_transition(const struct stat *a, const struct stat *b) { + if (a->st_uid == 0) /* Transitioning from privileged to unprivileged is always fine */ + return false; + ++ if (b->st_uid == 65534) /* Transitioning to a non-owned is OK too */ ++ return false; ++ + return a->st_uid != b->st_uid; /* Otherwise we need to stay within the same UID */ + } + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-core/systemd/systemd_%.bbappend b/bsp/meta-renesas/meta-rcar-gen3/recipes-core/systemd/systemd_%.bbappend new file mode 100644 index 00000000..b2d76b79 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-core/systemd/systemd_%.bbappend @@ -0,0 +1,3 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +SRC_URI_append_rcar-gen3 = " file://add-non-owned-item-for-safe-transitioning.patch" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/cairo/cairo_%.bbappend b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/cairo/cairo_%.bbappend new file mode 100644 index 00000000..8b3cca45 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/cairo/cairo_%.bbappend @@ -0,0 +1,3 @@ +require include/gles-control.inc + +DEPENDS_append_rcar-gen3 = "${@ ' gles-user-module' if '${USE_GLES_WAYLAND}' == '1' else ''}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/cogl/cogl-1.0_1.%.bbappend b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/cogl/cogl-1.0_1.%.bbappend new file mode 100644 index 00000000..12a5417e --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/cogl/cogl-1.0_1.%.bbappend @@ -0,0 +1,4 @@ +require include/gles-control.inc +DEPENDS_append_rcar-gen3 = " \ + ${@'gles-user-module libgbm' if '${USE_GLES_WAYLAND}' == '1' else ''} \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/gles-module/gles-user-module.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/gles-module/gles-user-module.bb new file mode 100644 index 00000000..084e5cee --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/gles-module/gles-user-module.bb @@ -0,0 +1,136 @@ +require include/gles-control.inc +require include/rcar-gen3-path-common.inc + +DESCRIPTION = "PowerVR GPU user module" +LICENSE = "CLOSED" + +PN = "gles-user-module" +PR = "r0" + +COMPATIBLE_MACHINE = "(r8a7795|r8a7796|r8a77965|r8a77990)" +PACKAGE_ARCH = "${MACHINE_ARCH}" + +S = "${WORKDIR}/rogue" +GLES = "gsx" + +SRC_URI_r8a7795 = "file://r8a77951_linux_gsx_binaries_gles.tar.bz2" +SRC_URI_r8a7796 = "file://r8a77960_linux_gsx_binaries_gles.tar.bz2" +SRC_URI_r8a77965 = "file://r8a77965_linux_gsx_binaries_gles.tar.bz2" +SRC_URI_r8a77990 = "file://r8a77990_linux_gsx_binaries_gles.tar.bz2" + +SRC_URI_append = " \ + file://change-shell.patch \ + file://rc.pvr.service \ +" + +inherit update-rc.d systemd + +INITSCRIPT_NAME = "pvrinit" +INITSCRIPT_PARAMS = "start 7 5 2 . stop 62 0 1 6 ." +SYSTEMD_SERVICE_${PN} = "rc.pvr.service" + +do_populate_lic[noexec] = "1" +do_compile[noexec] = "1" + +do_install() { + # Install configuration files + install -d ${D}${sysconfdir}/init.d + install -m 644 ${S}/etc/powervr.ini ${D}${sysconfdir} + install -m 755 ${S}/etc/init.d/rc.pvr ${D}${sysconfdir}/init.d/pvrinit + install -m 755 ${S}/etc/init.d/rc.pvr ${D}${sysconfdir}/init.d/ + install -d ${D}${sysconfdir}/udev/rules.d + install -m 644 ${S}/etc/udev/rules.d/72-pvr-seat.rules ${D}${sysconfdir}/udev/rules.d/ + + # Install header files + install -d ${D}${includedir}/EGL + install -m 644 ${S}/usr/include/EGL/*.h ${D}${includedir}/EGL/ + install -d ${D}${includedir}/GLES2 + install -m 644 ${S}/usr/include/GLES2/*.h ${D}${includedir}/GLES2/ + install -d ${D}${includedir}/GLES3 + install -m 644 ${S}/usr/include/GLES3/*.h ${D}${includedir}/GLES3/ + install -d ${D}${includedir}/KHR + install -m 644 ${S}/usr/include/KHR/khrplatform.h ${D}${includedir}/KHR/khrplatform.h + + # Install pre-builded binaries + install -d ${D}${libdir} + install -m 755 ${S}/usr/lib/*.so ${D}${libdir}/ + install -d ${D}${RENESAS_DATADIR}/bin + install -m 755 ${S}/usr/local/bin/dlcsrv_REL ${D}${RENESAS_DATADIR}/bin/dlcsrv_REL + install -d ${D}/lib/firmware + install -m 644 ${S}/lib/firmware/* ${D}/lib/firmware/ + + # Install pkgconfig + install -d ${D}${libdir}/pkgconfig + install -m 644 ${S}/usr/lib/pkgconfig/*.pc ${D}${libdir}/pkgconfig/ + + # Create symbolic link + cd ${D}${libdir} + ln -s libEGL.so libEGL.so.1 + ln -s libGLESv2.so libGLESv2.so.2 + + if [ "${USE_GLES_WAYLAND}" = "1" ]; then + # Set the "WindowSystem" parameter for wayland + if [ "${GLES}" = "gsx" ]; then + sed -i -e "s/WindowSystem=libpvrDRM_WSEGL.so/WindowSystem=libpvrWAYLAND_WSEGL.so/g" \ + ${D}${sysconfdir}/powervr.ini + fi + fi + + # Install systemd service + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)} ; then + install -d ${D}${systemd_system_unitdir}/ + install -m 644 ${WORKDIR}/rc.pvr.service ${D}${systemd_system_unitdir}/ + + # Fix weston dependency, needs to be weston@.service + sed -i 's/^RequiredBy=weston.service$/RequiredBy=weston@.service/' \ + ${D}${systemd_system_unitdir}/rc.pvr.service + + install -d ${D}${exec_prefix}/bin + install -m 755 ${S}/etc/init.d/rc.pvr ${D}${exec_prefix}/bin/pvrinit + fi +} + +PACKAGES = "\ + ${PN} \ + ${PN}-dev \ +" + +FILES_${PN} = " \ + ${sysconfdir}/* \ + ${libdir}/* \ + /lib/firmware/rgx.fw* \ + ${RENESAS_DATADIR}/bin/* \ + ${exec_prefix}/bin/* \ +" + +FILES_${PN}-dev = " \ + ${includedir}/* \ + ${libdir}/pkgconfig/* \ +" + +PROVIDES = "virtual/libgles2" +RPROVIDES_${PN} += " \ + ${GLES}-user-module \ + libgles2-mesa \ + libgles2-mesa-dev \ + libgles2 \ + libgles2-dev \ +" + +RDEPENDS_${PN} = " \ + kernel-module-gles \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'libgbm wayland-kms', '', d)} \ +" + +INSANE_SKIP_${PN} = "ldflags build-deps file-rdeps" +INSANE_SKIP_${PN}-dev = "ldflags build-deps file-rdeps" +INSANE_SKIP_${PN} += "arch" +INSANE_SKIP_${PN}-dev += "arch" +INSANE_SKIP_${PN}-dbg = "arch" + +# Skip debug strip of do_populate_sysroot() +INHIBIT_SYSROOT_STRIP = "1" + +# Skip debug split and strip of do_package() +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/gles-module/gles-user-module/change-shell.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/gles-module/gles-user-module/change-shell.patch new file mode 100644 index 00000000..f6025709 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/gles-module/gles-user-module/change-shell.patch @@ -0,0 +1,10 @@ +Index: rogue/etc/init.d/rc.pvr +=================================================================== +--- rogue.orig/etc/init.d/rc.pvr ++++ rogue/etc/init.d/rc.pvr +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + ############################################################################ ### + # File rc.pvr + # Copyright Copyright (C) 2013-2016 Renesas Electronics Corporation diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/gles-module/gles-user-module/rc.pvr.service b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/gles-module/gles-user-module/rc.pvr.service new file mode 100644 index 00000000..da7fc300 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/gles-module/gles-user-module/rc.pvr.service @@ -0,0 +1,13 @@ +[Unit] +Description=PowerVR consumer services +Before=weston.service + +[Service] +ExecStart=/usr/bin/pvrinit start +ExecStop=/usr/bin/pvrinit stop +Type=oneshot +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target +RequiredBy=weston.service diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/images/core-image-renesas-base.inc b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/images/core-image-renesas-base.inc new file mode 100644 index 00000000..b64abad9 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/images/core-image-renesas-base.inc @@ -0,0 +1,68 @@ +require include/iccom-control.inc + +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" + +# Basic packages +IMAGE_INSTALL_append = " \ + bash \ + v4l-utils \ + i2c-tools \ + coreutils \ +" + +# Support secure environment +IMAGE_INSTALL_append = " \ + optee-client \ +" + +# Add overrides for selection 32 bit or 64 bit target +OVERRIDES .= ":${TARGET_SYS}" + +# Qos user packages only supports 64bit. +QOS_USER_PKGS = "" +QOS_USER_PKGS_aarch64-poky-linux = " \ + qosif-user-module \ + qosif-tp-user-module \ +" + +# Installation for QoS packages +IMAGE_INSTALL_append = " \ + kernel-module-qos \ + ${QOS_USER_PKGS} \ +" + +# Renesas Basic packages for 32bit +BASIC_32BIT_PKGS = " \ + lib32-coreutils \ + lib32-libstdc++ \ + lib32-optee-client \ +" + +# Installation for 32bit packages +IMAGE_INSTALL_append = " \ + ${@oe.utils.conditional("USE_32BIT_PKGS", "1", "${BASIC_32BIT_PKGS}", "", d)} \ +" + +# Kernel modules of ICCOM +ICCOM_KERNEL_PKGS = " \ + kernel-module-iccom-mfis \ + kernel-module-iccom-hwspinlock-sample \ +" + +# User modules of ICCOM only supports 64bit +ICCOM_USER_PKGS = "" +ICCOM_USER_PKGS_aarch64-poky-linux = " \ + iccom-user-module \ + iccom-tp-user-module \ +" + +# ICCOM Packages +ICCOM_PKGS = " \ + ${ICCOM_KERNEL_PKGS} \ + ${ICCOM_USER_PKGS} \ +" + +# Installation for ICCOM Packages +IMAGE_INSTALL_append = " \ + ${@oe.utils.conditional("USE_ICCOM", "1", " ${ICCOM_PKGS}", "", d)} \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/images/core-image-renesas-mmp-base.inc b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/images/core-image-renesas-mmp-base.inc new file mode 100644 index 00000000..88062204 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/images/core-image-renesas-mmp-base.inc @@ -0,0 +1,102 @@ +require include/multimedia-control.inc +require include/cms-control.inc +require include/adsp-control.inc +require include/dtv-dvd-control.inc +require include/avb-control.inc +require include/omx-control.inc + +# Common Multi Media Packages (MMP) +MULTIMEDIA_PKGS = " \ + packagegroup-multimedia-kernel-modules \ + packagegroup-multimedia-libs \ +" + +# MMP test Packages +MULTIMEDIA_TP_PKGS = " \ + vspmif-tp-user-module \ +" + +# OMX MMP Packages +OMX_MULTIMEDIA_PKGS = " \ + omx-user-module \ +" + +# CMS MMP Packages +CMS_MULTIMEDIA_PKGS = " \ + cms-user-module \ +" + +# Kernel modules of DTV +DTV_KERNEL_PKGS = " \ + kernel-module-scu-src \ + kernel-module-ssp \ + kernel-module-tddmac \ + kernel-module-tsif \ +" + +# DTV Packages +DTV_PKGS = " \ + ${DTV_KERNEL_PKGS} \ + dtv-user-module \ +" + +# DVD Packages +DVD_PKGS = " \ + dvd-user-module \ +" + +# DVD Encryption Library packages +DVD_ENCRYPTION_PKGS = " \ + dvd-encryption-module \ +" + +# ADSP Packages +ADSP_PKGS = " \ + kernel-module-xtensa-hifi \ + adsp-if-module \ + adsp-fw-module \ +" + +# Kernel modules of AVB +AVB_KERNEL_PKGS = " \ + kernel-module-avb-streaming \ + kernel-module-avb-mch \ + kernel-module-avb-mse \ +" + +# AVB Packages +AVB_PKGS = " \ + ${AVB_KERNEL_PKGS} \ + avbtool \ + linuxptp \ + openavnu-mrpd \ + openavnu-gptp \ + openavnu-maap \ + avb-demoapps-avblauncher \ + avb-demoapps-mrpdummy \ + avb-demoapps-simple \ +" + +# Renesas MMP 32bit packages +MMP_32BIT_PKGS = " \ + ${@oe.utils.conditional("USE_MULTIMEDIA", "1", "lib32-packagegroup-multimedia-libs lib32-omx-user-module", "", d)} \ + ${@oe.utils.conditional("USE_MULTIMEDIA_TP", "1", "lib32-vspmif-tp-user-module", "", d)} \ + ${@oe.utils.conditional("USE_CMS", "1", "lib32-cms-user-module", "", d)} \ + ${@oe.utils.conditional("USE_DTV", "1", "lib32-dtv-user-module", "", d)} \ + ${@oe.utils.conditional("USE_DVD", "1", "lib32-dvd-user-module", "", d)} \ + ${@oe.utils.conditional("USE_ADSP", "1", "lib32-adsp-if-module", "", d)} \ +" + +# Install pkg selection +IMAGE_INSTALL_append = " \ + ${@oe.utils.conditional("USE_MULTIMEDIA", "1", " ${MULTIMEDIA_PKGS}", "", d)} \ + ${@oe.utils.conditional("USE_MULTIMEDIA_TP", "1", " ${MULTIMEDIA_TP_PKGS}", "", d)} \ + ${@oe.utils.conditional("USE_OMX_USER_MODULE", "1", " ${OMX_MULTIMEDIA_PKGS}", "", d)} \ + ${@oe.utils.conditional("USE_CMS", "1", " ${CMS_MULTIMEDIA_PKGS}", "", d)} \ + ${@oe.utils.conditional("USE_DTV", "1", " ${DTV_PKGS}", "", d)} \ + ${@oe.utils.conditional("USE_DVD", "1", " ${DVD_PKGS}", "", d)} \ + ${@oe.utils.conditional("USE_DVD_ENCRYPTION_LIB", "1", " ${DVD_ENCRYPTION_PKGS}", "", d)} \ + ${@oe.utils.conditional("USE_ADSP", "1", " ${ADSP_PKGS}", "", d)} \ + ${@oe.utils.conditional("USE_AVB", "1", " ${AVB_PKGS}", "", d)} \ + ${@oe.utils.conditional("USE_32BIT_MMP", "1", " ${MMP_32BIT_PKGS}", "", d)} \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/images/core-image-weston-sdk.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/images/core-image-weston-sdk.bb new file mode 100644 index 00000000..fd4e6a09 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/images/core-image-weston-sdk.bb @@ -0,0 +1,15 @@ +require recipes-graphics/images/core-image-weston.bb +require core-image-renesas-base.inc +require core-image-weston.inc + +DESCRIPTION = "Image with weston support that includes everything within \ +core-image-weston plus meta-toolchain, development headers and libraries to \ +form a standalone SDK." + +IMAGE_FEATURES += " \ + dev-pkgs tools-sdk \ + tools-debug debug-tweaks \ + ssh-server-openssh \ +" + +IMAGE_INSTALL_append = " kernel-devsrc ltp" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/images/core-image-weston.bbappend b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/images/core-image-weston.bbappend new file mode 100644 index 00000000..41f1cb04 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/images/core-image-weston.bbappend @@ -0,0 +1,2 @@ +require ${@"core-image-renesas-base.inc" if "rcar-gen3" in d.getVar("OVERRIDES") else ""} +require ${@"core-image-weston.inc" if "rcar-gen3" in d.getVar("OVERRIDES") else ""} diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/images/core-image-weston.inc b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/images/core-image-weston.inc new file mode 100644 index 00000000..4ae567a1 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/images/core-image-weston.inc @@ -0,0 +1,16 @@ +require include/gles-control.inc +require core-image-renesas-mmp-base.inc + +# Gstreamer Packages +GSTREAMER_PKGS = "packagegroup-gstreamer1.0-plugins" + +# Install packages for Wayland Env +# default: Basic packages, Gstreamer packages +# optional: GFX packages +IMAGE_INSTALL_append = " \ + ${GSTREAMER_PKGS} \ + packagegroup-wayland-community \ + packagegroup-graphics-renesas-proprietary \ + packagegroup-graphics-renesas-wayland \ + libx11-locale \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/mesa/mesa-dummy.inc b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/mesa/mesa-dummy.inc new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/mesa/mesa-dummy.inc diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/mesa/mesa-wayland.inc b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/mesa/mesa-wayland.inc new file mode 100644 index 00000000..eee68630 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/mesa/mesa-wayland.inc @@ -0,0 +1,24 @@ +# FIXME: can not override PACKAGECONFIG. +PACKAGECONFIG[gles] = "-Dgles1=true -Dgles2=false" +PACKAGECONFIG[egl] = "-Degl=true" + +# Disable the gbm modules of mesa +PACKAGECONFIG_remove = "gbm" + +# Remove the gbm and egl packages. These are provided in other recipes. +PACKAGES_remove = " \ + libgbm-dev libgbm \ + libegl-mesa-dev libegl-mesa \ + libegl-dev libegl \ + libgles2-mesa libgles2-mesa-dev \ + libwayland-egl libwayland-egl-dev \ +" + +do_install_append() { + # Remove libegl-mesa modules and headers + rm -f ${D}/${libdir}/libEGL.la + rm -f ${D}/${libdir}/libEGL.so* + rm -f ${D}/${libdir}/pkgconfig/egl.pc + rm -rf ${D}/${includedir}/EGL + rm -rf ${D}/${includedir}/KHR +} diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/mesa/mesa_%.bbappend b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/mesa/mesa_%.bbappend new file mode 100644 index 00000000..022144ef --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/mesa/mesa_%.bbappend @@ -0,0 +1,10 @@ +require include/gles-control.inc + +def map_libs(d): + if oe.utils.conditional('USE_GLES_WAYLAND', "1", "1", "0", d) == "1": + return "wayland" + + return "dummy" + +MESATARGET := "${@map_libs(d)}" +include mesa-${MESATARGET}.inc diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/packagegroups/packagegroup-graphic-renesas.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/packagegroups/packagegroup-graphic-renesas.bb new file mode 100644 index 00000000..b5cff820 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/packagegroups/packagegroup-graphic-renesas.bb @@ -0,0 +1,39 @@ +SUMMARY = "Renesas package group for Weston" +LICENSE = "CLOSED & MIT" + +inherit packagegroup +require include/gles-control.inc + +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" + +PACKAGES = " \ + packagegroup-wayland-community \ + packagegroup-graphics-renesas-proprietary \ + packagegroup-graphics-renesas-wayland \ +" + +PR = "r0" + +RDEPENDS_packagegroup-wayland-community = " \ + wayland \ + weston \ + weston-examples \ + alsa-utils \ + alsa-tools \ + libdrm-tests \ + libdrm-kms \ +" + +RDEPENDS_packagegroup-graphics-renesas-proprietary = " \ + ${@bb.utils.contains('USE_GLES', '1', \ + 'kernel-module-gles gles-user-module' , \ + '', d)} \ +" + +DEPENDS_packagegroup-graphics-renesas-wayland = "libegl" + +RDEPENDS_packagegroup-graphics-renesas-wayland = " \ + ${@bb.utils.contains('USE_GLES_WAYLAND', '1', \ + 'libgbm libgbm-dev wayland-kms', \ + '', d)} \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/libegl.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/libegl.bb new file mode 100644 index 00000000..06c56f73 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/libegl.bb @@ -0,0 +1,21 @@ +SUMMARY = "Recipe for libegl" +LICENSE = "CLOSED" + +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" + +DEPENDS = "gles-user-module \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'libgbm wayland-kms', '', d)} \ +" + +PR = "r0" + +RDEPENDS_${PN} = " \ + gles-user-module \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'libgbm wayland-kms', '', d)} \ +" + +PROVIDES = "virtual/egl" +RPROVIDES_${PN} += " \ + libegl \ + libegl1 \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/libgbm.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/libgbm.bb new file mode 100644 index 00000000..87d52f0e --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/libgbm.bb @@ -0,0 +1,36 @@ +SUMMARY = "gbm library" +LICENSE = "MIT" +SECTION = "libs" + +LIC_FILES_CHKSUM = " \ + file://gbm.c;beginline=4;endline=22;md5=5cdaac262c876e98e47771f11c7036b5" + +SRCREV = "953f6515dc07c717360c499273dccc227857e6ed" +SRC_URI = "git://github.com/renesas-rcar/libgbm;branch=match-mesa-19.0.1" + +S = "${WORKDIR}/git" + +COMPATIBLE_MACHINE = "(r8a7795|r8a7796|r8a77965|r8a77990)" +DEPENDS = "wayland-kms udev" + +inherit autotools pkgconfig + +PACKAGES = " \ + ${PN} \ + ${PN}-dev \ + ${PN}-dbg \ + ${PN}-staticdev \ +" + +FILES_${PN} = " \ + ${libdir}/libgbm.so.* \ + ${libdir}/gbm/libgbm_kms.so.* \ + ${libdir}/gbm/*.so \ + ${libdir}/*.so \ +" +FILES_${PN}-dev += "${libdir}/gbm/*.la" +FILES_${PN}-dbg += "${libdir}/gbm/.debug/*" +FILES_${PN}-staticdev += "${libdir}/gbm/*.a" + +INSANE_SKIP_${PN} += "dev-so" +PROVIDES += "virtual/libgbm" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/wayland-kms_1.6.0.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/wayland-kms_1.6.0.bb new file mode 100644 index 00000000..134e8d2e --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/wayland-kms_1.6.0.bb @@ -0,0 +1,25 @@ +SUMMARY = "KMS library for Wayland" +LICENSE = "MIT" + +LIC_FILES_CHKSUM = " \ + file://wayland-kms.c;beginline=6;endline=24;md5=5cdaac262c876e98e47771f11c7036b5" + +PV_append = "+git${SRCREV}" + +SRCREV = "15184e5bd3701938a6b30b8f03b471477fc742e8" +SRC_URI = "git://github.com/renesas-rcar/wayland-kms.git;branch=rcar-gen3" + +COMPATIBLE_MACHINE = "(r8a7795|r8a7796|r8a77965|r8a77990)" +S = "${WORKDIR}/git" +DEPENDS = "libdrm wayland gles-user-module wayland-native" + +inherit autotools pkgconfig + +FILES_${PN} = "${libdir}/libwayland-kms.so.*" +FILES_${PN}-dev = " \ + ${libdir}/libwayland-kms.la \ + ${libdir}/libwayland-kms.so \ + ${libdir}/pkgconfig/* \ + ${includedir}/* \ +" +FILES_${PN}-staticdev += "${libdir}/libwayland-kms.a" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/weston-init.bbappend b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/weston-init.bbappend new file mode 100644 index 00000000..17225873 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/weston-init.bbappend @@ -0,0 +1,48 @@ +require include/gles-control.inc + +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +SRC_URI_append_rcar-gen3 = " \ + file://weston.ini \ + file://weston.sh \ +" + +do_install_append_rcar-gen3() { + if [ "X${USE_GLES}" = "X1" ]; then + sed -e "/^After=/s/$/ dbus.service multi-user.target/" \ + -e "s/\$OPTARGS/--idle-time=0 \$OPTARGS/" \ + -i ${D}/${systemd_system_unitdir}/weston@.service + fi + + install -d ${D}/${sysconfdir}/xdg/weston + # install weston.ini as sample settings of gl-renderer + install -m 644 ${WORKDIR}/weston.ini ${D}/${sysconfdir}/xdg/weston/ + + # Checking for ivi-shell configuration + # If ivi-shell is enable, we will add its configs to weston.ini + if [ "X${USE_WAYLAND_IVI_SHELL}" = "X1" ]; then + sed -i '/repaint-window=34/c\repaint-window=34\nshell=ivi-shell.so' \ + ${D}/${sysconfdir}/xdg/weston/weston.ini + sed -e '$a\\' \ + -e '$a\[ivi-shell]' \ + -e '$a\ivi-module=ivi-controller.so' \ + -e '$a\ivi-input-module=ivi-input-controller.so' \ + -e '$a\transition-duration=300' \ + -e '$a\cursor-theme=default' \ + -i ${D}/${sysconfdir}/xdg/weston/weston.ini + fi + + # Set XDG_RUNTIME_DIR to /run/user/$UID (e.g. run/user/0) + install -d ${D}/${sysconfdir}/profile.d + install -m 0755 ${WORKDIR}/weston.sh ${D}/${sysconfdir}/profile.d/weston.sh + + # Fix weston.service and weston@.service run simultaneously. + mv ${D}/${sysconfdir}/init.d/weston ${D}/${sysconfdir}/init.d/weston@ +} + +FILES_${PN}_append_rcar-gen3 = " \ + ${sysconfdir}/profile.d/weston.sh \ +" + +INITSCRIPT_NAME = "weston@" + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/weston-init/weston.ini b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/weston-init/weston.ini new file mode 100644 index 00000000..f31c2906 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/weston-init/weston.ini @@ -0,0 +1,2 @@ +[core] +repaint-window=34 diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/weston-init/weston.sh b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/weston-init/weston.sh new file mode 100755 index 00000000..33ed8a4a --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/weston-init/weston.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if test -z "$XDG_RUNTIME_DIR"; then + export XDG_RUNTIME_DIR=/run/user/$UID +fi diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/weston/0001-drm-change-timing-to-set-color-format-for-primary-pl.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/weston/0001-drm-change-timing-to-set-color-format-for-primary-pl.patch new file mode 100644 index 00000000..2c797df8 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/weston/0001-drm-change-timing-to-set-color-format-for-primary-pl.patch @@ -0,0 +1,49 @@ +From 51048463dae4ace13776bb77675316007083a6ee Mon Sep 17 00:00:00 2001 +From: Tomohito Esaki <etom@igel.co.jp> +Date: Mon, 30 Mar 2020 17:10:54 +0900 +Subject: [PATCH] drm: change timing to set color format for primary plane + without universal plane + +Without universal plane, the weston crashes with null pointer access in +set_gbm_format function because that function called before output +enable function. By changing timing to set color format for primary +plane in this case, this issue fixes. + +Signed-off-by: Tomohito Esaki <etom@igel.co.jp> +--- + libweston/backend-drm/drm.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c +index 3c5ca65..2aea82f 100644 +--- a/libweston/backend-drm/drm.c ++++ b/libweston/backend-drm/drm.c +@@ -1389,12 +1389,6 @@ drm_output_set_gbm_format(struct weston_output *base, + + if (parse_gbm_format(gbm_format, b->gbm_format, &output->gbm_format) == -1) + output->gbm_format = b->gbm_format; +- +- /* Without universal planes, we can't discover which formats are +- * supported by the primary plane; we just hope that the GBM format +- * works. */ +- if (!b->universal_planes) +- output->scanout_plane->formats[0].format = output->gbm_format; + } + + static void +@@ -1626,6 +1620,12 @@ drm_output_init_crtc(struct drm_output *output, drmModeRes *resources) + goto err_crtc; + } + ++ /* Without universal planes, we can't discover which formats are ++ * supported by the primary plane; we just hope that the GBM format ++ * works. */ ++ if (!b->universal_planes) ++ output->scanout_plane->formats[0].format = output->gbm_format; ++ + /* Failing to find a cursor plane is not fatal, as we'll fall back + * to software cursor. */ + output->cursor_plane = +-- +2.7.4 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/weston_%.bbappend b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/weston_%.bbappend new file mode 100644 index 00000000..c2f75afc --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/wayland/weston_%.bbappend @@ -0,0 +1,23 @@ +require include/gles-control.inc +require include/multimedia-control.inc + +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +SRC_URI_append_rcar-gen3 = " \ + file://0001-drm-change-timing-to-set-color-format-for-primary-pl.patch \ +" + +PACKAGECONFIG_remove_virtclass-multilib-lib32 = "launch" + +DEPENDS_append_rcar-gen3 = " \ + ${@oe.utils.conditional('USE_GLES', '1', ' libgbm', '', d)}" + +RDEPENDS_${PN}_append_rcar-gen3 = " \ + ${@oe.utils.conditional('USE_GLES', '1', ' libgbm', '', d)} \ +" +RDEPENDS_${PN}-examples_append_rcar-gen3 = " \ + ${@oe.utils.conditional('USE_GLES', '1', ' libgbm', '', d)}" + +EXTRA_OECONF_append_rcar-gen3 = " \ + ${@oe.utils.conditional('USE_GLES', '1', '', \ + ' WESTON_NATIVE_BACKEND="fbdev-backend.so"', d)}" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg.inc b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg.inc new file mode 100644 index 00000000..3a6d2aef --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg.inc @@ -0,0 +1,180 @@ +SUMMARY = "The X.Org X server" +HOMEPAGE = "http://www.x.org" +SECTION = "x11/base" +LICENSE = "MIT-X" +LIC_FILES_CHKSUM = "file://COPYING;md5=5df87950af51ac2c5822094553ea1880" + +# xf86-*-* packages depend on an X server built with the xfree86 DDX +# so we have a virtual to represent that: +# deprecated, we should use virtual/xserver instead +PROVIDES = "virtual/xserver-xf86" + +# Other packages tend to just care that there is *an* X server: +PROVIDES += "virtual/xserver" + +PE = "2" +INC_PR = "r8" + +XORG_PN = "xorg-server" +SRC_URI = "${XORG_MIRROR}/individual/xserver/${XORG_PN}-${PV}.tar.bz2" +SRC_URI += "file://macro_tweak.patch" + +S = "${WORKDIR}/${XORG_PN}-${PV}" + +inherit autotools pkgconfig + +inherit features_check +REQUIRED_DISTRO_FEATURES = "x11" + +PROTO_DEPS = "xorgproto" +LIB_DEPS = "pixman libxfont2 xtrans libxau libxext libxdmcp libdrm libxkbfile libpciaccess" +DEPENDS = "${PROTO_DEPS} ${LIB_DEPS} font-util" + +# Split out some modules and extensions from the main package +# These aren't needed for basic operations and only take up space: +# 32.0k libdri.so +# 91.0k libexa.so +# 336.0k libglx.so +# 1360k libint10.so +# 180.0k libwfb.so +# 320.0k libxaa.so +# 124.0k libxf1bpp.so +# 84.0k libxf4bpp.so +# librecord.so +# libextmod.so +# libdbe.so + +PACKAGES =+ "${PN}-sdl \ + ${PN}-fbdev \ + ${PN}-xvfb \ + ${PN}-utils \ + ${PN}-xephyr \ + ${PN}-xwayland \ + ${PN}-multimedia-modules \ + ${PN}-extension-dri \ + ${PN}-extension-dri2 \ + ${PN}-extension-glx \ + ${PN}-extension-record \ + ${PN}-extension-extmod \ + ${PN}-extension-dbe \ + ${PN}-module-libint10 \ + ${PN}-module-libafb \ + ${PN}-module-libwfb \ + ${PN}-module-libmfb \ + ${PN}-module-libcfb \ + ${PN}-module-exa \ + ${PN}-module-xaa \ + ${PN}-module-libxf1bpp \ + ${PN}-module-libxf4bpp \ + xf86-video-modesetting" + +SUMMARY_xf86-video-modesetting = "X.Org X server -- modesetting display driver" +INSANE_SKIP_${MLPREFIX}xf86-video-modesetting = "xorg-driver-abi" + +XSERVER_RRECOMMENDS = "xkeyboard-config rgb xserver-xf86-config xkbcomp xf86-input-libinput" +RRECOMMENDS_${PN} += "${XSERVER_RRECOMMENDS}" +RRECOMMENDS_${PN}-xwayland += "${XSERVER_RRECOMMENDS}" +RDEPENDS_${PN}-xvfb += "xkeyboard-config" +RDEPENDS_${PN}-module-exa = "${PN} (= ${EXTENDPKGV})" + +FILES_${PN} = "${bindir} ${libdir}/X11/Options ${libdir}/X11/Cards ${libdir}/X11/getconfig ${libdir}/X11/etc ${libdir}/modules/*.so ${libdir}/xorg/modules/*.so /etc/X11 ${libdir}/xorg/protocol.txt ${datadir}/X11/xorg.conf.d" +FILES_${PN}-dev += "${libdir}/xorg/modules/*.la ${libdir}/xorg/modules/*/*.la" +FILES_${PN}-doc += "${libdir}/X11/doc ${datadir}/X11/xkb/compiled/README.compiled ${localstatedir}/lib/xkb/README.compiled" +FILES_${PN}-sdl = "${bindir}/Xsdl" +FILES_${PN}-fbdev = "${bindir}/Xfbdev" +FILES_${PN}-xvfb = "${bindir}/Xvfb" +FILES_${PN}-utils = "${bindir}/scanpci ${bindir}/pcitweak ${bindir}/ioport ${bindir}/in[bwl] ${bindir}/out[bwl] ${bindir}/mmap[rw] ${bindir}/gtf ${bindir}/getconfig ${bindir}/getconfig.pl" +FILES_${PN}-xephyr = "${bindir}/Xephyr" +FILES_${PN}-xwayland = "${bindir}/Xwayland" +FILES_${PN}-multimedia-modules = "${libdir}/xorg/modules/multimedia/*drv*" +FILES_${PN}-extension-dri = "${libdir}/xorg/modules/extensions/libdri.so" +FILES_${PN}-extension-dri2 = "${libdir}/xorg/modules/extensions/libdri2.so" +FILES_${PN}-extension-glx = "${libdir}/xorg/modules/extensions/libglx.so" +FILES_${PN}-extension-record = "${libdir}/xorg/modules/extensions/librecord.so" +FILES_${PN}-extension-extmod = "${libdir}/xorg/modules/extensions/libextmod.so" +FILES_${PN}-extension-dbe = "${libdir}/xorg/modules/extensions/libdbe.so" +FILES_${PN}-module-libint10 = "${libdir}/xorg/modules/libint10.so" +FILES_${PN}-module-libafb = "${libdir}/xorg/modules/libafb.so" +FILES_${PN}-module-libwfb = "${libdir}/xorg/modules/libwfb.so" +FILES_${PN}-module-libmfb = "${libdir}/xorg/modules/libmfb.so" +FILES_${PN}-module-libcfb = "${libdir}/xorg/modules/libcfb.so" +FILES_${PN}-module-exa = "${libdir}/xorg/modules/libexa.so" +FILES_${PN}-module-xaa = "${libdir}/xorg/modules/libxaa.so" +FILES_${PN}-module-libxf1bpp = "${libdir}/xorg/modules/libxf1bpp.so" +FILES_${PN}-module-libxf4bpp = "${libdir}/xorg/modules/libxf4bpp.so" +FILES_xf86-video-modesetting = "${libdir}/xorg/modules/drivers/modesetting_drv.so" + +EXTRA_OECONF += "--with-fop=no \ + --with-pic \ + --disable-static \ + --disable-record \ + --disable-dmx \ + --disable-xnest \ + --enable-xvfb \ + --enable-composite \ + --without-dtrace \ + --with-int10=x86emu \ + --sysconfdir=/etc/X11 \ + --localstatedir=/var \ + --with-xkb-output=/var/lib/xkb \ +" + +OPENGL_PKGCONFIGS = "dri glx glamor dri3 xshmfence" +PACKAGECONFIG ??= "dri2 udev ${XORG_CRYPTO} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', '${OPENGL_PKGCONFIGS}', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'opengl wayland', 'xwayland', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd systemd-logind', '', d)} \ +" + +PACKAGECONFIG[udev] = "--enable-config-udev,--disable-config-udev,udev" +PACKAGECONFIG[dri] = "--enable-dri,--disable-dri,xorgproto virtual/mesa" +PACKAGECONFIG[dri2] = "--enable-dri2,--disable-dri2,xorgproto" +# DRI3 requires xshmfence to also be enabled +PACKAGECONFIG[dri3] = "--enable-dri3,--disable-dri3,xorgproto" +PACKAGECONFIG[glx] = "--enable-glx,--disable-glx,xorgproto virtual/libgl virtual/libx11" +PACKAGECONFIG[glamor] = "--enable-glamor,--disable-glamor,libepoxy virtual/libgbm,libegl" +PACKAGECONFIG[unwind] = "--enable-libunwind,--disable-libunwind,libunwind" +PACKAGECONFIG[xshmfence] = "--enable-xshmfence,--disable-xshmfence,libxshmfence" +PACKAGECONFIG[xmlto] = "--with-xmlto, --without-xmlto, xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native" +PACKAGECONFIG[systemd-logind] = "--enable-systemd-logind=yes,--enable-systemd-logind=no,dbus," +PACKAGECONFIG[systemd] = "--with-systemd-daemon,--without-systemd-daemon,systemd" +PACKAGECONFIG[xinerama] = "--enable-xinerama,--disable-xinerama,xorgproto" +PACKAGECONFIG[xwayland] = "--enable-xwayland,--disable-xwayland,wayland wayland-native wayland-protocols libepoxy" + +# Xorg requires a SHA1 implementation, pick one +XORG_CRYPTO ??= "openssl" +PACKAGECONFIG[openssl] = "--with-sha1=libcrypto,,openssl" +PACKAGECONFIG[nettle] = "--with-sha1=libnettle,,nettle" +PACKAGECONFIG[gcrypt] = "--with-sha1=libgcrypt,,libgcrypt" + +do_install_append () { + # Its assumed base-files creates this for us + rmdir ${D}${localstatedir}/log/ +} + +# Add runtime provides for the ABI versions of the video and input subsystems, +# so that drivers can depend on the relevant version. +python populate_packages_prepend() { + import subprocess + + # Set PKG_CONFIG_PATH so pkg-config looks at the .pc files that are going + # into the new package, not the staged ones. + newenv = dict(os.environ) + newenv["PKG_CONFIG_PATH"] = d.expand("${PKGD}${libdir}/pkgconfig/") + + def get_abi(name): + abis = { + "video": "abi_videodrv", + "input": "abi_xinput" + } + p = subprocess.Popen(args="pkg-config --variable=%s xorg-server" % abis[name], + shell=True, env=newenv, stdout=subprocess.PIPE) + stdout, stderr = p.communicate() + output = stdout.decode("utf-8").split(".")[0] + mlprefix = d.getVar('MLPREFIX') or '' + return "%sxorg-abi-%s-%s" % (mlprefix, name, output) + + pn = d.getVar("PN") + d.appendVar("RPROVIDES_" + pn, " " + get_abi("input")) + d.appendVar("RPROVIDES_" + pn, " " + get_abi("video")) +} diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/0001-config-fix-NULL-value-detection-for-ID_INPUT-being-u.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/0001-config-fix-NULL-value-detection-for-ID_INPUT-being-u.patch new file mode 100644 index 00000000..964d5dd4 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/0001-config-fix-NULL-value-detection-for-ID_INPUT-being-u.patch @@ -0,0 +1,40 @@ +From a309323328d9d6e0bf5d9ea1d75920e53b9beef3 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer <peter.hutterer@who-t.net> +Date: Fri, 5 Jan 2018 11:58:42 +1000 +Subject: [PATCH] config: fix NULL value detection for ID_INPUT being unset + +Erroneous condition caused us to keep going with all devices that didn't have +ID_INPUT set. + +Fixes: 5aad81445c8c3d6 +Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104382 +Reviewed-by: Adam Jackson <ajax@redhat.com> +Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> + +Upstream-status: Backport +https://patchwork.freedesktop.org/patch/196090/ +Affects: < 1.20.0 +[Yocto # 12899] + +Signed-off-by: Armin Kuster <akuser808@gmail.com> + +--- + config/udev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/config/udev.c b/config/udev.c +index e198e8609..3a73189e2 100644 +--- a/config/udev.c ++++ b/config/udev.c +@@ -135,7 +135,7 @@ device_added(struct udev_device *udev_device) + #endif + + value = udev_device_get_property_value(udev_device, "ID_INPUT"); +- if (value && !strcmp(value, "0")) { ++ if (!value || !strcmp(value, "0")) { + LogMessageVerb(X_INFO, 10, + "config/udev: ignoring device %s without " + "property ID_INPUT set\n", path); +-- +2.17.1 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/0001-configure.ac-Fix-check-for-CLOCK_MONOTONIC.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/0001-configure.ac-Fix-check-for-CLOCK_MONOTONIC.patch new file mode 100644 index 00000000..16ec3edb --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/0001-configure.ac-Fix-check-for-CLOCK_MONOTONIC.patch @@ -0,0 +1,61 @@ +Discover monotonic clock using compile-time check + +monotonic clock check does not work when cross-compiling. + +Upstream-Status: Denied [Does not work on OpenBSD] +Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> + + + +Original patch follows: + +When xorg-xserver is being cross-compiled, there is currently no way +for us to detect whether the monotonic clock is available on the +target system, because we aren't able to run a test program on the host +system. Currently, in this situation, we default to not use the +monotonic clock. One problem with this situation is that the user will +be treated as idle when the date is updated. + +To fix this situation, we now use a compile-time check to detect whether the +monotonic clock is available. This check can run just fine when we are +cross-compiling. + +Signed-off-by: David James <davidjames at google.com> +--- + configure.ac | 17 +++++++---------- + 1 file changed, 7 insertions(+), 10 deletions(-) + +diff --git a/configure.ac b/configure.ac +index f7ab48c..26e85cd 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1048,19 +1048,16 @@ if ! test "x$have_clock_gettime" = xno; then + CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE=200112L" + fi + +- AC_RUN_IFELSE([AC_LANG_SOURCE([ ++ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ + #include <time.h> +- +-int main(int argc, char *argv[[]]) { +- struct timespec tp; +- +- if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0) ++#include <unistd.h> ++int main() { ++#if !(defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0 && defined(CLOCK_MONOTONIC)) ++ #error No monotonic clock ++#endif + return 0; +- else +- return 1; + } +- ])], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no], +- [MONOTONIC_CLOCK="cross compiling"]) ++]])],[MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no]) + + LIBS="$LIBS_SAVE" + CPPFLAGS="$CPPFLAGS_SAVE" +-- +2.1.4 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/0001-xf86pciBus.c-use-Intel-ddx-only-for-pre-gen4-hardwar.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/0001-xf86pciBus.c-use-Intel-ddx-only-for-pre-gen4-hardwar.patch new file mode 100644 index 00000000..d05eec5b --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/0001-xf86pciBus.c-use-Intel-ddx-only-for-pre-gen4-hardwar.patch @@ -0,0 +1,53 @@ +From d77cdc5e1eee26821ab98c947abea53fb7b18fe5 Mon Sep 17 00:00:00 2001 +From: California Sullivan <california.l.sullivan@intel.com> +Date: Fri, 16 Mar 2018 17:23:11 -0700 +Subject: [PATCH] xf86pciBus.c: use Intel ddx only for pre-gen4 hardware + +Use intel ddx only on pre-gen4 hw, newer ones will fall back to modesetting +Author: Timo Aaltonen <tjaalton@debian.org> + +Instead of defaulting to the Intel driver for all Intel hardware, only +default it for older hardware for which it has shown to be better for. + +Others fall through to the -modesetting default. + +Upstream-Status: Pending [Debian/Fedora patch +https://src.fedoraproject.org/rpms/xorg-x11-server/c/ee515e44b07e37689abf48cf2fffb41578f3bc1d] + +Signed-off-by: California Sullivan <california.l.sullivan@intel.com> +--- + hw/xfree86/common/xf86pciBus.c | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c +index e61ae0cd4..d70c99197 100644 +--- a/hw/xfree86/common/xf86pciBus.c ++++ b/hw/xfree86/common/xf86pciBus.c +@@ -1173,7 +1173,23 @@ xf86VideoPtrToDriverList(struct pci_device *dev, + case 0x0bef: + /* Use fbdev/vesa driver on Oaktrail, Medfield, CDV */ + break; +- default: ++ /* Default to intel only on pre-gen4 chips */ ++ case 0x3577: ++ case 0x2562: ++ case 0x3582: ++ case 0x358e: ++ case 0x2572: ++ case 0x2582: ++ case 0x258a: ++ case 0x2592: ++ case 0x2772: ++ case 0x27a2: ++ case 0x27ae: ++ case 0x29b2: ++ case 0x29c2: ++ case 0x29d2: ++ case 0xa001: ++ case 0xa011: + driverList[0] = "intel"; + break; + } +-- +2.14.3 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/0003-Remove-check-for-useSIGIO-option.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/0003-Remove-check-for-useSIGIO-option.patch new file mode 100644 index 00000000..beed6cb4 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/0003-Remove-check-for-useSIGIO-option.patch @@ -0,0 +1,47 @@ +From cf407b16cd65ad6e26a9c8e5984e163409a5c0f7 Mon Sep 17 00:00:00 2001 +From: Prabhu Sundararaj <prabhu.sundararaj@nxp.com> +Date: Mon, 30 Jan 2017 16:32:06 -0600 +Subject: [PATCH] Remove check for useSIGIO option + +Commit 6a5a4e60373c1386b311b2a8bb666c32d68a9d99 removes the configure of useSIGIO +option. + +As the xfree86 SIGIO support is reworked to use internal versions of OsBlockSIGIO +and OsReleaseSIGIO. + +No longer the check for useSIGIO is needed + +Upstream-Status: Pending + +Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@nxp.com> +--- + hw/xfree86/os-support/shared/sigio.c | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/hw/xfree86/os-support/shared/sigio.c b/hw/xfree86/os-support/shared/sigio.c +index 884a71c..be76498 100644 +--- a/hw/xfree86/os-support/shared/sigio.c ++++ b/hw/xfree86/os-support/shared/sigio.c +@@ -185,9 +185,6 @@ xf86InstallSIGIOHandler(int fd, void (*f) (int, void *), void *closure) + int i; + int installed = FALSE; + +- if (!xf86Info.useSIGIO) +- return 0; +- + for (i = 0; i < MAX_FUNCS; i++) { + if (!xf86SigIOFuncs[i].f) { + if (xf86IsPipe(fd)) +@@ -256,9 +253,6 @@ xf86RemoveSIGIOHandler(int fd) + int max; + int ret; + +- if (!xf86Info.useSIGIO) +- return 0; +- + max = 0; + ret = 0; + for (i = 0; i < MAX_FUNCS; i++) { +-- +2.7.4 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/0003-modesetting-Fix-16-bit-depth-bpp-mode.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/0003-modesetting-Fix-16-bit-depth-bpp-mode.patch new file mode 100644 index 00000000..5243761f --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/0003-modesetting-Fix-16-bit-depth-bpp-mode.patch @@ -0,0 +1,46 @@ +From 5028ef46ff4ab0930224b71024a7349b05610d42 Mon Sep 17 00:00:00 2001 +From: Stefan Agner <stefan@agner.ch> +Date: Thu, 22 Dec 2016 15:41:06 +0100 +Subject: [PATCH] modesetting: Fix 16 bit depth/bpp mode + +When setting DefaultDepth to 16 in the Screen section, the current +code requests a 32 bpp framebuffer, however the X-Server seems to +assumes 16 bpp. + +Fixes commit 21217d02168d ("modesetting: Implement 32->24 bpp +conversion in shadow update") + +Signed-off-by: Stefan Agner <stefan@agner.ch> + +Upstream-Status: Submitted [1] + +[1] https://lists.x.org/archives/xorg-devel/2016-December/052113.html +--- + hw/xfree86/drivers/modesetting/driver.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c +index d7030e5..647ad83 100644 +--- a/hw/xfree86/drivers/modesetting/driver.c ++++ b/hw/xfree86/drivers/modesetting/driver.c +@@ -930,7 +930,7 @@ PreInit(ScrnInfoPtr pScrn, int flags) + "Using 24bpp hw front buffer with 32bpp shadow\n"); + defaultbpp = 32; + } else { +- ms->drmmode.kbpp = defaultbpp; ++ ms->drmmode.kbpp = 0; + } + bppflags = PreferConvert24to32 | SupportConvert24to32 | Support32bppFb; + +@@ -950,6 +950,8 @@ PreInit(ScrnInfoPtr pScrn, int flags) + return FALSE; + } + xf86PrintDepthBpp(pScrn); ++ if (!ms->drmmode.kbpp) ++ ms->drmmode.kbpp = pScrn->bitsPerPixel; + + /* Process the options */ + xf86CollectOptions(pScrn, NULL); +-- +2.7.4 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/macro_tweak.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/macro_tweak.patch new file mode 100644 index 00000000..c36e4e73 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/macro_tweak.patch @@ -0,0 +1,25 @@ +This is the revised version of files/macro_tweak.patch for +xorg-server 1.8.99.904 and newer. + +Upstream-Status: Pending + +Signed-off-by: Yu Ke <ke.yu@intel.com> + +Index: xorg-server-1.19.6/xorg-server.m4 +=================================================================== +--- xorg-server-1.19.6.orig/xorg-server.m4 ++++ xorg-server-1.19.6/xorg-server.m4 +@@ -28,10 +28,12 @@ dnl + # Checks for the MACRO define in xorg-server.h (from the sdk). If it + # is defined, then add the given PROTO to $REQUIRED_MODULES. + ++m4_pattern_allow(PKG_CONFIG_SYSROOT_DIR) ++ + AC_DEFUN([XORG_DRIVER_CHECK_EXT],[ + AC_REQUIRE([PKG_PROG_PKG_CONFIG]) + SAVE_CFLAGS="$CFLAGS" +- CFLAGS="$CFLAGS -I`$PKG_CONFIG --variable=sdkdir xorg-server`" ++ CFLAGS="$CFLAGS -I$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=sdkdir xorg-server`" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #include "xorg-server.h" + #if !defined $1 diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/musl-arm-inb-outb.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/musl-arm-inb-outb.patch new file mode 100644 index 00000000..4be441fb --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg/musl-arm-inb-outb.patch @@ -0,0 +1,18 @@ +inb/outb family for arm is only implemented on glibc +so assumption across linux is wrong + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Upstream-Status: Pending +Index: xorg-server-1.18.0/hw/xfree86/common/compiler.h +=================================================================== +--- xorg-server-1.18.0.orig/hw/xfree86/common/compiler.h ++++ xorg-server-1.18.0/hw/xfree86/common/compiler.h +@@ -758,7 +758,7 @@ inl(unsigned short port) + return xf86ReadMmio32Le((void *) ioBase, port); + } + +-#elif defined(__arm__) && defined(__linux__) ++#elif defined(__arm__) && defined(__GLIBC__) + + /* for Linux on ARM, we use the LIBC inx/outx routines */ + /* note that the appropriate setup via "ioperm" needs to be done */ diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend new file mode 100644 index 00000000..c51bcd54 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg_%.bbappend @@ -0,0 +1,3 @@ +# Glamor for Xorg requires gbm >= 10.2.0. +# Glamor is not necessary with current env, so disable it. +PACKAGECONFIG_remove_rcar-gen3 = "glamor" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg_1.19.6.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg_1.19.6.bb new file mode 100644 index 00000000..bec021d6 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-graphics/xorg-xserver/xserver-xorg_1.19.6.bb @@ -0,0 +1,35 @@ +require xserver-xorg.inc + +COMPATIBLE_MACHINE = "(salvator-x|ebisu|ulcb)" + +SRC_URI += "file://musl-arm-inb-outb.patch \ + file://0001-configure.ac-Fix-check-for-CLOCK_MONOTONIC.patch \ + file://0003-modesetting-Fix-16-bit-depth-bpp-mode.patch \ + file://0003-Remove-check-for-useSIGIO-option.patch \ + file://0001-xf86pciBus.c-use-Intel-ddx-only-for-pre-gen4-hardwar.patch \ + file://0001-config-fix-NULL-value-detection-for-ID_INPUT-being-u.patch \ + " +SRC_URI[md5sum] = "3e47777ff034a331aed2322b078694a8" +SRC_URI[sha256sum] = "a732502f1db000cf36a376cd0c010ffdbf32ecdd7f1fa08ba7f5bdf9601cc197" + +# These extensions are now integrated into the server, so declare the migration +# path for in-place upgrades. + +RREPLACES_${PN} = "${PN}-extension-dri \ + ${PN}-extension-dri2 \ + ${PN}-extension-record \ + ${PN}-extension-extmod \ + ${PN}-extension-dbe \ + " +RPROVIDES_${PN} = "${PN}-extension-dri \ + ${PN}-extension-dri2 \ + ${PN}-extension-record \ + ${PN}-extension-extmod \ + ${PN}-extension-dbe \ + " +RCONFLICTS_${PN} = "${PN}-extension-dri \ + ${PN}-extension-dri2 \ + ${PN}-extension-record \ + ${PN}-extension-extmod \ + ${PN}-extension-dbe \ + " diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-adsp/kernel-module-xtensa-hifi.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-adsp/kernel-module-xtensa-hifi.bb new file mode 100644 index 00000000..5b7ec898 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-adsp/kernel-module-xtensa-hifi.bb @@ -0,0 +1,41 @@ +DESCRIPTION = "ADSP Driver for Linux" +LICENSE = "GPLv2 & MIT" + +LIC_FILES_CHKSUM = " \ + file://COPYING;md5=55979d94ccbb973fdea772250e0c54d6 \ + file://MIT-COPYING;md5=f932f6ad0feea4f97b6e8316e172070e \ +" + +inherit module features_check + +REQUIRED_DISTRO_FEATURES = "adsp" + +FILESEXTRAPATHS_prepend := "${THISDIR}/xtensa-hifi:" + +SRC_URI = "file://RCG3AHPDL4101ZDO.tar.gz" + +S = "${WORKDIR}/RCG3AHPDL4101ZDO" + +# Define the extra config for using module.bbclass to build ADSP driver +EXTRA_OEMAKE_append = " KDIR=${STAGING_KERNEL_DIR}" + +# Build ADSP kernel module without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +# Enable build target for E3 board +do_configure_prepend_r8a77990(){ + sed -i 's|-DTARGET_BOARD_E3=0|-DTARGET_BOARD_E3=1|g' ${S}/Kbuild +} + +do_install_append(){ + # Create install directories + install -d ${D}/${includedir} + install -d ${D}/${includedir}/sys/xt-shmem + + # Install shared header files + install -m 644 ${S}/include/*.h ${D}/${includedir}/ + install -m 644 ${S}/include/sys/xt-shmem/*.h ${D}/${includedir}/sys/xt-shmem/ +} + +# The ADSP driver need adsp firmware for running +RDEPENDS_${PN}_append = " adsp-fw-module" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-avb/kernel-module-avb-mch.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-avb/kernel-module-avb-mch.bb new file mode 100644 index 00000000..8423642c --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-avb/kernel-module-avb-mch.bb @@ -0,0 +1,39 @@ +DESCRIPTION = "AVB MCH Driver for Linux for the R-Car Gen3" + +require include/avb-control.inc +require include/rcar-gen3-modules-common.inc + +LICENSE = "GPLv2 & MIT" +LIC_FILES_CHKSUM = " \ + file://GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://MIT-COPYING;md5=96e553279b3fff0d6168dafe0b596197 \ +" + +inherit module features_check + +DEPENDS = "linux-renesas" + +REQUIRED_DISTRO_FEATURES = "avb" + +SRC_URI = "git://github.com/renesas-rcar/avb-mch.git;branch=rcar-gen3" +SRCREV = "5c02335afa0c6c692798dc07e65c9eb21943fb2f" + +S = "${WORKDIR}/git" + +includedir = "${RENESAS_DATADIR}/include" + +# Build AVB MCH kernel module without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +do_install_append() { + # Create destination directories + install -d ${KERNELSRC}/include + install -d ${D}/${includedir} + + # Install shared header files to KERNELSRC(STAGING_KERNEL_DIR). + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/ravb_mch.h ${KERNELSRC}/include + + # Install shared header files to ${includedir} + install -m 644 ${S}/ravb_mch.h ${D}/${includedir} +} diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-avb/kernel-module-avb-mse.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-avb/kernel-module-avb-mse.bb new file mode 100644 index 00000000..4dd910ae --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-avb/kernel-module-avb-mse.bb @@ -0,0 +1,41 @@ +DESCRIPTION = "AVB MSE Driver for Linux for the R-Car Gen3" + +require include/avb-control.inc +require include/rcar-gen3-modules-common.inc + +LICENSE = "GPLv2 & MIT" +LIC_FILES_CHKSUM = " \ + file://GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://MIT-COPYING;md5=98449101c5d5452a9429b88d6ead1ba4 \ +" + +inherit module features_check + +DEPENDS = "linux-renesas kernel-module-avb-streaming kernel-module-avb-mch" + +REQUIRED_DISTRO_FEATURES = "avb" + +SRC_URI = "git://github.com/renesas-rcar/avb-mse.git;branch=rcar-gen3" +SRCREV = "d290b4a5d7afab654a8b3a356934be2c1406c378" + +S = "${WORKDIR}/git" + +includedir = "${RENESAS_DATADIR}/include" + +# Build AVB MSE kernel module without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +do_install_append() { + # Create destination directories + install -d ${KERNELSRC}/include + install -d ${D}/${includedir} + + # Install shared header files to KERNELSRC(STAGING_KERNEL_DIR). + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/ravb_mse.h ${KERNELSRC}/include + install -m 644 ${S}/ravb_mse_kernel.h ${KERNELSRC}/include + + # Install shared header files to ${includedir} + install -m 644 ${S}/ravb_mse.h ${D}/${includedir} + install -m 644 ${S}/ravb_mse_kernel.h ${D}/${includedir} +} diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-avb/kernel-module-avb-streaming.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-avb/kernel-module-avb-streaming.bb new file mode 100644 index 00000000..fc3ddf48 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-avb/kernel-module-avb-streaming.bb @@ -0,0 +1,39 @@ +DESCRIPTION = "AVB Streaming Driver for Linux for the R-Car Gen3" + +require include/rcar-gen3-modules-common.inc +require include/avb-control.inc + +LICENSE = "GPLv2 & MIT" +LIC_FILES_CHKSUM = " \ + file://GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://MIT-COPYING;md5=704e38c3a28fde2e7fa153d3e0e787a4 \ +" + +inherit module features_check + +DEPENDS = "linux-renesas" + +REQUIRED_DISTRO_FEATURES = "avb" + +SRC_URI = "git://github.com/renesas-rcar/avb-streaming.git;branch=rcar-gen3" +SRCREV = "526c794e5667d4b260934ef1e3934a094f01f404" + +S = "${WORKDIR}/git" + +includedir = "${RENESAS_DATADIR}/include" + +# Build AVB Streaming kernel module without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +do_install_append () { + # Create destination directories + install -d ${KERNELSRC}/include + install -d ${D}/${includedir} + + # Install shared header files to KERNELSRC(STAGING_KERNEL_DIR). + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/ravb_eavb.h ${KERNELSRC}/include + + # Install shared header files to ${includedir} + install -m 644 ${S}/ravb_eavb.h ${D}/${includedir} +} diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-dtv/kernel-module-scu-src.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-dtv/kernel-module-scu-src.bb new file mode 100644 index 00000000..64da9c4a --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-dtv/kernel-module-scu-src.bb @@ -0,0 +1,59 @@ +DESCRIPTION = "DTV Driver part of scu_src for Linux for the R-Car Gen3" + +require include/rcar-gen3-modules-common.inc +require include/dtv-dvd-control.inc + +LICENSE = "GPLv2 & MIT" +LIC_FILES_CHKSUM = " \ + file://scu_src_drv/include/GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://scu_src_drv/include/MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 \ +" + +inherit module features_check + +DEPENDS = "linux-renesas" +PN = "kernel-module-scu-src" +PR = "r0" + +REQUIRED_DISTRO_FEATURES = "dtv" + +SRC_URI = "file://scu_src_drv.tar.gz" + +S = "${WORKDIR}" + +EXTRA_OEMAKE_r8a7795 += "DTV_MAKE_HW_SWITCH=HW_SUPPORT_H3" +EXTRA_OEMAKE_r8a7796 += "DTV_MAKE_HW_SWITCH=HW_SUPPORT_M3" +EXTRA_OEMAKE_r8a77965 += "DTV_MAKE_HW_SWITCH=HW_SUPPORT_M3N" + +# Build DTV kernel modules without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +do_compile() { + cd ${S}/scu_src_drv/drv + oe_runmake +} + +do_install () { + # Create destination directories + install -d ${D}/lib/modules/${KERNEL_VERSION}/extra/ + install -d ${KERNELSRC}/include + + # Install kernel module + install -m 644 ${S}/scu_src_drv/drv/scu_src_drv.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/ + + # Install shared header files to KERNELSRC(STAGING_KERNEL_DIR). + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/scu_src_drv/include/*.h ${KERNELSRC}/include + install -m 644 ${S}/scu_src_drv/drv/Module.symvers ${KERNELSRC}/include/scu-drv.symvers +} + +PACKAGES = "\ + ${PN} \ +" + +FILES_${PN} = " \ + /lib/modules/${KERNEL_VERSION}/extra/scu_src_drv.ko \ +" + +RPROVIDES_${PN} += "kernel-module-scu-src kernel-module-scu-src-drv" +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-dtv/kernel-module-ssp.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-dtv/kernel-module-ssp.bb new file mode 100644 index 00000000..b741a88f --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-dtv/kernel-module-ssp.bb @@ -0,0 +1,59 @@ +DESCRIPTION = "DTV Driver part of ssp for Linux for the R-Car Gen3" + +require include/rcar-gen3-modules-common.inc +require include/dtv-dvd-control.inc + +LICENSE = "GPLv2 & MIT" +LIC_FILES_CHKSUM = " \ + file://ssp_drv/include/GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://ssp_drv/include/MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 \ +" + +inherit module features_check + +DEPENDS = "linux-renesas" +PN = "kernel-module-ssp" +PR = "r0" + +REQUIRED_DISTRO_FEATURES = "dtv" + +SRC_URI = "file://ssp_drv.tar.gz" + +S = "${WORKDIR}" + +EXTRA_OEMAKE_r8a7795 += "DTV_MAKE_HW_SWITCH=HW_SUPPORT_H3" +EXTRA_OEMAKE_r8a7796 += "DTV_MAKE_HW_SWITCH=HW_SUPPORT_M3" +EXTRA_OEMAKE_r8a77965 += "DTV_MAKE_HW_SWITCH=HW_SUPPORT_M3N" + +# Build DTV SSP kernel module without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +do_compile() { + cd ${S}/ssp_drv/drv + oe_runmake +} + +do_install () { + # Create destination directories + install -d ${D}/lib/modules/${KERNEL_VERSION}/extra/ + install -d ${KERNELSRC}/include + + # Install kernel module + install -m 644 ${S}/ssp_drv/drv/ssp_dev.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/ + + # Install shared header files to KERNELSRC(STAGING_KERNEL_DIR). + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/ssp_drv/include/*.h ${KERNELSRC}/include + install -m 644 ${S}/ssp_drv/drv/Module.symvers ${KERNELSRC}/include/ssp_drv.symvers +} + +PACKAGES = "\ + ${PN} \ +" + +FILES_${PN} = " \ + /lib/modules/${KERNEL_VERSION}/extra/ssp_dev.ko \ +" + +RPROVIDES_${PN} += "kernel-module-ssp" +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-dtv/kernel-module-tddmac.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-dtv/kernel-module-tddmac.bb new file mode 100644 index 00000000..42e0d019 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-dtv/kernel-module-tddmac.bb @@ -0,0 +1,59 @@ +DESCRIPTION = "DTV Driver part of tddmac for Linux for the R-Car Gen3" + +require include/rcar-gen3-modules-common.inc +require include/dtv-dvd-control.inc + +LICENSE = "GPLv2 & MIT" +LIC_FILES_CHKSUM = " \ + file://tddmac_drv/include/GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://tddmac_drv/include/MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 \ +" + +inherit module features_check + +DEPENDS = "linux-renesas" +PN = "kernel-module-tddmac" +PR = "r0" + +REQUIRED_DISTRO_FEATURES = "dtv" + +SRC_URI = "file://tddmac_drv.tar.gz" + +S = "${WORKDIR}" + +EXTRA_OEMAKE_r8a7795 += "DTV_MAKE_HW_SWITCH=HW_SUPPORT_H3" +EXTRA_OEMAKE_r8a7796 += "DTV_MAKE_HW_SWITCH=HW_SUPPORT_M3" +EXTRA_OEMAKE_r8a77965 += "DTV_MAKE_HW_SWITCH=HW_SUPPORT_M3N" + +# Build DTV tddmac kernel module without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +do_compile() { + cd ${S}/tddmac_drv/drv + oe_runmake +} + +do_install () { + # Create destination directories + install -d ${D}/lib/modules/${KERNEL_VERSION}/extra/ + install -d ${KERNELSRC}/include + + # Install kernel module + install -m 644 ${S}/tddmac_drv/drv/tddmac.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/ + + # Install shared header files to KERNELSRC(STAGING_KERNEL_DIR). + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/tddmac_drv/include/*.h ${KERNELSRC}/include + install -m 644 ${S}/tddmac_drv/drv/Module.symvers ${KERNELSRC}/include/tddmac_drv.symvers +} + +PACKAGES = "\ + ${PN} \ +" + +FILES_${PN} = " \ + /lib/modules/${KERNEL_VERSION}/extra/tddmac.ko \ +" + +RPROVIDES_${PN} += "kernel-module-tddmac" +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-dtv/kernel-module-tsif.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-dtv/kernel-module-tsif.bb new file mode 100644 index 00000000..001f9b72 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-dtv/kernel-module-tsif.bb @@ -0,0 +1,58 @@ +DESCRIPTION = "DTV Driver part of tsif for Linux for the R-Car Gen3" + +require include/rcar-gen3-modules-common.inc +require include/dtv-dvd-control.inc + +LICENSE = "GPLv2 & MIT" +LIC_FILES_CHKSUM = " \ + file://tsif_drv/include/GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://tsif_drv/include/MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 \ +" + +inherit module features_check + +PN = "kernel-module-tsif" +PR = "r0" + +REQUIRED_DISTRO_FEATURES = "dtv" + +SRC_URI = "file://tsif_drv.tar.gz" + +S = "${WORKDIR}" + +EXTRA_OEMAKE_r8a7795 += "DTV_MAKE_HW_SWITCH=HW_SUPPORT_H3" +EXTRA_OEMAKE_r8a7796 += "DTV_MAKE_HW_SWITCH=HW_SUPPORT_M3" +EXTRA_OEMAKE_r8a77965 += "DTV_MAKE_HW_SWITCH=HW_SUPPORT_M3N" + +# Build DTV tsif kernel module without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +do_compile() { + cd ${S}/tsif_drv/drv + oe_runmake +} + +do_install () { + # Create destination directories + install -d ${D}/lib/modules/${KERNEL_VERSION}/extra/ + install -d ${KERNELSRC}/include + + # Install kernel module + install -m 644 ${S}/tsif_drv/drv/tsif_drv.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/ + + # Install shared header files to KERNELSRC(STAGING_KERNEL_DIR). + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/tsif_drv/include/*.h ${KERNELSRC}/include + install -m 644 ${S}/tsif_drv/drv/Module.symvers ${KERNELSRC}/include/tsif_drv.symvers +} + +PACKAGES = "\ + ${PN} \ +" + +FILES_${PN} = " \ + /lib/modules/${KERNEL_VERSION}/extra/tsif_drv.ko \ +" + +RPROVIDES_${PN} += "kernel-module-tsif kernel-module-tsif-drv" +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-gles/kernel-module-gles.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-gles/kernel-module-gles.bb new file mode 100644 index 00000000..50a6765c --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-gles/kernel-module-gles.bb @@ -0,0 +1,76 @@ +DESCRIPTION = "Kernel module of PowerVR GPU" +LICENSE = "GPLv2 & MIT" +LIC_FILES_CHKSUM = " \ + file://GPL-COPYING;md5=60422928ba677faaa13d6ab5f5baaa1e \ + file://MIT-COPYING;md5=8c2810fa6bfdc5ae5c15a0c1ade34054 \ +" +inherit module +PN = "kernel-module-gles" +PR = "r0" + +COMPATIBLE_MACHINE = "(r8a7795|r8a7796|r8a77965|r8a77990)" +PACKAGE_ARCH = "${MACHINE_ARCH}" + +SRC_URI_r8a7795 = 'file://GSX_KM_H3.tar.bz2' +SRC_URI_r8a7796 = 'file://GSX_KM_M3.tar.bz2' +SRC_URI_r8a77965 = 'file://GSX_KM_M3N.tar.bz2' +SRC_URI_r8a77990 = 'file://GSX_KM_E3.tar.bz2' + +S = "${WORKDIR}/rogue_km" + +# W/A fix build errors with GCC 8.1 +SRC_URI_append = " file://0001-Silence-warnings-being-treated-as-errors.patch" + +KBUILD_DIR_r8a7795 = "${S}/build/linux/r8a7795_linux" +KBUILD_DIR_r8a7796 = "${S}/build/linux/r8a7796_linux" +KBUILD_DIR_r8a77965 = "${S}/build/linux/r8a77965_linux" +KBUILD_DIR_r8a77990 = "${S}/build/linux/r8a7799_linux" +KBUILD_OUTDIR_r8a7795 = "binary_r8a7795_linux_release/target_aarch64/kbuild/" +KBUILD_OUTDIR_r8a7796 = "binary_r8a7796_linux_release/target_aarch64/kbuild/" +KBUILD_OUTDIR_r8a77965 = "binary_r8a77965_linux_release/target_aarch64/kbuild/" +KBUILD_OUTDIR_r8a77990 = "binary_r8a7799_linux_release/target_aarch64/kbuild/" + +B = "${KBUILD_DIR}" + +EXTRA_OEMAKE = "KERNELDIR=${STAGING_KERNEL_BUILDDIR}" +EXTRA_OEMAKE += "CROSS_COMPILE=${CROSS_COMPILE}" + +# Build GFX kernel module without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +module_do_compile() { + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS + cd ${KBUILD_DIR} + oe_runmake +} + +module_do_install() { + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS + install -d ${D}/lib/modules/${KERNEL_VERSION} + cd ${KBUILD_DIR} + oe_runmake DISCIMAGE="${D}" install +} + +# Ship the module symbol file to kernel build dir +SYSROOT_PREPROCESS_FUNCS = "module_sysroot_symbol" + +module_sysroot_symbol() { + install -m 644 ${S}/${KBUILD_OUTDIR}/Module.symvers ${STAGING_KERNEL_BUILDDIR}/GLES.symvers +} + +# Clean up the module symbol file +CLEANFUNCS = "module_clean_symbol" + +module_clean_symbol() { + rm -f ${STAGING_KERNEL_BUILDDIR}/GLES.symvers +} + +FILES_${PN} = " \ + /lib/modules/${KERNEL_VERSION}/extra/pvrsrvkm.ko \ + ${sysconfdir}/modules-load.d \ +" + +RPROVIDES_${PN} += "kernel-module-pvrsrvkm kernel-module-dc-linuxfb" + +# Auto load pvrsrvkm +KERNEL_MODULE_AUTOLOAD_append = " pvrsrvkm" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-gles/kernel-module-gles/0001-Silence-warnings-being-treated-as-errors.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-gles/kernel-module-gles/0001-Silence-warnings-being-treated-as-errors.patch new file mode 100644 index 00000000..a9ddfa51 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-gles/kernel-module-gles/0001-Silence-warnings-being-treated-as-errors.patch @@ -0,0 +1,25 @@ +Current GFX source code will get compilation error with GCC 9.x, +because it is defined in makefile to use -Wall to enable all Warnings +check. +-Wcast-function-type, -Wsizeof-pointer-div and -Wstringop-truncation +-Wmissing-attributes -Waddress-of-packed-member +are new Warnings from GCC 9. + +Signed-off-by: Khang Nguyen <khang.nguyen.xw@renesas.com> +--- + build/linux/buildvars.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: rogue_km/build/linux/buildvars.mk +=================================================================== +--- rogue_km.orig/build/linux/buildvars.mk ++++ rogue_km/build/linux/buildvars.mk +@@ -51,7 +51,7 @@ + + # These flags are used for kernel, User C and User C++ + # +-COMMON_FLAGS := -W -Wall ++COMMON_FLAGS := -W -Wall -Wno-cast-function-type -Wno-sizeof-pointer-div -Wno-stringop-truncation -Wno-missing-attributes -Wno-address-of-packed-member + + # Enable 64-bit file & memory handling on 32-bit systems. + # diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-iccom/kernel-module-iccom-hwspinlock-sample.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-iccom/kernel-module-iccom-hwspinlock-sample.bb new file mode 100644 index 00000000..b63f393b --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-iccom/kernel-module-iccom-hwspinlock-sample.bb @@ -0,0 +1,34 @@ +DESCRIPTION = "Linux ICCOM hwspinlock Sample Driver for Renesas R-Car Gen3" + +require include/rcar-gen3-modules-common.inc + +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +inherit module features_check + +DEPENDS = "linux-renesas" +PN = "kernel-module-iccom-hwspinlock-sample" +PR = "r0" + +REQUIRED_DISTRO_FEATURES = "iccom" + +SRC_URI = "file://iccom-hwspinlock-sample.tar.bz2" + +S = "${WORKDIR}/iccom-hwspinlock-sample" +B = "${S}/iccom-hwspinlock-sample" + +# Build ICCOM kernel module without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +do_install () { + # Create destination directory + install -d ${D}/lib/modules/${KERNEL_VERSION}/extra/ + + # Install kernel module + install -m 644 ${B}/iccom_hwspinlock_sample.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/ +} + +FILES_${PN} = " \ + /lib/modules/${KERNEL_VERSION}/extra/iccom_hwspinlock_sample.ko \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-iccom/kernel-module-iccom-mfis.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-iccom/kernel-module-iccom-mfis.bb new file mode 100644 index 00000000..24a2048f --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-iccom/kernel-module-iccom-mfis.bb @@ -0,0 +1,37 @@ +DESCRIPTION = "Linux ICCOM MFIS Driver for Renesas R-Car Gen3" + +require include/rcar-gen3-modules-common.inc + +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +inherit module features_check + +DEPENDS = "linux-renesas" +PN = "kernel-module-iccom-mfis" +PR = "r0" + +REQUIRED_DISTRO_FEATURES = "iccom" + +SRC_URI = "file://iccom-mfis.tar.bz2" + +S = "${WORKDIR}/iccom-mfis" +B = "${S}/iccom-mfis/drv" + +# Build ICCOM MFIS kernel module without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +do_install () { + # Create destination directory + install -d ${D}/lib/modules/${KERNEL_VERSION}/extra/ + + # Install kernel module + install -m 644 ${B}/iccom_mfis.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/ +} + +FILES_${PN} = " \ + /lib/modules/${KERNEL_VERSION}/extra/iccom_mfis.ko \ +" + +# Autoload ICCOM MFIS Driver +KERNEL_MODULE_AUTOLOAD_append = " iccom_mfis" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-mmngr/kernel-module-mmngr.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-mmngr/kernel-module-mmngr.bb new file mode 100644 index 00000000..694163ef --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-mmngr/kernel-module-mmngr.bb @@ -0,0 +1,75 @@ +DESCRIPTION = "Memory Manager Kernel module for Renesas R-Car Gen3" + +require mmngr_drv.inc +require include/dtv-dvd-control.inc + +DEPENDS = "linux-renesas" +PN = "kernel-module-mmngr" +PR = "r0" + +S = "${WORKDIR}/git" +MMNGR_DRV_DIR = "mmngr_drv/mmngr/mmngr-module/files/mmngr" + +MMNGR_CFG_salvator-x = "MMNGR_SALVATORX" +MMNGR_CFG_h3ulcb = "MMNGR_SALVATORX" +MMNGR_CFG_m3ulcb = "MMNGR_SALVATORX" +MMNGR_CFG_m3nulcb = "MMNGR_SALVATORX" +MMNGR_CFG_ebisu = "MMNGR_EBISU" + +includedir = "${RENESAS_DATADIR}/include" +SSTATE_DUPWHITELIST += "${STAGING_INCDIR}" + +# Build Memory Manager kernel module without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +do_compile() { + export MMNGR_CONFIG=${MMNGR_CFG} + + if [ "X${USE_DTV}" = "X1" ]; then + export MMNGR_SSP_CONFIG="MMNGR_SSP_ENABLE" + else + export MMNGR_SSP_CONFIG="MMNGR_SSP_DISABLE" + fi + + export MMNGR_IPMMU_MMU_CONFIG="IPMMU_MMU_DISABLE" + + cd ${S}/${MMNGR_DRV_DIR}/drv + install -d ${INCSHARED} + make all +} + +do_install () { + # Create destination directories + install -d ${D}/lib/modules/${KERNEL_VERSION}/extra/ + install -d ${KERNELSRC}/include + install -d ${D}/${includedir} + + # Install shared library to KERNELSRC(STAGING_KERNEL_DIR) for reference from other modules + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/${MMNGR_DRV_DIR}/drv/Module.symvers ${KERNELSRC}/include/mmngr.symvers + + # Install kernel module + install -m 644 ${S}/${MMNGR_DRV_DIR}/drv/mmngr.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/ + + # Install shared header files to KERNELSRC(STAGING_KERNEL_DIR) + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/${MMNGR_DRV_DIR}/include/mmngr_public.h ${KERNELSRC}/include/ + install -m 644 ${S}/${MMNGR_DRV_DIR}/include/mmngr_private.h ${KERNELSRC}/include/ + install -m 644 ${S}/${MMNGR_DRV_DIR}/include/mmngr_public_cmn.h ${KERNELSRC}/include/ + install -m 644 ${S}/${MMNGR_DRV_DIR}/include/mmngr_private_cmn.h ${KERNELSRC}/include/ + + # Install shared header file to ${includedir} + install -m 644 ${S}/${MMNGR_DRV_DIR}/include/mmngr_public_cmn.h ${D}/${includedir}/ + install -m 644 ${S}/${MMNGR_DRV_DIR}/include/mmngr_private_cmn.h ${D}/${includedir}/ +} + +PACKAGES = "\ + ${PN} \ + ${PN}-dev \ +" + +FILES_${PN} = " \ + /lib/modules/${KERNEL_VERSION}/extra/mmngr.ko \ +" + +RPROVIDES_${PN} += "kernel-module-mmngr" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-mmngr/kernel-module-mmngrbuf.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-mmngr/kernel-module-mmngrbuf.bb new file mode 100644 index 00000000..3ae960b5 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-mmngr/kernel-module-mmngrbuf.bb @@ -0,0 +1,60 @@ +DESCRIPTION = "Memory Manager Buffer Kernel module for Renesas R-Car Gen3" + +require mmngr_drv.inc + +DEPENDS = "linux-renesas" +PN = "kernel-module-mmngrbuf" +PR = "r0" + +S = "${WORKDIR}/git" +MMNGRBUF_DRV_DIR = "mmngr_drv/mmngrbuf/mmngrbuf-module/files/mmngrbuf" + +# Support HW overlay mode +SRC_URI_append = "\ + file://0001-mmngr_drv-mmngrbuf-Take-care-of-any-migration-of-sca.patch \ +" + +includedir = "${RENESAS_DATADIR}/include" +SSTATE_DUPWHITELIST += "${STAGING_INCDIR}" + +# Build Memory Manager Buffer kernel module without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +do_compile() { + cd ${S}/${MMNGRBUF_DRV_DIR}/drv + install -d ${INCSHARED} + make all +} + +do_install () { + # Create destination directories + install -d ${D}/lib/modules/${KERNEL_VERSION}/extra/ + install -d ${KERNELSRC}/include + install -d ${D}/${includedir} + + # Install shared library to KERNELSRC(STAGING_KERNEL_DIR) for reference from other modules + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/${MMNGRBUF_DRV_DIR}/drv/Module.symvers ${KERNELSRC}/include/mmngrbuf.symvers + + # Install kernel module + install -m 644 ${S}/${MMNGRBUF_DRV_DIR}/drv/mmngrbuf.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/ + + # Install shared header files to KERNELSRC(STAGING_KERNEL_DIR) + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/${MMNGRBUF_DRV_DIR}/include/mmngr_buf_private.h ${KERNELSRC}/include/ + install -m 644 ${S}/${MMNGRBUF_DRV_DIR}/include/mmngr_buf_private_cmn.h ${KERNELSRC}/include/ + + # Install shared header files to ${includedir} + install -m 644 ${S}/${MMNGRBUF_DRV_DIR}/include/mmngr_buf_private_cmn.h ${D}/${includedir}/ +} + +PACKAGES = "\ + ${PN} \ + ${PN}-dev \ +" + +FILES_${PN} = " \ + /lib/modules/${KERNEL_VERSION}/extra/mmngrbuf.ko \ +" + +RPROVIDES_${PN} += "kernel-module-mmngrbuf" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-mmngr/kernel-module-mmngrbuf/0001-mmngr_drv-mmngrbuf-Take-care-of-any-migration-of-sca.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-mmngr/kernel-module-mmngrbuf/0001-mmngr_drv-mmngrbuf-Take-care-of-any-migration-of-sca.patch new file mode 100644 index 00000000..7e5ca0aa --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-mmngr/kernel-module-mmngrbuf/0001-mmngr_drv-mmngrbuf-Take-care-of-any-migration-of-sca.patch @@ -0,0 +1,35 @@ +From 43d2cc7496340eea3f96cb3c3cf66139e0878f3c Mon Sep 17 00:00:00 2001 +From: Hai Nguyen Pham <hai.pham.ud@renesas.com> +Date: Tue, 26 Mar 2019 15:56:30 +0700 +Subject: [PATCH] mmngr_drv: mmngrbuf: Take care of any migration of + scatterlist + +MMNGRBUF should take care of any migration of scatterlist for +all (shared) users of the DMA buffer. Although we only care about +DMA addresses at the moment, this will benefit the DRM system that +uses the buffer allocated by MMNGR directly. + +Initialize the scatterlist entry so that it can be happily traversed. + +Signed-off-by: Hai Nguyen Pham <hai.pham.ud@renesas.com> +--- + mmngr_drv/mmngrbuf/mmngrbuf-module/files/mmngrbuf/drv/mmngr_buf_drv.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/mmngr_drv/mmngrbuf/mmngrbuf-module/files/mmngrbuf/drv/mmngr_buf_drv.c b/mmngr_drv/mmngrbuf/mmngrbuf-module/files/mmngrbuf/drv/mmngr_buf_drv.c +index fe3db08..d9189e9 100644 +--- a/mmngr_drv/mmngrbuf/mmngrbuf-module/files/mmngrbuf/drv/mmngr_buf_drv.c ++++ b/mmngr_drv/mmngrbuf/mmngrbuf-module/files/mmngrbuf/drv/mmngr_buf_drv.c +@@ -256,6 +256,9 @@ static struct sg_table *dmabuf_map_dma_buf(struct dma_buf_attachment *attach, + return NULL; + } + ++ sg_set_page(sgt->sgl, pfn_to_page(PFN_DOWN(priv->hard_addr)), ++ priv->size, offset_in_page(priv->hard_addr)); ++ + sg_dma_address(sgt->sgl) = priv->hard_addr; + sg_dma_len(sgt->sgl) = priv->size; + +-- +2.7.4 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-mmngr/mmngr_drv.inc b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-mmngr/mmngr_drv.inc new file mode 100644 index 00000000..77a0bced --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-mmngr/mmngr_drv.inc @@ -0,0 +1,13 @@ +LICENSE = "GPLv2 & MIT" +LIC_FILES_CHKSUM = " \ + file://GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://MIT-COPYING;md5=192063521ce782a445a3c9f99a8ad560 \ +" + +require include/rcar-gen3-modules-common.inc +inherit module + +MMNGR_DRV_URI = "git://github.com/renesas-rcar/mmngr_drv.git" + +SRC_URI = "${MMNGR_DRV_URI};branch=rcar_gen3" +SRCREV = "85d0042924de379307115533d7b6284333409bb3" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-qos/kernel-module-qos.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-qos/kernel-module-qos.bb new file mode 100644 index 00000000..5b02fb92 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-qos/kernel-module-qos.bb @@ -0,0 +1,62 @@ +DESCRIPTION = "QoS driver for the R-Car Gen3" + +require include/rcar-gen3-modules-common.inc + +LICENSE = "GPLv2 & MIT" +LIC_FILES_CHKSUM = " \ + file://GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://MIT-COPYING;md5=192063521ce782a445a3c9f99a8ad560 \ +" + +inherit module + +DEPENDS = "linux-renesas" +PN = "kernel-module-qos" +PR = "r0" + +QOS_DRV_URL = "git://github.com/renesas-rcar/qos_drv.git" +BRANCH = "rcar-gen3" +SRCREV = "d32fbee4d7b76056c37935ff31102c3583801a29" + +SRC_URI = "${QOS_DRV_URL};branch=${BRANCH}" + +S = "${WORKDIR}/git" +QOS_DRV_DIR = "qos-module/files/qos/drv" + +includedir = "${RENESAS_DATADIR}/include" + +# Build Qos kernel module without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +do_compile() { + cd ${S}/${QOS_DRV_DIR}/ + oe_runmake +} + +do_install () { + # Create destination directories + install -d ${D}/lib/modules/${KERNEL_VERSION}/extra/ + install -d ${D}/${includedir} + + # Install shared library to KERNELSRC(STAGING_KERNEL_DIR) for reference from other modules + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/${QOS_DRV_DIR}/Module.symvers ${KERNELSRC}/include/qos.symvers + + # Install kernel module + install -m 644 ${S}/${QOS_DRV_DIR}/qos.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/ + + # Install shared header files + install -m 644 ${S}/${QOS_DRV_DIR}/qos.h ${KERNELSRC}/include/ + install -m 644 ${S}/${QOS_DRV_DIR}/qos_public_common.h ${KERNELSRC}/include/ + install -m 644 ${S}/${QOS_DRV_DIR}/qos_public_common.h ${D}/${includedir}/ +} + +PACKAGES = " \ + ${PN} \ + ${PN}-dev \ + ${PN}-dbg \ +" + +FILES_${PN} = " \ + /lib/modules/${KERNEL_VERSION}/extra/qos.ko \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-uvcs/kernel-module-uvcs-drv.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-uvcs/kernel-module-uvcs-drv.bb new file mode 100644 index 00000000..eb2d33b6 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-uvcs/kernel-module-uvcs-drv.bb @@ -0,0 +1,70 @@ +DESCRIPTION = "Kernel module of UVCS" +LICENSE = "GPLv2 & MIT" +LIC_FILES_CHKSUM = " \ + file://include/GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://src/lkm/GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://src/core/GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://src/cmn/GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://include/MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 \ + file://src/lkm/MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 \ + file://src/core/MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 \ + file://src/cmn/MIT-COPYING;md5=fea016ce2bdf2ec10080f69e9381d378 \ +" +require include/omx-control.inc +require include/rcar-gen3-path-common.inc + +inherit module +PR = "r0" + +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" + +SRC_URI = "${@oe.utils.conditional('USE_VIDEO_OMX', '1', 'file://RCG3VUDRL4101ZDO.tar.bz2', '', d)}" + +S = "${WORKDIR}/RCG3VUDRL4101ZDO" + +EXTRA_OEMAKE = "KERNELDIR=${STAGING_KERNEL_BUILDDIR}" +EXTRA_OEMAKE += "CROSS_COMPILE=${CROSS_COMPILE}" + +B="${S}/src/makefile" + +includedir = "${RENESAS_DATADIR}/include" + +do_compile_prepend() { + export UVCS_SRC="${S}/src" + export UVCS_INC="${S}" + export VCP4_SRC="${S}/src" +} + +# Build UVCS kernel module without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +do_install() { + # Create destination directory + install -d ${D}/lib/modules/${KERNEL_VERSION}/extra/ + install -d ${D}/${includedir}/ + + # Install kernel module + install -m 644 ${B}/uvcs_drv.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/ + + # Install module symbol file + install -m 644 ${B}/Module.symvers ${STAGING_KERNEL_BUILDDIR}/UVCS.symvers + + # Install shared header file + install -m 644 ${S}/include/uvcs_ioctl.h ${D}/${includedir}/ +} + +# Clean up the module symbol file +CLEANFUNCS = "module_clean_symbol" + +module_clean_symbol() { + rm -f ${STAGING_KERNEL_BUILDDIR}/UVCS.symvers +} + +PACKAGES = " \ + ${PN} \ + ${PN}-sstate \ +" + +FILES_${PN}-sstate = " \ + ${includedir}/uvcs_ioctl.h \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-vsp2driver/kernel-module-vsp2driver.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-vsp2driver/kernel-module-vsp2driver.bb new file mode 100644 index 00000000..be8f8e01 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-vsp2driver/kernel-module-vsp2driver.bb @@ -0,0 +1,65 @@ +DESCRIPTION = "VSP2Driver for the R-Car Gen3" + +LICENSE = "GPLv2 & MIT" +LIC_FILES_CHKSUM = " \ + file://GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://MIT-COPYING;md5=192063521ce782a445a3c9f99a8ad560 \ +" + +require include/rcar-gen3-modules-common.inc + +inherit module + +DEPENDS = "linux-renesas kernel-module-vspm" +PN = "kernel-module-vsp2driver" +PR = "r0" + +VSP2DRIVER_URL = " \ + git://github.com/renesas-rcar/vsp2driver.git" +BRANCH = "rcar-gen3" +SRCREV = "0ecf35aa05c103ba4d3ab83e3320a22fccd912c3" + +SRC_URI = "${VSP2DRIVER_URL};branch=${BRANCH}" + +SRC_URI_append = " file://0001-Handle-data_offset-setting-from-V4L2-API.patch" + +S = "${WORKDIR}/git" + +# Build VSP2 driver kernel module without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +do_compile() { + cd ${S}/vsp2driver + make all +} + +do_install () { + # Create destination directories + install -d ${D}/lib/modules/${KERNEL_VERSION}/extra/ + install -d ${KERNELSRC}/include + + # Install shared library to KERNELSRC(STAGING_KERNEL_DIR) for reference from other modules + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/vsp2driver/Module.symvers ${KERNELSRC}/include/vsp2.symvers + + # Copy kernel module + install -m 644 ${S}/vsp2driver/vsp2.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/ + + # Install shared header files to KERNELSRC(STAGING_KERNEL_DIR) + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/vsp2driver/linux/vsp2.h ${KERNELSRC}/include/ +} + +PACKAGES = "\ + ${PN} \ +" + +FILES_${PN} = " \ + /lib/modules/${KERNEL_VERSION}/extra/vsp2.ko \ + ${sysconfdir}/modules-load.d \ +" + +RPROVIDES_${PN} += "kernel-module-vsp2driver kernel-module-vsp2" + +# Autoload VSP2Driver +KERNEL_MODULE_AUTOLOAD_append = " vsp2" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-vsp2driver/kernel-module-vsp2driver/0001-Handle-data_offset-setting-from-V4L2-API.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-vsp2driver/kernel-module-vsp2driver/0001-Handle-data_offset-setting-from-V4L2-API.patch new file mode 100644 index 00000000..3aab1740 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-vsp2driver/kernel-module-vsp2driver/0001-Handle-data_offset-setting-from-V4L2-API.patch @@ -0,0 +1,29 @@ +From 50dd867589931beef05dbcdb17a37a8a678e4b13 Mon Sep 17 00:00:00 2001 +From: Damian Hobson-Garcia <dhobsong@igel.co.jp> +Date: Fri, 10 May 2019 13:34:42 +0900 +Subject: [PATCH] Handle data_offset setting from V4L2 API + +The data in each buffer does not necessarily start at the +beginning of the buffer. Adjust as necessary according to +the data_offset field specified from user space. +--- + vsp2driver/vsp2_video.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/vsp2driver/vsp2_video.c b/vsp2driver/vsp2_video.c +index 8875578..0abf81c 100644 +--- a/vsp2driver/vsp2_video.c ++++ b/vsp2driver/vsp2_video.c +@@ -764,7 +764,8 @@ static int vsp2_video_buffer_prepare(struct vb2_buffer *vb) + } + + for (i = 0; i < vb->num_planes; ++i) { +- buf->mem.addr[i] = vb2_dma_contig_plane_dma_addr(vb, i); ++ buf->mem.addr[i] = vb2_dma_contig_plane_dma_addr(vb, i) + ++ vb->planes[i].data_offset; + + if (vb2_plane_size(vb, i) < format->plane_fmt[i].sizeimage) + return -EINVAL; +-- +2.17.1 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-vspm/kernel-module-vspm.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-vspm/kernel-module-vspm.bb new file mode 100644 index 00000000..9b723614 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-vspm/kernel-module-vspm.bb @@ -0,0 +1,102 @@ +DESCRIPTION = "VSP Manager for the R-Car Gen3" + +require include/rcar-gen3-modules-common.inc + +LICENSE = "GPLv2 & MIT" +LIC_FILES_CHKSUM = " \ + file://GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://MIT-COPYING;md5=0ebf15a927e436cec699371cd890775c \ +" + +inherit module + +DEPENDS = "linux-renesas" +PN = "kernel-module-vspm" +PR = "r0" + +VSPM_DRV_URL = "git://github.com/renesas-rcar/vspm_drv.git" +BRANCH = "rcar_gen3" +SRCREV = "7f854a9a1c4760255a54b7c14891d1545ed1bf43" + +SRC_URI = "${VSPM_DRV_URL};branch=${BRANCH}" + +# Fix patch for upscaling issue +SRC_URI_append = " \ + file://0001-Set-UDS-horizontal-scaling-phase-to-auto.patch \ +" + +S = "${WORKDIR}/git" +VSPM_DRV_DIR = "vspm-module/files/vspm" +includedir = "${RENESAS_DATADIR}/include" + +# Build VSP Manager kernel module without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +do_compile() { + cd ${S}/${VSPM_DRV_DIR}/drv + make all +} + +do_install () { + # Create destination directories + install -d ${D}/lib/modules/${KERNEL_VERSION}/extra/ + install -d ${KERNELSRC}/include + install -d ${D}/${includedir} + + # Install shared library to KERNELSRC(STAGING_KERNEL_DIR) for reference from other modules + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/${VSPM_DRV_DIR}/drv/Module.symvers ${KERNELSRC}/include/vspm.symvers + + # Install kernel module + install -m 644 ${S}/${VSPM_DRV_DIR}/drv/vspm.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/ + + # Install shared header files to KERNELSRC(STAGING_KERNEL_DIR) + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/${VSPM_DRV_DIR}/include/vspm_public.h ${KERNELSRC}/include/ + install -m 644 ${S}/${VSPM_DRV_DIR}/include/vspm_cmn.h ${KERNELSRC}/include/ + install -m 644 ${S}/${VSPM_DRV_DIR}/include/vsp_drv.h ${KERNELSRC}/include/ + install -m 644 ${S}/${VSPM_DRV_DIR}/include/fdp_drv.h ${KERNELSRC}/include/ + + # Install shared header files + install -m 644 ${S}/${VSPM_DRV_DIR}/include/vspm_cmn.h ${D}/${includedir}/ + install -m 644 ${S}/${VSPM_DRV_DIR}/include/vsp_drv.h ${D}/${includedir}/ + install -m 644 ${S}/${VSPM_DRV_DIR}/include/fdp_drv.h ${D}/${includedir}/ +} + +do_populate_sysroot[sstate-inputdirs] += "${S}/${VSPM_DRV_DIR}/include/" +do_populate_sysroot[sstate-outputdirs] += "${KERNELSRC}/include/" +do_populate_sysroot_setscene[prefuncs] = "vspm_sstate_check_func" +SSTATE_DUPWHITELIST = "${KERNELSRC}/include" + +vspm_sstate_check_func() { + # An error is returned when unpack of kernel source has not been completed yet. + # By returning error, rebuild task runs by force (Invalidating sstate). + # This module installs shared header files in ${KERNELSRC}/include by + # sstate cache. + # Those files will be deleted by unpack task of kernel. + if [ ${WITHIN_EXT_SDK} -eq 1 ]; then + : + else + if [ ! -d "${KERNELSRC}/include" ]; then + exit 1 + fi + fi +} + +# Should also clean deploy/licenses directory +# for module when do_clean. +do_clean[cleandirs] += "${LICENSE_DIRECTORY}/${PN}" + +PACKAGES = " \ + ${PN} \ + ${PN}-dev \ +" + +FILES_${PN} = " \ + /lib/modules/${KERNEL_VERSION}/extra/vspm.ko \ +" + +RPROVIDES_${PN} += "kernel-module-vspm" + +# Autoload VSPM +KERNEL_MODULE_AUTOLOAD_append = " vspm" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-vspm/kernel-module-vspm/0001-Set-UDS-horizontal-scaling-phase-to-auto.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-vspm/kernel-module-vspm/0001-Set-UDS-horizontal-scaling-phase-to-auto.patch new file mode 100644 index 00000000..17bf6233 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-vspm/kernel-module-vspm/0001-Set-UDS-horizontal-scaling-phase-to-auto.patch @@ -0,0 +1,40 @@ +From dd7dffa07065100c3164ca94a1d4395712e647cd Mon Sep 17 00:00:00 2001 +From: Damian Hobson-Garcia <dhobsong@igel.co.jp> +Date: Mon, 3 Jun 2019 12:33:57 +0900 +Subject: [PATCH] Set UDS horizontal scaling phase to auto + +Use the register default settings for the scaling phase instead +of manually calculating them. + +The default setting seems to calculate the phase correctly, +which the manual settings seem to shift the output image to the left +my an amount proportional to the scaling ratio. i.e x16 scaling +will shift the output by 16 pixels. +--- + vspm-module/files/vspm/drv/vsp/vsp_drv_phy.c | 10 ---------- + 1 file changed, 10 deletions(-) + +diff --git a/vspm-module/files/vspm/drv/vsp/vsp_drv_phy.c b/vspm-module/files/vspm/drv/vsp/vsp_drv_phy.c +index 8f63565..6f89bae 100644 +--- a/vspm-module/files/vspm/drv/vsp/vsp_drv_phy.c ++++ b/vspm-module/files/vspm/drv/vsp/vsp_drv_phy.c +@@ -1454,16 +1454,6 @@ static void vsp_ins_replace_part_uds_module( + r_temp *= ratio; + } + +- /* add horizontal filter phase of control register */ +- uds_info->val_ctrl |= VSP_UDS_CTRL_AMDSLH; +- +- /* replace scaling filter horizontal phase */ +- if (l_temp & 0xfff) +- uds_info->val_hphase = (4096 - (l_temp & 0xfff)) << 16; +- else +- uds_info->val_hphase = 0; +- if (r_temp & 0xfff) +- uds_info->val_hphase |= (4096 - (r_temp & 0xfff)); + } else { + l_temp *= 4096; + r_temp *= 4096; +-- +2.17.1 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-vspmif/kernel-module-vspmif.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-vspmif/kernel-module-vspmif.bb new file mode 100644 index 00000000..95e71c44 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/kernel-module-vspmif/kernel-module-vspmif.bb @@ -0,0 +1,67 @@ +DESCRIPTION = "VSP Manager Interface driver for the R-Car Gen3" + +require include/rcar-gen3-modules-common.inc + +LICENSE = "GPLv2 & MIT" +LIC_FILES_CHKSUM = " \ + file://GPL-COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://MIT-COPYING;md5=0ebf15a927e436cec699371cd890775c \ +" + +inherit module + +DEPENDS = "linux-renesas kernel-module-vspm" +PN = "kernel-module-vspmif" +PR = "r0" + +VSPMIF_DRV_URL = " \ + git://github.com/renesas-rcar/vspmif_drv.git" +BRANCH = "rcar_gen3" +SRCREV = "6172cc7273aae0345db894faa5ab59777549c247" + +SRC_URI = "${VSPMIF_DRV_URL};branch=${BRANCH}" + +S = "${WORKDIR}/git" +VSPMIF_DRV_DIR = "vspm_if-module/files/vspm_if" + +includedir = "${RENESAS_DATADIR}/include" + +# Build VSP Manager Interface kernel module without suffix +KERNEL_MODULE_PACKAGE_SUFFIX = "" + +do_compile() { + cd ${S}/${VSPMIF_DRV_DIR}/drv + make all +} + +do_install () { + # Create destination directories + install -d ${D}/lib/modules/${KERNEL_VERSION}/extra/ + install -d ${D}/${includedir} + install -d ${KERNELSRC}/include + + # Install shared library to KERNELSRC(STAGING_KERNEL_DIR) for reference from other modules + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/${VSPMIF_DRV_DIR}/drv/Module.symvers ${KERNELSRC}/include/vspm_if.symvers + + # Install kernel module + install -m 644 ${S}/${VSPMIF_DRV_DIR}/drv/vspm_if.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/ + + # Install shared header files to KERNELSRC(STAGING_KERNEL_DIR) + # This file installed in SDK by kernel-devsrc pkg. + install -m 644 ${S}/${VSPMIF_DRV_DIR}/include/vspm_if.h ${KERNELSRC}/include/ + + # Install shared header file + install -m 644 ${S}/${VSPMIF_DRV_DIR}/include/vspm_if.h ${D}/${includedir}/ +} + +PACKAGES = "\ + ${PN} \ + ${PN}-dev \ +" + +FILES_${PN} = " \ + /lib/modules/${KERNEL_VERSION}/extra/vspm_if.ko \ +" + +RPROVIDES_${PN} += "kernel-module-vspmif kernel-module-vspm-if" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-ADSP-add-document-for-compatible-string-renesas-rcar.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-ADSP-add-document-for-compatible-string-renesas-rcar.patch new file mode 100644 index 00000000..765053fa --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-ADSP-add-document-for-compatible-string-renesas-rcar.patch @@ -0,0 +1,32 @@ +From 5f378e5db591a4a119b6cface6037cbded240506 Mon Sep 17 00:00:00 2001 +From: tienphitran <tien.tran.uw@renesas.com> +Date: Thu, 25 Oct 2018 13:25:10 +0700 +Subject: [PATCH 1/6] ADSP: add document for compatible string + "renesas,rcar_adsp_sound_gen3" + +Signed-off-by: tienphitran <tien.tran.uw@renesas.com> +--- + .../devicetree/bindings/sound/renesas,adsp.txt | 11 +++++++++++ + 1 file changed, 11 insertions(+) + create mode 100644 Documentation/devicetree/bindings/sound/renesas,adsp.txt + +diff --git a/Documentation/devicetree/bindings/sound/renesas,adsp.txt b/Documentation/devicetree/bindings/sound/renesas,adsp.txt +new file mode 100644 +index 000000000000..b529bcadea82 +--- /dev/null ++++ b/Documentation/devicetree/bindings/sound/renesas,adsp.txt +@@ -0,0 +1,11 @@ ++Renesas ADSP sound driver ++ ++Required properties: ++- compatible : "renesas,rcar_adsp_sound_gen3" ++ ++Example: ++ ++rcar_adsp_sound: adsp_sound@0 { ++ compatible = "renesas,rcar_adsp_sound_gen3"; ++ status = "disabled"; ++}; +-- +2.19.1 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-arm64-bpf-correct-broken-uapi-for-BPF_PROG_TYPE_PERF.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-arm64-bpf-correct-broken-uapi-for-BPF_PROG_TYPE_PERF.patch new file mode 100644 index 00000000..9c38a327 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-arm64-bpf-correct-broken-uapi-for-BPF_PROG_TYPE_PERF.patch @@ -0,0 +1,61 @@ +From a39cada70268aadff7153e4f782bcd90a5c69d07 Mon Sep 17 00:00:00 2001 +From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> +Date: Mon, 4 Dec 2017 10:56:46 +0100 +Subject: [PATCH] arm64/bpf: correct broken uapi for BPF_PROG_TYPE_PERF_EVENT + program type + +Correct the broken uapi for the BPF_PROG_TYPE_PERF_EVENT program type +by exporting the user_pt_regs structure instead of the pt_regs structure +that is in-kernel only. + +Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> +Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com> +Acked-by: Alexei Starovoitov <ast@kernel.org> +Cc: Will Deacon <will.deacon@arm.com> +Cc: Mark Rutland <mark.rutland@arm.com> +Cc: Arnaldo Carvalho de Melo <acme@kernel.org> +Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> +--- + arch/arm64/include/asm/perf_event.h | 2 ++ + arch/arm64/include/uapi/asm/bpf_perf_event.h | 9 +++++++++ + 2 files changed, 11 insertions(+) + create mode 100644 arch/arm64/include/uapi/asm/bpf_perf_event.h + +diff --git a/arch/arm64/include/asm/perf_event.h b/arch/arm64/include/asm/perf_event.h +index 8d5cbec..f9ccc36 100644 +--- a/arch/arm64/include/asm/perf_event.h ++++ b/arch/arm64/include/asm/perf_event.h +@@ -18,6 +18,7 @@ + #define __ASM_PERF_EVENT_H + + #include <asm/stack_pointer.h> ++#include <asm/ptrace.h> + + #define ARMV8_PMU_MAX_COUNTERS 32 + #define ARMV8_PMU_COUNTER_MASK (ARMV8_PMU_MAX_COUNTERS - 1) +@@ -79,6 +80,7 @@ struct pt_regs; + extern unsigned long perf_instruction_pointer(struct pt_regs *regs); + extern unsigned long perf_misc_flags(struct pt_regs *regs); + #define perf_misc_flags(regs) perf_misc_flags(regs) ++#define perf_arch_bpf_user_pt_regs(regs) ®s->user_regs + #endif + + #define perf_arch_fetch_caller_regs(regs, __ip) { \ +diff --git a/arch/arm64/include/uapi/asm/bpf_perf_event.h b/arch/arm64/include/uapi/asm/bpf_perf_event.h +new file mode 100644 +index 0000000..b551b74 +--- /dev/null ++++ b/arch/arm64/include/uapi/asm/bpf_perf_event.h +@@ -0,0 +1,9 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__ ++#define _UAPI__ASM_BPF_PERF_EVENT_H__ ++ ++#include <asm/ptrace.h> ++ ++typedef struct user_pt_regs bpf_user_pt_regs_t; ++ ++#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */ +-- +2.7.4 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-drm-rcar-du-Set-primary-plane-zpos-immutably-at-init.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-drm-rcar-du-Set-primary-plane-zpos-immutably-at-init.patch new file mode 100644 index 00000000..9ce66d64 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-drm-rcar-du-Set-primary-plane-zpos-immutably-at-init.patch @@ -0,0 +1,89 @@ +From f8358c2afe0be62cffe4cca58c5373951ecc1c8d Mon Sep 17 00:00:00 2001 +From: Khang Nguyen <khang.nguyen.xw@renesas.com> +Date: Mon, 13 Apr 2020 21:49:28 +0900 +Subject: [PATCH] drm: rcar-du: Set primary plane zpos immutably at + initializing + +This patch backports a fix from [1] for an issue occurs on Weston 8.0.0. + +[1]: +https://lists.freedesktop.org/archives/dri-devel/2020-April/261224.html + +According to drm_plane_create_zpos_property() function documentation, +all planes zpos range should be set if zpos property is supported. +However, the rcar-du driver didn't set primary plane zpos range. Since +the primary plane's zpos is fixed, set it immutably. + +Signed-off-by: Khang Nguyen <khang.nguyen.xw@renesas.com> +Signed-off-by: Tram Huynh <tram.huynh.aj@renesas.com> +--- + drivers/gpu/drm/rcar-du/rcar_du_plane.c | 13 ++++++++----- + drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 18 ++++++++++-------- + 2 files changed, 18 insertions(+), 13 deletions(-) + +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c +index 1b70db3..5818c59 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c ++++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c +@@ -825,15 +825,18 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp) + drm_plane_helper_add(&plane->plane, + &rcar_du_plane_helper_funcs); + +- if (type == DRM_PLANE_TYPE_PRIMARY) +- continue; ++ if (type == DRM_PLANE_TYPE_PRIMARY){ ++ drm_plane_create_zpos_immutable_property(&plane->plane, ++ 0); ++ } else { + +- drm_object_attach_property(&plane->plane.base, ++ drm_object_attach_property(&plane->plane.base, + rcdu->props.alpha, 255); +- drm_object_attach_property(&plane->plane.base, ++ drm_object_attach_property(&plane->plane.base, + rcdu->props.colorkey, + RCAR_DU_COLORKEY_NONE); +- drm_plane_create_zpos_property(&plane->plane, 1, 1, 7); ++ drm_plane_create_zpos_property(&plane->plane, 1, 1, 7); ++ } + } + + return 0; +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +index c44d336..0c352a0 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c ++++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +@@ -633,20 +633,22 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np, + drm_plane_helper_add(&plane->plane, + &rcar_du_vsp_plane_helper_funcs); + +- if (type == DRM_PLANE_TYPE_PRIMARY) +- continue; +- +- drm_object_attach_property(&plane->plane.base, ++ if (type == DRM_PLANE_TYPE_PRIMARY) { ++ drm_plane_create_zpos_immutable_property(&plane->plane, ++ 0); ++ } else { ++ drm_object_attach_property(&plane->plane.base, + rcdu->props.alpha, 255); +- drm_object_attach_property(&plane->plane.base, ++ drm_object_attach_property(&plane->plane.base, + rcdu->props.colorkey, + RCAR_DU_COLORKEY_NONE); +- if (rcdu->props.colorkey_alpha) +- drm_object_attach_property(&plane->plane.base, ++ if (rcdu->props.colorkey_alpha) ++ drm_object_attach_property(&plane->plane.base, + rcdu->props.colorkey_alpha, + 0); +- drm_plane_create_zpos_property(&plane->plane, 1, 1, ++ drm_plane_create_zpos_property(&plane->plane, 1, 1, + vsp->num_planes - 1); ++ } + } + + return 0; +-- +2.7.4 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-perf-tools-Add-Python-3-support.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-perf-tools-Add-Python-3-support.patch new file mode 100644 index 00000000..74ce61e5 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-perf-tools-Add-Python-3-support.patch @@ -0,0 +1,917 @@ +From 8804547988bb772a00cd4bb832fe4e1a79f552b7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= <jskarvad@redhat.com> +Date: Fri, 19 Jan 2018 21:56:41 +0100 +Subject: [PATCH] perf tools: Add Python 3 support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Added Python 3 support while keeping Python 2.7 compatibility. + +Committer notes: + +This doesn't make it to auto detect python 3, one has to explicitely ask +it to build with python 3 devel files, here are the instructions +provided by Jaroslav: + + --- + $ cp -a tools/perf tools/python3-perf + $ make V=1 prefix=/usr -C tools/perf PYTHON=/usr/bin/python2 all + $ make V=1 prefix=/usr -C tools/python3-perf PYTHON=/usr/bin/python3 all + $ make V=1 prefix=/usr -C tools/python3-perf PYTHON=/usr/bin/python3 DESTDIR=%{buildroot} install-python_ext + $ make V=1 prefix=/usr -C tools/perf PYTHON=/usr/bin/python2 DESTDIR=%{buildroot} install-python_ext + --- + +We need to make this automatic, just like the existing tests for checking if +the python2 devel files are in place, allowing the build with python3 if +available, fallbacking to python2 and then just disabling it if none are +available. + +So, using the PYTHON variable to build it using O= we get: + +Before this patch: + + $ rpm -q python3 python3-devel + python3-3.6.4-7.fc27.x86_64 + python3-devel-3.6.4-7.fc27.x86_64 + $ rm -rf /tmp/build/perf/ ; mkdir -p /tmp/build/perf ; make O=/tmp/build/perf PYTHON=/usr/bin/python3 -C tools/perf install-bin + make: Entering directory '/home/acme/git/linux/tools/perf' + <SNIP> + Makefile.config:670: Python 3 is not yet supported; please set + Makefile.config:671: PYTHON and/or PYTHON_CONFIG appropriately. + Makefile.config:672: If you also have Python 2 installed, then + Makefile.config:673: try something like: + Makefile.config:674: + Makefile.config:675: make PYTHON=python2 + Makefile.config:676: + Makefile.config:677: Otherwise, disable Python support entirely: + Makefile.config:678: + Makefile.config:679: make NO_LIBPYTHON=1 + Makefile.config:680: + Makefile.config:681: *** . Stop. + make[1]: *** [Makefile.perf:212: sub-make] Error 2 + make: *** [Makefile:110: install-bin] Error 2 + make: Leaving directory '/home/acme/git/linux/tools/perf' + $ + +After: + + $ make O=/tmp/build/perf PYTHON=python3 -C tools/perf install-bin + $ ldd ~/bin/perf | grep python + libpython3.6m.so.1.0 => /lib64/libpython3.6m.so.1.0 (0x00007f58a31e8000) + $ rpm -qf /lib64/libpython3.6m.so.1.0 + python3-libs-3.6.4-7.fc27.x86_64 + $ + +Now verify that when using the binding the right ELF file is loaded, +using perf trace: + + $ perf trace -e open* perf test python + 0.051 ( 0.016 ms): perf/3927 openat(dfd: CWD, filename: /etc/ld.so.cache, flags: CLOEXEC ) = 3 +<SNIP> + 18: 'import perf' in python : + 8.849 ( 0.013 ms): sh/3929 openat(dfd: CWD, filename: /etc/ld.so.cache, flags: CLOEXEC ) = 3 +<SNIP> + 25.572 ( 0.008 ms): python3/3931 openat(dfd: CWD, filename: /tmp/build/perf/python/perf.cpython-36m-x86_64-linux-gnu.so, flags: CLOEXEC) = 3 +<SNIP> + Ok +<SNIP> + $ + +And using tools/perf/python/twatch.py, to show PERF_RECORD_ metaevents: + + $ python3 tools/perf/python/twatch.py + cpu: 3, pid: 16060, tid: 16060 { type: fork, pid: 5207, ppid: 16060, tid: 5207, ptid: 16060, time: 10798513015459} + cpu: 3, pid: 16060, tid: 16060 { type: fork, pid: 5208, ppid: 16060, tid: 5208, ptid: 16060, time: 10798513562503} + cpu: 0, pid: 5208, tid: 5208 { type: comm, pid: 5208, tid: 5208, comm: grep } + cpu: 2, pid: 5207, tid: 5207 { type: comm, pid: 5207, tid: 5207, comm: ps } + cpu: 2, pid: 5207, tid: 5207 { type: exit, pid: 5207, ppid: 5207, tid: 5207, ptid: 5207, time: 10798551337484} + cpu: 3, pid: 5208, tid: 5208 { type: exit, pid: 5208, ppid: 5208, tid: 5208, ptid: 5208, time: 10798551292153} + cpu: 3, pid: 601, tid: 601 { type: fork, pid: 5209, ppid: 601, tid: 5209, ptid: 601, time: 10801779977324} + ^CTraceback (most recent call last): + File "tools/perf/python/twatch.py", line 68, in <module> + main() + File "tools/perf/python/twatch.py", line 40, in main + evlist.poll(timeout = -1) + KeyboardInterrupt + $ + + # ps ax|grep twatch + 5197 pts/8 S+ 0:00 python3 tools/perf/python/twatch.py + # ls -la /proc/5197/smaps + -r--r--r--. 1 acme acme 0 Feb 19 13:14 /proc/5197/smaps + # grep python /proc/5197/smaps + 558111307000-558111309000 r-xp 00000000 fd:00 3151710 /usr/bin/python3.6 + 558111508000-558111509000 r--p 00001000 fd:00 3151710 /usr/bin/python3.6 + 558111509000-55811150a000 rw-p 00002000 fd:00 3151710 /usr/bin/python3.6 + 7ffad6fc1000-7ffad7008000 r-xp 00000000 00:2d 220196 /tmp/build/perf/python/perf.cpython-36m-x86_64-linux-gnu.so + 7ffad7008000-7ffad7207000 ---p 00047000 00:2d 220196 /tmp/build/perf/python/perf.cpython-36m-x86_64-linux-gnu.so + 7ffad7207000-7ffad7208000 r--p 00046000 00:2d 220196 /tmp/build/perf/python/perf.cpython-36m-x86_64-linux-gnu.so + 7ffad7208000-7ffad7215000 rw-p 00047000 00:2d 220196 /tmp/build/perf/python/perf.cpython-36m-x86_64-linux-gnu.so + 7ffadea77000-7ffaded3d000 r-xp 00000000 fd:00 3151795 /usr/lib64/libpython3.6m.so.1.0 + 7ffaded3d000-7ffadef3c000 ---p 002c6000 fd:00 3151795 /usr/lib64/libpython3.6m.so.1.0 + 7ffadef3c000-7ffadef42000 r--p 002c5000 fd:00 3151795 /usr/lib64/libpython3.6m.so.1.0 + 7ffadef42000-7ffadefa5000 rw-p 002cb000 fd:00 3151795 /usr/lib64/libpython3.6m.so.1.0 + # + +And with this patch, but building normally, without specifying the +PYTHON=python3 part, which will make it use python2 if its devel files are +available, like in this test: + + $ make O=/tmp/build/perf -C tools/perf install-bin + $ ldd ~/bin/perf | grep python + libpython2.7.so.1.0 => /lib64/libpython2.7.so.1.0 (0x00007f6a44410000) + $ ldd /tmp/build/perf/python_ext_build/lib/perf.so | grep python + libpython2.7.so.1.0 => /lib64/libpython2.7.so.1.0 (0x00007fed28a2c000) + $ + + [acme@jouet perf]$ tools/perf/python/twatch.py + cpu: 0, pid: 2817, tid: 2817 { type: fork, pid: 2817, ppid: 2817, tid: 8910, ptid: 2817, time: 11126454335306} + cpu: 0, pid: 2817, tid: 2817 { type: comm, pid: 2817, tid: 8910, comm: worker } + $ ps ax | grep twatch.py + 8909 pts/8 S+ 0:00 /usr/bin/python tools/perf/python/twatch.py + $ grep python /proc/8909/smaps + 5579de658000-5579de659000 r-xp 00000000 fd:00 3156044 /usr/bin/python2.7 + 5579de858000-5579de859000 r--p 00000000 fd:00 3156044 /usr/bin/python2.7 + 5579de859000-5579de85a000 rw-p 00001000 fd:00 3156044 /usr/bin/python2.7 + 7f0de01f7000-7f0de023e000 r-xp 00000000 00:2d 230695 /tmp/build/perf/python/perf.so + 7f0de023e000-7f0de043d000 ---p 00047000 00:2d 230695 /tmp/build/perf/python/perf.so + 7f0de043d000-7f0de043e000 r--p 00046000 00:2d 230695 /tmp/build/perf/python/perf.so + 7f0de043e000-7f0de044b000 rw-p 00047000 00:2d 230695 /tmp/build/perf/python/perf.so + 7f0de6f0f000-7f0de6f13000 r-xp 00000000 fd:00 134975 /usr/lib64/python2.7/lib-dynload/_localemodule.so + 7f0de6f13000-7f0de7113000 ---p 00004000 fd:00 134975 /usr/lib64/python2.7/lib-dynload/_localemodule.so + 7f0de7113000-7f0de7114000 r--p 00004000 fd:00 134975 /usr/lib64/python2.7/lib-dynload/_localemodule.so + 7f0de7114000-7f0de7115000 rw-p 00005000 fd:00 134975 /usr/lib64/python2.7/lib-dynload/_localemodule.so + 7f0de7e73000-7f0de8052000 r-xp 00000000 fd:00 3173292 /usr/lib64/libpython2.7.so.1.0 + 7f0de8052000-7f0de8251000 ---p 001df000 fd:00 3173292 /usr/lib64/libpython2.7.so.1.0 + 7f0de8251000-7f0de8255000 r--p 001de000 fd:00 3173292 /usr/lib64/libpython2.7.so.1.0 + 7f0de8255000-7f0de8291000 rw-p 001e2000 fd:00 3173292 /usr/lib64/libpython2.7.so.1.0 + $ + +Signed-off-by: Jaroslav Å karvada <jskarvad@redhat.com> +Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> +Cc: Adrian Hunter <adrian.hunter@intel.com> +Cc: David Ahern <dsahern@gmail.com> +Cc: Jiri Olsa <jolsa@kernel.org> +Cc: Namhyung Kim <namhyung@kernel.org> +Cc: Wang Nan <wangnan0@huawei.com> +LPU-Reference: 20180119205641.24242-1-jskarvad@redhat.com +Link: https://lkml.kernel.org/n/tip-8d7dt9kqp83vsz25hagug8fu@git.kernel.org +[ Removed explicit check for python version, allowing it to really build with python3 ] +Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> + +Upstream status: Backport [https://github.com/torvalds/linux/commit/66dfdff03d196e51322c6a85c0d8db8bb2bdd655] +Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> +--- + tools/perf/Makefile.config | 23 +-- + tools/perf/Makefile.perf | 4 +- + .../scripts/python/Perf-Trace-Util/Context.c | 34 +++- + tools/perf/util/python.c | 95 ++++++++--- + .../scripting-engines/trace-event-python.c | 147 +++++++++++++----- + tools/perf/util/setup.py | 6 +- + 6 files changed, 221 insertions(+), 88 deletions(-) + +diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config +index f362ee46506a..ecdc3770d899 100644 +--- a/tools/perf/Makefile.config ++++ b/tools/perf/Makefile.config +@@ -622,25 +622,10 @@ else + ifneq ($(feature-libpython), 1) + $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev) + else +- ifneq ($(feature-libpython-version), 1) +- $(warning Python 3 is not yet supported; please set) +- $(warning PYTHON and/or PYTHON_CONFIG appropriately.) +- $(warning If you also have Python 2 installed, then) +- $(warning try something like:) +- $(warning $(and ,)) +- $(warning $(and ,) make PYTHON=python2) +- $(warning $(and ,)) +- $(warning Otherwise, disable Python support entirely:) +- $(warning $(and ,)) +- $(warning $(and ,) make NO_LIBPYTHON=1) +- $(warning $(and ,)) +- $(error $(and ,)) +- else +- LDFLAGS += $(PYTHON_EMBED_LDFLAGS) +- EXTLIBS += $(PYTHON_EMBED_LIBADD) +- LANG_BINDINGS += $(obj-perf)python/perf.so +- $(call detected,CONFIG_LIBPYTHON) +- endif ++ LDFLAGS += $(PYTHON_EMBED_LDFLAGS) ++ EXTLIBS += $(PYTHON_EMBED_LIBADD) ++ LANG_BINDINGS += $(obj-perf)python/perf.so ++ $(call detected,CONFIG_LIBPYTHON) + endif + endif + endif +diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf +index 349ea5133d83..6879321c612d 100644 +--- a/tools/perf/Makefile.perf ++++ b/tools/perf/Makefile.perf +@@ -294,7 +294,7 @@ PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/ + PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/ + export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP + +-python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so ++python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so + + PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources) + PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPI) +@@ -444,7 +444,7 @@ $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_D + $(PYTHON_WORD) util/setup.py \ + --quiet build_ext; \ + mkdir -p $(OUTPUT)python && \ +- cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/ ++ cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/ + + please_set_SHELL_PATH_to_a_more_modern_shell: + $(Q)$$(:) +diff --git a/tools/perf/scripts/python/Perf-Trace-Util/Context.c b/tools/perf/scripts/python/Perf-Trace-Util/Context.c +index fcd1dd667906..1a0d27757eec 100644 +--- a/tools/perf/scripts/python/Perf-Trace-Util/Context.c ++++ b/tools/perf/scripts/python/Perf-Trace-Util/Context.c +@@ -23,7 +23,17 @@ + #include "../../../perf.h" + #include "../../../util/trace-event.h" + ++#if PY_MAJOR_VERSION < 3 ++#define _PyCapsule_GetPointer(arg1, arg2) \ ++ PyCObject_AsVoidPtr(arg1) ++ + PyMODINIT_FUNC initperf_trace_context(void); ++#else ++#define _PyCapsule_GetPointer(arg1, arg2) \ ++ PyCapsule_GetPointer((arg1), (arg2)) ++ ++PyMODINIT_FUNC PyInit_perf_trace_context(void); ++#endif + + static PyObject *perf_trace_context_common_pc(PyObject *obj, PyObject *args) + { +@@ -34,7 +44,7 @@ static PyObject *perf_trace_context_common_pc(PyObject *obj, PyObject *args) + if (!PyArg_ParseTuple(args, "O", &context)) + return NULL; + +- scripting_context = PyCObject_AsVoidPtr(context); ++ scripting_context = _PyCapsule_GetPointer(context, NULL); + retval = common_pc(scripting_context); + + return Py_BuildValue("i", retval); +@@ -50,7 +60,7 @@ static PyObject *perf_trace_context_common_flags(PyObject *obj, + if (!PyArg_ParseTuple(args, "O", &context)) + return NULL; + +- scripting_context = PyCObject_AsVoidPtr(context); ++ scripting_context = _PyCapsule_GetPointer(context, NULL); + retval = common_flags(scripting_context); + + return Py_BuildValue("i", retval); +@@ -66,7 +76,7 @@ static PyObject *perf_trace_context_common_lock_depth(PyObject *obj, + if (!PyArg_ParseTuple(args, "O", &context)) + return NULL; + +- scripting_context = PyCObject_AsVoidPtr(context); ++ scripting_context = _PyCapsule_GetPointer(context, NULL); + retval = common_lock_depth(scripting_context); + + return Py_BuildValue("i", retval); +@@ -82,7 +92,25 @@ static PyMethodDef ContextMethods[] = { + { NULL, NULL, 0, NULL} + }; + ++#if PY_MAJOR_VERSION < 3 + PyMODINIT_FUNC initperf_trace_context(void) + { + (void) Py_InitModule("perf_trace_context", ContextMethods); + } ++#else ++PyMODINIT_FUNC PyInit_perf_trace_context(void) ++{ ++ static struct PyModuleDef moduledef = { ++ PyModuleDef_HEAD_INIT, ++ "perf_trace_context", /* m_name */ ++ "", /* m_doc */ ++ -1, /* m_size */ ++ ContextMethods, /* m_methods */ ++ NULL, /* m_reload */ ++ NULL, /* m_traverse */ ++ NULL, /* m_clear */ ++ NULL, /* m_free */ ++ }; ++ return PyModule_Create(&moduledef); ++} ++#endif +diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c +index 8e49d9cafcfc..16620c37fd8c 100644 +--- a/tools/perf/util/python.c ++++ b/tools/perf/util/python.c +@@ -12,6 +12,30 @@ + #include "print_binary.h" + #include "thread_map.h" + ++#if PY_MAJOR_VERSION < 3 ++#define _PyUnicode_FromString(arg) \ ++ PyString_FromString(arg) ++#define _PyUnicode_AsString(arg) \ ++ PyString_AsString(arg) ++#define _PyUnicode_FromFormat(...) \ ++ PyString_FromFormat(__VA_ARGS__) ++#define _PyLong_FromLong(arg) \ ++ PyInt_FromLong(arg) ++ ++#else ++ ++#define _PyUnicode_FromString(arg) \ ++ PyUnicode_FromString(arg) ++#define _PyUnicode_FromFormat(...) \ ++ PyUnicode_FromFormat(__VA_ARGS__) ++#define _PyLong_FromLong(arg) \ ++ PyLong_FromLong(arg) ++#endif ++ ++#ifndef Py_TYPE ++#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) ++#endif ++ + /* + * Provide these two so that we don't have to link against callchain.c and + * start dragging hist.c, etc. +@@ -49,7 +73,11 @@ int eprintf(int level, int var, const char *fmt, ...) + # define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, + #endif + ++#if PY_MAJOR_VERSION < 3 + PyMODINIT_FUNC initperf(void); ++#else ++PyMODINIT_FUNC PyInit_perf(void); ++#endif + + #define member_def(type, member, ptype, help) \ + { #member, ptype, \ +@@ -107,7 +135,7 @@ static PyObject *pyrf_mmap_event__repr(struct pyrf_event *pevent) + pevent->event.mmap.pgoff, pevent->event.mmap.filename) < 0) { + ret = PyErr_NoMemory(); + } else { +- ret = PyString_FromString(s); ++ ret = _PyUnicode_FromString(s); + free(s); + } + return ret; +@@ -138,7 +166,7 @@ static PyMemberDef pyrf_task_event__members[] = { + + static PyObject *pyrf_task_event__repr(struct pyrf_event *pevent) + { +- return PyString_FromFormat("{ type: %s, pid: %u, ppid: %u, tid: %u, " ++ return _PyUnicode_FromFormat("{ type: %s, pid: %u, ppid: %u, tid: %u, " + "ptid: %u, time: %" PRIu64 "}", + pevent->event.header.type == PERF_RECORD_FORK ? "fork" : "exit", + pevent->event.fork.pid, +@@ -171,7 +199,7 @@ static PyMemberDef pyrf_comm_event__members[] = { + + static PyObject *pyrf_comm_event__repr(struct pyrf_event *pevent) + { +- return PyString_FromFormat("{ type: comm, pid: %u, tid: %u, comm: %s }", ++ return _PyUnicode_FromFormat("{ type: comm, pid: %u, tid: %u, comm: %s }", + pevent->event.comm.pid, + pevent->event.comm.tid, + pevent->event.comm.comm); +@@ -202,7 +230,7 @@ static PyObject *pyrf_throttle_event__repr(struct pyrf_event *pevent) + { + struct throttle_event *te = (struct throttle_event *)(&pevent->event.header + 1); + +- return PyString_FromFormat("{ type: %sthrottle, time: %" PRIu64 ", id: %" PRIu64 ++ return _PyUnicode_FromFormat("{ type: %sthrottle, time: %" PRIu64 ", id: %" PRIu64 + ", stream_id: %" PRIu64 " }", + pevent->event.header.type == PERF_RECORD_THROTTLE ? "" : "un", + te->time, te->id, te->stream_id); +@@ -237,7 +265,7 @@ static PyObject *pyrf_lost_event__repr(struct pyrf_event *pevent) + pevent->event.lost.id, pevent->event.lost.lost) < 0) { + ret = PyErr_NoMemory(); + } else { +- ret = PyString_FromString(s); ++ ret = _PyUnicode_FromString(s); + free(s); + } + return ret; +@@ -264,7 +292,7 @@ static PyMemberDef pyrf_read_event__members[] = { + + static PyObject *pyrf_read_event__repr(struct pyrf_event *pevent) + { +- return PyString_FromFormat("{ type: read, pid: %u, tid: %u }", ++ return _PyUnicode_FromFormat("{ type: read, pid: %u, tid: %u }", + pevent->event.read.pid, + pevent->event.read.tid); + /* +@@ -299,7 +327,7 @@ static PyObject *pyrf_sample_event__repr(struct pyrf_event *pevent) + if (asprintf(&s, "{ type: sample }") < 0) { + ret = PyErr_NoMemory(); + } else { +- ret = PyString_FromString(s); ++ ret = _PyUnicode_FromString(s); + free(s); + } + return ret; +@@ -330,7 +358,7 @@ tracepoint_field(struct pyrf_event *pe, struct format_field *field) + } + if (field->flags & FIELD_IS_STRING && + is_printable_array(data + offset, len)) { +- ret = PyString_FromString((char *)data + offset); ++ ret = _PyUnicode_FromString((char *)data + offset); + } else { + ret = PyByteArray_FromStringAndSize((const char *) data + offset, len); + field->flags &= ~FIELD_IS_STRING; +@@ -352,7 +380,7 @@ tracepoint_field(struct pyrf_event *pe, struct format_field *field) + static PyObject* + get_tracepoint_field(struct pyrf_event *pevent, PyObject *attr_name) + { +- const char *str = PyString_AsString(PyObject_Str(attr_name)); ++ const char *str = _PyUnicode_AsString(PyObject_Str(attr_name)); + struct perf_evsel *evsel = pevent->evsel; + struct format_field *field; + +@@ -416,7 +444,7 @@ static PyObject *pyrf_context_switch_event__repr(struct pyrf_event *pevent) + !!(pevent->event.header.misc & PERF_RECORD_MISC_SWITCH_OUT)) < 0) { + ret = PyErr_NoMemory(); + } else { +- ret = PyString_FromString(s); ++ ret = _PyUnicode_FromString(s); + free(s); + } + return ret; +@@ -528,7 +556,7 @@ static int pyrf_cpu_map__init(struct pyrf_cpu_map *pcpus, + static void pyrf_cpu_map__delete(struct pyrf_cpu_map *pcpus) + { + cpu_map__put(pcpus->cpus); +- pcpus->ob_type->tp_free((PyObject*)pcpus); ++ Py_TYPE(pcpus)->tp_free((PyObject*)pcpus); + } + + static Py_ssize_t pyrf_cpu_map__length(PyObject *obj) +@@ -597,7 +625,7 @@ static int pyrf_thread_map__init(struct pyrf_thread_map *pthreads, + static void pyrf_thread_map__delete(struct pyrf_thread_map *pthreads) + { + thread_map__put(pthreads->threads); +- pthreads->ob_type->tp_free((PyObject*)pthreads); ++ Py_TYPE(pthreads)->tp_free((PyObject*)pthreads); + } + + static Py_ssize_t pyrf_thread_map__length(PyObject *obj) +@@ -759,7 +787,7 @@ static int pyrf_evsel__init(struct pyrf_evsel *pevsel, + static void pyrf_evsel__delete(struct pyrf_evsel *pevsel) + { + perf_evsel__exit(&pevsel->evsel); +- pevsel->ob_type->tp_free((PyObject*)pevsel); ++ Py_TYPE(pevsel)->tp_free((PyObject*)pevsel); + } + + static PyObject *pyrf_evsel__open(struct pyrf_evsel *pevsel, +@@ -850,7 +878,7 @@ static int pyrf_evlist__init(struct pyrf_evlist *pevlist, + static void pyrf_evlist__delete(struct pyrf_evlist *pevlist) + { + perf_evlist__exit(&pevlist->evlist); +- pevlist->ob_type->tp_free((PyObject*)pevlist); ++ Py_TYPE(pevlist)->tp_free((PyObject*)pevlist); + } + + static PyObject *pyrf_evlist__mmap(struct pyrf_evlist *pevlist, +@@ -902,12 +930,16 @@ static PyObject *pyrf_evlist__get_pollfd(struct pyrf_evlist *pevlist, + + for (i = 0; i < evlist->pollfd.nr; ++i) { + PyObject *file; ++#if PY_MAJOR_VERSION < 3 + FILE *fp = fdopen(evlist->pollfd.entries[i].fd, "r"); + + if (fp == NULL) + goto free_list; + + file = PyFile_FromFile(fp, "perf", "r", NULL); ++#else ++ file = PyFile_FromFd(evlist->pollfd.entries[i].fd, "perf", "r", -1, NULL, NULL, NULL, 1); ++#endif + if (file == NULL) + goto free_list; + +@@ -1194,9 +1226,9 @@ static PyObject *pyrf__tracepoint(struct pyrf_evsel *pevsel, + + tp_format = trace_event__tp_format(sys, name); + if (IS_ERR(tp_format)) +- return PyInt_FromLong(-1); ++ return _PyLong_FromLong(-1); + +- return PyInt_FromLong(tp_format->id); ++ return _PyLong_FromLong(tp_format->id); + } + + static PyMethodDef perf__methods[] = { +@@ -1209,11 +1241,31 @@ static PyMethodDef perf__methods[] = { + { .ml_name = NULL, } + }; + ++#if PY_MAJOR_VERSION < 3 + PyMODINIT_FUNC initperf(void) ++#else ++PyMODINIT_FUNC PyInit_perf(void) ++#endif + { + PyObject *obj; + int i; +- PyObject *dict, *module = Py_InitModule("perf", perf__methods); ++ PyObject *dict; ++#if PY_MAJOR_VERSION < 3 ++ PyObject *module = Py_InitModule("perf", perf__methods); ++#else ++ static struct PyModuleDef moduledef = { ++ PyModuleDef_HEAD_INIT, ++ "perf", /* m_name */ ++ "", /* m_doc */ ++ -1, /* m_size */ ++ perf__methods, /* m_methods */ ++ NULL, /* m_reload */ ++ NULL, /* m_traverse */ ++ NULL, /* m_clear */ ++ NULL, /* m_free */ ++ }; ++ PyObject *module = PyModule_Create(&moduledef); ++#endif + + if (module == NULL || + pyrf_event__setup_types() < 0 || +@@ -1221,7 +1273,11 @@ PyMODINIT_FUNC initperf(void) + pyrf_evsel__setup_types() < 0 || + pyrf_thread_map__setup_types() < 0 || + pyrf_cpu_map__setup_types() < 0) ++#if PY_MAJOR_VERSION < 3 + return; ++#else ++ return module; ++#endif + + /* The page_size is placed in util object. */ + page_size = sysconf(_SC_PAGE_SIZE); +@@ -1270,7 +1326,7 @@ PyMODINIT_FUNC initperf(void) + goto error; + + for (i = 0; perf__constants[i].name != NULL; i++) { +- obj = PyInt_FromLong(perf__constants[i].value); ++ obj = _PyLong_FromLong(perf__constants[i].value); + if (obj == NULL) + goto error; + PyDict_SetItemString(dict, perf__constants[i].name, obj); +@@ -1280,6 +1336,9 @@ PyMODINIT_FUNC initperf(void) + error: + if (PyErr_Occurred()) + PyErr_SetString(PyExc_ImportError, "perf: Init failed!"); ++#if PY_MAJOR_VERSION >= 3 ++ return module; ++#endif + } + + /* +diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c +index f03fa7a835a1..8db28d4ff4b6 100644 +--- a/tools/perf/util/scripting-engines/trace-event-python.c ++++ b/tools/perf/util/scripting-engines/trace-event-python.c +@@ -50,7 +50,37 @@ + #include "print_binary.h" + #include "stat.h" + ++#if PY_MAJOR_VERSION < 3 ++#define _PyUnicode_FromString(arg) \ ++ PyString_FromString(arg) ++#define _PyUnicode_FromStringAndSize(arg1, arg2) \ ++ PyString_FromStringAndSize((arg1), (arg2)) ++#define _PyBytes_FromStringAndSize(arg1, arg2) \ ++ PyString_FromStringAndSize((arg1), (arg2)) ++#define _PyLong_FromLong(arg) \ ++ PyInt_FromLong(arg) ++#define _PyLong_AsLong(arg) \ ++ PyInt_AsLong(arg) ++#define _PyCapsule_New(arg1, arg2, arg3) \ ++ PyCObject_FromVoidPtr((arg1), (arg2)) ++ + PyMODINIT_FUNC initperf_trace_context(void); ++#else ++#define _PyUnicode_FromString(arg) \ ++ PyUnicode_FromString(arg) ++#define _PyUnicode_FromStringAndSize(arg1, arg2) \ ++ PyUnicode_FromStringAndSize((arg1), (arg2)) ++#define _PyBytes_FromStringAndSize(arg1, arg2) \ ++ PyBytes_FromStringAndSize((arg1), (arg2)) ++#define _PyLong_FromLong(arg) \ ++ PyLong_FromLong(arg) ++#define _PyLong_AsLong(arg) \ ++ PyLong_AsLong(arg) ++#define _PyCapsule_New(arg1, arg2, arg3) \ ++ PyCapsule_New((arg1), (arg2), (arg3)) ++ ++PyMODINIT_FUNC PyInit_perf_trace_context(void); ++#endif + + #define TRACE_EVENT_TYPE_MAX \ + ((1 << (sizeof(unsigned short) * 8)) - 1) +@@ -136,7 +166,7 @@ static int get_argument_count(PyObject *handler) + PyObject *arg_count_obj = PyObject_GetAttrString(code_obj, + "co_argcount"); + if (arg_count_obj) { +- arg_count = (int) PyInt_AsLong(arg_count_obj); ++ arg_count = (int) _PyLong_AsLong(arg_count_obj); + Py_DECREF(arg_count_obj); + } + Py_DECREF(code_obj); +@@ -183,10 +213,10 @@ static void define_value(enum print_arg_type field_type, + + value = eval_flag(field_value); + +- PyTuple_SetItem(t, n++, PyString_FromString(ev_name)); +- PyTuple_SetItem(t, n++, PyString_FromString(field_name)); +- PyTuple_SetItem(t, n++, PyInt_FromLong(value)); +- PyTuple_SetItem(t, n++, PyString_FromString(field_str)); ++ PyTuple_SetItem(t, n++, _PyUnicode_FromString(ev_name)); ++ PyTuple_SetItem(t, n++, _PyUnicode_FromString(field_name)); ++ PyTuple_SetItem(t, n++, _PyLong_FromLong(value)); ++ PyTuple_SetItem(t, n++, _PyUnicode_FromString(field_str)); + + try_call_object(handler_name, t); + +@@ -224,10 +254,10 @@ static void define_field(enum print_arg_type field_type, + if (!t) + Py_FatalError("couldn't create Python tuple"); + +- PyTuple_SetItem(t, n++, PyString_FromString(ev_name)); +- PyTuple_SetItem(t, n++, PyString_FromString(field_name)); ++ PyTuple_SetItem(t, n++, _PyUnicode_FromString(ev_name)); ++ PyTuple_SetItem(t, n++, _PyUnicode_FromString(field_name)); + if (field_type == PRINT_FLAGS) +- PyTuple_SetItem(t, n++, PyString_FromString(delim)); ++ PyTuple_SetItem(t, n++, _PyUnicode_FromString(delim)); + + try_call_object(handler_name, t); + +@@ -326,12 +356,12 @@ static PyObject *get_field_numeric_entry(struct event_format *event, + if (field->flags & FIELD_IS_SIGNED) { + if ((long long)val >= LONG_MIN && + (long long)val <= LONG_MAX) +- obj = PyInt_FromLong(val); ++ obj = _PyLong_FromLong(val); + else + obj = PyLong_FromLongLong(val); + } else { + if (val <= LONG_MAX) +- obj = PyInt_FromLong(val); ++ obj = _PyLong_FromLong(val); + else + obj = PyLong_FromUnsignedLongLong(val); + } +@@ -390,9 +420,9 @@ static PyObject *python_process_callchain(struct perf_sample *sample, + pydict_set_item_string_decref(pysym, "end", + PyLong_FromUnsignedLongLong(node->sym->end)); + pydict_set_item_string_decref(pysym, "binding", +- PyInt_FromLong(node->sym->binding)); ++ _PyLong_FromLong(node->sym->binding)); + pydict_set_item_string_decref(pysym, "name", +- PyString_FromStringAndSize(node->sym->name, ++ _PyUnicode_FromStringAndSize(node->sym->name, + node->sym->namelen)); + pydict_set_item_string_decref(pyelem, "sym", pysym); + } +@@ -407,7 +437,7 @@ static PyObject *python_process_callchain(struct perf_sample *sample, + dsoname = map->dso->name; + } + pydict_set_item_string_decref(pyelem, "dso", +- PyString_FromString(dsoname)); ++ _PyUnicode_FromString(dsoname)); + } + + callchain_cursor_advance(&callchain_cursor); +@@ -484,16 +514,16 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample, + if (!dict_sample) + Py_FatalError("couldn't create Python dictionary"); + +- pydict_set_item_string_decref(dict, "ev_name", PyString_FromString(perf_evsel__name(evsel))); +- pydict_set_item_string_decref(dict, "attr", PyString_FromStringAndSize( ++ pydict_set_item_string_decref(dict, "ev_name", _PyUnicode_FromString(perf_evsel__name(evsel))); ++ pydict_set_item_string_decref(dict, "attr", _PyUnicode_FromStringAndSize( + (const char *)&evsel->attr, sizeof(evsel->attr))); + + pydict_set_item_string_decref(dict_sample, "pid", +- PyInt_FromLong(sample->pid)); ++ _PyLong_FromLong(sample->pid)); + pydict_set_item_string_decref(dict_sample, "tid", +- PyInt_FromLong(sample->tid)); ++ _PyLong_FromLong(sample->tid)); + pydict_set_item_string_decref(dict_sample, "cpu", +- PyInt_FromLong(sample->cpu)); ++ _PyLong_FromLong(sample->cpu)); + pydict_set_item_string_decref(dict_sample, "ip", + PyLong_FromUnsignedLongLong(sample->ip)); + pydict_set_item_string_decref(dict_sample, "time", +@@ -503,17 +533,17 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample, + set_sample_read_in_dict(dict_sample, sample, evsel); + pydict_set_item_string_decref(dict, "sample", dict_sample); + +- pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize( ++ pydict_set_item_string_decref(dict, "raw_buf", _PyBytes_FromStringAndSize( + (const char *)sample->raw_data, sample->raw_size)); + pydict_set_item_string_decref(dict, "comm", +- PyString_FromString(thread__comm_str(al->thread))); ++ _PyUnicode_FromString(thread__comm_str(al->thread))); + if (al->map) { + pydict_set_item_string_decref(dict, "dso", +- PyString_FromString(al->map->dso->name)); ++ _PyUnicode_FromString(al->map->dso->name)); + } + if (al->sym) { + pydict_set_item_string_decref(dict, "symbol", +- PyString_FromString(al->sym->name)); ++ _PyUnicode_FromString(al->sym->name)); + } + + pydict_set_item_string_decref(dict, "callchain", callchain); +@@ -573,9 +603,9 @@ static void python_process_tracepoint(struct perf_sample *sample, + scripting_context->event_data = data; + scripting_context->pevent = evsel->tp_format->pevent; + +- context = PyCObject_FromVoidPtr(scripting_context, NULL); ++ context = _PyCapsule_New(scripting_context, NULL, NULL); + +- PyTuple_SetItem(t, n++, PyString_FromString(handler_name)); ++ PyTuple_SetItem(t, n++, _PyUnicode_FromString(handler_name)); + PyTuple_SetItem(t, n++, context); + + /* ip unwinding */ +@@ -584,18 +614,18 @@ static void python_process_tracepoint(struct perf_sample *sample, + Py_INCREF(callchain); + + if (!dict) { +- PyTuple_SetItem(t, n++, PyInt_FromLong(cpu)); +- PyTuple_SetItem(t, n++, PyInt_FromLong(s)); +- PyTuple_SetItem(t, n++, PyInt_FromLong(ns)); +- PyTuple_SetItem(t, n++, PyInt_FromLong(pid)); +- PyTuple_SetItem(t, n++, PyString_FromString(comm)); ++ PyTuple_SetItem(t, n++, _PyLong_FromLong(cpu)); ++ PyTuple_SetItem(t, n++, _PyLong_FromLong(s)); ++ PyTuple_SetItem(t, n++, _PyLong_FromLong(ns)); ++ PyTuple_SetItem(t, n++, _PyLong_FromLong(pid)); ++ PyTuple_SetItem(t, n++, _PyUnicode_FromString(comm)); + PyTuple_SetItem(t, n++, callchain); + } else { +- pydict_set_item_string_decref(dict, "common_cpu", PyInt_FromLong(cpu)); +- pydict_set_item_string_decref(dict, "common_s", PyInt_FromLong(s)); +- pydict_set_item_string_decref(dict, "common_ns", PyInt_FromLong(ns)); +- pydict_set_item_string_decref(dict, "common_pid", PyInt_FromLong(pid)); +- pydict_set_item_string_decref(dict, "common_comm", PyString_FromString(comm)); ++ pydict_set_item_string_decref(dict, "common_cpu", _PyLong_FromLong(cpu)); ++ pydict_set_item_string_decref(dict, "common_s", _PyLong_FromLong(s)); ++ pydict_set_item_string_decref(dict, "common_ns", _PyLong_FromLong(ns)); ++ pydict_set_item_string_decref(dict, "common_pid", _PyLong_FromLong(pid)); ++ pydict_set_item_string_decref(dict, "common_comm", _PyUnicode_FromString(comm)); + pydict_set_item_string_decref(dict, "common_callchain", callchain); + } + for (field = event->format.fields; field; field = field->next) { +@@ -614,7 +644,7 @@ static void python_process_tracepoint(struct perf_sample *sample, + } + if (field->flags & FIELD_IS_STRING && + is_printable_array(data + offset, len)) { +- obj = PyString_FromString((char *) data + offset); ++ obj = _PyUnicode_FromString((char *) data + offset); + } else { + obj = PyByteArray_FromStringAndSize((const char *) data + offset, len); + field->flags &= ~FIELD_IS_STRING; +@@ -664,7 +694,7 @@ static PyObject *tuple_new(unsigned int sz) + static int tuple_set_u64(PyObject *t, unsigned int pos, u64 val) + { + #if BITS_PER_LONG == 64 +- return PyTuple_SetItem(t, pos, PyInt_FromLong(val)); ++ return PyTuple_SetItem(t, pos, _PyLong_FromLong(val)); + #endif + #if BITS_PER_LONG == 32 + return PyTuple_SetItem(t, pos, PyLong_FromLongLong(val)); +@@ -673,12 +703,12 @@ static int tuple_set_u64(PyObject *t, unsigned int pos, u64 val) + + static int tuple_set_s32(PyObject *t, unsigned int pos, s32 val) + { +- return PyTuple_SetItem(t, pos, PyInt_FromLong(val)); ++ return PyTuple_SetItem(t, pos, _PyLong_FromLong(val)); + } + + static int tuple_set_string(PyObject *t, unsigned int pos, const char *s) + { +- return PyTuple_SetItem(t, pos, PyString_FromString(s)); ++ return PyTuple_SetItem(t, pos, _PyUnicode_FromString(s)); + } + + static int python_export_evsel(struct db_export *dbe, struct perf_evsel *evsel) +@@ -1024,8 +1054,8 @@ process_stat(struct perf_evsel *counter, int cpu, int thread, u64 tstamp, + return; + } + +- PyTuple_SetItem(t, n++, PyInt_FromLong(cpu)); +- PyTuple_SetItem(t, n++, PyInt_FromLong(thread)); ++ PyTuple_SetItem(t, n++, _PyLong_FromLong(cpu)); ++ PyTuple_SetItem(t, n++, _PyLong_FromLong(thread)); + + tuple_set_u64(t, n++, tstamp); + tuple_set_u64(t, n++, count->val); +@@ -1207,27 +1237,58 @@ static void set_table_handlers(struct tables *tables) + SET_TABLE_HANDLER(call_return); + } + ++#if PY_MAJOR_VERSION < 3 ++static void _free_command_line(const char **command_line, int num) ++{ ++ free(command_line); ++} ++#else ++static void _free_command_line(wchar_t **command_line, int num) ++{ ++ int i; ++ for (i = 0; i < num; i++) ++ PyMem_RawFree(command_line[i]); ++ free(command_line); ++} ++#endif ++ ++ + /* + * Start trace script + */ + static int python_start_script(const char *script, int argc, const char **argv) + { + struct tables *tables = &tables_global; ++#if PY_MAJOR_VERSION < 3 + const char **command_line; ++#else ++ wchar_t **command_line; ++#endif + char buf[PATH_MAX]; + int i, err = 0; + FILE *fp; + ++#if PY_MAJOR_VERSION < 3 + command_line = malloc((argc + 1) * sizeof(const char *)); + command_line[0] = script; + for (i = 1; i < argc + 1; i++) + command_line[i] = argv[i - 1]; ++#else ++ command_line = malloc((argc + 1) * sizeof(wchar_t *)); ++ command_line[0] = Py_DecodeLocale(script, NULL); ++ for (i = 1; i < argc + 1; i++) ++ command_line[i] = Py_DecodeLocale(argv[i - 1], NULL); ++#endif + + Py_Initialize(); + ++#if PY_MAJOR_VERSION < 3 + initperf_trace_context(); +- + PySys_SetArgv(argc + 1, (char **)command_line); ++#else ++ PyInit_perf_trace_context(); ++ PySys_SetArgv(argc + 1, command_line); ++#endif + + fp = fopen(script, "r"); + if (!fp) { +@@ -1257,12 +1318,12 @@ static int python_start_script(const char *script, int argc, const char **argv) + goto error; + } + +- free(command_line); ++ _free_command_line(command_line, argc + 1); + + return err; + error: + Py_Finalize(); +- free(command_line); ++ _free_command_line(command_line, argc + 1); + + return err; + } +diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py +index 23f1bf175179..a5f9e236cc71 100644 +--- a/tools/perf/util/setup.py ++++ b/tools/perf/util/setup.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python2 ++#!/usr/bin/python + + from os import getenv + +@@ -37,11 +37,11 @@ build_tmp = getenv('PYTHON_EXTBUILD_TMP') + libtraceevent = getenv('LIBTRACEEVENT') + libapikfs = getenv('LIBAPI') + +-ext_sources = [f.strip() for f in file('util/python-ext-sources') ++ext_sources = [f.strip() for f in open('util/python-ext-sources') + if len(f.strip()) > 0 and f[0] != '#'] + + # use full paths with source files +-ext_sources = map(lambda x: '%s/%s' % (src_perf, x) , ext_sources) ++ext_sources = list(map(lambda x: '%s/%s' % (src_perf, x) , ext_sources)) + + perf = Extension('perf', + sources = ext_sources, +-- +2.17.1 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-rpmsg-Add-message-to-be-able-to-configure-RPMSG_VIRT.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-rpmsg-Add-message-to-be-able-to-configure-RPMSG_VIRT.patch new file mode 100644 index 00000000..8c0a2af7 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0001-rpmsg-Add-message-to-be-able-to-configure-RPMSG_VIRT.patch @@ -0,0 +1,27 @@ +From 1cdbf4ed4717eefa2b6237c1e63e351b62990522 Mon Sep 17 00:00:00 2001 +From: Dien Pham <dien.pham.ry@renesas.com> +Date: Fri, 23 Feb 2018 18:29:32 +0700 +Subject: [PATCH] rpmsg: Add message to be able to configure RPMSG_VIRTIO from + defconfig + +Signed-off-by: Dien Pham <dien.pham.ry@renesas.com> +--- + drivers/rpmsg/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/rpmsg/Kconfig b/drivers/rpmsg/Kconfig +index 0fe6eac..5b1e61b 100644 +--- a/drivers/rpmsg/Kconfig ++++ b/drivers/rpmsg/Kconfig +@@ -47,7 +47,7 @@ config RPMSG_QCOM_SMD + platforms. + + config RPMSG_VIRTIO +- tristate ++ tristate "Enable remote processor message and virtual I/O configure" + select RPMSG + select VIRTIO + +-- +1.9.1 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-ADSP-add-ADSP-sound-driver-source.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-ADSP-add-ADSP-sound-driver-source.patch new file mode 100644 index 00000000..14719fba --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0002-ADSP-add-ADSP-sound-driver-source.patch @@ -0,0 +1,7204 @@ +From 829c17a722611c39cda6926f0fac46fa586c70ef Mon Sep 17 00:00:00 2001 +From: tienphitran <tien.tran.uw@renesas.com> +Date: Mon, 17 Jun 2019 17:04:02 +0700 +Subject: [PATCH 2/6] ADSP: add ADSP sound driver source + +Signed-off-by: tienphitran <tien.tran.uw@renesas.com> + +diff --git a/include/adsp_drv/xf-adsp-drv-ext.h b/include/adsp_drv/xf-adsp-drv-ext.h +new file mode 100644 +index 0000000..6c3dbc0 +--- /dev/null ++++ b/include/adsp_drv/xf-adsp-drv-ext.h +@@ -0,0 +1,58 @@ ++/***************************************************************************** ++ * \file xf-adsp-driver-ext.h ++ * \brief Header file for ADSP driver extension part ++ * \addtogroup ADSP Driver ++ ****************************************************************************** ++ * \date Oct. 21, 2017 ++ * \author Renesas Electronics Corporation ++ ****************************************************************************** ++ * \par Copyright ++ * ++ * Copyright(c) 2016 Renesas Electoronics Corporation ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a copy ++ * of this software and associated documentation files (the "Software"), to deal ++ * in the Software without restriction, including without limitation the rights ++ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++ * copies of the Software, and to permit persons to whom the Software is ++ * furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included in ++ * all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ++ * THE SOFTWARE. ++ ******************************************************************************/ ++ ++#ifndef __XF_ADSP_DRV_EXT_H ++#define __XF_ADSP_DRV_EXT_H ++ ++/*********************************************************** ++ * Extension client APIs ++ * ********************************************************/ ++ ++struct xf_adsp_base_cmd { ++ /* register new client for ADSP base control */ ++ int (*client_register)(void **private_data); ++ /* unregister client */ ++ int (*client_unregister)(void *private_data); ++ /* get data from proxy */ ++ int (*recv)(void *private_data, void *buf); ++ /* send data to proxy */ ++ int (*send)(void *private_data, void *buf); ++ /* wait the valid message in the response queue */ ++ int (*poll)(void *private_data, int *condition); ++}; ++ ++/* create ADSP base control data */ ++int xf_adsp_base_create(struct xf_adsp_base_cmd *cmd); ++ ++/* destroy ADSP base control data */ ++int xf_adsp_base_destroy(void); ++ ++#endif +diff --git a/sound/soc/adsp/Kconfig b/sound/soc/adsp/Kconfig +new file mode 100644 +index 0000000..605261f +--- /dev/null ++++ b/sound/soc/adsp/Kconfig +@@ -0,0 +1,14 @@ ++## SoC for ADSP driver configuration ++menu "ASoC ADSP driver" ++ ++config SND_SOC_ADSP ++ tristate "SoC Audio for R-Car ADSP" ++ select SND_SIMPLE_CARD ++ select SND_SIMPLE_SCU_CARD ++ select SND_AUDIO_GRAPH_CARD ++ select SND_AUDIO_GRAPH_SCU_CARD ++ default y ++ help ++ This option enables ALSA ADSP sound supports ADSP module ++ ++endmenu +diff --git a/sound/soc/adsp/Makefile b/sound/soc/adsp/Makefile +new file mode 100644 +index 0000000..8277fdb +--- /dev/null ++++ b/sound/soc/adsp/Makefile +@@ -0,0 +1,3 @@ ++## Makefile for SoC ADSP driver ++snd-soc-adsp-objs := xf-adsp-alsa.o xf-adsp-base.o ++obj-$(CONFIG_SND_SOC_ADSP) += snd-soc-adsp.o +diff --git a/sound/soc/adsp/xf-adsp-alsa.c b/sound/soc/adsp/xf-adsp-alsa.c +new file mode 100644 +index 0000000..493ff84 +--- /dev/null ++++ b/sound/soc/adsp/xf-adsp-alsa.c +@@ -0,0 +1,3939 @@ ++/** *************************************************************************** ++ * \file xf-adsp-alsa.c ++ * \brief Source file for ADSP ALSA Driver ++ * \addtogroup ADSP Driver ++ ****************************************************************************** ++ * \date Oct. 21, 2017 ++ * \author Renesas Electronics Corporation ++ ****************************************************************************** ++ * \par Copyright ++ * ++ * Copyright(c) 2016 Renesas Electoronics Corporation ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the "Software"), ++ * to deal in the Software without restriction, including without limitation ++ * the rights to use, copy, modify, merge, publish, distribute, sublicense, ++ * and/or sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included in ++ * all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ++ * DEALINGS IN THE SOFTWARE. ++ *****************************************************************************/ ++ ++#include <linux/slab.h> ++#include <linux/platform_device.h> ++#include <linux/module.h> ++#include <linux/io.h> ++#include <linux/sched/signal.h> ++#include <linux/delay.h> ++#include <sound/core.h> ++#include <sound/control.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/pcm-indirect.h> ++#include <linux/time.h> ++ ++#include "xf-adsp-base.h" ++ ++/* Name of Volume control for playback */ ++#define PLAYBACK_VOLUME_CTR_NAME "PlaybackVolume" ++ ++/* Name of Volume control for capture */ ++#define CAPTURE_VOLUME_CTR_NAME "CaptureVolume" ++ ++/* Name of Sample Rate control for playback */ ++#define PLAYBACK_OUT_RATE_CTR_NAME "PlaybackOutRate" ++ ++/* Name of Output Channel control for playback */ ++#define PLAYBACK_OUT_CHANNEL_CTR_NAME "PlaybackOutChannel" ++ ++/* Name of Sample Rate control for capture */ ++#define CAPTURE_IN_RATE_CTR_NAME "CaptureInRate" ++ ++/* Name of Equalizer parameters control for playback */ ++#define PLAYBACK_EQZ_CTR_NAME "PlaybackEQZControl" ++ ++/* Name of Equalizer parameters control for capture */ ++#define CAPTURE_EQZ_CTR_NAME "CaptureEQZControl" ++ ++/* Name of Equalizer Switch control for playback */ ++#define PLAYBACK_EQZ_SWITCH_CTR_NAME "PlaybackEQZSwitch" ++ ++/* Name of Equalizer Switch control for capture */ ++#define CAPTURE_EQZ_SWITCH_CTR_NAME "CaptureEQZSwitch" ++ ++/* Name of Volume control for TDM playback */ ++#define TDM_PLAYBACK_VOLUME_CTR_NAME "TDMPlaybackVolume" ++ ++/* Name of Volume control for TDM capture */ ++#define TDM_CAPTURE_VOLUME_CTR_NAME "TDMCaptureVolume" ++ ++/* Name of Sample Rate control for TDM playback */ ++#define TDM_PLAYBACK_OUT_RATE_CTR_NAME "TDMPlaybackOutRate" ++ ++/* Name of Sample Rate control for TDM capture */ ++#define TDM_CAPTURE_IN_RATE_CTR_NAME "TDMCaptureInRate" ++ ++/* Prefix of Playback control name */ ++#define PREFIX_OF_PLAYBACK_CTR_NAME PLAYBACK_VOLUME_CTR_NAME[0] ++ ++/* Prefix of Capture control name */ ++#define PREFIX_OF_CAPTURE_CTR_NAME CAPTURE_VOLUME_CTR_NAME[0] ++ ++/* Prefix of TDM control name */ ++#define PREFIX_OF_TDM_CTR_NAME TDM_PLAYBACK_VOLUME_CTR_NAME[0] ++ ++/* Prefix of TDM playback */ ++#define TDM_PLAYBACK TDM_PLAYBACK_VOLUME_CTR_NAME[3] ++ ++/* Prefix of TDM record */ ++#define TDM_CAPTURE TDM_CAPTURE_VOLUME_CTR_NAME[3] ++ ++/* Number of control for playback & capture */ ++#define RDR_CONTROL_NUM (9) ++ ++/* Number of controls for TDM */ ++#define TDM_CONTROL_NUM (4) ++ ++/* Indicate playback stream */ ++#define DIRECT_PLAYBACK (0) ++ ++/* Indicate capture stream */ ++#define DIRECT_CAPTURE (1) ++ ++/* Indicate stream number */ ++#define DIRECT_NUM (2) ++ ++/* Supported frame size for playback/record function in driver */ ++#define FRAME_SIZE (1024) ++ ++/* Supported frame size for TDM playback/record function in driver */ ++#define TDM_FRAME_SIZE (1024) ++ ++/* Supported sample rate in driver */ ++#define SND_ADSP_SAMPLE_RATES (SNDRV_PCM_RATE_32000 | \ ++ SNDRV_PCM_RATE_44100 | \ ++ SNDRV_PCM_RATE_48000) ++ ++/* Supported PCM width in driver */ ++#define SND_ADSP_PCM_WIDTHS (SNDRV_PCM_FMTBIT_S16_LE | \ ++ SNDRV_PCM_FMTBIT_S24_LE) ++ ++/* Macro to control DAI index */ ++/* DAI 0 index for playback/record functions of stereo/mono formats */ ++#define RDR_DAI_IDX0 (0) ++ ++/* DAI 1 index for playback/record functions of stereo/mono formats */ ++#define RDR_DAI_IDX1 (1) ++ ++/* DAI 2 index for playback/record functions of stereo/mono formats */ ++#define RDR_DAI_IDX2 (2) ++ ++/* DAI 3 index for playback/record functions of stereo/mono formats */ ++#define RDR_DAI_IDX3 (3) ++ ++/* DAI 4 index for playback/record functions of TDM formats */ ++#define TDM_DAI_IDX (4) ++ ++/* Maximum number of DAI supported by driver */ ++#define MAX_DAI_IDX (5) ++ ++/* Renderer/Capture software information */ ++/* Minimum channel number supported */ ++#define MIN_CHANNEL (1) ++ ++/* Maximum channel number supported */ ++#define MAX_CHANNEL (2) ++ ++/* Minimum buffer size in byte */ ++#define MIN_BUF_SIZE (FRAME_SIZE * MIN_CHANNEL * 2) ++ ++/* Maximum buffer size in byte */ ++#define MAX_BUF_SIZE (FRAME_SIZE * MAX_CHANNEL * 4) ++ ++/* Minimum numbers of period in the buffer */ ++#define MIN_PERIOD (1) ++ ++/* Maximum numbers of period in the buffer */ ++#define MAX_PERIOD (4) ++ ++/* Maximun numbers of bytes in ALSA buffer */ ++#define MAX_BUFFER_BYTES (MAX_PERIOD * MAX_BUF_SIZE) ++ ++/* TDM software information */ ++/*< Minimum channel number supported in TDM plugin */ ++#define TDM_MIN_CHANNEL (6) ++ ++/* Maximum channel number supported in TDM plugin */ ++#define TDM_MAX_CHANNEL (8) ++ ++/* Minimum buffer size in byte for TDM format */ ++#define TDM_MIN_BUF_SIZE (TDM_FRAME_SIZE * TDM_MIN_CHANNEL * 2) ++ ++/* Maximum buffer size in byte for TDM format */ ++#define TDM_MAX_BUF_SIZE (TDM_FRAME_SIZE * TDM_MAX_CHANNEL * 4) ++ ++/* Minimum numbers of period in the buffer for TDM format */ ++#define TDM_MIN_PERIOD (1) ++ ++/* Maximum numbers of period in the buffer for TDM format */ ++#define TDM_MAX_PERIOD (4) ++ ++/* Maximum numbers of bytes in ALSA buffer for TDM format */ ++#define TDM_MAX_BUFFER_BYTES (TDM_MAX_PERIOD * TDM_MAX_BUF_SIZE) ++ ++/* Volume scale used when user set */ ++#define VOLUME_SCALE (100) ++ ++/* Maximum element in Equalizer parameter control */ ++#define MAX_EQZ_PARAM_NUMBER (55) ++ ++/* Equalizer control is disabled */ ++#define EQZ_OFF (0) ++ ++/* Equalizer control is enabled */ ++#define EQZ_ON (1) ++ ++/* Component status */ ++/* Handle state is NULL */ ++#define XF_HANDLE_NULL (0) ++ ++/* Handle state is CREATED after creating handle successfully */ ++#define XF_HANDLE_CREATED BIT(0) ++ ++/* Handle state is READY after finishing handle init */ ++#define XF_HANDLE_READY BIT(1) ++ ++/* channels */ ++/* Mono stream */ ++#define MONAURAL (1) ++ ++/* Stereo stream */ ++#define STEREO (2) ++ ++/* define number of bytes in a sample of 24 bits format types */ ++/* store 24 bits data in 4 bytes LE */ ++#define FMTBIT_S24_LE_BYTES_PER_SAMPLE (4) ++ ++/* store 24 bits data in 3 bytes LE */ ++#define FMTBIT_S24_3LE_BYTES_PER_SAMPLE (3) ++ ++/* helper macro to get bytes per sample number */ ++#define BYTES_PER_SAMPLE(fmt) (FMTBIT_##fmt##_BYTES_PER_SAMPLE) ++ ++/* check component is created */ ++#define COMPONENT_IS_CREATED(n) (((n & XF_HANDLE_CREATED) != 0) ? TRUE : FALSE) ++ ++/* check component is ready */ ++#define COMPONENT_IS_READY(n) (((n & XF_HANDLE_READY) != 0) ? TRUE : FALSE) ++ ++/* indicator of stream order */ ++#define MIX_UNUSED (0) ++#define FIRST_RUN (2) ++#define SECOND_RUN (1) ++ ++/* check MIX usage */ ++#define MIX_ENABLED(mix_ctl) ((mix_ctl == SECOND_RUN) ? TRUE : FALSE) ++ ++/******************************************************************* ++ * base structures for ADSP ALSA driver ++ * ****************************************************************/ ++ ++/** \struct snd_adsp_control ++ * \brief Structure stores parameters from user ++ */ ++struct snd_adsp_control { ++ /* Volume rate for playback/record */ ++ int vol_rate[DIRECT_NUM][MAX_DAI_IDX - 1]; ++ ++ /* Volume rate for TDM playback/TDM record */ ++ int tdm_vol_rate[DIRECT_NUM]; ++ ++ /* Out sample rate with Renderer, in sample rate with Capture */ ++ int sample_rate[DIRECT_NUM][MAX_DAI_IDX - 1]; ++ ++ /* Out sample rate for TDM Renderer, in sample rate for TDM Capture */ ++ int tdm_sample_rate[DIRECT_NUM]; ++ ++ /* Output channel of playback */ ++ int rdr_out_ch[MAX_DAI_IDX - 1]; ++ ++ /* Equalizer parameters */ ++ struct xf_adsp_equalizer_params eqz_params[DIRECT_NUM][MAX_DAI_IDX - 1]; ++ ++ /* Equalizer switch */ ++ int eqz_switch[DIRECT_NUM][MAX_DAI_IDX - 1]; ++ ++ /* Indicator of MIX usage */ ++ int mix_usage; ++}; ++ ++/** \struct snd_adsp_base_info ++ * \brief Structure stores some base information of a stream ++ */ ++struct snd_adsp_base_info { ++ /* high resolution timer data */ ++ struct hrtimer hrtimer; ++ ++ /* kernel time value in nanosecond */ ++ ktime_t ktime; ++ ++ /* save interrupt state before getting lock */ ++ unsigned long flag; ++ ++ /* high resolution timer state */ ++ int hrt_state; ++ ++ /* target handle id of ALSA driver */ ++ int handle_id; ++ ++ /* data buffer */ ++ char *buffer[XF_BUF_POOL_SIZE]; ++ ++ /* size of each allocated data buffer */ ++ int buf_bytes; ++ ++ /* data index of buffer */ ++ int buf_idx; ++ ++ /* queue index of buffer */ ++ int buf_queue; ++ ++ /* HW index in bytes */ ++ int hw_idx; ++ ++ /* number of bytes in a period */ ++ int period_bytes; ++ ++ /* substream runtime object */ ++ struct snd_pcm_substream *substream; ++ ++ /* indirect PCM data transfer */ ++ struct snd_pcm_indirect pcm_indirect; ++ ++ /* spinlock data */ ++ spinlock_t lock; ++ ++ /* runtime error indicator */ ++ int runtime_err; ++}; ++ ++/** \struct snd_adsp_playback ++ * \brief Structure stores data for playback function ++ */ ++struct snd_adsp_playback { ++ /* base information of stream */ ++ struct snd_adsp_base_info base; ++ ++ /* Renderer component data */ ++ struct xf_adsp_renderer *renderer; ++ ++ /* Equalizer component data */ ++ struct xf_adsp_equalizer *equalizer; ++ ++ /* Renderer component state */ ++ int rdr_state; ++ ++ /* Equalizer component state */ ++ int eqz_state; ++}; ++ ++/** \struct snd_adsp_record ++ * \brief Structure stores data for record function ++ */ ++struct snd_adsp_record { ++ /* base information of stream */ ++ struct snd_adsp_base_info base; ++ ++ /* Capture component data */ ++ struct xf_adsp_capture *capture; ++ ++ /* Equalizer component data */ ++ struct xf_adsp_equalizer *equalizer; ++ ++ /* Capture component state */ ++ int cap_state; ++ ++ /* Equalizer component state */ ++ int eqz_state; ++}; ++ ++/** \struct snd_adsp_tdm_playback ++ * \brief Structure stores data for TDM playback function ++ */ ++struct snd_adsp_tdm_playback { ++ /* base information of stream */ ++ struct snd_adsp_base_info base; ++ ++ /* TDM Renderer component data */ ++ struct xf_adsp_tdm_renderer *tdm_renderer; ++ ++ /* TDM Renderer component state */ ++ int state; ++}; ++ ++/** \struct snd_adsp_tdm_record ++ * \brief Structure stores data for TDM record function ++ */ ++struct snd_adsp_tdm_record { ++ /* base information of stream */ ++ struct snd_adsp_base_info base; ++ ++ /* TDM Capture component data */ ++ struct xf_adsp_tdm_capture *tdm_capture; ++ ++ /* TDM Capture component state */ ++ int state; ++}; ++ ++/** \struct snd_adsp_card ++ * \brief Structure stores data for ALSA sound card ++ */ ++struct snd_adsp_card { ++ /* playback data */ ++ struct snd_adsp_playback *playback[MAX_DAI_IDX - 1]; ++ ++ /* record data */ ++ struct snd_adsp_record *record[MAX_DAI_IDX - 1]; ++ ++ /* TDM playback data */ ++ struct snd_adsp_tdm_playback *tdm_playback; ++ ++ /* TDM record data */ ++ struct snd_adsp_tdm_record *tdm_record; ++ ++ /* Structure contains params information for control */ ++ struct snd_adsp_control ctr_if; ++}; ++ ++/** HW configuration of ALSA ADSP card for Renderer/Capture */ ++static struct snd_pcm_hardware snd_pcm_adsp_hw = { ++ .info = (SNDRV_PCM_INFO_INTERLEAVED /* PRQA S 1053 14 */ ++ | SNDRV_PCM_INFO_RESUME ++ | SNDRV_PCM_INFO_BLOCK_TRANSFER ++ | SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), ++ .formats = SND_ADSP_PCM_WIDTHS, ++ .rates = SND_ADSP_SAMPLE_RATES, ++ .rate_min = 32000, ++ .rate_max = 48000, ++ .channels_min = MIN_CHANNEL, ++ .channels_max = MAX_CHANNEL, ++ ++ /* maximum buffer size in bytes */ ++ .buffer_bytes_max = MAX_BUFFER_BYTES, ++ ++ /* minimum size of the periods (frame) in bytes */ ++ .period_bytes_min = MIN_BUF_SIZE, ++ ++ /* maximum size of the periods (frame) in bytes */ ++ .period_bytes_max = MAX_BUF_SIZE, ++ ++ /* minimum periods (frames) in a buffer */ ++ .periods_min = MIN_PERIOD, ++ ++ /* maximum periods (frames) in a buffer */ ++ .periods_max = MAX_PERIOD, ++}; ++ ++/* HW configuration of ALSA ADSP card for TDM */ ++static struct snd_pcm_hardware snd_pcm_adsp_tdm_hw = { ++ .info = (SNDRV_PCM_INFO_INTERLEAVED /* PRQA S 1053 14 */ ++ | SNDRV_PCM_INFO_RESUME ++ | SNDRV_PCM_INFO_BLOCK_TRANSFER ++ | SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), ++ .formats = SND_ADSP_PCM_WIDTHS, ++ .rates = SND_ADSP_SAMPLE_RATES, ++ .rate_min = 32000, ++ .rate_max = 48000, ++ .channels_min = TDM_MIN_CHANNEL, ++ .channels_max = TDM_MAX_CHANNEL, ++ ++ /* maximum buffer size in bytes */ ++ .buffer_bytes_max = TDM_MAX_BUFFER_BYTES, ++ ++ /* minimum size of the periods (frame) in bytes */ ++ .period_bytes_min = TDM_MIN_BUF_SIZE, ++ ++ /* maximum size of the periods (frame) in bytes */ ++ .period_bytes_max = TDM_MAX_BUF_SIZE, ++ ++ /* minimum periods (frames) in a buffer */ ++ .periods_min = TDM_MIN_PERIOD, ++ ++ /* maximum periods (frames) in a buffer */ ++ .periods_max = TDM_MAX_PERIOD, ++}; ++ ++/******************************************************************* ++ * function declaration ++ * ****************************************************************/ ++ ++static int ++snd_adsp_rdr_empty_buf_done(void *data, int opcode, int length, char *buffer); ++static int ++snd_adsp_rdr_fill_buf_done(void *data, int opcode, int length, char *buffer); ++static int ++snd_adsp_cap_empty_buf_done(void *data, int opcode, int length, char *buffer); ++static int ++snd_adsp_cap_fill_buf_done(void *data, int opcode, int length, char *buffer); ++static int ++snd_adsp_get_dai_id_from_substream(struct snd_pcm_substream *substream); ++static void * ++snd_adsp_get_drvdata_from_substream(struct snd_pcm_substream *substream); ++static struct snd_adsp_base_info * ++snd_adsp_get_base_from_substream(struct snd_pcm_substream *substream); ++static struct snd_adsp_base_info * ++snd_adsp_get_base_from_hrt(struct hrtimer *hrt); ++static enum hrtimer_restart snd_adsp_hrtimer_func(struct hrtimer *hrt); ++static int snd_adsp_playback_init(struct snd_adsp_playback **data, ++ int eqz_flag, ++ struct snd_pcm_substream *substream); ++static int snd_adsp_record_init(struct snd_adsp_record **data, ++ int eqz_flag, ++ struct snd_pcm_substream *substream); ++static int snd_adsp_playback_prepare(struct snd_adsp_playback *playback, ++ struct snd_pcm_substream *substream); ++static int snd_adsp_record_prepare(struct snd_adsp_record *record, ++ struct snd_pcm_substream *substream); ++static int snd_adsp_playback_deinit(struct snd_adsp_playback *playback); ++static int snd_adsp_record_deinit(struct snd_adsp_record *record); ++static int snd_adsp_tdm_playback_init(struct snd_adsp_tdm_playback **data, ++ struct snd_pcm_substream *substream); ++static int snd_adsp_tdm_record_init(struct snd_adsp_tdm_record **data, ++ struct snd_pcm_substream *substream); ++static int ++snd_adsp_tdm_playback_prepare(struct snd_adsp_tdm_playback *tdm_playback, ++ struct snd_pcm_substream *substream); ++static int snd_adsp_tdm_record_prepare(struct snd_adsp_tdm_record *tdm_record, ++ struct snd_pcm_substream *substream); ++static int ++snd_adsp_tdm_playback_deinit(struct snd_adsp_tdm_playback *tdm_playback); ++static int snd_adsp_tdm_record_deinit(struct snd_adsp_tdm_record *tdm_record); ++static int snd_adsp_pcm_open(struct snd_pcm_substream *substream); ++static int snd_adsp_pcm_close(struct snd_pcm_substream *substream); ++static int snd_adsp_pcm_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *hw_params); ++static int snd_adsp_pcm_hw_free(struct snd_pcm_substream *substream); ++static int snd_adsp_pcm_prepare(struct snd_pcm_substream *substream); ++static int snd_adsp_pcm_trigger(struct snd_pcm_substream *substream, int idx); ++static snd_pcm_uframes_t ++snd_adsp_pcm_pointer(struct snd_pcm_substream *substream); ++static int snd_adsp_pcm_ack(struct snd_pcm_substream *substream); ++static void snd_adsp_pcm_transfer(struct snd_pcm_substream *substream, ++ struct snd_pcm_indirect *rec, size_t bytes); ++static int snd_adsp_control_volume_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo); ++static int snd_adsp_control_volume_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int snd_adsp_control_volume_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int snd_adsp_control_eqz_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int snd_adsp_control_eqz_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo); ++static int snd_adsp_control_eqz_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int ++snd_adsp_control_eqz_switch_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int ++snd_adsp_control_eqz_switch_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo); ++static int ++snd_adsp_control_sample_rate_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int ++snd_adsp_control_sample_rate_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo); ++static int ++snd_adsp_control_sample_rate_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int ++snd_adsp_control_eqz_switch_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static void snd_adsp_get_eqz_params_from_control( ++ struct xf_adsp_equalizer_params *eqz_params, ++ struct xf_adsp_equalizer_params *eqz_ctr_params, ++ bool flag); ++static int snd_adsp_pcm_new(struct snd_soc_pcm_runtime *runtime); ++static int snd_adsp_probe(struct platform_device *pdev); ++static int snd_adsp_remove(struct platform_device *pdev); ++ ++/******************************************************************* ++ * callback function of ADSP control interface ++ * ****************************************************************/ ++/** ************************************************************************** ++ * \brief event handler callback to notify error from ADSP ++ * ++ * \param[in] data Pointer to ADSP ALSA sound card ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_event_handler(void *data) ++{ ++ struct snd_adsp_base_info *base = (struct snd_adsp_base_info *)data; ++ ++ if (base) ++ base->runtime_err = TRUE; ++ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief empty buf done callback for playback/TDM playback functions ++ * ++ * \param[in] data Pointer to ADSP ALSA sound card ++ * \param[in] opcode Opcode of message ++ * \param[in] length Length of data buffer ++ * \param[in] buffer Pointer to data buffer ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_rdr_empty_buf_done(void *data, int opcode, int length, char *buffer) ++{ ++ struct snd_adsp_base_info *base = (struct snd_adsp_base_info *)data; ++ ++ if (base) { ++ spin_lock_irqsave(&base->lock, base->flag); ++ ++ base->buf_queue++; ++ base->hw_idx += length; /* increase the DMA buffer index */ ++ ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ } ++ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief fill buf done callback for playback/TDM playback functions ++ * ++ * \param[in] data Pointer to ADSP ALSA sound card ++ * \param[in] opcode Opcode of message ++ * \param[in] length Length of data buffer ++ * \param[in] buffer Pointer to data buffer ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_rdr_fill_buf_done(void *data, int opcode, int length, char *buffer) ++{ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief empty buf done callback for record/TDM record functions ++ * ++ * \param[in] data Pointer to ADSP ALSA sound card ++ * \param[in] opcode Opcode of message ++ * \param[in] length Length of data buffer ++ * \param[in] buffer Pointer to data buffer ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_cap_empty_buf_done(void *data, int opcode, int length, char *buffer) ++{ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief fill buf done callback for record/TDM record functions ++ * ++ * \param[in] data Pointer to ADSP ALSA sound card ++ * \param[in] opcode Opcode of message ++ * \param[in] length Length of data buffer ++ * \param[in] buffer Pointer to data buffer ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_cap_fill_buf_done(void *data, int opcode, int length, char *buffer) ++{ ++ struct snd_adsp_base_info *base = (struct snd_adsp_base_info *)data; ++ ++ if (base) { ++ spin_lock_irqsave(&base->lock, base->flag); ++ ++ base->buf_queue++; ++ base->hw_idx += length; /* increase the DMA buffer index */ ++ ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ } ++ ++ return 0; ++} ++ ++/** callback functions for playback/TDM playback */ ++static struct xf_callback_func rdr_callbacks = /* PRQA S 3218 */ ++{ ++ .empty_buf_done = &snd_adsp_rdr_empty_buf_done, /* PRQA S 1053 2 */ ++ .fill_buf_done = &snd_adsp_rdr_fill_buf_done, ++ .event_handler = &snd_adsp_event_handler ++}; ++ ++/** callback functions for record/TDM record */ ++static struct xf_callback_func cap_callbacks = /* PRQA S 3218 */ ++{ ++ .empty_buf_done = &snd_adsp_cap_empty_buf_done, /* PRQA S 1053 2 */ ++ .fill_buf_done = &snd_adsp_cap_fill_buf_done, ++ .event_handler = &snd_adsp_event_handler ++}; ++ ++/******************************************************************* ++ * helper functions to get some internal data ++ * ****************************************************************/ ++ ++/** ************************************************************************** ++ * \brief Get current index of CPU DAI from runtime data of substream ++ * ++ * \param[in] substream Pointer to PCM stream data ++ * \retval id Index of current CPU DAI ++ *****************************************************************************/ ++static int ++snd_adsp_get_dai_id_from_substream(struct snd_pcm_substream *substream) ++{ ++ struct snd_soc_pcm_runtime *rtd; ++ ++ rtd = (struct snd_soc_pcm_runtime *)substream->private_data; ++ return rtd->cpu_dai->id; ++} ++ ++/** ************************************************************************** ++ * \brief Get ADSP ALSA driver's data from runtime data of substream ++ * ++ * \param[in] substream Pointer to PCM stream data ++ * \retval pointer Pointer to driver's data ++ *****************************************************************************/ ++static void * ++snd_adsp_get_drvdata_from_substream(struct snd_pcm_substream *substream) ++{ ++ struct snd_soc_pcm_runtime *rtd; ++ ++ rtd = (struct snd_soc_pcm_runtime *)substream->private_data; ++ return snd_soc_dai_get_drvdata(rtd->cpu_dai); ++} ++ ++/** ************************************************************************** ++ * \brief Get base's data of playback/record from runtime data of substream ++ * ++ * \param[in] substream Pointer to PCM stream data ++ * \retval pointer Pointer to playback/record's base data ++ *****************************************************************************/ ++static struct snd_adsp_base_info * ++snd_adsp_get_base_from_substream(struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_card *adsp_card; ++ struct snd_adsp_base_info *base; ++ int dai_idx; ++ ++ adsp_card = snd_adsp_get_drvdata_from_substream(substream); ++ ++ /* get DAI index of substream */ ++ dai_idx = snd_adsp_get_dai_id_from_substream(substream); ++ ++ /* get base data of the substream */ ++ if (dai_idx == RDR_DAI_IDX0 || dai_idx == RDR_DAI_IDX1 || ++ dai_idx == RDR_DAI_IDX2 || dai_idx == RDR_DAI_IDX3) { ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ base = !adsp_card->playback[dai_idx] ? ++ NULL : &adsp_card->playback[dai_idx]->base; ++ } else { ++ base = !adsp_card->record[dai_idx] ? ++ NULL : &adsp_card->record[dai_idx]->base; ++ } ++ } else { ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ base = !adsp_card->tdm_playback ? ++ NULL : &adsp_card->tdm_playback->base; ++ } else { ++ base = !adsp_card->tdm_record ? ++ NULL : &adsp_card->tdm_record->base; ++ } ++ } ++ ++ return base; ++} ++ ++/** *************************************************************************** ++ * \brief Get playback/record/TDM playback/TDM record's base data ++ * from hr timer data ++ * ++ * \param[in] hrt Pointer to hr timer data ++ * \retval pointer Pointer to playback/record's base data ++ *****************************************************************************/ ++static struct snd_adsp_base_info * ++snd_adsp_get_base_from_hrt(struct hrtimer *hrt) ++{ ++ return (struct snd_adsp_base_info *)hrt; ++} ++ ++/***************************************************************************** ++ * hrtimer interrupt function ++ * ***************************************************************************/ ++ ++/** ************************************************************************** ++ * \brief Interrupt function of high resolution timer ++ * ++ * \param[in] hrt Pointer to hr timer data ++ * \retval HRTIMER_RESTART Restart the timer after expire time ++ *****************************************************************************/ ++static enum hrtimer_restart snd_adsp_hrtimer_func(struct hrtimer *hrt) ++{ ++ struct snd_adsp_base_info *base = snd_adsp_get_base_from_hrt(hrt); ++ ++ spin_lock_irqsave(&base->lock, base->flag); ++ if (base->hw_idx != 0) { ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ /* update PCM status for the next period */ ++ snd_pcm_period_elapsed(base->substream); ++ } else { ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ } ++ ++ hrtimer_forward_now(hrt, base->ktime); ++ ++ return HRTIMER_RESTART; ++} ++ ++/***************************************************************************** ++ * internal functions to manage playback and record functions ++ * ***************************************************************************/ ++ ++/** ************************************************************************** ++ * \brief Initialize playback data ++ * ++ * \param[out] playback_data Pointer to store playback data ++ * \param[in] eqz_flag Flag to indicate equalizer usage ++ * \param[in] substream Pointer to substream data ++ * \retval EINVAL Failed to initialize playback data ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_playback_init(struct snd_adsp_playback **playback_data, ++ int eqz_flag, ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_playback *playback; ++ ++ /* allocate memory for playback data */ ++ playback = kmalloc(sizeof(*playback), GFP_KERNEL); ++ if (!playback) ++ return -EINVAL; ++ ++ /* init params */ ++ memset(playback, 0, sizeof(struct snd_adsp_playback)); ++ ++ /* save the playback data */ ++ *playback_data = playback; ++ ++ /* set handle state as NULL state */ ++ playback->rdr_state = XF_HANDLE_NULL; ++ playback->eqz_state = XF_HANDLE_NULL; ++ playback->base.hrt_state = XF_HANDLE_NULL; ++ ++ /* register renderer component */ ++ if (xf_adsp_renderer_create(&playback->renderer, ++ &rdr_callbacks, ++ (void *)&playback->base) < 0) ++ return -EINVAL; ++ ++ /* mark renderer component created */ ++ playback->rdr_state = XF_HANDLE_CREATED; ++ ++ /* set target handle ID as renderer ID */ ++ playback->base.handle_id = playback->renderer->handle_id; ++ ++ if (eqz_flag == EQZ_ON) { ++ /* create equalizer component when equalizer is used */ ++ if (xf_adsp_equalizer_create(&playback->equalizer, ++ &rdr_callbacks, ++ (void *)&playback->base) < 0) ++ return -EINVAL; ++ ++ /* mark equalizer component created */ ++ playback->eqz_state = XF_HANDLE_CREATED; ++ ++ /* set target handle ID as equalizer ID */ ++ playback->base.handle_id = playback->equalizer->handle_id; ++ } ++ ++ /* init lock */ ++ spin_lock_init(&playback->base.lock); ++ ++ /* save the substream data */ ++ playback->base.substream = substream; ++ ++ /* init high resolution timer for updating hw status */ ++ hrtimer_init(&playback->base.hrtimer, ++ CLOCK_MONOTONIC, ++ HRTIMER_MODE_REL); ++ ++ /* PRQA S 0563 1 */ ++ playback->base.hrtimer.function = &snd_adsp_hrtimer_func; ++ playback->base.hrt_state = XF_HANDLE_CREATED; ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Initialize record data ++ * ++ * \param[out] record_data Pointer to store record data ++ * \param[in] eqz_flag Flag to indicate equalizer usage ++ * \param[in] substream Pointer to substream data ++ * \retval -EINVAL Failed to initialize record data ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_record_init(struct snd_adsp_record **record_data, ++ int eqz_flag, ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_record *record; ++ ++ /* allocate memory for record data */ ++ record = kmalloc(sizeof(*record), GFP_KERNEL); ++ if (!record) ++ return -EINVAL; ++ ++ /* init params */ ++ memset(record, 0, sizeof(struct snd_adsp_record)); ++ ++ /* save the record data */ ++ *record_data = record; ++ ++ /* set handle state as NULL state */ ++ record->cap_state = XF_HANDLE_NULL; ++ record->eqz_state = XF_HANDLE_NULL; ++ record->base.hrt_state = XF_HANDLE_NULL; ++ ++ /* register capture component */ ++ if (xf_adsp_capture_create(&record->capture, ++ &cap_callbacks, ++ (void *)&record->base) < 0) ++ return -EINVAL; ++ ++ /* mark capture component created */ ++ record->cap_state = XF_HANDLE_CREATED; ++ ++ /* set target handle ID as capture ID */ ++ record->base.handle_id = record->capture->handle_id; ++ ++ /* create equalizer component in case of it being used */ ++ if (eqz_flag == EQZ_ON) { ++ if (xf_adsp_equalizer_create(&record->equalizer, ++ &cap_callbacks, ++ (void *)&record->base) < 0) ++ return -EINVAL; ++ ++ /* mark equalizer component created */ ++ record->eqz_state = XF_HANDLE_CREATED; ++ ++ /* set target handle ID as equalizer ID */ ++ record->base.handle_id = record->equalizer->handle_id; ++ } ++ ++ /* init lock */ ++ spin_lock_init(&record->base.lock); ++ ++ /* save the substream data */ ++ record->base.substream = substream; ++ ++ /* init high resolution timer for updating hw status */ ++ hrtimer_init(&record->base.hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); ++ ++ /* PRQA S 0563 1 */ ++ record->base.hrtimer.function = &snd_adsp_hrtimer_func; ++ record->base.hrt_state = XF_HANDLE_CREATED; ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Prepare playback function ++ * ++ * \param[out] playback Pointer to playback data ++ * \param[in] substream Pointer to substream data ++ * \retval -EINVAL Failed to prepare playback function ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_playback_prepare(struct snd_adsp_playback *playback, ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_card *adsp_card; ++ int dai_idx, pcm_width, ch, fs, frame_size, vol_rate, hw_buffer_size; ++ int out_rate; ++ struct snd_adsp_control *ctr_if; ++ struct snd_pcm_runtime *runtime; ++ struct xf_adsp_renderer *renderer; ++ struct xf_adsp_equalizer *equalizer; ++ struct snd_adsp_base_info *base; ++ int i; ++ ++ adsp_card = snd_adsp_get_drvdata_from_substream(substream); ++ dai_idx = snd_adsp_get_dai_id_from_substream(substream); ++ ctr_if = &adsp_card->ctr_if; ++ runtime = substream->runtime; ++ renderer = playback->renderer; ++ equalizer = playback->equalizer; ++ base = &playback->base; ++ ++ /* runtime parameter */ ++ fs = runtime->rate; ++ ch = runtime->channels; ++ pcm_width = (runtime->format == SNDRV_PCM_FORMAT_S16_LE) ? 16 : 24; ++ frame_size = runtime->period_size; ++ vol_rate = ctr_if->vol_rate[DIRECT_PLAYBACK][dai_idx]; ++ out_rate = ctr_if->sample_rate[DIRECT_PLAYBACK][dai_idx]; ++ hw_buffer_size = snd_pcm_lib_buffer_bytes(substream); ++ ++ /* get number of bytes in a period */ ++ base->period_bytes = snd_pcm_lib_period_bytes(substream); ++ ++ if (pcm_width == 16) ++ base->buf_bytes = base->period_bytes; ++ else ++ base->buf_bytes = (base->period_bytes * ++ BYTES_PER_SAMPLE(S24_3LE)) / BYTES_PER_SAMPLE(S24_LE); ++ ++ /* pcm indirect configuration */ ++ base->pcm_indirect.hw_buffer_size = hw_buffer_size; ++ base->pcm_indirect.sw_buffer_size = base->pcm_indirect.hw_buffer_size; ++ ++ /* it should equal to a period size in bytes */ ++ base->pcm_indirect.hw_queue_size = base->period_bytes; ++ ++ /* set parameters when Renderer is not ready */ ++ if (COMPONENT_IS_READY(playback->rdr_state) == FALSE) { ++ struct xf_adsp_renderer_params *params = &renderer->params; ++ ++ /* apply renderer parameters */ ++ params->in_rate = fs; ++ params->channel = ch; ++ params->pcm_width = pcm_width; ++ params->frame_size = frame_size; ++ ++ if (ctr_if->mix_usage == SECOND_RUN) ++ params->mix_ctrl = ctr_if->mix_usage; ++ else ++ params->mix_ctrl = MIX_UNUSED; ++ ++ /* set flow as ADSP->PDMA0->SRC0->PDMA1->SSI0 */ ++ params->dev1 = SRC0; ++ params->dev2 = SSI00; ++ params->dma1 = PDMA_CH00; ++ params->dma2 = PDMA_CH01; ++ ++ /* when MIX is enabled, change to DMAC transfer type to save */ ++ /* hw FIFO */ ++ if (MIX_ENABLED(params->mix_ctrl) == TRUE) ++ params->dma1 = ADMAC_CH01; ++ ++ /* set volume rate if it is set by user or default value */ ++ /* is 100% */ ++ if (vol_rate >= 0) ++ params->vol_rate = vol_rate; ++ else ++ params->vol_rate = (1 << 20); ++ ++ /* set output channel if it is set by user */ ++ if (ctr_if->rdr_out_ch[dai_idx] >= MONAURAL) ++ params->out_channel = ctr_if->rdr_out_ch[dai_idx]; ++ else ++ params->out_channel = params->channel; ++ ++ /* set sample rate output if it is set by user */ ++ if (out_rate >= 0) ++ params->out_rate = out_rate; ++ ++ /* set parameters to ADSP Renderer plugin */ ++ if (xf_adsp_renderer_set_params(renderer) != 0) ++ return -EINVAL; ++ ++ /* allocate buffer pool to prepare the execution */ ++ renderer->buf_pool = xf_adsp_allocate_mem_pool( ++ XF_BUF_POOL_SIZE, base->buf_bytes); ++ ++ if (IS_ERR(renderer->buf_pool)) /* PRQA S 306*/ ++ return -EINVAL; ++ ++ for (i = 0; i < XF_BUF_POOL_SIZE; i++) { ++ base->buffer[i] = xf_adsp_get_data_from_pool( ++ renderer->buf_pool, i); ++ ++ base->buf_queue++; ++ memset(base->buffer[i], 0, base->buf_bytes); ++ } ++ ++ /* mark Renderer ready */ ++ playback->rdr_state |= XF_HANDLE_READY; ++ ++ /* set parameters for Equalizer if it is used */ ++ if (COMPONENT_IS_CREATED(playback->eqz_state) == TRUE) { ++ /* apply Equalizer parameter setting */ ++ equalizer->params.channel = ch; ++ equalizer->params.pcm_width = pcm_width; ++ equalizer->params.rate = fs; ++ ++ /* get equalizer parameters from control interface */ ++ /* data */ ++ snd_adsp_get_eqz_params_from_control( ++ &equalizer->params, ++ &ctr_if->eqz_params[DIRECT_PLAYBACK][dai_idx], ++ true); ++ ++ /* set parameters to Equalizer plugin */ ++ if (xf_adsp_equalizer_set_params(equalizer) != 0) ++ return -EINVAL; ++ ++ /* route Equalizer to Renderer */ ++ if (xf_adsp_route(equalizer->handle_id, ++ renderer->handle_id, ++ XF_BUF_POOL_SIZE, ++ base->buf_bytes) != 0) ++ return -EINVAL; ++ ++ /* mark Equalizer ready */ ++ playback->eqz_state |= XF_HANDLE_READY; ++ ++ /* prepare data before start PCM */ ++ /* PRQA S 2462 1 */ /* PRQA S 2463 1 */ ++ for (i = 0; i < XF_BUF_POOL_SIZE; i++) { ++ /* send buffer to plugin to kick */ ++ /* init-processing */ ++ if (xf_adsp_empty_this_buffer( ++ base->handle_id, ++ base->buffer[i], ++ base->buf_bytes) != 0) ++ return -EINVAL; ++ ++ spin_lock_irqsave(&base->lock, base->flag); ++ base->buf_queue--; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ } ++ } else { ++ /* send zero buffer to plugin to kick */ ++ /* init-processing */ ++ if (xf_adsp_empty_this_buffer(base->handle_id, ++ base->buffer[0], ++ base->buf_bytes) != 0) ++ return -EINVAL; ++ ++ spin_lock_irqsave(&base->lock, base->flag); ++ base->buf_queue--; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ } ++ ++ /* wait until all the buffer have been consummed */ ++ while (base->buf_queue != XF_BUF_POOL_SIZE) { ++ schedule_timeout_interruptible(2); ++ if (signal_pending(current)) ++ break; ++ ++ /* check the error from initialization */ ++ if (base->runtime_err) ++ return -EINVAL; ++ } ++ ++ /* reset HW index */ ++ base->hw_idx = 0; ++ } ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Prepare record function ++ * ++ * \param[out] record Pointer to record data ++ * \param[in] substream Pointer to substream data ++ * \retval -EINVAL Failed to prepare record function ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_record_prepare(struct snd_adsp_record *record, ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_card *adsp_card; ++ int dai_idx, pcm_width, ch, fs, frame_size, vol_rate, in_rate; ++ int hw_buffer_size, hw_queue_size; ++ struct snd_adsp_control *ctr_if; ++ struct snd_pcm_runtime *runtime; ++ struct xf_adsp_capture *capture; ++ struct xf_adsp_equalizer *equalizer; ++ struct snd_adsp_base_info *base; ++ int i; ++ ++ adsp_card = snd_adsp_get_drvdata_from_substream(substream); ++ dai_idx = snd_adsp_get_dai_id_from_substream(substream); ++ ctr_if = &adsp_card->ctr_if; ++ runtime = substream->runtime; ++ capture = record->capture; ++ equalizer = record->equalizer; ++ base = &record->base; ++ ++ /* runtime parameter */ ++ fs = runtime->rate; ++ ch = runtime->channels; ++ pcm_width = (runtime->format == SNDRV_PCM_FORMAT_S16_LE) ? 16 : 24; ++ frame_size = runtime->period_size; ++ vol_rate = ctr_if->vol_rate[DIRECT_CAPTURE][dai_idx]; ++ in_rate = ctr_if->sample_rate[DIRECT_CAPTURE][dai_idx]; ++ hw_buffer_size = snd_pcm_lib_buffer_bytes(substream); ++ ++ /* total size of allocated buffers */ ++ hw_queue_size = base->period_bytes * XF_BUF_POOL_SIZE; ++ ++ /* get number of bytes in a period */ ++ base->period_bytes = snd_pcm_lib_period_bytes(substream); ++ ++ if (pcm_width == 16) ++ base->buf_bytes = base->period_bytes; ++ else ++ base->buf_bytes = ((base->period_bytes * ++ BYTES_PER_SAMPLE(S24_3LE)) / BYTES_PER_SAMPLE(S24_LE)); ++ ++ /* pcm indirect configuration */ ++ base->pcm_indirect.hw_buffer_size = hw_buffer_size; ++ base->pcm_indirect.sw_buffer_size = base->pcm_indirect.hw_buffer_size; ++ base->pcm_indirect.hw_queue_size = hw_queue_size; ++ ++ /* prepare parameters to set to Capture plugin when it is not yet */ ++ /* ready */ ++ if (COMPONENT_IS_READY(record->cap_state) == FALSE) { ++ struct xf_adsp_capture_params *params = &capture->params; ++ ++ /* apply capture parameters */ ++ params->out_rate = fs; ++ params->channel = ch; ++ params->pcm_width = pcm_width; ++ params->frame_size = frame_size; ++ ++ params->dev1 = SRC0; ++ params->dev2 = SSI10; ++ params->dma1 = PDMA_CH00; ++ params->dma2 = PDMA_CH01; ++ ++ /* set volume rate if it is set by user or default volume as */ ++ /* 100% */ ++ if (vol_rate >= 0) ++ params->vol_rate = vol_rate; ++ else ++ params->vol_rate = (1 << 20); ++ ++ /* set sample rate input if it is set by user */ ++ if (in_rate >= 0) ++ params->in_rate = in_rate; ++ ++ /* allocate buffer pool to prepare the execution */ ++ capture->buf_pool = xf_adsp_allocate_mem_pool( ++ XF_BUF_POOL_SIZE, base->buf_bytes); ++ ++ if (IS_ERR(capture->buf_pool)) /* PRQA S 306 */ ++ return -EINVAL; ++ ++ for (i = 0; i < XF_BUF_POOL_SIZE; i++) { ++ base->buffer[i] = xf_adsp_get_data_from_pool( ++ capture->buf_pool, i); ++ ++ base->buf_queue++; ++ } ++ ++ /* set parameters to ADSP Capture plugin */ ++ if (xf_adsp_capture_set_params(capture) != 0) ++ return -EINVAL; ++ ++ /* mark Capture ready */ ++ record->cap_state |= XF_HANDLE_READY; ++ ++ /* set parameters for Equalizer if it's used */ ++ if (COMPONENT_IS_CREATED(record->eqz_state) == TRUE) { ++ /* apply Equalizer parameter setting */ ++ equalizer->params.channel = ch; ++ equalizer->params.pcm_width = pcm_width; ++ equalizer->params.rate = fs; ++ ++ /* get equalizer parameter from control interface */ ++ /* data */ ++ snd_adsp_get_eqz_params_from_control( ++ &equalizer->params, ++ &ctr_if->eqz_params[DIRECT_CAPTURE][dai_idx], ++ true); ++ ++ /* set parameters to Equalizer plugin */ ++ if (xf_adsp_equalizer_set_params(equalizer) != 0) ++ return -EINVAL; ++ ++ /* route Capture to Equalizer */ ++ if (xf_adsp_route(capture->handle_id, ++ equalizer->handle_id, ++ XF_BUF_POOL_SIZE, ++ base->buf_bytes) != 0) ++ return -EINVAL; ++ ++ /* mark Equalizer ready */ ++ record->eqz_state |= XF_HANDLE_READY; ++ } ++ ++ /* kick init process by sending a zero buffer length */ ++ xf_adsp_fill_this_buffer(base->handle_id, base->buffer[0], 0); ++ ++ spin_lock_irqsave(&base->lock, base->flag); ++ base->buf_queue--; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ ++ /* wait until finishing initialization */ ++ while (base->buf_queue != XF_BUF_POOL_SIZE) { ++ schedule_timeout_interruptible(2); ++ if (signal_pending(current)) ++ break; ++ ++ /* check the error from initialization */ ++ if (base->runtime_err) ++ return -EINVAL; ++ } ++ ++ if (COMPONENT_IS_CREATED(record->eqz_state) == TRUE) { ++ /* PRQA S 2462 1 */ /* PRQA S 2463 1 */ ++ for (i = 0; i < XF_BUF_POOL_SIZE; i++) { ++ /* send buffer to plugin */ ++ if (xf_adsp_fill_this_buffer( ++ base->handle_id, ++ base->buffer[i], ++ base->buf_bytes) != 0) ++ return -EINVAL; ++ ++ spin_lock_irqsave(&base->lock, base->flag); ++ base->buf_queue--; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ } ++ ++ /* wait until all the buffer have been responsed */ ++ while (base->buf_queue != XF_BUF_POOL_SIZE) { ++ schedule_timeout_interruptible(2); ++ if (signal_pending(current)) ++ break; ++ ++ /* check the error from initialization */ ++ if (base->runtime_err) ++ return -EINVAL; ++ } ++ } ++ ++ /* reset hw data position */ ++ base->hw_idx = 0; ++ } ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Deinitialize playback function ++ * ++ * \param[out] playback Pointer to playback data ++ * \retval -EINVAL Failed to deinitialize playback function ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_playback_deinit(struct snd_adsp_playback *playback) ++{ ++ int ret = 0; ++ ++ /* perform de-initialization if playback has been created already */ ++ if (playback) { ++ /* perform completion process */ ++ if (COMPONENT_IS_CREATED(playback->rdr_state) == TRUE) { ++ /* send buffer with zero length to plugin for */ ++ /* completion process *//* PRQA S 3200 2 */ ++ xf_adsp_empty_this_buffer(playback->base.handle_id, ++ NULL, 0); ++ ++ /* free buffer pool */ /* PRQA S 3200 1 */ ++ xf_adsp_free_mem_pool(playback->renderer->buf_pool); ++ ++ /* destroy Renderer */ ++ if (xf_adsp_renderer_destroy(playback->renderer) != 0) ++ ret = -EINVAL; ++ ++ playback->renderer = NULL; ++ } ++ ++ /* destroy Equalizer if it is used */ ++ if (COMPONENT_IS_CREATED(playback->eqz_state) == TRUE) { ++ if (xf_adsp_equalizer_destroy(playback->equalizer)) ++ ret = -EINVAL; ++ ++ playback->equalizer = NULL; ++ } ++ ++ /* canncel timer interrupt */ ++ if (COMPONENT_IS_CREATED(playback->base.hrt_state) == TRUE) ++ hrtimer_cancel(&playback->base.hrtimer); ++ ++ /* free playback data */ ++ kfree(playback); ++ } ++ ++ return ret; ++} ++ ++/** ************************************************************************** ++ * \brief Deinitialize record function ++ * ++ * \param[out] record Pointer to record data ++ * \retval -EINVAL Failed to deinitialize record function ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_record_deinit(struct snd_adsp_record *record) ++{ ++ int ret = 0; ++ ++ /* perform de-initialization if record has been created already */ ++ if (!record) ++ return ret; ++ ++ /* perform completion process */ ++ if (COMPONENT_IS_CREATED(record->cap_state) == TRUE) { ++ /* send buffer with zero length to plugin for */ ++ /* completion process *//* PRQA S 3200 2 */ ++ xf_adsp_empty_this_buffer(record->base.handle_id, NULL, 0); ++ ++ /* free buffer pool */ /* PRQA S 3200 1 */ ++ xf_adsp_free_mem_pool(record->capture->buf_pool); ++ ++ if (xf_adsp_capture_destroy(record->capture)) ++ ret = -EINVAL; ++ ++ record->capture = NULL; ++ } ++ ++ /* destroy Equalizer if it is used */ ++ if (COMPONENT_IS_CREATED(record->eqz_state) == TRUE) { ++ if (xf_adsp_equalizer_destroy(record->equalizer) != 0) ++ ret = -EINVAL; ++ ++ record->equalizer = NULL; ++ } ++ ++ /* canncel timer interrupt */ ++ if (COMPONENT_IS_CREATED(record->base.hrt_state) == TRUE) ++ hrtimer_cancel(&record->base.hrtimer); ++ ++ /* free record data */ ++ kfree(record); ++ ++ return ret; ++} ++ ++/***************************************************************************** ++ * internal functions to manage TDM playback and TDM record functions ++ * ***************************************************************************/ ++ ++/** ************************************************************************** ++ * \brief Initialize TDM playback data ++ * ++ * \param[out] tdm_playback_data Pointer to store TDM playback data ++ * \param[in] substream Pointer to substream data ++ * \retval -EINVAL Failed to initialize TDM playback data ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_tdm_playback_init(struct snd_adsp_tdm_playback **tdm_playback_data, ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_tdm_playback *tdm_playback; ++ ++ /* allocate memory for TDM playback data */ ++ tdm_playback = kmalloc(sizeof(*tdm_playback), GFP_KERNEL); ++ ++ if (!tdm_playback) ++ return -EINVAL; ++ ++ /* init params */ ++ memset(tdm_playback, 0, sizeof(struct snd_adsp_tdm_playback)); ++ ++ /* save the TDM playback data */ ++ *tdm_playback_data = tdm_playback; ++ ++ /* set handle state as NULL state */ ++ tdm_playback->state = XF_HANDLE_NULL; ++ tdm_playback->base.hrt_state = XF_HANDLE_NULL; ++ ++ /* register TDM renderer component */ ++ if (xf_adsp_tdm_renderer_create(&tdm_playback->tdm_renderer, ++ &rdr_callbacks, ++ (void *)&tdm_playback->base) < 0) ++ return -EINVAL; ++ ++ /* mark TDM renderer component created */ ++ tdm_playback->state = XF_HANDLE_CREATED; ++ ++ /* set target handle ID as TDM renderer ID */ ++ tdm_playback->base.handle_id = tdm_playback->tdm_renderer->handle_id; ++ ++ /* init lock */ ++ spin_lock_init(&tdm_playback->base.lock); ++ ++ /* save the substream data */ ++ tdm_playback->base.substream = substream; ++ ++ /* init high resolution timer for updating hw status */ ++ hrtimer_init(&tdm_playback->base.hrtimer, ++ CLOCK_MONOTONIC, ++ HRTIMER_MODE_REL); ++ ++ /* PRQA S 0563 1 */ ++ tdm_playback->base.hrtimer.function = &snd_adsp_hrtimer_func; ++ tdm_playback->base.hrt_state = XF_HANDLE_CREATED; ++ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Initialize TDM record data ++ * ++ * \param[out] tdm_record_data Pointer to store TDM record data ++ * \param[in] substream Pointer to substream data ++ * \retval -EINVAL Failed to initialize TDM record data ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_tdm_record_init(struct snd_adsp_tdm_record **tdm_record_data, ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_tdm_record *tdm_record; ++ ++ /* allocate memory for TDM record data */ ++ tdm_record = kmalloc(sizeof(*tdm_record), GFP_KERNEL); ++ if (!tdm_record) ++ return -EINVAL; ++ ++ /* init params */ ++ memset(tdm_record, 0, sizeof(struct snd_adsp_tdm_record)); ++ ++ /* save the TDM record data */ ++ *tdm_record_data = tdm_record; ++ ++ /* set handle state as NULL state */ ++ tdm_record->state = XF_HANDLE_NULL; ++ tdm_record->base.hrt_state = XF_HANDLE_NULL; ++ ++ /* register TDM Capture component */ ++ if (xf_adsp_tdm_capture_create(&tdm_record->tdm_capture, ++ &cap_callbacks, ++ (void *)&tdm_record->base) != 0) ++ return -EINVAL; ++ ++ /* mark TDM capture component created */ ++ tdm_record->state = XF_HANDLE_CREATED; ++ ++ /* set target handle ID as TDM capture ID */ ++ tdm_record->base.handle_id = tdm_record->tdm_capture->handle_id; ++ ++ /* init lock */ ++ spin_lock_init(&tdm_record->base.lock); ++ ++ /* save the substream data */ ++ tdm_record->base.substream = substream; ++ ++ /* init high resolution timer for updating hw status */ ++ hrtimer_init(&tdm_record->base.hrtimer, ++ CLOCK_MONOTONIC, ++ HRTIMER_MODE_REL); ++ ++ /* PRQA S 0563 1 */ ++ tdm_record->base.hrtimer.function = &snd_adsp_hrtimer_func; ++ tdm_record->base.hrt_state = XF_HANDLE_CREATED; ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Prepare TDM playback function ++ * ++ * \param[out] tdm_playback Pointer to TDM playback data ++ * \param[in] substream Pointer to substream data ++ * \retval -EINVAL Failed to prepare TDM playback function ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_tdm_playback_prepare(struct snd_adsp_tdm_playback *tdm_playback, ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_card *adsp_card; ++ struct snd_adsp_control *ctr_if; ++ struct snd_pcm_runtime *runtime; ++ struct xf_adsp_tdm_renderer *tdm_renderer; ++ struct snd_adsp_base_info *base; ++ int i; ++ int pcm_width, ch_mode, fs, frame_size, hw_buffer_size; ++ ++ adsp_card = snd_adsp_get_drvdata_from_substream(substream); ++ ctr_if = &adsp_card->ctr_if; ++ runtime = substream->runtime; ++ tdm_renderer = tdm_playback->tdm_renderer; ++ base = &tdm_playback->base; ++ ++ /* runtime parameter */ ++ fs = runtime->rate; ++ pcm_width = (runtime->format == SNDRV_PCM_FORMAT_S16_LE) ? 16 : 24; ++ frame_size = runtime->period_size; ++ ++ ch_mode = (runtime->channels == 8) ? ++ XA_TDM_RDR_CHANNEL_MODE_1X8 : XA_TDM_RDR_CHANNEL_MODE_1X6; ++ ++ hw_buffer_size = snd_pcm_lib_buffer_bytes(substream); ++ ++ /* get number of bytes in a period */ ++ base->period_bytes = snd_pcm_lib_period_bytes(substream); ++ ++ if (pcm_width == 16) ++ base->buf_bytes = base->period_bytes; ++ else ++ base->buf_bytes = ((base->period_bytes * ++ BYTES_PER_SAMPLE(S24_3LE)) / BYTES_PER_SAMPLE(S24_LE)); ++ ++ /* pcm indirect configuration */ ++ base->pcm_indirect.hw_buffer_size = hw_buffer_size; ++ base->pcm_indirect.sw_buffer_size = base->pcm_indirect.hw_buffer_size; ++ ++ /* it should equal to a period size in bytes */ ++ base->pcm_indirect.hw_queue_size = base->period_bytes; ++ ++ /* prepare parameters to set to TDM playback as it is not ready */ ++ if (COMPONENT_IS_READY(tdm_playback->state) == FALSE) { ++ struct xf_adsp_tdm_renderer_params *params; ++ ++ params = &tdm_renderer->params; ++ ++ /* apply renderer parameters */ ++ params->in_rate = fs; ++ params->ch_mode = ch_mode; ++ params->pcm_width = pcm_width; ++ params->frame_size = frame_size; ++ ++ /* setting Audio device indexes */ ++ params->dma1 = ADMAC_CH00; /* use DMAC for transfer data */ ++ params->dma2 = PDMA_CH03; ++ params->dev1 = SRC1; ++ params->dev2 = SSI30; /* set SSI index to SSI30 */ ++ ++ /* set volume rate if it is set by user or default value as */ ++ /* 100% */ ++ params->vol_rate = (ctr_if->tdm_vol_rate[DIRECT_PLAYBACK] >= 0) ++ ? ctr_if->tdm_vol_rate[DIRECT_PLAYBACK] : (1 << 20); ++ ++ /* set output sampling rate if it is set by user */ ++ if (ctr_if->tdm_sample_rate[DIRECT_PLAYBACK] >= 0) ++ params->out_rate = ++ ctr_if->tdm_sample_rate[DIRECT_PLAYBACK]; ++ ++ /* set parameters to ADSP TDM Renderer plugin */ ++ if (xf_adsp_tdm_renderer_set_params(tdm_renderer) != 0) ++ return -EINVAL; ++ ++ /* allocate buffer pool to prepare the execution */ ++ tdm_renderer->buf_pool = xf_adsp_allocate_mem_pool( ++ XF_BUF_POOL_SIZE, base->buf_bytes); ++ ++ if (IS_ERR(tdm_renderer->buf_pool)) /* PRQA S 306*/ ++ return -EINVAL; ++ ++ for (i = 0; i < XF_BUF_POOL_SIZE; i++) { ++ base->buffer[i] = xf_adsp_get_data_from_pool( ++ tdm_renderer->buf_pool, i); ++ ++ base->buf_queue++; ++ } ++ ++ /* mark TDM Renderer created */ ++ tdm_playback->state |= XF_HANDLE_READY; ++ ++ /* send zero buffer to plugin to kick init-processing */ ++ memset(base->buffer[0], 0, base->buf_bytes); ++ ++ if (xf_adsp_empty_this_buffer(base->handle_id, base->buffer[0], ++ base->buf_bytes) != 0) ++ return -EINVAL; ++ ++ spin_lock_irqsave(&base->lock, base->flag); ++ base->buf_queue--; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ ++ /* wait until all the buffer have been consummed */ ++ while (base->buf_queue != XF_BUF_POOL_SIZE) { ++ schedule_timeout_interruptible(2); ++ if (signal_pending(current)) ++ break; ++ ++ /* check the error from initialization */ ++ if (base->runtime_err) ++ return -EINVAL; ++ } ++ ++ /* reset HW index */ ++ base->hw_idx = 0; ++ } ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Prepare TDM record function ++ * ++ * \param[out] tdm_record Pointer to TDM record data ++ * \param[in] substream Pointer to substream data ++ * \retval -EINVAL Failed to prepare TDM record function ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_tdm_record_prepare(struct snd_adsp_tdm_record *tdm_record, ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_card *adsp_card = ++ snd_adsp_get_drvdata_from_substream(substream); ++ struct snd_adsp_control *ctr_if = &adsp_card->ctr_if; ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ struct xf_adsp_tdm_capture *tdm_capture = tdm_record->tdm_capture; ++ struct snd_adsp_base_info *base = &tdm_record->base; ++ int i; ++ int pcm_width, ch_mode, fs, frame_size; ++ ++ /* runtime parameter */ ++ fs = runtime->rate; ++ ++ ch_mode = (runtime->channels == 8) ? ++ XA_TDM_RDR_CHANNEL_MODE_1X8 : XA_TDM_RDR_CHANNEL_MODE_1X6; ++ ++ pcm_width = (runtime->format == SNDRV_PCM_FORMAT_S16_LE) ? 16 : 24; ++ frame_size = runtime->period_size; ++ ++ /* get number of bytes in a period */ ++ base->period_bytes = snd_pcm_lib_period_bytes(substream); ++ base->buf_bytes = (pcm_width == 16) ? ++ base->period_bytes : ((base->period_bytes * ++ BYTES_PER_SAMPLE(S24_3LE)) / ++ BYTES_PER_SAMPLE(S24_LE)); ++ ++ /* pcm indirect configuration */ ++ base->pcm_indirect.hw_buffer_size = snd_pcm_lib_buffer_bytes(substream); ++ base->pcm_indirect.sw_buffer_size = base->pcm_indirect.hw_buffer_size; ++ ++ /* total size of allocated buffers */ ++ base->pcm_indirect.hw_queue_size = base->period_bytes * ++ XF_BUF_POOL_SIZE; ++ ++ /* prepare parameters to set to TDM Capture as it is not yet ready */ ++ if (COMPONENT_IS_READY(tdm_record->state) == FALSE) { ++ struct xf_adsp_tdm_capture_params *params; ++ ++ params = &tdm_capture->params; ++ ++ /* apply capture parameters */ ++ params->out_rate = fs; ++ params->ch_mode = ch_mode; ++ params->pcm_width = pcm_width; ++ params->frame_size = frame_size; ++ ++ /* setting Audio device indexes */ ++ params->dma1 = PDMA_CH00; ++ params->dma2 = PDMA_CH01; ++ params->dev1 = SRC0; ++ params->dev2 = SSI40; /* set input device is SSI40 */ ++ ++ /* set volume rate if it is set by user or default value as */ ++ /* 100% */ ++ params->vol_rate = (ctr_if->tdm_vol_rate[DIRECT_CAPTURE] >= 0) ++ ? ctr_if->tdm_vol_rate[DIRECT_CAPTURE] : (1 << 20); ++ ++ /* set input rate if it is set by user */ ++ if (ctr_if->tdm_sample_rate[DIRECT_CAPTURE] >= 0) { ++ params->in_rate = ++ ctr_if->tdm_sample_rate[DIRECT_CAPTURE]; ++ } ++ ++ /* allocate buffer pool to prepare the execution */ ++ tdm_capture->buf_pool = xf_adsp_allocate_mem_pool( ++ XF_BUF_POOL_SIZE, base->buf_bytes); ++ ++ if (IS_ERR(tdm_capture->buf_pool)) /* PRQA S 306 */ ++ return -EINVAL; ++ ++ for (i = 0; i < XF_BUF_POOL_SIZE; i++) { ++ base->buffer[i] = xf_adsp_get_data_from_pool( ++ tdm_capture->buf_pool, i); ++ ++ base->buf_queue++; ++ } ++ ++ /* set parameters to ADSP TDM Capture plugin */ ++ if (xf_adsp_tdm_capture_set_params(tdm_capture) != 0) ++ return -EINVAL; ++ ++ /* mark TDM Capture ready */ ++ tdm_record->state |= XF_HANDLE_READY; ++ ++ /* kick init process by sending a zero buffer length */ ++ xf_adsp_fill_this_buffer(base->handle_id, base->buffer[0], 0); ++ ++ spin_lock_irqsave(&base->lock, base->flag); ++ base->buf_queue--; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ ++ /* wait until finishing initialization */ ++ while (base->buf_queue != XF_BUF_POOL_SIZE) { ++ schedule_timeout_interruptible(2); ++ if (signal_pending(current)) ++ break; ++ ++ /* check the error from initialization */ ++ if (base->runtime_err) ++ return -EINVAL; ++ } ++ ++ /* reset hw data position */ ++ base->hw_idx = 0; ++ } ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Deinitialize TDM playback function ++ * ++ * \param[out] tdm_playback Pointer to TDM playback data ++ * \retval -EINVAL Failed to deinitialize TDM playback function ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_tdm_playback_deinit(struct snd_adsp_tdm_playback *tdm_playback) ++{ ++ int ret = 0; ++ ++ /* perform de-initialization if TDM playback has been created */ ++ if (!tdm_playback) ++ return ret; ++ ++ /* perform completion process */ ++ if (COMPONENT_IS_CREATED(tdm_playback->state) == TRUE) { ++ /* send buffer with zero length to plugin for */ ++ /* completion process */ ++ /* PRQA S 3200 2 */ ++ xf_adsp_empty_this_buffer(tdm_playback->base.handle_id, ++ NULL, 0); ++ ++ /* free buffer pool *//* PRQA S 3200 2 */ ++ xf_adsp_free_mem_pool(tdm_playback->tdm_renderer->buf_pool); ++ ++ /* destroy TDM Renderer component */ ++ if (xf_adsp_tdm_renderer_destroy( ++ tdm_playback->tdm_renderer) != 0) ++ ret = -EINVAL; ++ ++ tdm_playback->tdm_renderer = NULL; ++ } ++ ++ /* canncel timer interrupt */ ++ if (COMPONENT_IS_CREATED(tdm_playback->base.hrt_state) == TRUE) ++ hrtimer_cancel(&tdm_playback->base.hrtimer); ++ ++ /* free playback data */ ++ kfree(tdm_playback); ++ ++ return ret; ++} ++ ++/** ************************************************************************** ++ * \brief Deinitialize TDM record function ++ * ++ * \param[out] tdm_record Pointer to TDM record data ++ * \retval -EINVAL Failed to deinitialize TDM record function ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_tdm_record_deinit(struct snd_adsp_tdm_record *tdm_record) ++{ ++ int ret = 0; ++ ++ /* perform de-initialization if TDM record has been created already */ ++ if (!tdm_record) ++ return ret; ++ ++ /* perform completion process */ ++ if (COMPONENT_IS_CREATED(tdm_record->state) == TRUE) { ++ /* send buffer with zero length to plugin for */ ++ /* completion process */ ++ /* PRQA S 3200 2 */ ++ xf_adsp_empty_this_buffer(tdm_record->base.handle_id, NULL, 0); ++ ++ /* free buffer pool *//* PRQA S 3200 2 */ ++ xf_adsp_free_mem_pool(tdm_record->tdm_capture->buf_pool); ++ ++ /* destroy TDM Capture component */ ++ if (xf_adsp_tdm_capture_destroy(tdm_record->tdm_capture) != 0) ++ ret = -EINVAL; ++ ++ tdm_record->tdm_capture = NULL; ++ } ++ ++ /* canncel timer interrupt */ ++ if (COMPONENT_IS_CREATED(tdm_record->base.hrt_state) == TRUE) ++ hrtimer_cancel(&tdm_record->base.hrtimer); ++ ++ /* free record data */ ++ kfree(tdm_record); ++ ++ return ret; ++} ++ ++/***************************************************************************** ++ * callback functions of ADSP ALSA driver ++ * ***************************************************************************/ ++ ++/** ************************************************************************** ++ * \brief Open a playback/TDM playback or record/TDM record stream ++ * ++ * \param[in] substream Pointer to substream object ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int snd_adsp_pcm_open(struct snd_pcm_substream *substream) ++{ ++ /* get ADSP soundcard and CPU DAI index */ ++ struct snd_adsp_card *adsp_card; ++ int dai_idx = snd_adsp_get_dai_id_from_substream(substream); ++ struct snd_adsp_control *ctr_if; ++ ++ adsp_card = snd_adsp_get_drvdata_from_substream(substream); ++ ctr_if = &adsp_card->ctr_if; ++ ++ if (dai_idx == RDR_DAI_IDX0 || dai_idx == RDR_DAI_IDX1 || ++ dai_idx == RDR_DAI_IDX2 || dai_idx == RDR_DAI_IDX3) { ++ /* register data for playback/record functions */ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ /* perform playback initialization */ ++ if (snd_adsp_playback_init( ++ &adsp_card->playback[dai_idx], ++ ctr_if->eqz_switch[DIRECT_PLAYBACK][dai_idx], ++ substream) < 0) { ++ /* perform playback de-initialization when */ ++ /* the initialization fails */ ++ snd_adsp_playback_deinit( ++ adsp_card->playback[dai_idx]); ++ ++ adsp_card->playback[dai_idx] = NULL; ++ return -EINVAL; ++ } ++ } else { ++ /* perform record initialization */ ++ if (snd_adsp_record_init( ++ &adsp_card->record[dai_idx], ++ ctr_if->eqz_switch[DIRECT_CAPTURE][dai_idx], ++ substream) < 0) { ++ /* perform record de-initialization when the */ ++ /* initialization fails */ ++ snd_adsp_record_deinit( ++ adsp_card->record[dai_idx]); ++ ++ adsp_card->record[dai_idx] = NULL; ++ return -EINVAL; ++ } ++ } ++ ++ /* save the hardware parameters */ ++ snd_soc_set_runtime_hwparams(substream, &snd_pcm_adsp_hw); ++ ++ /* each period has a frame size */ ++ snd_pcm_hw_constraint_single(substream->runtime, ++ SNDRV_PCM_HW_PARAM_PERIOD_SIZE, ++ FRAME_SIZE); ++ } else { ++ /* register data for TDM playback/record functions */ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ /* perform TDM playback initialization */ ++ if (snd_adsp_tdm_playback_init( ++ &adsp_card->tdm_playback, ++ substream) < 0) { ++ /* perform TDM playback de-initialization */ ++ /* when the initialization fails */ ++ snd_adsp_tdm_playback_deinit( ++ adsp_card->tdm_playback); ++ ++ adsp_card->tdm_playback = NULL; ++ return -EINVAL; ++ } ++ } else { ++ /* perform TDM record initialization */ ++ if (snd_adsp_tdm_record_init(&adsp_card->tdm_record, ++ substream) < 0) { ++ /* perform TDM record de-initialization */ ++ /* when the initialization fails */ ++ snd_adsp_tdm_record_deinit( ++ adsp_card->tdm_record); ++ ++ adsp_card->tdm_record = NULL; ++ return -EINVAL; ++ } ++ } ++ ++ /* save the hardware parameters */ ++ snd_soc_set_runtime_hwparams(substream, &snd_pcm_adsp_tdm_hw); ++ ++ /* each period has a frame size */ ++ snd_pcm_hw_constraint_single(substream->runtime, ++ SNDRV_PCM_HW_PARAM_PERIOD_SIZE, ++ TDM_FRAME_SIZE); ++ } ++ ++ snd_pcm_hw_constraint_integer(substream->runtime, ++ SNDRV_PCM_HW_PARAM_PERIODS); ++ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Close a playback/TDM playback or record/TDM record stream ++ * ++ * \param[in] substream Pointer to substream object ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int snd_adsp_pcm_close(struct snd_pcm_substream *substream) ++{ ++ /* get ADSP soundcard and CPU DAI index */ ++ struct snd_adsp_card *adsp_card = ++ snd_adsp_get_drvdata_from_substream(substream); ++ int dai_idx = snd_adsp_get_dai_id_from_substream(substream); ++ int err = 0; ++ ++ if (dai_idx == RDR_DAI_IDX0 || dai_idx == RDR_DAI_IDX1 || ++ dai_idx == RDR_DAI_IDX2 || dai_idx == RDR_DAI_IDX3) { ++ /* destroy Renderer/Capture or Equalizer (if used) */ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ if (snd_adsp_playback_deinit( ++ adsp_card->playback[dai_idx]) < 0) ++ err = -EINVAL; ++ ++ adsp_card->playback[dai_idx] = NULL; ++ } else { ++ if (snd_adsp_record_deinit( ++ adsp_card->record[dai_idx]) < 0) ++ err = -EINVAL; ++ ++ adsp_card->record[dai_idx] = NULL; ++ } ++ } else { ++ /* destroy TDM Renderer/TDM Capture */ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ if (snd_adsp_tdm_playback_deinit( ++ adsp_card->tdm_playback) < 0) ++ err = -EINVAL; ++ ++ adsp_card->tdm_playback = NULL; ++ } else { ++ if (snd_adsp_tdm_record_deinit( ++ adsp_card->tdm_record) < 0) ++ err = -EINVAL; ++ ++ adsp_card->tdm_record = NULL; ++ } ++ } ++ ++ return err; ++} ++ ++/** ************************************************************************** ++ * \brief Allocate ALSA buffer and calculate expire time of hr timer ++ * ++ * \param[in] substream Pointer to substream object ++ * \retval 0 Success ++ * \retval -ENOMEM Cannot allocate ALSA buffer ++ *****************************************************************************/ ++static int snd_adsp_pcm_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *hw_params) ++{ ++ struct snd_adsp_base_info *base; ++ int err = 0; ++ ++ base = snd_adsp_get_base_from_substream(substream); ++ ++ /* set expire time of hrtimer, this value should be time for */ ++ /* transfer a frame */ ++ base->ktime = ns_to_ktime((1000000000 / params_rate(hw_params)) * ++ params_period_size(hw_params)); ++ ++ err = snd_pcm_lib_malloc_pages(substream, ++ params_buffer_bytes(hw_params)); ++ ++ /* reset DMA buffer area */ ++ memset(substream->runtime->dma_area, 0, substream->runtime->dma_bytes); ++ ++ return err; ++} ++ ++/** ************************************************************************** ++ * \brief Free the allocated ALSA buffer ++ * ++ * \param[in] substream Pointer to substream object ++ * \retval 0 Success ++ * \retval -EINVAL Cannot deallocate buffer ++ *****************************************************************************/ ++static int snd_adsp_pcm_hw_free(struct snd_pcm_substream *substream) ++{ ++ return snd_pcm_lib_free_pages(substream); ++} ++ ++/** ************************************************************************** ++ * \brief Prepare playback/TDM playback or record/TDM record function ++ * before transferring data ++ * ++ * \param[in] substream Pointer to substream object ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int snd_adsp_pcm_prepare(struct snd_pcm_substream *substream) ++{ ++ /* get ADSP soundcard and CPU DAI index */ ++ struct snd_adsp_card * ++ adsp_card = snd_adsp_get_drvdata_from_substream(substream); ++ int dai_idx = snd_adsp_get_dai_id_from_substream(substream); ++ int err = 0; ++ ++ if (dai_idx == RDR_DAI_IDX0 || dai_idx == RDR_DAI_IDX1 || ++ dai_idx == RDR_DAI_IDX2 || dai_idx == RDR_DAI_IDX3) { ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ++ /* get playback prepared to execute */ ++ err = snd_adsp_playback_prepare( ++ adsp_card->playback[dai_idx], substream); ++ else ++ /* get record prepared to execute */ ++ err = snd_adsp_record_prepare( ++ adsp_card->record[dai_idx], substream); ++ } else { ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ++ /* get TDM playback prepared to execute */ ++ err = snd_adsp_tdm_playback_prepare( ++ adsp_card->tdm_playback, substream); ++ else ++ /* get TDM record prepared to execute */ ++ err = snd_adsp_tdm_record_prepare( ++ adsp_card->tdm_record, substream); ++ } ++ ++ return err; ++} ++ ++/** ************************************************************************** ++ * \brief Trigger playback/TDM playback or record/TDM record stream ++ * to go to next phase ++ * ++ * \param[in] substream Pointer to substream object ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int snd_adsp_pcm_trigger(struct snd_pcm_substream *substream, int idx) ++{ ++ struct snd_adsp_base_info * ++ base = snd_adsp_get_base_from_substream(substream); ++ ++ switch (idx) { ++ case SNDRV_PCM_TRIGGER_START: ++ case SNDRV_PCM_TRIGGER_RESUME: ++ /* start high-resolution timer */ ++ hrtimer_start(&base->hrtimer, base->ktime, HRTIMER_MODE_REL); ++ ++ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { ++ int buf_queue = 0; ++ ++ /* get current available buffer */ ++ spin_lock_irqsave(&base->lock, base->flag); ++ buf_queue = base->buf_queue; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ ++ /* send all available buffer to plugin to */ ++ /* get data */ ++ for (; buf_queue > 0; buf_queue--) { ++ if (xf_adsp_fill_this_buffer( ++ base->handle_id, ++ base->buffer[base->buf_idx], ++ base->buf_bytes) != 0) ++ return -EINVAL; ++ ++ spin_lock_irqsave(&base->lock, base->flag); ++ base->buf_queue--; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ ++ base->buf_idx++; ++ ++ if (base->buf_idx >= XF_BUF_POOL_SIZE) ++ base->buf_idx = 0; ++ } ++ } ++ break; ++ case SNDRV_PCM_TRIGGER_STOP: ++ case SNDRV_PCM_TRIGGER_SUSPEND: ++ break; ++ default: ++ return -EINVAL; ++ } ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Return HW data position ++ * ++ * \param[in] substream Pointer to substream object ++ * \retval position HW data position ++ *****************************************************************************/ ++static snd_pcm_uframes_t ++snd_adsp_pcm_pointer(struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_base_info * ++ base = snd_adsp_get_base_from_substream(substream); ++ unsigned int hw_idx, hw_buffer_size; ++ snd_pcm_uframes_t pointer; ++ ++ /* convert hw index to correct as submitted bytes */ ++ spin_lock_irqsave(&base->lock, base->flag); ++ hw_idx = (base->hw_idx / base->buf_bytes) * base->period_bytes; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ ++ hw_buffer_size = base->pcm_indirect.hw_buffer_size; ++ ++ if (hw_idx >= hw_buffer_size) { ++ spin_lock_irqsave(&base->lock, base->flag); ++ ++ base->hw_idx -= (hw_buffer_size / base->period_bytes) * ++ base->buf_bytes; ++ ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ } ++ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ++ pointer = snd_pcm_indirect_playback_pointer(substream, ++ &base->pcm_indirect, ++ hw_idx); ++ else ++ pointer = snd_pcm_indirect_capture_pointer(substream, ++ &base->pcm_indirect, ++ hw_idx); ++ ++ return pointer; ++} ++ ++/** ************************************************************************** ++ * \brief Call read/write process to transfer data ++ * ++ * \param[in] substream Pointer to substream object ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int snd_adsp_pcm_ack(struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_base_info * ++ base = snd_adsp_get_base_from_substream(substream); ++ ++ if (base->runtime_err) ++ return -EINVAL; ++ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ++ snd_pcm_indirect_playback_transfer(substream, ++ &base->pcm_indirect, ++ snd_adsp_pcm_transfer); ++ else ++ snd_pcm_indirect_capture_transfer(substream, ++ &base->pcm_indirect, ++ snd_adsp_pcm_transfer); ++ ++ return 0; ++} ++ ++/** *************************************************************************** ++ * \brief Copy data from source buffer to destination buffer ++ * ++ * \params[in] dst Destination buffer pointer ++ * \params[out] src Source buffer pointer ++ * \params[in] dst_size Destination buffer size in byte ++ * \params[in] src_size Source buffer size in byte ++ * \retval None ++ *****************************************************************************/ ++static inline void ++snd_adsp_copy_data(void *dst, void *src, int dst_size, int src_size) ++{ ++ unsigned char *data_dst = dst; ++ unsigned char *data_src = src; ++ int i; ++ ++ if (dst_size == src_size) { ++ /* src and dst bufs are same size, does not need to convert */ ++ memcpy(data_dst, data_src, dst_size); ++ ++ } else if (dst_size < src_size) { ++ for (i = 0; i < (dst_size - BYTES_PER_SAMPLE(S24_3LE)); ++ i += BYTES_PER_SAMPLE(S24_3LE)) { ++ *(u32 *)data_dst = *(u32 *)data_src; ++ ++ data_dst += BYTES_PER_SAMPLE(S24_3LE); ++ data_src += BYTES_PER_SAMPLE(S24_LE); ++ } ++ ++ /* copy a S24_3LE sample from S24_LE sample */ ++ data_dst[0] = data_src[0]; ++ data_dst[1] = data_src[1]; ++ data_dst[2] = data_src[2]; ++ ++ } else { ++ unsigned int tmp; ++ ++ for (i = 0; i < (dst_size - BYTES_PER_SAMPLE(S24_LE)); ++ i += BYTES_PER_SAMPLE(S24_LE)) { ++ tmp = *(u32 *)data_src; ++ *(u32 *)data_dst = tmp & 0x0FFFFFF; ++ ++ data_dst += BYTES_PER_SAMPLE(S24_LE); ++ data_src += BYTES_PER_SAMPLE(S24_3LE); ++ } ++ ++ /* copy a S24_LE sample from S24_3LE sample */ ++ data_dst[0] = data_src[0]; ++ data_dst[1] = data_src[1]; ++ data_dst[2] = data_src[2]; ++ data_dst[3] = 0; ++ } ++} ++ ++/** ************************************************************************** ++ * \brief Transfer data process between ALSA buffer and ADSP buffer ++ * ++ * \param[in] substream Pointer to substream object ++ * \param[in] rec Pointer to indirect PCM data ++ * \param[in] bytes Number of byte need to be transferred ++ * \retval None ++ *****************************************************************************/ ++static void snd_adsp_pcm_transfer(struct snd_pcm_substream *substream, ++ struct snd_pcm_indirect *rec, ++ size_t bytes) ++{ ++ struct snd_adsp_base_info * ++ base = snd_adsp_get_base_from_substream(substream); ++ int direct = substream->stream; ++ int trans_bytes = bytes; ++ int buf_bytes, period_bytes; ++ void *dma_buf, *data_buff; ++ ++ /* get the DMA buffer pointer */ ++ dma_buf = (void *)(substream->runtime->dma_area + rec->sw_data); ++ ++ /* get information from base */ ++ buf_bytes = base->buf_bytes; ++ period_bytes = base->period_bytes; ++ ++ /* make sure the available buffer and transfer size - TBD */ ++ while (trans_bytes > 0) { ++ spin_lock_irqsave(&base->lock, base->flag); ++ if (base->buf_queue > 0 && trans_bytes >= period_bytes) { ++ base->buf_queue--; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ ++ /* get the buffer pointer from stream */ ++ data_buff = base->buffer[base->buf_idx]; ++ ++ if (direct == SNDRV_PCM_STREAM_PLAYBACK) { ++ /* copy data from user *//* PRQA S 3200 2 */ ++ snd_adsp_copy_data(data_buff, dma_buf, ++ buf_bytes, period_bytes); ++ ++ /* send buffer to plugin */ ++ if (xf_adsp_empty_this_buffer(base->handle_id, ++ data_buff, ++ buf_bytes) < 0) ++ base->runtime_err = TRUE; ++ } else { ++ /* copy data to user *//* PRQA S 3200 2 */ ++ snd_adsp_copy_data(dma_buf, data_buff, ++ period_bytes, buf_bytes); ++ ++ /* send buffer to plugin */ ++ if (xf_adsp_fill_this_buffer(base->handle_id, ++ data_buff, ++ buf_bytes) < 0) ++ base->runtime_err = TRUE; ++ } ++ ++ base->buf_idx++; ++ if (base->buf_idx >= XF_BUF_POOL_SIZE) ++ base->buf_idx = 0; ++ } else { ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ break; ++ } ++ ++ trans_bytes -= period_bytes; ++ } ++} ++ ++/** ************************************************************************** ++ * \brief Get info of Volume control ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] uinfo Pointer to info structure of volume control ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_control_volume_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; ++ uinfo->count = 1; ++ uinfo->value.integer.min = -1; ++ uinfo->value.integer.max = 799; ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Get volume value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to volume value ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int snd_adsp_control_volume_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ struct snd_adsp_control *ctr_if = &adsp_card->ctr_if; ++ int handle_state, handle_id; ++ int volume, cmd_idx, direction; ++ unsigned int index; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ /* set handle state as NULL state */ ++ handle_state = XF_HANDLE_NULL; ++ handle_id = -1; ++ ++ /* determine command index, direction, handle state, handle ID */ ++ if (kcontrol->id.name[0] == PREFIX_OF_PLAYBACK_CTR_NAME) { ++ cmd_idx = XA_RDR_CONFIG_PARAM_VOLUME_RATE; ++ direction = DIRECT_PLAYBACK; ++ ++ if (adsp_card->playback[index]) { ++ handle_state = adsp_card->playback[index]->rdr_state; ++ ++ handle_id = ++ adsp_card->playback[index]->renderer->handle_id; ++ } ++ } else if (kcontrol->id.name[0] == PREFIX_OF_CAPTURE_CTR_NAME) { ++ cmd_idx = XA_CAP_CONFIG_PARAM_VOLUME_RATE; ++ direction = DIRECT_CAPTURE; ++ ++ if (adsp_card->record[index]) { ++ handle_state = adsp_card->record[index]->cap_state; ++ ++ handle_id = ++ adsp_card->record[index]->capture->handle_id; ++ } ++ } else { ++ if (kcontrol->id.name[3] == TDM_PLAYBACK) { ++ cmd_idx = XA_TDM_RDR_CONFIG_PARAM_VOLUME_RATE; ++ direction = DIRECT_PLAYBACK; ++ ++ if (adsp_card->tdm_playback) { ++ handle_state = adsp_card->tdm_playback->state; ++ ++ handle_id = ++ adsp_card->tdm_playback->tdm_renderer->handle_id; ++ } ++ } else { ++ cmd_idx = XA_TDM_CAP_CONFIG_PARAM_VOLUME_RATE; ++ direction = DIRECT_CAPTURE; ++ ++ if (adsp_card->tdm_record) { ++ handle_state = adsp_card->tdm_record->state; ++ ++ handle_id = ++ adsp_card->tdm_record->tdm_capture->handle_id; ++ } ++ } ++ } ++ ++ /* get the volume's value */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) { ++ /* get the volume's value from the plugin */ ++ if (xf_adsp_get_param(handle_id, cmd_idx, &volume) != 0) ++ return -EINVAL; ++ ++ /* check the value after getting it and adjust it */ ++ ucontrol->value.integer.value[0] = (volume == 0xFFFFFFFF) ? ++ (-1) : (volume * VOLUME_SCALE) >> 20; ++ } else { ++ if (kcontrol->id.name[0] != PREFIX_OF_TDM_CTR_NAME) ++ ucontrol->value.integer.value[0] = ++ (ctr_if->vol_rate[direction][index] * ++ VOLUME_SCALE) >> 20; ++ else ++ ucontrol->value.integer.value[0] = ++ (ctr_if->tdm_vol_rate[direction] * ++ VOLUME_SCALE) >> 20; ++ } ++ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Set volume value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to volume value ++ * \retval 1 Volume change ++ * \retval 0 Volume does not change ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++/* PRQA S 3673 1*/ ++static int ++snd_adsp_control_volume_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ struct snd_adsp_control *ctr_if = &adsp_card->ctr_if; ++ int volume; ++ int ret; ++ int handle_state, handle_id, cmd_idx, volume_get; ++ int direction; ++ unsigned int index; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ /* set handle state as NULL state and handle ID */ ++ handle_state = XF_HANDLE_NULL; ++ handle_id = -1; ++ ++ /* get the value to set */ ++ if (ucontrol->value.integer.value[0] == -1) { ++ volume = 0xFFFFFFFF; ++ } else { ++ /* round up the value if needed */ ++ volume = (ucontrol->value.integer.value[0] * (1 << 20)) / ++ VOLUME_SCALE; ++ ++ if ((ucontrol->value.integer.value[0] * (1 << 20)) > ++ (VOLUME_SCALE * volume)) ++ volume += 1; ++ } ++ ++ /* determine command index, direction, handle state, handle ID */ ++ if (kcontrol->id.name[0] == PREFIX_OF_PLAYBACK_CTR_NAME) { ++ cmd_idx = XA_RDR_CONFIG_PARAM_VOLUME_RATE; ++ direction = DIRECT_PLAYBACK; ++ ++ if (adsp_card->playback[index]) { ++ handle_state = adsp_card->playback[index]->rdr_state; ++ ++ handle_id = ++ adsp_card->playback[index]->renderer->handle_id; ++ } ++ } else if (kcontrol->id.name[0] == PREFIX_OF_CAPTURE_CTR_NAME) { ++ cmd_idx = XA_CAP_CONFIG_PARAM_VOLUME_RATE; ++ direction = DIRECT_CAPTURE; ++ ++ if (adsp_card->record[index]) { ++ handle_state = adsp_card->record[index]->cap_state; ++ ++ handle_id = ++ adsp_card->record[index]->capture->handle_id; ++ } ++ } else { ++ if (kcontrol->id.name[3] == TDM_PLAYBACK) { ++ cmd_idx = XA_TDM_RDR_CONFIG_PARAM_VOLUME_RATE; ++ direction = DIRECT_PLAYBACK; ++ ++ if (adsp_card->tdm_playback) { ++ handle_state = adsp_card->tdm_playback->state; ++ ++ handle_id = ++ adsp_card->tdm_playback->tdm_renderer->handle_id; ++ } ++ } else { ++ cmd_idx = XA_TDM_CAP_CONFIG_PARAM_VOLUME_RATE; ++ direction = DIRECT_CAPTURE; ++ ++ if (adsp_card->tdm_record) { ++ handle_state = adsp_card->tdm_record->state; ++ ++ handle_id = ++ adsp_card->tdm_record->tdm_capture->handle_id; ++ } ++ } ++ } ++ ++ /* set volume to plugin */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) { ++ /* TDM does not support set volume in runtime state */ ++ if (kcontrol->id.name[0] == PREFIX_OF_TDM_CTR_NAME) ++ return -EINVAL; ++ ++ /* apply set volume value to ADSP from user setting */ ++ if (xf_adsp_set_param(handle_id, cmd_idx, volume) != 0) ++ return -EINVAL; ++ ++ /* get volume from ADSP after setting to confirm */ ++ if (xf_adsp_get_param(handle_id, cmd_idx, &volume_get) != 0) ++ return -EINVAL; ++ ++ /* check if the value has changed */ ++ ret = (volume_get == volume) ? 1 : 0; ++ } else { ++ if (kcontrol->id.name[0] != PREFIX_OF_TDM_CTR_NAME) ++ ctr_if->vol_rate[direction][index] = volume; ++ else ++ ctr_if->tdm_vol_rate[direction] = volume; ++ ++ ret = 1; ++ } ++ ++ return ret; ++} ++ ++/** ************************************************************************** ++ * \brief Get info of Sample Rate Converter control ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] uinfo Pointer to info structure of sample rate ++ * converter control ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_control_sample_rate_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; ++ uinfo->count = 1; ++ uinfo->value.integer.min = -1; ++ uinfo->value.integer.max = 48000; ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Get sample rate value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to sample rate value ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int snd_adsp_control_sample_rate_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ int *rate; ++ int handle_id, handle_state, cmd_idx, direction; ++ unsigned int index; ++ ++ rate = (int *)&ucontrol->value.integer.value[0]; /* PRQA S 310 */ ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ /* set handle state as NULL state and handle ID */ ++ handle_state = XF_HANDLE_NULL; ++ handle_id = -1; ++ ++ /* determine command, direction, handle state, handle ID */ ++ if (kcontrol->id.name[0] == PREFIX_OF_PLAYBACK_CTR_NAME) { ++ cmd_idx = XA_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ direction = DIRECT_PLAYBACK; ++ ++ if (adsp_card->playback[index]) { ++ handle_state = adsp_card->playback[index]->rdr_state; ++ ++ handle_id = ++ adsp_card->playback[index]->renderer->handle_id; ++ } ++ } else if (kcontrol->id.name[0] == PREFIX_OF_CAPTURE_CTR_NAME) { ++ cmd_idx = XA_CAP_CONFIG_PARAM_SAMPLE_RATE; ++ direction = DIRECT_CAPTURE; ++ ++ if (adsp_card->record[index]) { ++ handle_state = adsp_card->record[index]->cap_state; ++ ++ handle_id = ++ adsp_card->record[index]->capture->handle_id; ++ } ++ } else { ++ if (kcontrol->id.name[3] == TDM_PLAYBACK) { ++ cmd_idx = XA_TDM_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ direction = DIRECT_PLAYBACK; ++ ++ if (adsp_card->tdm_playback) { ++ handle_state = adsp_card->tdm_playback->state; ++ ++ handle_id = ++ adsp_card->tdm_playback->tdm_renderer->handle_id; ++ } ++ } else { ++ cmd_idx = XA_TDM_CAP_CONFIG_PARAM_IN_SAMPLE_RATE; ++ direction = DIRECT_CAPTURE; ++ ++ if (adsp_card->tdm_record) { ++ handle_state = adsp_card->tdm_record->state; ++ ++ handle_id = ++ adsp_card->tdm_record->tdm_capture->handle_id; ++ } ++ } ++ } ++ ++ /* get parameter from plugin */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) { ++ if (xf_adsp_get_param(handle_id, cmd_idx, rate) != 0) ++ return -EINVAL; ++ } else { ++ if (kcontrol->id.name[0] != PREFIX_OF_TDM_CTR_NAME) ++ *rate = adsp_card->ctr_if.sample_rate[direction][index]; ++ else ++ *rate = adsp_card->ctr_if.tdm_sample_rate[direction]; ++ } ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Set sample rate value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to sample rate value ++ * \retval 1 Sample rate change ++ * \retval 0 Sample rate does not change ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++/* PRQA S 3673 1 */ ++static int ++snd_adsp_control_sample_rate_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ unsigned int index; ++ int rate; ++ int handle_state, cmd_idx, direction; ++ int ret = 1; ++ ++ rate = (int)ucontrol->value.integer.value[0]; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ /* set handle state as NULL state */ ++ handle_state = XF_HANDLE_NULL; ++ ++ /* determine command, direction and handle state */ ++ if (kcontrol->id.name[0] == PREFIX_OF_PLAYBACK_CTR_NAME) { ++ cmd_idx = XA_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ direction = DIRECT_PLAYBACK; ++ ++ if (adsp_card->playback[index]) ++ handle_state = adsp_card->playback[index]->rdr_state; ++ ++ } else if (kcontrol->id.name[0] == PREFIX_OF_CAPTURE_CTR_NAME) { ++ cmd_idx = XA_CAP_CONFIG_PARAM_SAMPLE_RATE; ++ direction = DIRECT_CAPTURE; ++ ++ if (adsp_card->record[index]) ++ handle_state = adsp_card->record[index]->cap_state; ++ ++ } else { ++ if (kcontrol->id.name[3] == TDM_PLAYBACK) { ++ cmd_idx = XA_TDM_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ direction = DIRECT_PLAYBACK; ++ ++ if (adsp_card->tdm_playback) ++ handle_state = adsp_card->tdm_playback->state; ++ ++ } else { ++ cmd_idx = XA_TDM_CAP_CONFIG_PARAM_IN_SAMPLE_RATE; ++ direction = DIRECT_CAPTURE; ++ ++ if (adsp_card->tdm_record) ++ handle_state = adsp_card->tdm_record->state; ++ } ++ } ++ ++ /* get the value to set */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) ++ return -EINVAL; ++ ++ if (kcontrol->id.name[0] != PREFIX_OF_TDM_CTR_NAME) ++ adsp_card->ctr_if.sample_rate[direction][index] = rate; ++ else ++ adsp_card->ctr_if.tdm_sample_rate[direction] = rate; ++ ++ ret = 1; ++ ++ return ret; ++} ++ ++/** ************************************************************************** ++ * \brief Get info of Equalizer control ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] uinfo Pointer to info structure of Equalizer control ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_control_eqz_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; ++ uinfo->count = MAX_EQZ_PARAM_NUMBER; ++ uinfo->value.integer.min = -1; ++ uinfo->value.integer.max = 0x7fffffff; ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Get equalizer parameters value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to equalizer parameters value ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int snd_adsp_control_eqz_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ int handle_state, direction; ++ int i, j, filter_index; ++ unsigned int index; ++ struct xf_adsp_equalizer *equalizer; ++ struct xf_adsp_equalizer_params *eqz_params; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ /* determin direction of stream */ ++ direction = (kcontrol->id.name[0] == PREFIX_OF_PLAYBACK_CTR_NAME) ? ++ DIRECT_PLAYBACK : DIRECT_CAPTURE; ++ ++ /* set handle state as NULL state, handle ID, equalizer pointer */ ++ handle_state = XF_HANDLE_NULL; ++ equalizer = NULL; ++ ++ /* get component's state */ ++ if (direction == DIRECT_PLAYBACK) { ++ if (adsp_card->playback[index]) { ++ handle_state = adsp_card->playback[index]->eqz_state; ++ equalizer = adsp_card->playback[index]->equalizer; ++ } ++ } else { ++ if (adsp_card->record[index]) { ++ handle_state = adsp_card->record[index]->eqz_state; ++ equalizer = adsp_card->record[index]->equalizer; ++ } ++ } ++ ++ /* perform parameters' values getting */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) { ++ /* get equalizer's parameters */ ++ if (xf_adsp_equalizer_get_params(equalizer) != 0) ++ return -EINVAL; ++ ++ eqz_params = &equalizer->params; ++ } else { ++ eqz_params = &adsp_card->ctr_if.eqz_params[direction][index]; ++ } ++ ++ /* get equalizer type: PARAMETRIC or GRAPHIC */ ++ ucontrol->value.integer.value[0] = eqz_params->eqz_type; ++ ++ /* get parameters' value from Equalizer plugin */ ++ if (eqz_params->eqz_type == XA_REL_EQZ_TYPE_PARAMETRIC) { ++ for (i = 0, filter_index = 1; ++ filter_index <= XA_REL_EQZ_FILTER_NUM; ++ i++, filter_index++) { ++ /* get filter index */ ++ ucontrol->value.integer.value[(i * 6) + 1] = ++ filter_index; ++ ++ /* get frequency centre */ ++ ucontrol->value.integer.value[(i * 6) + 2] = ++ eqz_params->p_coef.fc[i]; ++ ++ /* get bandwidth */ ++ ucontrol->value.integer.value[(i * 6) + 3] = ++ eqz_params->p_coef.band_width[i]; ++ ++ /* get filter type */ ++ ucontrol->value.integer.value[(i * 6) + 4] = ++ eqz_params->p_coef.type[i]; ++ ++ /* get gain base */ ++ ucontrol->value.integer.value[(i * 6) + 5] = ++ eqz_params->p_coef.gain_base[i]; ++ ++ /* get gain */ ++ ucontrol->value.integer.value[(i * 6) + 6] = ++ eqz_params->p_coef.gain[i]; ++ } ++ } else { ++ for (i = 0, filter_index = 1; ++ filter_index <= XA_REL_EQZ_GRAPHIC_BAND_NUM; ++ i++, filter_index++) { ++ /* get band index */ ++ ucontrol->value.integer.value[(i * 2) + 1] = ++ filter_index; ++ ++ /* get graphic gain */ ++ ucontrol->value.integer.value[(i * 2) + 2] = ++ eqz_params->g_coef.gain_g[i]; ++ } ++ ++ j = (i * 2) + 1; ++ ++ /* make the rest of values silent */ ++ while (j < MAX_EQZ_PARAM_NUMBER) { ++ ucontrol->value.integer.value[j] = -1; ++ j++; ++ } ++ } ++ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Set equalizer parameters value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to equalizer parameters value ++ * \retval 1 Equalizer parameters change ++ * \retval 0 Equalizer parameters does not change ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++/* PRQA S 3673 1*/ ++static int snd_adsp_control_eqz_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ int handle_state, direction, filter_idx; ++ int i; ++ int index; ++ struct xf_adsp_equalizer_params *eqz_params = NULL; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ /* determine the direction */ ++ direction = (kcontrol->id.name[0] == PREFIX_OF_PLAYBACK_CTR_NAME) ? ++ DIRECT_PLAYBACK : DIRECT_CAPTURE; ++ ++ /* set handle state as NULL state */ ++ handle_state = XF_HANDLE_NULL; ++ ++ /* get the handle state */ ++ if (direction == DIRECT_PLAYBACK) { ++ if (adsp_card->playback[index]) ++ handle_state = adsp_card->playback[index]->eqz_state; ++ } else { ++ if (adsp_card->record[index]) ++ handle_state = adsp_card->record[index]->eqz_state; ++ } ++ ++ /* perform equalizer's parameters setting */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) ++ return -EINVAL; ++ ++ /* PRQA S 310 1*/ ++ eqz_params = &adsp_card->ctr_if.eqz_params[direction][index]; ++ ++ i = 0; ++ /* PRQA S 3440 1*/ ++ eqz_params->eqz_type = ucontrol->value.integer.value[i]; ++ i++; ++ filter_idx = 0; ++ ++ if (eqz_params->eqz_type == XA_REL_EQZ_TYPE_PARAMETRIC) { ++ while (i < MAX_EQZ_PARAM_NUMBER) { ++ /* get index filter */ ++ /* PRQA S 3440*/ ++ filter_idx = ucontrol->value.integer.value[i]; ++ i++; ++ ++ /* valid index filter is range */ ++ /* (1 to XA_REL_EQZ_FILTER_NUM) */ ++ if (filter_idx >= 1 && ++ filter_idx <= XA_REL_EQZ_FILTER_NUM) { ++ /* PRQA S 3440 5*/ ++ eqz_params->p_coef.fc[filter_idx - 1] = ++ ucontrol->value.integer.value[i]; ++ ++ i++; ++ eqz_params->p_coef.band_width[filter_idx - 1] = ++ ucontrol->value.integer.value[i]; ++ ++ i++; ++ eqz_params->p_coef.type[filter_idx - 1] = ++ ucontrol->value.integer.value[i]; ++ ++ i++; ++ eqz_params->p_coef.gain_base[filter_idx - 1] = ++ ucontrol->value.integer.value[i]; ++ ++ i++; ++ eqz_params->p_coef.gain[filter_idx - 1] = ++ ucontrol->value.integer.value[i]; ++ ++ i++; ++ } ++ /* index filter = -1 means that user */ ++ /* does not set this filter */ ++ else if (filter_idx == -1 || filter_idx == 0) { ++ i += 5; ++ } else { ++ return -EINVAL; ++ } ++ } ++ } else if (eqz_params->eqz_type == XA_REL_EQZ_TYPE_GRAPHIC) { ++ while (i < ((XA_REL_EQZ_GRAPHIC_BAND_NUM * 2) + 1)) { ++ /*get index filter */ ++ /* PRQA S 3440 */ ++ filter_idx = ucontrol->value.integer.value[i++]; ++ ++ if (filter_idx >= 1 && ++ filter_idx <= XA_REL_EQZ_GRAPHIC_BAND_NUM) { ++ eqz_params->g_coef.gain_g[filter_idx - 1] = ++ ucontrol->value.integer.value[i]; ++ i++; ++ ++ } else if (filter_idx == -1 || filter_idx == 0) { ++ i += 1; ++ } else { ++ return -EINVAL; ++ } ++ } ++ } else { ++ return -EINVAL; ++ } ++ ++ return 1; ++} ++ ++/** ************************************************************************** ++ * \brief Get info of Equalizer Switch control ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] uinfo Pointer to info structure of Equalizer ++ * Switch control ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_control_eqz_switch_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; ++ uinfo->count = 1; ++ uinfo->value.integer.min = 0; ++ uinfo->value.integer.max = 1; ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Get equalizer switch value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to equalizer switch value ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int ++snd_adsp_control_eqz_switch_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ int direction; ++ unsigned int index; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ /* determine the direction */ ++ direction = (kcontrol->id.name[0] == PREFIX_OF_PLAYBACK_CTR_NAME) ? ++ DIRECT_PLAYBACK : DIRECT_CAPTURE; ++ ++ /* get the Equalizer switch status */ ++ ucontrol->value.integer.value[0] = ++ adsp_card->ctr_if.eqz_switch[direction][index]; ++ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Set equalizer switch value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to equalizer switch value ++ * \retval 1 Equalizer switch change ++ * \retval 0 Equalizer switch does not change ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++/* PRQA S 3673 1 */ ++static int ++snd_adsp_control_eqz_switch_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ int eqz_switch; ++ int handle_state, direction; ++ unsigned int index; ++ int ret = 0; ++ ++ eqz_switch = ucontrol->value.integer.value[0]; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ /* determine the direction */ ++ direction = (kcontrol->id.name[0] == PREFIX_OF_PLAYBACK_CTR_NAME) ? ++ DIRECT_PLAYBACK : DIRECT_CAPTURE; ++ ++ /* set handle state as NULL state */ ++ handle_state = XF_HANDLE_NULL; ++ ++ /* determine handle state */ ++ if (direction == DIRECT_PLAYBACK) { ++ if (adsp_card->playback[index]) ++ handle_state = adsp_card->playback[index]->rdr_state; ++ } else { ++ if (adsp_card->record[index]) ++ handle_state = adsp_card->record[index]->cap_state; ++ } ++ ++ /* set the status of Equalizer */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) { ++ /* runtime setting is not supported */ ++ ret = -EINVAL; ++ } else { ++ adsp_card->ctr_if.eqz_switch[direction][index] = eqz_switch; ++ ret = 1; ++ } ++ ++ return ret; ++} ++ ++/** ************************************************************************** ++ * \brief Get info of Renderer output channel ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] uinfo Pointer to info structure of Renderer output channel ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_control_rdr_out_channel_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; ++ uinfo->count = 1; ++ uinfo->value.integer.min = MONAURAL; ++ uinfo->value.integer.max = STEREO; ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Get Renderer output channel's value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to Renderer output channel value ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int ++snd_adsp_control_rdr_out_channel_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ int rdr_out_ch; ++ unsigned int index; ++ int handle_state, handle_id; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ handle_state = XF_HANDLE_NULL; ++ handle_id = -1; ++ ++ /* determine handle state and handle ID */ ++ if (adsp_card->playback[index]) { ++ handle_state = adsp_card->playback[index]->rdr_state; ++ handle_id = adsp_card->playback[index]->renderer->handle_id; ++ } ++ ++ /* get Renderer output channel's value */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) { ++ /* get Renderer output channel's value from Renderer plugin */ ++ if (xf_adsp_get_param(handle_id, ++ XA_RDR_CONFIG_PARAM_OUT_CHANNELS, ++ &rdr_out_ch) != 0) { ++ return -EINVAL; ++ } ++ ++ ucontrol->value.integer.value[0] = rdr_out_ch; ++ } else { ++ ucontrol->value.integer.value[0] = ++ adsp_card->ctr_if.rdr_out_ch[index]; ++ } ++ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Set Renderer output channel's value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to Renderer output channel value ++ * \retval 1 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int ++snd_adsp_control_rdr_out_channel_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ unsigned int index; ++ int handle_state; ++ int ret = 1; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ handle_state = XF_HANDLE_NULL; ++ ++ /* determine handle state and handle ID */ ++ if (adsp_card->playback[index]) ++ handle_state = adsp_card->playback[index]->rdr_state; ++ ++ /* get Renderer output channel's value */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) ++ /* not support runtime setting */ ++ ret = -EINVAL; ++ else ++ adsp_card->ctr_if.rdr_out_ch[index] = ++ ucontrol->value.integer.value[0]; ++ ++ return ret; ++} ++ ++/** control interface for playback's volume rate */ ++/* PRQA S 3218 */ ++static struct snd_kcontrol_new ++snd_adsp_playback_volume_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = PLAYBACK_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX1, ++ .name = PLAYBACK_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX2, ++ .name = PLAYBACK_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX3, ++ .name = PLAYBACK_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++ } ++}; ++ ++/** control interface for Capture's volume rate */ ++/* PRQA S 3218 1*/ ++static struct snd_kcontrol_new ++snd_adsp_capture_volume_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = CAPTURE_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX1, ++ .name = CAPTURE_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX2, ++ .name = CAPTURE_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX3, ++ .name = CAPTURE_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++ } ++}; ++ ++/** control interface for playback's output sample rate */ ++/* PRQA S 3218 1*/ ++static struct snd_kcontrol_new ++snd_adsp_playback_sample_rate_out_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = PLAYBACK_OUT_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX1, ++ .name = PLAYBACK_OUT_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX2, ++ .name = PLAYBACK_OUT_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX3, ++ .name = PLAYBACK_OUT_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++ } ++}; ++ ++/** control interface for Capture's input sample rate */ ++/* PRQA S 3218 */ ++static struct snd_kcontrol_new ++snd_adsp_capture_sample_rate_in_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = CAPTURE_IN_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX1, ++ .name = CAPTURE_IN_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX2, ++ .name = CAPTURE_IN_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX3, ++ .name = CAPTURE_IN_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++ } ++}; ++ ++/** control interface for Equalizer parameters in playback */ ++/* PRQA S 3218 1*/ ++static struct snd_kcontrol_new ++snd_adsp_playback_equalizer_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = PLAYBACK_EQZ_CTR_NAME, ++ .info = &snd_adsp_control_eqz_info, ++ .get = &snd_adsp_control_eqz_get, ++ .put = &snd_adsp_control_eqz_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX1, ++ .name = PLAYBACK_EQZ_CTR_NAME, ++ .info = &snd_adsp_control_eqz_info, ++ .get = &snd_adsp_control_eqz_get, ++ .put = &snd_adsp_control_eqz_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX2, ++ .name = PLAYBACK_EQZ_CTR_NAME, ++ .info = &snd_adsp_control_eqz_info, ++ .get = &snd_adsp_control_eqz_get, ++ .put = &snd_adsp_control_eqz_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX3, ++ .name = PLAYBACK_EQZ_CTR_NAME, ++ .info = &snd_adsp_control_eqz_info, ++ .get = &snd_adsp_control_eqz_get, ++ .put = &snd_adsp_control_eqz_put ++ } ++}; ++ ++/** control interface for Equalizer parameters in record */ ++/* PRQA S 3218 */ ++static struct snd_kcontrol_new ++snd_adsp_capture_equalizer_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = CAPTURE_EQZ_CTR_NAME, ++ .info = &snd_adsp_control_eqz_info, ++ .get = &snd_adsp_control_eqz_get, ++ .put = &snd_adsp_control_eqz_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX1, ++ .name = CAPTURE_EQZ_CTR_NAME, ++ .info = &snd_adsp_control_eqz_info, ++ .get = &snd_adsp_control_eqz_get, ++ .put = &snd_adsp_control_eqz_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX2, ++ .name = CAPTURE_EQZ_CTR_NAME, ++ .info = &snd_adsp_control_eqz_info, ++ .get = &snd_adsp_control_eqz_get, ++ .put = &snd_adsp_control_eqz_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX3, ++ .name = CAPTURE_EQZ_CTR_NAME, ++ .info = &snd_adsp_control_eqz_info, ++ .get = &snd_adsp_control_eqz_get, ++ .put = &snd_adsp_control_eqz_put ++ } ++}; ++ ++/** control interface for Equalizer usage in playback */ ++/* PRQA S 3218 */ ++static struct snd_kcontrol_new ++snd_adsp_playback_equalizer_switch_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = PLAYBACK_EQZ_SWITCH_CTR_NAME, ++ .info = &snd_adsp_control_eqz_switch_info, ++ .get = &snd_adsp_control_eqz_switch_get, ++ .put = &snd_adsp_control_eqz_switch_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX1, ++ .name = PLAYBACK_EQZ_SWITCH_CTR_NAME, ++ .info = &snd_adsp_control_eqz_switch_info, ++ .get = &snd_adsp_control_eqz_switch_get, ++ .put = &snd_adsp_control_eqz_switch_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX2, ++ .name = PLAYBACK_EQZ_SWITCH_CTR_NAME, ++ .info = &snd_adsp_control_eqz_switch_info, ++ .get = &snd_adsp_control_eqz_switch_get, ++ .put = &snd_adsp_control_eqz_switch_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX3, ++ .name = PLAYBACK_EQZ_SWITCH_CTR_NAME, ++ .info = &snd_adsp_control_eqz_switch_info, ++ .get = &snd_adsp_control_eqz_switch_get, ++ .put = &snd_adsp_control_eqz_switch_put ++ } ++}; ++ ++/** control interface for Equalizer usage in record */ ++/* PRQA S 3218 1*/ ++static struct snd_kcontrol_new ++snd_adsp_capture_equalizer_switch_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = CAPTURE_EQZ_SWITCH_CTR_NAME, ++ .info = &snd_adsp_control_eqz_switch_info, ++ .get = &snd_adsp_control_eqz_switch_get, ++ .put = &snd_adsp_control_eqz_switch_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX1, ++ .name = CAPTURE_EQZ_SWITCH_CTR_NAME, ++ .info = &snd_adsp_control_eqz_switch_info, ++ .get = &snd_adsp_control_eqz_switch_get, ++ .put = &snd_adsp_control_eqz_switch_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX2, ++ .name = CAPTURE_EQZ_SWITCH_CTR_NAME, ++ .info = &snd_adsp_control_eqz_switch_info, ++ .get = &snd_adsp_control_eqz_switch_get, ++ .put = &snd_adsp_control_eqz_switch_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX3, ++ .name = CAPTURE_EQZ_SWITCH_CTR_NAME, ++ .info = &snd_adsp_control_eqz_switch_info, ++ .get = &snd_adsp_control_eqz_switch_get, ++ .put = &snd_adsp_control_eqz_switch_put ++ } ++}; ++ ++/** control interface for playback's output channel */ ++static struct snd_kcontrol_new ++snd_adsp_playback_out_channel_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = PLAYBACK_OUT_CHANNEL_CTR_NAME, ++ .info = &snd_adsp_control_rdr_out_channel_info, ++ .get = &snd_adsp_control_rdr_out_channel_get, ++ .put = &snd_adsp_control_rdr_out_channel_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ++ .index = RDR_DAI_IDX1, ++ .name = PLAYBACK_OUT_CHANNEL_CTR_NAME, ++ .info = &snd_adsp_control_rdr_out_channel_info, ++ .get = &snd_adsp_control_rdr_out_channel_get, ++ .put = &snd_adsp_control_rdr_out_channel_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ++ .index = RDR_DAI_IDX2, ++ .name = PLAYBACK_OUT_CHANNEL_CTR_NAME, ++ .info = &snd_adsp_control_rdr_out_channel_info, ++ .get = &snd_adsp_control_rdr_out_channel_get, ++ .put = &snd_adsp_control_rdr_out_channel_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ++ .index = RDR_DAI_IDX3, ++ .name = PLAYBACK_OUT_CHANNEL_CTR_NAME, ++ .info = &snd_adsp_control_rdr_out_channel_info, ++ .get = &snd_adsp_control_rdr_out_channel_get, ++ .put = &snd_adsp_control_rdr_out_channel_put ++ } ++}; ++ ++/** control interface for TDM playback's volume rate */ ++static struct snd_kcontrol_new snd_adsp_tdm_playback_volume_control = { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .name = TDM_PLAYBACK_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++}; ++ ++/** control interface for TDM capture's volume rate */ ++static struct snd_kcontrol_new snd_adsp_tdm_capture_volume_control = { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .name = TDM_CAPTURE_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++}; ++ ++/** control interface for TDM playback's output sample rate */ ++static struct snd_kcontrol_new snd_adsp_tdm_playback_sample_rate_out_control = { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .name = TDM_PLAYBACK_OUT_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++}; ++ ++/** control interface for TDM capture's input sample rate */ ++static struct snd_kcontrol_new snd_adsp_tdm_capture_sample_rate_in_control = { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .name = TDM_CAPTURE_IN_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++}; ++ ++/** PCM callback function of the sound card */ ++static struct snd_pcm_ops snd_adsp_pcm_ops = { ++ .open = &snd_adsp_pcm_open, /* PRQA S 1053 10 */ ++ .close = &snd_adsp_pcm_close, ++ .ioctl = &snd_pcm_lib_ioctl, ++ .hw_params = &snd_adsp_pcm_hw_params, ++ .hw_free = &snd_adsp_pcm_hw_free, ++ .prepare = &snd_adsp_pcm_prepare, ++ .trigger = &snd_adsp_pcm_trigger, ++ .pointer = &snd_adsp_pcm_pointer, ++ .ack = &snd_adsp_pcm_ack ++}; ++ ++/******************************************************************* ++ * Internal functions ++ * ****************************************************************/ ++ ++/** ************************************************************************** ++ * \brief Process information get from control structure ++ * ++ * \param[in] eqz_params Equalizer parameters object ++ * \param[in] eqz_ctr_params Equalizer parameters stored in control object ++ * \param[in] flag Indicate playback or capture stream ++ *****************************************************************************/ ++static void snd_adsp_get_eqz_params_from_control( ++ struct xf_adsp_equalizer_params *eqz_params, ++ struct xf_adsp_equalizer_params *eqz_ctr_params, bool flag) ++{ ++ int filter_idx; ++ ++ if (flag) { ++ if (eqz_ctr_params->eqz_type >= 0) ++ eqz_params->eqz_type = eqz_ctr_params->eqz_type; ++ ++ for (filter_idx = 0; filter_idx < XA_REL_EQZ_FILTER_NUM; ++ filter_idx++) { ++ if (eqz_ctr_params->p_coef.fc[filter_idx] >= 0) ++ eqz_params->p_coef.fc[filter_idx] = ++ eqz_ctr_params->p_coef.fc[filter_idx]; ++ ++ if (eqz_ctr_params->p_coef.band_width[filter_idx] >= 0) ++ eqz_params->p_coef.band_width[filter_idx] = ++ eqz_ctr_params->p_coef.band_width[filter_idx]; ++ ++ if (eqz_ctr_params->p_coef.type[filter_idx] >= 0) ++ eqz_params->p_coef.type[filter_idx] = ++ eqz_ctr_params->p_coef.type[filter_idx]; ++ ++ if (eqz_ctr_params->p_coef.gain_base[filter_idx] >= 0) ++ eqz_params->p_coef.gain_base[filter_idx] = ++ eqz_ctr_params->p_coef.gain_base[filter_idx]; ++ ++ if (eqz_ctr_params->p_coef.gain[filter_idx] >= 0) ++ eqz_params->p_coef.gain[filter_idx] = ++ eqz_ctr_params->p_coef.gain[filter_idx]; ++ } ++ for (filter_idx = 0; filter_idx < XA_REL_EQZ_GRAPHIC_BAND_NUM; ++ filter_idx++) { ++ if (eqz_ctr_params->g_coef.gain_g[filter_idx] >= 0) ++ eqz_params->g_coef.gain_g[filter_idx] = ++ eqz_ctr_params->g_coef.gain_g[filter_idx]; ++ } ++ } else { ++ memcpy(eqz_ctr_params, eqz_params, sizeof(*eqz_params)); ++ } ++} ++ ++/******************************************************************* ++ * ALSA ADSP Platform driver interface ++ * ****************************************************************/ ++ ++/** **************************************************************************** ++ * \brief Register control interface and preallocate ALSA buffer ++ * ++ * \param[in] runtime Pointer to runtime PCM data ++ * \retval 0 Success ++ * \retval -EINVAL Cannot register control interface ++ ******************************************************************************/ ++static int snd_adsp_pcm_new(struct snd_soc_pcm_runtime *runtime) ++{ ++ int i = 0, err = 0; ++ int id; ++ struct snd_card *card; ++ struct snd_adsp_card *adsp_card; ++ int alsa_buf_sz = 0; ++ ++ /* get sound card data */ ++ card = runtime->card->snd_card; ++ ++ /* get driver data */ ++ adsp_card = snd_soc_dai_get_drvdata(runtime->cpu_dai); ++ ++ /* get the ID of CPU DAI */ ++ id = runtime->cpu_dai->id; ++ ++ /* register control interfaces */ ++ if (id == RDR_DAI_IDX0 || id == RDR_DAI_IDX1 || ++ id == RDR_DAI_IDX2 || id == RDR_DAI_IDX3) { ++ struct snd_kcontrol *kctl[RDR_CONTROL_NUM]; ++ void *rdr_ctr[RDR_CONTROL_NUM] = { ++ &snd_adsp_playback_volume_control[id], /* PRQA S 1031 */ ++ &snd_adsp_capture_volume_control[id], ++ &snd_adsp_playback_sample_rate_out_control[id], ++ &snd_adsp_capture_sample_rate_in_control[id], ++ &snd_adsp_playback_equalizer_control[id], ++ &snd_adsp_capture_equalizer_control[id], ++ &snd_adsp_playback_equalizer_switch_control[id], ++ &snd_adsp_capture_equalizer_switch_control[id], ++ &snd_adsp_playback_out_channel_control[id] ++ }; ++ ++ /* add basic control instance */ ++ for (i = 0; i < RDR_CONTROL_NUM; i++) { ++ kctl[i] = snd_ctl_new1(rdr_ctr[i], adsp_card); ++ err = snd_ctl_add(card, kctl[i]); ++ if (err < 0) ++ return -EINVAL; ++ } ++ ++ /* assign ALSA buffer size */ ++ alsa_buf_sz = MAX_BUFFER_BYTES; ++ ++ /* enable MIX feature from the 2nd playback/record stream */ ++ if (adsp_card->ctr_if.mix_usage == MIX_UNUSED) ++ adsp_card->ctr_if.mix_usage = FIRST_RUN; ++ else if (adsp_card->ctr_if.mix_usage == FIRST_RUN) ++ adsp_card->ctr_if.mix_usage = SECOND_RUN; ++ ++ } else { ++ struct snd_kcontrol *kctl[TDM_CONTROL_NUM]; ++ void *tdm_ctr[TDM_CONTROL_NUM] = { ++ &snd_adsp_tdm_playback_volume_control, ++ &snd_adsp_tdm_playback_sample_rate_out_control, ++ &snd_adsp_tdm_capture_volume_control, ++ &snd_adsp_tdm_capture_sample_rate_in_control ++ }; ++ ++ /* add basic control instances */ ++ for (i = 0; i < TDM_CONTROL_NUM; i++) { ++ kctl[i] = snd_ctl_new1(tdm_ctr[i], adsp_card); ++ err = snd_ctl_add(card, kctl[i]); ++ if (err < 0) ++ return -EINVAL; ++ } ++ ++ /* assign ALSA buffer size */ ++ alsa_buf_sz = TDM_MAX_BUFFER_BYTES; ++ } ++ ++ return snd_pcm_lib_preallocate_pages_for_all(runtime->pcm, ++ SNDRV_DMA_TYPE_CONTINUOUS, ++ snd_dma_continuous_data(GFP_KERNEL), ++ alsa_buf_sz, alsa_buf_sz); ++} ++ ++/* **************************************************************************** ++ * ALSA ADSP DAI register ++ * ***************************************************************************/ ++ ++/** callback function of platform driver */ ++static struct snd_soc_platform_driver snd_adsp_platform = { ++ .pcm_new = &snd_adsp_pcm_new, /* PRQA S 1053 *//* PRQA S 0674 */ ++ .ops = &snd_adsp_pcm_ops, ++}; ++ ++/** component information of driver */ ++static const struct snd_soc_component_driver snd_adsp_component = { ++ .name = "snd_adsp", /* PRQA S 1053 */ ++}; ++ ++/** DAI information of ADSP ALSA driver */ ++static struct snd_soc_dai_driver snd_adsp_dai[MAX_DAI_IDX] = { ++ { ++ /* PRQA S 1053 */ ++ .id = RDR_DAI_IDX0, ++ .name = "adsp-dai.0", ++ .playback.stream_name = "Playback0", ++ .capture.stream_name = "Capture0", ++ }, ++ { ++ .id = RDR_DAI_IDX1, ++ .name = "adsp-dai.1", ++ .playback.stream_name = "Playback1", ++ .capture.stream_name = "Capture1", ++ }, ++ { ++ .id = RDR_DAI_IDX2, ++ .name = "adsp-dai.2", ++ .playback.stream_name = "Playback2", ++ .capture.stream_name = "Capture2", ++ }, ++ { ++ .id = RDR_DAI_IDX3, ++ .name = "adsp-dai.3", ++ .playback.stream_name = "Playback3", ++ .capture.stream_name = "Capture3", ++ }, ++ { ++ .id = TDM_DAI_IDX, ++ .name = "adsp-tdm-dai", ++ .playback.stream_name = "TDM Playback", ++ .capture.stream_name = "TDM Capture", ++ } ++}; ++ ++/** *************************************************************************** ++ * \brief Register platform driver and ADSP ALSA sound card ++ * ++ * \param[in] pdev Pointer to platform driver data ++ * \retval 0 Success ++ * \retval -ENOMEM Cannot allocate driver's data ++ * \retval -EINVAL Cannot register platform driver or sound card ++ ****************************************************************************/ ++static int snd_adsp_probe(struct platform_device *pdev) ++{ ++ struct snd_adsp_card *adsp_card; ++ int i; ++ ++ /* allocate a card data structure */ ++ adsp_card = kmalloc(sizeof(*adsp_card), GFP_KERNEL); ++ if (!adsp_card) ++ return -ENOMEM; ++ ++ /* init parameters */ ++ memset(adsp_card, 0, sizeof(*adsp_card)); /* PRQA S 3200 */ ++ ++ /* PRQA S 3200 1*/ ++ memset(&adsp_card->ctr_if, -1, sizeof(struct snd_adsp_control)); ++ ++ /* disable Equalizer for all streams */ ++ for (i = 0; i < (MAX_DAI_IDX - 1); i++) { ++ adsp_card->ctr_if.eqz_switch[DIRECT_CAPTURE][i] = 0; ++ adsp_card->ctr_if.eqz_switch[DIRECT_PLAYBACK][i] = 0; ++ } ++ ++ /* disable MIX function for all */ ++ adsp_card->ctr_if.mix_usage = MIX_UNUSED; ++ ++ /* save driver data */ ++ dev_set_drvdata(&pdev->dev, adsp_card); ++ ++ /* register platform device */ ++ if (snd_soc_register_platform(&pdev->dev, &snd_adsp_platform) < 0) { ++ snd_soc_unregister_platform(&pdev->dev); ++ return -EINVAL; ++ } ++ ++ /* fill format information of sound DAI driver for Rdr/Cap function */ ++ for (i = 0; i < (MAX_DAI_IDX - 1); i++) { ++ snd_adsp_dai[i].playback.rates = SND_ADSP_SAMPLE_RATES; ++ snd_adsp_dai[i].playback.formats = SND_ADSP_PCM_WIDTHS; ++ snd_adsp_dai[i].playback.channels_min = MIN_CHANNEL; ++ snd_adsp_dai[i].playback.channels_max = MAX_CHANNEL; ++ ++ snd_adsp_dai[i].capture.rates = SND_ADSP_SAMPLE_RATES; ++ snd_adsp_dai[i].capture.formats = SND_ADSP_PCM_WIDTHS; ++ snd_adsp_dai[i].capture.channels_min = MIN_CHANNEL; ++ snd_adsp_dai[i].capture.channels_max = MAX_CHANNEL; ++ } ++ ++ /* fill format information of sound DAI driver for TDM function */ ++ snd_adsp_dai[i].playback.rates = SND_ADSP_SAMPLE_RATES; ++ snd_adsp_dai[i].playback.formats = SND_ADSP_PCM_WIDTHS; ++ snd_adsp_dai[i].playback.channels_min = TDM_MIN_CHANNEL; ++ snd_adsp_dai[i].playback.channels_max = TDM_MAX_CHANNEL; ++ ++ snd_adsp_dai[i].capture.rates = SND_ADSP_SAMPLE_RATES; ++ snd_adsp_dai[i].capture.formats = SND_ADSP_PCM_WIDTHS; ++ snd_adsp_dai[i].capture.channels_min = TDM_MIN_CHANNEL; ++ snd_adsp_dai[i].capture.channels_max = TDM_MAX_CHANNEL; ++ ++ /* register CPU dai */ ++ if (snd_soc_register_component(&pdev->dev, &snd_adsp_component, ++ snd_adsp_dai, ++ ARRAY_SIZE(snd_adsp_dai)) < 0) { ++ snd_soc_unregister_platform(&pdev->dev); ++ return -EINVAL; ++ } ++ ++ dev_info(&pdev->dev, "probed\n"); ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Unregister platform driver and ADSP ALSA sound card ++ * ++ * \param[in] pdev Pointer platform driver data ++ * \retval 0 Success ++ * \retval -EINVAL Invalid driver's data ++ *****************************************************************************/ ++static int snd_adsp_remove(struct platform_device *pdev) ++{ ++ /* get ADSP sound card data */ ++ struct snd_adsp_card *adsp_card = dev_get_drvdata(&pdev->dev); ++ ++ if (!adsp_card) ++ return -ENODEV; ++ ++ /* release the ADSP sound card */ ++ kfree(adsp_card); ++ ++ /* unregister platform driver */ ++ snd_soc_unregister_component(&pdev->dev); ++ snd_soc_unregister_platform(&pdev->dev); ++ ++ /* success */ ++ return 0; ++} ++ ++/** ADSP ALSA driver information */ ++static const struct of_device_id snd_adsp_id[] = { ++ { .compatible = "renesas,rcar_adsp_sound_gen3", }, /* PRQA S 1053 */ ++}; ++MODULE_DEVICE_TABLE(of, snd_adsp_id); ++ ++/** platform driver of ADSP ALSA sound card */ ++static struct platform_driver snd_adsp_driver = { ++ .driver = { /* PRQA S 1053 */ ++ .name = "rcar_adsp_sound", ++ .of_match_table = snd_adsp_id, ++ }, ++ .probe = snd_adsp_probe, ++ .remove = snd_adsp_remove, ++}; ++module_platform_driver(snd_adsp_driver); /* PRQA S 0651 */ ++ ++MODULE_AUTHOR("Renesas AudioDSP"); ++MODULE_DESCRIPTION("Platform driver for ADSP"); ++MODULE_LICENSE("GPL v2"); ++MODULE_ALIAS("platform:ADSP-PCM-AUDIO"); +diff --git a/sound/soc/adsp/xf-adsp-base.c b/sound/soc/adsp/xf-adsp-base.c +new file mode 100644 +index 0000000..3ad9445 +--- /dev/null ++++ b/sound/soc/adsp/xf-adsp-base.c +@@ -0,0 +1,2259 @@ ++/** *************************************************************************** ++ *\file xf-adsp-base.c ++ *\brief Source file for ADSP Base Control layer ++ *\addtogroup ADSP Driver ++ ****************************************************************************** ++ *\date Oct. 21, 2017 ++ *\author Renesas Electronics Corporation ++ ****************************************************************************** ++ *\par Copyright ++ * ++ * Copyright(c) 2016 Renesas Electoronics Corporation ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a copy ++ * of this software and associated documentation files (the "Software"), to deal ++ * in the Software without restriction, including without limitation the rights ++ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++ * copies of the Software, and to permit persons to whom the Software is ++ * furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included in ++ * all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ++ * THE SOFTWARE. ++ ******************************************************************************/ ++ ++#include <linux/slab.h> ++#include <linux/kthread.h> ++#include <linux/wait.h> ++ ++#include "xf-adsp-base.h" ++ ++#define XF_AUX_POOL_SIZE (16) /**< size of auxiliary pool*/ ++#define XF_AUX_POOL_MSG_LENGTH (256) /**< size of auxiliary buffer */ ++ ++#define XF_PROXY_ALIGN (64) /**< proxy alignment */ ++ ++/** \def XF_ALIGNED(size) ++ * Get properly aligned buffer length ++ */ ++#define XF_ALIGNED(size)\ ++((((size) + XF_PROXY_ALIGN) - 1) & ~(XF_PROXY_ALIGN - 1)) /* PRQA S 3453 */ ++ ++#ifndef offset_of ++/** \def offset_of(type, member) ++ * Return the offset of member in type structuer in byte ++ */ ++#define offset_of(type, member) \ ++ ((int)(long int)&(((const type *)(0))->member)) /* PRQA S 3453 */ ++#endif ++ ++/************************************************* ++ * Variable and and function declaration ++ * **********************************************/ ++ ++/** ADSP base control data */ ++static struct xf_adsp_base *base; ++ ++/* function declaration */ ++static int xf_adsp_base_register_handle(void *private_data, ++ struct xf_callback_func *cb, ++ int comp_id); ++static inline struct xf_handle *xf_adsp_base_get_handle(int handle_id); ++static int xf_adsp_base_free_handle(int handle_id); ++static void xf_adsp_base_init_handle(void); ++static int xf_adsp_base_get_valid_handle(void); ++static int xf_send_and_receive(struct xf_message *msg); ++static int xf_response_thread(void *data); ++static void xf_buffer_put(struct xf_buffer *buffer); ++static u32 xf_buffer_length(struct xf_buffer *b); ++static struct xf_buffer *xf_buffer_get(struct xf_pool *pool); ++static void *xf_buffer_data(struct xf_buffer *b); ++static int xf_adsp_unregister(int comp_id); ++static int xf_adsp_register(char *name, int *comp_id); ++ ++/************************************************* ++ * Helper function to process pool data ++ * **********************************************/ ++ ++/** *********************************************************** ++ * \brief get buffer from given pool ++ * ++ * \param[in] pool Data pool address ++ * \retval b Pointer to buffer address in pool ++ **************************************************************/ ++static struct xf_buffer *xf_buffer_get(struct xf_pool *pool) ++{ ++ struct xf_buffer *b; ++ ++ b = pool->free; ++ if (b) { ++ pool->free = b->link.next; ++ b->link.pool = pool; ++ } ++ return b; ++} ++ ++/*********************************************************** ++ *\brief return buffer back to pool ++ * ++ *\param[in] buffer Pointer to the buffer data ++ ************************************************************/ ++static void xf_buffer_put(struct xf_buffer *buffer) ++{ ++ struct xf_pool *pool = buffer->link.pool; ++ ++ buffer->link.next = pool->free; ++ pool->free = buffer; ++} ++ ++/*********************************************************** ++ *\brief get the address of the given buffer data ++ * ++ *\param[in] b Pointer to the buffer data ++ *\retval address Address of buffer data ++ ************************************************************/ ++static void *xf_buffer_data(struct xf_buffer *b) ++{ ++ return b->address; ++} ++ ++/************************************************************ ++ *\brief get the length of the given buffer data ++ * ++ *\param[in] b Pointer to the buffer data ++ *\retval length Size of buffer data ++ ************************************************************/ ++static u32 xf_buffer_length(struct xf_buffer *b) /* PRQA S 3673 */ ++{ ++ return b->link.pool->length; ++} ++ ++/************************************************************ ++ *\brief set data to the given command message ++ * ++ *\param[out] m Pointer to the command message ++ *\param[in] id Message ID ++ *\param[in] opcode Message opcode ++ *\param[in] length Message length ++ *\param[in] buf Pointer to the buffer data ++ *\param[in] next Pointer to the next message ++ *\retval m Pointer to the command message ++ ************************************************************/ ++static inline struct xf_message * ++xf_create_msg(struct xf_message *m, u32 id, u32 opcode, u32 length, void *buf, ++ struct xf_message *next) ++{ ++ if (m) { ++ m->id = id; ++ m->opcode = opcode; ++ m->length = length; ++ m->buffer = buf; ++ m->next = next; ++ } ++ ++ return m; ++} ++ ++/***************************************************************** ++ *\brief synchronous send and wait for response message from proxy ++ * ++ *\param[in] msg Pointer to the command message ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ ****************************************************************/ ++static int xf_send_and_receive(struct xf_message *msg) ++{ ++ int err; ++ int opcode = msg->opcode; ++ ++ /* reset the base flag */ ++ spin_lock(&base->lock); ++ base->base_flag = FALSE; ++ spin_unlock(&base->lock); ++ ++ err = base->cmd.send(base->client, (void *)msg); ++ if (err != 0) ++ return err; ++ ++ /* sleep and wait for the response wake up event */ ++ if (wait_event_interruptible(base->base_wait, ++ base->base_flag || base->err_flag)) { ++ return -EINVAL; ++ } ++ ++ if (base->err_flag != 0) { ++ spin_lock(&base->lock); ++ base->err_flag = FALSE; ++ spin_unlock(&base->lock); ++ return -EINVAL; ++ } ++ ++ /* save the response message */ ++ /* PRQA S 3200 */ ++ memcpy(msg, &base->base_msg, sizeof(struct xf_message)); ++ ++ /* check if the reponsed message is right */ ++ if (msg->opcode != opcode) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++/************************************************************* ++ *\brief send a message to proxy ++ * ++ *\param[in] msg Pointer to the command message ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++static inline int xf_send(struct xf_message *msg) ++{ ++ return base->cmd.send(base->client, (void *)msg); ++} ++ ++/** *********************************************************** ++ *\brief receive message from proxy ++ * ++ *\param[in] msg Pointer to store the response message ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++static inline int xf_receive(struct xf_message *msg) ++{ ++ /* do not wait here */ ++ return base->cmd.recv(base->client, (void *)msg); ++} ++ ++/** *********************************************************** ++ *\brief thread for receive response data ++ **************************************************************/ ++static int xf_response_thread(void *data) ++{ ++ struct xf_message msg; ++ struct xf_handle *handle; ++ int id; ++ ++ /* set polling to wait the response message */ ++ spin_lock(&base->lock); ++ base->wait_flag = FALSE; ++ spin_unlock(&base->lock); ++ ++ while (!kthread_should_stop()) { ++ if (base->cmd.poll(base->client, &base->wait_flag) != 0) ++ continue; ++ ++ if (xf_receive(&msg) != 0) ++ continue; ++ ++ /* get the handle id */ ++ id = XF_AP_CLIENT(msg.id); ++ ++ /* check the destination of the response message */ ++ if (id == 0) { ++ /* message is from base control */ ++ /* PRQA S 3200 1*/ ++ memcpy(&base->base_msg, &msg, ++ sizeof(struct xf_message)); ++ ++ spin_lock(&base->lock); ++ base->base_flag = TRUE; ++ spin_unlock(&base->lock); ++ ++ wake_up(&base->base_wait); ++ continue; ++ } ++ ++ /* get handle data */ ++ handle = xf_adsp_base_get_handle(id); ++ ++ if (handle == 0) ++ continue; ++ ++ switch (msg.opcode) { ++ case XF_EMPTY_THIS_BUFFER: /* PRQA S 0594 */ ++ handle->cb->empty_buf_done(handle->private_data, ++ msg.opcode, ++ msg.length, ++ msg.buffer); ++ break; ++ case XF_FILL_THIS_BUFFER: /* PRQA S 0594 */ ++ handle->cb->fill_buf_done(handle->private_data, ++ msg.opcode, ++ msg.length, ++ msg.buffer); ++ break; ++ case XF_SET_PARAM: /* PRQA S 0594 4 */ ++ case XF_GET_PARAM: ++ case XF_ROUTE: ++ case XF_UNROUTE: ++ /* message is from base control */ ++ memcpy(&base->base_msg, &msg, ++ sizeof(struct xf_message)); /* PRQA S 3200 */ ++ ++ spin_lock(&base->lock); ++ base->base_flag = TRUE; ++ spin_unlock(&base->lock); ++ ++ wake_up(&base->base_wait); ++ break; ++ default: ++ /* error has occurred */ ++ handle->cb->event_handler(handle->private_data); ++ ++ xf_adsp_base_free_handle(id); /* PRQA S 3200 */ ++ ++ spin_lock(&base->lock); ++ base->err_flag = TRUE; ++ spin_unlock(&base->lock); ++ ++ wake_up(&base->base_wait); ++ break; ++ } ++ } ++ ++ pr_info("ADSP base thread was exited\n"); ++ ++ do_exit(0); ++ return 0; ++} ++ ++/************************************************************* ++ * \brief register component to ADSP ++ * ++ * \param[in] name Name string of component ++ * \param[out] comp_id Store the registered component ID ++ * \retval 0 Success ++ * \retval -EINVAL Failed ++ **************************************************************/ ++static int xf_adsp_register(char *name, int *comp_id) /* PRQA S 3673 */ ++{ ++ struct xf_message msg; ++ struct xf_buffer *b = xf_buffer_get(base->aux_pool); ++ int err = 0; ++ ++ msg.id = __XF_MSG_ID(__XF_AP_PROXY(0), __XF_DSP_PROXY(0)); ++ msg.opcode = XF_REGISTER; ++ msg.length = strlen(name) + 1; ++ msg.buffer = xf_buffer_data(b); ++ ++ /* copy identify name of ADSP component */ ++ if (msg.length <= xf_buffer_length(b)) ++ strncpy(msg.buffer, name, msg.length); /* PRQA S 3200 */ ++ else ++ strncpy(msg.buffer, name, xf_buffer_length(b));/* PRQA S 3200 */ ++ ++ err = xf_send_and_receive(&msg); ++ if (err != 0) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* save the registered component ID */ ++ *comp_id = XF_MSG_SRC(msg.id); ++ ++exit: ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ * \brief unregister component from ADSP ++ * \param[in] comp_id Registered component ID ++ * \retval 0 Success ++ * \retval -EINVAL Failed ++ **************************************************************/ ++static int xf_adsp_unregister(int comp_id) ++{ ++ struct xf_message msg; ++ ++ xf_create_msg(&msg, __XF_MSG_ID(__XF_AP_PROXY(0), comp_id), ++ XF_UNREGISTER, 0, NULL, NULL); /* PRQA S 3200 */ ++ ++ return xf_send_and_receive(&msg); ++} ++ ++/*************************************************************** ++ * APIs for ADSP component helper ++ * ************************************************************/ ++/** *********************************************************** ++ * \brief allocate memory pool from shared memory ++ * \param[in] pool_size Number of buffer need to allocate ++ * \param[in] buf_length Size of each buffer in bytes ++ * \retval pool Pointer to allocated pool ++ * \retval -EINVAL Invalid base data ++ * \retval -ENOMEM Out of memory resource ++ **************************************************************/ ++struct xf_pool *xf_adsp_allocate_mem_pool(int pool_size, int buf_length) ++{ ++ void *data; ++ u32 number; ++ struct xf_buffer *b; ++ struct xf_message msg; ++ struct xf_pool *pool; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return ERR_PTR(-EINVAL); /* PRQA S 0306 */ ++ ++ xf_create_msg(&msg, __XF_MSG_ID(__XF_AP_PROXY(0), __XF_DSP_PROXY(0)), ++ XF_ALLOC, ++ buf_length * pool_size, NULL, NULL); /* PRQA S 3200 */ ++ ++ err = xf_send_and_receive(&msg); ++ if (err != 0) ++ return ERR_PTR(-ENOMEM); /* PRQA S 0306 */ ++ ++ /* PRQA S 0306 1 */ ++ pool = kmalloc(offset_of(struct xf_pool, buffer) + ++ (pool_size * sizeof(struct xf_buffer)), GFP_KERNEL); ++ ++ if (!pool) ++ return ERR_PTR(-ENOMEM); /* PRQA S 0306 */ ++ ++ pool->length = buf_length; ++ pool->number = pool_size; ++ pool->p = msg.buffer; ++ ++ number = pool_size; ++ for (pool->free = b = &pool->buffer[0], data = pool->p; ++ number > 0; number--, b++) { /* PRQA S 2462,3418,0489 */ ++ /* set address of the buffer */ ++ b->address = data; ++ ++ /* fill buffer into free list */ ++ if (number == 1) ++ b->link.next = NULL; ++ else ++ b->link.next = b + 1; /* PRQA S 0489 */ ++ ++ /* advance data pointer in contigous buffer */ ++ data += buf_length; /* PRQA S 0550 */ ++ } ++ ++ return pool; ++} ++ ++/** *********************************************************** ++ *\brief return memory to shared memory ++ *\param[in] pool Data pool address ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base or pool data ++ **************************************************************/ ++int xf_adsp_free_mem_pool(struct xf_pool *pool) ++{ ++ struct xf_message msg; ++ ++ /* check the sane ADSP base pool data*/ ++ if (!base || !pool) ++ return -EINVAL; ++ ++ xf_create_msg(&msg, __XF_MSG_ID(__XF_AP_PROXY(0), __XF_DSP_PROXY(0)), ++ XF_FREE, pool->number * pool->length, ++ pool->p, NULL); /* PRQA S 3200 */ ++ ++ xf_send_and_receive(&msg); /* PRQA S 3200 */ ++ ++ kfree(pool); ++ ++ return 0; ++} ++ ++/** *********************************************************** ++ *\brief get buffer from given pool ++ * ++ *\param[in] pool Data pool address ++ *\param[in] index Buffer index ++ *\retval b Pointer to buffer address in pool ++ *\retval -EINVAL Invalid pool or index ++ **************************************************************/ ++char *xf_adsp_get_data_from_pool(struct xf_pool *pool, int index) ++{ ++ struct xf_buffer *buf[XF_BUF_POOL_SIZE] = {0}; ++ char *data; ++ int i; ++ ++ /* check the sane pool data*/ ++ if (!pool) ++ return ERR_PTR(-EINVAL); /* PRQA S 306 */ ++ ++ /* check the index is valid */ ++ if (index > (pool->number - 1)) ++ return ERR_PTR(-EINVAL); /* PRQA S 306 */ ++ ++ /* get buffer from pool */ ++ for (i = 0; i <= index; i++) ++ buf[i] = xf_buffer_get(pool); ++ ++ /* get data from buffer */ ++ data = xf_buffer_data(buf[index]); ++ ++ /* return buffer to pool */ ++ for (i = index; i >= 0; i--) ++ xf_buffer_put(buf[i]); ++ ++ return data; ++} ++ ++/** *********************************************************** ++ *\brief send empty this buffer command to ADSP framework ++ * ++ *\param[in] handle_id ID of the registered handle ++ *\param[in] buffer Pointer to data buffer ++ *\param[in] length Size of buffer in bytes ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_empty_this_buffer(int handle_id, char *buffer, int length) ++{ ++ struct xf_message msg; ++ struct xf_handle *handle; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ /* submit message to port 0 of component */ ++ /* PRQA S 3200 2 */ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_EMPTY_THIS_BUFFER, length, buffer, NULL); ++ ++ xf_send(&msg); /* PRQA S 3200 */ ++ ++ return 0; ++} ++ ++/** *********************************************************** ++ *\brief send fill this buffer command to ADSP framework ++ * ++ *\param[in] handle_id ID of the registered handle ++ *\param[in] buffer Pointer to data buffer ++ *\param[in] length Size of buffer in bytes ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_fill_this_buffer(int handle_id, char *buffer, int length) ++{ ++ struct xf_message msg; ++ struct xf_handle *handle; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ /* submit message to port 1 of component */ ++ /* PRQA S 3200 2 */ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 1)), ++ XF_FILL_THIS_BUFFER, length, buffer, NULL); ++ ++ xf_send(&msg); /* PRQA S 3200 */ ++ ++ return 0; ++} ++ ++/** *********************************************************** ++ *\brief route data between two registered ADSP plugins ++ * ++ *\param[in] src_handle_id Handle ID of source plugin ++ *\param[in] dst_handle_id Handle ID of sink plugin ++ *\param[in] buf_cnt Number of buffer in tunnel ++ *\param[in] buf_size Size of each buffer in tunnel ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int ++xf_adsp_route(int src_handle_id, int dst_handle_id, int buf_cnt, int buf_size) ++{ ++ struct xf_route_port_msg *route_msg; ++ struct xf_message msg; ++ struct xf_buffer *b; ++ struct xf_handle *dst_handle, *src_handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ /* get handle data */ ++ dst_handle = xf_adsp_base_get_handle(dst_handle_id); ++ src_handle = xf_adsp_base_get_handle(src_handle_id); ++ ++ if (!dst_handle || !src_handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ route_msg = xf_buffer_data(b); ++ ++ /* route information */ ++ route_msg->dst = __XF_PORT_SPEC2(dst_handle->comp_id, 0); ++ route_msg->alloc_align = 4; ++ route_msg->alloc_number = buf_cnt; ++ route_msg->alloc_size = buf_size; ++ ++ /* PRQA S 3200 2*/ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, src_handle_id), ++ __XF_PORT_SPEC2(src_handle->comp_id, 1)), ++ XF_ROUTE, sizeof(*route_msg), route_msg, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief set a single parameter ++ * ++ *\param[in] handle_id ID of registered handle ++ *\param[in] index Sub-command index of parameter ++ *\param[in] value the setting value ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_set_param(int handle_id, int index, int value) ++{ ++ struct xf_message msg; ++ struct xf_buffer *b; ++ struct xf_set_param_msg *msg_params; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ msg_params = xf_buffer_data(b); ++ ++ msg_params->item[0].id = index; ++ msg_params->item[0].value = value; ++ ++ /* PRQA S 3200 2 */ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_SET_PARAM, XF_SET_PARAM_CMD_LEN(1), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief get a single parameter ++ * ++ *\param[in] handle_id ID of registered handle ++ *\param[in] index Sub-command index of parameter ++ *\param[out] value Store the getting value ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_get_param(int handle_id, int index, int *value) ++{ ++ struct xf_message msg; ++ struct xf_buffer *b; ++ union xf_get_param_msg *msg_params; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base and value data */ ++ if (!base || !value) ++ return -EINVAL; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ msg_params = xf_buffer_data(b); ++ ++ msg_params->c.id[0] = index; ++ ++ /* PRQA S 3200 2 */ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_GET_PARAM, XF_GET_PARAM_CMD_LEN(1), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ if (err != 0) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* save the received parameters */ ++ *value = msg_params->r.value[0]; ++ ++exit: ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/*************************************************** ++ * APIs for ADSP base control ++ * ************************************************/ ++ ++/** *********************************************************** ++ *\brief initialize ADSP base's instance ++ * ++ *\retval 0 Success ++ *\retval -EINVAL ADSP base's instance has been initialized ++ *\retval -ENOMEM Cannot allocate memory for ADSP base ++ *\retval -EBUSY Cannot register client to proxy ++ **************************************************************/ ++int xf_adsp_base_create(struct xf_adsp_base_cmd *cmd) ++{ ++ int err = 0; ++ ++ if (base != 0) ++ return -EINVAL; ++ ++ if (!cmd || !cmd->recv || !cmd->send || !cmd->poll || ++ !cmd->client_register || !cmd->client_unregister) ++ return -EINVAL; ++ ++ base = kmalloc(sizeof(*base), GFP_KERNEL); ++ if (!base) ++ return -ENOMEM; ++ ++ memset(base, 0, sizeof(struct xf_adsp_base)); /* PRQA S 3200 */ ++ ++ /* store the proxy command */ ++ memcpy(&base->cmd, cmd, sizeof(struct xf_adsp_base_cmd)); ++ ++ /* create client to connect from proxy driver */ ++ err = base->cmd.client_register(&base->client); ++ if (err != 0) ++ goto err3; /* PRQA S 2001 */ ++ ++ /* initialize waiting queue */ ++ init_waitqueue_head(&base->base_wait); ++ ++ /* initialize handle */ ++ xf_adsp_base_init_handle(); ++ ++ /* create thread to get the responsed message from proxy */ ++ base->rsp_thread = kthread_run(&xf_response_thread, ++ (void *)base, "adsp base"); ++ ++ if (base->rsp_thread != 0) { ++ pr_info("ADSP base thread has been started.\n"); ++ } else { ++ pr_info("Failed in create base thread\n"); ++ err = -ENOMEM; ++ goto err2; /* PRQA S 2001 */ ++ } ++ ++ /* allocate auxiliary pool for component usage */ ++ base->aux_pool = xf_adsp_allocate_mem_pool( ++ XF_AUX_POOL_SIZE, ++ XF_ALIGNED(XF_AUX_POOL_MSG_LENGTH)); ++ ++ if (IS_ERR(base->aux_pool)) { /* PRQA S 306 */ ++ err = -ENOMEM; ++ goto err1; /* PRQA S 2001 */ ++ } ++ ++ pr_info("ADSP base was created\n"); ++ return 0; ++ ++err1: ++ /* cancel the waitting queue */ ++ spin_lock(&base->lock); ++ base->wait_flag = TRUE; ++ spin_unlock(&base->lock); ++ ++ /* stop thread inadvance */ ++ kthread_stop(base->rsp_thread); ++ ++err2: ++ base->cmd.client_unregister(base->client); ++ ++err3: ++ kfree(base); ++ base = NULL; ++ ++ return err; ++} ++EXPORT_SYMBOL(xf_adsp_base_create); /* PRQA S 0651 */ ++ ++/** *********************************************************** ++ *\brief deinitialize ADSP base's instance ++ * ++ *\retval 0 Success ++ *\retval -EINVAL Invalid ADSP base's instance ++ **************************************************************/ ++int xf_adsp_base_destroy(void) ++{ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ /* free auxiliary pool to shared memory */ ++ xf_adsp_free_mem_pool(base->aux_pool); /* PRQA S 3200 */ ++ ++ /* cancel wait the response message, go to stop process */ ++ spin_lock(&base->lock); ++ base->wait_flag = TRUE; ++ spin_unlock(&base->lock); ++ ++ /* stop response thread */ ++ kthread_stop(base->rsp_thread); ++ ++ /* unregister client */ ++ base->cmd.client_unregister(base->client); ++ ++ kfree(base); ++ base = NULL; ++ ++ pr_info("ADSP base was destroyed\n"); ++ return 0; ++} ++EXPORT_SYMBOL(xf_adsp_base_destroy); /* PRQA S 0651 */ ++ ++/** *********************************************************** ++ * \brief initialize handle instance ++ **************************************************************/ ++static inline void xf_adsp_base_init_handle(void) ++{ ++ int i; ++ ++ for (i = 0; i < MAX_HANDLE; i++) ++ base->handle[i] = NULL; ++} ++ ++/** *********************************************************** ++ *\brief get the next available handle ID for register ++ * ++ *\retval -1 Unavailable handle ID ++ *\retval 0 to 255 Available handle ID ++ **************************************************************/ ++static inline int xf_adsp_base_get_valid_handle(void) ++{ ++ int id = -1; ++ int i; ++ ++ for (i = 0; i < MAX_HANDLE; i++) { ++ /* get the id of the first available handler */ ++ if (!base->handle[i]) { ++ id = i; ++ break; ++ } ++ } ++ ++ return id; ++} ++ ++/** *********************************************************** ++ *\brief register a handle instance for component usage ++ * ++ *\param[in] private_data Private data of this component ++ *\param[in] cb Callback function ++ *\param[in] comp_id ID of register component ++ *\retval id ID of registered handle ++ *\retval -EINVAL Cannot get the handle instance ++ *\retval -ENOMEM Cannot allocate handle memory ++ **************************************************************/ ++static int xf_adsp_base_register_handle(void *private_data, ++ struct xf_callback_func *cb, ++ int comp_id) ++{ ++ struct xf_handle *handle; ++ int id; ++ ++ /* get the next handle id */ ++ id = xf_adsp_base_get_valid_handle(); ++ ++ /* check available handle in base */ ++ if (id < 0) ++ return -EINVAL; ++ ++ /* allocate handle data */ ++ handle = kmalloc(sizeof(*handle), GFP_KERNEL); ++ if (!handle) ++ return -ENOMEM; ++ ++ /* save handle data */ ++ handle->private_data = private_data; ++ handle->cb = cb; ++ handle->comp_id = comp_id; ++ ++ /* save the hanle data */ ++ base->handle[id] = handle; ++ ++ /* return the id numbering in base handle */ ++ return (id + 1); ++} ++ ++/** *********************************************************** ++ *\brief get handle instance from handle ID ++ * ++ *\param[in] handle_id ID of registered handle ++ *\retval handle Pointer to handle instance ++ **************************************************************/ ++static inline struct xf_handle *xf_adsp_base_get_handle(int handle_id) ++{ ++ return base->handle[handle_id - 1]; ++} ++ ++/** *********************************************************** ++ *\brief free the registered handle instance ++ * ++ *\param[in] handle_id ID of registered handle ++ *\retval 0 Success ++ *\retval -EINVAL Invalid handle ID ++ **************************************************************/ ++static int xf_adsp_base_free_handle(int handle_id) ++{ ++ if (handle_id < 1 || handle_id > MAX_HANDLE) ++ return -EINVAL; ++ ++ kfree(base->handle[handle_id - 1]); ++ base->handle[handle_id - 1] = NULL; ++ ++ return 0; ++} ++ ++/*********************************************************************** ++ * APIs for Renderer component ++ * ********************************************************************/ ++ ++/** *********************************************************** ++ *\brief set ADSP Renderer parameters ++ * ++ *\param[in] renderer Pointer to Renderer component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_renderer_set_params(struct xf_adsp_renderer *renderer) ++{ ++ struct xf_message msg; ++ struct xf_set_param_msg *msg_params; ++ struct xf_adsp_renderer_params *params; ++ struct xf_buffer *b; ++ int i; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !renderer) ++ return -EINVAL; ++ ++ params = &renderer->params; ++ ++ /* get Renderer's handle data */ ++ handle = xf_adsp_base_get_handle(renderer->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_SAMPLE_RATE; ++ msg_params->item[i++].value = params->in_rate; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_CHANNELS; ++ msg_params->item[i++].value = params->channel; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->item[i++].value = params->pcm_width; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_FRAME_SIZE; ++ msg_params->item[i++].value = params->frame_size; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_OUTPUT1; ++ msg_params->item[i++].value = params->dev1; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_OUTPUT2; ++ msg_params->item[i++].value = params->dev2; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_DMACHANNEL1; ++ msg_params->item[i++].value = params->dma1; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_DMACHANNEL2; ++ msg_params->item[i++].value = params->dma2; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ msg_params->item[i++].value = params->out_rate; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_VOLUME_RATE; ++ msg_params->item[i++].value = params->vol_rate; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_OUT_CHANNELS; ++ msg_params->item[i++].value = params->out_channel; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_MIX_CONTROL; ++ msg_params->item[i++].value = params->mix_ctrl; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_STATE; ++ msg_params->item[i++].value = params->state; ++ ++ /* PRQA S 3200 2*/ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, renderer->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_SET_PARAM, XF_SET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief get ADSP Renderer parameters ++ * ++ *\param[in] renderer Pointer to Renderer component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++/* PRQA S 1505 */ ++int xf_adsp_renderer_get_params(struct xf_adsp_renderer *renderer) ++{ ++ struct xf_adsp_renderer_params *rdr_params; ++ struct xf_message msg; ++ struct xf_buffer *b; ++ union xf_get_param_msg *msg_params; ++ int i; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !renderer) ++ return -EINVAL; ++ ++ rdr_params = &renderer->params; ++ ++ /* get Renderer's handle data */ ++ handle = xf_adsp_base_get_handle(renderer->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ /* PRQA S 3440 13 1*/ ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_SAMPLE_RATE; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_CHANNELS; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_FRAME_SIZE; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_OUTPUT1; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_OUTPUT2; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_DMACHANNEL1; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_DMACHANNEL2; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_VOLUME_RATE; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_OUT_CHANNELS; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_MIX_CONTROL; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_STATE; ++ ++ /* PRQA S 3200 2*/ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, renderer->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_GET_PARAM, XF_GET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ if (err != 0) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* save the received parameters */ ++ i = 0; ++ rdr_params->in_rate = msg_params->r.value[i++]; /* PRQA S 3440 13 */ ++ rdr_params->channel = msg_params->r.value[i++]; ++ rdr_params->pcm_width = msg_params->r.value[i++]; ++ rdr_params->frame_size = msg_params->r.value[i++]; ++ rdr_params->dev1 = msg_params->r.value[i++]; ++ rdr_params->dev2 = msg_params->r.value[i++]; ++ rdr_params->dma1 = msg_params->r.value[i++]; ++ rdr_params->dma2 = msg_params->r.value[i++]; ++ rdr_params->out_rate = msg_params->r.value[i++]; ++ rdr_params->vol_rate = msg_params->r.value[i++]; ++ rdr_params->out_channel = msg_params->r.value[i++]; ++ rdr_params->mix_ctrl = msg_params->r.value[i++]; ++ rdr_params->state = msg_params->r.value[i++]; ++ ++exit: ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** ************************************************************************** ++ *\brief create Renderer component ++ * ++ *\param[in,out] renderer Pointer to the registered component ++ *\param[in] cb Callback function ++ *\param[in] private_data Private data ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base instance or register fail ++ *\retval -ENOMEM Cannot allocate Renderer instance ++ *****************************************************************************/ ++int xf_adsp_renderer_create(struct xf_adsp_renderer **renderer, ++ struct xf_callback_func *cb, void *private_data) ++{ ++ struct xf_adsp_renderer *rdr; ++ int err; ++ int comp_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ rdr = kmalloc(sizeof(*rdr), GFP_KERNEL); ++ if (!rdr) ++ return -ENOMEM; ++ ++ memset(rdr, 0, sizeof(struct xf_adsp_renderer)); /* PRQA S 3200 */ ++ ++ /* register renderer component */ ++ err = xf_adsp_register("renderer", &comp_id); ++ if (err != 0) ++ goto err2; /* PRQA S 2001 */ ++ ++ /* register Renderer to ADSP base control */ ++ rdr->handle_id = xf_adsp_base_register_handle(private_data, ++ cb, comp_id); ++ ++ if (rdr->handle_id <= 0) { ++ err = -EINVAL; ++ goto err1; /* PRQA S 2001 */ ++ } ++ ++ /* get the default parameter from Renderer plugin */ ++ err = xf_adsp_renderer_get_params(rdr); ++ if (err != 0) ++ goto err1; /* PRQA S 2001 */ ++ ++ /* save renderer compoent data */ ++ *renderer = rdr; ++ ++ return 0; ++ ++err1: ++ xf_adsp_unregister(comp_id); /* PRQA S 3200 */ ++ ++err2: ++ kfree(rdr); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief deinitialize ADSP Renderer component ++ * ++ *\param[in] renderer Pointer to Renderer component ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base or Renderer data ++ **************************************************************/ ++/* PRQA S 3673 */ ++int xf_adsp_renderer_destroy(struct xf_adsp_renderer *renderer) ++{ ++ struct xf_handle *handle; ++ int handle_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !renderer) ++ return -EINVAL; ++ ++ handle_id = renderer->handle_id; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* unregister component */ ++ xf_adsp_unregister(handle->comp_id); /* PRQA S 3200 */ ++ ++ /* free handle data from base control */ ++ xf_adsp_base_free_handle(handle_id); /* PRQA S 3200 */ ++ ++exit: ++ kfree(renderer); ++ ++ return 0; ++} ++ ++/*********************************************************************** ++ * APIs for Capture component ++ * ********************************************************************/ ++ ++/** *********************************************************** ++ *\brief set ADSP Capture parameters ++ * ++ *\param[in] capture Pointer to Capture component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_capture_set_params(struct xf_adsp_capture *capture) ++{ ++ struct xf_message msg; ++ struct xf_set_param_msg *msg_params; ++ struct xf_adsp_capture_params *params; ++ struct xf_buffer *b; ++ int i; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !capture) ++ return -EINVAL; ++ ++ params = &capture->params; ++ ++ /* get Capture's handle data */ ++ handle = xf_adsp_base_get_handle(capture->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_SAMPLE_RATE; ++ msg_params->item[i++].value = params->in_rate; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_CHANNELS; ++ msg_params->item[i++].value = params->channel; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->item[i++].value = params->pcm_width; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_FRAME_SIZE; ++ msg_params->item[i++].value = params->frame_size; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_INPUT1; ++ msg_params->item[i++].value = params->dev1; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_INPUT2; ++ msg_params->item[i++].value = params->dev2; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_DMACHANNEL1; ++ msg_params->item[i++].value = params->dma1; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_DMACHANNEL2; ++ msg_params->item[i++].value = params->dma2; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ msg_params->item[i++].value = params->out_rate; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_VOLUME_RATE; ++ msg_params->item[i++].value = params->vol_rate; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_STATE; ++ msg_params->item[i++].value = params->state; ++ ++ /* PRQA S 3200 2 */ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, capture->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_SET_PARAM, XF_SET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief get ADSP Capture parameters ++ * ++ *\param[in] capture Pointer to Capture component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++/* PRQA S 1505 */ ++int xf_adsp_capture_get_params(struct xf_adsp_capture *capture) ++{ ++ struct xf_adsp_capture_params *cap_params; ++ struct xf_message msg; ++ struct xf_buffer *b; ++ union xf_get_param_msg *msg_params; ++ int i; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !capture) ++ return -EINVAL; ++ ++ cap_params = &capture->params; ++ ++ /* get Capture's handle data */ ++ handle = xf_adsp_base_get_handle(capture->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ /* PRQA S 3440 11 1*/ ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_SAMPLE_RATE; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_CHANNELS; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_FRAME_SIZE; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_INPUT1; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_INPUT2; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_DMACHANNEL1; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_DMACHANNEL2; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_VOLUME_RATE; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_STATE; ++ ++ /* PRQA S 3200 2 */ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, capture->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_GET_PARAM, XF_GET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ if (err != 0) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* save the received parameters */ ++ i = 0; ++ cap_params->in_rate = msg_params->r.value[i++]; /* PRQA S 3440 11 */ ++ cap_params->channel = msg_params->r.value[i++]; ++ cap_params->pcm_width = msg_params->r.value[i++]; ++ cap_params->frame_size = msg_params->r.value[i++]; ++ cap_params->dev1 = msg_params->r.value[i++]; ++ cap_params->dev2 = msg_params->r.value[i++]; ++ cap_params->dma1 = msg_params->r.value[i++]; ++ cap_params->dma2 = msg_params->r.value[i++]; ++ cap_params->out_rate = msg_params->r.value[i++]; ++ cap_params->vol_rate = msg_params->r.value[i++]; ++ cap_params->state = msg_params->r.value[i++]; ++ ++exit: ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** ************************************************************************** ++ *\brief create Capture component ++ * ++ *\param[in,out] capture Pointer to the registered component ++ *\param[in] cb Callback function ++ *\param[in] private_data Private data ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base instance or register fail ++ *\retval -ENOMEM Cannot allocate Capture instance ++ *****************************************************************************/ ++int xf_adsp_capture_create(struct xf_adsp_capture **capture, ++ struct xf_callback_func *cb, void *private_data) ++{ ++ struct xf_adsp_capture *cap; ++ int err; ++ int comp_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ cap = kmalloc(sizeof(*cap), GFP_KERNEL); ++ if (!cap) ++ return -ENOMEM; ++ ++ memset(cap, 0, sizeof(struct xf_adsp_capture)); /* PRQA S 3200 */ ++ ++ /* register capture component */ ++ err = xf_adsp_register("capture", &comp_id); ++ if (err != 0) ++ goto err2; /* PRQA S 2001 */ ++ ++ /* register capture to ADSP base control */ ++ cap->handle_id = xf_adsp_base_register_handle(private_data, ++ cb, comp_id); ++ ++ if (cap->handle_id <= 0) { ++ err = -EINVAL; ++ goto err1; /* PRQA S 2001 */ ++ } ++ ++ /* get the default parameter from capture plugin */ ++ err = xf_adsp_capture_get_params(cap); ++ if (err != 0) ++ goto err1; /* PRQA S 2001 */ ++ ++ /* save capture compoent data */ ++ *capture = cap; ++ ++ return 0; ++ ++err1: ++ xf_adsp_unregister(comp_id); /* PRQA S 3200 */ ++ ++err2: ++ kfree(cap); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief deinitialize ADSP Capture component ++ * ++ *\param[in] capture Pointer to Capture component ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base or Capture data ++ **************************************************************/ ++int xf_adsp_capture_destroy(struct xf_adsp_capture *capture) /* PRQA S 3673 */ ++{ ++ struct xf_handle *handle; ++ int handle_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !capture) ++ return -EINVAL; ++ ++ handle_id = capture->handle_id; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* unregister component */ ++ xf_adsp_unregister(handle->comp_id); /* PRQA S 3200 */ ++ ++ /* free handle data from base control */ ++ xf_adsp_base_free_handle(handle_id); /* PRQA S 3200 */ ++ ++exit: ++ kfree(capture); ++ ++ return 0; ++} ++ ++/*********************************************************************** ++ * APIs for Equalizer component ++ * ********************************************************************/ ++ ++/** *********************************************************** ++ *\brief set ADSP Equalizer parameters ++ * ++ *\param[in] equalizer Pointer to Equalizer component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_equalizer_set_params(struct xf_adsp_equalizer *equalizer) ++{ ++ struct xf_message msg; ++ struct xf_set_param_msg *msg_params; ++ struct xf_adsp_equalizer_params *params; ++ struct xf_buffer *b; ++ int i, n; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !equalizer) ++ return -EINVAL; ++ ++ params = &equalizer->params; ++ ++ /* get Equalizer's handle data */ ++ handle = xf_adsp_base_get_handle(equalizer->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ msg_params->item[i].id = XA_EQZ_CONFIG_PARAM_COEF_FS; ++ msg_params->item[i++].value = params->rate; ++ ++ msg_params->item[i].id = XA_EQZ_CONFIG_PARAM_CH; ++ msg_params->item[i++].value = params->channel; ++ ++ msg_params->item[i].id = XA_EQZ_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->item[i++].value = params->pcm_width; ++ ++ msg_params->item[i].id = XA_EQZ_CONFIG_PARAM_EQZ_TYPE; ++ msg_params->item[i++].value = params->eqz_type; ++ ++ if (params->eqz_type == XA_REL_EQZ_TYPE_PARAMETRIC) { ++ struct xf_equalizer_parametric_coef *coef = ¶ms->p_coef; ++ ++ for (n = 0; n < XA_REL_EQZ_FILTER_NUM; n++) { ++ msg_params->item[i].id = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_TYPE + n; ++ msg_params->item[i++].value = coef->type[n]; ++ ++ msg_params->item[i].id = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_FC + n; ++ msg_params->item[i++].value = coef->fc[n]; ++ ++ msg_params->item[i].id = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_BW + n; ++ msg_params->item[i++].value = coef->band_width[n]; ++ ++ msg_params->item[i].id = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_GA + n; ++ msg_params->item[i++].value = coef->gain[n]; ++ ++ msg_params->item[i].id = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_BA + n; ++ msg_params->item[i++].value = coef->gain_base[n]; ++ } ++ } else { ++ struct xf_equalizer_graphic_coef *coef = ¶ms->g_coef; ++ ++ for (n = 0; n < XA_REL_EQZ_GRAPHIC_BAND_NUM; n++) { ++ msg_params->item[i].id = ++ XA_EQZ_CONFIG_PARAM_BAND_0_GCOEF_GA + n; ++ msg_params->item[i++].value = coef->gain_g[n]; ++ } ++ } ++ ++ /* PRQA S 3200 2 */ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, equalizer->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_SET_PARAM, XF_SET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief get ADSP Equalizer parameters ++ * ++ *\param[in] equalizer Pointer to Equalizer component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++/* PRQA S 1505 1*/ ++int xf_adsp_equalizer_get_params(struct xf_adsp_equalizer *equalizer) ++{ ++ struct xf_adsp_equalizer_params *eqz_params; ++ struct xf_message msg; ++ struct xf_buffer *b; ++ union xf_get_param_msg *msg_params; ++ int i, n; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !equalizer) ++ return -EINVAL; ++ ++ eqz_params = &equalizer->params; ++ ++ /* get Equalizer's handle data */ ++ handle = xf_adsp_base_get_handle(equalizer->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ msg_params->c.id[i++] = XA_EQZ_CONFIG_PARAM_COEF_FS; /* PRQA S 3440 4 */ ++ msg_params->c.id[i++] = XA_EQZ_CONFIG_PARAM_CH; ++ msg_params->c.id[i++] = XA_EQZ_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->c.id[i++] = XA_EQZ_CONFIG_PARAM_EQZ_TYPE; ++ ++ for (n = 0; n < XA_REL_EQZ_FILTER_NUM; n++) { ++ /* PRQA S 3440 5 */ ++ msg_params->c.id[i++] = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_TYPE + n; ++ ++ msg_params->c.id[i++] = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_FC + n; ++ ++ msg_params->c.id[i++] = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_BW + n; ++ ++ msg_params->c.id[i++] = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_GA + n; ++ ++ msg_params->c.id[i++] = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_BA + n; ++ } ++ ++ for (n = 0; n < XA_REL_EQZ_GRAPHIC_BAND_NUM; n++) ++ /* PRQA S 3440 1 */ ++ msg_params->c.id[i++] = XA_EQZ_CONFIG_PARAM_BAND_0_GCOEF_GA + n; ++ ++ /* PRQA S 3200 2 */ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, equalizer->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_GET_PARAM, XF_GET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ if (err != 0) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* save the received parameters */ ++ i = 0; ++ eqz_params->rate = msg_params->r.value[i++]; /* PRQA S 3440 4 */ ++ eqz_params->channel = msg_params->r.value[i++]; ++ eqz_params->pcm_width = msg_params->r.value[i++]; ++ eqz_params->eqz_type = msg_params->r.value[i++]; ++ ++ for (n = 0; n < XA_REL_EQZ_FILTER_NUM; n++) { ++ /* PRQA S 3440 5 */ ++ eqz_params->p_coef.type[n] = msg_params->r.value[i++]; ++ eqz_params->p_coef.fc[n] = msg_params->r.value[i++]; ++ eqz_params->p_coef.band_width[n] = msg_params->r.value[i++]; ++ eqz_params->p_coef.gain[n] = msg_params->r.value[i++]; ++ eqz_params->p_coef.gain_base[n] = msg_params->r.value[i++]; ++ } ++ ++ for (n = 0; n < XA_REL_EQZ_GRAPHIC_BAND_NUM; n++) { ++ /* PRQA S 3440 1 */ ++ eqz_params->g_coef.gain_g[n] = msg_params->r.value[i++]; ++ } ++ ++exit: ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** ************************************************************************** ++ *\brief create Equalizer component ++ * ++ *\param[in,out] equalizer Pointer to the registered component ++ *\param[in] cb Callback function ++ *\param[in] private_data Private data ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base instance or register fail ++ *\retval -ENOMEM Cannot allocate Equalier instance ++ *****************************************************************************/ ++int xf_adsp_equalizer_create(struct xf_adsp_equalizer **equalizer, ++ struct xf_callback_func *cb, void *private_data) ++{ ++ struct xf_adsp_equalizer *eqz; ++ int err; ++ int comp_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ eqz = kmalloc(sizeof(*eqz), GFP_KERNEL); ++ if (!eqz) ++ return -ENOMEM; ++ ++ memset(eqz, 0, sizeof(struct xf_adsp_equalizer)); /* PRQA S 3200 */ ++ ++ /* register equalizer component */ ++ err = xf_adsp_register("equalizer", &comp_id); ++ if (err != 0) ++ goto err2; /* PRQA S 2001 */ ++ ++ /* register equalizer to ADSP base control */ ++ eqz->handle_id = xf_adsp_base_register_handle(private_data, ++ cb, comp_id); ++ ++ if (eqz->handle_id <= 0) { ++ err = -EINVAL; ++ goto err1; /* PRQA S 2001 */ ++ } ++ ++ /* get the default parameter from equalizer plugin */ ++ err = xf_adsp_equalizer_get_params(eqz); ++ if (err != 0) ++ goto err1; /* PRQA S 2001 */ ++ ++ /* save equalizer compoent data */ ++ *equalizer = eqz; ++ ++ return 0; ++ ++err1: ++ xf_adsp_unregister(comp_id); /* PRQA S 3200 */ ++ ++err2: ++ kfree(eqz); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief deinitialize ADSP Equalizer component ++ * ++ *\param[in] equalizer Pointer to Equalizer component ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base or Equalizer data ++ **************************************************************/ ++/* PRQA S 3673 */ ++int xf_adsp_equalizer_destroy(struct xf_adsp_equalizer *equalizer) ++{ ++ struct xf_handle *handle; ++ int handle_id; ++ ++ /* check the sane ADSP base and Equalizer data */ ++ if (!base || !equalizer) ++ return -EINVAL; ++ ++ handle_id = equalizer->handle_id; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* unregister component */ ++ xf_adsp_unregister(handle->comp_id); /* PRQA S 3200 */ ++ ++ /* free handle data from base control */ ++ xf_adsp_base_free_handle(handle_id); /* PRQA S 3200 */ ++ ++exit: ++ kfree(equalizer); ++ ++ return 0; ++} ++ ++/*********************************************************************** ++ * APIs for TDM Renderer component ++ * ********************************************************************/ ++ ++/** *********************************************************** ++ *\brief set ADSP TDM Renderer parameters ++ * ++ *\param[in] tdm_renderer Pointer to TDM Renderer component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_tdm_renderer_set_params(struct xf_adsp_tdm_renderer *tdm_renderer) ++{ ++ struct xf_message msg; ++ struct xf_set_param_msg *msg_params; ++ struct xf_adsp_tdm_renderer_params *params; ++ struct xf_buffer *b; ++ int i; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !tdm_renderer) ++ return -EINVAL; ++ ++ params = &tdm_renderer->params; ++ ++ /* get TDM Renderer's handle data */ ++ handle = xf_adsp_base_get_handle(tdm_renderer->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_IN_SAMPLE_RATE; ++ msg_params->item[i++].value = params->in_rate; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_CHANNEL_MODE; ++ msg_params->item[i++].value = params->ch_mode; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->item[i++].value = params->pcm_width; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_FRAME_SIZE; ++ msg_params->item[i++].value = params->frame_size; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_OUTPUT1; ++ msg_params->item[i++].value = params->dev1; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_OUTPUT2; ++ msg_params->item[i++].value = params->dev2; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_DMACHANNEL1; ++ msg_params->item[i++].value = params->dma1; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_DMACHANNEL2; ++ msg_params->item[i++].value = params->dma2; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ msg_params->item[i++].value = params->out_rate; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_VOLUME_RATE; ++ msg_params->item[i++].value = params->vol_rate; ++ ++ /* PRQA S 3200 2*/ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, tdm_renderer->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_SET_PARAM, XF_SET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief get ADSP TDM Renderer parameters ++ * ++ *\param[in] tdm_renderer Pointer to TDM Renderer component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++/* PRQA S 1505 1*/ ++int xf_adsp_tdm_renderer_get_params(struct xf_adsp_tdm_renderer *tdm_renderer) ++{ ++ struct xf_adsp_tdm_renderer_params *params; ++ struct xf_message msg; ++ struct xf_buffer *b; ++ union xf_get_param_msg *msg_params; ++ int i; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !tdm_renderer) ++ return -EINVAL; ++ ++ params = &tdm_renderer->params; ++ ++ /* get TDM Renderer's handle data */ ++ handle = xf_adsp_base_get_handle(tdm_renderer->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ /* PRQA S 3440 13 1*/ ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_IN_SAMPLE_RATE; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_CHANNEL_MODE; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_FRAME_SIZE; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_OUTPUT1; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_OUTPUT2; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_DMACHANNEL1; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_DMACHANNEL2; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_VOLUME_RATE; ++ ++ /* PRQA S 3200 2*/ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, tdm_renderer->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_GET_PARAM, XF_GET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ if (err != 0) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* save the received parameters */ ++ i = 0; ++ params->in_rate = msg_params->r.value[i++]; /* PRQA S 3440 13 */ ++ params->ch_mode = msg_params->r.value[i++]; ++ params->pcm_width = msg_params->r.value[i++]; ++ params->frame_size = msg_params->r.value[i++]; ++ params->dev1 = msg_params->r.value[i++]; ++ params->dev2 = msg_params->r.value[i++]; ++ params->dma1 = msg_params->r.value[i++]; ++ params->dma2 = msg_params->r.value[i++]; ++ params->out_rate = msg_params->r.value[i++]; ++ params->vol_rate = msg_params->r.value[i++]; ++ ++exit: ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** ************************************************************************** ++ *\brief create TDM Renderer component ++ * ++ *\param[in,out] tdm_renderer Pointer to the registered component ++ *\param[in] cb Callback function ++ *\param[in] private_data Private data ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base instance or register fail ++ *\retval -ENOMEM Cannot allocate Renderer instance ++ *****************************************************************************/ ++int xf_adsp_tdm_renderer_create(struct xf_adsp_tdm_renderer **tdm_renderer, ++ struct xf_callback_func *cb, ++ void *private_data) ++{ ++ struct xf_adsp_tdm_renderer *tdm_rdr; ++ int err; ++ int comp_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ tdm_rdr = kmalloc(sizeof(*tdm_rdr), GFP_KERNEL); ++ if (!tdm_rdr) ++ return -ENOMEM; ++ ++ /* PRQA S 3200 */ ++ memset(tdm_rdr, 0, sizeof(struct xf_adsp_tdm_renderer)); ++ ++ /* register TDM Renderer component */ ++ err = xf_adsp_register("tdm-renderer", &comp_id); ++ if (err != 0) ++ goto err2; /* PRQA S 2001 */ ++ ++ /* register TDM Renderer to ADSP base control */ ++ tdm_rdr->handle_id = xf_adsp_base_register_handle(private_data, ++ cb, comp_id); ++ ++ if (tdm_rdr->handle_id <= 0) { ++ err = -EINVAL; ++ goto err1; /* PRQA S 2001 */ ++ } ++ ++ /* get the default parameter from plugin */ ++ err = xf_adsp_tdm_renderer_get_params(tdm_rdr); ++ if (err != 0) ++ goto err1; /* PRQA S 2001 */ ++ ++ /* save compoent data */ ++ *tdm_renderer = tdm_rdr; ++ ++ return 0; ++ ++err1: ++ xf_adsp_unregister(comp_id); /* PRQA S 3200 */ ++ ++err2: ++ kfree(tdm_rdr); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief deinitialize ADSP TDM Renderer component ++ * ++ *\param[in] tdm_renderer Pointer to TDM Renderer component ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base or Renderer data ++ **************************************************************/ ++/* PRQA S 3673 1*/ ++int xf_adsp_tdm_renderer_destroy(struct xf_adsp_tdm_renderer *tdm_renderer) ++{ ++ struct xf_handle *handle; ++ int handle_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !tdm_renderer) ++ return -EINVAL; ++ ++ handle_id = tdm_renderer->handle_id; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* unregister component */ ++ xf_adsp_unregister(handle->comp_id); /* PRQA S 3200 */ ++ ++ /* free handle data from base control */ ++ xf_adsp_base_free_handle(handle_id); /* PRQA S 3200 */ ++ ++exit: ++ kfree(tdm_renderer); ++ ++ return 0; ++} ++ ++/*********************************************************************** ++ * APIs for TDM Capture component ++ * ********************************************************************/ ++ ++/** *********************************************************** ++ *\brief set ADSP TDM Capture parameters ++ * ++ *\param[in] tdm_capture Pointer to TDM Capture component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_tdm_capture_set_params(struct xf_adsp_tdm_capture *tdm_capture) ++{ ++ struct xf_message msg; ++ struct xf_set_param_msg *msg_params; ++ struct xf_adsp_tdm_capture_params *params; ++ struct xf_buffer *b; ++ int i; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !tdm_capture) ++ return -EINVAL; ++ ++ params = &tdm_capture->params; ++ ++ /* get TDM Capture's handle data */ ++ handle = xf_adsp_base_get_handle(tdm_capture->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_IN_SAMPLE_RATE; ++ msg_params->item[i++].value = params->in_rate; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_CHANNEL_MODE; ++ msg_params->item[i++].value = params->ch_mode; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->item[i++].value = params->pcm_width; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_FRAME_SIZE; ++ msg_params->item[i++].value = params->frame_size; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_INPUT1; ++ msg_params->item[i++].value = params->dev1; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_INPUT2; ++ msg_params->item[i++].value = params->dev2; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_DMACHANNEL1; ++ msg_params->item[i++].value = params->dma1; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_DMACHANNEL2; ++ msg_params->item[i++].value = params->dma2; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ msg_params->item[i++].value = params->out_rate; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_VOLUME_RATE; ++ msg_params->item[i++].value = params->vol_rate; ++ ++ /* PRQA S 3200 2*/ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, tdm_capture->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_SET_PARAM, XF_SET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief get ADSP TDM Capture parameters ++ * ++ *\param[in] tdm_capture Pointer to TDM Capture component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++/* PRQA S 1505 1*/ ++int xf_adsp_tdm_capture_get_params(struct xf_adsp_tdm_capture *tdm_capture) ++{ ++ struct xf_adsp_tdm_capture_params *params; ++ struct xf_message msg; ++ struct xf_buffer *b; ++ union xf_get_param_msg *msg_params; ++ int i; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !tdm_capture) ++ return -EINVAL; ++ ++ params = &tdm_capture->params; ++ ++ /* get TDM Capture's handle data */ ++ handle = xf_adsp_base_get_handle(tdm_capture->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ /* PRQA S 3440 13 1*/ ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_IN_SAMPLE_RATE; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_CHANNEL_MODE; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_FRAME_SIZE; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_INPUT1; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_INPUT2; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_DMACHANNEL1; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_DMACHANNEL2; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_VOLUME_RATE; ++ ++ /* PRQA S 3200 2*/ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, tdm_capture->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_GET_PARAM, XF_GET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ if (err != 0) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* save the received parameters */ ++ i = 0; ++ params->in_rate = msg_params->r.value[i++]; /* PRQA S 3440 13 */ ++ params->ch_mode = msg_params->r.value[i++]; ++ params->pcm_width = msg_params->r.value[i++]; ++ params->frame_size = msg_params->r.value[i++]; ++ params->dev1 = msg_params->r.value[i++]; ++ params->dev2 = msg_params->r.value[i++]; ++ params->dma1 = msg_params->r.value[i++]; ++ params->dma2 = msg_params->r.value[i++]; ++ params->out_rate = msg_params->r.value[i++]; ++ params->vol_rate = msg_params->r.value[i++]; ++ ++exit: ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** ************************************************************************** ++ *\brief create TDM Capture component ++ * ++ *\param[in,out] tdm_capture Pointer to the registered component ++ *\param[in] cb Callback function ++ *\param[in] private_data Private data ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base instance or register fail ++ *\retval -ENOMEM Cannot allocate Renderer instance ++ *****************************************************************************/ ++int xf_adsp_tdm_capture_create(struct xf_adsp_tdm_capture **tdm_capture, ++ struct xf_callback_func *cb, void *private_data) ++{ ++ struct xf_adsp_tdm_capture *tdm_cap; ++ int err; ++ int comp_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ tdm_cap = kmalloc(sizeof(*tdm_cap), GFP_KERNEL); ++ if (!tdm_cap) ++ return -ENOMEM; ++ ++ /* PRQA S 3200 */ ++ memset(tdm_cap, 0, sizeof(struct xf_adsp_tdm_capture)); ++ ++ /* register TDM Capture component */ ++ err = xf_adsp_register("tdm-capture", &comp_id); ++ if (err != 0) ++ goto err2; /* PRQA S 2001 */ ++ ++ /* register TDM Capture to ADSP base control */ ++ tdm_cap->handle_id = xf_adsp_base_register_handle(private_data, ++ cb, comp_id); ++ ++ if (tdm_cap->handle_id <= 0) { ++ err = -EINVAL; ++ goto err1; /* PRQA S 2001 */ ++ } ++ ++ /* get the default parameter from plugin */ ++ err = xf_adsp_tdm_capture_get_params(tdm_cap); ++ if (err != 0) ++ goto err1; /* PRQA S 2001 */ ++ ++ /* save compoent data */ ++ *tdm_capture = tdm_cap; ++ ++ return 0; ++ ++err1: ++ xf_adsp_unregister(comp_id); /* PRQA S 3200 */ ++ ++err2: ++ kfree(tdm_cap); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief deinitialize ADSP TDM Capture component ++ * ++ *\param[in] tdm_capture Pointer to TDM Capture component ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base or Renderer data ++ **************************************************************/ ++/* PRQA S 3673 */ ++int xf_adsp_tdm_capture_destroy(struct xf_adsp_tdm_capture *tdm_capture) ++{ ++ struct xf_handle *handle; ++ int handle_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !tdm_capture) ++ return -EINVAL; ++ ++ handle_id = tdm_capture->handle_id; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* unregister component */ ++ xf_adsp_unregister(handle->comp_id); /* PRQA S 3200 */ ++ ++ /* free handle data from base control */ ++ xf_adsp_base_free_handle(handle_id); /* PRQA S 3200 */ ++ ++exit: ++ kfree(tdm_capture); ++ ++ return 0; ++} +diff --git a/sound/soc/adsp/xf-adsp-base.h b/sound/soc/adsp/xf-adsp-base.h +new file mode 100644 +index 0000000..27eb084 +--- /dev/null ++++ b/sound/soc/adsp/xf-adsp-base.h +@@ -0,0 +1,275 @@ ++/** ************************************************************************* ++ *\file xf-adsp-base.h ++ *\brief Header file for ADSP Base Control layer ++ *\addtogroup ADSP Driver ++ **************************************************************************** ++ *\date Oct. 21, 2017 ++ *\author Renesas Electronics Corporation ++ **************************************************************************** ++ *\par Copyright ++ * ++ * Copyright(c) 2016 Renesas Electoronics Corporation ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a copy ++ * of this software and associated documentation files (the "Software"), to deal ++ * in the Software without restriction, including without limitation the rights ++ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++ * copies of the Software, and to permit persons to whom the Software is ++ * furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included in ++ * all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ++ * THE SOFTWARE. ++ ******************************************************************************/ ++ ++#ifndef __XF_ADSP_BASE_H ++#define __XF_ADSP_BASE_H ++ ++#include "xf-adsp-config.h" ++#include <adsp_drv/xf-adsp-drv-ext.h> ++ ++#define XF_BUF_POOL_SIZE (4) /**< number of buffer in a data pool */ ++ ++/**< maximum number of DSP component can be registered */ ++#define MAX_HANDLE (256) ++ ++/* define boolean */ ++#define TRUE (1) ++#define FALSE (0) ++ ++/** \struct xf_callback_func ++ * \brief callback function for ADSP's response message ++ */ ++struct xf_callback_func { ++ /** callback for empty buffer done message */ ++ int (*empty_buf_done)(void *data, int opcode, int length, char *buffer); ++ ++ /** callback for fill buffer done message */ ++ int (*fill_buf_done)(void *data, int opcode, int length, char *buffer); ++ ++ /** callback for event handler */ ++ int (*event_handler)(void *data); ++}; ++ ++/** \struct xf_adsp_renderer_params ++ * \brief parameter structure for Renderer component ++ */ ++struct xf_adsp_renderer_params { ++ int channel; /**< channel number */ ++ int pcm_width; /**< PCM width */ ++ int frame_size; /**< frame size */ ++ int in_rate; /**< input sampling rate */ ++ int out_rate; /**< output sampling rate */ ++ int vol_rate; /**< volume rate */ ++ int dev1; /**< 1st device index */ ++ int dev2; /**< 2nd device index */ ++ int dma1; /**< 1st DMA index */ ++ int dma2; /**< 2nd DMA index */ ++ int out_channel; /**< output channels */ ++ int mix_ctrl; /**< mix control flag */ ++ int state; /**< operation state */ ++}; ++ ++/** \struct xf_adsp_renderer ++ * \brief Renderer component structure ++ */ ++struct xf_adsp_renderer { ++ struct xf_adsp_renderer_params params; /**< parameter structure*/ ++ struct xf_pool *buf_pool; /**< buffer pool for data transfer */ ++ int handle_id; /**< ID of registered handle*/ ++}; ++ ++/** \struct xf_adsp_capture_params ++ *\brief parameter structure of Capture component ++ */ ++struct xf_adsp_capture_params { ++ int channel; /**< channel number */ ++ int pcm_width; /**< PCM width */ ++ int frame_size; /**< frame size */ ++ int in_rate; /**< input sampling rate */ ++ int out_rate; /**< output sampling rate */ ++ int vol_rate; /**< volume rate */ ++ int dev1; /**< 1st device index */ ++ int dev2; /**< 2nd device index */ ++ int dma1; /**< 1st DMA index */ ++ int dma2; /**< 2nd DMA index */ ++ int state; /**< operation state */ ++}; ++ ++/** \struct xf_adsp_capture ++ * \brief Capture component structure ++ */ ++struct xf_adsp_capture { ++ struct xf_adsp_capture_params params; /**< parameter structuer*/ ++ struct xf_pool *buf_pool; /**< buffer pool for data transfer */ ++ int handle_id; /**< ID of registered handle*/ ++}; ++ ++/** \struct xf_equalizer_parametric_coef ++ *\brief Parametric Equalizer type's parameters ++ */ ++struct xf_equalizer_parametric_coef { ++ int type[XA_REL_EQZ_FILTER_NUM]; /**< Filter type */ ++ int fc[XA_REL_EQZ_FILTER_NUM]; /**< Filter center frequency */ ++ int gain[XA_REL_EQZ_FILTER_NUM]; /**< Filter gain */ ++ int band_width[XA_REL_EQZ_FILTER_NUM]; /**< Filter band width */ ++ int gain_base[XA_REL_EQZ_FILTER_NUM]; /**< Filter base gain */ ++}; ++ ++/** \struct xf_equalizer_graphic_coef ++ * \brief Graphic Equalizer type's parameters ++ */ ++struct xf_equalizer_graphic_coef { ++ int gain_g[XA_REL_EQZ_GRAPHIC_BAND_NUM];/**< Graphic equalizer gain */ ++}; ++ ++/** \struct xf_adsp_equalizer_params ++ *\brief Equalizer parameters ++ */ ++struct xf_adsp_equalizer_params { ++ int channel; /**< channel number */ ++ int pcm_width; /**< PCM width */ ++ int rate; /**< sampling rate */ ++ int eqz_type; /**< Equalizer type */ ++ struct xf_equalizer_parametric_coef p_coef; /**< Parametric params */ ++ struct xf_equalizer_graphic_coef g_coef; /**< Graphic params */ ++}; ++ ++/** \struct xf_adsp_equalizer ++ * \brief Equalizer component's structure ++ */ ++struct xf_adsp_equalizer { ++ struct xf_adsp_equalizer_params params;/**< Equalizer parameters */ ++ struct xf_pool *buf_pool; /**< buffer pool for transfer data */ ++ int handle_id; /**< ID of registered handle */ ++}; ++ ++/** \struct xf_adsp_tdm_renderer_params ++ * \brief parameter structure for TDM Renderer component ++ */ ++struct xf_adsp_tdm_renderer_params { ++ int ch_mode; /**< channel mode */ ++ int pcm_width; /**< PCM width */ ++ int frame_size; /**< frame size */ ++ int in_rate; /**< input sampling rate */ ++ int out_rate; /**< output sampling rate */ ++ int vol_rate; /**< volume rate */ ++ int dev1; /**< 1st device index */ ++ int dev2; /**< 2nd device index */ ++ int dma1; /**< 1st DMA index */ ++ int dma2; /**< 2nd DMA index */ ++}; ++ ++/** \struct xf_adsp_tdm_renderer ++ * \brief TDM Renderer component structure ++ */ ++struct xf_adsp_tdm_renderer { ++ struct xf_adsp_tdm_renderer_params params; /**< parameter structure*/ ++ struct xf_pool *buf_pool; /**< buffer pool for data transfer */ ++ int handle_id; /**< ID of registered handle */ ++}; ++ ++/** \struct xf_adsp_tdm_capture_params ++ * \brief parameter structure for TDM Capture component ++ */ ++struct xf_adsp_tdm_capture_params { ++ int ch_mode; /**< channel mode */ ++ int pcm_width; /**< PCM width */ ++ int frame_size; /**< frame size */ ++ int in_rate; /**< input sampling rate */ ++ int out_rate; /**< output sampling rate */ ++ int vol_rate; /**< volume rate */ ++ int dev1; /**< 1st device index */ ++ int dev2; /**< 2nd device index */ ++ int dma1; /**< 1st DMA index */ ++ int dma2; /**< 2nd DMA index */ ++}; ++ ++/** \struct xf_adsp_tdm_capture ++ * \brief TDM Capture component structure ++ */ ++struct xf_adsp_tdm_capture { ++ struct xf_adsp_tdm_capture_params params; /**< parameter structure*/ ++ struct xf_pool *buf_pool; /**< buffer pool for data transfer */ ++ int handle_id; /**< ID of registered handle*/ ++}; ++ ++/** \struct xf_handle ++ * \brief Handle struct for each ADSP component ++ */ ++struct xf_handle { ++ int comp_id;/**< ADSP component ID */ ++ struct xf_callback_func *cb;/**< callback functions */ ++ void *private_data; /**< private data for callback functions*/ ++}; ++ ++/** \struct xf_adsp_base ++ * \brief Base component structure ++ */ ++struct xf_adsp_base { ++ struct xf_adsp_base_cmd cmd; /**< proxy commands */ ++ void *client; /**< client data which registered to proxy */ ++ struct xf_pool *aux_pool; /**< auxiliary buffer pool data */ ++ struct xf_handle *handle[MAX_HANDLE]; /**< handler data */ ++ struct task_struct *rsp_thread;/**< thread for response message*/ ++ wait_queue_head_t base_wait; /**< ADSP base's waiting queue */ ++ struct xf_message base_msg; /**< ADSP base's response message */ ++ int base_flag; /**< flag to control its waiting queue */ ++ int err_flag; /**< flag to indicate a error from plugins */ ++ int wait_flag; /**< flag to control the polling waiting*/ ++ spinlock_t lock; /**< spinlock data */ ++}; ++ ++struct xf_pool *xf_adsp_allocate_mem_pool(int pool_size, int buf_length); ++int xf_adsp_free_mem_pool(struct xf_pool *pool); ++char *xf_adsp_get_data_from_pool(struct xf_pool *pool, int index); ++ ++int xf_adsp_empty_this_buffer(int handle_id, char *buffer, int length); ++int xf_adsp_fill_this_buffer(int handle_id, char *buffer, int length); ++ ++int xf_adsp_route(int src_handle_id, int dst_handle_id ++ , int buf_cnt, int buf_size); ++ ++int xf_adsp_set_param(int handle_id, int index, int value); ++int xf_adsp_get_param(int handle_id, int index, int *value); ++ ++int xf_adsp_renderer_create(struct xf_adsp_renderer **renderer, ++ struct xf_callback_func *cb, void *private_data); ++int xf_adsp_renderer_destroy(struct xf_adsp_renderer *renderer); ++int xf_adsp_renderer_set_params(struct xf_adsp_renderer *renderer); ++int xf_adsp_renderer_get_params(struct xf_adsp_renderer *renderer); ++ ++int xf_adsp_capture_create(struct xf_adsp_capture **capture, ++ struct xf_callback_func *cb, void *private_data); ++int xf_adsp_capture_destroy(struct xf_adsp_capture *capture); ++int xf_adsp_capture_set_params(struct xf_adsp_capture *capture); ++int xf_adsp_capture_get_params(struct xf_adsp_capture *capture); ++ ++int xf_adsp_equalizer_create(struct xf_adsp_equalizer **equalizer, ++ struct xf_callback_func *cb, void *private_data); ++int xf_adsp_equalizer_destroy(struct xf_adsp_equalizer *equalizer); ++int xf_adsp_equalizer_set_params(struct xf_adsp_equalizer *equalizer); ++int xf_adsp_equalizer_get_params(struct xf_adsp_equalizer *equalizer); ++ ++int xf_adsp_tdm_renderer_create(struct xf_adsp_tdm_renderer **tdm_renderer, ++ struct xf_callback_func *cb, ++ void *private_data); ++int xf_adsp_tdm_renderer_destroy(struct xf_adsp_tdm_renderer *tdm_renderer); ++int xf_adsp_tdm_renderer_set_params(struct xf_adsp_tdm_renderer *tdm_renderer); ++int xf_adsp_tdm_renderer_get_params(struct xf_adsp_tdm_renderer *tdm_renderer); ++ ++int xf_adsp_tdm_capture_create(struct xf_adsp_tdm_capture **tdm_capture, ++ struct xf_callback_func *cb, ++ void *private_data); ++int xf_adsp_tdm_capture_destroy(struct xf_adsp_tdm_capture *tdm_capture); ++int xf_adsp_tdm_capture_set_params(struct xf_adsp_tdm_capture *tdm_capture); ++int xf_adsp_tdm_capture_get_params(struct xf_adsp_tdm_capture *tdm_capture); ++ ++#endif +diff --git a/sound/soc/adsp/xf-adsp-config.h b/sound/soc/adsp/xf-adsp-config.h +new file mode 100644 +index 0000000..818a46a +--- /dev/null ++++ b/sound/soc/adsp/xf-adsp-config.h +@@ -0,0 +1,604 @@ ++/** **************************************************************************** ++ *\file xf-adsp-config.h ++ *\brief Header file for ADSP configuration ++ *\addtogroup ADSP Driver ++ ******************************************************************************* ++ *\date Oct. 21, 2017 ++ *\author Renesas Electronics Corporation ++ ******************************************************************************* ++ *\par Copyright ++ * ++ * Copyright(c) 2016 Renesas Electoronics Corporation ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a copy ++ * of this software and associated documentation files (the "Software"), to deal ++ * in the Software without restriction, including without limitation the rights ++ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++ * copies of the Software, and to permit persons to whom the Software is ++ * furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included in ++ * all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ++ * THE SOFTWARE. ++ ******************************************************************************/ ++ ++#ifndef __XF_ADSP_CONFIG_H ++#define __XF_ADSP_CONFIG_H ++ ++/* Equalizer definition */ ++#define XA_REL_EQZ_FILTER_NUM (9) /**< number of filter */ ++#define XA_REL_EQZ_GRAPHIC_BAND_NUM (5) /**< number of graphic band */ ++ ++struct xf_buffer { ++ void *address; ++ union { /* PRQA S 750 3 */ ++ struct xf_buffer *next; ++ struct xf_pool *pool; ++ } link; ++}; ++ ++struct xf_pool { ++ /* length of individual buffer in a pool */ ++ u32 length; ++ ++ /* number of buffer in a pool */ ++ u32 number; ++ ++ /* pointer to pool memory */ ++ void *p; ++ ++ /* pointer to first free buffer in a pool */ ++ struct xf_buffer *free; ++ ++ /* individual buffer */ ++ struct xf_buffer buffer[0]; /* PRQA S 1037 */ ++}; ++ ++struct xf_message { ++ /* pointer to the next item in the list */ ++ struct xf_message *next; ++ ++ /* shmem session_id */ ++ u32 id; ++ ++ /* operation code */ ++ u32 opcode; ++ ++ /* length of attached message buffer */ ++ u32 length; ++ ++ /* message buffer */ ++ void *buffer; ++}; ++ ++/******************************************************************************* ++ * XF_GET_PARAM message ++ ******************************************************************************/ ++ ++/* ...message body (command/response) */ ++union xf_get_param_msg { /* PRQA S 750 18 */ ++ /* ...command structure */ ++ struct { ++ /* ...array of parameters requested */ ++ u32 id[0]; /* PRQA S 1037 */ ++ ++ } __attribute__((__packed__)) c; ++ ++ /* ...response structure */ ++ struct { ++ /* ...array of parameters values */ ++ u32 value[0];/* PRQA S 1037 */ ++ ++ } __attribute__((__packed__)) r; ++ ++}; ++ ++/* ...length of the XF_GET_PARAM command/response */ ++/* PRQA S 3453 2 */ ++#define XF_GET_PARAM_CMD_LEN(params) (sizeof(u32) * (params)) ++#define XF_GET_PARAM_RSP_LEN(params) (sizeof(u32) * (params)) ++ ++/******************************************************************************* ++ * XF_SET_PARAM message ++ ******************************************************************************/ ++ ++/* ...component initialization parameter */ ++struct xf_set_param_item { ++ /* ...index of parameter passed to SET_CONFIG_PARAM call */ ++ u32 id; ++ ++ /* ...value of parameter */ ++ u32 value; ++ ++} __attribute__ ((__packed__)); ++ ++/* ...message body (no response message? - tbd) */ ++struct xf_set_param_msg { ++ /* ...command message */ ++ struct xf_set_param_item item[0]; /* PRQA S 1037 */ ++ ++} __attribute__ ((__packed__)); ++ ++/* ...length of the command message */ ++/* PRQA S 3453 */ ++#define XF_SET_PARAM_CMD_LEN(params) \ ++ (sizeof(struct xf_set_param_item) * (params)) ++ ++/******************************************************************************* ++ * XF_ROUTE definition ++ ******************************************************************************/ ++ ++/* ...port routing command */ ++struct xf_route_port_msg { ++ /* ...source port specification */ ++ u32 src; ++ ++ /* ...destination port specification */ ++ u32 dst; ++ ++ /* ...number of buffers to allocate */ ++ u32 alloc_number; ++ ++ /* ...length of buffer to allocate */ ++ u32 alloc_size; ++ ++ /* ...alignment restriction for a buffer */ ++ u32 alloc_align; ++ ++} __attribute__((__packed__)); ++ ++/******************************************************************************* ++ * XF_UNROUTE definition ++ ******************************************************************************/ ++ ++/* ...port unrouting command */ ++struct xf_unroute_port_msg { ++ /* ...source port specification */ ++ u32 src; ++ ++ /* ...destination port specification */ ++ u32 dst; ++ ++} __attribute__((__packed__)); ++ ++/* ...Capture states */ ++enum xa_capture_state { ++ XA_CAP_STATE_RUN = 0, ++ XA_CAP_STATE_IDLE = 1, ++ XA_CAP_STATE_PAUSE = 2 ++}; ++ ++/* ...Renderer states */ ++enum xa_renderer_state { ++ XA_RDR_STATE_RUN = 0, ++ XA_RDR_STATE_IDLE = 1, ++ XA_RDR_STATE_PAUSE = 2 ++}; ++ ++/******************************************************************************* ++ * Message routing composition - move somewhere else - tbd ++ ******************************************************************************/ ++ ++/* ...adjust IPC client of message going from user-space */ ++#define XF_MSG_AP_FROM_USER(id, client) \ ++ (((id) & ~(0xF << 2)) | ((client) << 2)) ++ ++/* ...wipe out IPC client from message going to user-space */ ++#define XF_MSG_AP_TO_USER(id) \ ++ ((id) & ~(0xF << 18)) ++ ++/* ...port specification (12 bits) */ ++#define __XF_PORT_SPEC(core, id, port) ((core) | ((id) << 2) | ((port) << 8)) ++#define __XF_PORT_SPEC2(id, port) ((id) | ((port) << 8)) ++#define XF_PORT_CORE(spec) ((spec) & 0x3) ++#define XF_PORT_CLIENT(spec) (((spec) >> 2) & 0x3F) ++#define XF_PORT_ID(spec) (((spec) >> 8) & 0xF) ++ ++/* ...message id contains source and destination ports specification */ ++#define __XF_MSG_ID(src, dst) (((src) & 0xFFFF) | (((dst) & 0xFFFF) << 16)) ++#define XF_MSG_SRC(id) (((id) >> 0) & 0xFFFF) ++#define XF_MSG_SRC_CORE(id) (((id) >> 0) & 0x3) ++#define XF_MSG_SRC_CLIENT(id) (((id) >> 2) & 0x3F) ++#define XF_MSG_SRC_PORT(id) (((id) >> 8) & 0xF) ++#define XF_MSG_SRC_PROXY(id) (((id) >> 15) & 0x1) ++#define XF_MSG_DST(id) (((id) >> 16) & 0xFFFF) ++#define XF_MSG_DST_CORE(id) (((id) >> 16) & 0x3) ++#define XF_MSG_DST_CLIENT(id) (((id) >> 18) & 0x3F) ++#define XF_MSG_DST_PORT(id) (((id) >> 24) & 0xF) ++#define XF_MSG_DST_PROXY(id) (((id) >> 31) & 0x1) ++ ++/* ...special treatment of AP-proxy destination field */ ++#define XF_AP_IPC_CLIENT(id) (((id) >> 18) & 0xF) ++#define XF_AP_CLIENT(id) (((id) >> 22) & 0x1FF) ++#define __XF_AP_PROXY(core) ((core) | 0x8000) ++#define __XF_DSP_PROXY(core) ((core) | 0x8000) ++#define __XF_AP_CLIENT(core, client) ((core) | ((client) << 6) | 0x8000) ++ ++/******************************************************************************* ++ * Opcode composition ++ ******************************************************************************/ ++ ++/* ...opcode composition with command/response data tags */ ++#define __XF_OPCODE(c, r, op) (((c) << 31) | ((r) << 30) | ((op) & 0x3F)) ++ ++/* ...accessors */ ++#define XF_OPCODE_CDATA(opcode) ((opcode) & (1 << 31)) ++#define XF_OPCODE_RDATA(opcode) ((opcode) & (1 << 30)) ++#define XF_OPCODE_TYPE(opcode) ((opcode) & (0x3F)) ++ ++/******************************************************************************* ++ * Opcode types ++ ******************************************************************************/ ++ ++/* ...unregister client */ ++#define XF_UNREGISTER __XF_OPCODE(0, 0, 0) ++ ++/* ...register client at proxy */ ++#define XF_REGISTER __XF_OPCODE(1, 0, 1) ++ ++/* ...port routing command */ ++#define XF_ROUTE __XF_OPCODE(1, 0, 2) ++ ++/* ...port unrouting command */ ++#define XF_UNROUTE __XF_OPCODE(1, 0, 3) ++ ++/* ...shared buffer allocation */ ++#define XF_ALLOC __XF_OPCODE(0, 0, 4) ++ ++/* ...shared buffer freeing */ ++#define XF_FREE __XF_OPCODE(0, 0, 5) ++ ++/* ...set component parameters */ ++#define XF_SET_PARAM __XF_OPCODE(1, 0, 6) ++ ++/* ...get component parameters */ ++#define XF_GET_PARAM __XF_OPCODE(1, 1, 7) ++ ++/* ...input buffer reception */ ++#define XF_EMPTY_THIS_BUFFER __XF_OPCODE(1, 0, 8) ++ ++/* ...output buffer reception */ ++#define XF_FILL_THIS_BUFFER __XF_OPCODE(0, 1, 9) ++ ++/* ...flush specific port */ ++#define XF_FLUSH __XF_OPCODE(0, 0, 10) ++ ++/* ...start component operation */ ++#define XF_START __XF_OPCODE(0, 0, 11) ++ ++/* ...stop component operation */ ++#define XF_STOP __XF_OPCODE(0, 0, 12) ++ ++/* ...pause component operation */ ++#define XF_PAUSE __XF_OPCODE(0, 0, 13) ++ ++/* ...resume component operation */ ++#define XF_RESUME __XF_OPCODE(0, 0, 14) ++ ++/* ...total amount of supported decoder commands */ ++#define __XF_OP_NUM (15) ++ ++/************************************************* ++ * Renderer - specific configuration parameters ++ * **********************************************/ ++ ++enum xa_config_param_renderer { ++ XA_RDR_CONFIG_PARAM_STATE = 0, ++ XA_RDR_CONFIG_PARAM_PCM_WIDTH = 1, ++ XA_RDR_CONFIG_PARAM_CHANNELS = 2, ++ XA_RDR_CONFIG_PARAM_SAMPLE_RATE = 3, ++ XA_RDR_CONFIG_PARAM_FRAME_SIZE = 4, ++ XA_RDR_CONFIG_PARAM_OUTPUT1 = 5, ++ XA_RDR_CONFIG_PARAM_DMACHANNEL1 = 6, ++ XA_RDR_CONFIG_PARAM_OUTPUT2 = 7, ++ XA_RDR_CONFIG_PARAM_DMACHANNEL2 = 8, ++ XA_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE = 9, ++ XA_RDR_CONFIG_PARAM_VOLUME_RATE = 10, ++ XA_RDR_CONFIG_PARAM_OUT_CHANNELS = 11, ++ XA_RDR_CONFIG_PARAM_MIX_CONTROL = 12, ++ XA_RDR_CONFIG_PARAM_NUM = 13 ++}; ++ ++/************************************************* ++ * Capture - specific configuration parameters ++ * **********************************************/ ++ ++enum xa_config_param_capture { ++ XA_CAP_CONFIG_PARAM_CB = 0, ++ XA_CAP_CONFIG_PARAM_STATE = 1, ++ XA_CAP_CONFIG_PARAM_PCM_WIDTH = 2, ++ XA_CAP_CONFIG_PARAM_CHANNELS = 3, ++ XA_CAP_CONFIG_PARAM_SAMPLE_RATE = 4, ++ XA_CAP_CONFIG_PARAM_FRAME_SIZE = 5, ++ XA_CAP_CONFIG_PARAM_INPUT1 = 6, ++ XA_CAP_CONFIG_PARAM_DMACHANNEL1 = 7, ++ XA_CAP_CONFIG_PARAM_INPUT2 = 8, ++ XA_CAP_CONFIG_PARAM_DMACHANNEL2 = 9, ++ XA_CAP_CONFIG_PARAM_OUT_SAMPLE_RATE = 10, ++ XA_CAP_CONFIG_PARAM_VOLUME_RATE = 11, ++ XA_CAP_CONFIG_PARAM_NUM = 12 ++}; ++ ++/************************************************* ++ * Equalizer - specific configuration parameters ++ * **********************************************/ ++ ++enum xa_rel_eqz_filter_type { ++ XA_REL_EQZ_TYPE_THROUGH = 0, ++ XA_REL_EQZ_TYPE_PEAK = 1, ++ XA_REL_EQZ_TYPE_BASS = 2, ++ XA_REL_EQZ_TYPE_TREBLE = 3 ++}; ++ ++enum xa_rel_eqz_type { ++ XA_REL_EQZ_TYPE_PARAMETRIC = 0, ++ XA_REL_EQZ_TYPE_GRAPHIC = 1 ++}; ++ ++/*****************************************************************************/ ++/* Additional subcommand indices */ ++/*****************************************************************************/ ++ ++enum xa_add_cmd_type_generic { ++ /* XA_API_CMD_SET_CONFIG_PARAM indices */ ++ XA_EQZ_CONFIG_PARAM_COEF_FS = 0x0000, ++ XA_EQZ_CONFIG_PARAM_PCM_WIDTH = 0x0001, ++ XA_EQZ_CONFIG_PARAM_CH = 0x0002, ++ XA_EQZ_CONFIG_PARAM_EQZ_TYPE = 0x0003, ++ ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_FC = 0x0010, ++ XA_EQZ_CONFIG_PARAM_FILTER_1_COEF_FC = 0x0011, ++ XA_EQZ_CONFIG_PARAM_FILTER_2_COEF_FC = 0x0012, ++ XA_EQZ_CONFIG_PARAM_FILTER_3_COEF_FC = 0x0013, ++ XA_EQZ_CONFIG_PARAM_FILTER_4_COEF_FC = 0x0014, ++ XA_EQZ_CONFIG_PARAM_FILTER_5_COEF_FC = 0x0015, ++ XA_EQZ_CONFIG_PARAM_FILTER_6_COEF_FC = 0x0016, ++ XA_EQZ_CONFIG_PARAM_FILTER_7_COEF_FC = 0x0017, ++ XA_EQZ_CONFIG_PARAM_FILTER_8_COEF_FC = 0x0018, ++ ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_TYPE = 0x0020, ++ XA_EQZ_CONFIG_PARAM_FILTER_1_COEF_TYPE = 0x0021, ++ XA_EQZ_CONFIG_PARAM_FILTER_2_COEF_TYPE = 0x0022, ++ XA_EQZ_CONFIG_PARAM_FILTER_3_COEF_TYPE = 0x0023, ++ XA_EQZ_CONFIG_PARAM_FILTER_4_COEF_TYPE = 0x0024, ++ XA_EQZ_CONFIG_PARAM_FILTER_5_COEF_TYPE = 0x0025, ++ XA_EQZ_CONFIG_PARAM_FILTER_6_COEF_TYPE = 0x0026, ++ XA_EQZ_CONFIG_PARAM_FILTER_7_COEF_TYPE = 0x0027, ++ XA_EQZ_CONFIG_PARAM_FILTER_8_COEF_TYPE = 0x0028, ++ ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_BW = 0x0030, ++ XA_EQZ_CONFIG_PARAM_FILTER_1_COEF_BW = 0x0031, ++ XA_EQZ_CONFIG_PARAM_FILTER_2_COEF_BW = 0x0032, ++ XA_EQZ_CONFIG_PARAM_FILTER_3_COEF_BW = 0x0033, ++ XA_EQZ_CONFIG_PARAM_FILTER_4_COEF_BW = 0x0034, ++ XA_EQZ_CONFIG_PARAM_FILTER_5_COEF_BW = 0x0035, ++ XA_EQZ_CONFIG_PARAM_FILTER_6_COEF_BW = 0x0036, ++ XA_EQZ_CONFIG_PARAM_FILTER_7_COEF_BW = 0x0037, ++ XA_EQZ_CONFIG_PARAM_FILTER_8_COEF_BW = 0x0038, ++ ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_GA = 0x0040, ++ XA_EQZ_CONFIG_PARAM_FILTER_1_COEF_GA = 0x0041, ++ XA_EQZ_CONFIG_PARAM_FILTER_2_COEF_GA = 0x0042, ++ XA_EQZ_CONFIG_PARAM_FILTER_3_COEF_GA = 0x0043, ++ XA_EQZ_CONFIG_PARAM_FILTER_4_COEF_GA = 0x0044, ++ XA_EQZ_CONFIG_PARAM_FILTER_5_COEF_GA = 0x0045, ++ XA_EQZ_CONFIG_PARAM_FILTER_6_COEF_GA = 0x0046, ++ XA_EQZ_CONFIG_PARAM_FILTER_7_COEF_GA = 0x0047, ++ XA_EQZ_CONFIG_PARAM_FILTER_8_COEF_GA = 0x0048, ++ ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_BA = 0x0050, ++ XA_EQZ_CONFIG_PARAM_FILTER_1_COEF_BA = 0x0051, ++ XA_EQZ_CONFIG_PARAM_FILTER_2_COEF_BA = 0x0052, ++ XA_EQZ_CONFIG_PARAM_FILTER_3_COEF_BA = 0x0053, ++ XA_EQZ_CONFIG_PARAM_FILTER_4_COEF_BA = 0x0054, ++ XA_EQZ_CONFIG_PARAM_FILTER_5_COEF_BA = 0x0055, ++ XA_EQZ_CONFIG_PARAM_FILTER_6_COEF_BA = 0x0056, ++ XA_EQZ_CONFIG_PARAM_FILTER_7_COEF_BA = 0x0057, ++ XA_EQZ_CONFIG_PARAM_FILTER_8_COEF_BA = 0x0058, ++ ++ XA_EQZ_CONFIG_PARAM_BAND_0_GCOEF_GA = 0x0060, ++ XA_EQZ_CONFIG_PARAM_BAND_1_GCOEF_GA = 0x0061, ++ XA_EQZ_CONFIG_PARAM_BAND_2_GCOEF_GA = 0x0062, ++ XA_EQZ_CONFIG_PARAM_BAND_3_GCOEF_GA = 0x0063, ++ XA_EQZ_CONFIG_PARAM_BAND_4_GCOEF_GA = 0x0064 ++}; ++ ++/* ...tdm-renderer-specific configuration parameters */ ++enum xa_config_param_tdm_renderer { ++ XA_TDM_RDR_CONFIG_PARAM_PCM_WIDTH = 0, ++ XA_TDM_RDR_CONFIG_PARAM_CHANNEL_MODE = 1, ++ XA_TDM_RDR_CONFIG_PARAM_IN_SAMPLE_RATE = 2, ++ XA_TDM_RDR_CONFIG_PARAM_FRAME_SIZE = 3, ++ XA_TDM_RDR_CONFIG_PARAM_OUTPUT1 = 4, ++ XA_TDM_RDR_CONFIG_PARAM_DMACHANNEL1 = 5, ++ XA_TDM_RDR_CONFIG_PARAM_OUTPUT2 = 6, ++ XA_TDM_RDR_CONFIG_PARAM_DMACHANNEL2 = 7, ++ XA_TDM_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE = 8, ++ XA_TDM_RDR_CONFIG_PARAM_VOLUME_RATE = 9 ++}; ++ ++enum xa_rel_tdm_renderer_channel_mode { ++ XA_TDM_RDR_CHANNEL_MODE_2X4 = 0, /**< 4 stereo TDM data */ ++ XA_TDM_RDR_CHANNEL_MODE_1X8 = 1, /**< 1 eight-channel TDM data*/ ++ /**< 1 six-channels plus 1 two-channels TDM data */ ++ XA_TDM_RDR_CHANNEL_MODE_6_2 = 2, ++ XA_TDM_RDR_CHANNEL_MODE_2X3 = 3, /**< 3 stereo TDM data */ ++ XA_TDM_RDR_CHANNEL_MODE_1X6 = 4 /**< 1 six-channel TDM data */ ++}; ++ ++/* ...TDM Capture-specific configuration parameters */ ++enum xa_config_param_tdm_capture { ++ XA_TDM_CAP_CONFIG_PARAM_PCM_WIDTH = 0, ++ XA_TDM_CAP_CONFIG_PARAM_CHANNEL_MODE = 1, ++ XA_TDM_CAP_CONFIG_PARAM_IN_SAMPLE_RATE = 2, ++ XA_TDM_CAP_CONFIG_PARAM_FRAME_SIZE = 3, ++ XA_TDM_CAP_CONFIG_PARAM_INPUT1 = 4, ++ XA_TDM_CAP_CONFIG_PARAM_DMACHANNEL1 = 5, ++ XA_TDM_CAP_CONFIG_PARAM_INPUT2 = 6, ++ XA_TDM_CAP_CONFIG_PARAM_DMACHANNEL2 = 7, ++ XA_TDM_CAP_CONFIG_PARAM_OUT_SAMPLE_RATE = 8, ++ XA_TDM_CAP_CONFIG_PARAM_VOLUME_RATE = 9 ++}; ++ ++enum xa_rel_tdm_capture_channel_mode { ++ XA_TDM_CAP_CHANNEL_MODE_2X4 = 0, /**< 4 stereo TDM data */ ++ XA_TDM_CAP_CHANNEL_MODE_1X8 = 1, /**< 1 eight-channel TDM data*/ ++ /**< 1 six-channels plus 1 two-channels TDM data */ ++ XA_TDM_CAP_CHANNEL_MODE_6_2 = 2, ++ XA_TDM_CAP_CHANNEL_MODE_2X3 = 3, /**< 3 stereo TDM data */ ++ XA_TDM_CAP_CHANNEL_MODE_1X6 = 4 /**< 1 six-channel TDM data */ ++}; ++ ++/*****************************************************************************/ ++/* HW supported */ ++/*****************************************************************************/ ++/* ...SSI modules supported by HW */ ++enum ssi_module { ++ SSI00 = 0, ++ SSI01 = 1, ++ SSI02 = 2, ++ SSI03 = 3, ++ SSI04 = 4, ++ SSI05 = 5, ++ SSI06 = 6, ++ SSI07 = 7, ++ SSI10 = 10, ++ SSI11 = 11, ++ SSI12 = 12, ++ SSI13 = 13, ++ SSI14 = 14, ++ SSI15 = 15, ++ SSI16 = 16, ++ SSI17 = 17, ++ SSI20 = 20, ++ SSI21 = 21, ++ SSI22 = 22, ++ SSI23 = 23, ++ SSI24 = 24, ++ SSI25 = 25, ++ SSI26 = 26, ++ SSI27 = 27, ++ SSI30 = 30, ++ SSI31 = 31, ++ SSI32 = 32, ++ SSI33 = 33, ++ SSI34 = 34, ++ SSI35 = 35, ++ SSI36 = 36, ++ SSI37 = 37, ++ SSI40 = 40, ++ SSI41 = 41, ++ SSI42 = 42, ++ SSI43 = 43, ++ SSI44 = 44, ++ SSI45 = 45, ++ SSI46 = 46, ++ SSI47 = 47, ++ SSI5 = 50, ++ SSI6 = 60, ++ SSI7 = 70, ++ SSI8 = 80, ++ SSI90 = 90, ++ SSI91 = 91, ++ SSI92 = 92, ++ SSI93 = 93, ++ SSI94 = 94, ++ SSI95 = 95, ++ SSI96 = 96, ++ SSI97 = 97 ++}; ++ ++/* ...SRC modules supported by HW */ ++enum src_module { ++ SRC0 = 110, /* SRC0 */ ++ SRC1 = 111, /* SRC1 */ ++ SRC2 = 112, /* SRC2 */ ++ SRC3 = 113, /* SRC3 */ ++ SRC4 = 114, /* SRC4 */ ++ SRC5 = 115, /* SRC5 */ ++ SRC6 = 116, /* SRC6 */ ++ SRC7 = 117, /* SRC7 */ ++ SRC8 = 118, /* SRC8 */ ++ SRC9 = 119, /* SRC9 */ ++ SRCMAX = 120 /* Maximum number of SRC modules */ ++}; ++ ++/* ...PDMA supported by HW */ ++enum { ++ PDMA_CH00 = 0, ++ PDMA_CH01 = 1, ++ PDMA_CH02 = 2, ++ PDMA_CH03 = 3, ++ PDMA_CH04 = 4, ++ PDMA_CH05 = 5, ++ PDMA_CH06 = 6, ++ PDMA_CH07 = 7, ++ PDMA_CH08 = 8, ++ PDMA_CH09 = 9, ++ PDMA_CH10 = 10, ++ PDMA_CH11 = 11, ++ PDMA_CH12 = 12, ++ PDMA_CH13 = 13, ++ PDMA_CH14 = 14, ++ PDMA_CH15 = 15, ++ PDMA_CH16 = 16, ++ PDMA_CH17 = 17, ++ PDMA_CH18 = 18, ++ PDMA_CH19 = 19, ++ PDMA_CH20 = 20, ++ PDMA_CH21 = 21, ++ PDMA_CH22 = 22, ++ PDMA_CH23 = 23, ++ PDMA_CH24 = 24, ++ PDMA_CH25 = 25, ++ PDMA_CH26 = 26, ++ PDMA_CH27 = 27, ++ PDMA_CH28 = 28, ++ PDMA_CHMAX = 29 ++}; ++ ++/* ...DMAC supported by HW */ ++enum { ++ ADMAC_CH00 = PDMA_CHMAX + 0, ++ ADMAC_CH01 = PDMA_CHMAX + 1, ++ ADMAC_CH02 = PDMA_CHMAX + 2, ++ ADMAC_CH03 = PDMA_CHMAX + 3, ++ ADMAC_CH04 = PDMA_CHMAX + 4, ++ ADMAC_CH05 = PDMA_CHMAX + 5, ++ ADMAC_CH06 = PDMA_CHMAX + 6, ++ ADMAC_CH07 = PDMA_CHMAX + 7, ++ ADMAC_CH08 = PDMA_CHMAX + 8, ++ ADMAC_CH09 = PDMA_CHMAX + 9, ++ ADMAC_CH10 = PDMA_CHMAX + 10, ++ ADMAC_CH11 = PDMA_CHMAX + 11, ++ ADMAC_CH12 = PDMA_CHMAX + 12, ++ ADMAC_CH13 = PDMA_CHMAX + 13, ++ ADMAC_CH14 = PDMA_CHMAX + 14, ++ ADMAC_CH15 = PDMA_CHMAX + 15, ++ ADMAC_CH16 = PDMA_CHMAX + 16, ++ ADMAC_CH17 = PDMA_CHMAX + 17, ++ ADMAC_CH18 = PDMA_CHMAX + 18, ++ ADMAC_CH19 = PDMA_CHMAX + 19, ++ ADMAC_CH20 = PDMA_CHMAX + 20, ++ ADMAC_CH21 = PDMA_CHMAX + 21, ++ ADMAC_CH22 = PDMA_CHMAX + 22, ++ ADMAC_CH23 = PDMA_CHMAX + 23, ++ ADMAC_CH24 = PDMA_CHMAX + 24, ++ ADMAC_CH25 = PDMA_CHMAX + 25, ++ ADMAC_CH26 = PDMA_CHMAX + 26, ++ ADMAC_CH27 = PDMA_CHMAX + 27, ++ ADMAC_CH28 = PDMA_CHMAX + 28, ++ ADMAC_CH29 = PDMA_CHMAX + 29, ++ ADMAC_CH30 = PDMA_CHMAX + 30, ++ ADMAC_CH31 = PDMA_CHMAX + 31, ++ ADMAC_CHMAX = PDMA_CHMAX + 32 ++}; ++ ++#endif +-- +2.7.4 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-ADSP-add-build-for-ADSP-sound-driver.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-ADSP-add-build-for-ADSP-sound-driver.patch new file mode 100644 index 00000000..ecab4120 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0003-ADSP-add-build-for-ADSP-sound-driver.patch @@ -0,0 +1,35 @@ +From 3ae5cb9feda031f660becc94f5496d5ee9b90e22 Mon Sep 17 00:00:00 2001 +From: tienphitran <tien.tran.uw@renesas.com> +Date: Mon, 15 Oct 2018 17:57:56 +0700 +Subject: [PATCH 3/6] ADSP: add build for ADSP sound driver + +Signed-off-by: tienphitran <tien.tran.uw@renesas.com> +--- + sound/soc/Kconfig | 1 + + sound/soc/Makefile | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig +index c0abad2067e1..f5f6abbd6e14 100644 +--- a/sound/soc/Kconfig ++++ b/sound/soc/Kconfig +@@ -71,6 +71,7 @@ source "sound/soc/txx9/Kconfig" + source "sound/soc/ux500/Kconfig" + source "sound/soc/xtensa/Kconfig" + source "sound/soc/zte/Kconfig" ++source "sound/soc/adsp/Kconfig" + + # Supported codecs + source "sound/soc/codecs/Kconfig" +diff --git a/sound/soc/Makefile b/sound/soc/Makefile +index bf8c1e2ce0bf..6e77abba2b01 100644 +--- a/sound/soc/Makefile ++++ b/sound/soc/Makefile +@@ -52,3 +52,4 @@ obj-$(CONFIG_SND_SOC) += txx9/ + obj-$(CONFIG_SND_SOC) += ux500/ + obj-$(CONFIG_SND_SOC) += xtensa/ + obj-$(CONFIG_SND_SOC) += zte/ ++obj-$(CONFIG_SND_SOC) += adsp/ +-- +2.19.1 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0004-ADSP-integrate-ADSP-sound-for-H3-M3-M3N-board.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0004-ADSP-integrate-ADSP-sound-for-H3-M3-M3N-board.patch new file mode 100644 index 00000000..6d95d65f --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0004-ADSP-integrate-ADSP-sound-for-H3-M3-M3N-board.patch @@ -0,0 +1,185 @@ +From 825517f3f8ebe551d297db16e4582c0eae646f05 Mon Sep 17 00:00:00 2001 +From: tienphitran <tien.tran.uw@renesas.com> +Date: Wed, 31 Oct 2018 16:12:36 +0700 +Subject: [PATCH 4/6] ADSP: integrate ADSP sound for H3, M3, M3N board + +Signed-off-by: tienphitran <tien.tran.uw@renesas.com> +[takeshi.kihara.df: fix W=1 dtc warning] +Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com> +--- + arch/arm64/boot/dts/renesas/r8a7795.dtsi | 5 ++ + arch/arm64/boot/dts/renesas/r8a7796.dtsi | 5 ++ + arch/arm64/boot/dts/renesas/r8a77965.dtsi | 5 ++ + .../boot/dts/renesas/salvator-common.dtsi | 84 +++++++++++++++++-- + 4 files changed, 94 insertions(+), 5 deletions(-) + +diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi +index 1896e5250dff..8dfda0fda91c 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi +@@ -793,6 +793,11 @@ + method = "smc"; + }; + ++ rcar_adsp_sound: adsp_sound { ++ compatible = "renesas,rcar_adsp_sound_gen3"; ++ status = "disabled"; ++ }; ++ + /* External SCIF clock - to be overridden by boards that provide it */ + scif_clk: scif { + compatible = "fixed-clock"; +diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi b/arch/arm64/boot/dts/renesas/r8a7796.dtsi +index c00d1da64198..726c0d07fe59 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi +@@ -798,6 +798,11 @@ + method = "smc"; + }; + ++ rcar_adsp_sound: adsp_sound { ++ compatible = "renesas,rcar_adsp_sound_gen3"; ++ status = "disabled"; ++ }; ++ + /* External SCIF clock - to be overridden by boards that provide it */ + scif_clk: scif { + compatible = "fixed-clock"; +diff --git a/arch/arm64/boot/dts/renesas/r8a77965.dtsi b/arch/arm64/boot/dts/renesas/r8a77965.dtsi +index 454a67b132f4..799b005ade92 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77965.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a77965.dtsi +@@ -227,6 +227,11 @@ + method = "smc"; + }; + ++ rcar_adsp_sound: adsp_sound { ++ compatible = "renesas,rcar_adsp_sound_gen3"; ++ status = "disabled"; ++ }; ++ + /* External SCIF clock - to be overridden by boards that provide it */ + scif_clk: scif { + compatible = "fixed-clock"; +diff --git a/arch/arm64/boot/dts/renesas/salvator-common.dtsi b/arch/arm64/boot/dts/renesas/salvator-common.dtsi +index 922b9cc4797c..2c1d49c4bcaa 100644 +--- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi ++++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi +@@ -153,11 +153,27 @@ + }; + + sound_card: sound { +- compatible = "audio-graph-card"; ++ compatible = "audio-graph-scu-card"; + + label = "rcar-sound"; + +- dais = <&rsnd_port0>; ++ prefix = "ak4613"; ++ routing = "ak4613 Playback", "Playback0", ++ "ak4613 Playback", "Playback1", ++ "ak4613 Playback", "Playback2", ++ "ak4613 Playback", "Playback3", ++ "Capture0", "ak4613 Capture", ++ "Capture1", "ak4613 Capture", ++ "Capture2", "ak4613 Capture", ++ "Capture3", "ak4613 Capture", ++ "ak4613 Playback", "DAI0 Playback", ++ "DAI0 Capture", "ak4613 Capture"; ++ ++ dais = <&adsp_port0 ++ &adsp_port1 ++ &adsp_port2 ++ &adsp_port3 ++ &rsnd_port0>; + }; + + vbus0_usb2: regulator-vbus0-usb2 { +@@ -419,8 +435,27 @@ + asahi-kasei,out5-single-end; + asahi-kasei,out6-single-end; + +- port { +- ak4613_endpoint: endpoint { ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ak4613_endpoint0: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&adsp_endpoint0>; ++ }; ++ ak4613_endpoint1: endpoint@1 { ++ reg = <1>; ++ remote-endpoint = <&adsp_endpoint1>; ++ }; ++ ak4613_endpoint2: endpoint@2 { ++ reg = <2>; ++ remote-endpoint = <&adsp_endpoint2>; ++ }; ++ ak4613_endpoint3: endpoint@3 { ++ reg = <3>; ++ remote-endpoint = <&adsp_endpoint3>; ++ }; ++ ak4613_endpoint4: endpoint@4 { ++ reg = <4>; + remote-endpoint = <&rsnd_endpoint0>; + }; + }; +@@ -731,6 +766,45 @@ + status = "okay"; + }; + ++&rcar_adsp_sound { ++ status = "okay"; ++ /* Multiple DAI */ ++ #sound-dai-cells = <1>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ adsp_port0: port@0 { ++ reg = <0>; ++ adsp_endpoint0: endpoint { ++ remote-endpoint = <&ak4613_endpoint0>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port1: port@1 { ++ reg = <1>; ++ adsp_endpoint1: endpoint { ++ remote-endpoint = <&ak4613_endpoint1>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port2: port@2 { ++ reg = <2>; ++ adsp_endpoint2: endpoint { ++ remote-endpoint = <&ak4613_endpoint2>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port3: port@3 { ++ reg = <3>; ++ adsp_endpoint3: endpoint { ++ remote-endpoint = <&ak4613_endpoint3>; ++ dai-format = "left_j"; ++ }; ++ }; ++ }; ++}; ++ + &rcar_sound { + pinctrl-0 = <&sound_pins &sound_clk_pins>; + pinctrl-names = "default"; +@@ -769,7 +843,7 @@ + rsnd_port0: port@0 { + reg = <0>; + rsnd_endpoint0: endpoint { +- remote-endpoint = <&ak4613_endpoint>; ++ remote-endpoint = <&ak4613_endpoint4>; + + dai-format = "left_j"; + bitclock-master = <&rsnd_endpoint0>; +-- +2.19.1 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0005-ADSP-integrate-ADSP-sound-for-E3-board.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0005-ADSP-integrate-ADSP-sound-for-E3-board.patch new file mode 100644 index 00000000..34b32d8f --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0005-ADSP-integrate-ADSP-sound-for-E3-board.patch @@ -0,0 +1,272 @@ +From 455f26d0de1cf6eaeb0aa5b58725e3e34d8d34bd Mon Sep 17 00:00:00 2001 +From: Nguyen Dang <nguyen.dang.wh@rvc.renesas.com> +Date: Tue, 6 Nov 2018 11:36:15 +0700 +Subject: [PATCH 5/6] ADSP: integrate ADSP sound for E3 board + +Signed-off-by: Nguyen Dang <nguyen.dang.wh@renesas.com> +[takeshi.kihara.df: fix W=1 dtc warning] +[takeshi.kihara.df: support for dt file separation by E3 ES1.0 SoC] +Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com> +--- + .../arm64/boot/dts/renesas/r8a77990-ebisu.dts | 84 +++++++++++++++++-- + .../boot/dts/renesas/r8a77990-es10-ebisu.dts | 84 +++++++++++++++++-- + arch/arm64/boot/dts/renesas/r8a77990.dtsi | 5 ++ + 3 files changed, 163 insertions(+), 10 deletions(-) + +diff --git a/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts b/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts +index 26081a6e1866..20fdb4085d87 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts ++++ b/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts +@@ -221,11 +221,27 @@ + }; + + sound_card: sound { +- compatible = "audio-graph-card"; ++ compatible = "audio-graph-scu-card"; + + label = "rcar-sound"; + +- dais = <&rsnd_port0>; ++ prefix = "ak4613"; ++ routing = "ak4613 Playback", "DAI0 Playback", ++ "DAI0 Capture", "ak4613 Capture", ++ "ak4613 Playback", "Playback0", ++ "ak4613 Playback", "Playback1", ++ "ak4613 Playback", "Playback2", ++ "ak4613 Playback", "Playback3", ++ "Capture0", "ak4613 Capture", ++ "Capture1", "ak4613 Capture", ++ "Capture2", "ak4613 Capture", ++ "Capture3", "ak4613 Capture"; ++ ++ dais = <&adsp_port0 ++ &adsp_port1 ++ &adsp_port2 ++ &adsp_port3 ++ &rsnd_port0>; + }; + + vbus0_usb2: regulator-vbus0-usb2 { +@@ -501,8 +517,27 @@ + asahi-kasei,out5-single-end; + asahi-kasei,out6-single-end; + +- port { +- ak4613_endpoint: endpoint { ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ak4613_endpoint0: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&adsp_endpoint0>; ++ }; ++ ak4613_endpoint1: endpoint@1 { ++ reg = <1>; ++ remote-endpoint = <&adsp_endpoint1>; ++ }; ++ ak4613_endpoint2: endpoint@2 { ++ reg = <2>; ++ remote-endpoint = <&adsp_endpoint2>; ++ }; ++ ak4613_endpoint3: endpoint@3 { ++ reg = <3>; ++ remote-endpoint = <&adsp_endpoint3>; ++ }; ++ ak4613_endpoint4: endpoint@4 { ++ reg = <4>; + remote-endpoint = <&rsnd_endpoint0>; + }; + }; +@@ -702,6 +737,45 @@ + status = "okay"; + }; + ++&rcar_adsp_sound { ++ status = "okay"; ++ /* Multiple DAI */ ++ #sound-dai-cells = <1>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ adsp_port0: port@0 { ++ reg = <0>; ++ adsp_endpoint0: endpoint { ++ remote-endpoint = <&ak4613_endpoint0>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port1: port@1 { ++ reg = <1>; ++ adsp_endpoint1: endpoint { ++ remote-endpoint = <&ak4613_endpoint1>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port2: port@2 { ++ reg = <2>; ++ adsp_endpoint2: endpoint { ++ remote-endpoint = <&ak4613_endpoint2>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port3: port@3 { ++ reg = <3>; ++ adsp_endpoint3: endpoint { ++ remote-endpoint = <&ak4613_endpoint3>; ++ dai-format = "left_j"; ++ }; ++ }; ++ }; ++}; ++ + &rcar_sound { + pinctrl-0 = <&sound_pins &sound_clk_pins>; + pinctrl-names = "default"; +@@ -737,7 +811,7 @@ + ports { + rsnd_port0: port@0 { + rsnd_endpoint0: endpoint { +- remote-endpoint = <&ak4613_endpoint>; ++ remote-endpoint = <&ak4613_endpoint4>; + + dai-format = "left_j"; + bitclock-master = <&rsnd_endpoint0>; +diff --git a/arch/arm64/boot/dts/renesas/r8a77990-es10-ebisu.dts b/arch/arm64/boot/dts/renesas/r8a77990-es10-ebisu.dts +index 087d5533f3db..61e18309c4a4 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77990-es10-ebisu.dts ++++ b/arch/arm64/boot/dts/renesas/r8a77990-es10-ebisu.dts +@@ -221,11 +221,27 @@ + }; + + sound_card: sound { +- compatible = "audio-graph-card"; ++ compatible = "audio-graph-scu-card"; + + label = "rcar-sound"; + +- dais = <&rsnd_port0>; ++ prefix = "ak4613"; ++ routing = "ak4613 Playback", "DAI0 Playback", ++ "DAI0 Capture", "ak4613 Capture", ++ "ak4613 Playback", "Playback0", ++ "ak4613 Playback", "Playback1", ++ "ak4613 Playback", "Playback2", ++ "ak4613 Playback", "Playback3", ++ "Capture0", "ak4613 Capture", ++ "Capture1", "ak4613 Capture", ++ "Capture2", "ak4613 Capture", ++ "Capture3", "ak4613 Capture"; ++ ++ dais = <&adsp_port0 ++ &adsp_port1 ++ &adsp_port2 ++ &adsp_port3 ++ &rsnd_port0>; + }; + + vbus0_usb2: regulator-vbus0-usb2 { +@@ -501,8 +517,27 @@ + asahi-kasei,out5-single-end; + asahi-kasei,out6-single-end; + +- port { +- ak4613_endpoint: endpoint { ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ak4613_endpoint0: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&adsp_endpoint0>; ++ }; ++ ak4613_endpoint1: endpoint@1 { ++ reg = <1>; ++ remote-endpoint = <&adsp_endpoint1>; ++ }; ++ ak4613_endpoint2: endpoint@2 { ++ reg = <2>; ++ remote-endpoint = <&adsp_endpoint2>; ++ }; ++ ak4613_endpoint3: endpoint@3 { ++ reg = <3>; ++ remote-endpoint = <&adsp_endpoint3>; ++ }; ++ ak4613_endpoint4: endpoint@4 { ++ reg = <4>; + remote-endpoint = <&rsnd_endpoint0>; + }; + }; +@@ -702,6 +737,45 @@ + status = "okay"; + }; + ++&rcar_adsp_sound { ++ status = "okay"; ++ /* Multiple DAI */ ++ #sound-dai-cells = <1>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ adsp_port0: port@0 { ++ reg = <0>; ++ adsp_endpoint0: endpoint { ++ remote-endpoint = <&ak4613_endpoint0>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port1: port@1 { ++ reg = <1>; ++ adsp_endpoint1: endpoint { ++ remote-endpoint = <&ak4613_endpoint1>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port2: port@2 { ++ reg = <2>; ++ adsp_endpoint2: endpoint { ++ remote-endpoint = <&ak4613_endpoint2>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port3: port@3 { ++ reg = <3>; ++ adsp_endpoint3: endpoint { ++ remote-endpoint = <&ak4613_endpoint3>; ++ dai-format = "left_j"; ++ }; ++ }; ++ }; ++}; ++ + &rcar_sound { + pinctrl-0 = <&sound_pins &sound_clk_pins>; + pinctrl-names = "default"; +@@ -737,7 +811,7 @@ + ports { + rsnd_port0: port@0 { + rsnd_endpoint0: endpoint { +- remote-endpoint = <&ak4613_endpoint>; ++ remote-endpoint = <&ak4613_endpoint4>; + + dai-format = "left_j"; + bitclock-master = <&rsnd_endpoint0>; +diff --git a/arch/arm64/boot/dts/renesas/r8a77990.dtsi b/arch/arm64/boot/dts/renesas/r8a77990.dtsi +index bd4d71e2b93e..845399adcbdb 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77990.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a77990.dtsi +@@ -181,6 +181,11 @@ + method = "smc"; + }; + ++ rcar_adsp_sound: adsp_sound { ++ compatible = "renesas,rcar_adsp_sound_gen3"; ++ status = "disabled"; ++ }; ++ + /* External SCIF clock - to be overridden by boards that provide it */ + scif_clk: scif { + compatible = "fixed-clock"; +-- +2.19.1 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0006-ADSP-remove-HDMI-support-from-rcar-sound.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0006-ADSP-remove-HDMI-support-from-rcar-sound.patch new file mode 100644 index 00000000..3f601b64 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers/0006-ADSP-remove-HDMI-support-from-rcar-sound.patch @@ -0,0 +1,101 @@ +From acd7751ebcce90a442588f37fc6731990b5e09ea Mon Sep 17 00:00:00 2001 +From: Nguyen Dang <nguyen.dang.wh@renesas.com> +Date: Tue, 6 Nov 2018 11:46:25 +0700 +Subject: [PATCH v2 6/6] ADSP: remove HDMI support from rcar-sound + +Signed-off-by: Nguyen Dang <nguyen.dang.wh@renesas.com> +[takeshi.kihara.df: support for dt file separation by M3v3.0 SoC] +Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com> +--- + arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 6 ------ + arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts | 6 ------ + arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 5 ----- + arch/arm64/boot/dts/renesas/r8a7796-salvator-xs-2x4g.dts | 5 ----- + arch/arm64/boot/dts/renesas/r8a7796-salvator-xs.dts | 5 ----- + 5 files changed, 27 deletions(-) + +diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +index 6928afbd8e06..b268afd7df85 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts ++++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +@@ -104,12 +104,6 @@ + status = "okay"; + }; + +-&sound_card { +- dais = <&rsnd_port0 /* ak4613 */ +- &rsnd_port1 /* HDMI0 */ +- &rsnd_port2>; /* HDMI1 */ +-}; +- + &hdmi0 { + status = "okay"; + +diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts b/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts +index 498f78875dbd..b6ec3036e9fd 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts ++++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts +@@ -114,12 +114,6 @@ + status = "okay"; + }; + +-&sound_card { +- dais = <&rsnd_port0 /* ak4613 */ +- &rsnd_port1 /* HDMI0 */ +- &rsnd_port2>; /* HDMI1 */ +-}; +- + &hdmi0 { + status = "okay"; + +diff --git a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts +index cf92aa3939e3..4faf935c4a32 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts ++++ b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts +@@ -88,11 +88,6 @@ + "dclkin.0", "dclkin.1", "dclkin.2"; + }; + +-&sound_card { +- dais = <&rsnd_port0 /* ak4613 */ +- &rsnd_port1>; /* HDMI0 */ +-}; +- + &hdmi0 { + status = "okay"; + +diff --git a/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs-2x4g.dts b/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs-2x4g.dts +index 664dc9250bbb..13960f69b2f7 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs-2x4g.dts ++++ b/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs-2x4g.dts +@@ -96,11 +96,6 @@ + "dclkin.0", "dclkin.1", "dclkin.2"; + }; + +-&sound_card { +- dais = <&rsnd_port0 /* ak4613 */ +- &rsnd_port1>; /* HDMI0 */ +-}; +- + &hdmi0 { + status = "okay"; + +diff --git a/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs.dts b/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs.dts +index 7d39dc96ac8a..1cd6f0463361 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs.dts ++++ b/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs.dts +@@ -88,11 +88,6 @@ + "dclkin.0", "dclkin.1", "dclkin.2"; + }; + +-&sound_card { +- dais = <&rsnd_port0 /* ak4613 */ +- &rsnd_port1>; /* HDMI0 */ +-}; +- + &hdmi0 { + status = "okay"; + +-- +2.21.0 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers_4.14.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers_4.14.bb new file mode 100644 index 00000000..6afa4ef4 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux-libc-headers/linux-libc-headers_4.14.bb @@ -0,0 +1,48 @@ +require recipes-kernel/linux-libc-headers/linux-libc-headers.inc +require include/iccom-control.inc +require include/adsp-control.inc + +RENESAS_BSP_URL = " \ + git://github.com/renesas-rcar/linux-bsp.git" +BRANCH = "v4.14.75-ltsi/rcar-3.9.9" +SRCREV = "4d2a32e5d314e2c77346f13e8736e97ca3e1b90b" + +SRC_URI = "${RENESAS_BSP_URL};branch=${BRANCH}" + +LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7" + +# Add python3 support to fix Perf build failure +SRC_URI_append = " \ + file://0001-perf-tools-Add-Python-3-support.patch \ +" + +# Fix patch for Weston 8.0.0 issue +SRC_URI_append = " \ + file://0001-drm-rcar-du-Set-primary-plane-zpos-immutably-at-init.patch \ +" + +# Enable RPMSG_VIRTIO depend on ICCOM +SRC_URI_append = " \ + ${@oe.utils.conditional("USE_ICCOM", "1", " file://0001-rpmsg-Add-message-to-be-able-to-configure-RPMSG_VIRT.patch", "", d)} \ +" + +# Add ADSP ALSA driver +SUPPORT_ADSP_ASOC = " \ + file://0001-ADSP-add-document-for-compatible-string-renesas-rcar.patch \ + file://0002-ADSP-add-ADSP-sound-driver-source.patch \ + file://0003-ADSP-add-build-for-ADSP-sound-driver.patch \ + file://0004-ADSP-integrate-ADSP-sound-for-H3-M3-M3N-board.patch \ + file://0005-ADSP-integrate-ADSP-sound-for-E3-board.patch \ + file://0006-ADSP-remove-HDMI-support-from-rcar-sound.patch \ +" + +SRC_URI_append = " \ + ${@oe.utils.conditional("USE_ADSP", "1", "${SUPPORT_ADSP_ASOC}", "", d)} \ +" + +S = "${WORKDIR}/git" + +# W/A Fix build issue with Linux v4.14 +SRC_URI_append = " \ + file://0001-arm64-bpf-correct-broken-uapi-for-BPF_PROG_TYPE_PERF.patch \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-ADSP-add-document-for-compatible-string-renesas-rcar.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-ADSP-add-document-for-compatible-string-renesas-rcar.patch new file mode 100644 index 00000000..765053fa --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-ADSP-add-document-for-compatible-string-renesas-rcar.patch @@ -0,0 +1,32 @@ +From 5f378e5db591a4a119b6cface6037cbded240506 Mon Sep 17 00:00:00 2001 +From: tienphitran <tien.tran.uw@renesas.com> +Date: Thu, 25 Oct 2018 13:25:10 +0700 +Subject: [PATCH 1/6] ADSP: add document for compatible string + "renesas,rcar_adsp_sound_gen3" + +Signed-off-by: tienphitran <tien.tran.uw@renesas.com> +--- + .../devicetree/bindings/sound/renesas,adsp.txt | 11 +++++++++++ + 1 file changed, 11 insertions(+) + create mode 100644 Documentation/devicetree/bindings/sound/renesas,adsp.txt + +diff --git a/Documentation/devicetree/bindings/sound/renesas,adsp.txt b/Documentation/devicetree/bindings/sound/renesas,adsp.txt +new file mode 100644 +index 000000000000..b529bcadea82 +--- /dev/null ++++ b/Documentation/devicetree/bindings/sound/renesas,adsp.txt +@@ -0,0 +1,11 @@ ++Renesas ADSP sound driver ++ ++Required properties: ++- compatible : "renesas,rcar_adsp_sound_gen3" ++ ++Example: ++ ++rcar_adsp_sound: adsp_sound@0 { ++ compatible = "renesas,rcar_adsp_sound_gen3"; ++ status = "disabled"; ++}; +-- +2.19.1 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-arm64-bpf-correct-broken-uapi-for-BPF_PROG_TYPE_PERF.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-arm64-bpf-correct-broken-uapi-for-BPF_PROG_TYPE_PERF.patch new file mode 100644 index 00000000..9c38a327 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-arm64-bpf-correct-broken-uapi-for-BPF_PROG_TYPE_PERF.patch @@ -0,0 +1,61 @@ +From a39cada70268aadff7153e4f782bcd90a5c69d07 Mon Sep 17 00:00:00 2001 +From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> +Date: Mon, 4 Dec 2017 10:56:46 +0100 +Subject: [PATCH] arm64/bpf: correct broken uapi for BPF_PROG_TYPE_PERF_EVENT + program type + +Correct the broken uapi for the BPF_PROG_TYPE_PERF_EVENT program type +by exporting the user_pt_regs structure instead of the pt_regs structure +that is in-kernel only. + +Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> +Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com> +Acked-by: Alexei Starovoitov <ast@kernel.org> +Cc: Will Deacon <will.deacon@arm.com> +Cc: Mark Rutland <mark.rutland@arm.com> +Cc: Arnaldo Carvalho de Melo <acme@kernel.org> +Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> +--- + arch/arm64/include/asm/perf_event.h | 2 ++ + arch/arm64/include/uapi/asm/bpf_perf_event.h | 9 +++++++++ + 2 files changed, 11 insertions(+) + create mode 100644 arch/arm64/include/uapi/asm/bpf_perf_event.h + +diff --git a/arch/arm64/include/asm/perf_event.h b/arch/arm64/include/asm/perf_event.h +index 8d5cbec..f9ccc36 100644 +--- a/arch/arm64/include/asm/perf_event.h ++++ b/arch/arm64/include/asm/perf_event.h +@@ -18,6 +18,7 @@ + #define __ASM_PERF_EVENT_H + + #include <asm/stack_pointer.h> ++#include <asm/ptrace.h> + + #define ARMV8_PMU_MAX_COUNTERS 32 + #define ARMV8_PMU_COUNTER_MASK (ARMV8_PMU_MAX_COUNTERS - 1) +@@ -79,6 +80,7 @@ struct pt_regs; + extern unsigned long perf_instruction_pointer(struct pt_regs *regs); + extern unsigned long perf_misc_flags(struct pt_regs *regs); + #define perf_misc_flags(regs) perf_misc_flags(regs) ++#define perf_arch_bpf_user_pt_regs(regs) ®s->user_regs + #endif + + #define perf_arch_fetch_caller_regs(regs, __ip) { \ +diff --git a/arch/arm64/include/uapi/asm/bpf_perf_event.h b/arch/arm64/include/uapi/asm/bpf_perf_event.h +new file mode 100644 +index 0000000..b551b74 +--- /dev/null ++++ b/arch/arm64/include/uapi/asm/bpf_perf_event.h +@@ -0,0 +1,9 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__ ++#define _UAPI__ASM_BPF_PERF_EVENT_H__ ++ ++#include <asm/ptrace.h> ++ ++typedef struct user_pt_regs bpf_user_pt_regs_t; ++ ++#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */ +-- +2.7.4 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-drm-rcar-du-Set-primary-plane-zpos-immutably-at-init.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-drm-rcar-du-Set-primary-plane-zpos-immutably-at-init.patch new file mode 100644 index 00000000..9ce66d64 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-drm-rcar-du-Set-primary-plane-zpos-immutably-at-init.patch @@ -0,0 +1,89 @@ +From f8358c2afe0be62cffe4cca58c5373951ecc1c8d Mon Sep 17 00:00:00 2001 +From: Khang Nguyen <khang.nguyen.xw@renesas.com> +Date: Mon, 13 Apr 2020 21:49:28 +0900 +Subject: [PATCH] drm: rcar-du: Set primary plane zpos immutably at + initializing + +This patch backports a fix from [1] for an issue occurs on Weston 8.0.0. + +[1]: +https://lists.freedesktop.org/archives/dri-devel/2020-April/261224.html + +According to drm_plane_create_zpos_property() function documentation, +all planes zpos range should be set if zpos property is supported. +However, the rcar-du driver didn't set primary plane zpos range. Since +the primary plane's zpos is fixed, set it immutably. + +Signed-off-by: Khang Nguyen <khang.nguyen.xw@renesas.com> +Signed-off-by: Tram Huynh <tram.huynh.aj@renesas.com> +--- + drivers/gpu/drm/rcar-du/rcar_du_plane.c | 13 ++++++++----- + drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 18 ++++++++++-------- + 2 files changed, 18 insertions(+), 13 deletions(-) + +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c +index 1b70db3..5818c59 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c ++++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c +@@ -825,15 +825,18 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp) + drm_plane_helper_add(&plane->plane, + &rcar_du_plane_helper_funcs); + +- if (type == DRM_PLANE_TYPE_PRIMARY) +- continue; ++ if (type == DRM_PLANE_TYPE_PRIMARY){ ++ drm_plane_create_zpos_immutable_property(&plane->plane, ++ 0); ++ } else { + +- drm_object_attach_property(&plane->plane.base, ++ drm_object_attach_property(&plane->plane.base, + rcdu->props.alpha, 255); +- drm_object_attach_property(&plane->plane.base, ++ drm_object_attach_property(&plane->plane.base, + rcdu->props.colorkey, + RCAR_DU_COLORKEY_NONE); +- drm_plane_create_zpos_property(&plane->plane, 1, 1, 7); ++ drm_plane_create_zpos_property(&plane->plane, 1, 1, 7); ++ } + } + + return 0; +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +index c44d336..0c352a0 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c ++++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c +@@ -633,20 +633,22 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np, + drm_plane_helper_add(&plane->plane, + &rcar_du_vsp_plane_helper_funcs); + +- if (type == DRM_PLANE_TYPE_PRIMARY) +- continue; +- +- drm_object_attach_property(&plane->plane.base, ++ if (type == DRM_PLANE_TYPE_PRIMARY) { ++ drm_plane_create_zpos_immutable_property(&plane->plane, ++ 0); ++ } else { ++ drm_object_attach_property(&plane->plane.base, + rcdu->props.alpha, 255); +- drm_object_attach_property(&plane->plane.base, ++ drm_object_attach_property(&plane->plane.base, + rcdu->props.colorkey, + RCAR_DU_COLORKEY_NONE); +- if (rcdu->props.colorkey_alpha) +- drm_object_attach_property(&plane->plane.base, ++ if (rcdu->props.colorkey_alpha) ++ drm_object_attach_property(&plane->plane.base, + rcdu->props.colorkey_alpha, + 0); +- drm_plane_create_zpos_property(&plane->plane, 1, 1, ++ drm_plane_create_zpos_property(&plane->plane, 1, 1, + vsp->num_planes - 1); ++ } + } + + return 0; +-- +2.7.4 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-perf-tools-Add-Python-3-support.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-perf-tools-Add-Python-3-support.patch new file mode 100644 index 00000000..74ce61e5 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-perf-tools-Add-Python-3-support.patch @@ -0,0 +1,917 @@ +From 8804547988bb772a00cd4bb832fe4e1a79f552b7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= <jskarvad@redhat.com> +Date: Fri, 19 Jan 2018 21:56:41 +0100 +Subject: [PATCH] perf tools: Add Python 3 support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Added Python 3 support while keeping Python 2.7 compatibility. + +Committer notes: + +This doesn't make it to auto detect python 3, one has to explicitely ask +it to build with python 3 devel files, here are the instructions +provided by Jaroslav: + + --- + $ cp -a tools/perf tools/python3-perf + $ make V=1 prefix=/usr -C tools/perf PYTHON=/usr/bin/python2 all + $ make V=1 prefix=/usr -C tools/python3-perf PYTHON=/usr/bin/python3 all + $ make V=1 prefix=/usr -C tools/python3-perf PYTHON=/usr/bin/python3 DESTDIR=%{buildroot} install-python_ext + $ make V=1 prefix=/usr -C tools/perf PYTHON=/usr/bin/python2 DESTDIR=%{buildroot} install-python_ext + --- + +We need to make this automatic, just like the existing tests for checking if +the python2 devel files are in place, allowing the build with python3 if +available, fallbacking to python2 and then just disabling it if none are +available. + +So, using the PYTHON variable to build it using O= we get: + +Before this patch: + + $ rpm -q python3 python3-devel + python3-3.6.4-7.fc27.x86_64 + python3-devel-3.6.4-7.fc27.x86_64 + $ rm -rf /tmp/build/perf/ ; mkdir -p /tmp/build/perf ; make O=/tmp/build/perf PYTHON=/usr/bin/python3 -C tools/perf install-bin + make: Entering directory '/home/acme/git/linux/tools/perf' + <SNIP> + Makefile.config:670: Python 3 is not yet supported; please set + Makefile.config:671: PYTHON and/or PYTHON_CONFIG appropriately. + Makefile.config:672: If you also have Python 2 installed, then + Makefile.config:673: try something like: + Makefile.config:674: + Makefile.config:675: make PYTHON=python2 + Makefile.config:676: + Makefile.config:677: Otherwise, disable Python support entirely: + Makefile.config:678: + Makefile.config:679: make NO_LIBPYTHON=1 + Makefile.config:680: + Makefile.config:681: *** . Stop. + make[1]: *** [Makefile.perf:212: sub-make] Error 2 + make: *** [Makefile:110: install-bin] Error 2 + make: Leaving directory '/home/acme/git/linux/tools/perf' + $ + +After: + + $ make O=/tmp/build/perf PYTHON=python3 -C tools/perf install-bin + $ ldd ~/bin/perf | grep python + libpython3.6m.so.1.0 => /lib64/libpython3.6m.so.1.0 (0x00007f58a31e8000) + $ rpm -qf /lib64/libpython3.6m.so.1.0 + python3-libs-3.6.4-7.fc27.x86_64 + $ + +Now verify that when using the binding the right ELF file is loaded, +using perf trace: + + $ perf trace -e open* perf test python + 0.051 ( 0.016 ms): perf/3927 openat(dfd: CWD, filename: /etc/ld.so.cache, flags: CLOEXEC ) = 3 +<SNIP> + 18: 'import perf' in python : + 8.849 ( 0.013 ms): sh/3929 openat(dfd: CWD, filename: /etc/ld.so.cache, flags: CLOEXEC ) = 3 +<SNIP> + 25.572 ( 0.008 ms): python3/3931 openat(dfd: CWD, filename: /tmp/build/perf/python/perf.cpython-36m-x86_64-linux-gnu.so, flags: CLOEXEC) = 3 +<SNIP> + Ok +<SNIP> + $ + +And using tools/perf/python/twatch.py, to show PERF_RECORD_ metaevents: + + $ python3 tools/perf/python/twatch.py + cpu: 3, pid: 16060, tid: 16060 { type: fork, pid: 5207, ppid: 16060, tid: 5207, ptid: 16060, time: 10798513015459} + cpu: 3, pid: 16060, tid: 16060 { type: fork, pid: 5208, ppid: 16060, tid: 5208, ptid: 16060, time: 10798513562503} + cpu: 0, pid: 5208, tid: 5208 { type: comm, pid: 5208, tid: 5208, comm: grep } + cpu: 2, pid: 5207, tid: 5207 { type: comm, pid: 5207, tid: 5207, comm: ps } + cpu: 2, pid: 5207, tid: 5207 { type: exit, pid: 5207, ppid: 5207, tid: 5207, ptid: 5207, time: 10798551337484} + cpu: 3, pid: 5208, tid: 5208 { type: exit, pid: 5208, ppid: 5208, tid: 5208, ptid: 5208, time: 10798551292153} + cpu: 3, pid: 601, tid: 601 { type: fork, pid: 5209, ppid: 601, tid: 5209, ptid: 601, time: 10801779977324} + ^CTraceback (most recent call last): + File "tools/perf/python/twatch.py", line 68, in <module> + main() + File "tools/perf/python/twatch.py", line 40, in main + evlist.poll(timeout = -1) + KeyboardInterrupt + $ + + # ps ax|grep twatch + 5197 pts/8 S+ 0:00 python3 tools/perf/python/twatch.py + # ls -la /proc/5197/smaps + -r--r--r--. 1 acme acme 0 Feb 19 13:14 /proc/5197/smaps + # grep python /proc/5197/smaps + 558111307000-558111309000 r-xp 00000000 fd:00 3151710 /usr/bin/python3.6 + 558111508000-558111509000 r--p 00001000 fd:00 3151710 /usr/bin/python3.6 + 558111509000-55811150a000 rw-p 00002000 fd:00 3151710 /usr/bin/python3.6 + 7ffad6fc1000-7ffad7008000 r-xp 00000000 00:2d 220196 /tmp/build/perf/python/perf.cpython-36m-x86_64-linux-gnu.so + 7ffad7008000-7ffad7207000 ---p 00047000 00:2d 220196 /tmp/build/perf/python/perf.cpython-36m-x86_64-linux-gnu.so + 7ffad7207000-7ffad7208000 r--p 00046000 00:2d 220196 /tmp/build/perf/python/perf.cpython-36m-x86_64-linux-gnu.so + 7ffad7208000-7ffad7215000 rw-p 00047000 00:2d 220196 /tmp/build/perf/python/perf.cpython-36m-x86_64-linux-gnu.so + 7ffadea77000-7ffaded3d000 r-xp 00000000 fd:00 3151795 /usr/lib64/libpython3.6m.so.1.0 + 7ffaded3d000-7ffadef3c000 ---p 002c6000 fd:00 3151795 /usr/lib64/libpython3.6m.so.1.0 + 7ffadef3c000-7ffadef42000 r--p 002c5000 fd:00 3151795 /usr/lib64/libpython3.6m.so.1.0 + 7ffadef42000-7ffadefa5000 rw-p 002cb000 fd:00 3151795 /usr/lib64/libpython3.6m.so.1.0 + # + +And with this patch, but building normally, without specifying the +PYTHON=python3 part, which will make it use python2 if its devel files are +available, like in this test: + + $ make O=/tmp/build/perf -C tools/perf install-bin + $ ldd ~/bin/perf | grep python + libpython2.7.so.1.0 => /lib64/libpython2.7.so.1.0 (0x00007f6a44410000) + $ ldd /tmp/build/perf/python_ext_build/lib/perf.so | grep python + libpython2.7.so.1.0 => /lib64/libpython2.7.so.1.0 (0x00007fed28a2c000) + $ + + [acme@jouet perf]$ tools/perf/python/twatch.py + cpu: 0, pid: 2817, tid: 2817 { type: fork, pid: 2817, ppid: 2817, tid: 8910, ptid: 2817, time: 11126454335306} + cpu: 0, pid: 2817, tid: 2817 { type: comm, pid: 2817, tid: 8910, comm: worker } + $ ps ax | grep twatch.py + 8909 pts/8 S+ 0:00 /usr/bin/python tools/perf/python/twatch.py + $ grep python /proc/8909/smaps + 5579de658000-5579de659000 r-xp 00000000 fd:00 3156044 /usr/bin/python2.7 + 5579de858000-5579de859000 r--p 00000000 fd:00 3156044 /usr/bin/python2.7 + 5579de859000-5579de85a000 rw-p 00001000 fd:00 3156044 /usr/bin/python2.7 + 7f0de01f7000-7f0de023e000 r-xp 00000000 00:2d 230695 /tmp/build/perf/python/perf.so + 7f0de023e000-7f0de043d000 ---p 00047000 00:2d 230695 /tmp/build/perf/python/perf.so + 7f0de043d000-7f0de043e000 r--p 00046000 00:2d 230695 /tmp/build/perf/python/perf.so + 7f0de043e000-7f0de044b000 rw-p 00047000 00:2d 230695 /tmp/build/perf/python/perf.so + 7f0de6f0f000-7f0de6f13000 r-xp 00000000 fd:00 134975 /usr/lib64/python2.7/lib-dynload/_localemodule.so + 7f0de6f13000-7f0de7113000 ---p 00004000 fd:00 134975 /usr/lib64/python2.7/lib-dynload/_localemodule.so + 7f0de7113000-7f0de7114000 r--p 00004000 fd:00 134975 /usr/lib64/python2.7/lib-dynload/_localemodule.so + 7f0de7114000-7f0de7115000 rw-p 00005000 fd:00 134975 /usr/lib64/python2.7/lib-dynload/_localemodule.so + 7f0de7e73000-7f0de8052000 r-xp 00000000 fd:00 3173292 /usr/lib64/libpython2.7.so.1.0 + 7f0de8052000-7f0de8251000 ---p 001df000 fd:00 3173292 /usr/lib64/libpython2.7.so.1.0 + 7f0de8251000-7f0de8255000 r--p 001de000 fd:00 3173292 /usr/lib64/libpython2.7.so.1.0 + 7f0de8255000-7f0de8291000 rw-p 001e2000 fd:00 3173292 /usr/lib64/libpython2.7.so.1.0 + $ + +Signed-off-by: Jaroslav Å karvada <jskarvad@redhat.com> +Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> +Cc: Adrian Hunter <adrian.hunter@intel.com> +Cc: David Ahern <dsahern@gmail.com> +Cc: Jiri Olsa <jolsa@kernel.org> +Cc: Namhyung Kim <namhyung@kernel.org> +Cc: Wang Nan <wangnan0@huawei.com> +LPU-Reference: 20180119205641.24242-1-jskarvad@redhat.com +Link: https://lkml.kernel.org/n/tip-8d7dt9kqp83vsz25hagug8fu@git.kernel.org +[ Removed explicit check for python version, allowing it to really build with python3 ] +Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> + +Upstream status: Backport [https://github.com/torvalds/linux/commit/66dfdff03d196e51322c6a85c0d8db8bb2bdd655] +Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> +--- + tools/perf/Makefile.config | 23 +-- + tools/perf/Makefile.perf | 4 +- + .../scripts/python/Perf-Trace-Util/Context.c | 34 +++- + tools/perf/util/python.c | 95 ++++++++--- + .../scripting-engines/trace-event-python.c | 147 +++++++++++++----- + tools/perf/util/setup.py | 6 +- + 6 files changed, 221 insertions(+), 88 deletions(-) + +diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config +index f362ee46506a..ecdc3770d899 100644 +--- a/tools/perf/Makefile.config ++++ b/tools/perf/Makefile.config +@@ -622,25 +622,10 @@ else + ifneq ($(feature-libpython), 1) + $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev) + else +- ifneq ($(feature-libpython-version), 1) +- $(warning Python 3 is not yet supported; please set) +- $(warning PYTHON and/or PYTHON_CONFIG appropriately.) +- $(warning If you also have Python 2 installed, then) +- $(warning try something like:) +- $(warning $(and ,)) +- $(warning $(and ,) make PYTHON=python2) +- $(warning $(and ,)) +- $(warning Otherwise, disable Python support entirely:) +- $(warning $(and ,)) +- $(warning $(and ,) make NO_LIBPYTHON=1) +- $(warning $(and ,)) +- $(error $(and ,)) +- else +- LDFLAGS += $(PYTHON_EMBED_LDFLAGS) +- EXTLIBS += $(PYTHON_EMBED_LIBADD) +- LANG_BINDINGS += $(obj-perf)python/perf.so +- $(call detected,CONFIG_LIBPYTHON) +- endif ++ LDFLAGS += $(PYTHON_EMBED_LDFLAGS) ++ EXTLIBS += $(PYTHON_EMBED_LIBADD) ++ LANG_BINDINGS += $(obj-perf)python/perf.so ++ $(call detected,CONFIG_LIBPYTHON) + endif + endif + endif +diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf +index 349ea5133d83..6879321c612d 100644 +--- a/tools/perf/Makefile.perf ++++ b/tools/perf/Makefile.perf +@@ -294,7 +294,7 @@ PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/ + PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/ + export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP + +-python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so ++python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so + + PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources) + PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPI) +@@ -444,7 +444,7 @@ $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_D + $(PYTHON_WORD) util/setup.py \ + --quiet build_ext; \ + mkdir -p $(OUTPUT)python && \ +- cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/ ++ cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/ + + please_set_SHELL_PATH_to_a_more_modern_shell: + $(Q)$$(:) +diff --git a/tools/perf/scripts/python/Perf-Trace-Util/Context.c b/tools/perf/scripts/python/Perf-Trace-Util/Context.c +index fcd1dd667906..1a0d27757eec 100644 +--- a/tools/perf/scripts/python/Perf-Trace-Util/Context.c ++++ b/tools/perf/scripts/python/Perf-Trace-Util/Context.c +@@ -23,7 +23,17 @@ + #include "../../../perf.h" + #include "../../../util/trace-event.h" + ++#if PY_MAJOR_VERSION < 3 ++#define _PyCapsule_GetPointer(arg1, arg2) \ ++ PyCObject_AsVoidPtr(arg1) ++ + PyMODINIT_FUNC initperf_trace_context(void); ++#else ++#define _PyCapsule_GetPointer(arg1, arg2) \ ++ PyCapsule_GetPointer((arg1), (arg2)) ++ ++PyMODINIT_FUNC PyInit_perf_trace_context(void); ++#endif + + static PyObject *perf_trace_context_common_pc(PyObject *obj, PyObject *args) + { +@@ -34,7 +44,7 @@ static PyObject *perf_trace_context_common_pc(PyObject *obj, PyObject *args) + if (!PyArg_ParseTuple(args, "O", &context)) + return NULL; + +- scripting_context = PyCObject_AsVoidPtr(context); ++ scripting_context = _PyCapsule_GetPointer(context, NULL); + retval = common_pc(scripting_context); + + return Py_BuildValue("i", retval); +@@ -50,7 +60,7 @@ static PyObject *perf_trace_context_common_flags(PyObject *obj, + if (!PyArg_ParseTuple(args, "O", &context)) + return NULL; + +- scripting_context = PyCObject_AsVoidPtr(context); ++ scripting_context = _PyCapsule_GetPointer(context, NULL); + retval = common_flags(scripting_context); + + return Py_BuildValue("i", retval); +@@ -66,7 +76,7 @@ static PyObject *perf_trace_context_common_lock_depth(PyObject *obj, + if (!PyArg_ParseTuple(args, "O", &context)) + return NULL; + +- scripting_context = PyCObject_AsVoidPtr(context); ++ scripting_context = _PyCapsule_GetPointer(context, NULL); + retval = common_lock_depth(scripting_context); + + return Py_BuildValue("i", retval); +@@ -82,7 +92,25 @@ static PyMethodDef ContextMethods[] = { + { NULL, NULL, 0, NULL} + }; + ++#if PY_MAJOR_VERSION < 3 + PyMODINIT_FUNC initperf_trace_context(void) + { + (void) Py_InitModule("perf_trace_context", ContextMethods); + } ++#else ++PyMODINIT_FUNC PyInit_perf_trace_context(void) ++{ ++ static struct PyModuleDef moduledef = { ++ PyModuleDef_HEAD_INIT, ++ "perf_trace_context", /* m_name */ ++ "", /* m_doc */ ++ -1, /* m_size */ ++ ContextMethods, /* m_methods */ ++ NULL, /* m_reload */ ++ NULL, /* m_traverse */ ++ NULL, /* m_clear */ ++ NULL, /* m_free */ ++ }; ++ return PyModule_Create(&moduledef); ++} ++#endif +diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c +index 8e49d9cafcfc..16620c37fd8c 100644 +--- a/tools/perf/util/python.c ++++ b/tools/perf/util/python.c +@@ -12,6 +12,30 @@ + #include "print_binary.h" + #include "thread_map.h" + ++#if PY_MAJOR_VERSION < 3 ++#define _PyUnicode_FromString(arg) \ ++ PyString_FromString(arg) ++#define _PyUnicode_AsString(arg) \ ++ PyString_AsString(arg) ++#define _PyUnicode_FromFormat(...) \ ++ PyString_FromFormat(__VA_ARGS__) ++#define _PyLong_FromLong(arg) \ ++ PyInt_FromLong(arg) ++ ++#else ++ ++#define _PyUnicode_FromString(arg) \ ++ PyUnicode_FromString(arg) ++#define _PyUnicode_FromFormat(...) \ ++ PyUnicode_FromFormat(__VA_ARGS__) ++#define _PyLong_FromLong(arg) \ ++ PyLong_FromLong(arg) ++#endif ++ ++#ifndef Py_TYPE ++#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) ++#endif ++ + /* + * Provide these two so that we don't have to link against callchain.c and + * start dragging hist.c, etc. +@@ -49,7 +73,11 @@ int eprintf(int level, int var, const char *fmt, ...) + # define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, + #endif + ++#if PY_MAJOR_VERSION < 3 + PyMODINIT_FUNC initperf(void); ++#else ++PyMODINIT_FUNC PyInit_perf(void); ++#endif + + #define member_def(type, member, ptype, help) \ + { #member, ptype, \ +@@ -107,7 +135,7 @@ static PyObject *pyrf_mmap_event__repr(struct pyrf_event *pevent) + pevent->event.mmap.pgoff, pevent->event.mmap.filename) < 0) { + ret = PyErr_NoMemory(); + } else { +- ret = PyString_FromString(s); ++ ret = _PyUnicode_FromString(s); + free(s); + } + return ret; +@@ -138,7 +166,7 @@ static PyMemberDef pyrf_task_event__members[] = { + + static PyObject *pyrf_task_event__repr(struct pyrf_event *pevent) + { +- return PyString_FromFormat("{ type: %s, pid: %u, ppid: %u, tid: %u, " ++ return _PyUnicode_FromFormat("{ type: %s, pid: %u, ppid: %u, tid: %u, " + "ptid: %u, time: %" PRIu64 "}", + pevent->event.header.type == PERF_RECORD_FORK ? "fork" : "exit", + pevent->event.fork.pid, +@@ -171,7 +199,7 @@ static PyMemberDef pyrf_comm_event__members[] = { + + static PyObject *pyrf_comm_event__repr(struct pyrf_event *pevent) + { +- return PyString_FromFormat("{ type: comm, pid: %u, tid: %u, comm: %s }", ++ return _PyUnicode_FromFormat("{ type: comm, pid: %u, tid: %u, comm: %s }", + pevent->event.comm.pid, + pevent->event.comm.tid, + pevent->event.comm.comm); +@@ -202,7 +230,7 @@ static PyObject *pyrf_throttle_event__repr(struct pyrf_event *pevent) + { + struct throttle_event *te = (struct throttle_event *)(&pevent->event.header + 1); + +- return PyString_FromFormat("{ type: %sthrottle, time: %" PRIu64 ", id: %" PRIu64 ++ return _PyUnicode_FromFormat("{ type: %sthrottle, time: %" PRIu64 ", id: %" PRIu64 + ", stream_id: %" PRIu64 " }", + pevent->event.header.type == PERF_RECORD_THROTTLE ? "" : "un", + te->time, te->id, te->stream_id); +@@ -237,7 +265,7 @@ static PyObject *pyrf_lost_event__repr(struct pyrf_event *pevent) + pevent->event.lost.id, pevent->event.lost.lost) < 0) { + ret = PyErr_NoMemory(); + } else { +- ret = PyString_FromString(s); ++ ret = _PyUnicode_FromString(s); + free(s); + } + return ret; +@@ -264,7 +292,7 @@ static PyMemberDef pyrf_read_event__members[] = { + + static PyObject *pyrf_read_event__repr(struct pyrf_event *pevent) + { +- return PyString_FromFormat("{ type: read, pid: %u, tid: %u }", ++ return _PyUnicode_FromFormat("{ type: read, pid: %u, tid: %u }", + pevent->event.read.pid, + pevent->event.read.tid); + /* +@@ -299,7 +327,7 @@ static PyObject *pyrf_sample_event__repr(struct pyrf_event *pevent) + if (asprintf(&s, "{ type: sample }") < 0) { + ret = PyErr_NoMemory(); + } else { +- ret = PyString_FromString(s); ++ ret = _PyUnicode_FromString(s); + free(s); + } + return ret; +@@ -330,7 +358,7 @@ tracepoint_field(struct pyrf_event *pe, struct format_field *field) + } + if (field->flags & FIELD_IS_STRING && + is_printable_array(data + offset, len)) { +- ret = PyString_FromString((char *)data + offset); ++ ret = _PyUnicode_FromString((char *)data + offset); + } else { + ret = PyByteArray_FromStringAndSize((const char *) data + offset, len); + field->flags &= ~FIELD_IS_STRING; +@@ -352,7 +380,7 @@ tracepoint_field(struct pyrf_event *pe, struct format_field *field) + static PyObject* + get_tracepoint_field(struct pyrf_event *pevent, PyObject *attr_name) + { +- const char *str = PyString_AsString(PyObject_Str(attr_name)); ++ const char *str = _PyUnicode_AsString(PyObject_Str(attr_name)); + struct perf_evsel *evsel = pevent->evsel; + struct format_field *field; + +@@ -416,7 +444,7 @@ static PyObject *pyrf_context_switch_event__repr(struct pyrf_event *pevent) + !!(pevent->event.header.misc & PERF_RECORD_MISC_SWITCH_OUT)) < 0) { + ret = PyErr_NoMemory(); + } else { +- ret = PyString_FromString(s); ++ ret = _PyUnicode_FromString(s); + free(s); + } + return ret; +@@ -528,7 +556,7 @@ static int pyrf_cpu_map__init(struct pyrf_cpu_map *pcpus, + static void pyrf_cpu_map__delete(struct pyrf_cpu_map *pcpus) + { + cpu_map__put(pcpus->cpus); +- pcpus->ob_type->tp_free((PyObject*)pcpus); ++ Py_TYPE(pcpus)->tp_free((PyObject*)pcpus); + } + + static Py_ssize_t pyrf_cpu_map__length(PyObject *obj) +@@ -597,7 +625,7 @@ static int pyrf_thread_map__init(struct pyrf_thread_map *pthreads, + static void pyrf_thread_map__delete(struct pyrf_thread_map *pthreads) + { + thread_map__put(pthreads->threads); +- pthreads->ob_type->tp_free((PyObject*)pthreads); ++ Py_TYPE(pthreads)->tp_free((PyObject*)pthreads); + } + + static Py_ssize_t pyrf_thread_map__length(PyObject *obj) +@@ -759,7 +787,7 @@ static int pyrf_evsel__init(struct pyrf_evsel *pevsel, + static void pyrf_evsel__delete(struct pyrf_evsel *pevsel) + { + perf_evsel__exit(&pevsel->evsel); +- pevsel->ob_type->tp_free((PyObject*)pevsel); ++ Py_TYPE(pevsel)->tp_free((PyObject*)pevsel); + } + + static PyObject *pyrf_evsel__open(struct pyrf_evsel *pevsel, +@@ -850,7 +878,7 @@ static int pyrf_evlist__init(struct pyrf_evlist *pevlist, + static void pyrf_evlist__delete(struct pyrf_evlist *pevlist) + { + perf_evlist__exit(&pevlist->evlist); +- pevlist->ob_type->tp_free((PyObject*)pevlist); ++ Py_TYPE(pevlist)->tp_free((PyObject*)pevlist); + } + + static PyObject *pyrf_evlist__mmap(struct pyrf_evlist *pevlist, +@@ -902,12 +930,16 @@ static PyObject *pyrf_evlist__get_pollfd(struct pyrf_evlist *pevlist, + + for (i = 0; i < evlist->pollfd.nr; ++i) { + PyObject *file; ++#if PY_MAJOR_VERSION < 3 + FILE *fp = fdopen(evlist->pollfd.entries[i].fd, "r"); + + if (fp == NULL) + goto free_list; + + file = PyFile_FromFile(fp, "perf", "r", NULL); ++#else ++ file = PyFile_FromFd(evlist->pollfd.entries[i].fd, "perf", "r", -1, NULL, NULL, NULL, 1); ++#endif + if (file == NULL) + goto free_list; + +@@ -1194,9 +1226,9 @@ static PyObject *pyrf__tracepoint(struct pyrf_evsel *pevsel, + + tp_format = trace_event__tp_format(sys, name); + if (IS_ERR(tp_format)) +- return PyInt_FromLong(-1); ++ return _PyLong_FromLong(-1); + +- return PyInt_FromLong(tp_format->id); ++ return _PyLong_FromLong(tp_format->id); + } + + static PyMethodDef perf__methods[] = { +@@ -1209,11 +1241,31 @@ static PyMethodDef perf__methods[] = { + { .ml_name = NULL, } + }; + ++#if PY_MAJOR_VERSION < 3 + PyMODINIT_FUNC initperf(void) ++#else ++PyMODINIT_FUNC PyInit_perf(void) ++#endif + { + PyObject *obj; + int i; +- PyObject *dict, *module = Py_InitModule("perf", perf__methods); ++ PyObject *dict; ++#if PY_MAJOR_VERSION < 3 ++ PyObject *module = Py_InitModule("perf", perf__methods); ++#else ++ static struct PyModuleDef moduledef = { ++ PyModuleDef_HEAD_INIT, ++ "perf", /* m_name */ ++ "", /* m_doc */ ++ -1, /* m_size */ ++ perf__methods, /* m_methods */ ++ NULL, /* m_reload */ ++ NULL, /* m_traverse */ ++ NULL, /* m_clear */ ++ NULL, /* m_free */ ++ }; ++ PyObject *module = PyModule_Create(&moduledef); ++#endif + + if (module == NULL || + pyrf_event__setup_types() < 0 || +@@ -1221,7 +1273,11 @@ PyMODINIT_FUNC initperf(void) + pyrf_evsel__setup_types() < 0 || + pyrf_thread_map__setup_types() < 0 || + pyrf_cpu_map__setup_types() < 0) ++#if PY_MAJOR_VERSION < 3 + return; ++#else ++ return module; ++#endif + + /* The page_size is placed in util object. */ + page_size = sysconf(_SC_PAGE_SIZE); +@@ -1270,7 +1326,7 @@ PyMODINIT_FUNC initperf(void) + goto error; + + for (i = 0; perf__constants[i].name != NULL; i++) { +- obj = PyInt_FromLong(perf__constants[i].value); ++ obj = _PyLong_FromLong(perf__constants[i].value); + if (obj == NULL) + goto error; + PyDict_SetItemString(dict, perf__constants[i].name, obj); +@@ -1280,6 +1336,9 @@ PyMODINIT_FUNC initperf(void) + error: + if (PyErr_Occurred()) + PyErr_SetString(PyExc_ImportError, "perf: Init failed!"); ++#if PY_MAJOR_VERSION >= 3 ++ return module; ++#endif + } + + /* +diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c +index f03fa7a835a1..8db28d4ff4b6 100644 +--- a/tools/perf/util/scripting-engines/trace-event-python.c ++++ b/tools/perf/util/scripting-engines/trace-event-python.c +@@ -50,7 +50,37 @@ + #include "print_binary.h" + #include "stat.h" + ++#if PY_MAJOR_VERSION < 3 ++#define _PyUnicode_FromString(arg) \ ++ PyString_FromString(arg) ++#define _PyUnicode_FromStringAndSize(arg1, arg2) \ ++ PyString_FromStringAndSize((arg1), (arg2)) ++#define _PyBytes_FromStringAndSize(arg1, arg2) \ ++ PyString_FromStringAndSize((arg1), (arg2)) ++#define _PyLong_FromLong(arg) \ ++ PyInt_FromLong(arg) ++#define _PyLong_AsLong(arg) \ ++ PyInt_AsLong(arg) ++#define _PyCapsule_New(arg1, arg2, arg3) \ ++ PyCObject_FromVoidPtr((arg1), (arg2)) ++ + PyMODINIT_FUNC initperf_trace_context(void); ++#else ++#define _PyUnicode_FromString(arg) \ ++ PyUnicode_FromString(arg) ++#define _PyUnicode_FromStringAndSize(arg1, arg2) \ ++ PyUnicode_FromStringAndSize((arg1), (arg2)) ++#define _PyBytes_FromStringAndSize(arg1, arg2) \ ++ PyBytes_FromStringAndSize((arg1), (arg2)) ++#define _PyLong_FromLong(arg) \ ++ PyLong_FromLong(arg) ++#define _PyLong_AsLong(arg) \ ++ PyLong_AsLong(arg) ++#define _PyCapsule_New(arg1, arg2, arg3) \ ++ PyCapsule_New((arg1), (arg2), (arg3)) ++ ++PyMODINIT_FUNC PyInit_perf_trace_context(void); ++#endif + + #define TRACE_EVENT_TYPE_MAX \ + ((1 << (sizeof(unsigned short) * 8)) - 1) +@@ -136,7 +166,7 @@ static int get_argument_count(PyObject *handler) + PyObject *arg_count_obj = PyObject_GetAttrString(code_obj, + "co_argcount"); + if (arg_count_obj) { +- arg_count = (int) PyInt_AsLong(arg_count_obj); ++ arg_count = (int) _PyLong_AsLong(arg_count_obj); + Py_DECREF(arg_count_obj); + } + Py_DECREF(code_obj); +@@ -183,10 +213,10 @@ static void define_value(enum print_arg_type field_type, + + value = eval_flag(field_value); + +- PyTuple_SetItem(t, n++, PyString_FromString(ev_name)); +- PyTuple_SetItem(t, n++, PyString_FromString(field_name)); +- PyTuple_SetItem(t, n++, PyInt_FromLong(value)); +- PyTuple_SetItem(t, n++, PyString_FromString(field_str)); ++ PyTuple_SetItem(t, n++, _PyUnicode_FromString(ev_name)); ++ PyTuple_SetItem(t, n++, _PyUnicode_FromString(field_name)); ++ PyTuple_SetItem(t, n++, _PyLong_FromLong(value)); ++ PyTuple_SetItem(t, n++, _PyUnicode_FromString(field_str)); + + try_call_object(handler_name, t); + +@@ -224,10 +254,10 @@ static void define_field(enum print_arg_type field_type, + if (!t) + Py_FatalError("couldn't create Python tuple"); + +- PyTuple_SetItem(t, n++, PyString_FromString(ev_name)); +- PyTuple_SetItem(t, n++, PyString_FromString(field_name)); ++ PyTuple_SetItem(t, n++, _PyUnicode_FromString(ev_name)); ++ PyTuple_SetItem(t, n++, _PyUnicode_FromString(field_name)); + if (field_type == PRINT_FLAGS) +- PyTuple_SetItem(t, n++, PyString_FromString(delim)); ++ PyTuple_SetItem(t, n++, _PyUnicode_FromString(delim)); + + try_call_object(handler_name, t); + +@@ -326,12 +356,12 @@ static PyObject *get_field_numeric_entry(struct event_format *event, + if (field->flags & FIELD_IS_SIGNED) { + if ((long long)val >= LONG_MIN && + (long long)val <= LONG_MAX) +- obj = PyInt_FromLong(val); ++ obj = _PyLong_FromLong(val); + else + obj = PyLong_FromLongLong(val); + } else { + if (val <= LONG_MAX) +- obj = PyInt_FromLong(val); ++ obj = _PyLong_FromLong(val); + else + obj = PyLong_FromUnsignedLongLong(val); + } +@@ -390,9 +420,9 @@ static PyObject *python_process_callchain(struct perf_sample *sample, + pydict_set_item_string_decref(pysym, "end", + PyLong_FromUnsignedLongLong(node->sym->end)); + pydict_set_item_string_decref(pysym, "binding", +- PyInt_FromLong(node->sym->binding)); ++ _PyLong_FromLong(node->sym->binding)); + pydict_set_item_string_decref(pysym, "name", +- PyString_FromStringAndSize(node->sym->name, ++ _PyUnicode_FromStringAndSize(node->sym->name, + node->sym->namelen)); + pydict_set_item_string_decref(pyelem, "sym", pysym); + } +@@ -407,7 +437,7 @@ static PyObject *python_process_callchain(struct perf_sample *sample, + dsoname = map->dso->name; + } + pydict_set_item_string_decref(pyelem, "dso", +- PyString_FromString(dsoname)); ++ _PyUnicode_FromString(dsoname)); + } + + callchain_cursor_advance(&callchain_cursor); +@@ -484,16 +514,16 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample, + if (!dict_sample) + Py_FatalError("couldn't create Python dictionary"); + +- pydict_set_item_string_decref(dict, "ev_name", PyString_FromString(perf_evsel__name(evsel))); +- pydict_set_item_string_decref(dict, "attr", PyString_FromStringAndSize( ++ pydict_set_item_string_decref(dict, "ev_name", _PyUnicode_FromString(perf_evsel__name(evsel))); ++ pydict_set_item_string_decref(dict, "attr", _PyUnicode_FromStringAndSize( + (const char *)&evsel->attr, sizeof(evsel->attr))); + + pydict_set_item_string_decref(dict_sample, "pid", +- PyInt_FromLong(sample->pid)); ++ _PyLong_FromLong(sample->pid)); + pydict_set_item_string_decref(dict_sample, "tid", +- PyInt_FromLong(sample->tid)); ++ _PyLong_FromLong(sample->tid)); + pydict_set_item_string_decref(dict_sample, "cpu", +- PyInt_FromLong(sample->cpu)); ++ _PyLong_FromLong(sample->cpu)); + pydict_set_item_string_decref(dict_sample, "ip", + PyLong_FromUnsignedLongLong(sample->ip)); + pydict_set_item_string_decref(dict_sample, "time", +@@ -503,17 +533,17 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample, + set_sample_read_in_dict(dict_sample, sample, evsel); + pydict_set_item_string_decref(dict, "sample", dict_sample); + +- pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize( ++ pydict_set_item_string_decref(dict, "raw_buf", _PyBytes_FromStringAndSize( + (const char *)sample->raw_data, sample->raw_size)); + pydict_set_item_string_decref(dict, "comm", +- PyString_FromString(thread__comm_str(al->thread))); ++ _PyUnicode_FromString(thread__comm_str(al->thread))); + if (al->map) { + pydict_set_item_string_decref(dict, "dso", +- PyString_FromString(al->map->dso->name)); ++ _PyUnicode_FromString(al->map->dso->name)); + } + if (al->sym) { + pydict_set_item_string_decref(dict, "symbol", +- PyString_FromString(al->sym->name)); ++ _PyUnicode_FromString(al->sym->name)); + } + + pydict_set_item_string_decref(dict, "callchain", callchain); +@@ -573,9 +603,9 @@ static void python_process_tracepoint(struct perf_sample *sample, + scripting_context->event_data = data; + scripting_context->pevent = evsel->tp_format->pevent; + +- context = PyCObject_FromVoidPtr(scripting_context, NULL); ++ context = _PyCapsule_New(scripting_context, NULL, NULL); + +- PyTuple_SetItem(t, n++, PyString_FromString(handler_name)); ++ PyTuple_SetItem(t, n++, _PyUnicode_FromString(handler_name)); + PyTuple_SetItem(t, n++, context); + + /* ip unwinding */ +@@ -584,18 +614,18 @@ static void python_process_tracepoint(struct perf_sample *sample, + Py_INCREF(callchain); + + if (!dict) { +- PyTuple_SetItem(t, n++, PyInt_FromLong(cpu)); +- PyTuple_SetItem(t, n++, PyInt_FromLong(s)); +- PyTuple_SetItem(t, n++, PyInt_FromLong(ns)); +- PyTuple_SetItem(t, n++, PyInt_FromLong(pid)); +- PyTuple_SetItem(t, n++, PyString_FromString(comm)); ++ PyTuple_SetItem(t, n++, _PyLong_FromLong(cpu)); ++ PyTuple_SetItem(t, n++, _PyLong_FromLong(s)); ++ PyTuple_SetItem(t, n++, _PyLong_FromLong(ns)); ++ PyTuple_SetItem(t, n++, _PyLong_FromLong(pid)); ++ PyTuple_SetItem(t, n++, _PyUnicode_FromString(comm)); + PyTuple_SetItem(t, n++, callchain); + } else { +- pydict_set_item_string_decref(dict, "common_cpu", PyInt_FromLong(cpu)); +- pydict_set_item_string_decref(dict, "common_s", PyInt_FromLong(s)); +- pydict_set_item_string_decref(dict, "common_ns", PyInt_FromLong(ns)); +- pydict_set_item_string_decref(dict, "common_pid", PyInt_FromLong(pid)); +- pydict_set_item_string_decref(dict, "common_comm", PyString_FromString(comm)); ++ pydict_set_item_string_decref(dict, "common_cpu", _PyLong_FromLong(cpu)); ++ pydict_set_item_string_decref(dict, "common_s", _PyLong_FromLong(s)); ++ pydict_set_item_string_decref(dict, "common_ns", _PyLong_FromLong(ns)); ++ pydict_set_item_string_decref(dict, "common_pid", _PyLong_FromLong(pid)); ++ pydict_set_item_string_decref(dict, "common_comm", _PyUnicode_FromString(comm)); + pydict_set_item_string_decref(dict, "common_callchain", callchain); + } + for (field = event->format.fields; field; field = field->next) { +@@ -614,7 +644,7 @@ static void python_process_tracepoint(struct perf_sample *sample, + } + if (field->flags & FIELD_IS_STRING && + is_printable_array(data + offset, len)) { +- obj = PyString_FromString((char *) data + offset); ++ obj = _PyUnicode_FromString((char *) data + offset); + } else { + obj = PyByteArray_FromStringAndSize((const char *) data + offset, len); + field->flags &= ~FIELD_IS_STRING; +@@ -664,7 +694,7 @@ static PyObject *tuple_new(unsigned int sz) + static int tuple_set_u64(PyObject *t, unsigned int pos, u64 val) + { + #if BITS_PER_LONG == 64 +- return PyTuple_SetItem(t, pos, PyInt_FromLong(val)); ++ return PyTuple_SetItem(t, pos, _PyLong_FromLong(val)); + #endif + #if BITS_PER_LONG == 32 + return PyTuple_SetItem(t, pos, PyLong_FromLongLong(val)); +@@ -673,12 +703,12 @@ static int tuple_set_u64(PyObject *t, unsigned int pos, u64 val) + + static int tuple_set_s32(PyObject *t, unsigned int pos, s32 val) + { +- return PyTuple_SetItem(t, pos, PyInt_FromLong(val)); ++ return PyTuple_SetItem(t, pos, _PyLong_FromLong(val)); + } + + static int tuple_set_string(PyObject *t, unsigned int pos, const char *s) + { +- return PyTuple_SetItem(t, pos, PyString_FromString(s)); ++ return PyTuple_SetItem(t, pos, _PyUnicode_FromString(s)); + } + + static int python_export_evsel(struct db_export *dbe, struct perf_evsel *evsel) +@@ -1024,8 +1054,8 @@ process_stat(struct perf_evsel *counter, int cpu, int thread, u64 tstamp, + return; + } + +- PyTuple_SetItem(t, n++, PyInt_FromLong(cpu)); +- PyTuple_SetItem(t, n++, PyInt_FromLong(thread)); ++ PyTuple_SetItem(t, n++, _PyLong_FromLong(cpu)); ++ PyTuple_SetItem(t, n++, _PyLong_FromLong(thread)); + + tuple_set_u64(t, n++, tstamp); + tuple_set_u64(t, n++, count->val); +@@ -1207,27 +1237,58 @@ static void set_table_handlers(struct tables *tables) + SET_TABLE_HANDLER(call_return); + } + ++#if PY_MAJOR_VERSION < 3 ++static void _free_command_line(const char **command_line, int num) ++{ ++ free(command_line); ++} ++#else ++static void _free_command_line(wchar_t **command_line, int num) ++{ ++ int i; ++ for (i = 0; i < num; i++) ++ PyMem_RawFree(command_line[i]); ++ free(command_line); ++} ++#endif ++ ++ + /* + * Start trace script + */ + static int python_start_script(const char *script, int argc, const char **argv) + { + struct tables *tables = &tables_global; ++#if PY_MAJOR_VERSION < 3 + const char **command_line; ++#else ++ wchar_t **command_line; ++#endif + char buf[PATH_MAX]; + int i, err = 0; + FILE *fp; + ++#if PY_MAJOR_VERSION < 3 + command_line = malloc((argc + 1) * sizeof(const char *)); + command_line[0] = script; + for (i = 1; i < argc + 1; i++) + command_line[i] = argv[i - 1]; ++#else ++ command_line = malloc((argc + 1) * sizeof(wchar_t *)); ++ command_line[0] = Py_DecodeLocale(script, NULL); ++ for (i = 1; i < argc + 1; i++) ++ command_line[i] = Py_DecodeLocale(argv[i - 1], NULL); ++#endif + + Py_Initialize(); + ++#if PY_MAJOR_VERSION < 3 + initperf_trace_context(); +- + PySys_SetArgv(argc + 1, (char **)command_line); ++#else ++ PyInit_perf_trace_context(); ++ PySys_SetArgv(argc + 1, command_line); ++#endif + + fp = fopen(script, "r"); + if (!fp) { +@@ -1257,12 +1318,12 @@ static int python_start_script(const char *script, int argc, const char **argv) + goto error; + } + +- free(command_line); ++ _free_command_line(command_line, argc + 1); + + return err; + error: + Py_Finalize(); +- free(command_line); ++ _free_command_line(command_line, argc + 1); + + return err; + } +diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py +index 23f1bf175179..a5f9e236cc71 100644 +--- a/tools/perf/util/setup.py ++++ b/tools/perf/util/setup.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python2 ++#!/usr/bin/python + + from os import getenv + +@@ -37,11 +37,11 @@ build_tmp = getenv('PYTHON_EXTBUILD_TMP') + libtraceevent = getenv('LIBTRACEEVENT') + libapikfs = getenv('LIBAPI') + +-ext_sources = [f.strip() for f in file('util/python-ext-sources') ++ext_sources = [f.strip() for f in open('util/python-ext-sources') + if len(f.strip()) > 0 and f[0] != '#'] + + # use full paths with source files +-ext_sources = map(lambda x: '%s/%s' % (src_perf, x) , ext_sources) ++ext_sources = list(map(lambda x: '%s/%s' % (src_perf, x) , ext_sources)) + + perf = Extension('perf', + sources = ext_sources, +-- +2.17.1 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-rpmsg-Add-message-to-be-able-to-configure-RPMSG_VIRT.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-rpmsg-Add-message-to-be-able-to-configure-RPMSG_VIRT.patch new file mode 100644 index 00000000..8c0a2af7 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0001-rpmsg-Add-message-to-be-able-to-configure-RPMSG_VIRT.patch @@ -0,0 +1,27 @@ +From 1cdbf4ed4717eefa2b6237c1e63e351b62990522 Mon Sep 17 00:00:00 2001 +From: Dien Pham <dien.pham.ry@renesas.com> +Date: Fri, 23 Feb 2018 18:29:32 +0700 +Subject: [PATCH] rpmsg: Add message to be able to configure RPMSG_VIRTIO from + defconfig + +Signed-off-by: Dien Pham <dien.pham.ry@renesas.com> +--- + drivers/rpmsg/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/rpmsg/Kconfig b/drivers/rpmsg/Kconfig +index 0fe6eac..5b1e61b 100644 +--- a/drivers/rpmsg/Kconfig ++++ b/drivers/rpmsg/Kconfig +@@ -47,7 +47,7 @@ config RPMSG_QCOM_SMD + platforms. + + config RPMSG_VIRTIO +- tristate ++ tristate "Enable remote processor message and virtual I/O configure" + select RPMSG + select VIRTIO + +-- +1.9.1 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0002-ADSP-add-ADSP-sound-driver-source.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0002-ADSP-add-ADSP-sound-driver-source.patch new file mode 100644 index 00000000..14719fba --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0002-ADSP-add-ADSP-sound-driver-source.patch @@ -0,0 +1,7204 @@ +From 829c17a722611c39cda6926f0fac46fa586c70ef Mon Sep 17 00:00:00 2001 +From: tienphitran <tien.tran.uw@renesas.com> +Date: Mon, 17 Jun 2019 17:04:02 +0700 +Subject: [PATCH 2/6] ADSP: add ADSP sound driver source + +Signed-off-by: tienphitran <tien.tran.uw@renesas.com> + +diff --git a/include/adsp_drv/xf-adsp-drv-ext.h b/include/adsp_drv/xf-adsp-drv-ext.h +new file mode 100644 +index 0000000..6c3dbc0 +--- /dev/null ++++ b/include/adsp_drv/xf-adsp-drv-ext.h +@@ -0,0 +1,58 @@ ++/***************************************************************************** ++ * \file xf-adsp-driver-ext.h ++ * \brief Header file for ADSP driver extension part ++ * \addtogroup ADSP Driver ++ ****************************************************************************** ++ * \date Oct. 21, 2017 ++ * \author Renesas Electronics Corporation ++ ****************************************************************************** ++ * \par Copyright ++ * ++ * Copyright(c) 2016 Renesas Electoronics Corporation ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a copy ++ * of this software and associated documentation files (the "Software"), to deal ++ * in the Software without restriction, including without limitation the rights ++ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++ * copies of the Software, and to permit persons to whom the Software is ++ * furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included in ++ * all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ++ * THE SOFTWARE. ++ ******************************************************************************/ ++ ++#ifndef __XF_ADSP_DRV_EXT_H ++#define __XF_ADSP_DRV_EXT_H ++ ++/*********************************************************** ++ * Extension client APIs ++ * ********************************************************/ ++ ++struct xf_adsp_base_cmd { ++ /* register new client for ADSP base control */ ++ int (*client_register)(void **private_data); ++ /* unregister client */ ++ int (*client_unregister)(void *private_data); ++ /* get data from proxy */ ++ int (*recv)(void *private_data, void *buf); ++ /* send data to proxy */ ++ int (*send)(void *private_data, void *buf); ++ /* wait the valid message in the response queue */ ++ int (*poll)(void *private_data, int *condition); ++}; ++ ++/* create ADSP base control data */ ++int xf_adsp_base_create(struct xf_adsp_base_cmd *cmd); ++ ++/* destroy ADSP base control data */ ++int xf_adsp_base_destroy(void); ++ ++#endif +diff --git a/sound/soc/adsp/Kconfig b/sound/soc/adsp/Kconfig +new file mode 100644 +index 0000000..605261f +--- /dev/null ++++ b/sound/soc/adsp/Kconfig +@@ -0,0 +1,14 @@ ++## SoC for ADSP driver configuration ++menu "ASoC ADSP driver" ++ ++config SND_SOC_ADSP ++ tristate "SoC Audio for R-Car ADSP" ++ select SND_SIMPLE_CARD ++ select SND_SIMPLE_SCU_CARD ++ select SND_AUDIO_GRAPH_CARD ++ select SND_AUDIO_GRAPH_SCU_CARD ++ default y ++ help ++ This option enables ALSA ADSP sound supports ADSP module ++ ++endmenu +diff --git a/sound/soc/adsp/Makefile b/sound/soc/adsp/Makefile +new file mode 100644 +index 0000000..8277fdb +--- /dev/null ++++ b/sound/soc/adsp/Makefile +@@ -0,0 +1,3 @@ ++## Makefile for SoC ADSP driver ++snd-soc-adsp-objs := xf-adsp-alsa.o xf-adsp-base.o ++obj-$(CONFIG_SND_SOC_ADSP) += snd-soc-adsp.o +diff --git a/sound/soc/adsp/xf-adsp-alsa.c b/sound/soc/adsp/xf-adsp-alsa.c +new file mode 100644 +index 0000000..493ff84 +--- /dev/null ++++ b/sound/soc/adsp/xf-adsp-alsa.c +@@ -0,0 +1,3939 @@ ++/** *************************************************************************** ++ * \file xf-adsp-alsa.c ++ * \brief Source file for ADSP ALSA Driver ++ * \addtogroup ADSP Driver ++ ****************************************************************************** ++ * \date Oct. 21, 2017 ++ * \author Renesas Electronics Corporation ++ ****************************************************************************** ++ * \par Copyright ++ * ++ * Copyright(c) 2016 Renesas Electoronics Corporation ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the "Software"), ++ * to deal in the Software without restriction, including without limitation ++ * the rights to use, copy, modify, merge, publish, distribute, sublicense, ++ * and/or sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included in ++ * all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ++ * DEALINGS IN THE SOFTWARE. ++ *****************************************************************************/ ++ ++#include <linux/slab.h> ++#include <linux/platform_device.h> ++#include <linux/module.h> ++#include <linux/io.h> ++#include <linux/sched/signal.h> ++#include <linux/delay.h> ++#include <sound/core.h> ++#include <sound/control.h> ++#include <sound/pcm.h> ++#include <sound/pcm_params.h> ++#include <sound/soc.h> ++#include <sound/pcm-indirect.h> ++#include <linux/time.h> ++ ++#include "xf-adsp-base.h" ++ ++/* Name of Volume control for playback */ ++#define PLAYBACK_VOLUME_CTR_NAME "PlaybackVolume" ++ ++/* Name of Volume control for capture */ ++#define CAPTURE_VOLUME_CTR_NAME "CaptureVolume" ++ ++/* Name of Sample Rate control for playback */ ++#define PLAYBACK_OUT_RATE_CTR_NAME "PlaybackOutRate" ++ ++/* Name of Output Channel control for playback */ ++#define PLAYBACK_OUT_CHANNEL_CTR_NAME "PlaybackOutChannel" ++ ++/* Name of Sample Rate control for capture */ ++#define CAPTURE_IN_RATE_CTR_NAME "CaptureInRate" ++ ++/* Name of Equalizer parameters control for playback */ ++#define PLAYBACK_EQZ_CTR_NAME "PlaybackEQZControl" ++ ++/* Name of Equalizer parameters control for capture */ ++#define CAPTURE_EQZ_CTR_NAME "CaptureEQZControl" ++ ++/* Name of Equalizer Switch control for playback */ ++#define PLAYBACK_EQZ_SWITCH_CTR_NAME "PlaybackEQZSwitch" ++ ++/* Name of Equalizer Switch control for capture */ ++#define CAPTURE_EQZ_SWITCH_CTR_NAME "CaptureEQZSwitch" ++ ++/* Name of Volume control for TDM playback */ ++#define TDM_PLAYBACK_VOLUME_CTR_NAME "TDMPlaybackVolume" ++ ++/* Name of Volume control for TDM capture */ ++#define TDM_CAPTURE_VOLUME_CTR_NAME "TDMCaptureVolume" ++ ++/* Name of Sample Rate control for TDM playback */ ++#define TDM_PLAYBACK_OUT_RATE_CTR_NAME "TDMPlaybackOutRate" ++ ++/* Name of Sample Rate control for TDM capture */ ++#define TDM_CAPTURE_IN_RATE_CTR_NAME "TDMCaptureInRate" ++ ++/* Prefix of Playback control name */ ++#define PREFIX_OF_PLAYBACK_CTR_NAME PLAYBACK_VOLUME_CTR_NAME[0] ++ ++/* Prefix of Capture control name */ ++#define PREFIX_OF_CAPTURE_CTR_NAME CAPTURE_VOLUME_CTR_NAME[0] ++ ++/* Prefix of TDM control name */ ++#define PREFIX_OF_TDM_CTR_NAME TDM_PLAYBACK_VOLUME_CTR_NAME[0] ++ ++/* Prefix of TDM playback */ ++#define TDM_PLAYBACK TDM_PLAYBACK_VOLUME_CTR_NAME[3] ++ ++/* Prefix of TDM record */ ++#define TDM_CAPTURE TDM_CAPTURE_VOLUME_CTR_NAME[3] ++ ++/* Number of control for playback & capture */ ++#define RDR_CONTROL_NUM (9) ++ ++/* Number of controls for TDM */ ++#define TDM_CONTROL_NUM (4) ++ ++/* Indicate playback stream */ ++#define DIRECT_PLAYBACK (0) ++ ++/* Indicate capture stream */ ++#define DIRECT_CAPTURE (1) ++ ++/* Indicate stream number */ ++#define DIRECT_NUM (2) ++ ++/* Supported frame size for playback/record function in driver */ ++#define FRAME_SIZE (1024) ++ ++/* Supported frame size for TDM playback/record function in driver */ ++#define TDM_FRAME_SIZE (1024) ++ ++/* Supported sample rate in driver */ ++#define SND_ADSP_SAMPLE_RATES (SNDRV_PCM_RATE_32000 | \ ++ SNDRV_PCM_RATE_44100 | \ ++ SNDRV_PCM_RATE_48000) ++ ++/* Supported PCM width in driver */ ++#define SND_ADSP_PCM_WIDTHS (SNDRV_PCM_FMTBIT_S16_LE | \ ++ SNDRV_PCM_FMTBIT_S24_LE) ++ ++/* Macro to control DAI index */ ++/* DAI 0 index for playback/record functions of stereo/mono formats */ ++#define RDR_DAI_IDX0 (0) ++ ++/* DAI 1 index for playback/record functions of stereo/mono formats */ ++#define RDR_DAI_IDX1 (1) ++ ++/* DAI 2 index for playback/record functions of stereo/mono formats */ ++#define RDR_DAI_IDX2 (2) ++ ++/* DAI 3 index for playback/record functions of stereo/mono formats */ ++#define RDR_DAI_IDX3 (3) ++ ++/* DAI 4 index for playback/record functions of TDM formats */ ++#define TDM_DAI_IDX (4) ++ ++/* Maximum number of DAI supported by driver */ ++#define MAX_DAI_IDX (5) ++ ++/* Renderer/Capture software information */ ++/* Minimum channel number supported */ ++#define MIN_CHANNEL (1) ++ ++/* Maximum channel number supported */ ++#define MAX_CHANNEL (2) ++ ++/* Minimum buffer size in byte */ ++#define MIN_BUF_SIZE (FRAME_SIZE * MIN_CHANNEL * 2) ++ ++/* Maximum buffer size in byte */ ++#define MAX_BUF_SIZE (FRAME_SIZE * MAX_CHANNEL * 4) ++ ++/* Minimum numbers of period in the buffer */ ++#define MIN_PERIOD (1) ++ ++/* Maximum numbers of period in the buffer */ ++#define MAX_PERIOD (4) ++ ++/* Maximun numbers of bytes in ALSA buffer */ ++#define MAX_BUFFER_BYTES (MAX_PERIOD * MAX_BUF_SIZE) ++ ++/* TDM software information */ ++/*< Minimum channel number supported in TDM plugin */ ++#define TDM_MIN_CHANNEL (6) ++ ++/* Maximum channel number supported in TDM plugin */ ++#define TDM_MAX_CHANNEL (8) ++ ++/* Minimum buffer size in byte for TDM format */ ++#define TDM_MIN_BUF_SIZE (TDM_FRAME_SIZE * TDM_MIN_CHANNEL * 2) ++ ++/* Maximum buffer size in byte for TDM format */ ++#define TDM_MAX_BUF_SIZE (TDM_FRAME_SIZE * TDM_MAX_CHANNEL * 4) ++ ++/* Minimum numbers of period in the buffer for TDM format */ ++#define TDM_MIN_PERIOD (1) ++ ++/* Maximum numbers of period in the buffer for TDM format */ ++#define TDM_MAX_PERIOD (4) ++ ++/* Maximum numbers of bytes in ALSA buffer for TDM format */ ++#define TDM_MAX_BUFFER_BYTES (TDM_MAX_PERIOD * TDM_MAX_BUF_SIZE) ++ ++/* Volume scale used when user set */ ++#define VOLUME_SCALE (100) ++ ++/* Maximum element in Equalizer parameter control */ ++#define MAX_EQZ_PARAM_NUMBER (55) ++ ++/* Equalizer control is disabled */ ++#define EQZ_OFF (0) ++ ++/* Equalizer control is enabled */ ++#define EQZ_ON (1) ++ ++/* Component status */ ++/* Handle state is NULL */ ++#define XF_HANDLE_NULL (0) ++ ++/* Handle state is CREATED after creating handle successfully */ ++#define XF_HANDLE_CREATED BIT(0) ++ ++/* Handle state is READY after finishing handle init */ ++#define XF_HANDLE_READY BIT(1) ++ ++/* channels */ ++/* Mono stream */ ++#define MONAURAL (1) ++ ++/* Stereo stream */ ++#define STEREO (2) ++ ++/* define number of bytes in a sample of 24 bits format types */ ++/* store 24 bits data in 4 bytes LE */ ++#define FMTBIT_S24_LE_BYTES_PER_SAMPLE (4) ++ ++/* store 24 bits data in 3 bytes LE */ ++#define FMTBIT_S24_3LE_BYTES_PER_SAMPLE (3) ++ ++/* helper macro to get bytes per sample number */ ++#define BYTES_PER_SAMPLE(fmt) (FMTBIT_##fmt##_BYTES_PER_SAMPLE) ++ ++/* check component is created */ ++#define COMPONENT_IS_CREATED(n) (((n & XF_HANDLE_CREATED) != 0) ? TRUE : FALSE) ++ ++/* check component is ready */ ++#define COMPONENT_IS_READY(n) (((n & XF_HANDLE_READY) != 0) ? TRUE : FALSE) ++ ++/* indicator of stream order */ ++#define MIX_UNUSED (0) ++#define FIRST_RUN (2) ++#define SECOND_RUN (1) ++ ++/* check MIX usage */ ++#define MIX_ENABLED(mix_ctl) ((mix_ctl == SECOND_RUN) ? TRUE : FALSE) ++ ++/******************************************************************* ++ * base structures for ADSP ALSA driver ++ * ****************************************************************/ ++ ++/** \struct snd_adsp_control ++ * \brief Structure stores parameters from user ++ */ ++struct snd_adsp_control { ++ /* Volume rate for playback/record */ ++ int vol_rate[DIRECT_NUM][MAX_DAI_IDX - 1]; ++ ++ /* Volume rate for TDM playback/TDM record */ ++ int tdm_vol_rate[DIRECT_NUM]; ++ ++ /* Out sample rate with Renderer, in sample rate with Capture */ ++ int sample_rate[DIRECT_NUM][MAX_DAI_IDX - 1]; ++ ++ /* Out sample rate for TDM Renderer, in sample rate for TDM Capture */ ++ int tdm_sample_rate[DIRECT_NUM]; ++ ++ /* Output channel of playback */ ++ int rdr_out_ch[MAX_DAI_IDX - 1]; ++ ++ /* Equalizer parameters */ ++ struct xf_adsp_equalizer_params eqz_params[DIRECT_NUM][MAX_DAI_IDX - 1]; ++ ++ /* Equalizer switch */ ++ int eqz_switch[DIRECT_NUM][MAX_DAI_IDX - 1]; ++ ++ /* Indicator of MIX usage */ ++ int mix_usage; ++}; ++ ++/** \struct snd_adsp_base_info ++ * \brief Structure stores some base information of a stream ++ */ ++struct snd_adsp_base_info { ++ /* high resolution timer data */ ++ struct hrtimer hrtimer; ++ ++ /* kernel time value in nanosecond */ ++ ktime_t ktime; ++ ++ /* save interrupt state before getting lock */ ++ unsigned long flag; ++ ++ /* high resolution timer state */ ++ int hrt_state; ++ ++ /* target handle id of ALSA driver */ ++ int handle_id; ++ ++ /* data buffer */ ++ char *buffer[XF_BUF_POOL_SIZE]; ++ ++ /* size of each allocated data buffer */ ++ int buf_bytes; ++ ++ /* data index of buffer */ ++ int buf_idx; ++ ++ /* queue index of buffer */ ++ int buf_queue; ++ ++ /* HW index in bytes */ ++ int hw_idx; ++ ++ /* number of bytes in a period */ ++ int period_bytes; ++ ++ /* substream runtime object */ ++ struct snd_pcm_substream *substream; ++ ++ /* indirect PCM data transfer */ ++ struct snd_pcm_indirect pcm_indirect; ++ ++ /* spinlock data */ ++ spinlock_t lock; ++ ++ /* runtime error indicator */ ++ int runtime_err; ++}; ++ ++/** \struct snd_adsp_playback ++ * \brief Structure stores data for playback function ++ */ ++struct snd_adsp_playback { ++ /* base information of stream */ ++ struct snd_adsp_base_info base; ++ ++ /* Renderer component data */ ++ struct xf_adsp_renderer *renderer; ++ ++ /* Equalizer component data */ ++ struct xf_adsp_equalizer *equalizer; ++ ++ /* Renderer component state */ ++ int rdr_state; ++ ++ /* Equalizer component state */ ++ int eqz_state; ++}; ++ ++/** \struct snd_adsp_record ++ * \brief Structure stores data for record function ++ */ ++struct snd_adsp_record { ++ /* base information of stream */ ++ struct snd_adsp_base_info base; ++ ++ /* Capture component data */ ++ struct xf_adsp_capture *capture; ++ ++ /* Equalizer component data */ ++ struct xf_adsp_equalizer *equalizer; ++ ++ /* Capture component state */ ++ int cap_state; ++ ++ /* Equalizer component state */ ++ int eqz_state; ++}; ++ ++/** \struct snd_adsp_tdm_playback ++ * \brief Structure stores data for TDM playback function ++ */ ++struct snd_adsp_tdm_playback { ++ /* base information of stream */ ++ struct snd_adsp_base_info base; ++ ++ /* TDM Renderer component data */ ++ struct xf_adsp_tdm_renderer *tdm_renderer; ++ ++ /* TDM Renderer component state */ ++ int state; ++}; ++ ++/** \struct snd_adsp_tdm_record ++ * \brief Structure stores data for TDM record function ++ */ ++struct snd_adsp_tdm_record { ++ /* base information of stream */ ++ struct snd_adsp_base_info base; ++ ++ /* TDM Capture component data */ ++ struct xf_adsp_tdm_capture *tdm_capture; ++ ++ /* TDM Capture component state */ ++ int state; ++}; ++ ++/** \struct snd_adsp_card ++ * \brief Structure stores data for ALSA sound card ++ */ ++struct snd_adsp_card { ++ /* playback data */ ++ struct snd_adsp_playback *playback[MAX_DAI_IDX - 1]; ++ ++ /* record data */ ++ struct snd_adsp_record *record[MAX_DAI_IDX - 1]; ++ ++ /* TDM playback data */ ++ struct snd_adsp_tdm_playback *tdm_playback; ++ ++ /* TDM record data */ ++ struct snd_adsp_tdm_record *tdm_record; ++ ++ /* Structure contains params information for control */ ++ struct snd_adsp_control ctr_if; ++}; ++ ++/** HW configuration of ALSA ADSP card for Renderer/Capture */ ++static struct snd_pcm_hardware snd_pcm_adsp_hw = { ++ .info = (SNDRV_PCM_INFO_INTERLEAVED /* PRQA S 1053 14 */ ++ | SNDRV_PCM_INFO_RESUME ++ | SNDRV_PCM_INFO_BLOCK_TRANSFER ++ | SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), ++ .formats = SND_ADSP_PCM_WIDTHS, ++ .rates = SND_ADSP_SAMPLE_RATES, ++ .rate_min = 32000, ++ .rate_max = 48000, ++ .channels_min = MIN_CHANNEL, ++ .channels_max = MAX_CHANNEL, ++ ++ /* maximum buffer size in bytes */ ++ .buffer_bytes_max = MAX_BUFFER_BYTES, ++ ++ /* minimum size of the periods (frame) in bytes */ ++ .period_bytes_min = MIN_BUF_SIZE, ++ ++ /* maximum size of the periods (frame) in bytes */ ++ .period_bytes_max = MAX_BUF_SIZE, ++ ++ /* minimum periods (frames) in a buffer */ ++ .periods_min = MIN_PERIOD, ++ ++ /* maximum periods (frames) in a buffer */ ++ .periods_max = MAX_PERIOD, ++}; ++ ++/* HW configuration of ALSA ADSP card for TDM */ ++static struct snd_pcm_hardware snd_pcm_adsp_tdm_hw = { ++ .info = (SNDRV_PCM_INFO_INTERLEAVED /* PRQA S 1053 14 */ ++ | SNDRV_PCM_INFO_RESUME ++ | SNDRV_PCM_INFO_BLOCK_TRANSFER ++ | SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), ++ .formats = SND_ADSP_PCM_WIDTHS, ++ .rates = SND_ADSP_SAMPLE_RATES, ++ .rate_min = 32000, ++ .rate_max = 48000, ++ .channels_min = TDM_MIN_CHANNEL, ++ .channels_max = TDM_MAX_CHANNEL, ++ ++ /* maximum buffer size in bytes */ ++ .buffer_bytes_max = TDM_MAX_BUFFER_BYTES, ++ ++ /* minimum size of the periods (frame) in bytes */ ++ .period_bytes_min = TDM_MIN_BUF_SIZE, ++ ++ /* maximum size of the periods (frame) in bytes */ ++ .period_bytes_max = TDM_MAX_BUF_SIZE, ++ ++ /* minimum periods (frames) in a buffer */ ++ .periods_min = TDM_MIN_PERIOD, ++ ++ /* maximum periods (frames) in a buffer */ ++ .periods_max = TDM_MAX_PERIOD, ++}; ++ ++/******************************************************************* ++ * function declaration ++ * ****************************************************************/ ++ ++static int ++snd_adsp_rdr_empty_buf_done(void *data, int opcode, int length, char *buffer); ++static int ++snd_adsp_rdr_fill_buf_done(void *data, int opcode, int length, char *buffer); ++static int ++snd_adsp_cap_empty_buf_done(void *data, int opcode, int length, char *buffer); ++static int ++snd_adsp_cap_fill_buf_done(void *data, int opcode, int length, char *buffer); ++static int ++snd_adsp_get_dai_id_from_substream(struct snd_pcm_substream *substream); ++static void * ++snd_adsp_get_drvdata_from_substream(struct snd_pcm_substream *substream); ++static struct snd_adsp_base_info * ++snd_adsp_get_base_from_substream(struct snd_pcm_substream *substream); ++static struct snd_adsp_base_info * ++snd_adsp_get_base_from_hrt(struct hrtimer *hrt); ++static enum hrtimer_restart snd_adsp_hrtimer_func(struct hrtimer *hrt); ++static int snd_adsp_playback_init(struct snd_adsp_playback **data, ++ int eqz_flag, ++ struct snd_pcm_substream *substream); ++static int snd_adsp_record_init(struct snd_adsp_record **data, ++ int eqz_flag, ++ struct snd_pcm_substream *substream); ++static int snd_adsp_playback_prepare(struct snd_adsp_playback *playback, ++ struct snd_pcm_substream *substream); ++static int snd_adsp_record_prepare(struct snd_adsp_record *record, ++ struct snd_pcm_substream *substream); ++static int snd_adsp_playback_deinit(struct snd_adsp_playback *playback); ++static int snd_adsp_record_deinit(struct snd_adsp_record *record); ++static int snd_adsp_tdm_playback_init(struct snd_adsp_tdm_playback **data, ++ struct snd_pcm_substream *substream); ++static int snd_adsp_tdm_record_init(struct snd_adsp_tdm_record **data, ++ struct snd_pcm_substream *substream); ++static int ++snd_adsp_tdm_playback_prepare(struct snd_adsp_tdm_playback *tdm_playback, ++ struct snd_pcm_substream *substream); ++static int snd_adsp_tdm_record_prepare(struct snd_adsp_tdm_record *tdm_record, ++ struct snd_pcm_substream *substream); ++static int ++snd_adsp_tdm_playback_deinit(struct snd_adsp_tdm_playback *tdm_playback); ++static int snd_adsp_tdm_record_deinit(struct snd_adsp_tdm_record *tdm_record); ++static int snd_adsp_pcm_open(struct snd_pcm_substream *substream); ++static int snd_adsp_pcm_close(struct snd_pcm_substream *substream); ++static int snd_adsp_pcm_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *hw_params); ++static int snd_adsp_pcm_hw_free(struct snd_pcm_substream *substream); ++static int snd_adsp_pcm_prepare(struct snd_pcm_substream *substream); ++static int snd_adsp_pcm_trigger(struct snd_pcm_substream *substream, int idx); ++static snd_pcm_uframes_t ++snd_adsp_pcm_pointer(struct snd_pcm_substream *substream); ++static int snd_adsp_pcm_ack(struct snd_pcm_substream *substream); ++static void snd_adsp_pcm_transfer(struct snd_pcm_substream *substream, ++ struct snd_pcm_indirect *rec, size_t bytes); ++static int snd_adsp_control_volume_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo); ++static int snd_adsp_control_volume_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int snd_adsp_control_volume_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int snd_adsp_control_eqz_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int snd_adsp_control_eqz_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo); ++static int snd_adsp_control_eqz_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int ++snd_adsp_control_eqz_switch_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int ++snd_adsp_control_eqz_switch_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo); ++static int ++snd_adsp_control_sample_rate_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int ++snd_adsp_control_sample_rate_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo); ++static int ++snd_adsp_control_sample_rate_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static int ++snd_adsp_control_eqz_switch_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol); ++static void snd_adsp_get_eqz_params_from_control( ++ struct xf_adsp_equalizer_params *eqz_params, ++ struct xf_adsp_equalizer_params *eqz_ctr_params, ++ bool flag); ++static int snd_adsp_pcm_new(struct snd_soc_pcm_runtime *runtime); ++static int snd_adsp_probe(struct platform_device *pdev); ++static int snd_adsp_remove(struct platform_device *pdev); ++ ++/******************************************************************* ++ * callback function of ADSP control interface ++ * ****************************************************************/ ++/** ************************************************************************** ++ * \brief event handler callback to notify error from ADSP ++ * ++ * \param[in] data Pointer to ADSP ALSA sound card ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_event_handler(void *data) ++{ ++ struct snd_adsp_base_info *base = (struct snd_adsp_base_info *)data; ++ ++ if (base) ++ base->runtime_err = TRUE; ++ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief empty buf done callback for playback/TDM playback functions ++ * ++ * \param[in] data Pointer to ADSP ALSA sound card ++ * \param[in] opcode Opcode of message ++ * \param[in] length Length of data buffer ++ * \param[in] buffer Pointer to data buffer ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_rdr_empty_buf_done(void *data, int opcode, int length, char *buffer) ++{ ++ struct snd_adsp_base_info *base = (struct snd_adsp_base_info *)data; ++ ++ if (base) { ++ spin_lock_irqsave(&base->lock, base->flag); ++ ++ base->buf_queue++; ++ base->hw_idx += length; /* increase the DMA buffer index */ ++ ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ } ++ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief fill buf done callback for playback/TDM playback functions ++ * ++ * \param[in] data Pointer to ADSP ALSA sound card ++ * \param[in] opcode Opcode of message ++ * \param[in] length Length of data buffer ++ * \param[in] buffer Pointer to data buffer ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_rdr_fill_buf_done(void *data, int opcode, int length, char *buffer) ++{ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief empty buf done callback for record/TDM record functions ++ * ++ * \param[in] data Pointer to ADSP ALSA sound card ++ * \param[in] opcode Opcode of message ++ * \param[in] length Length of data buffer ++ * \param[in] buffer Pointer to data buffer ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_cap_empty_buf_done(void *data, int opcode, int length, char *buffer) ++{ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief fill buf done callback for record/TDM record functions ++ * ++ * \param[in] data Pointer to ADSP ALSA sound card ++ * \param[in] opcode Opcode of message ++ * \param[in] length Length of data buffer ++ * \param[in] buffer Pointer to data buffer ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_cap_fill_buf_done(void *data, int opcode, int length, char *buffer) ++{ ++ struct snd_adsp_base_info *base = (struct snd_adsp_base_info *)data; ++ ++ if (base) { ++ spin_lock_irqsave(&base->lock, base->flag); ++ ++ base->buf_queue++; ++ base->hw_idx += length; /* increase the DMA buffer index */ ++ ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ } ++ ++ return 0; ++} ++ ++/** callback functions for playback/TDM playback */ ++static struct xf_callback_func rdr_callbacks = /* PRQA S 3218 */ ++{ ++ .empty_buf_done = &snd_adsp_rdr_empty_buf_done, /* PRQA S 1053 2 */ ++ .fill_buf_done = &snd_adsp_rdr_fill_buf_done, ++ .event_handler = &snd_adsp_event_handler ++}; ++ ++/** callback functions for record/TDM record */ ++static struct xf_callback_func cap_callbacks = /* PRQA S 3218 */ ++{ ++ .empty_buf_done = &snd_adsp_cap_empty_buf_done, /* PRQA S 1053 2 */ ++ .fill_buf_done = &snd_adsp_cap_fill_buf_done, ++ .event_handler = &snd_adsp_event_handler ++}; ++ ++/******************************************************************* ++ * helper functions to get some internal data ++ * ****************************************************************/ ++ ++/** ************************************************************************** ++ * \brief Get current index of CPU DAI from runtime data of substream ++ * ++ * \param[in] substream Pointer to PCM stream data ++ * \retval id Index of current CPU DAI ++ *****************************************************************************/ ++static int ++snd_adsp_get_dai_id_from_substream(struct snd_pcm_substream *substream) ++{ ++ struct snd_soc_pcm_runtime *rtd; ++ ++ rtd = (struct snd_soc_pcm_runtime *)substream->private_data; ++ return rtd->cpu_dai->id; ++} ++ ++/** ************************************************************************** ++ * \brief Get ADSP ALSA driver's data from runtime data of substream ++ * ++ * \param[in] substream Pointer to PCM stream data ++ * \retval pointer Pointer to driver's data ++ *****************************************************************************/ ++static void * ++snd_adsp_get_drvdata_from_substream(struct snd_pcm_substream *substream) ++{ ++ struct snd_soc_pcm_runtime *rtd; ++ ++ rtd = (struct snd_soc_pcm_runtime *)substream->private_data; ++ return snd_soc_dai_get_drvdata(rtd->cpu_dai); ++} ++ ++/** ************************************************************************** ++ * \brief Get base's data of playback/record from runtime data of substream ++ * ++ * \param[in] substream Pointer to PCM stream data ++ * \retval pointer Pointer to playback/record's base data ++ *****************************************************************************/ ++static struct snd_adsp_base_info * ++snd_adsp_get_base_from_substream(struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_card *adsp_card; ++ struct snd_adsp_base_info *base; ++ int dai_idx; ++ ++ adsp_card = snd_adsp_get_drvdata_from_substream(substream); ++ ++ /* get DAI index of substream */ ++ dai_idx = snd_adsp_get_dai_id_from_substream(substream); ++ ++ /* get base data of the substream */ ++ if (dai_idx == RDR_DAI_IDX0 || dai_idx == RDR_DAI_IDX1 || ++ dai_idx == RDR_DAI_IDX2 || dai_idx == RDR_DAI_IDX3) { ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ base = !adsp_card->playback[dai_idx] ? ++ NULL : &adsp_card->playback[dai_idx]->base; ++ } else { ++ base = !adsp_card->record[dai_idx] ? ++ NULL : &adsp_card->record[dai_idx]->base; ++ } ++ } else { ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ base = !adsp_card->tdm_playback ? ++ NULL : &adsp_card->tdm_playback->base; ++ } else { ++ base = !adsp_card->tdm_record ? ++ NULL : &adsp_card->tdm_record->base; ++ } ++ } ++ ++ return base; ++} ++ ++/** *************************************************************************** ++ * \brief Get playback/record/TDM playback/TDM record's base data ++ * from hr timer data ++ * ++ * \param[in] hrt Pointer to hr timer data ++ * \retval pointer Pointer to playback/record's base data ++ *****************************************************************************/ ++static struct snd_adsp_base_info * ++snd_adsp_get_base_from_hrt(struct hrtimer *hrt) ++{ ++ return (struct snd_adsp_base_info *)hrt; ++} ++ ++/***************************************************************************** ++ * hrtimer interrupt function ++ * ***************************************************************************/ ++ ++/** ************************************************************************** ++ * \brief Interrupt function of high resolution timer ++ * ++ * \param[in] hrt Pointer to hr timer data ++ * \retval HRTIMER_RESTART Restart the timer after expire time ++ *****************************************************************************/ ++static enum hrtimer_restart snd_adsp_hrtimer_func(struct hrtimer *hrt) ++{ ++ struct snd_adsp_base_info *base = snd_adsp_get_base_from_hrt(hrt); ++ ++ spin_lock_irqsave(&base->lock, base->flag); ++ if (base->hw_idx != 0) { ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ /* update PCM status for the next period */ ++ snd_pcm_period_elapsed(base->substream); ++ } else { ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ } ++ ++ hrtimer_forward_now(hrt, base->ktime); ++ ++ return HRTIMER_RESTART; ++} ++ ++/***************************************************************************** ++ * internal functions to manage playback and record functions ++ * ***************************************************************************/ ++ ++/** ************************************************************************** ++ * \brief Initialize playback data ++ * ++ * \param[out] playback_data Pointer to store playback data ++ * \param[in] eqz_flag Flag to indicate equalizer usage ++ * \param[in] substream Pointer to substream data ++ * \retval EINVAL Failed to initialize playback data ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_playback_init(struct snd_adsp_playback **playback_data, ++ int eqz_flag, ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_playback *playback; ++ ++ /* allocate memory for playback data */ ++ playback = kmalloc(sizeof(*playback), GFP_KERNEL); ++ if (!playback) ++ return -EINVAL; ++ ++ /* init params */ ++ memset(playback, 0, sizeof(struct snd_adsp_playback)); ++ ++ /* save the playback data */ ++ *playback_data = playback; ++ ++ /* set handle state as NULL state */ ++ playback->rdr_state = XF_HANDLE_NULL; ++ playback->eqz_state = XF_HANDLE_NULL; ++ playback->base.hrt_state = XF_HANDLE_NULL; ++ ++ /* register renderer component */ ++ if (xf_adsp_renderer_create(&playback->renderer, ++ &rdr_callbacks, ++ (void *)&playback->base) < 0) ++ return -EINVAL; ++ ++ /* mark renderer component created */ ++ playback->rdr_state = XF_HANDLE_CREATED; ++ ++ /* set target handle ID as renderer ID */ ++ playback->base.handle_id = playback->renderer->handle_id; ++ ++ if (eqz_flag == EQZ_ON) { ++ /* create equalizer component when equalizer is used */ ++ if (xf_adsp_equalizer_create(&playback->equalizer, ++ &rdr_callbacks, ++ (void *)&playback->base) < 0) ++ return -EINVAL; ++ ++ /* mark equalizer component created */ ++ playback->eqz_state = XF_HANDLE_CREATED; ++ ++ /* set target handle ID as equalizer ID */ ++ playback->base.handle_id = playback->equalizer->handle_id; ++ } ++ ++ /* init lock */ ++ spin_lock_init(&playback->base.lock); ++ ++ /* save the substream data */ ++ playback->base.substream = substream; ++ ++ /* init high resolution timer for updating hw status */ ++ hrtimer_init(&playback->base.hrtimer, ++ CLOCK_MONOTONIC, ++ HRTIMER_MODE_REL); ++ ++ /* PRQA S 0563 1 */ ++ playback->base.hrtimer.function = &snd_adsp_hrtimer_func; ++ playback->base.hrt_state = XF_HANDLE_CREATED; ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Initialize record data ++ * ++ * \param[out] record_data Pointer to store record data ++ * \param[in] eqz_flag Flag to indicate equalizer usage ++ * \param[in] substream Pointer to substream data ++ * \retval -EINVAL Failed to initialize record data ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_record_init(struct snd_adsp_record **record_data, ++ int eqz_flag, ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_record *record; ++ ++ /* allocate memory for record data */ ++ record = kmalloc(sizeof(*record), GFP_KERNEL); ++ if (!record) ++ return -EINVAL; ++ ++ /* init params */ ++ memset(record, 0, sizeof(struct snd_adsp_record)); ++ ++ /* save the record data */ ++ *record_data = record; ++ ++ /* set handle state as NULL state */ ++ record->cap_state = XF_HANDLE_NULL; ++ record->eqz_state = XF_HANDLE_NULL; ++ record->base.hrt_state = XF_HANDLE_NULL; ++ ++ /* register capture component */ ++ if (xf_adsp_capture_create(&record->capture, ++ &cap_callbacks, ++ (void *)&record->base) < 0) ++ return -EINVAL; ++ ++ /* mark capture component created */ ++ record->cap_state = XF_HANDLE_CREATED; ++ ++ /* set target handle ID as capture ID */ ++ record->base.handle_id = record->capture->handle_id; ++ ++ /* create equalizer component in case of it being used */ ++ if (eqz_flag == EQZ_ON) { ++ if (xf_adsp_equalizer_create(&record->equalizer, ++ &cap_callbacks, ++ (void *)&record->base) < 0) ++ return -EINVAL; ++ ++ /* mark equalizer component created */ ++ record->eqz_state = XF_HANDLE_CREATED; ++ ++ /* set target handle ID as equalizer ID */ ++ record->base.handle_id = record->equalizer->handle_id; ++ } ++ ++ /* init lock */ ++ spin_lock_init(&record->base.lock); ++ ++ /* save the substream data */ ++ record->base.substream = substream; ++ ++ /* init high resolution timer for updating hw status */ ++ hrtimer_init(&record->base.hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); ++ ++ /* PRQA S 0563 1 */ ++ record->base.hrtimer.function = &snd_adsp_hrtimer_func; ++ record->base.hrt_state = XF_HANDLE_CREATED; ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Prepare playback function ++ * ++ * \param[out] playback Pointer to playback data ++ * \param[in] substream Pointer to substream data ++ * \retval -EINVAL Failed to prepare playback function ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_playback_prepare(struct snd_adsp_playback *playback, ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_card *adsp_card; ++ int dai_idx, pcm_width, ch, fs, frame_size, vol_rate, hw_buffer_size; ++ int out_rate; ++ struct snd_adsp_control *ctr_if; ++ struct snd_pcm_runtime *runtime; ++ struct xf_adsp_renderer *renderer; ++ struct xf_adsp_equalizer *equalizer; ++ struct snd_adsp_base_info *base; ++ int i; ++ ++ adsp_card = snd_adsp_get_drvdata_from_substream(substream); ++ dai_idx = snd_adsp_get_dai_id_from_substream(substream); ++ ctr_if = &adsp_card->ctr_if; ++ runtime = substream->runtime; ++ renderer = playback->renderer; ++ equalizer = playback->equalizer; ++ base = &playback->base; ++ ++ /* runtime parameter */ ++ fs = runtime->rate; ++ ch = runtime->channels; ++ pcm_width = (runtime->format == SNDRV_PCM_FORMAT_S16_LE) ? 16 : 24; ++ frame_size = runtime->period_size; ++ vol_rate = ctr_if->vol_rate[DIRECT_PLAYBACK][dai_idx]; ++ out_rate = ctr_if->sample_rate[DIRECT_PLAYBACK][dai_idx]; ++ hw_buffer_size = snd_pcm_lib_buffer_bytes(substream); ++ ++ /* get number of bytes in a period */ ++ base->period_bytes = snd_pcm_lib_period_bytes(substream); ++ ++ if (pcm_width == 16) ++ base->buf_bytes = base->period_bytes; ++ else ++ base->buf_bytes = (base->period_bytes * ++ BYTES_PER_SAMPLE(S24_3LE)) / BYTES_PER_SAMPLE(S24_LE); ++ ++ /* pcm indirect configuration */ ++ base->pcm_indirect.hw_buffer_size = hw_buffer_size; ++ base->pcm_indirect.sw_buffer_size = base->pcm_indirect.hw_buffer_size; ++ ++ /* it should equal to a period size in bytes */ ++ base->pcm_indirect.hw_queue_size = base->period_bytes; ++ ++ /* set parameters when Renderer is not ready */ ++ if (COMPONENT_IS_READY(playback->rdr_state) == FALSE) { ++ struct xf_adsp_renderer_params *params = &renderer->params; ++ ++ /* apply renderer parameters */ ++ params->in_rate = fs; ++ params->channel = ch; ++ params->pcm_width = pcm_width; ++ params->frame_size = frame_size; ++ ++ if (ctr_if->mix_usage == SECOND_RUN) ++ params->mix_ctrl = ctr_if->mix_usage; ++ else ++ params->mix_ctrl = MIX_UNUSED; ++ ++ /* set flow as ADSP->PDMA0->SRC0->PDMA1->SSI0 */ ++ params->dev1 = SRC0; ++ params->dev2 = SSI00; ++ params->dma1 = PDMA_CH00; ++ params->dma2 = PDMA_CH01; ++ ++ /* when MIX is enabled, change to DMAC transfer type to save */ ++ /* hw FIFO */ ++ if (MIX_ENABLED(params->mix_ctrl) == TRUE) ++ params->dma1 = ADMAC_CH01; ++ ++ /* set volume rate if it is set by user or default value */ ++ /* is 100% */ ++ if (vol_rate >= 0) ++ params->vol_rate = vol_rate; ++ else ++ params->vol_rate = (1 << 20); ++ ++ /* set output channel if it is set by user */ ++ if (ctr_if->rdr_out_ch[dai_idx] >= MONAURAL) ++ params->out_channel = ctr_if->rdr_out_ch[dai_idx]; ++ else ++ params->out_channel = params->channel; ++ ++ /* set sample rate output if it is set by user */ ++ if (out_rate >= 0) ++ params->out_rate = out_rate; ++ ++ /* set parameters to ADSP Renderer plugin */ ++ if (xf_adsp_renderer_set_params(renderer) != 0) ++ return -EINVAL; ++ ++ /* allocate buffer pool to prepare the execution */ ++ renderer->buf_pool = xf_adsp_allocate_mem_pool( ++ XF_BUF_POOL_SIZE, base->buf_bytes); ++ ++ if (IS_ERR(renderer->buf_pool)) /* PRQA S 306*/ ++ return -EINVAL; ++ ++ for (i = 0; i < XF_BUF_POOL_SIZE; i++) { ++ base->buffer[i] = xf_adsp_get_data_from_pool( ++ renderer->buf_pool, i); ++ ++ base->buf_queue++; ++ memset(base->buffer[i], 0, base->buf_bytes); ++ } ++ ++ /* mark Renderer ready */ ++ playback->rdr_state |= XF_HANDLE_READY; ++ ++ /* set parameters for Equalizer if it is used */ ++ if (COMPONENT_IS_CREATED(playback->eqz_state) == TRUE) { ++ /* apply Equalizer parameter setting */ ++ equalizer->params.channel = ch; ++ equalizer->params.pcm_width = pcm_width; ++ equalizer->params.rate = fs; ++ ++ /* get equalizer parameters from control interface */ ++ /* data */ ++ snd_adsp_get_eqz_params_from_control( ++ &equalizer->params, ++ &ctr_if->eqz_params[DIRECT_PLAYBACK][dai_idx], ++ true); ++ ++ /* set parameters to Equalizer plugin */ ++ if (xf_adsp_equalizer_set_params(equalizer) != 0) ++ return -EINVAL; ++ ++ /* route Equalizer to Renderer */ ++ if (xf_adsp_route(equalizer->handle_id, ++ renderer->handle_id, ++ XF_BUF_POOL_SIZE, ++ base->buf_bytes) != 0) ++ return -EINVAL; ++ ++ /* mark Equalizer ready */ ++ playback->eqz_state |= XF_HANDLE_READY; ++ ++ /* prepare data before start PCM */ ++ /* PRQA S 2462 1 */ /* PRQA S 2463 1 */ ++ for (i = 0; i < XF_BUF_POOL_SIZE; i++) { ++ /* send buffer to plugin to kick */ ++ /* init-processing */ ++ if (xf_adsp_empty_this_buffer( ++ base->handle_id, ++ base->buffer[i], ++ base->buf_bytes) != 0) ++ return -EINVAL; ++ ++ spin_lock_irqsave(&base->lock, base->flag); ++ base->buf_queue--; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ } ++ } else { ++ /* send zero buffer to plugin to kick */ ++ /* init-processing */ ++ if (xf_adsp_empty_this_buffer(base->handle_id, ++ base->buffer[0], ++ base->buf_bytes) != 0) ++ return -EINVAL; ++ ++ spin_lock_irqsave(&base->lock, base->flag); ++ base->buf_queue--; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ } ++ ++ /* wait until all the buffer have been consummed */ ++ while (base->buf_queue != XF_BUF_POOL_SIZE) { ++ schedule_timeout_interruptible(2); ++ if (signal_pending(current)) ++ break; ++ ++ /* check the error from initialization */ ++ if (base->runtime_err) ++ return -EINVAL; ++ } ++ ++ /* reset HW index */ ++ base->hw_idx = 0; ++ } ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Prepare record function ++ * ++ * \param[out] record Pointer to record data ++ * \param[in] substream Pointer to substream data ++ * \retval -EINVAL Failed to prepare record function ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_record_prepare(struct snd_adsp_record *record, ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_card *adsp_card; ++ int dai_idx, pcm_width, ch, fs, frame_size, vol_rate, in_rate; ++ int hw_buffer_size, hw_queue_size; ++ struct snd_adsp_control *ctr_if; ++ struct snd_pcm_runtime *runtime; ++ struct xf_adsp_capture *capture; ++ struct xf_adsp_equalizer *equalizer; ++ struct snd_adsp_base_info *base; ++ int i; ++ ++ adsp_card = snd_adsp_get_drvdata_from_substream(substream); ++ dai_idx = snd_adsp_get_dai_id_from_substream(substream); ++ ctr_if = &adsp_card->ctr_if; ++ runtime = substream->runtime; ++ capture = record->capture; ++ equalizer = record->equalizer; ++ base = &record->base; ++ ++ /* runtime parameter */ ++ fs = runtime->rate; ++ ch = runtime->channels; ++ pcm_width = (runtime->format == SNDRV_PCM_FORMAT_S16_LE) ? 16 : 24; ++ frame_size = runtime->period_size; ++ vol_rate = ctr_if->vol_rate[DIRECT_CAPTURE][dai_idx]; ++ in_rate = ctr_if->sample_rate[DIRECT_CAPTURE][dai_idx]; ++ hw_buffer_size = snd_pcm_lib_buffer_bytes(substream); ++ ++ /* total size of allocated buffers */ ++ hw_queue_size = base->period_bytes * XF_BUF_POOL_SIZE; ++ ++ /* get number of bytes in a period */ ++ base->period_bytes = snd_pcm_lib_period_bytes(substream); ++ ++ if (pcm_width == 16) ++ base->buf_bytes = base->period_bytes; ++ else ++ base->buf_bytes = ((base->period_bytes * ++ BYTES_PER_SAMPLE(S24_3LE)) / BYTES_PER_SAMPLE(S24_LE)); ++ ++ /* pcm indirect configuration */ ++ base->pcm_indirect.hw_buffer_size = hw_buffer_size; ++ base->pcm_indirect.sw_buffer_size = base->pcm_indirect.hw_buffer_size; ++ base->pcm_indirect.hw_queue_size = hw_queue_size; ++ ++ /* prepare parameters to set to Capture plugin when it is not yet */ ++ /* ready */ ++ if (COMPONENT_IS_READY(record->cap_state) == FALSE) { ++ struct xf_adsp_capture_params *params = &capture->params; ++ ++ /* apply capture parameters */ ++ params->out_rate = fs; ++ params->channel = ch; ++ params->pcm_width = pcm_width; ++ params->frame_size = frame_size; ++ ++ params->dev1 = SRC0; ++ params->dev2 = SSI10; ++ params->dma1 = PDMA_CH00; ++ params->dma2 = PDMA_CH01; ++ ++ /* set volume rate if it is set by user or default volume as */ ++ /* 100% */ ++ if (vol_rate >= 0) ++ params->vol_rate = vol_rate; ++ else ++ params->vol_rate = (1 << 20); ++ ++ /* set sample rate input if it is set by user */ ++ if (in_rate >= 0) ++ params->in_rate = in_rate; ++ ++ /* allocate buffer pool to prepare the execution */ ++ capture->buf_pool = xf_adsp_allocate_mem_pool( ++ XF_BUF_POOL_SIZE, base->buf_bytes); ++ ++ if (IS_ERR(capture->buf_pool)) /* PRQA S 306 */ ++ return -EINVAL; ++ ++ for (i = 0; i < XF_BUF_POOL_SIZE; i++) { ++ base->buffer[i] = xf_adsp_get_data_from_pool( ++ capture->buf_pool, i); ++ ++ base->buf_queue++; ++ } ++ ++ /* set parameters to ADSP Capture plugin */ ++ if (xf_adsp_capture_set_params(capture) != 0) ++ return -EINVAL; ++ ++ /* mark Capture ready */ ++ record->cap_state |= XF_HANDLE_READY; ++ ++ /* set parameters for Equalizer if it's used */ ++ if (COMPONENT_IS_CREATED(record->eqz_state) == TRUE) { ++ /* apply Equalizer parameter setting */ ++ equalizer->params.channel = ch; ++ equalizer->params.pcm_width = pcm_width; ++ equalizer->params.rate = fs; ++ ++ /* get equalizer parameter from control interface */ ++ /* data */ ++ snd_adsp_get_eqz_params_from_control( ++ &equalizer->params, ++ &ctr_if->eqz_params[DIRECT_CAPTURE][dai_idx], ++ true); ++ ++ /* set parameters to Equalizer plugin */ ++ if (xf_adsp_equalizer_set_params(equalizer) != 0) ++ return -EINVAL; ++ ++ /* route Capture to Equalizer */ ++ if (xf_adsp_route(capture->handle_id, ++ equalizer->handle_id, ++ XF_BUF_POOL_SIZE, ++ base->buf_bytes) != 0) ++ return -EINVAL; ++ ++ /* mark Equalizer ready */ ++ record->eqz_state |= XF_HANDLE_READY; ++ } ++ ++ /* kick init process by sending a zero buffer length */ ++ xf_adsp_fill_this_buffer(base->handle_id, base->buffer[0], 0); ++ ++ spin_lock_irqsave(&base->lock, base->flag); ++ base->buf_queue--; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ ++ /* wait until finishing initialization */ ++ while (base->buf_queue != XF_BUF_POOL_SIZE) { ++ schedule_timeout_interruptible(2); ++ if (signal_pending(current)) ++ break; ++ ++ /* check the error from initialization */ ++ if (base->runtime_err) ++ return -EINVAL; ++ } ++ ++ if (COMPONENT_IS_CREATED(record->eqz_state) == TRUE) { ++ /* PRQA S 2462 1 */ /* PRQA S 2463 1 */ ++ for (i = 0; i < XF_BUF_POOL_SIZE; i++) { ++ /* send buffer to plugin */ ++ if (xf_adsp_fill_this_buffer( ++ base->handle_id, ++ base->buffer[i], ++ base->buf_bytes) != 0) ++ return -EINVAL; ++ ++ spin_lock_irqsave(&base->lock, base->flag); ++ base->buf_queue--; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ } ++ ++ /* wait until all the buffer have been responsed */ ++ while (base->buf_queue != XF_BUF_POOL_SIZE) { ++ schedule_timeout_interruptible(2); ++ if (signal_pending(current)) ++ break; ++ ++ /* check the error from initialization */ ++ if (base->runtime_err) ++ return -EINVAL; ++ } ++ } ++ ++ /* reset hw data position */ ++ base->hw_idx = 0; ++ } ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Deinitialize playback function ++ * ++ * \param[out] playback Pointer to playback data ++ * \retval -EINVAL Failed to deinitialize playback function ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_playback_deinit(struct snd_adsp_playback *playback) ++{ ++ int ret = 0; ++ ++ /* perform de-initialization if playback has been created already */ ++ if (playback) { ++ /* perform completion process */ ++ if (COMPONENT_IS_CREATED(playback->rdr_state) == TRUE) { ++ /* send buffer with zero length to plugin for */ ++ /* completion process *//* PRQA S 3200 2 */ ++ xf_adsp_empty_this_buffer(playback->base.handle_id, ++ NULL, 0); ++ ++ /* free buffer pool */ /* PRQA S 3200 1 */ ++ xf_adsp_free_mem_pool(playback->renderer->buf_pool); ++ ++ /* destroy Renderer */ ++ if (xf_adsp_renderer_destroy(playback->renderer) != 0) ++ ret = -EINVAL; ++ ++ playback->renderer = NULL; ++ } ++ ++ /* destroy Equalizer if it is used */ ++ if (COMPONENT_IS_CREATED(playback->eqz_state) == TRUE) { ++ if (xf_adsp_equalizer_destroy(playback->equalizer)) ++ ret = -EINVAL; ++ ++ playback->equalizer = NULL; ++ } ++ ++ /* canncel timer interrupt */ ++ if (COMPONENT_IS_CREATED(playback->base.hrt_state) == TRUE) ++ hrtimer_cancel(&playback->base.hrtimer); ++ ++ /* free playback data */ ++ kfree(playback); ++ } ++ ++ return ret; ++} ++ ++/** ************************************************************************** ++ * \brief Deinitialize record function ++ * ++ * \param[out] record Pointer to record data ++ * \retval -EINVAL Failed to deinitialize record function ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_record_deinit(struct snd_adsp_record *record) ++{ ++ int ret = 0; ++ ++ /* perform de-initialization if record has been created already */ ++ if (!record) ++ return ret; ++ ++ /* perform completion process */ ++ if (COMPONENT_IS_CREATED(record->cap_state) == TRUE) { ++ /* send buffer with zero length to plugin for */ ++ /* completion process *//* PRQA S 3200 2 */ ++ xf_adsp_empty_this_buffer(record->base.handle_id, NULL, 0); ++ ++ /* free buffer pool */ /* PRQA S 3200 1 */ ++ xf_adsp_free_mem_pool(record->capture->buf_pool); ++ ++ if (xf_adsp_capture_destroy(record->capture)) ++ ret = -EINVAL; ++ ++ record->capture = NULL; ++ } ++ ++ /* destroy Equalizer if it is used */ ++ if (COMPONENT_IS_CREATED(record->eqz_state) == TRUE) { ++ if (xf_adsp_equalizer_destroy(record->equalizer) != 0) ++ ret = -EINVAL; ++ ++ record->equalizer = NULL; ++ } ++ ++ /* canncel timer interrupt */ ++ if (COMPONENT_IS_CREATED(record->base.hrt_state) == TRUE) ++ hrtimer_cancel(&record->base.hrtimer); ++ ++ /* free record data */ ++ kfree(record); ++ ++ return ret; ++} ++ ++/***************************************************************************** ++ * internal functions to manage TDM playback and TDM record functions ++ * ***************************************************************************/ ++ ++/** ************************************************************************** ++ * \brief Initialize TDM playback data ++ * ++ * \param[out] tdm_playback_data Pointer to store TDM playback data ++ * \param[in] substream Pointer to substream data ++ * \retval -EINVAL Failed to initialize TDM playback data ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_tdm_playback_init(struct snd_adsp_tdm_playback **tdm_playback_data, ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_tdm_playback *tdm_playback; ++ ++ /* allocate memory for TDM playback data */ ++ tdm_playback = kmalloc(sizeof(*tdm_playback), GFP_KERNEL); ++ ++ if (!tdm_playback) ++ return -EINVAL; ++ ++ /* init params */ ++ memset(tdm_playback, 0, sizeof(struct snd_adsp_tdm_playback)); ++ ++ /* save the TDM playback data */ ++ *tdm_playback_data = tdm_playback; ++ ++ /* set handle state as NULL state */ ++ tdm_playback->state = XF_HANDLE_NULL; ++ tdm_playback->base.hrt_state = XF_HANDLE_NULL; ++ ++ /* register TDM renderer component */ ++ if (xf_adsp_tdm_renderer_create(&tdm_playback->tdm_renderer, ++ &rdr_callbacks, ++ (void *)&tdm_playback->base) < 0) ++ return -EINVAL; ++ ++ /* mark TDM renderer component created */ ++ tdm_playback->state = XF_HANDLE_CREATED; ++ ++ /* set target handle ID as TDM renderer ID */ ++ tdm_playback->base.handle_id = tdm_playback->tdm_renderer->handle_id; ++ ++ /* init lock */ ++ spin_lock_init(&tdm_playback->base.lock); ++ ++ /* save the substream data */ ++ tdm_playback->base.substream = substream; ++ ++ /* init high resolution timer for updating hw status */ ++ hrtimer_init(&tdm_playback->base.hrtimer, ++ CLOCK_MONOTONIC, ++ HRTIMER_MODE_REL); ++ ++ /* PRQA S 0563 1 */ ++ tdm_playback->base.hrtimer.function = &snd_adsp_hrtimer_func; ++ tdm_playback->base.hrt_state = XF_HANDLE_CREATED; ++ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Initialize TDM record data ++ * ++ * \param[out] tdm_record_data Pointer to store TDM record data ++ * \param[in] substream Pointer to substream data ++ * \retval -EINVAL Failed to initialize TDM record data ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_tdm_record_init(struct snd_adsp_tdm_record **tdm_record_data, ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_tdm_record *tdm_record; ++ ++ /* allocate memory for TDM record data */ ++ tdm_record = kmalloc(sizeof(*tdm_record), GFP_KERNEL); ++ if (!tdm_record) ++ return -EINVAL; ++ ++ /* init params */ ++ memset(tdm_record, 0, sizeof(struct snd_adsp_tdm_record)); ++ ++ /* save the TDM record data */ ++ *tdm_record_data = tdm_record; ++ ++ /* set handle state as NULL state */ ++ tdm_record->state = XF_HANDLE_NULL; ++ tdm_record->base.hrt_state = XF_HANDLE_NULL; ++ ++ /* register TDM Capture component */ ++ if (xf_adsp_tdm_capture_create(&tdm_record->tdm_capture, ++ &cap_callbacks, ++ (void *)&tdm_record->base) != 0) ++ return -EINVAL; ++ ++ /* mark TDM capture component created */ ++ tdm_record->state = XF_HANDLE_CREATED; ++ ++ /* set target handle ID as TDM capture ID */ ++ tdm_record->base.handle_id = tdm_record->tdm_capture->handle_id; ++ ++ /* init lock */ ++ spin_lock_init(&tdm_record->base.lock); ++ ++ /* save the substream data */ ++ tdm_record->base.substream = substream; ++ ++ /* init high resolution timer for updating hw status */ ++ hrtimer_init(&tdm_record->base.hrtimer, ++ CLOCK_MONOTONIC, ++ HRTIMER_MODE_REL); ++ ++ /* PRQA S 0563 1 */ ++ tdm_record->base.hrtimer.function = &snd_adsp_hrtimer_func; ++ tdm_record->base.hrt_state = XF_HANDLE_CREATED; ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Prepare TDM playback function ++ * ++ * \param[out] tdm_playback Pointer to TDM playback data ++ * \param[in] substream Pointer to substream data ++ * \retval -EINVAL Failed to prepare TDM playback function ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_tdm_playback_prepare(struct snd_adsp_tdm_playback *tdm_playback, ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_card *adsp_card; ++ struct snd_adsp_control *ctr_if; ++ struct snd_pcm_runtime *runtime; ++ struct xf_adsp_tdm_renderer *tdm_renderer; ++ struct snd_adsp_base_info *base; ++ int i; ++ int pcm_width, ch_mode, fs, frame_size, hw_buffer_size; ++ ++ adsp_card = snd_adsp_get_drvdata_from_substream(substream); ++ ctr_if = &adsp_card->ctr_if; ++ runtime = substream->runtime; ++ tdm_renderer = tdm_playback->tdm_renderer; ++ base = &tdm_playback->base; ++ ++ /* runtime parameter */ ++ fs = runtime->rate; ++ pcm_width = (runtime->format == SNDRV_PCM_FORMAT_S16_LE) ? 16 : 24; ++ frame_size = runtime->period_size; ++ ++ ch_mode = (runtime->channels == 8) ? ++ XA_TDM_RDR_CHANNEL_MODE_1X8 : XA_TDM_RDR_CHANNEL_MODE_1X6; ++ ++ hw_buffer_size = snd_pcm_lib_buffer_bytes(substream); ++ ++ /* get number of bytes in a period */ ++ base->period_bytes = snd_pcm_lib_period_bytes(substream); ++ ++ if (pcm_width == 16) ++ base->buf_bytes = base->period_bytes; ++ else ++ base->buf_bytes = ((base->period_bytes * ++ BYTES_PER_SAMPLE(S24_3LE)) / BYTES_PER_SAMPLE(S24_LE)); ++ ++ /* pcm indirect configuration */ ++ base->pcm_indirect.hw_buffer_size = hw_buffer_size; ++ base->pcm_indirect.sw_buffer_size = base->pcm_indirect.hw_buffer_size; ++ ++ /* it should equal to a period size in bytes */ ++ base->pcm_indirect.hw_queue_size = base->period_bytes; ++ ++ /* prepare parameters to set to TDM playback as it is not ready */ ++ if (COMPONENT_IS_READY(tdm_playback->state) == FALSE) { ++ struct xf_adsp_tdm_renderer_params *params; ++ ++ params = &tdm_renderer->params; ++ ++ /* apply renderer parameters */ ++ params->in_rate = fs; ++ params->ch_mode = ch_mode; ++ params->pcm_width = pcm_width; ++ params->frame_size = frame_size; ++ ++ /* setting Audio device indexes */ ++ params->dma1 = ADMAC_CH00; /* use DMAC for transfer data */ ++ params->dma2 = PDMA_CH03; ++ params->dev1 = SRC1; ++ params->dev2 = SSI30; /* set SSI index to SSI30 */ ++ ++ /* set volume rate if it is set by user or default value as */ ++ /* 100% */ ++ params->vol_rate = (ctr_if->tdm_vol_rate[DIRECT_PLAYBACK] >= 0) ++ ? ctr_if->tdm_vol_rate[DIRECT_PLAYBACK] : (1 << 20); ++ ++ /* set output sampling rate if it is set by user */ ++ if (ctr_if->tdm_sample_rate[DIRECT_PLAYBACK] >= 0) ++ params->out_rate = ++ ctr_if->tdm_sample_rate[DIRECT_PLAYBACK]; ++ ++ /* set parameters to ADSP TDM Renderer plugin */ ++ if (xf_adsp_tdm_renderer_set_params(tdm_renderer) != 0) ++ return -EINVAL; ++ ++ /* allocate buffer pool to prepare the execution */ ++ tdm_renderer->buf_pool = xf_adsp_allocate_mem_pool( ++ XF_BUF_POOL_SIZE, base->buf_bytes); ++ ++ if (IS_ERR(tdm_renderer->buf_pool)) /* PRQA S 306*/ ++ return -EINVAL; ++ ++ for (i = 0; i < XF_BUF_POOL_SIZE; i++) { ++ base->buffer[i] = xf_adsp_get_data_from_pool( ++ tdm_renderer->buf_pool, i); ++ ++ base->buf_queue++; ++ } ++ ++ /* mark TDM Renderer created */ ++ tdm_playback->state |= XF_HANDLE_READY; ++ ++ /* send zero buffer to plugin to kick init-processing */ ++ memset(base->buffer[0], 0, base->buf_bytes); ++ ++ if (xf_adsp_empty_this_buffer(base->handle_id, base->buffer[0], ++ base->buf_bytes) != 0) ++ return -EINVAL; ++ ++ spin_lock_irqsave(&base->lock, base->flag); ++ base->buf_queue--; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ ++ /* wait until all the buffer have been consummed */ ++ while (base->buf_queue != XF_BUF_POOL_SIZE) { ++ schedule_timeout_interruptible(2); ++ if (signal_pending(current)) ++ break; ++ ++ /* check the error from initialization */ ++ if (base->runtime_err) ++ return -EINVAL; ++ } ++ ++ /* reset HW index */ ++ base->hw_idx = 0; ++ } ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Prepare TDM record function ++ * ++ * \param[out] tdm_record Pointer to TDM record data ++ * \param[in] substream Pointer to substream data ++ * \retval -EINVAL Failed to prepare TDM record function ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_tdm_record_prepare(struct snd_adsp_tdm_record *tdm_record, ++ struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_card *adsp_card = ++ snd_adsp_get_drvdata_from_substream(substream); ++ struct snd_adsp_control *ctr_if = &adsp_card->ctr_if; ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ struct xf_adsp_tdm_capture *tdm_capture = tdm_record->tdm_capture; ++ struct snd_adsp_base_info *base = &tdm_record->base; ++ int i; ++ int pcm_width, ch_mode, fs, frame_size; ++ ++ /* runtime parameter */ ++ fs = runtime->rate; ++ ++ ch_mode = (runtime->channels == 8) ? ++ XA_TDM_RDR_CHANNEL_MODE_1X8 : XA_TDM_RDR_CHANNEL_MODE_1X6; ++ ++ pcm_width = (runtime->format == SNDRV_PCM_FORMAT_S16_LE) ? 16 : 24; ++ frame_size = runtime->period_size; ++ ++ /* get number of bytes in a period */ ++ base->period_bytes = snd_pcm_lib_period_bytes(substream); ++ base->buf_bytes = (pcm_width == 16) ? ++ base->period_bytes : ((base->period_bytes * ++ BYTES_PER_SAMPLE(S24_3LE)) / ++ BYTES_PER_SAMPLE(S24_LE)); ++ ++ /* pcm indirect configuration */ ++ base->pcm_indirect.hw_buffer_size = snd_pcm_lib_buffer_bytes(substream); ++ base->pcm_indirect.sw_buffer_size = base->pcm_indirect.hw_buffer_size; ++ ++ /* total size of allocated buffers */ ++ base->pcm_indirect.hw_queue_size = base->period_bytes * ++ XF_BUF_POOL_SIZE; ++ ++ /* prepare parameters to set to TDM Capture as it is not yet ready */ ++ if (COMPONENT_IS_READY(tdm_record->state) == FALSE) { ++ struct xf_adsp_tdm_capture_params *params; ++ ++ params = &tdm_capture->params; ++ ++ /* apply capture parameters */ ++ params->out_rate = fs; ++ params->ch_mode = ch_mode; ++ params->pcm_width = pcm_width; ++ params->frame_size = frame_size; ++ ++ /* setting Audio device indexes */ ++ params->dma1 = PDMA_CH00; ++ params->dma2 = PDMA_CH01; ++ params->dev1 = SRC0; ++ params->dev2 = SSI40; /* set input device is SSI40 */ ++ ++ /* set volume rate if it is set by user or default value as */ ++ /* 100% */ ++ params->vol_rate = (ctr_if->tdm_vol_rate[DIRECT_CAPTURE] >= 0) ++ ? ctr_if->tdm_vol_rate[DIRECT_CAPTURE] : (1 << 20); ++ ++ /* set input rate if it is set by user */ ++ if (ctr_if->tdm_sample_rate[DIRECT_CAPTURE] >= 0) { ++ params->in_rate = ++ ctr_if->tdm_sample_rate[DIRECT_CAPTURE]; ++ } ++ ++ /* allocate buffer pool to prepare the execution */ ++ tdm_capture->buf_pool = xf_adsp_allocate_mem_pool( ++ XF_BUF_POOL_SIZE, base->buf_bytes); ++ ++ if (IS_ERR(tdm_capture->buf_pool)) /* PRQA S 306 */ ++ return -EINVAL; ++ ++ for (i = 0; i < XF_BUF_POOL_SIZE; i++) { ++ base->buffer[i] = xf_adsp_get_data_from_pool( ++ tdm_capture->buf_pool, i); ++ ++ base->buf_queue++; ++ } ++ ++ /* set parameters to ADSP TDM Capture plugin */ ++ if (xf_adsp_tdm_capture_set_params(tdm_capture) != 0) ++ return -EINVAL; ++ ++ /* mark TDM Capture ready */ ++ tdm_record->state |= XF_HANDLE_READY; ++ ++ /* kick init process by sending a zero buffer length */ ++ xf_adsp_fill_this_buffer(base->handle_id, base->buffer[0], 0); ++ ++ spin_lock_irqsave(&base->lock, base->flag); ++ base->buf_queue--; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ ++ /* wait until finishing initialization */ ++ while (base->buf_queue != XF_BUF_POOL_SIZE) { ++ schedule_timeout_interruptible(2); ++ if (signal_pending(current)) ++ break; ++ ++ /* check the error from initialization */ ++ if (base->runtime_err) ++ return -EINVAL; ++ } ++ ++ /* reset hw data position */ ++ base->hw_idx = 0; ++ } ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Deinitialize TDM playback function ++ * ++ * \param[out] tdm_playback Pointer to TDM playback data ++ * \retval -EINVAL Failed to deinitialize TDM playback function ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_tdm_playback_deinit(struct snd_adsp_tdm_playback *tdm_playback) ++{ ++ int ret = 0; ++ ++ /* perform de-initialization if TDM playback has been created */ ++ if (!tdm_playback) ++ return ret; ++ ++ /* perform completion process */ ++ if (COMPONENT_IS_CREATED(tdm_playback->state) == TRUE) { ++ /* send buffer with zero length to plugin for */ ++ /* completion process */ ++ /* PRQA S 3200 2 */ ++ xf_adsp_empty_this_buffer(tdm_playback->base.handle_id, ++ NULL, 0); ++ ++ /* free buffer pool *//* PRQA S 3200 2 */ ++ xf_adsp_free_mem_pool(tdm_playback->tdm_renderer->buf_pool); ++ ++ /* destroy TDM Renderer component */ ++ if (xf_adsp_tdm_renderer_destroy( ++ tdm_playback->tdm_renderer) != 0) ++ ret = -EINVAL; ++ ++ tdm_playback->tdm_renderer = NULL; ++ } ++ ++ /* canncel timer interrupt */ ++ if (COMPONENT_IS_CREATED(tdm_playback->base.hrt_state) == TRUE) ++ hrtimer_cancel(&tdm_playback->base.hrtimer); ++ ++ /* free playback data */ ++ kfree(tdm_playback); ++ ++ return ret; ++} ++ ++/** ************************************************************************** ++ * \brief Deinitialize TDM record function ++ * ++ * \param[out] tdm_record Pointer to TDM record data ++ * \retval -EINVAL Failed to deinitialize TDM record function ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_tdm_record_deinit(struct snd_adsp_tdm_record *tdm_record) ++{ ++ int ret = 0; ++ ++ /* perform de-initialization if TDM record has been created already */ ++ if (!tdm_record) ++ return ret; ++ ++ /* perform completion process */ ++ if (COMPONENT_IS_CREATED(tdm_record->state) == TRUE) { ++ /* send buffer with zero length to plugin for */ ++ /* completion process */ ++ /* PRQA S 3200 2 */ ++ xf_adsp_empty_this_buffer(tdm_record->base.handle_id, NULL, 0); ++ ++ /* free buffer pool *//* PRQA S 3200 2 */ ++ xf_adsp_free_mem_pool(tdm_record->tdm_capture->buf_pool); ++ ++ /* destroy TDM Capture component */ ++ if (xf_adsp_tdm_capture_destroy(tdm_record->tdm_capture) != 0) ++ ret = -EINVAL; ++ ++ tdm_record->tdm_capture = NULL; ++ } ++ ++ /* canncel timer interrupt */ ++ if (COMPONENT_IS_CREATED(tdm_record->base.hrt_state) == TRUE) ++ hrtimer_cancel(&tdm_record->base.hrtimer); ++ ++ /* free record data */ ++ kfree(tdm_record); ++ ++ return ret; ++} ++ ++/***************************************************************************** ++ * callback functions of ADSP ALSA driver ++ * ***************************************************************************/ ++ ++/** ************************************************************************** ++ * \brief Open a playback/TDM playback or record/TDM record stream ++ * ++ * \param[in] substream Pointer to substream object ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int snd_adsp_pcm_open(struct snd_pcm_substream *substream) ++{ ++ /* get ADSP soundcard and CPU DAI index */ ++ struct snd_adsp_card *adsp_card; ++ int dai_idx = snd_adsp_get_dai_id_from_substream(substream); ++ struct snd_adsp_control *ctr_if; ++ ++ adsp_card = snd_adsp_get_drvdata_from_substream(substream); ++ ctr_if = &adsp_card->ctr_if; ++ ++ if (dai_idx == RDR_DAI_IDX0 || dai_idx == RDR_DAI_IDX1 || ++ dai_idx == RDR_DAI_IDX2 || dai_idx == RDR_DAI_IDX3) { ++ /* register data for playback/record functions */ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ /* perform playback initialization */ ++ if (snd_adsp_playback_init( ++ &adsp_card->playback[dai_idx], ++ ctr_if->eqz_switch[DIRECT_PLAYBACK][dai_idx], ++ substream) < 0) { ++ /* perform playback de-initialization when */ ++ /* the initialization fails */ ++ snd_adsp_playback_deinit( ++ adsp_card->playback[dai_idx]); ++ ++ adsp_card->playback[dai_idx] = NULL; ++ return -EINVAL; ++ } ++ } else { ++ /* perform record initialization */ ++ if (snd_adsp_record_init( ++ &adsp_card->record[dai_idx], ++ ctr_if->eqz_switch[DIRECT_CAPTURE][dai_idx], ++ substream) < 0) { ++ /* perform record de-initialization when the */ ++ /* initialization fails */ ++ snd_adsp_record_deinit( ++ adsp_card->record[dai_idx]); ++ ++ adsp_card->record[dai_idx] = NULL; ++ return -EINVAL; ++ } ++ } ++ ++ /* save the hardware parameters */ ++ snd_soc_set_runtime_hwparams(substream, &snd_pcm_adsp_hw); ++ ++ /* each period has a frame size */ ++ snd_pcm_hw_constraint_single(substream->runtime, ++ SNDRV_PCM_HW_PARAM_PERIOD_SIZE, ++ FRAME_SIZE); ++ } else { ++ /* register data for TDM playback/record functions */ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ /* perform TDM playback initialization */ ++ if (snd_adsp_tdm_playback_init( ++ &adsp_card->tdm_playback, ++ substream) < 0) { ++ /* perform TDM playback de-initialization */ ++ /* when the initialization fails */ ++ snd_adsp_tdm_playback_deinit( ++ adsp_card->tdm_playback); ++ ++ adsp_card->tdm_playback = NULL; ++ return -EINVAL; ++ } ++ } else { ++ /* perform TDM record initialization */ ++ if (snd_adsp_tdm_record_init(&adsp_card->tdm_record, ++ substream) < 0) { ++ /* perform TDM record de-initialization */ ++ /* when the initialization fails */ ++ snd_adsp_tdm_record_deinit( ++ adsp_card->tdm_record); ++ ++ adsp_card->tdm_record = NULL; ++ return -EINVAL; ++ } ++ } ++ ++ /* save the hardware parameters */ ++ snd_soc_set_runtime_hwparams(substream, &snd_pcm_adsp_tdm_hw); ++ ++ /* each period has a frame size */ ++ snd_pcm_hw_constraint_single(substream->runtime, ++ SNDRV_PCM_HW_PARAM_PERIOD_SIZE, ++ TDM_FRAME_SIZE); ++ } ++ ++ snd_pcm_hw_constraint_integer(substream->runtime, ++ SNDRV_PCM_HW_PARAM_PERIODS); ++ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Close a playback/TDM playback or record/TDM record stream ++ * ++ * \param[in] substream Pointer to substream object ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int snd_adsp_pcm_close(struct snd_pcm_substream *substream) ++{ ++ /* get ADSP soundcard and CPU DAI index */ ++ struct snd_adsp_card *adsp_card = ++ snd_adsp_get_drvdata_from_substream(substream); ++ int dai_idx = snd_adsp_get_dai_id_from_substream(substream); ++ int err = 0; ++ ++ if (dai_idx == RDR_DAI_IDX0 || dai_idx == RDR_DAI_IDX1 || ++ dai_idx == RDR_DAI_IDX2 || dai_idx == RDR_DAI_IDX3) { ++ /* destroy Renderer/Capture or Equalizer (if used) */ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ if (snd_adsp_playback_deinit( ++ adsp_card->playback[dai_idx]) < 0) ++ err = -EINVAL; ++ ++ adsp_card->playback[dai_idx] = NULL; ++ } else { ++ if (snd_adsp_record_deinit( ++ adsp_card->record[dai_idx]) < 0) ++ err = -EINVAL; ++ ++ adsp_card->record[dai_idx] = NULL; ++ } ++ } else { ++ /* destroy TDM Renderer/TDM Capture */ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { ++ if (snd_adsp_tdm_playback_deinit( ++ adsp_card->tdm_playback) < 0) ++ err = -EINVAL; ++ ++ adsp_card->tdm_playback = NULL; ++ } else { ++ if (snd_adsp_tdm_record_deinit( ++ adsp_card->tdm_record) < 0) ++ err = -EINVAL; ++ ++ adsp_card->tdm_record = NULL; ++ } ++ } ++ ++ return err; ++} ++ ++/** ************************************************************************** ++ * \brief Allocate ALSA buffer and calculate expire time of hr timer ++ * ++ * \param[in] substream Pointer to substream object ++ * \retval 0 Success ++ * \retval -ENOMEM Cannot allocate ALSA buffer ++ *****************************************************************************/ ++static int snd_adsp_pcm_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *hw_params) ++{ ++ struct snd_adsp_base_info *base; ++ int err = 0; ++ ++ base = snd_adsp_get_base_from_substream(substream); ++ ++ /* set expire time of hrtimer, this value should be time for */ ++ /* transfer a frame */ ++ base->ktime = ns_to_ktime((1000000000 / params_rate(hw_params)) * ++ params_period_size(hw_params)); ++ ++ err = snd_pcm_lib_malloc_pages(substream, ++ params_buffer_bytes(hw_params)); ++ ++ /* reset DMA buffer area */ ++ memset(substream->runtime->dma_area, 0, substream->runtime->dma_bytes); ++ ++ return err; ++} ++ ++/** ************************************************************************** ++ * \brief Free the allocated ALSA buffer ++ * ++ * \param[in] substream Pointer to substream object ++ * \retval 0 Success ++ * \retval -EINVAL Cannot deallocate buffer ++ *****************************************************************************/ ++static int snd_adsp_pcm_hw_free(struct snd_pcm_substream *substream) ++{ ++ return snd_pcm_lib_free_pages(substream); ++} ++ ++/** ************************************************************************** ++ * \brief Prepare playback/TDM playback or record/TDM record function ++ * before transferring data ++ * ++ * \param[in] substream Pointer to substream object ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int snd_adsp_pcm_prepare(struct snd_pcm_substream *substream) ++{ ++ /* get ADSP soundcard and CPU DAI index */ ++ struct snd_adsp_card * ++ adsp_card = snd_adsp_get_drvdata_from_substream(substream); ++ int dai_idx = snd_adsp_get_dai_id_from_substream(substream); ++ int err = 0; ++ ++ if (dai_idx == RDR_DAI_IDX0 || dai_idx == RDR_DAI_IDX1 || ++ dai_idx == RDR_DAI_IDX2 || dai_idx == RDR_DAI_IDX3) { ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ++ /* get playback prepared to execute */ ++ err = snd_adsp_playback_prepare( ++ adsp_card->playback[dai_idx], substream); ++ else ++ /* get record prepared to execute */ ++ err = snd_adsp_record_prepare( ++ adsp_card->record[dai_idx], substream); ++ } else { ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ++ /* get TDM playback prepared to execute */ ++ err = snd_adsp_tdm_playback_prepare( ++ adsp_card->tdm_playback, substream); ++ else ++ /* get TDM record prepared to execute */ ++ err = snd_adsp_tdm_record_prepare( ++ adsp_card->tdm_record, substream); ++ } ++ ++ return err; ++} ++ ++/** ************************************************************************** ++ * \brief Trigger playback/TDM playback or record/TDM record stream ++ * to go to next phase ++ * ++ * \param[in] substream Pointer to substream object ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int snd_adsp_pcm_trigger(struct snd_pcm_substream *substream, int idx) ++{ ++ struct snd_adsp_base_info * ++ base = snd_adsp_get_base_from_substream(substream); ++ ++ switch (idx) { ++ case SNDRV_PCM_TRIGGER_START: ++ case SNDRV_PCM_TRIGGER_RESUME: ++ /* start high-resolution timer */ ++ hrtimer_start(&base->hrtimer, base->ktime, HRTIMER_MODE_REL); ++ ++ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { ++ int buf_queue = 0; ++ ++ /* get current available buffer */ ++ spin_lock_irqsave(&base->lock, base->flag); ++ buf_queue = base->buf_queue; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ ++ /* send all available buffer to plugin to */ ++ /* get data */ ++ for (; buf_queue > 0; buf_queue--) { ++ if (xf_adsp_fill_this_buffer( ++ base->handle_id, ++ base->buffer[base->buf_idx], ++ base->buf_bytes) != 0) ++ return -EINVAL; ++ ++ spin_lock_irqsave(&base->lock, base->flag); ++ base->buf_queue--; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ ++ base->buf_idx++; ++ ++ if (base->buf_idx >= XF_BUF_POOL_SIZE) ++ base->buf_idx = 0; ++ } ++ } ++ break; ++ case SNDRV_PCM_TRIGGER_STOP: ++ case SNDRV_PCM_TRIGGER_SUSPEND: ++ break; ++ default: ++ return -EINVAL; ++ } ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Return HW data position ++ * ++ * \param[in] substream Pointer to substream object ++ * \retval position HW data position ++ *****************************************************************************/ ++static snd_pcm_uframes_t ++snd_adsp_pcm_pointer(struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_base_info * ++ base = snd_adsp_get_base_from_substream(substream); ++ unsigned int hw_idx, hw_buffer_size; ++ snd_pcm_uframes_t pointer; ++ ++ /* convert hw index to correct as submitted bytes */ ++ spin_lock_irqsave(&base->lock, base->flag); ++ hw_idx = (base->hw_idx / base->buf_bytes) * base->period_bytes; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ ++ hw_buffer_size = base->pcm_indirect.hw_buffer_size; ++ ++ if (hw_idx >= hw_buffer_size) { ++ spin_lock_irqsave(&base->lock, base->flag); ++ ++ base->hw_idx -= (hw_buffer_size / base->period_bytes) * ++ base->buf_bytes; ++ ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ } ++ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ++ pointer = snd_pcm_indirect_playback_pointer(substream, ++ &base->pcm_indirect, ++ hw_idx); ++ else ++ pointer = snd_pcm_indirect_capture_pointer(substream, ++ &base->pcm_indirect, ++ hw_idx); ++ ++ return pointer; ++} ++ ++/** ************************************************************************** ++ * \brief Call read/write process to transfer data ++ * ++ * \param[in] substream Pointer to substream object ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int snd_adsp_pcm_ack(struct snd_pcm_substream *substream) ++{ ++ struct snd_adsp_base_info * ++ base = snd_adsp_get_base_from_substream(substream); ++ ++ if (base->runtime_err) ++ return -EINVAL; ++ ++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ++ snd_pcm_indirect_playback_transfer(substream, ++ &base->pcm_indirect, ++ snd_adsp_pcm_transfer); ++ else ++ snd_pcm_indirect_capture_transfer(substream, ++ &base->pcm_indirect, ++ snd_adsp_pcm_transfer); ++ ++ return 0; ++} ++ ++/** *************************************************************************** ++ * \brief Copy data from source buffer to destination buffer ++ * ++ * \params[in] dst Destination buffer pointer ++ * \params[out] src Source buffer pointer ++ * \params[in] dst_size Destination buffer size in byte ++ * \params[in] src_size Source buffer size in byte ++ * \retval None ++ *****************************************************************************/ ++static inline void ++snd_adsp_copy_data(void *dst, void *src, int dst_size, int src_size) ++{ ++ unsigned char *data_dst = dst; ++ unsigned char *data_src = src; ++ int i; ++ ++ if (dst_size == src_size) { ++ /* src and dst bufs are same size, does not need to convert */ ++ memcpy(data_dst, data_src, dst_size); ++ ++ } else if (dst_size < src_size) { ++ for (i = 0; i < (dst_size - BYTES_PER_SAMPLE(S24_3LE)); ++ i += BYTES_PER_SAMPLE(S24_3LE)) { ++ *(u32 *)data_dst = *(u32 *)data_src; ++ ++ data_dst += BYTES_PER_SAMPLE(S24_3LE); ++ data_src += BYTES_PER_SAMPLE(S24_LE); ++ } ++ ++ /* copy a S24_3LE sample from S24_LE sample */ ++ data_dst[0] = data_src[0]; ++ data_dst[1] = data_src[1]; ++ data_dst[2] = data_src[2]; ++ ++ } else { ++ unsigned int tmp; ++ ++ for (i = 0; i < (dst_size - BYTES_PER_SAMPLE(S24_LE)); ++ i += BYTES_PER_SAMPLE(S24_LE)) { ++ tmp = *(u32 *)data_src; ++ *(u32 *)data_dst = tmp & 0x0FFFFFF; ++ ++ data_dst += BYTES_PER_SAMPLE(S24_LE); ++ data_src += BYTES_PER_SAMPLE(S24_3LE); ++ } ++ ++ /* copy a S24_LE sample from S24_3LE sample */ ++ data_dst[0] = data_src[0]; ++ data_dst[1] = data_src[1]; ++ data_dst[2] = data_src[2]; ++ data_dst[3] = 0; ++ } ++} ++ ++/** ************************************************************************** ++ * \brief Transfer data process between ALSA buffer and ADSP buffer ++ * ++ * \param[in] substream Pointer to substream object ++ * \param[in] rec Pointer to indirect PCM data ++ * \param[in] bytes Number of byte need to be transferred ++ * \retval None ++ *****************************************************************************/ ++static void snd_adsp_pcm_transfer(struct snd_pcm_substream *substream, ++ struct snd_pcm_indirect *rec, ++ size_t bytes) ++{ ++ struct snd_adsp_base_info * ++ base = snd_adsp_get_base_from_substream(substream); ++ int direct = substream->stream; ++ int trans_bytes = bytes; ++ int buf_bytes, period_bytes; ++ void *dma_buf, *data_buff; ++ ++ /* get the DMA buffer pointer */ ++ dma_buf = (void *)(substream->runtime->dma_area + rec->sw_data); ++ ++ /* get information from base */ ++ buf_bytes = base->buf_bytes; ++ period_bytes = base->period_bytes; ++ ++ /* make sure the available buffer and transfer size - TBD */ ++ while (trans_bytes > 0) { ++ spin_lock_irqsave(&base->lock, base->flag); ++ if (base->buf_queue > 0 && trans_bytes >= period_bytes) { ++ base->buf_queue--; ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ ++ /* get the buffer pointer from stream */ ++ data_buff = base->buffer[base->buf_idx]; ++ ++ if (direct == SNDRV_PCM_STREAM_PLAYBACK) { ++ /* copy data from user *//* PRQA S 3200 2 */ ++ snd_adsp_copy_data(data_buff, dma_buf, ++ buf_bytes, period_bytes); ++ ++ /* send buffer to plugin */ ++ if (xf_adsp_empty_this_buffer(base->handle_id, ++ data_buff, ++ buf_bytes) < 0) ++ base->runtime_err = TRUE; ++ } else { ++ /* copy data to user *//* PRQA S 3200 2 */ ++ snd_adsp_copy_data(dma_buf, data_buff, ++ period_bytes, buf_bytes); ++ ++ /* send buffer to plugin */ ++ if (xf_adsp_fill_this_buffer(base->handle_id, ++ data_buff, ++ buf_bytes) < 0) ++ base->runtime_err = TRUE; ++ } ++ ++ base->buf_idx++; ++ if (base->buf_idx >= XF_BUF_POOL_SIZE) ++ base->buf_idx = 0; ++ } else { ++ spin_unlock_irqrestore(&base->lock, base->flag); ++ break; ++ } ++ ++ trans_bytes -= period_bytes; ++ } ++} ++ ++/** ************************************************************************** ++ * \brief Get info of Volume control ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] uinfo Pointer to info structure of volume control ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_control_volume_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; ++ uinfo->count = 1; ++ uinfo->value.integer.min = -1; ++ uinfo->value.integer.max = 799; ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Get volume value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to volume value ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int snd_adsp_control_volume_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ struct snd_adsp_control *ctr_if = &adsp_card->ctr_if; ++ int handle_state, handle_id; ++ int volume, cmd_idx, direction; ++ unsigned int index; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ /* set handle state as NULL state */ ++ handle_state = XF_HANDLE_NULL; ++ handle_id = -1; ++ ++ /* determine command index, direction, handle state, handle ID */ ++ if (kcontrol->id.name[0] == PREFIX_OF_PLAYBACK_CTR_NAME) { ++ cmd_idx = XA_RDR_CONFIG_PARAM_VOLUME_RATE; ++ direction = DIRECT_PLAYBACK; ++ ++ if (adsp_card->playback[index]) { ++ handle_state = adsp_card->playback[index]->rdr_state; ++ ++ handle_id = ++ adsp_card->playback[index]->renderer->handle_id; ++ } ++ } else if (kcontrol->id.name[0] == PREFIX_OF_CAPTURE_CTR_NAME) { ++ cmd_idx = XA_CAP_CONFIG_PARAM_VOLUME_RATE; ++ direction = DIRECT_CAPTURE; ++ ++ if (adsp_card->record[index]) { ++ handle_state = adsp_card->record[index]->cap_state; ++ ++ handle_id = ++ adsp_card->record[index]->capture->handle_id; ++ } ++ } else { ++ if (kcontrol->id.name[3] == TDM_PLAYBACK) { ++ cmd_idx = XA_TDM_RDR_CONFIG_PARAM_VOLUME_RATE; ++ direction = DIRECT_PLAYBACK; ++ ++ if (adsp_card->tdm_playback) { ++ handle_state = adsp_card->tdm_playback->state; ++ ++ handle_id = ++ adsp_card->tdm_playback->tdm_renderer->handle_id; ++ } ++ } else { ++ cmd_idx = XA_TDM_CAP_CONFIG_PARAM_VOLUME_RATE; ++ direction = DIRECT_CAPTURE; ++ ++ if (adsp_card->tdm_record) { ++ handle_state = adsp_card->tdm_record->state; ++ ++ handle_id = ++ adsp_card->tdm_record->tdm_capture->handle_id; ++ } ++ } ++ } ++ ++ /* get the volume's value */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) { ++ /* get the volume's value from the plugin */ ++ if (xf_adsp_get_param(handle_id, cmd_idx, &volume) != 0) ++ return -EINVAL; ++ ++ /* check the value after getting it and adjust it */ ++ ucontrol->value.integer.value[0] = (volume == 0xFFFFFFFF) ? ++ (-1) : (volume * VOLUME_SCALE) >> 20; ++ } else { ++ if (kcontrol->id.name[0] != PREFIX_OF_TDM_CTR_NAME) ++ ucontrol->value.integer.value[0] = ++ (ctr_if->vol_rate[direction][index] * ++ VOLUME_SCALE) >> 20; ++ else ++ ucontrol->value.integer.value[0] = ++ (ctr_if->tdm_vol_rate[direction] * ++ VOLUME_SCALE) >> 20; ++ } ++ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Set volume value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to volume value ++ * \retval 1 Volume change ++ * \retval 0 Volume does not change ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++/* PRQA S 3673 1*/ ++static int ++snd_adsp_control_volume_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ struct snd_adsp_control *ctr_if = &adsp_card->ctr_if; ++ int volume; ++ int ret; ++ int handle_state, handle_id, cmd_idx, volume_get; ++ int direction; ++ unsigned int index; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ /* set handle state as NULL state and handle ID */ ++ handle_state = XF_HANDLE_NULL; ++ handle_id = -1; ++ ++ /* get the value to set */ ++ if (ucontrol->value.integer.value[0] == -1) { ++ volume = 0xFFFFFFFF; ++ } else { ++ /* round up the value if needed */ ++ volume = (ucontrol->value.integer.value[0] * (1 << 20)) / ++ VOLUME_SCALE; ++ ++ if ((ucontrol->value.integer.value[0] * (1 << 20)) > ++ (VOLUME_SCALE * volume)) ++ volume += 1; ++ } ++ ++ /* determine command index, direction, handle state, handle ID */ ++ if (kcontrol->id.name[0] == PREFIX_OF_PLAYBACK_CTR_NAME) { ++ cmd_idx = XA_RDR_CONFIG_PARAM_VOLUME_RATE; ++ direction = DIRECT_PLAYBACK; ++ ++ if (adsp_card->playback[index]) { ++ handle_state = adsp_card->playback[index]->rdr_state; ++ ++ handle_id = ++ adsp_card->playback[index]->renderer->handle_id; ++ } ++ } else if (kcontrol->id.name[0] == PREFIX_OF_CAPTURE_CTR_NAME) { ++ cmd_idx = XA_CAP_CONFIG_PARAM_VOLUME_RATE; ++ direction = DIRECT_CAPTURE; ++ ++ if (adsp_card->record[index]) { ++ handle_state = adsp_card->record[index]->cap_state; ++ ++ handle_id = ++ adsp_card->record[index]->capture->handle_id; ++ } ++ } else { ++ if (kcontrol->id.name[3] == TDM_PLAYBACK) { ++ cmd_idx = XA_TDM_RDR_CONFIG_PARAM_VOLUME_RATE; ++ direction = DIRECT_PLAYBACK; ++ ++ if (adsp_card->tdm_playback) { ++ handle_state = adsp_card->tdm_playback->state; ++ ++ handle_id = ++ adsp_card->tdm_playback->tdm_renderer->handle_id; ++ } ++ } else { ++ cmd_idx = XA_TDM_CAP_CONFIG_PARAM_VOLUME_RATE; ++ direction = DIRECT_CAPTURE; ++ ++ if (adsp_card->tdm_record) { ++ handle_state = adsp_card->tdm_record->state; ++ ++ handle_id = ++ adsp_card->tdm_record->tdm_capture->handle_id; ++ } ++ } ++ } ++ ++ /* set volume to plugin */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) { ++ /* TDM does not support set volume in runtime state */ ++ if (kcontrol->id.name[0] == PREFIX_OF_TDM_CTR_NAME) ++ return -EINVAL; ++ ++ /* apply set volume value to ADSP from user setting */ ++ if (xf_adsp_set_param(handle_id, cmd_idx, volume) != 0) ++ return -EINVAL; ++ ++ /* get volume from ADSP after setting to confirm */ ++ if (xf_adsp_get_param(handle_id, cmd_idx, &volume_get) != 0) ++ return -EINVAL; ++ ++ /* check if the value has changed */ ++ ret = (volume_get == volume) ? 1 : 0; ++ } else { ++ if (kcontrol->id.name[0] != PREFIX_OF_TDM_CTR_NAME) ++ ctr_if->vol_rate[direction][index] = volume; ++ else ++ ctr_if->tdm_vol_rate[direction] = volume; ++ ++ ret = 1; ++ } ++ ++ return ret; ++} ++ ++/** ************************************************************************** ++ * \brief Get info of Sample Rate Converter control ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] uinfo Pointer to info structure of sample rate ++ * converter control ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_control_sample_rate_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; ++ uinfo->count = 1; ++ uinfo->value.integer.min = -1; ++ uinfo->value.integer.max = 48000; ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Get sample rate value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to sample rate value ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int snd_adsp_control_sample_rate_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ int *rate; ++ int handle_id, handle_state, cmd_idx, direction; ++ unsigned int index; ++ ++ rate = (int *)&ucontrol->value.integer.value[0]; /* PRQA S 310 */ ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ /* set handle state as NULL state and handle ID */ ++ handle_state = XF_HANDLE_NULL; ++ handle_id = -1; ++ ++ /* determine command, direction, handle state, handle ID */ ++ if (kcontrol->id.name[0] == PREFIX_OF_PLAYBACK_CTR_NAME) { ++ cmd_idx = XA_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ direction = DIRECT_PLAYBACK; ++ ++ if (adsp_card->playback[index]) { ++ handle_state = adsp_card->playback[index]->rdr_state; ++ ++ handle_id = ++ adsp_card->playback[index]->renderer->handle_id; ++ } ++ } else if (kcontrol->id.name[0] == PREFIX_OF_CAPTURE_CTR_NAME) { ++ cmd_idx = XA_CAP_CONFIG_PARAM_SAMPLE_RATE; ++ direction = DIRECT_CAPTURE; ++ ++ if (adsp_card->record[index]) { ++ handle_state = adsp_card->record[index]->cap_state; ++ ++ handle_id = ++ adsp_card->record[index]->capture->handle_id; ++ } ++ } else { ++ if (kcontrol->id.name[3] == TDM_PLAYBACK) { ++ cmd_idx = XA_TDM_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ direction = DIRECT_PLAYBACK; ++ ++ if (adsp_card->tdm_playback) { ++ handle_state = adsp_card->tdm_playback->state; ++ ++ handle_id = ++ adsp_card->tdm_playback->tdm_renderer->handle_id; ++ } ++ } else { ++ cmd_idx = XA_TDM_CAP_CONFIG_PARAM_IN_SAMPLE_RATE; ++ direction = DIRECT_CAPTURE; ++ ++ if (adsp_card->tdm_record) { ++ handle_state = adsp_card->tdm_record->state; ++ ++ handle_id = ++ adsp_card->tdm_record->tdm_capture->handle_id; ++ } ++ } ++ } ++ ++ /* get parameter from plugin */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) { ++ if (xf_adsp_get_param(handle_id, cmd_idx, rate) != 0) ++ return -EINVAL; ++ } else { ++ if (kcontrol->id.name[0] != PREFIX_OF_TDM_CTR_NAME) ++ *rate = adsp_card->ctr_if.sample_rate[direction][index]; ++ else ++ *rate = adsp_card->ctr_if.tdm_sample_rate[direction]; ++ } ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Set sample rate value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to sample rate value ++ * \retval 1 Sample rate change ++ * \retval 0 Sample rate does not change ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++/* PRQA S 3673 1 */ ++static int ++snd_adsp_control_sample_rate_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ unsigned int index; ++ int rate; ++ int handle_state, cmd_idx, direction; ++ int ret = 1; ++ ++ rate = (int)ucontrol->value.integer.value[0]; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ /* set handle state as NULL state */ ++ handle_state = XF_HANDLE_NULL; ++ ++ /* determine command, direction and handle state */ ++ if (kcontrol->id.name[0] == PREFIX_OF_PLAYBACK_CTR_NAME) { ++ cmd_idx = XA_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ direction = DIRECT_PLAYBACK; ++ ++ if (adsp_card->playback[index]) ++ handle_state = adsp_card->playback[index]->rdr_state; ++ ++ } else if (kcontrol->id.name[0] == PREFIX_OF_CAPTURE_CTR_NAME) { ++ cmd_idx = XA_CAP_CONFIG_PARAM_SAMPLE_RATE; ++ direction = DIRECT_CAPTURE; ++ ++ if (adsp_card->record[index]) ++ handle_state = adsp_card->record[index]->cap_state; ++ ++ } else { ++ if (kcontrol->id.name[3] == TDM_PLAYBACK) { ++ cmd_idx = XA_TDM_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ direction = DIRECT_PLAYBACK; ++ ++ if (adsp_card->tdm_playback) ++ handle_state = adsp_card->tdm_playback->state; ++ ++ } else { ++ cmd_idx = XA_TDM_CAP_CONFIG_PARAM_IN_SAMPLE_RATE; ++ direction = DIRECT_CAPTURE; ++ ++ if (adsp_card->tdm_record) ++ handle_state = adsp_card->tdm_record->state; ++ } ++ } ++ ++ /* get the value to set */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) ++ return -EINVAL; ++ ++ if (kcontrol->id.name[0] != PREFIX_OF_TDM_CTR_NAME) ++ adsp_card->ctr_if.sample_rate[direction][index] = rate; ++ else ++ adsp_card->ctr_if.tdm_sample_rate[direction] = rate; ++ ++ ret = 1; ++ ++ return ret; ++} ++ ++/** ************************************************************************** ++ * \brief Get info of Equalizer control ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] uinfo Pointer to info structure of Equalizer control ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_control_eqz_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; ++ uinfo->count = MAX_EQZ_PARAM_NUMBER; ++ uinfo->value.integer.min = -1; ++ uinfo->value.integer.max = 0x7fffffff; ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Get equalizer parameters value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to equalizer parameters value ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int snd_adsp_control_eqz_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ int handle_state, direction; ++ int i, j, filter_index; ++ unsigned int index; ++ struct xf_adsp_equalizer *equalizer; ++ struct xf_adsp_equalizer_params *eqz_params; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ /* determin direction of stream */ ++ direction = (kcontrol->id.name[0] == PREFIX_OF_PLAYBACK_CTR_NAME) ? ++ DIRECT_PLAYBACK : DIRECT_CAPTURE; ++ ++ /* set handle state as NULL state, handle ID, equalizer pointer */ ++ handle_state = XF_HANDLE_NULL; ++ equalizer = NULL; ++ ++ /* get component's state */ ++ if (direction == DIRECT_PLAYBACK) { ++ if (adsp_card->playback[index]) { ++ handle_state = adsp_card->playback[index]->eqz_state; ++ equalizer = adsp_card->playback[index]->equalizer; ++ } ++ } else { ++ if (adsp_card->record[index]) { ++ handle_state = adsp_card->record[index]->eqz_state; ++ equalizer = adsp_card->record[index]->equalizer; ++ } ++ } ++ ++ /* perform parameters' values getting */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) { ++ /* get equalizer's parameters */ ++ if (xf_adsp_equalizer_get_params(equalizer) != 0) ++ return -EINVAL; ++ ++ eqz_params = &equalizer->params; ++ } else { ++ eqz_params = &adsp_card->ctr_if.eqz_params[direction][index]; ++ } ++ ++ /* get equalizer type: PARAMETRIC or GRAPHIC */ ++ ucontrol->value.integer.value[0] = eqz_params->eqz_type; ++ ++ /* get parameters' value from Equalizer plugin */ ++ if (eqz_params->eqz_type == XA_REL_EQZ_TYPE_PARAMETRIC) { ++ for (i = 0, filter_index = 1; ++ filter_index <= XA_REL_EQZ_FILTER_NUM; ++ i++, filter_index++) { ++ /* get filter index */ ++ ucontrol->value.integer.value[(i * 6) + 1] = ++ filter_index; ++ ++ /* get frequency centre */ ++ ucontrol->value.integer.value[(i * 6) + 2] = ++ eqz_params->p_coef.fc[i]; ++ ++ /* get bandwidth */ ++ ucontrol->value.integer.value[(i * 6) + 3] = ++ eqz_params->p_coef.band_width[i]; ++ ++ /* get filter type */ ++ ucontrol->value.integer.value[(i * 6) + 4] = ++ eqz_params->p_coef.type[i]; ++ ++ /* get gain base */ ++ ucontrol->value.integer.value[(i * 6) + 5] = ++ eqz_params->p_coef.gain_base[i]; ++ ++ /* get gain */ ++ ucontrol->value.integer.value[(i * 6) + 6] = ++ eqz_params->p_coef.gain[i]; ++ } ++ } else { ++ for (i = 0, filter_index = 1; ++ filter_index <= XA_REL_EQZ_GRAPHIC_BAND_NUM; ++ i++, filter_index++) { ++ /* get band index */ ++ ucontrol->value.integer.value[(i * 2) + 1] = ++ filter_index; ++ ++ /* get graphic gain */ ++ ucontrol->value.integer.value[(i * 2) + 2] = ++ eqz_params->g_coef.gain_g[i]; ++ } ++ ++ j = (i * 2) + 1; ++ ++ /* make the rest of values silent */ ++ while (j < MAX_EQZ_PARAM_NUMBER) { ++ ucontrol->value.integer.value[j] = -1; ++ j++; ++ } ++ } ++ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Set equalizer parameters value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to equalizer parameters value ++ * \retval 1 Equalizer parameters change ++ * \retval 0 Equalizer parameters does not change ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++/* PRQA S 3673 1*/ ++static int snd_adsp_control_eqz_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ int handle_state, direction, filter_idx; ++ int i; ++ int index; ++ struct xf_adsp_equalizer_params *eqz_params = NULL; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ /* determine the direction */ ++ direction = (kcontrol->id.name[0] == PREFIX_OF_PLAYBACK_CTR_NAME) ? ++ DIRECT_PLAYBACK : DIRECT_CAPTURE; ++ ++ /* set handle state as NULL state */ ++ handle_state = XF_HANDLE_NULL; ++ ++ /* get the handle state */ ++ if (direction == DIRECT_PLAYBACK) { ++ if (adsp_card->playback[index]) ++ handle_state = adsp_card->playback[index]->eqz_state; ++ } else { ++ if (adsp_card->record[index]) ++ handle_state = adsp_card->record[index]->eqz_state; ++ } ++ ++ /* perform equalizer's parameters setting */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) ++ return -EINVAL; ++ ++ /* PRQA S 310 1*/ ++ eqz_params = &adsp_card->ctr_if.eqz_params[direction][index]; ++ ++ i = 0; ++ /* PRQA S 3440 1*/ ++ eqz_params->eqz_type = ucontrol->value.integer.value[i]; ++ i++; ++ filter_idx = 0; ++ ++ if (eqz_params->eqz_type == XA_REL_EQZ_TYPE_PARAMETRIC) { ++ while (i < MAX_EQZ_PARAM_NUMBER) { ++ /* get index filter */ ++ /* PRQA S 3440*/ ++ filter_idx = ucontrol->value.integer.value[i]; ++ i++; ++ ++ /* valid index filter is range */ ++ /* (1 to XA_REL_EQZ_FILTER_NUM) */ ++ if (filter_idx >= 1 && ++ filter_idx <= XA_REL_EQZ_FILTER_NUM) { ++ /* PRQA S 3440 5*/ ++ eqz_params->p_coef.fc[filter_idx - 1] = ++ ucontrol->value.integer.value[i]; ++ ++ i++; ++ eqz_params->p_coef.band_width[filter_idx - 1] = ++ ucontrol->value.integer.value[i]; ++ ++ i++; ++ eqz_params->p_coef.type[filter_idx - 1] = ++ ucontrol->value.integer.value[i]; ++ ++ i++; ++ eqz_params->p_coef.gain_base[filter_idx - 1] = ++ ucontrol->value.integer.value[i]; ++ ++ i++; ++ eqz_params->p_coef.gain[filter_idx - 1] = ++ ucontrol->value.integer.value[i]; ++ ++ i++; ++ } ++ /* index filter = -1 means that user */ ++ /* does not set this filter */ ++ else if (filter_idx == -1 || filter_idx == 0) { ++ i += 5; ++ } else { ++ return -EINVAL; ++ } ++ } ++ } else if (eqz_params->eqz_type == XA_REL_EQZ_TYPE_GRAPHIC) { ++ while (i < ((XA_REL_EQZ_GRAPHIC_BAND_NUM * 2) + 1)) { ++ /*get index filter */ ++ /* PRQA S 3440 */ ++ filter_idx = ucontrol->value.integer.value[i++]; ++ ++ if (filter_idx >= 1 && ++ filter_idx <= XA_REL_EQZ_GRAPHIC_BAND_NUM) { ++ eqz_params->g_coef.gain_g[filter_idx - 1] = ++ ucontrol->value.integer.value[i]; ++ i++; ++ ++ } else if (filter_idx == -1 || filter_idx == 0) { ++ i += 1; ++ } else { ++ return -EINVAL; ++ } ++ } ++ } else { ++ return -EINVAL; ++ } ++ ++ return 1; ++} ++ ++/** ************************************************************************** ++ * \brief Get info of Equalizer Switch control ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] uinfo Pointer to info structure of Equalizer ++ * Switch control ++ * \retval 0 Success ++ *****************************************************************************/ ++static int snd_adsp_control_eqz_switch_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; ++ uinfo->count = 1; ++ uinfo->value.integer.min = 0; ++ uinfo->value.integer.max = 1; ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Get equalizer switch value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to equalizer switch value ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int ++snd_adsp_control_eqz_switch_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ int direction; ++ unsigned int index; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ /* determine the direction */ ++ direction = (kcontrol->id.name[0] == PREFIX_OF_PLAYBACK_CTR_NAME) ? ++ DIRECT_PLAYBACK : DIRECT_CAPTURE; ++ ++ /* get the Equalizer switch status */ ++ ucontrol->value.integer.value[0] = ++ adsp_card->ctr_if.eqz_switch[direction][index]; ++ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Set equalizer switch value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to equalizer switch value ++ * \retval 1 Equalizer switch change ++ * \retval 0 Equalizer switch does not change ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++/* PRQA S 3673 1 */ ++static int ++snd_adsp_control_eqz_switch_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ int eqz_switch; ++ int handle_state, direction; ++ unsigned int index; ++ int ret = 0; ++ ++ eqz_switch = ucontrol->value.integer.value[0]; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ /* determine the direction */ ++ direction = (kcontrol->id.name[0] == PREFIX_OF_PLAYBACK_CTR_NAME) ? ++ DIRECT_PLAYBACK : DIRECT_CAPTURE; ++ ++ /* set handle state as NULL state */ ++ handle_state = XF_HANDLE_NULL; ++ ++ /* determine handle state */ ++ if (direction == DIRECT_PLAYBACK) { ++ if (adsp_card->playback[index]) ++ handle_state = adsp_card->playback[index]->rdr_state; ++ } else { ++ if (adsp_card->record[index]) ++ handle_state = adsp_card->record[index]->cap_state; ++ } ++ ++ /* set the status of Equalizer */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) { ++ /* runtime setting is not supported */ ++ ret = -EINVAL; ++ } else { ++ adsp_card->ctr_if.eqz_switch[direction][index] = eqz_switch; ++ ret = 1; ++ } ++ ++ return ret; ++} ++ ++/** ************************************************************************** ++ * \brief Get info of Renderer output channel ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] uinfo Pointer to info structure of Renderer output channel ++ * \retval 0 Success ++ *****************************************************************************/ ++static int ++snd_adsp_control_rdr_out_channel_info(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_info *uinfo) ++{ ++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; ++ uinfo->count = 1; ++ uinfo->value.integer.min = MONAURAL; ++ uinfo->value.integer.max = STEREO; ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Get Renderer output channel's value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to Renderer output channel value ++ * \retval 0 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int ++snd_adsp_control_rdr_out_channel_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ int rdr_out_ch; ++ unsigned int index; ++ int handle_state, handle_id; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ handle_state = XF_HANDLE_NULL; ++ handle_id = -1; ++ ++ /* determine handle state and handle ID */ ++ if (adsp_card->playback[index]) { ++ handle_state = adsp_card->playback[index]->rdr_state; ++ handle_id = adsp_card->playback[index]->renderer->handle_id; ++ } ++ ++ /* get Renderer output channel's value */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) { ++ /* get Renderer output channel's value from Renderer plugin */ ++ if (xf_adsp_get_param(handle_id, ++ XA_RDR_CONFIG_PARAM_OUT_CHANNELS, ++ &rdr_out_ch) != 0) { ++ return -EINVAL; ++ } ++ ++ ucontrol->value.integer.value[0] = rdr_out_ch; ++ } else { ++ ucontrol->value.integer.value[0] = ++ adsp_card->ctr_if.rdr_out_ch[index]; ++ } ++ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Set Renderer output channel's value ++ * ++ * \param[in] kcontrol Pointer to control instance ++ * \param[in] ucontrol Pointer to Renderer output channel value ++ * \retval 1 Success ++ * \retval -EINVAL Error ++ *****************************************************************************/ ++static int ++snd_adsp_control_rdr_out_channel_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_adsp_card *adsp_card = snd_kcontrol_chip(kcontrol); ++ unsigned int index; ++ int handle_state; ++ int ret = 1; ++ ++ /* get the index */ ++ index = kcontrol->id.index; ++ ++ handle_state = XF_HANDLE_NULL; ++ ++ /* determine handle state and handle ID */ ++ if (adsp_card->playback[index]) ++ handle_state = adsp_card->playback[index]->rdr_state; ++ ++ /* get Renderer output channel's value */ ++ if (COMPONENT_IS_READY(handle_state) == TRUE) ++ /* not support runtime setting */ ++ ret = -EINVAL; ++ else ++ adsp_card->ctr_if.rdr_out_ch[index] = ++ ucontrol->value.integer.value[0]; ++ ++ return ret; ++} ++ ++/** control interface for playback's volume rate */ ++/* PRQA S 3218 */ ++static struct snd_kcontrol_new ++snd_adsp_playback_volume_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = PLAYBACK_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX1, ++ .name = PLAYBACK_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX2, ++ .name = PLAYBACK_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX3, ++ .name = PLAYBACK_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++ } ++}; ++ ++/** control interface for Capture's volume rate */ ++/* PRQA S 3218 1*/ ++static struct snd_kcontrol_new ++snd_adsp_capture_volume_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = CAPTURE_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX1, ++ .name = CAPTURE_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX2, ++ .name = CAPTURE_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX3, ++ .name = CAPTURE_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++ } ++}; ++ ++/** control interface for playback's output sample rate */ ++/* PRQA S 3218 1*/ ++static struct snd_kcontrol_new ++snd_adsp_playback_sample_rate_out_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = PLAYBACK_OUT_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX1, ++ .name = PLAYBACK_OUT_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX2, ++ .name = PLAYBACK_OUT_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX3, ++ .name = PLAYBACK_OUT_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++ } ++}; ++ ++/** control interface for Capture's input sample rate */ ++/* PRQA S 3218 */ ++static struct snd_kcontrol_new ++snd_adsp_capture_sample_rate_in_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = CAPTURE_IN_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX1, ++ .name = CAPTURE_IN_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX2, ++ .name = CAPTURE_IN_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX3, ++ .name = CAPTURE_IN_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++ } ++}; ++ ++/** control interface for Equalizer parameters in playback */ ++/* PRQA S 3218 1*/ ++static struct snd_kcontrol_new ++snd_adsp_playback_equalizer_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = PLAYBACK_EQZ_CTR_NAME, ++ .info = &snd_adsp_control_eqz_info, ++ .get = &snd_adsp_control_eqz_get, ++ .put = &snd_adsp_control_eqz_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX1, ++ .name = PLAYBACK_EQZ_CTR_NAME, ++ .info = &snd_adsp_control_eqz_info, ++ .get = &snd_adsp_control_eqz_get, ++ .put = &snd_adsp_control_eqz_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX2, ++ .name = PLAYBACK_EQZ_CTR_NAME, ++ .info = &snd_adsp_control_eqz_info, ++ .get = &snd_adsp_control_eqz_get, ++ .put = &snd_adsp_control_eqz_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX3, ++ .name = PLAYBACK_EQZ_CTR_NAME, ++ .info = &snd_adsp_control_eqz_info, ++ .get = &snd_adsp_control_eqz_get, ++ .put = &snd_adsp_control_eqz_put ++ } ++}; ++ ++/** control interface for Equalizer parameters in record */ ++/* PRQA S 3218 */ ++static struct snd_kcontrol_new ++snd_adsp_capture_equalizer_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = CAPTURE_EQZ_CTR_NAME, ++ .info = &snd_adsp_control_eqz_info, ++ .get = &snd_adsp_control_eqz_get, ++ .put = &snd_adsp_control_eqz_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX1, ++ .name = CAPTURE_EQZ_CTR_NAME, ++ .info = &snd_adsp_control_eqz_info, ++ .get = &snd_adsp_control_eqz_get, ++ .put = &snd_adsp_control_eqz_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX2, ++ .name = CAPTURE_EQZ_CTR_NAME, ++ .info = &snd_adsp_control_eqz_info, ++ .get = &snd_adsp_control_eqz_get, ++ .put = &snd_adsp_control_eqz_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX3, ++ .name = CAPTURE_EQZ_CTR_NAME, ++ .info = &snd_adsp_control_eqz_info, ++ .get = &snd_adsp_control_eqz_get, ++ .put = &snd_adsp_control_eqz_put ++ } ++}; ++ ++/** control interface for Equalizer usage in playback */ ++/* PRQA S 3218 */ ++static struct snd_kcontrol_new ++snd_adsp_playback_equalizer_switch_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = PLAYBACK_EQZ_SWITCH_CTR_NAME, ++ .info = &snd_adsp_control_eqz_switch_info, ++ .get = &snd_adsp_control_eqz_switch_get, ++ .put = &snd_adsp_control_eqz_switch_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX1, ++ .name = PLAYBACK_EQZ_SWITCH_CTR_NAME, ++ .info = &snd_adsp_control_eqz_switch_info, ++ .get = &snd_adsp_control_eqz_switch_get, ++ .put = &snd_adsp_control_eqz_switch_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX2, ++ .name = PLAYBACK_EQZ_SWITCH_CTR_NAME, ++ .info = &snd_adsp_control_eqz_switch_info, ++ .get = &snd_adsp_control_eqz_switch_get, ++ .put = &snd_adsp_control_eqz_switch_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX3, ++ .name = PLAYBACK_EQZ_SWITCH_CTR_NAME, ++ .info = &snd_adsp_control_eqz_switch_info, ++ .get = &snd_adsp_control_eqz_switch_get, ++ .put = &snd_adsp_control_eqz_switch_put ++ } ++}; ++ ++/** control interface for Equalizer usage in record */ ++/* PRQA S 3218 1*/ ++static struct snd_kcontrol_new ++snd_adsp_capture_equalizer_switch_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = CAPTURE_EQZ_SWITCH_CTR_NAME, ++ .info = &snd_adsp_control_eqz_switch_info, ++ .get = &snd_adsp_control_eqz_switch_get, ++ .put = &snd_adsp_control_eqz_switch_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX1, ++ .name = CAPTURE_EQZ_SWITCH_CTR_NAME, ++ .info = &snd_adsp_control_eqz_switch_info, ++ .get = &snd_adsp_control_eqz_switch_get, ++ .put = &snd_adsp_control_eqz_switch_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX2, ++ .name = CAPTURE_EQZ_SWITCH_CTR_NAME, ++ .info = &snd_adsp_control_eqz_switch_info, ++ .get = &snd_adsp_control_eqz_switch_get, ++ .put = &snd_adsp_control_eqz_switch_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX3, ++ .name = CAPTURE_EQZ_SWITCH_CTR_NAME, ++ .info = &snd_adsp_control_eqz_switch_info, ++ .get = &snd_adsp_control_eqz_switch_get, ++ .put = &snd_adsp_control_eqz_switch_put ++ } ++}; ++ ++/** control interface for playback's output channel */ ++static struct snd_kcontrol_new ++snd_adsp_playback_out_channel_control[MAX_DAI_IDX - 1] = { ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .index = RDR_DAI_IDX0, ++ .name = PLAYBACK_OUT_CHANNEL_CTR_NAME, ++ .info = &snd_adsp_control_rdr_out_channel_info, ++ .get = &snd_adsp_control_rdr_out_channel_get, ++ .put = &snd_adsp_control_rdr_out_channel_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ++ .index = RDR_DAI_IDX1, ++ .name = PLAYBACK_OUT_CHANNEL_CTR_NAME, ++ .info = &snd_adsp_control_rdr_out_channel_info, ++ .get = &snd_adsp_control_rdr_out_channel_get, ++ .put = &snd_adsp_control_rdr_out_channel_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ++ .index = RDR_DAI_IDX2, ++ .name = PLAYBACK_OUT_CHANNEL_CTR_NAME, ++ .info = &snd_adsp_control_rdr_out_channel_info, ++ .get = &snd_adsp_control_rdr_out_channel_get, ++ .put = &snd_adsp_control_rdr_out_channel_put ++ }, ++ { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, ++ .index = RDR_DAI_IDX3, ++ .name = PLAYBACK_OUT_CHANNEL_CTR_NAME, ++ .info = &snd_adsp_control_rdr_out_channel_info, ++ .get = &snd_adsp_control_rdr_out_channel_get, ++ .put = &snd_adsp_control_rdr_out_channel_put ++ } ++}; ++ ++/** control interface for TDM playback's volume rate */ ++static struct snd_kcontrol_new snd_adsp_tdm_playback_volume_control = { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .name = TDM_PLAYBACK_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++}; ++ ++/** control interface for TDM capture's volume rate */ ++static struct snd_kcontrol_new snd_adsp_tdm_capture_volume_control = { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .name = TDM_CAPTURE_VOLUME_CTR_NAME, ++ .info = &snd_adsp_control_volume_info, ++ .get = &snd_adsp_control_volume_get, ++ .put = &snd_adsp_control_volume_put ++}; ++ ++/** control interface for TDM playback's output sample rate */ ++static struct snd_kcontrol_new snd_adsp_tdm_playback_sample_rate_out_control = { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .name = TDM_PLAYBACK_OUT_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++}; ++ ++/** control interface for TDM capture's input sample rate */ ++static struct snd_kcontrol_new snd_adsp_tdm_capture_sample_rate_in_control = { ++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, /* PRQA S 1053 5 */ ++ .name = TDM_CAPTURE_IN_RATE_CTR_NAME, ++ .info = &snd_adsp_control_sample_rate_info, ++ .get = &snd_adsp_control_sample_rate_get, ++ .put = &snd_adsp_control_sample_rate_put ++}; ++ ++/** PCM callback function of the sound card */ ++static struct snd_pcm_ops snd_adsp_pcm_ops = { ++ .open = &snd_adsp_pcm_open, /* PRQA S 1053 10 */ ++ .close = &snd_adsp_pcm_close, ++ .ioctl = &snd_pcm_lib_ioctl, ++ .hw_params = &snd_adsp_pcm_hw_params, ++ .hw_free = &snd_adsp_pcm_hw_free, ++ .prepare = &snd_adsp_pcm_prepare, ++ .trigger = &snd_adsp_pcm_trigger, ++ .pointer = &snd_adsp_pcm_pointer, ++ .ack = &snd_adsp_pcm_ack ++}; ++ ++/******************************************************************* ++ * Internal functions ++ * ****************************************************************/ ++ ++/** ************************************************************************** ++ * \brief Process information get from control structure ++ * ++ * \param[in] eqz_params Equalizer parameters object ++ * \param[in] eqz_ctr_params Equalizer parameters stored in control object ++ * \param[in] flag Indicate playback or capture stream ++ *****************************************************************************/ ++static void snd_adsp_get_eqz_params_from_control( ++ struct xf_adsp_equalizer_params *eqz_params, ++ struct xf_adsp_equalizer_params *eqz_ctr_params, bool flag) ++{ ++ int filter_idx; ++ ++ if (flag) { ++ if (eqz_ctr_params->eqz_type >= 0) ++ eqz_params->eqz_type = eqz_ctr_params->eqz_type; ++ ++ for (filter_idx = 0; filter_idx < XA_REL_EQZ_FILTER_NUM; ++ filter_idx++) { ++ if (eqz_ctr_params->p_coef.fc[filter_idx] >= 0) ++ eqz_params->p_coef.fc[filter_idx] = ++ eqz_ctr_params->p_coef.fc[filter_idx]; ++ ++ if (eqz_ctr_params->p_coef.band_width[filter_idx] >= 0) ++ eqz_params->p_coef.band_width[filter_idx] = ++ eqz_ctr_params->p_coef.band_width[filter_idx]; ++ ++ if (eqz_ctr_params->p_coef.type[filter_idx] >= 0) ++ eqz_params->p_coef.type[filter_idx] = ++ eqz_ctr_params->p_coef.type[filter_idx]; ++ ++ if (eqz_ctr_params->p_coef.gain_base[filter_idx] >= 0) ++ eqz_params->p_coef.gain_base[filter_idx] = ++ eqz_ctr_params->p_coef.gain_base[filter_idx]; ++ ++ if (eqz_ctr_params->p_coef.gain[filter_idx] >= 0) ++ eqz_params->p_coef.gain[filter_idx] = ++ eqz_ctr_params->p_coef.gain[filter_idx]; ++ } ++ for (filter_idx = 0; filter_idx < XA_REL_EQZ_GRAPHIC_BAND_NUM; ++ filter_idx++) { ++ if (eqz_ctr_params->g_coef.gain_g[filter_idx] >= 0) ++ eqz_params->g_coef.gain_g[filter_idx] = ++ eqz_ctr_params->g_coef.gain_g[filter_idx]; ++ } ++ } else { ++ memcpy(eqz_ctr_params, eqz_params, sizeof(*eqz_params)); ++ } ++} ++ ++/******************************************************************* ++ * ALSA ADSP Platform driver interface ++ * ****************************************************************/ ++ ++/** **************************************************************************** ++ * \brief Register control interface and preallocate ALSA buffer ++ * ++ * \param[in] runtime Pointer to runtime PCM data ++ * \retval 0 Success ++ * \retval -EINVAL Cannot register control interface ++ ******************************************************************************/ ++static int snd_adsp_pcm_new(struct snd_soc_pcm_runtime *runtime) ++{ ++ int i = 0, err = 0; ++ int id; ++ struct snd_card *card; ++ struct snd_adsp_card *adsp_card; ++ int alsa_buf_sz = 0; ++ ++ /* get sound card data */ ++ card = runtime->card->snd_card; ++ ++ /* get driver data */ ++ adsp_card = snd_soc_dai_get_drvdata(runtime->cpu_dai); ++ ++ /* get the ID of CPU DAI */ ++ id = runtime->cpu_dai->id; ++ ++ /* register control interfaces */ ++ if (id == RDR_DAI_IDX0 || id == RDR_DAI_IDX1 || ++ id == RDR_DAI_IDX2 || id == RDR_DAI_IDX3) { ++ struct snd_kcontrol *kctl[RDR_CONTROL_NUM]; ++ void *rdr_ctr[RDR_CONTROL_NUM] = { ++ &snd_adsp_playback_volume_control[id], /* PRQA S 1031 */ ++ &snd_adsp_capture_volume_control[id], ++ &snd_adsp_playback_sample_rate_out_control[id], ++ &snd_adsp_capture_sample_rate_in_control[id], ++ &snd_adsp_playback_equalizer_control[id], ++ &snd_adsp_capture_equalizer_control[id], ++ &snd_adsp_playback_equalizer_switch_control[id], ++ &snd_adsp_capture_equalizer_switch_control[id], ++ &snd_adsp_playback_out_channel_control[id] ++ }; ++ ++ /* add basic control instance */ ++ for (i = 0; i < RDR_CONTROL_NUM; i++) { ++ kctl[i] = snd_ctl_new1(rdr_ctr[i], adsp_card); ++ err = snd_ctl_add(card, kctl[i]); ++ if (err < 0) ++ return -EINVAL; ++ } ++ ++ /* assign ALSA buffer size */ ++ alsa_buf_sz = MAX_BUFFER_BYTES; ++ ++ /* enable MIX feature from the 2nd playback/record stream */ ++ if (adsp_card->ctr_if.mix_usage == MIX_UNUSED) ++ adsp_card->ctr_if.mix_usage = FIRST_RUN; ++ else if (adsp_card->ctr_if.mix_usage == FIRST_RUN) ++ adsp_card->ctr_if.mix_usage = SECOND_RUN; ++ ++ } else { ++ struct snd_kcontrol *kctl[TDM_CONTROL_NUM]; ++ void *tdm_ctr[TDM_CONTROL_NUM] = { ++ &snd_adsp_tdm_playback_volume_control, ++ &snd_adsp_tdm_playback_sample_rate_out_control, ++ &snd_adsp_tdm_capture_volume_control, ++ &snd_adsp_tdm_capture_sample_rate_in_control ++ }; ++ ++ /* add basic control instances */ ++ for (i = 0; i < TDM_CONTROL_NUM; i++) { ++ kctl[i] = snd_ctl_new1(tdm_ctr[i], adsp_card); ++ err = snd_ctl_add(card, kctl[i]); ++ if (err < 0) ++ return -EINVAL; ++ } ++ ++ /* assign ALSA buffer size */ ++ alsa_buf_sz = TDM_MAX_BUFFER_BYTES; ++ } ++ ++ return snd_pcm_lib_preallocate_pages_for_all(runtime->pcm, ++ SNDRV_DMA_TYPE_CONTINUOUS, ++ snd_dma_continuous_data(GFP_KERNEL), ++ alsa_buf_sz, alsa_buf_sz); ++} ++ ++/* **************************************************************************** ++ * ALSA ADSP DAI register ++ * ***************************************************************************/ ++ ++/** callback function of platform driver */ ++static struct snd_soc_platform_driver snd_adsp_platform = { ++ .pcm_new = &snd_adsp_pcm_new, /* PRQA S 1053 *//* PRQA S 0674 */ ++ .ops = &snd_adsp_pcm_ops, ++}; ++ ++/** component information of driver */ ++static const struct snd_soc_component_driver snd_adsp_component = { ++ .name = "snd_adsp", /* PRQA S 1053 */ ++}; ++ ++/** DAI information of ADSP ALSA driver */ ++static struct snd_soc_dai_driver snd_adsp_dai[MAX_DAI_IDX] = { ++ { ++ /* PRQA S 1053 */ ++ .id = RDR_DAI_IDX0, ++ .name = "adsp-dai.0", ++ .playback.stream_name = "Playback0", ++ .capture.stream_name = "Capture0", ++ }, ++ { ++ .id = RDR_DAI_IDX1, ++ .name = "adsp-dai.1", ++ .playback.stream_name = "Playback1", ++ .capture.stream_name = "Capture1", ++ }, ++ { ++ .id = RDR_DAI_IDX2, ++ .name = "adsp-dai.2", ++ .playback.stream_name = "Playback2", ++ .capture.stream_name = "Capture2", ++ }, ++ { ++ .id = RDR_DAI_IDX3, ++ .name = "adsp-dai.3", ++ .playback.stream_name = "Playback3", ++ .capture.stream_name = "Capture3", ++ }, ++ { ++ .id = TDM_DAI_IDX, ++ .name = "adsp-tdm-dai", ++ .playback.stream_name = "TDM Playback", ++ .capture.stream_name = "TDM Capture", ++ } ++}; ++ ++/** *************************************************************************** ++ * \brief Register platform driver and ADSP ALSA sound card ++ * ++ * \param[in] pdev Pointer to platform driver data ++ * \retval 0 Success ++ * \retval -ENOMEM Cannot allocate driver's data ++ * \retval -EINVAL Cannot register platform driver or sound card ++ ****************************************************************************/ ++static int snd_adsp_probe(struct platform_device *pdev) ++{ ++ struct snd_adsp_card *adsp_card; ++ int i; ++ ++ /* allocate a card data structure */ ++ adsp_card = kmalloc(sizeof(*adsp_card), GFP_KERNEL); ++ if (!adsp_card) ++ return -ENOMEM; ++ ++ /* init parameters */ ++ memset(adsp_card, 0, sizeof(*adsp_card)); /* PRQA S 3200 */ ++ ++ /* PRQA S 3200 1*/ ++ memset(&adsp_card->ctr_if, -1, sizeof(struct snd_adsp_control)); ++ ++ /* disable Equalizer for all streams */ ++ for (i = 0; i < (MAX_DAI_IDX - 1); i++) { ++ adsp_card->ctr_if.eqz_switch[DIRECT_CAPTURE][i] = 0; ++ adsp_card->ctr_if.eqz_switch[DIRECT_PLAYBACK][i] = 0; ++ } ++ ++ /* disable MIX function for all */ ++ adsp_card->ctr_if.mix_usage = MIX_UNUSED; ++ ++ /* save driver data */ ++ dev_set_drvdata(&pdev->dev, adsp_card); ++ ++ /* register platform device */ ++ if (snd_soc_register_platform(&pdev->dev, &snd_adsp_platform) < 0) { ++ snd_soc_unregister_platform(&pdev->dev); ++ return -EINVAL; ++ } ++ ++ /* fill format information of sound DAI driver for Rdr/Cap function */ ++ for (i = 0; i < (MAX_DAI_IDX - 1); i++) { ++ snd_adsp_dai[i].playback.rates = SND_ADSP_SAMPLE_RATES; ++ snd_adsp_dai[i].playback.formats = SND_ADSP_PCM_WIDTHS; ++ snd_adsp_dai[i].playback.channels_min = MIN_CHANNEL; ++ snd_adsp_dai[i].playback.channels_max = MAX_CHANNEL; ++ ++ snd_adsp_dai[i].capture.rates = SND_ADSP_SAMPLE_RATES; ++ snd_adsp_dai[i].capture.formats = SND_ADSP_PCM_WIDTHS; ++ snd_adsp_dai[i].capture.channels_min = MIN_CHANNEL; ++ snd_adsp_dai[i].capture.channels_max = MAX_CHANNEL; ++ } ++ ++ /* fill format information of sound DAI driver for TDM function */ ++ snd_adsp_dai[i].playback.rates = SND_ADSP_SAMPLE_RATES; ++ snd_adsp_dai[i].playback.formats = SND_ADSP_PCM_WIDTHS; ++ snd_adsp_dai[i].playback.channels_min = TDM_MIN_CHANNEL; ++ snd_adsp_dai[i].playback.channels_max = TDM_MAX_CHANNEL; ++ ++ snd_adsp_dai[i].capture.rates = SND_ADSP_SAMPLE_RATES; ++ snd_adsp_dai[i].capture.formats = SND_ADSP_PCM_WIDTHS; ++ snd_adsp_dai[i].capture.channels_min = TDM_MIN_CHANNEL; ++ snd_adsp_dai[i].capture.channels_max = TDM_MAX_CHANNEL; ++ ++ /* register CPU dai */ ++ if (snd_soc_register_component(&pdev->dev, &snd_adsp_component, ++ snd_adsp_dai, ++ ARRAY_SIZE(snd_adsp_dai)) < 0) { ++ snd_soc_unregister_platform(&pdev->dev); ++ return -EINVAL; ++ } ++ ++ dev_info(&pdev->dev, "probed\n"); ++ ++ /* success */ ++ return 0; ++} ++ ++/** ************************************************************************** ++ * \brief Unregister platform driver and ADSP ALSA sound card ++ * ++ * \param[in] pdev Pointer platform driver data ++ * \retval 0 Success ++ * \retval -EINVAL Invalid driver's data ++ *****************************************************************************/ ++static int snd_adsp_remove(struct platform_device *pdev) ++{ ++ /* get ADSP sound card data */ ++ struct snd_adsp_card *adsp_card = dev_get_drvdata(&pdev->dev); ++ ++ if (!adsp_card) ++ return -ENODEV; ++ ++ /* release the ADSP sound card */ ++ kfree(adsp_card); ++ ++ /* unregister platform driver */ ++ snd_soc_unregister_component(&pdev->dev); ++ snd_soc_unregister_platform(&pdev->dev); ++ ++ /* success */ ++ return 0; ++} ++ ++/** ADSP ALSA driver information */ ++static const struct of_device_id snd_adsp_id[] = { ++ { .compatible = "renesas,rcar_adsp_sound_gen3", }, /* PRQA S 1053 */ ++}; ++MODULE_DEVICE_TABLE(of, snd_adsp_id); ++ ++/** platform driver of ADSP ALSA sound card */ ++static struct platform_driver snd_adsp_driver = { ++ .driver = { /* PRQA S 1053 */ ++ .name = "rcar_adsp_sound", ++ .of_match_table = snd_adsp_id, ++ }, ++ .probe = snd_adsp_probe, ++ .remove = snd_adsp_remove, ++}; ++module_platform_driver(snd_adsp_driver); /* PRQA S 0651 */ ++ ++MODULE_AUTHOR("Renesas AudioDSP"); ++MODULE_DESCRIPTION("Platform driver for ADSP"); ++MODULE_LICENSE("GPL v2"); ++MODULE_ALIAS("platform:ADSP-PCM-AUDIO"); +diff --git a/sound/soc/adsp/xf-adsp-base.c b/sound/soc/adsp/xf-adsp-base.c +new file mode 100644 +index 0000000..3ad9445 +--- /dev/null ++++ b/sound/soc/adsp/xf-adsp-base.c +@@ -0,0 +1,2259 @@ ++/** *************************************************************************** ++ *\file xf-adsp-base.c ++ *\brief Source file for ADSP Base Control layer ++ *\addtogroup ADSP Driver ++ ****************************************************************************** ++ *\date Oct. 21, 2017 ++ *\author Renesas Electronics Corporation ++ ****************************************************************************** ++ *\par Copyright ++ * ++ * Copyright(c) 2016 Renesas Electoronics Corporation ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a copy ++ * of this software and associated documentation files (the "Software"), to deal ++ * in the Software without restriction, including without limitation the rights ++ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++ * copies of the Software, and to permit persons to whom the Software is ++ * furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included in ++ * all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ++ * THE SOFTWARE. ++ ******************************************************************************/ ++ ++#include <linux/slab.h> ++#include <linux/kthread.h> ++#include <linux/wait.h> ++ ++#include "xf-adsp-base.h" ++ ++#define XF_AUX_POOL_SIZE (16) /**< size of auxiliary pool*/ ++#define XF_AUX_POOL_MSG_LENGTH (256) /**< size of auxiliary buffer */ ++ ++#define XF_PROXY_ALIGN (64) /**< proxy alignment */ ++ ++/** \def XF_ALIGNED(size) ++ * Get properly aligned buffer length ++ */ ++#define XF_ALIGNED(size)\ ++((((size) + XF_PROXY_ALIGN) - 1) & ~(XF_PROXY_ALIGN - 1)) /* PRQA S 3453 */ ++ ++#ifndef offset_of ++/** \def offset_of(type, member) ++ * Return the offset of member in type structuer in byte ++ */ ++#define offset_of(type, member) \ ++ ((int)(long int)&(((const type *)(0))->member)) /* PRQA S 3453 */ ++#endif ++ ++/************************************************* ++ * Variable and and function declaration ++ * **********************************************/ ++ ++/** ADSP base control data */ ++static struct xf_adsp_base *base; ++ ++/* function declaration */ ++static int xf_adsp_base_register_handle(void *private_data, ++ struct xf_callback_func *cb, ++ int comp_id); ++static inline struct xf_handle *xf_adsp_base_get_handle(int handle_id); ++static int xf_adsp_base_free_handle(int handle_id); ++static void xf_adsp_base_init_handle(void); ++static int xf_adsp_base_get_valid_handle(void); ++static int xf_send_and_receive(struct xf_message *msg); ++static int xf_response_thread(void *data); ++static void xf_buffer_put(struct xf_buffer *buffer); ++static u32 xf_buffer_length(struct xf_buffer *b); ++static struct xf_buffer *xf_buffer_get(struct xf_pool *pool); ++static void *xf_buffer_data(struct xf_buffer *b); ++static int xf_adsp_unregister(int comp_id); ++static int xf_adsp_register(char *name, int *comp_id); ++ ++/************************************************* ++ * Helper function to process pool data ++ * **********************************************/ ++ ++/** *********************************************************** ++ * \brief get buffer from given pool ++ * ++ * \param[in] pool Data pool address ++ * \retval b Pointer to buffer address in pool ++ **************************************************************/ ++static struct xf_buffer *xf_buffer_get(struct xf_pool *pool) ++{ ++ struct xf_buffer *b; ++ ++ b = pool->free; ++ if (b) { ++ pool->free = b->link.next; ++ b->link.pool = pool; ++ } ++ return b; ++} ++ ++/*********************************************************** ++ *\brief return buffer back to pool ++ * ++ *\param[in] buffer Pointer to the buffer data ++ ************************************************************/ ++static void xf_buffer_put(struct xf_buffer *buffer) ++{ ++ struct xf_pool *pool = buffer->link.pool; ++ ++ buffer->link.next = pool->free; ++ pool->free = buffer; ++} ++ ++/*********************************************************** ++ *\brief get the address of the given buffer data ++ * ++ *\param[in] b Pointer to the buffer data ++ *\retval address Address of buffer data ++ ************************************************************/ ++static void *xf_buffer_data(struct xf_buffer *b) ++{ ++ return b->address; ++} ++ ++/************************************************************ ++ *\brief get the length of the given buffer data ++ * ++ *\param[in] b Pointer to the buffer data ++ *\retval length Size of buffer data ++ ************************************************************/ ++static u32 xf_buffer_length(struct xf_buffer *b) /* PRQA S 3673 */ ++{ ++ return b->link.pool->length; ++} ++ ++/************************************************************ ++ *\brief set data to the given command message ++ * ++ *\param[out] m Pointer to the command message ++ *\param[in] id Message ID ++ *\param[in] opcode Message opcode ++ *\param[in] length Message length ++ *\param[in] buf Pointer to the buffer data ++ *\param[in] next Pointer to the next message ++ *\retval m Pointer to the command message ++ ************************************************************/ ++static inline struct xf_message * ++xf_create_msg(struct xf_message *m, u32 id, u32 opcode, u32 length, void *buf, ++ struct xf_message *next) ++{ ++ if (m) { ++ m->id = id; ++ m->opcode = opcode; ++ m->length = length; ++ m->buffer = buf; ++ m->next = next; ++ } ++ ++ return m; ++} ++ ++/***************************************************************** ++ *\brief synchronous send and wait for response message from proxy ++ * ++ *\param[in] msg Pointer to the command message ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ ****************************************************************/ ++static int xf_send_and_receive(struct xf_message *msg) ++{ ++ int err; ++ int opcode = msg->opcode; ++ ++ /* reset the base flag */ ++ spin_lock(&base->lock); ++ base->base_flag = FALSE; ++ spin_unlock(&base->lock); ++ ++ err = base->cmd.send(base->client, (void *)msg); ++ if (err != 0) ++ return err; ++ ++ /* sleep and wait for the response wake up event */ ++ if (wait_event_interruptible(base->base_wait, ++ base->base_flag || base->err_flag)) { ++ return -EINVAL; ++ } ++ ++ if (base->err_flag != 0) { ++ spin_lock(&base->lock); ++ base->err_flag = FALSE; ++ spin_unlock(&base->lock); ++ return -EINVAL; ++ } ++ ++ /* save the response message */ ++ /* PRQA S 3200 */ ++ memcpy(msg, &base->base_msg, sizeof(struct xf_message)); ++ ++ /* check if the reponsed message is right */ ++ if (msg->opcode != opcode) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++/************************************************************* ++ *\brief send a message to proxy ++ * ++ *\param[in] msg Pointer to the command message ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++static inline int xf_send(struct xf_message *msg) ++{ ++ return base->cmd.send(base->client, (void *)msg); ++} ++ ++/** *********************************************************** ++ *\brief receive message from proxy ++ * ++ *\param[in] msg Pointer to store the response message ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++static inline int xf_receive(struct xf_message *msg) ++{ ++ /* do not wait here */ ++ return base->cmd.recv(base->client, (void *)msg); ++} ++ ++/** *********************************************************** ++ *\brief thread for receive response data ++ **************************************************************/ ++static int xf_response_thread(void *data) ++{ ++ struct xf_message msg; ++ struct xf_handle *handle; ++ int id; ++ ++ /* set polling to wait the response message */ ++ spin_lock(&base->lock); ++ base->wait_flag = FALSE; ++ spin_unlock(&base->lock); ++ ++ while (!kthread_should_stop()) { ++ if (base->cmd.poll(base->client, &base->wait_flag) != 0) ++ continue; ++ ++ if (xf_receive(&msg) != 0) ++ continue; ++ ++ /* get the handle id */ ++ id = XF_AP_CLIENT(msg.id); ++ ++ /* check the destination of the response message */ ++ if (id == 0) { ++ /* message is from base control */ ++ /* PRQA S 3200 1*/ ++ memcpy(&base->base_msg, &msg, ++ sizeof(struct xf_message)); ++ ++ spin_lock(&base->lock); ++ base->base_flag = TRUE; ++ spin_unlock(&base->lock); ++ ++ wake_up(&base->base_wait); ++ continue; ++ } ++ ++ /* get handle data */ ++ handle = xf_adsp_base_get_handle(id); ++ ++ if (handle == 0) ++ continue; ++ ++ switch (msg.opcode) { ++ case XF_EMPTY_THIS_BUFFER: /* PRQA S 0594 */ ++ handle->cb->empty_buf_done(handle->private_data, ++ msg.opcode, ++ msg.length, ++ msg.buffer); ++ break; ++ case XF_FILL_THIS_BUFFER: /* PRQA S 0594 */ ++ handle->cb->fill_buf_done(handle->private_data, ++ msg.opcode, ++ msg.length, ++ msg.buffer); ++ break; ++ case XF_SET_PARAM: /* PRQA S 0594 4 */ ++ case XF_GET_PARAM: ++ case XF_ROUTE: ++ case XF_UNROUTE: ++ /* message is from base control */ ++ memcpy(&base->base_msg, &msg, ++ sizeof(struct xf_message)); /* PRQA S 3200 */ ++ ++ spin_lock(&base->lock); ++ base->base_flag = TRUE; ++ spin_unlock(&base->lock); ++ ++ wake_up(&base->base_wait); ++ break; ++ default: ++ /* error has occurred */ ++ handle->cb->event_handler(handle->private_data); ++ ++ xf_adsp_base_free_handle(id); /* PRQA S 3200 */ ++ ++ spin_lock(&base->lock); ++ base->err_flag = TRUE; ++ spin_unlock(&base->lock); ++ ++ wake_up(&base->base_wait); ++ break; ++ } ++ } ++ ++ pr_info("ADSP base thread was exited\n"); ++ ++ do_exit(0); ++ return 0; ++} ++ ++/************************************************************* ++ * \brief register component to ADSP ++ * ++ * \param[in] name Name string of component ++ * \param[out] comp_id Store the registered component ID ++ * \retval 0 Success ++ * \retval -EINVAL Failed ++ **************************************************************/ ++static int xf_adsp_register(char *name, int *comp_id) /* PRQA S 3673 */ ++{ ++ struct xf_message msg; ++ struct xf_buffer *b = xf_buffer_get(base->aux_pool); ++ int err = 0; ++ ++ msg.id = __XF_MSG_ID(__XF_AP_PROXY(0), __XF_DSP_PROXY(0)); ++ msg.opcode = XF_REGISTER; ++ msg.length = strlen(name) + 1; ++ msg.buffer = xf_buffer_data(b); ++ ++ /* copy identify name of ADSP component */ ++ if (msg.length <= xf_buffer_length(b)) ++ strncpy(msg.buffer, name, msg.length); /* PRQA S 3200 */ ++ else ++ strncpy(msg.buffer, name, xf_buffer_length(b));/* PRQA S 3200 */ ++ ++ err = xf_send_and_receive(&msg); ++ if (err != 0) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* save the registered component ID */ ++ *comp_id = XF_MSG_SRC(msg.id); ++ ++exit: ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ * \brief unregister component from ADSP ++ * \param[in] comp_id Registered component ID ++ * \retval 0 Success ++ * \retval -EINVAL Failed ++ **************************************************************/ ++static int xf_adsp_unregister(int comp_id) ++{ ++ struct xf_message msg; ++ ++ xf_create_msg(&msg, __XF_MSG_ID(__XF_AP_PROXY(0), comp_id), ++ XF_UNREGISTER, 0, NULL, NULL); /* PRQA S 3200 */ ++ ++ return xf_send_and_receive(&msg); ++} ++ ++/*************************************************************** ++ * APIs for ADSP component helper ++ * ************************************************************/ ++/** *********************************************************** ++ * \brief allocate memory pool from shared memory ++ * \param[in] pool_size Number of buffer need to allocate ++ * \param[in] buf_length Size of each buffer in bytes ++ * \retval pool Pointer to allocated pool ++ * \retval -EINVAL Invalid base data ++ * \retval -ENOMEM Out of memory resource ++ **************************************************************/ ++struct xf_pool *xf_adsp_allocate_mem_pool(int pool_size, int buf_length) ++{ ++ void *data; ++ u32 number; ++ struct xf_buffer *b; ++ struct xf_message msg; ++ struct xf_pool *pool; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return ERR_PTR(-EINVAL); /* PRQA S 0306 */ ++ ++ xf_create_msg(&msg, __XF_MSG_ID(__XF_AP_PROXY(0), __XF_DSP_PROXY(0)), ++ XF_ALLOC, ++ buf_length * pool_size, NULL, NULL); /* PRQA S 3200 */ ++ ++ err = xf_send_and_receive(&msg); ++ if (err != 0) ++ return ERR_PTR(-ENOMEM); /* PRQA S 0306 */ ++ ++ /* PRQA S 0306 1 */ ++ pool = kmalloc(offset_of(struct xf_pool, buffer) + ++ (pool_size * sizeof(struct xf_buffer)), GFP_KERNEL); ++ ++ if (!pool) ++ return ERR_PTR(-ENOMEM); /* PRQA S 0306 */ ++ ++ pool->length = buf_length; ++ pool->number = pool_size; ++ pool->p = msg.buffer; ++ ++ number = pool_size; ++ for (pool->free = b = &pool->buffer[0], data = pool->p; ++ number > 0; number--, b++) { /* PRQA S 2462,3418,0489 */ ++ /* set address of the buffer */ ++ b->address = data; ++ ++ /* fill buffer into free list */ ++ if (number == 1) ++ b->link.next = NULL; ++ else ++ b->link.next = b + 1; /* PRQA S 0489 */ ++ ++ /* advance data pointer in contigous buffer */ ++ data += buf_length; /* PRQA S 0550 */ ++ } ++ ++ return pool; ++} ++ ++/** *********************************************************** ++ *\brief return memory to shared memory ++ *\param[in] pool Data pool address ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base or pool data ++ **************************************************************/ ++int xf_adsp_free_mem_pool(struct xf_pool *pool) ++{ ++ struct xf_message msg; ++ ++ /* check the sane ADSP base pool data*/ ++ if (!base || !pool) ++ return -EINVAL; ++ ++ xf_create_msg(&msg, __XF_MSG_ID(__XF_AP_PROXY(0), __XF_DSP_PROXY(0)), ++ XF_FREE, pool->number * pool->length, ++ pool->p, NULL); /* PRQA S 3200 */ ++ ++ xf_send_and_receive(&msg); /* PRQA S 3200 */ ++ ++ kfree(pool); ++ ++ return 0; ++} ++ ++/** *********************************************************** ++ *\brief get buffer from given pool ++ * ++ *\param[in] pool Data pool address ++ *\param[in] index Buffer index ++ *\retval b Pointer to buffer address in pool ++ *\retval -EINVAL Invalid pool or index ++ **************************************************************/ ++char *xf_adsp_get_data_from_pool(struct xf_pool *pool, int index) ++{ ++ struct xf_buffer *buf[XF_BUF_POOL_SIZE] = {0}; ++ char *data; ++ int i; ++ ++ /* check the sane pool data*/ ++ if (!pool) ++ return ERR_PTR(-EINVAL); /* PRQA S 306 */ ++ ++ /* check the index is valid */ ++ if (index > (pool->number - 1)) ++ return ERR_PTR(-EINVAL); /* PRQA S 306 */ ++ ++ /* get buffer from pool */ ++ for (i = 0; i <= index; i++) ++ buf[i] = xf_buffer_get(pool); ++ ++ /* get data from buffer */ ++ data = xf_buffer_data(buf[index]); ++ ++ /* return buffer to pool */ ++ for (i = index; i >= 0; i--) ++ xf_buffer_put(buf[i]); ++ ++ return data; ++} ++ ++/** *********************************************************** ++ *\brief send empty this buffer command to ADSP framework ++ * ++ *\param[in] handle_id ID of the registered handle ++ *\param[in] buffer Pointer to data buffer ++ *\param[in] length Size of buffer in bytes ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_empty_this_buffer(int handle_id, char *buffer, int length) ++{ ++ struct xf_message msg; ++ struct xf_handle *handle; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ /* submit message to port 0 of component */ ++ /* PRQA S 3200 2 */ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_EMPTY_THIS_BUFFER, length, buffer, NULL); ++ ++ xf_send(&msg); /* PRQA S 3200 */ ++ ++ return 0; ++} ++ ++/** *********************************************************** ++ *\brief send fill this buffer command to ADSP framework ++ * ++ *\param[in] handle_id ID of the registered handle ++ *\param[in] buffer Pointer to data buffer ++ *\param[in] length Size of buffer in bytes ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_fill_this_buffer(int handle_id, char *buffer, int length) ++{ ++ struct xf_message msg; ++ struct xf_handle *handle; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ /* submit message to port 1 of component */ ++ /* PRQA S 3200 2 */ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 1)), ++ XF_FILL_THIS_BUFFER, length, buffer, NULL); ++ ++ xf_send(&msg); /* PRQA S 3200 */ ++ ++ return 0; ++} ++ ++/** *********************************************************** ++ *\brief route data between two registered ADSP plugins ++ * ++ *\param[in] src_handle_id Handle ID of source plugin ++ *\param[in] dst_handle_id Handle ID of sink plugin ++ *\param[in] buf_cnt Number of buffer in tunnel ++ *\param[in] buf_size Size of each buffer in tunnel ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int ++xf_adsp_route(int src_handle_id, int dst_handle_id, int buf_cnt, int buf_size) ++{ ++ struct xf_route_port_msg *route_msg; ++ struct xf_message msg; ++ struct xf_buffer *b; ++ struct xf_handle *dst_handle, *src_handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ /* get handle data */ ++ dst_handle = xf_adsp_base_get_handle(dst_handle_id); ++ src_handle = xf_adsp_base_get_handle(src_handle_id); ++ ++ if (!dst_handle || !src_handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ route_msg = xf_buffer_data(b); ++ ++ /* route information */ ++ route_msg->dst = __XF_PORT_SPEC2(dst_handle->comp_id, 0); ++ route_msg->alloc_align = 4; ++ route_msg->alloc_number = buf_cnt; ++ route_msg->alloc_size = buf_size; ++ ++ /* PRQA S 3200 2*/ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, src_handle_id), ++ __XF_PORT_SPEC2(src_handle->comp_id, 1)), ++ XF_ROUTE, sizeof(*route_msg), route_msg, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief set a single parameter ++ * ++ *\param[in] handle_id ID of registered handle ++ *\param[in] index Sub-command index of parameter ++ *\param[in] value the setting value ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_set_param(int handle_id, int index, int value) ++{ ++ struct xf_message msg; ++ struct xf_buffer *b; ++ struct xf_set_param_msg *msg_params; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ msg_params = xf_buffer_data(b); ++ ++ msg_params->item[0].id = index; ++ msg_params->item[0].value = value; ++ ++ /* PRQA S 3200 2 */ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_SET_PARAM, XF_SET_PARAM_CMD_LEN(1), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief get a single parameter ++ * ++ *\param[in] handle_id ID of registered handle ++ *\param[in] index Sub-command index of parameter ++ *\param[out] value Store the getting value ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_get_param(int handle_id, int index, int *value) ++{ ++ struct xf_message msg; ++ struct xf_buffer *b; ++ union xf_get_param_msg *msg_params; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base and value data */ ++ if (!base || !value) ++ return -EINVAL; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ msg_params = xf_buffer_data(b); ++ ++ msg_params->c.id[0] = index; ++ ++ /* PRQA S 3200 2 */ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_GET_PARAM, XF_GET_PARAM_CMD_LEN(1), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ if (err != 0) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* save the received parameters */ ++ *value = msg_params->r.value[0]; ++ ++exit: ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/*************************************************** ++ * APIs for ADSP base control ++ * ************************************************/ ++ ++/** *********************************************************** ++ *\brief initialize ADSP base's instance ++ * ++ *\retval 0 Success ++ *\retval -EINVAL ADSP base's instance has been initialized ++ *\retval -ENOMEM Cannot allocate memory for ADSP base ++ *\retval -EBUSY Cannot register client to proxy ++ **************************************************************/ ++int xf_adsp_base_create(struct xf_adsp_base_cmd *cmd) ++{ ++ int err = 0; ++ ++ if (base != 0) ++ return -EINVAL; ++ ++ if (!cmd || !cmd->recv || !cmd->send || !cmd->poll || ++ !cmd->client_register || !cmd->client_unregister) ++ return -EINVAL; ++ ++ base = kmalloc(sizeof(*base), GFP_KERNEL); ++ if (!base) ++ return -ENOMEM; ++ ++ memset(base, 0, sizeof(struct xf_adsp_base)); /* PRQA S 3200 */ ++ ++ /* store the proxy command */ ++ memcpy(&base->cmd, cmd, sizeof(struct xf_adsp_base_cmd)); ++ ++ /* create client to connect from proxy driver */ ++ err = base->cmd.client_register(&base->client); ++ if (err != 0) ++ goto err3; /* PRQA S 2001 */ ++ ++ /* initialize waiting queue */ ++ init_waitqueue_head(&base->base_wait); ++ ++ /* initialize handle */ ++ xf_adsp_base_init_handle(); ++ ++ /* create thread to get the responsed message from proxy */ ++ base->rsp_thread = kthread_run(&xf_response_thread, ++ (void *)base, "adsp base"); ++ ++ if (base->rsp_thread != 0) { ++ pr_info("ADSP base thread has been started.\n"); ++ } else { ++ pr_info("Failed in create base thread\n"); ++ err = -ENOMEM; ++ goto err2; /* PRQA S 2001 */ ++ } ++ ++ /* allocate auxiliary pool for component usage */ ++ base->aux_pool = xf_adsp_allocate_mem_pool( ++ XF_AUX_POOL_SIZE, ++ XF_ALIGNED(XF_AUX_POOL_MSG_LENGTH)); ++ ++ if (IS_ERR(base->aux_pool)) { /* PRQA S 306 */ ++ err = -ENOMEM; ++ goto err1; /* PRQA S 2001 */ ++ } ++ ++ pr_info("ADSP base was created\n"); ++ return 0; ++ ++err1: ++ /* cancel the waitting queue */ ++ spin_lock(&base->lock); ++ base->wait_flag = TRUE; ++ spin_unlock(&base->lock); ++ ++ /* stop thread inadvance */ ++ kthread_stop(base->rsp_thread); ++ ++err2: ++ base->cmd.client_unregister(base->client); ++ ++err3: ++ kfree(base); ++ base = NULL; ++ ++ return err; ++} ++EXPORT_SYMBOL(xf_adsp_base_create); /* PRQA S 0651 */ ++ ++/** *********************************************************** ++ *\brief deinitialize ADSP base's instance ++ * ++ *\retval 0 Success ++ *\retval -EINVAL Invalid ADSP base's instance ++ **************************************************************/ ++int xf_adsp_base_destroy(void) ++{ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ /* free auxiliary pool to shared memory */ ++ xf_adsp_free_mem_pool(base->aux_pool); /* PRQA S 3200 */ ++ ++ /* cancel wait the response message, go to stop process */ ++ spin_lock(&base->lock); ++ base->wait_flag = TRUE; ++ spin_unlock(&base->lock); ++ ++ /* stop response thread */ ++ kthread_stop(base->rsp_thread); ++ ++ /* unregister client */ ++ base->cmd.client_unregister(base->client); ++ ++ kfree(base); ++ base = NULL; ++ ++ pr_info("ADSP base was destroyed\n"); ++ return 0; ++} ++EXPORT_SYMBOL(xf_adsp_base_destroy); /* PRQA S 0651 */ ++ ++/** *********************************************************** ++ * \brief initialize handle instance ++ **************************************************************/ ++static inline void xf_adsp_base_init_handle(void) ++{ ++ int i; ++ ++ for (i = 0; i < MAX_HANDLE; i++) ++ base->handle[i] = NULL; ++} ++ ++/** *********************************************************** ++ *\brief get the next available handle ID for register ++ * ++ *\retval -1 Unavailable handle ID ++ *\retval 0 to 255 Available handle ID ++ **************************************************************/ ++static inline int xf_adsp_base_get_valid_handle(void) ++{ ++ int id = -1; ++ int i; ++ ++ for (i = 0; i < MAX_HANDLE; i++) { ++ /* get the id of the first available handler */ ++ if (!base->handle[i]) { ++ id = i; ++ break; ++ } ++ } ++ ++ return id; ++} ++ ++/** *********************************************************** ++ *\brief register a handle instance for component usage ++ * ++ *\param[in] private_data Private data of this component ++ *\param[in] cb Callback function ++ *\param[in] comp_id ID of register component ++ *\retval id ID of registered handle ++ *\retval -EINVAL Cannot get the handle instance ++ *\retval -ENOMEM Cannot allocate handle memory ++ **************************************************************/ ++static int xf_adsp_base_register_handle(void *private_data, ++ struct xf_callback_func *cb, ++ int comp_id) ++{ ++ struct xf_handle *handle; ++ int id; ++ ++ /* get the next handle id */ ++ id = xf_adsp_base_get_valid_handle(); ++ ++ /* check available handle in base */ ++ if (id < 0) ++ return -EINVAL; ++ ++ /* allocate handle data */ ++ handle = kmalloc(sizeof(*handle), GFP_KERNEL); ++ if (!handle) ++ return -ENOMEM; ++ ++ /* save handle data */ ++ handle->private_data = private_data; ++ handle->cb = cb; ++ handle->comp_id = comp_id; ++ ++ /* save the hanle data */ ++ base->handle[id] = handle; ++ ++ /* return the id numbering in base handle */ ++ return (id + 1); ++} ++ ++/** *********************************************************** ++ *\brief get handle instance from handle ID ++ * ++ *\param[in] handle_id ID of registered handle ++ *\retval handle Pointer to handle instance ++ **************************************************************/ ++static inline struct xf_handle *xf_adsp_base_get_handle(int handle_id) ++{ ++ return base->handle[handle_id - 1]; ++} ++ ++/** *********************************************************** ++ *\brief free the registered handle instance ++ * ++ *\param[in] handle_id ID of registered handle ++ *\retval 0 Success ++ *\retval -EINVAL Invalid handle ID ++ **************************************************************/ ++static int xf_adsp_base_free_handle(int handle_id) ++{ ++ if (handle_id < 1 || handle_id > MAX_HANDLE) ++ return -EINVAL; ++ ++ kfree(base->handle[handle_id - 1]); ++ base->handle[handle_id - 1] = NULL; ++ ++ return 0; ++} ++ ++/*********************************************************************** ++ * APIs for Renderer component ++ * ********************************************************************/ ++ ++/** *********************************************************** ++ *\brief set ADSP Renderer parameters ++ * ++ *\param[in] renderer Pointer to Renderer component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_renderer_set_params(struct xf_adsp_renderer *renderer) ++{ ++ struct xf_message msg; ++ struct xf_set_param_msg *msg_params; ++ struct xf_adsp_renderer_params *params; ++ struct xf_buffer *b; ++ int i; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !renderer) ++ return -EINVAL; ++ ++ params = &renderer->params; ++ ++ /* get Renderer's handle data */ ++ handle = xf_adsp_base_get_handle(renderer->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_SAMPLE_RATE; ++ msg_params->item[i++].value = params->in_rate; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_CHANNELS; ++ msg_params->item[i++].value = params->channel; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->item[i++].value = params->pcm_width; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_FRAME_SIZE; ++ msg_params->item[i++].value = params->frame_size; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_OUTPUT1; ++ msg_params->item[i++].value = params->dev1; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_OUTPUT2; ++ msg_params->item[i++].value = params->dev2; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_DMACHANNEL1; ++ msg_params->item[i++].value = params->dma1; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_DMACHANNEL2; ++ msg_params->item[i++].value = params->dma2; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ msg_params->item[i++].value = params->out_rate; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_VOLUME_RATE; ++ msg_params->item[i++].value = params->vol_rate; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_OUT_CHANNELS; ++ msg_params->item[i++].value = params->out_channel; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_MIX_CONTROL; ++ msg_params->item[i++].value = params->mix_ctrl; ++ ++ msg_params->item[i].id = XA_RDR_CONFIG_PARAM_STATE; ++ msg_params->item[i++].value = params->state; ++ ++ /* PRQA S 3200 2*/ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, renderer->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_SET_PARAM, XF_SET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief get ADSP Renderer parameters ++ * ++ *\param[in] renderer Pointer to Renderer component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++/* PRQA S 1505 */ ++int xf_adsp_renderer_get_params(struct xf_adsp_renderer *renderer) ++{ ++ struct xf_adsp_renderer_params *rdr_params; ++ struct xf_message msg; ++ struct xf_buffer *b; ++ union xf_get_param_msg *msg_params; ++ int i; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !renderer) ++ return -EINVAL; ++ ++ rdr_params = &renderer->params; ++ ++ /* get Renderer's handle data */ ++ handle = xf_adsp_base_get_handle(renderer->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ /* PRQA S 3440 13 1*/ ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_SAMPLE_RATE; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_CHANNELS; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_FRAME_SIZE; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_OUTPUT1; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_OUTPUT2; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_DMACHANNEL1; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_DMACHANNEL2; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_VOLUME_RATE; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_OUT_CHANNELS; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_MIX_CONTROL; ++ msg_params->c.id[i++] = XA_RDR_CONFIG_PARAM_STATE; ++ ++ /* PRQA S 3200 2*/ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, renderer->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_GET_PARAM, XF_GET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ if (err != 0) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* save the received parameters */ ++ i = 0; ++ rdr_params->in_rate = msg_params->r.value[i++]; /* PRQA S 3440 13 */ ++ rdr_params->channel = msg_params->r.value[i++]; ++ rdr_params->pcm_width = msg_params->r.value[i++]; ++ rdr_params->frame_size = msg_params->r.value[i++]; ++ rdr_params->dev1 = msg_params->r.value[i++]; ++ rdr_params->dev2 = msg_params->r.value[i++]; ++ rdr_params->dma1 = msg_params->r.value[i++]; ++ rdr_params->dma2 = msg_params->r.value[i++]; ++ rdr_params->out_rate = msg_params->r.value[i++]; ++ rdr_params->vol_rate = msg_params->r.value[i++]; ++ rdr_params->out_channel = msg_params->r.value[i++]; ++ rdr_params->mix_ctrl = msg_params->r.value[i++]; ++ rdr_params->state = msg_params->r.value[i++]; ++ ++exit: ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** ************************************************************************** ++ *\brief create Renderer component ++ * ++ *\param[in,out] renderer Pointer to the registered component ++ *\param[in] cb Callback function ++ *\param[in] private_data Private data ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base instance or register fail ++ *\retval -ENOMEM Cannot allocate Renderer instance ++ *****************************************************************************/ ++int xf_adsp_renderer_create(struct xf_adsp_renderer **renderer, ++ struct xf_callback_func *cb, void *private_data) ++{ ++ struct xf_adsp_renderer *rdr; ++ int err; ++ int comp_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ rdr = kmalloc(sizeof(*rdr), GFP_KERNEL); ++ if (!rdr) ++ return -ENOMEM; ++ ++ memset(rdr, 0, sizeof(struct xf_adsp_renderer)); /* PRQA S 3200 */ ++ ++ /* register renderer component */ ++ err = xf_adsp_register("renderer", &comp_id); ++ if (err != 0) ++ goto err2; /* PRQA S 2001 */ ++ ++ /* register Renderer to ADSP base control */ ++ rdr->handle_id = xf_adsp_base_register_handle(private_data, ++ cb, comp_id); ++ ++ if (rdr->handle_id <= 0) { ++ err = -EINVAL; ++ goto err1; /* PRQA S 2001 */ ++ } ++ ++ /* get the default parameter from Renderer plugin */ ++ err = xf_adsp_renderer_get_params(rdr); ++ if (err != 0) ++ goto err1; /* PRQA S 2001 */ ++ ++ /* save renderer compoent data */ ++ *renderer = rdr; ++ ++ return 0; ++ ++err1: ++ xf_adsp_unregister(comp_id); /* PRQA S 3200 */ ++ ++err2: ++ kfree(rdr); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief deinitialize ADSP Renderer component ++ * ++ *\param[in] renderer Pointer to Renderer component ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base or Renderer data ++ **************************************************************/ ++/* PRQA S 3673 */ ++int xf_adsp_renderer_destroy(struct xf_adsp_renderer *renderer) ++{ ++ struct xf_handle *handle; ++ int handle_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !renderer) ++ return -EINVAL; ++ ++ handle_id = renderer->handle_id; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* unregister component */ ++ xf_adsp_unregister(handle->comp_id); /* PRQA S 3200 */ ++ ++ /* free handle data from base control */ ++ xf_adsp_base_free_handle(handle_id); /* PRQA S 3200 */ ++ ++exit: ++ kfree(renderer); ++ ++ return 0; ++} ++ ++/*********************************************************************** ++ * APIs for Capture component ++ * ********************************************************************/ ++ ++/** *********************************************************** ++ *\brief set ADSP Capture parameters ++ * ++ *\param[in] capture Pointer to Capture component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_capture_set_params(struct xf_adsp_capture *capture) ++{ ++ struct xf_message msg; ++ struct xf_set_param_msg *msg_params; ++ struct xf_adsp_capture_params *params; ++ struct xf_buffer *b; ++ int i; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !capture) ++ return -EINVAL; ++ ++ params = &capture->params; ++ ++ /* get Capture's handle data */ ++ handle = xf_adsp_base_get_handle(capture->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_SAMPLE_RATE; ++ msg_params->item[i++].value = params->in_rate; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_CHANNELS; ++ msg_params->item[i++].value = params->channel; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->item[i++].value = params->pcm_width; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_FRAME_SIZE; ++ msg_params->item[i++].value = params->frame_size; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_INPUT1; ++ msg_params->item[i++].value = params->dev1; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_INPUT2; ++ msg_params->item[i++].value = params->dev2; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_DMACHANNEL1; ++ msg_params->item[i++].value = params->dma1; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_DMACHANNEL2; ++ msg_params->item[i++].value = params->dma2; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ msg_params->item[i++].value = params->out_rate; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_VOLUME_RATE; ++ msg_params->item[i++].value = params->vol_rate; ++ ++ msg_params->item[i].id = XA_CAP_CONFIG_PARAM_STATE; ++ msg_params->item[i++].value = params->state; ++ ++ /* PRQA S 3200 2 */ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, capture->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_SET_PARAM, XF_SET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief get ADSP Capture parameters ++ * ++ *\param[in] capture Pointer to Capture component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++/* PRQA S 1505 */ ++int xf_adsp_capture_get_params(struct xf_adsp_capture *capture) ++{ ++ struct xf_adsp_capture_params *cap_params; ++ struct xf_message msg; ++ struct xf_buffer *b; ++ union xf_get_param_msg *msg_params; ++ int i; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !capture) ++ return -EINVAL; ++ ++ cap_params = &capture->params; ++ ++ /* get Capture's handle data */ ++ handle = xf_adsp_base_get_handle(capture->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ /* PRQA S 3440 11 1*/ ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_SAMPLE_RATE; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_CHANNELS; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_FRAME_SIZE; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_INPUT1; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_INPUT2; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_DMACHANNEL1; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_DMACHANNEL2; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_VOLUME_RATE; ++ msg_params->c.id[i++] = XA_CAP_CONFIG_PARAM_STATE; ++ ++ /* PRQA S 3200 2 */ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, capture->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_GET_PARAM, XF_GET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ if (err != 0) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* save the received parameters */ ++ i = 0; ++ cap_params->in_rate = msg_params->r.value[i++]; /* PRQA S 3440 11 */ ++ cap_params->channel = msg_params->r.value[i++]; ++ cap_params->pcm_width = msg_params->r.value[i++]; ++ cap_params->frame_size = msg_params->r.value[i++]; ++ cap_params->dev1 = msg_params->r.value[i++]; ++ cap_params->dev2 = msg_params->r.value[i++]; ++ cap_params->dma1 = msg_params->r.value[i++]; ++ cap_params->dma2 = msg_params->r.value[i++]; ++ cap_params->out_rate = msg_params->r.value[i++]; ++ cap_params->vol_rate = msg_params->r.value[i++]; ++ cap_params->state = msg_params->r.value[i++]; ++ ++exit: ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** ************************************************************************** ++ *\brief create Capture component ++ * ++ *\param[in,out] capture Pointer to the registered component ++ *\param[in] cb Callback function ++ *\param[in] private_data Private data ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base instance or register fail ++ *\retval -ENOMEM Cannot allocate Capture instance ++ *****************************************************************************/ ++int xf_adsp_capture_create(struct xf_adsp_capture **capture, ++ struct xf_callback_func *cb, void *private_data) ++{ ++ struct xf_adsp_capture *cap; ++ int err; ++ int comp_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ cap = kmalloc(sizeof(*cap), GFP_KERNEL); ++ if (!cap) ++ return -ENOMEM; ++ ++ memset(cap, 0, sizeof(struct xf_adsp_capture)); /* PRQA S 3200 */ ++ ++ /* register capture component */ ++ err = xf_adsp_register("capture", &comp_id); ++ if (err != 0) ++ goto err2; /* PRQA S 2001 */ ++ ++ /* register capture to ADSP base control */ ++ cap->handle_id = xf_adsp_base_register_handle(private_data, ++ cb, comp_id); ++ ++ if (cap->handle_id <= 0) { ++ err = -EINVAL; ++ goto err1; /* PRQA S 2001 */ ++ } ++ ++ /* get the default parameter from capture plugin */ ++ err = xf_adsp_capture_get_params(cap); ++ if (err != 0) ++ goto err1; /* PRQA S 2001 */ ++ ++ /* save capture compoent data */ ++ *capture = cap; ++ ++ return 0; ++ ++err1: ++ xf_adsp_unregister(comp_id); /* PRQA S 3200 */ ++ ++err2: ++ kfree(cap); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief deinitialize ADSP Capture component ++ * ++ *\param[in] capture Pointer to Capture component ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base or Capture data ++ **************************************************************/ ++int xf_adsp_capture_destroy(struct xf_adsp_capture *capture) /* PRQA S 3673 */ ++{ ++ struct xf_handle *handle; ++ int handle_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !capture) ++ return -EINVAL; ++ ++ handle_id = capture->handle_id; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* unregister component */ ++ xf_adsp_unregister(handle->comp_id); /* PRQA S 3200 */ ++ ++ /* free handle data from base control */ ++ xf_adsp_base_free_handle(handle_id); /* PRQA S 3200 */ ++ ++exit: ++ kfree(capture); ++ ++ return 0; ++} ++ ++/*********************************************************************** ++ * APIs for Equalizer component ++ * ********************************************************************/ ++ ++/** *********************************************************** ++ *\brief set ADSP Equalizer parameters ++ * ++ *\param[in] equalizer Pointer to Equalizer component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_equalizer_set_params(struct xf_adsp_equalizer *equalizer) ++{ ++ struct xf_message msg; ++ struct xf_set_param_msg *msg_params; ++ struct xf_adsp_equalizer_params *params; ++ struct xf_buffer *b; ++ int i, n; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !equalizer) ++ return -EINVAL; ++ ++ params = &equalizer->params; ++ ++ /* get Equalizer's handle data */ ++ handle = xf_adsp_base_get_handle(equalizer->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ msg_params->item[i].id = XA_EQZ_CONFIG_PARAM_COEF_FS; ++ msg_params->item[i++].value = params->rate; ++ ++ msg_params->item[i].id = XA_EQZ_CONFIG_PARAM_CH; ++ msg_params->item[i++].value = params->channel; ++ ++ msg_params->item[i].id = XA_EQZ_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->item[i++].value = params->pcm_width; ++ ++ msg_params->item[i].id = XA_EQZ_CONFIG_PARAM_EQZ_TYPE; ++ msg_params->item[i++].value = params->eqz_type; ++ ++ if (params->eqz_type == XA_REL_EQZ_TYPE_PARAMETRIC) { ++ struct xf_equalizer_parametric_coef *coef = ¶ms->p_coef; ++ ++ for (n = 0; n < XA_REL_EQZ_FILTER_NUM; n++) { ++ msg_params->item[i].id = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_TYPE + n; ++ msg_params->item[i++].value = coef->type[n]; ++ ++ msg_params->item[i].id = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_FC + n; ++ msg_params->item[i++].value = coef->fc[n]; ++ ++ msg_params->item[i].id = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_BW + n; ++ msg_params->item[i++].value = coef->band_width[n]; ++ ++ msg_params->item[i].id = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_GA + n; ++ msg_params->item[i++].value = coef->gain[n]; ++ ++ msg_params->item[i].id = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_BA + n; ++ msg_params->item[i++].value = coef->gain_base[n]; ++ } ++ } else { ++ struct xf_equalizer_graphic_coef *coef = ¶ms->g_coef; ++ ++ for (n = 0; n < XA_REL_EQZ_GRAPHIC_BAND_NUM; n++) { ++ msg_params->item[i].id = ++ XA_EQZ_CONFIG_PARAM_BAND_0_GCOEF_GA + n; ++ msg_params->item[i++].value = coef->gain_g[n]; ++ } ++ } ++ ++ /* PRQA S 3200 2 */ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, equalizer->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_SET_PARAM, XF_SET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief get ADSP Equalizer parameters ++ * ++ *\param[in] equalizer Pointer to Equalizer component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++/* PRQA S 1505 1*/ ++int xf_adsp_equalizer_get_params(struct xf_adsp_equalizer *equalizer) ++{ ++ struct xf_adsp_equalizer_params *eqz_params; ++ struct xf_message msg; ++ struct xf_buffer *b; ++ union xf_get_param_msg *msg_params; ++ int i, n; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !equalizer) ++ return -EINVAL; ++ ++ eqz_params = &equalizer->params; ++ ++ /* get Equalizer's handle data */ ++ handle = xf_adsp_base_get_handle(equalizer->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ msg_params->c.id[i++] = XA_EQZ_CONFIG_PARAM_COEF_FS; /* PRQA S 3440 4 */ ++ msg_params->c.id[i++] = XA_EQZ_CONFIG_PARAM_CH; ++ msg_params->c.id[i++] = XA_EQZ_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->c.id[i++] = XA_EQZ_CONFIG_PARAM_EQZ_TYPE; ++ ++ for (n = 0; n < XA_REL_EQZ_FILTER_NUM; n++) { ++ /* PRQA S 3440 5 */ ++ msg_params->c.id[i++] = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_TYPE + n; ++ ++ msg_params->c.id[i++] = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_FC + n; ++ ++ msg_params->c.id[i++] = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_BW + n; ++ ++ msg_params->c.id[i++] = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_GA + n; ++ ++ msg_params->c.id[i++] = ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_BA + n; ++ } ++ ++ for (n = 0; n < XA_REL_EQZ_GRAPHIC_BAND_NUM; n++) ++ /* PRQA S 3440 1 */ ++ msg_params->c.id[i++] = XA_EQZ_CONFIG_PARAM_BAND_0_GCOEF_GA + n; ++ ++ /* PRQA S 3200 2 */ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, equalizer->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_GET_PARAM, XF_GET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ if (err != 0) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* save the received parameters */ ++ i = 0; ++ eqz_params->rate = msg_params->r.value[i++]; /* PRQA S 3440 4 */ ++ eqz_params->channel = msg_params->r.value[i++]; ++ eqz_params->pcm_width = msg_params->r.value[i++]; ++ eqz_params->eqz_type = msg_params->r.value[i++]; ++ ++ for (n = 0; n < XA_REL_EQZ_FILTER_NUM; n++) { ++ /* PRQA S 3440 5 */ ++ eqz_params->p_coef.type[n] = msg_params->r.value[i++]; ++ eqz_params->p_coef.fc[n] = msg_params->r.value[i++]; ++ eqz_params->p_coef.band_width[n] = msg_params->r.value[i++]; ++ eqz_params->p_coef.gain[n] = msg_params->r.value[i++]; ++ eqz_params->p_coef.gain_base[n] = msg_params->r.value[i++]; ++ } ++ ++ for (n = 0; n < XA_REL_EQZ_GRAPHIC_BAND_NUM; n++) { ++ /* PRQA S 3440 1 */ ++ eqz_params->g_coef.gain_g[n] = msg_params->r.value[i++]; ++ } ++ ++exit: ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** ************************************************************************** ++ *\brief create Equalizer component ++ * ++ *\param[in,out] equalizer Pointer to the registered component ++ *\param[in] cb Callback function ++ *\param[in] private_data Private data ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base instance or register fail ++ *\retval -ENOMEM Cannot allocate Equalier instance ++ *****************************************************************************/ ++int xf_adsp_equalizer_create(struct xf_adsp_equalizer **equalizer, ++ struct xf_callback_func *cb, void *private_data) ++{ ++ struct xf_adsp_equalizer *eqz; ++ int err; ++ int comp_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ eqz = kmalloc(sizeof(*eqz), GFP_KERNEL); ++ if (!eqz) ++ return -ENOMEM; ++ ++ memset(eqz, 0, sizeof(struct xf_adsp_equalizer)); /* PRQA S 3200 */ ++ ++ /* register equalizer component */ ++ err = xf_adsp_register("equalizer", &comp_id); ++ if (err != 0) ++ goto err2; /* PRQA S 2001 */ ++ ++ /* register equalizer to ADSP base control */ ++ eqz->handle_id = xf_adsp_base_register_handle(private_data, ++ cb, comp_id); ++ ++ if (eqz->handle_id <= 0) { ++ err = -EINVAL; ++ goto err1; /* PRQA S 2001 */ ++ } ++ ++ /* get the default parameter from equalizer plugin */ ++ err = xf_adsp_equalizer_get_params(eqz); ++ if (err != 0) ++ goto err1; /* PRQA S 2001 */ ++ ++ /* save equalizer compoent data */ ++ *equalizer = eqz; ++ ++ return 0; ++ ++err1: ++ xf_adsp_unregister(comp_id); /* PRQA S 3200 */ ++ ++err2: ++ kfree(eqz); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief deinitialize ADSP Equalizer component ++ * ++ *\param[in] equalizer Pointer to Equalizer component ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base or Equalizer data ++ **************************************************************/ ++/* PRQA S 3673 */ ++int xf_adsp_equalizer_destroy(struct xf_adsp_equalizer *equalizer) ++{ ++ struct xf_handle *handle; ++ int handle_id; ++ ++ /* check the sane ADSP base and Equalizer data */ ++ if (!base || !equalizer) ++ return -EINVAL; ++ ++ handle_id = equalizer->handle_id; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* unregister component */ ++ xf_adsp_unregister(handle->comp_id); /* PRQA S 3200 */ ++ ++ /* free handle data from base control */ ++ xf_adsp_base_free_handle(handle_id); /* PRQA S 3200 */ ++ ++exit: ++ kfree(equalizer); ++ ++ return 0; ++} ++ ++/*********************************************************************** ++ * APIs for TDM Renderer component ++ * ********************************************************************/ ++ ++/** *********************************************************** ++ *\brief set ADSP TDM Renderer parameters ++ * ++ *\param[in] tdm_renderer Pointer to TDM Renderer component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_tdm_renderer_set_params(struct xf_adsp_tdm_renderer *tdm_renderer) ++{ ++ struct xf_message msg; ++ struct xf_set_param_msg *msg_params; ++ struct xf_adsp_tdm_renderer_params *params; ++ struct xf_buffer *b; ++ int i; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !tdm_renderer) ++ return -EINVAL; ++ ++ params = &tdm_renderer->params; ++ ++ /* get TDM Renderer's handle data */ ++ handle = xf_adsp_base_get_handle(tdm_renderer->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_IN_SAMPLE_RATE; ++ msg_params->item[i++].value = params->in_rate; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_CHANNEL_MODE; ++ msg_params->item[i++].value = params->ch_mode; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->item[i++].value = params->pcm_width; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_FRAME_SIZE; ++ msg_params->item[i++].value = params->frame_size; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_OUTPUT1; ++ msg_params->item[i++].value = params->dev1; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_OUTPUT2; ++ msg_params->item[i++].value = params->dev2; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_DMACHANNEL1; ++ msg_params->item[i++].value = params->dma1; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_DMACHANNEL2; ++ msg_params->item[i++].value = params->dma2; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ msg_params->item[i++].value = params->out_rate; ++ ++ msg_params->item[i].id = XA_TDM_RDR_CONFIG_PARAM_VOLUME_RATE; ++ msg_params->item[i++].value = params->vol_rate; ++ ++ /* PRQA S 3200 2*/ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, tdm_renderer->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_SET_PARAM, XF_SET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief get ADSP TDM Renderer parameters ++ * ++ *\param[in] tdm_renderer Pointer to TDM Renderer component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++/* PRQA S 1505 1*/ ++int xf_adsp_tdm_renderer_get_params(struct xf_adsp_tdm_renderer *tdm_renderer) ++{ ++ struct xf_adsp_tdm_renderer_params *params; ++ struct xf_message msg; ++ struct xf_buffer *b; ++ union xf_get_param_msg *msg_params; ++ int i; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !tdm_renderer) ++ return -EINVAL; ++ ++ params = &tdm_renderer->params; ++ ++ /* get TDM Renderer's handle data */ ++ handle = xf_adsp_base_get_handle(tdm_renderer->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ /* PRQA S 3440 13 1*/ ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_IN_SAMPLE_RATE; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_CHANNEL_MODE; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_FRAME_SIZE; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_OUTPUT1; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_OUTPUT2; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_DMACHANNEL1; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_DMACHANNEL2; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ msg_params->c.id[i++] = XA_TDM_RDR_CONFIG_PARAM_VOLUME_RATE; ++ ++ /* PRQA S 3200 2*/ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, tdm_renderer->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_GET_PARAM, XF_GET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ if (err != 0) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* save the received parameters */ ++ i = 0; ++ params->in_rate = msg_params->r.value[i++]; /* PRQA S 3440 13 */ ++ params->ch_mode = msg_params->r.value[i++]; ++ params->pcm_width = msg_params->r.value[i++]; ++ params->frame_size = msg_params->r.value[i++]; ++ params->dev1 = msg_params->r.value[i++]; ++ params->dev2 = msg_params->r.value[i++]; ++ params->dma1 = msg_params->r.value[i++]; ++ params->dma2 = msg_params->r.value[i++]; ++ params->out_rate = msg_params->r.value[i++]; ++ params->vol_rate = msg_params->r.value[i++]; ++ ++exit: ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** ************************************************************************** ++ *\brief create TDM Renderer component ++ * ++ *\param[in,out] tdm_renderer Pointer to the registered component ++ *\param[in] cb Callback function ++ *\param[in] private_data Private data ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base instance or register fail ++ *\retval -ENOMEM Cannot allocate Renderer instance ++ *****************************************************************************/ ++int xf_adsp_tdm_renderer_create(struct xf_adsp_tdm_renderer **tdm_renderer, ++ struct xf_callback_func *cb, ++ void *private_data) ++{ ++ struct xf_adsp_tdm_renderer *tdm_rdr; ++ int err; ++ int comp_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ tdm_rdr = kmalloc(sizeof(*tdm_rdr), GFP_KERNEL); ++ if (!tdm_rdr) ++ return -ENOMEM; ++ ++ /* PRQA S 3200 */ ++ memset(tdm_rdr, 0, sizeof(struct xf_adsp_tdm_renderer)); ++ ++ /* register TDM Renderer component */ ++ err = xf_adsp_register("tdm-renderer", &comp_id); ++ if (err != 0) ++ goto err2; /* PRQA S 2001 */ ++ ++ /* register TDM Renderer to ADSP base control */ ++ tdm_rdr->handle_id = xf_adsp_base_register_handle(private_data, ++ cb, comp_id); ++ ++ if (tdm_rdr->handle_id <= 0) { ++ err = -EINVAL; ++ goto err1; /* PRQA S 2001 */ ++ } ++ ++ /* get the default parameter from plugin */ ++ err = xf_adsp_tdm_renderer_get_params(tdm_rdr); ++ if (err != 0) ++ goto err1; /* PRQA S 2001 */ ++ ++ /* save compoent data */ ++ *tdm_renderer = tdm_rdr; ++ ++ return 0; ++ ++err1: ++ xf_adsp_unregister(comp_id); /* PRQA S 3200 */ ++ ++err2: ++ kfree(tdm_rdr); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief deinitialize ADSP TDM Renderer component ++ * ++ *\param[in] tdm_renderer Pointer to TDM Renderer component ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base or Renderer data ++ **************************************************************/ ++/* PRQA S 3673 1*/ ++int xf_adsp_tdm_renderer_destroy(struct xf_adsp_tdm_renderer *tdm_renderer) ++{ ++ struct xf_handle *handle; ++ int handle_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !tdm_renderer) ++ return -EINVAL; ++ ++ handle_id = tdm_renderer->handle_id; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* unregister component */ ++ xf_adsp_unregister(handle->comp_id); /* PRQA S 3200 */ ++ ++ /* free handle data from base control */ ++ xf_adsp_base_free_handle(handle_id); /* PRQA S 3200 */ ++ ++exit: ++ kfree(tdm_renderer); ++ ++ return 0; ++} ++ ++/*********************************************************************** ++ * APIs for TDM Capture component ++ * ********************************************************************/ ++ ++/** *********************************************************** ++ *\brief set ADSP TDM Capture parameters ++ * ++ *\param[in] tdm_capture Pointer to TDM Capture component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++int xf_adsp_tdm_capture_set_params(struct xf_adsp_tdm_capture *tdm_capture) ++{ ++ struct xf_message msg; ++ struct xf_set_param_msg *msg_params; ++ struct xf_adsp_tdm_capture_params *params; ++ struct xf_buffer *b; ++ int i; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !tdm_capture) ++ return -EINVAL; ++ ++ params = &tdm_capture->params; ++ ++ /* get TDM Capture's handle data */ ++ handle = xf_adsp_base_get_handle(tdm_capture->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_IN_SAMPLE_RATE; ++ msg_params->item[i++].value = params->in_rate; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_CHANNEL_MODE; ++ msg_params->item[i++].value = params->ch_mode; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->item[i++].value = params->pcm_width; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_FRAME_SIZE; ++ msg_params->item[i++].value = params->frame_size; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_INPUT1; ++ msg_params->item[i++].value = params->dev1; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_INPUT2; ++ msg_params->item[i++].value = params->dev2; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_DMACHANNEL1; ++ msg_params->item[i++].value = params->dma1; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_DMACHANNEL2; ++ msg_params->item[i++].value = params->dma2; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ msg_params->item[i++].value = params->out_rate; ++ ++ msg_params->item[i].id = XA_TDM_CAP_CONFIG_PARAM_VOLUME_RATE; ++ msg_params->item[i++].value = params->vol_rate; ++ ++ /* PRQA S 3200 2*/ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, tdm_capture->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_SET_PARAM, XF_SET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief get ADSP TDM Capture parameters ++ * ++ *\param[in] tdm_capture Pointer to TDM Capture component ++ *\retval 0 Success ++ *\retval -EINVAL Failed ++ **************************************************************/ ++/* PRQA S 1505 1*/ ++int xf_adsp_tdm_capture_get_params(struct xf_adsp_tdm_capture *tdm_capture) ++{ ++ struct xf_adsp_tdm_capture_params *params; ++ struct xf_message msg; ++ struct xf_buffer *b; ++ union xf_get_param_msg *msg_params; ++ int i; ++ struct xf_handle *handle; ++ int err = 0; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !tdm_capture) ++ return -EINVAL; ++ ++ params = &tdm_capture->params; ++ ++ /* get TDM Capture's handle data */ ++ handle = xf_adsp_base_get_handle(tdm_capture->handle_id); ++ if (!handle) ++ return -EINVAL; ++ ++ b = xf_buffer_get(base->aux_pool); ++ msg_params = xf_buffer_data(b); ++ ++ i = 0; ++ /* PRQA S 3440 13 1*/ ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_IN_SAMPLE_RATE; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_CHANNEL_MODE; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_PCM_WIDTH; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_FRAME_SIZE; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_INPUT1; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_INPUT2; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_DMACHANNEL1; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_DMACHANNEL2; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_OUT_SAMPLE_RATE; ++ msg_params->c.id[i++] = XA_TDM_CAP_CONFIG_PARAM_VOLUME_RATE; ++ ++ /* PRQA S 3200 2*/ ++ xf_create_msg(&msg, ++ __XF_MSG_ID(__XF_AP_CLIENT(0, tdm_capture->handle_id), ++ __XF_PORT_SPEC2(handle->comp_id, 0)), ++ XF_GET_PARAM, XF_GET_PARAM_CMD_LEN(i), msg_params, NULL); ++ ++ err = xf_send_and_receive(&msg); ++ if (err != 0) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* save the received parameters */ ++ i = 0; ++ params->in_rate = msg_params->r.value[i++]; /* PRQA S 3440 13 */ ++ params->ch_mode = msg_params->r.value[i++]; ++ params->pcm_width = msg_params->r.value[i++]; ++ params->frame_size = msg_params->r.value[i++]; ++ params->dev1 = msg_params->r.value[i++]; ++ params->dev2 = msg_params->r.value[i++]; ++ params->dma1 = msg_params->r.value[i++]; ++ params->dma2 = msg_params->r.value[i++]; ++ params->out_rate = msg_params->r.value[i++]; ++ params->vol_rate = msg_params->r.value[i++]; ++ ++exit: ++ /* return msg to pool */ ++ xf_buffer_put(b); ++ ++ return err; ++} ++ ++/** ************************************************************************** ++ *\brief create TDM Capture component ++ * ++ *\param[in,out] tdm_capture Pointer to the registered component ++ *\param[in] cb Callback function ++ *\param[in] private_data Private data ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base instance or register fail ++ *\retval -ENOMEM Cannot allocate Renderer instance ++ *****************************************************************************/ ++int xf_adsp_tdm_capture_create(struct xf_adsp_tdm_capture **tdm_capture, ++ struct xf_callback_func *cb, void *private_data) ++{ ++ struct xf_adsp_tdm_capture *tdm_cap; ++ int err; ++ int comp_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base) ++ return -EINVAL; ++ ++ tdm_cap = kmalloc(sizeof(*tdm_cap), GFP_KERNEL); ++ if (!tdm_cap) ++ return -ENOMEM; ++ ++ /* PRQA S 3200 */ ++ memset(tdm_cap, 0, sizeof(struct xf_adsp_tdm_capture)); ++ ++ /* register TDM Capture component */ ++ err = xf_adsp_register("tdm-capture", &comp_id); ++ if (err != 0) ++ goto err2; /* PRQA S 2001 */ ++ ++ /* register TDM Capture to ADSP base control */ ++ tdm_cap->handle_id = xf_adsp_base_register_handle(private_data, ++ cb, comp_id); ++ ++ if (tdm_cap->handle_id <= 0) { ++ err = -EINVAL; ++ goto err1; /* PRQA S 2001 */ ++ } ++ ++ /* get the default parameter from plugin */ ++ err = xf_adsp_tdm_capture_get_params(tdm_cap); ++ if (err != 0) ++ goto err1; /* PRQA S 2001 */ ++ ++ /* save compoent data */ ++ *tdm_capture = tdm_cap; ++ ++ return 0; ++ ++err1: ++ xf_adsp_unregister(comp_id); /* PRQA S 3200 */ ++ ++err2: ++ kfree(tdm_cap); ++ ++ return err; ++} ++ ++/** *********************************************************** ++ *\brief deinitialize ADSP TDM Capture component ++ * ++ *\param[in] tdm_capture Pointer to TDM Capture component ++ *\retval 0 Success ++ *\retval -EINVAL Invalid base or Renderer data ++ **************************************************************/ ++/* PRQA S 3673 */ ++int xf_adsp_tdm_capture_destroy(struct xf_adsp_tdm_capture *tdm_capture) ++{ ++ struct xf_handle *handle; ++ int handle_id; ++ ++ /* check the sane ADSP base data */ ++ if (!base || !tdm_capture) ++ return -EINVAL; ++ ++ handle_id = tdm_capture->handle_id; ++ ++ handle = xf_adsp_base_get_handle(handle_id); ++ if (!handle) ++ goto exit; /* PRQA S 2001 */ ++ ++ /* unregister component */ ++ xf_adsp_unregister(handle->comp_id); /* PRQA S 3200 */ ++ ++ /* free handle data from base control */ ++ xf_adsp_base_free_handle(handle_id); /* PRQA S 3200 */ ++ ++exit: ++ kfree(tdm_capture); ++ ++ return 0; ++} +diff --git a/sound/soc/adsp/xf-adsp-base.h b/sound/soc/adsp/xf-adsp-base.h +new file mode 100644 +index 0000000..27eb084 +--- /dev/null ++++ b/sound/soc/adsp/xf-adsp-base.h +@@ -0,0 +1,275 @@ ++/** ************************************************************************* ++ *\file xf-adsp-base.h ++ *\brief Header file for ADSP Base Control layer ++ *\addtogroup ADSP Driver ++ **************************************************************************** ++ *\date Oct. 21, 2017 ++ *\author Renesas Electronics Corporation ++ **************************************************************************** ++ *\par Copyright ++ * ++ * Copyright(c) 2016 Renesas Electoronics Corporation ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a copy ++ * of this software and associated documentation files (the "Software"), to deal ++ * in the Software without restriction, including without limitation the rights ++ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++ * copies of the Software, and to permit persons to whom the Software is ++ * furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included in ++ * all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ++ * THE SOFTWARE. ++ ******************************************************************************/ ++ ++#ifndef __XF_ADSP_BASE_H ++#define __XF_ADSP_BASE_H ++ ++#include "xf-adsp-config.h" ++#include <adsp_drv/xf-adsp-drv-ext.h> ++ ++#define XF_BUF_POOL_SIZE (4) /**< number of buffer in a data pool */ ++ ++/**< maximum number of DSP component can be registered */ ++#define MAX_HANDLE (256) ++ ++/* define boolean */ ++#define TRUE (1) ++#define FALSE (0) ++ ++/** \struct xf_callback_func ++ * \brief callback function for ADSP's response message ++ */ ++struct xf_callback_func { ++ /** callback for empty buffer done message */ ++ int (*empty_buf_done)(void *data, int opcode, int length, char *buffer); ++ ++ /** callback for fill buffer done message */ ++ int (*fill_buf_done)(void *data, int opcode, int length, char *buffer); ++ ++ /** callback for event handler */ ++ int (*event_handler)(void *data); ++}; ++ ++/** \struct xf_adsp_renderer_params ++ * \brief parameter structure for Renderer component ++ */ ++struct xf_adsp_renderer_params { ++ int channel; /**< channel number */ ++ int pcm_width; /**< PCM width */ ++ int frame_size; /**< frame size */ ++ int in_rate; /**< input sampling rate */ ++ int out_rate; /**< output sampling rate */ ++ int vol_rate; /**< volume rate */ ++ int dev1; /**< 1st device index */ ++ int dev2; /**< 2nd device index */ ++ int dma1; /**< 1st DMA index */ ++ int dma2; /**< 2nd DMA index */ ++ int out_channel; /**< output channels */ ++ int mix_ctrl; /**< mix control flag */ ++ int state; /**< operation state */ ++}; ++ ++/** \struct xf_adsp_renderer ++ * \brief Renderer component structure ++ */ ++struct xf_adsp_renderer { ++ struct xf_adsp_renderer_params params; /**< parameter structure*/ ++ struct xf_pool *buf_pool; /**< buffer pool for data transfer */ ++ int handle_id; /**< ID of registered handle*/ ++}; ++ ++/** \struct xf_adsp_capture_params ++ *\brief parameter structure of Capture component ++ */ ++struct xf_adsp_capture_params { ++ int channel; /**< channel number */ ++ int pcm_width; /**< PCM width */ ++ int frame_size; /**< frame size */ ++ int in_rate; /**< input sampling rate */ ++ int out_rate; /**< output sampling rate */ ++ int vol_rate; /**< volume rate */ ++ int dev1; /**< 1st device index */ ++ int dev2; /**< 2nd device index */ ++ int dma1; /**< 1st DMA index */ ++ int dma2; /**< 2nd DMA index */ ++ int state; /**< operation state */ ++}; ++ ++/** \struct xf_adsp_capture ++ * \brief Capture component structure ++ */ ++struct xf_adsp_capture { ++ struct xf_adsp_capture_params params; /**< parameter structuer*/ ++ struct xf_pool *buf_pool; /**< buffer pool for data transfer */ ++ int handle_id; /**< ID of registered handle*/ ++}; ++ ++/** \struct xf_equalizer_parametric_coef ++ *\brief Parametric Equalizer type's parameters ++ */ ++struct xf_equalizer_parametric_coef { ++ int type[XA_REL_EQZ_FILTER_NUM]; /**< Filter type */ ++ int fc[XA_REL_EQZ_FILTER_NUM]; /**< Filter center frequency */ ++ int gain[XA_REL_EQZ_FILTER_NUM]; /**< Filter gain */ ++ int band_width[XA_REL_EQZ_FILTER_NUM]; /**< Filter band width */ ++ int gain_base[XA_REL_EQZ_FILTER_NUM]; /**< Filter base gain */ ++}; ++ ++/** \struct xf_equalizer_graphic_coef ++ * \brief Graphic Equalizer type's parameters ++ */ ++struct xf_equalizer_graphic_coef { ++ int gain_g[XA_REL_EQZ_GRAPHIC_BAND_NUM];/**< Graphic equalizer gain */ ++}; ++ ++/** \struct xf_adsp_equalizer_params ++ *\brief Equalizer parameters ++ */ ++struct xf_adsp_equalizer_params { ++ int channel; /**< channel number */ ++ int pcm_width; /**< PCM width */ ++ int rate; /**< sampling rate */ ++ int eqz_type; /**< Equalizer type */ ++ struct xf_equalizer_parametric_coef p_coef; /**< Parametric params */ ++ struct xf_equalizer_graphic_coef g_coef; /**< Graphic params */ ++}; ++ ++/** \struct xf_adsp_equalizer ++ * \brief Equalizer component's structure ++ */ ++struct xf_adsp_equalizer { ++ struct xf_adsp_equalizer_params params;/**< Equalizer parameters */ ++ struct xf_pool *buf_pool; /**< buffer pool for transfer data */ ++ int handle_id; /**< ID of registered handle */ ++}; ++ ++/** \struct xf_adsp_tdm_renderer_params ++ * \brief parameter structure for TDM Renderer component ++ */ ++struct xf_adsp_tdm_renderer_params { ++ int ch_mode; /**< channel mode */ ++ int pcm_width; /**< PCM width */ ++ int frame_size; /**< frame size */ ++ int in_rate; /**< input sampling rate */ ++ int out_rate; /**< output sampling rate */ ++ int vol_rate; /**< volume rate */ ++ int dev1; /**< 1st device index */ ++ int dev2; /**< 2nd device index */ ++ int dma1; /**< 1st DMA index */ ++ int dma2; /**< 2nd DMA index */ ++}; ++ ++/** \struct xf_adsp_tdm_renderer ++ * \brief TDM Renderer component structure ++ */ ++struct xf_adsp_tdm_renderer { ++ struct xf_adsp_tdm_renderer_params params; /**< parameter structure*/ ++ struct xf_pool *buf_pool; /**< buffer pool for data transfer */ ++ int handle_id; /**< ID of registered handle */ ++}; ++ ++/** \struct xf_adsp_tdm_capture_params ++ * \brief parameter structure for TDM Capture component ++ */ ++struct xf_adsp_tdm_capture_params { ++ int ch_mode; /**< channel mode */ ++ int pcm_width; /**< PCM width */ ++ int frame_size; /**< frame size */ ++ int in_rate; /**< input sampling rate */ ++ int out_rate; /**< output sampling rate */ ++ int vol_rate; /**< volume rate */ ++ int dev1; /**< 1st device index */ ++ int dev2; /**< 2nd device index */ ++ int dma1; /**< 1st DMA index */ ++ int dma2; /**< 2nd DMA index */ ++}; ++ ++/** \struct xf_adsp_tdm_capture ++ * \brief TDM Capture component structure ++ */ ++struct xf_adsp_tdm_capture { ++ struct xf_adsp_tdm_capture_params params; /**< parameter structure*/ ++ struct xf_pool *buf_pool; /**< buffer pool for data transfer */ ++ int handle_id; /**< ID of registered handle*/ ++}; ++ ++/** \struct xf_handle ++ * \brief Handle struct for each ADSP component ++ */ ++struct xf_handle { ++ int comp_id;/**< ADSP component ID */ ++ struct xf_callback_func *cb;/**< callback functions */ ++ void *private_data; /**< private data for callback functions*/ ++}; ++ ++/** \struct xf_adsp_base ++ * \brief Base component structure ++ */ ++struct xf_adsp_base { ++ struct xf_adsp_base_cmd cmd; /**< proxy commands */ ++ void *client; /**< client data which registered to proxy */ ++ struct xf_pool *aux_pool; /**< auxiliary buffer pool data */ ++ struct xf_handle *handle[MAX_HANDLE]; /**< handler data */ ++ struct task_struct *rsp_thread;/**< thread for response message*/ ++ wait_queue_head_t base_wait; /**< ADSP base's waiting queue */ ++ struct xf_message base_msg; /**< ADSP base's response message */ ++ int base_flag; /**< flag to control its waiting queue */ ++ int err_flag; /**< flag to indicate a error from plugins */ ++ int wait_flag; /**< flag to control the polling waiting*/ ++ spinlock_t lock; /**< spinlock data */ ++}; ++ ++struct xf_pool *xf_adsp_allocate_mem_pool(int pool_size, int buf_length); ++int xf_adsp_free_mem_pool(struct xf_pool *pool); ++char *xf_adsp_get_data_from_pool(struct xf_pool *pool, int index); ++ ++int xf_adsp_empty_this_buffer(int handle_id, char *buffer, int length); ++int xf_adsp_fill_this_buffer(int handle_id, char *buffer, int length); ++ ++int xf_adsp_route(int src_handle_id, int dst_handle_id ++ , int buf_cnt, int buf_size); ++ ++int xf_adsp_set_param(int handle_id, int index, int value); ++int xf_adsp_get_param(int handle_id, int index, int *value); ++ ++int xf_adsp_renderer_create(struct xf_adsp_renderer **renderer, ++ struct xf_callback_func *cb, void *private_data); ++int xf_adsp_renderer_destroy(struct xf_adsp_renderer *renderer); ++int xf_adsp_renderer_set_params(struct xf_adsp_renderer *renderer); ++int xf_adsp_renderer_get_params(struct xf_adsp_renderer *renderer); ++ ++int xf_adsp_capture_create(struct xf_adsp_capture **capture, ++ struct xf_callback_func *cb, void *private_data); ++int xf_adsp_capture_destroy(struct xf_adsp_capture *capture); ++int xf_adsp_capture_set_params(struct xf_adsp_capture *capture); ++int xf_adsp_capture_get_params(struct xf_adsp_capture *capture); ++ ++int xf_adsp_equalizer_create(struct xf_adsp_equalizer **equalizer, ++ struct xf_callback_func *cb, void *private_data); ++int xf_adsp_equalizer_destroy(struct xf_adsp_equalizer *equalizer); ++int xf_adsp_equalizer_set_params(struct xf_adsp_equalizer *equalizer); ++int xf_adsp_equalizer_get_params(struct xf_adsp_equalizer *equalizer); ++ ++int xf_adsp_tdm_renderer_create(struct xf_adsp_tdm_renderer **tdm_renderer, ++ struct xf_callback_func *cb, ++ void *private_data); ++int xf_adsp_tdm_renderer_destroy(struct xf_adsp_tdm_renderer *tdm_renderer); ++int xf_adsp_tdm_renderer_set_params(struct xf_adsp_tdm_renderer *tdm_renderer); ++int xf_adsp_tdm_renderer_get_params(struct xf_adsp_tdm_renderer *tdm_renderer); ++ ++int xf_adsp_tdm_capture_create(struct xf_adsp_tdm_capture **tdm_capture, ++ struct xf_callback_func *cb, ++ void *private_data); ++int xf_adsp_tdm_capture_destroy(struct xf_adsp_tdm_capture *tdm_capture); ++int xf_adsp_tdm_capture_set_params(struct xf_adsp_tdm_capture *tdm_capture); ++int xf_adsp_tdm_capture_get_params(struct xf_adsp_tdm_capture *tdm_capture); ++ ++#endif +diff --git a/sound/soc/adsp/xf-adsp-config.h b/sound/soc/adsp/xf-adsp-config.h +new file mode 100644 +index 0000000..818a46a +--- /dev/null ++++ b/sound/soc/adsp/xf-adsp-config.h +@@ -0,0 +1,604 @@ ++/** **************************************************************************** ++ *\file xf-adsp-config.h ++ *\brief Header file for ADSP configuration ++ *\addtogroup ADSP Driver ++ ******************************************************************************* ++ *\date Oct. 21, 2017 ++ *\author Renesas Electronics Corporation ++ ******************************************************************************* ++ *\par Copyright ++ * ++ * Copyright(c) 2016 Renesas Electoronics Corporation ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a copy ++ * of this software and associated documentation files (the "Software"), to deal ++ * in the Software without restriction, including without limitation the rights ++ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++ * copies of the Software, and to permit persons to whom the Software is ++ * furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included in ++ * all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ++ * THE SOFTWARE. ++ ******************************************************************************/ ++ ++#ifndef __XF_ADSP_CONFIG_H ++#define __XF_ADSP_CONFIG_H ++ ++/* Equalizer definition */ ++#define XA_REL_EQZ_FILTER_NUM (9) /**< number of filter */ ++#define XA_REL_EQZ_GRAPHIC_BAND_NUM (5) /**< number of graphic band */ ++ ++struct xf_buffer { ++ void *address; ++ union { /* PRQA S 750 3 */ ++ struct xf_buffer *next; ++ struct xf_pool *pool; ++ } link; ++}; ++ ++struct xf_pool { ++ /* length of individual buffer in a pool */ ++ u32 length; ++ ++ /* number of buffer in a pool */ ++ u32 number; ++ ++ /* pointer to pool memory */ ++ void *p; ++ ++ /* pointer to first free buffer in a pool */ ++ struct xf_buffer *free; ++ ++ /* individual buffer */ ++ struct xf_buffer buffer[0]; /* PRQA S 1037 */ ++}; ++ ++struct xf_message { ++ /* pointer to the next item in the list */ ++ struct xf_message *next; ++ ++ /* shmem session_id */ ++ u32 id; ++ ++ /* operation code */ ++ u32 opcode; ++ ++ /* length of attached message buffer */ ++ u32 length; ++ ++ /* message buffer */ ++ void *buffer; ++}; ++ ++/******************************************************************************* ++ * XF_GET_PARAM message ++ ******************************************************************************/ ++ ++/* ...message body (command/response) */ ++union xf_get_param_msg { /* PRQA S 750 18 */ ++ /* ...command structure */ ++ struct { ++ /* ...array of parameters requested */ ++ u32 id[0]; /* PRQA S 1037 */ ++ ++ } __attribute__((__packed__)) c; ++ ++ /* ...response structure */ ++ struct { ++ /* ...array of parameters values */ ++ u32 value[0];/* PRQA S 1037 */ ++ ++ } __attribute__((__packed__)) r; ++ ++}; ++ ++/* ...length of the XF_GET_PARAM command/response */ ++/* PRQA S 3453 2 */ ++#define XF_GET_PARAM_CMD_LEN(params) (sizeof(u32) * (params)) ++#define XF_GET_PARAM_RSP_LEN(params) (sizeof(u32) * (params)) ++ ++/******************************************************************************* ++ * XF_SET_PARAM message ++ ******************************************************************************/ ++ ++/* ...component initialization parameter */ ++struct xf_set_param_item { ++ /* ...index of parameter passed to SET_CONFIG_PARAM call */ ++ u32 id; ++ ++ /* ...value of parameter */ ++ u32 value; ++ ++} __attribute__ ((__packed__)); ++ ++/* ...message body (no response message? - tbd) */ ++struct xf_set_param_msg { ++ /* ...command message */ ++ struct xf_set_param_item item[0]; /* PRQA S 1037 */ ++ ++} __attribute__ ((__packed__)); ++ ++/* ...length of the command message */ ++/* PRQA S 3453 */ ++#define XF_SET_PARAM_CMD_LEN(params) \ ++ (sizeof(struct xf_set_param_item) * (params)) ++ ++/******************************************************************************* ++ * XF_ROUTE definition ++ ******************************************************************************/ ++ ++/* ...port routing command */ ++struct xf_route_port_msg { ++ /* ...source port specification */ ++ u32 src; ++ ++ /* ...destination port specification */ ++ u32 dst; ++ ++ /* ...number of buffers to allocate */ ++ u32 alloc_number; ++ ++ /* ...length of buffer to allocate */ ++ u32 alloc_size; ++ ++ /* ...alignment restriction for a buffer */ ++ u32 alloc_align; ++ ++} __attribute__((__packed__)); ++ ++/******************************************************************************* ++ * XF_UNROUTE definition ++ ******************************************************************************/ ++ ++/* ...port unrouting command */ ++struct xf_unroute_port_msg { ++ /* ...source port specification */ ++ u32 src; ++ ++ /* ...destination port specification */ ++ u32 dst; ++ ++} __attribute__((__packed__)); ++ ++/* ...Capture states */ ++enum xa_capture_state { ++ XA_CAP_STATE_RUN = 0, ++ XA_CAP_STATE_IDLE = 1, ++ XA_CAP_STATE_PAUSE = 2 ++}; ++ ++/* ...Renderer states */ ++enum xa_renderer_state { ++ XA_RDR_STATE_RUN = 0, ++ XA_RDR_STATE_IDLE = 1, ++ XA_RDR_STATE_PAUSE = 2 ++}; ++ ++/******************************************************************************* ++ * Message routing composition - move somewhere else - tbd ++ ******************************************************************************/ ++ ++/* ...adjust IPC client of message going from user-space */ ++#define XF_MSG_AP_FROM_USER(id, client) \ ++ (((id) & ~(0xF << 2)) | ((client) << 2)) ++ ++/* ...wipe out IPC client from message going to user-space */ ++#define XF_MSG_AP_TO_USER(id) \ ++ ((id) & ~(0xF << 18)) ++ ++/* ...port specification (12 bits) */ ++#define __XF_PORT_SPEC(core, id, port) ((core) | ((id) << 2) | ((port) << 8)) ++#define __XF_PORT_SPEC2(id, port) ((id) | ((port) << 8)) ++#define XF_PORT_CORE(spec) ((spec) & 0x3) ++#define XF_PORT_CLIENT(spec) (((spec) >> 2) & 0x3F) ++#define XF_PORT_ID(spec) (((spec) >> 8) & 0xF) ++ ++/* ...message id contains source and destination ports specification */ ++#define __XF_MSG_ID(src, dst) (((src) & 0xFFFF) | (((dst) & 0xFFFF) << 16)) ++#define XF_MSG_SRC(id) (((id) >> 0) & 0xFFFF) ++#define XF_MSG_SRC_CORE(id) (((id) >> 0) & 0x3) ++#define XF_MSG_SRC_CLIENT(id) (((id) >> 2) & 0x3F) ++#define XF_MSG_SRC_PORT(id) (((id) >> 8) & 0xF) ++#define XF_MSG_SRC_PROXY(id) (((id) >> 15) & 0x1) ++#define XF_MSG_DST(id) (((id) >> 16) & 0xFFFF) ++#define XF_MSG_DST_CORE(id) (((id) >> 16) & 0x3) ++#define XF_MSG_DST_CLIENT(id) (((id) >> 18) & 0x3F) ++#define XF_MSG_DST_PORT(id) (((id) >> 24) & 0xF) ++#define XF_MSG_DST_PROXY(id) (((id) >> 31) & 0x1) ++ ++/* ...special treatment of AP-proxy destination field */ ++#define XF_AP_IPC_CLIENT(id) (((id) >> 18) & 0xF) ++#define XF_AP_CLIENT(id) (((id) >> 22) & 0x1FF) ++#define __XF_AP_PROXY(core) ((core) | 0x8000) ++#define __XF_DSP_PROXY(core) ((core) | 0x8000) ++#define __XF_AP_CLIENT(core, client) ((core) | ((client) << 6) | 0x8000) ++ ++/******************************************************************************* ++ * Opcode composition ++ ******************************************************************************/ ++ ++/* ...opcode composition with command/response data tags */ ++#define __XF_OPCODE(c, r, op) (((c) << 31) | ((r) << 30) | ((op) & 0x3F)) ++ ++/* ...accessors */ ++#define XF_OPCODE_CDATA(opcode) ((opcode) & (1 << 31)) ++#define XF_OPCODE_RDATA(opcode) ((opcode) & (1 << 30)) ++#define XF_OPCODE_TYPE(opcode) ((opcode) & (0x3F)) ++ ++/******************************************************************************* ++ * Opcode types ++ ******************************************************************************/ ++ ++/* ...unregister client */ ++#define XF_UNREGISTER __XF_OPCODE(0, 0, 0) ++ ++/* ...register client at proxy */ ++#define XF_REGISTER __XF_OPCODE(1, 0, 1) ++ ++/* ...port routing command */ ++#define XF_ROUTE __XF_OPCODE(1, 0, 2) ++ ++/* ...port unrouting command */ ++#define XF_UNROUTE __XF_OPCODE(1, 0, 3) ++ ++/* ...shared buffer allocation */ ++#define XF_ALLOC __XF_OPCODE(0, 0, 4) ++ ++/* ...shared buffer freeing */ ++#define XF_FREE __XF_OPCODE(0, 0, 5) ++ ++/* ...set component parameters */ ++#define XF_SET_PARAM __XF_OPCODE(1, 0, 6) ++ ++/* ...get component parameters */ ++#define XF_GET_PARAM __XF_OPCODE(1, 1, 7) ++ ++/* ...input buffer reception */ ++#define XF_EMPTY_THIS_BUFFER __XF_OPCODE(1, 0, 8) ++ ++/* ...output buffer reception */ ++#define XF_FILL_THIS_BUFFER __XF_OPCODE(0, 1, 9) ++ ++/* ...flush specific port */ ++#define XF_FLUSH __XF_OPCODE(0, 0, 10) ++ ++/* ...start component operation */ ++#define XF_START __XF_OPCODE(0, 0, 11) ++ ++/* ...stop component operation */ ++#define XF_STOP __XF_OPCODE(0, 0, 12) ++ ++/* ...pause component operation */ ++#define XF_PAUSE __XF_OPCODE(0, 0, 13) ++ ++/* ...resume component operation */ ++#define XF_RESUME __XF_OPCODE(0, 0, 14) ++ ++/* ...total amount of supported decoder commands */ ++#define __XF_OP_NUM (15) ++ ++/************************************************* ++ * Renderer - specific configuration parameters ++ * **********************************************/ ++ ++enum xa_config_param_renderer { ++ XA_RDR_CONFIG_PARAM_STATE = 0, ++ XA_RDR_CONFIG_PARAM_PCM_WIDTH = 1, ++ XA_RDR_CONFIG_PARAM_CHANNELS = 2, ++ XA_RDR_CONFIG_PARAM_SAMPLE_RATE = 3, ++ XA_RDR_CONFIG_PARAM_FRAME_SIZE = 4, ++ XA_RDR_CONFIG_PARAM_OUTPUT1 = 5, ++ XA_RDR_CONFIG_PARAM_DMACHANNEL1 = 6, ++ XA_RDR_CONFIG_PARAM_OUTPUT2 = 7, ++ XA_RDR_CONFIG_PARAM_DMACHANNEL2 = 8, ++ XA_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE = 9, ++ XA_RDR_CONFIG_PARAM_VOLUME_RATE = 10, ++ XA_RDR_CONFIG_PARAM_OUT_CHANNELS = 11, ++ XA_RDR_CONFIG_PARAM_MIX_CONTROL = 12, ++ XA_RDR_CONFIG_PARAM_NUM = 13 ++}; ++ ++/************************************************* ++ * Capture - specific configuration parameters ++ * **********************************************/ ++ ++enum xa_config_param_capture { ++ XA_CAP_CONFIG_PARAM_CB = 0, ++ XA_CAP_CONFIG_PARAM_STATE = 1, ++ XA_CAP_CONFIG_PARAM_PCM_WIDTH = 2, ++ XA_CAP_CONFIG_PARAM_CHANNELS = 3, ++ XA_CAP_CONFIG_PARAM_SAMPLE_RATE = 4, ++ XA_CAP_CONFIG_PARAM_FRAME_SIZE = 5, ++ XA_CAP_CONFIG_PARAM_INPUT1 = 6, ++ XA_CAP_CONFIG_PARAM_DMACHANNEL1 = 7, ++ XA_CAP_CONFIG_PARAM_INPUT2 = 8, ++ XA_CAP_CONFIG_PARAM_DMACHANNEL2 = 9, ++ XA_CAP_CONFIG_PARAM_OUT_SAMPLE_RATE = 10, ++ XA_CAP_CONFIG_PARAM_VOLUME_RATE = 11, ++ XA_CAP_CONFIG_PARAM_NUM = 12 ++}; ++ ++/************************************************* ++ * Equalizer - specific configuration parameters ++ * **********************************************/ ++ ++enum xa_rel_eqz_filter_type { ++ XA_REL_EQZ_TYPE_THROUGH = 0, ++ XA_REL_EQZ_TYPE_PEAK = 1, ++ XA_REL_EQZ_TYPE_BASS = 2, ++ XA_REL_EQZ_TYPE_TREBLE = 3 ++}; ++ ++enum xa_rel_eqz_type { ++ XA_REL_EQZ_TYPE_PARAMETRIC = 0, ++ XA_REL_EQZ_TYPE_GRAPHIC = 1 ++}; ++ ++/*****************************************************************************/ ++/* Additional subcommand indices */ ++/*****************************************************************************/ ++ ++enum xa_add_cmd_type_generic { ++ /* XA_API_CMD_SET_CONFIG_PARAM indices */ ++ XA_EQZ_CONFIG_PARAM_COEF_FS = 0x0000, ++ XA_EQZ_CONFIG_PARAM_PCM_WIDTH = 0x0001, ++ XA_EQZ_CONFIG_PARAM_CH = 0x0002, ++ XA_EQZ_CONFIG_PARAM_EQZ_TYPE = 0x0003, ++ ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_FC = 0x0010, ++ XA_EQZ_CONFIG_PARAM_FILTER_1_COEF_FC = 0x0011, ++ XA_EQZ_CONFIG_PARAM_FILTER_2_COEF_FC = 0x0012, ++ XA_EQZ_CONFIG_PARAM_FILTER_3_COEF_FC = 0x0013, ++ XA_EQZ_CONFIG_PARAM_FILTER_4_COEF_FC = 0x0014, ++ XA_EQZ_CONFIG_PARAM_FILTER_5_COEF_FC = 0x0015, ++ XA_EQZ_CONFIG_PARAM_FILTER_6_COEF_FC = 0x0016, ++ XA_EQZ_CONFIG_PARAM_FILTER_7_COEF_FC = 0x0017, ++ XA_EQZ_CONFIG_PARAM_FILTER_8_COEF_FC = 0x0018, ++ ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_TYPE = 0x0020, ++ XA_EQZ_CONFIG_PARAM_FILTER_1_COEF_TYPE = 0x0021, ++ XA_EQZ_CONFIG_PARAM_FILTER_2_COEF_TYPE = 0x0022, ++ XA_EQZ_CONFIG_PARAM_FILTER_3_COEF_TYPE = 0x0023, ++ XA_EQZ_CONFIG_PARAM_FILTER_4_COEF_TYPE = 0x0024, ++ XA_EQZ_CONFIG_PARAM_FILTER_5_COEF_TYPE = 0x0025, ++ XA_EQZ_CONFIG_PARAM_FILTER_6_COEF_TYPE = 0x0026, ++ XA_EQZ_CONFIG_PARAM_FILTER_7_COEF_TYPE = 0x0027, ++ XA_EQZ_CONFIG_PARAM_FILTER_8_COEF_TYPE = 0x0028, ++ ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_BW = 0x0030, ++ XA_EQZ_CONFIG_PARAM_FILTER_1_COEF_BW = 0x0031, ++ XA_EQZ_CONFIG_PARAM_FILTER_2_COEF_BW = 0x0032, ++ XA_EQZ_CONFIG_PARAM_FILTER_3_COEF_BW = 0x0033, ++ XA_EQZ_CONFIG_PARAM_FILTER_4_COEF_BW = 0x0034, ++ XA_EQZ_CONFIG_PARAM_FILTER_5_COEF_BW = 0x0035, ++ XA_EQZ_CONFIG_PARAM_FILTER_6_COEF_BW = 0x0036, ++ XA_EQZ_CONFIG_PARAM_FILTER_7_COEF_BW = 0x0037, ++ XA_EQZ_CONFIG_PARAM_FILTER_8_COEF_BW = 0x0038, ++ ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_GA = 0x0040, ++ XA_EQZ_CONFIG_PARAM_FILTER_1_COEF_GA = 0x0041, ++ XA_EQZ_CONFIG_PARAM_FILTER_2_COEF_GA = 0x0042, ++ XA_EQZ_CONFIG_PARAM_FILTER_3_COEF_GA = 0x0043, ++ XA_EQZ_CONFIG_PARAM_FILTER_4_COEF_GA = 0x0044, ++ XA_EQZ_CONFIG_PARAM_FILTER_5_COEF_GA = 0x0045, ++ XA_EQZ_CONFIG_PARAM_FILTER_6_COEF_GA = 0x0046, ++ XA_EQZ_CONFIG_PARAM_FILTER_7_COEF_GA = 0x0047, ++ XA_EQZ_CONFIG_PARAM_FILTER_8_COEF_GA = 0x0048, ++ ++ XA_EQZ_CONFIG_PARAM_FILTER_0_COEF_BA = 0x0050, ++ XA_EQZ_CONFIG_PARAM_FILTER_1_COEF_BA = 0x0051, ++ XA_EQZ_CONFIG_PARAM_FILTER_2_COEF_BA = 0x0052, ++ XA_EQZ_CONFIG_PARAM_FILTER_3_COEF_BA = 0x0053, ++ XA_EQZ_CONFIG_PARAM_FILTER_4_COEF_BA = 0x0054, ++ XA_EQZ_CONFIG_PARAM_FILTER_5_COEF_BA = 0x0055, ++ XA_EQZ_CONFIG_PARAM_FILTER_6_COEF_BA = 0x0056, ++ XA_EQZ_CONFIG_PARAM_FILTER_7_COEF_BA = 0x0057, ++ XA_EQZ_CONFIG_PARAM_FILTER_8_COEF_BA = 0x0058, ++ ++ XA_EQZ_CONFIG_PARAM_BAND_0_GCOEF_GA = 0x0060, ++ XA_EQZ_CONFIG_PARAM_BAND_1_GCOEF_GA = 0x0061, ++ XA_EQZ_CONFIG_PARAM_BAND_2_GCOEF_GA = 0x0062, ++ XA_EQZ_CONFIG_PARAM_BAND_3_GCOEF_GA = 0x0063, ++ XA_EQZ_CONFIG_PARAM_BAND_4_GCOEF_GA = 0x0064 ++}; ++ ++/* ...tdm-renderer-specific configuration parameters */ ++enum xa_config_param_tdm_renderer { ++ XA_TDM_RDR_CONFIG_PARAM_PCM_WIDTH = 0, ++ XA_TDM_RDR_CONFIG_PARAM_CHANNEL_MODE = 1, ++ XA_TDM_RDR_CONFIG_PARAM_IN_SAMPLE_RATE = 2, ++ XA_TDM_RDR_CONFIG_PARAM_FRAME_SIZE = 3, ++ XA_TDM_RDR_CONFIG_PARAM_OUTPUT1 = 4, ++ XA_TDM_RDR_CONFIG_PARAM_DMACHANNEL1 = 5, ++ XA_TDM_RDR_CONFIG_PARAM_OUTPUT2 = 6, ++ XA_TDM_RDR_CONFIG_PARAM_DMACHANNEL2 = 7, ++ XA_TDM_RDR_CONFIG_PARAM_OUT_SAMPLE_RATE = 8, ++ XA_TDM_RDR_CONFIG_PARAM_VOLUME_RATE = 9 ++}; ++ ++enum xa_rel_tdm_renderer_channel_mode { ++ XA_TDM_RDR_CHANNEL_MODE_2X4 = 0, /**< 4 stereo TDM data */ ++ XA_TDM_RDR_CHANNEL_MODE_1X8 = 1, /**< 1 eight-channel TDM data*/ ++ /**< 1 six-channels plus 1 two-channels TDM data */ ++ XA_TDM_RDR_CHANNEL_MODE_6_2 = 2, ++ XA_TDM_RDR_CHANNEL_MODE_2X3 = 3, /**< 3 stereo TDM data */ ++ XA_TDM_RDR_CHANNEL_MODE_1X6 = 4 /**< 1 six-channel TDM data */ ++}; ++ ++/* ...TDM Capture-specific configuration parameters */ ++enum xa_config_param_tdm_capture { ++ XA_TDM_CAP_CONFIG_PARAM_PCM_WIDTH = 0, ++ XA_TDM_CAP_CONFIG_PARAM_CHANNEL_MODE = 1, ++ XA_TDM_CAP_CONFIG_PARAM_IN_SAMPLE_RATE = 2, ++ XA_TDM_CAP_CONFIG_PARAM_FRAME_SIZE = 3, ++ XA_TDM_CAP_CONFIG_PARAM_INPUT1 = 4, ++ XA_TDM_CAP_CONFIG_PARAM_DMACHANNEL1 = 5, ++ XA_TDM_CAP_CONFIG_PARAM_INPUT2 = 6, ++ XA_TDM_CAP_CONFIG_PARAM_DMACHANNEL2 = 7, ++ XA_TDM_CAP_CONFIG_PARAM_OUT_SAMPLE_RATE = 8, ++ XA_TDM_CAP_CONFIG_PARAM_VOLUME_RATE = 9 ++}; ++ ++enum xa_rel_tdm_capture_channel_mode { ++ XA_TDM_CAP_CHANNEL_MODE_2X4 = 0, /**< 4 stereo TDM data */ ++ XA_TDM_CAP_CHANNEL_MODE_1X8 = 1, /**< 1 eight-channel TDM data*/ ++ /**< 1 six-channels plus 1 two-channels TDM data */ ++ XA_TDM_CAP_CHANNEL_MODE_6_2 = 2, ++ XA_TDM_CAP_CHANNEL_MODE_2X3 = 3, /**< 3 stereo TDM data */ ++ XA_TDM_CAP_CHANNEL_MODE_1X6 = 4 /**< 1 six-channel TDM data */ ++}; ++ ++/*****************************************************************************/ ++/* HW supported */ ++/*****************************************************************************/ ++/* ...SSI modules supported by HW */ ++enum ssi_module { ++ SSI00 = 0, ++ SSI01 = 1, ++ SSI02 = 2, ++ SSI03 = 3, ++ SSI04 = 4, ++ SSI05 = 5, ++ SSI06 = 6, ++ SSI07 = 7, ++ SSI10 = 10, ++ SSI11 = 11, ++ SSI12 = 12, ++ SSI13 = 13, ++ SSI14 = 14, ++ SSI15 = 15, ++ SSI16 = 16, ++ SSI17 = 17, ++ SSI20 = 20, ++ SSI21 = 21, ++ SSI22 = 22, ++ SSI23 = 23, ++ SSI24 = 24, ++ SSI25 = 25, ++ SSI26 = 26, ++ SSI27 = 27, ++ SSI30 = 30, ++ SSI31 = 31, ++ SSI32 = 32, ++ SSI33 = 33, ++ SSI34 = 34, ++ SSI35 = 35, ++ SSI36 = 36, ++ SSI37 = 37, ++ SSI40 = 40, ++ SSI41 = 41, ++ SSI42 = 42, ++ SSI43 = 43, ++ SSI44 = 44, ++ SSI45 = 45, ++ SSI46 = 46, ++ SSI47 = 47, ++ SSI5 = 50, ++ SSI6 = 60, ++ SSI7 = 70, ++ SSI8 = 80, ++ SSI90 = 90, ++ SSI91 = 91, ++ SSI92 = 92, ++ SSI93 = 93, ++ SSI94 = 94, ++ SSI95 = 95, ++ SSI96 = 96, ++ SSI97 = 97 ++}; ++ ++/* ...SRC modules supported by HW */ ++enum src_module { ++ SRC0 = 110, /* SRC0 */ ++ SRC1 = 111, /* SRC1 */ ++ SRC2 = 112, /* SRC2 */ ++ SRC3 = 113, /* SRC3 */ ++ SRC4 = 114, /* SRC4 */ ++ SRC5 = 115, /* SRC5 */ ++ SRC6 = 116, /* SRC6 */ ++ SRC7 = 117, /* SRC7 */ ++ SRC8 = 118, /* SRC8 */ ++ SRC9 = 119, /* SRC9 */ ++ SRCMAX = 120 /* Maximum number of SRC modules */ ++}; ++ ++/* ...PDMA supported by HW */ ++enum { ++ PDMA_CH00 = 0, ++ PDMA_CH01 = 1, ++ PDMA_CH02 = 2, ++ PDMA_CH03 = 3, ++ PDMA_CH04 = 4, ++ PDMA_CH05 = 5, ++ PDMA_CH06 = 6, ++ PDMA_CH07 = 7, ++ PDMA_CH08 = 8, ++ PDMA_CH09 = 9, ++ PDMA_CH10 = 10, ++ PDMA_CH11 = 11, ++ PDMA_CH12 = 12, ++ PDMA_CH13 = 13, ++ PDMA_CH14 = 14, ++ PDMA_CH15 = 15, ++ PDMA_CH16 = 16, ++ PDMA_CH17 = 17, ++ PDMA_CH18 = 18, ++ PDMA_CH19 = 19, ++ PDMA_CH20 = 20, ++ PDMA_CH21 = 21, ++ PDMA_CH22 = 22, ++ PDMA_CH23 = 23, ++ PDMA_CH24 = 24, ++ PDMA_CH25 = 25, ++ PDMA_CH26 = 26, ++ PDMA_CH27 = 27, ++ PDMA_CH28 = 28, ++ PDMA_CHMAX = 29 ++}; ++ ++/* ...DMAC supported by HW */ ++enum { ++ ADMAC_CH00 = PDMA_CHMAX + 0, ++ ADMAC_CH01 = PDMA_CHMAX + 1, ++ ADMAC_CH02 = PDMA_CHMAX + 2, ++ ADMAC_CH03 = PDMA_CHMAX + 3, ++ ADMAC_CH04 = PDMA_CHMAX + 4, ++ ADMAC_CH05 = PDMA_CHMAX + 5, ++ ADMAC_CH06 = PDMA_CHMAX + 6, ++ ADMAC_CH07 = PDMA_CHMAX + 7, ++ ADMAC_CH08 = PDMA_CHMAX + 8, ++ ADMAC_CH09 = PDMA_CHMAX + 9, ++ ADMAC_CH10 = PDMA_CHMAX + 10, ++ ADMAC_CH11 = PDMA_CHMAX + 11, ++ ADMAC_CH12 = PDMA_CHMAX + 12, ++ ADMAC_CH13 = PDMA_CHMAX + 13, ++ ADMAC_CH14 = PDMA_CHMAX + 14, ++ ADMAC_CH15 = PDMA_CHMAX + 15, ++ ADMAC_CH16 = PDMA_CHMAX + 16, ++ ADMAC_CH17 = PDMA_CHMAX + 17, ++ ADMAC_CH18 = PDMA_CHMAX + 18, ++ ADMAC_CH19 = PDMA_CHMAX + 19, ++ ADMAC_CH20 = PDMA_CHMAX + 20, ++ ADMAC_CH21 = PDMA_CHMAX + 21, ++ ADMAC_CH22 = PDMA_CHMAX + 22, ++ ADMAC_CH23 = PDMA_CHMAX + 23, ++ ADMAC_CH24 = PDMA_CHMAX + 24, ++ ADMAC_CH25 = PDMA_CHMAX + 25, ++ ADMAC_CH26 = PDMA_CHMAX + 26, ++ ADMAC_CH27 = PDMA_CHMAX + 27, ++ ADMAC_CH28 = PDMA_CHMAX + 28, ++ ADMAC_CH29 = PDMA_CHMAX + 29, ++ ADMAC_CH30 = PDMA_CHMAX + 30, ++ ADMAC_CH31 = PDMA_CHMAX + 31, ++ ADMAC_CHMAX = PDMA_CHMAX + 32 ++}; ++ ++#endif +-- +2.7.4 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0003-ADSP-add-build-for-ADSP-sound-driver.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0003-ADSP-add-build-for-ADSP-sound-driver.patch new file mode 100644 index 00000000..ecab4120 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0003-ADSP-add-build-for-ADSP-sound-driver.patch @@ -0,0 +1,35 @@ +From 3ae5cb9feda031f660becc94f5496d5ee9b90e22 Mon Sep 17 00:00:00 2001 +From: tienphitran <tien.tran.uw@renesas.com> +Date: Mon, 15 Oct 2018 17:57:56 +0700 +Subject: [PATCH 3/6] ADSP: add build for ADSP sound driver + +Signed-off-by: tienphitran <tien.tran.uw@renesas.com> +--- + sound/soc/Kconfig | 1 + + sound/soc/Makefile | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig +index c0abad2067e1..f5f6abbd6e14 100644 +--- a/sound/soc/Kconfig ++++ b/sound/soc/Kconfig +@@ -71,6 +71,7 @@ source "sound/soc/txx9/Kconfig" + source "sound/soc/ux500/Kconfig" + source "sound/soc/xtensa/Kconfig" + source "sound/soc/zte/Kconfig" ++source "sound/soc/adsp/Kconfig" + + # Supported codecs + source "sound/soc/codecs/Kconfig" +diff --git a/sound/soc/Makefile b/sound/soc/Makefile +index bf8c1e2ce0bf..6e77abba2b01 100644 +--- a/sound/soc/Makefile ++++ b/sound/soc/Makefile +@@ -52,3 +52,4 @@ obj-$(CONFIG_SND_SOC) += txx9/ + obj-$(CONFIG_SND_SOC) += ux500/ + obj-$(CONFIG_SND_SOC) += xtensa/ + obj-$(CONFIG_SND_SOC) += zte/ ++obj-$(CONFIG_SND_SOC) += adsp/ +-- +2.19.1 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0004-ADSP-integrate-ADSP-sound-for-H3-M3-M3N-board.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0004-ADSP-integrate-ADSP-sound-for-H3-M3-M3N-board.patch new file mode 100644 index 00000000..6d95d65f --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0004-ADSP-integrate-ADSP-sound-for-H3-M3-M3N-board.patch @@ -0,0 +1,185 @@ +From 825517f3f8ebe551d297db16e4582c0eae646f05 Mon Sep 17 00:00:00 2001 +From: tienphitran <tien.tran.uw@renesas.com> +Date: Wed, 31 Oct 2018 16:12:36 +0700 +Subject: [PATCH 4/6] ADSP: integrate ADSP sound for H3, M3, M3N board + +Signed-off-by: tienphitran <tien.tran.uw@renesas.com> +[takeshi.kihara.df: fix W=1 dtc warning] +Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com> +--- + arch/arm64/boot/dts/renesas/r8a7795.dtsi | 5 ++ + arch/arm64/boot/dts/renesas/r8a7796.dtsi | 5 ++ + arch/arm64/boot/dts/renesas/r8a77965.dtsi | 5 ++ + .../boot/dts/renesas/salvator-common.dtsi | 84 +++++++++++++++++-- + 4 files changed, 94 insertions(+), 5 deletions(-) + +diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi +index 1896e5250dff..8dfda0fda91c 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi +@@ -793,6 +793,11 @@ + method = "smc"; + }; + ++ rcar_adsp_sound: adsp_sound { ++ compatible = "renesas,rcar_adsp_sound_gen3"; ++ status = "disabled"; ++ }; ++ + /* External SCIF clock - to be overridden by boards that provide it */ + scif_clk: scif { + compatible = "fixed-clock"; +diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi b/arch/arm64/boot/dts/renesas/r8a7796.dtsi +index c00d1da64198..726c0d07fe59 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi +@@ -798,6 +798,11 @@ + method = "smc"; + }; + ++ rcar_adsp_sound: adsp_sound { ++ compatible = "renesas,rcar_adsp_sound_gen3"; ++ status = "disabled"; ++ }; ++ + /* External SCIF clock - to be overridden by boards that provide it */ + scif_clk: scif { + compatible = "fixed-clock"; +diff --git a/arch/arm64/boot/dts/renesas/r8a77965.dtsi b/arch/arm64/boot/dts/renesas/r8a77965.dtsi +index 454a67b132f4..799b005ade92 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77965.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a77965.dtsi +@@ -227,6 +227,11 @@ + method = "smc"; + }; + ++ rcar_adsp_sound: adsp_sound { ++ compatible = "renesas,rcar_adsp_sound_gen3"; ++ status = "disabled"; ++ }; ++ + /* External SCIF clock - to be overridden by boards that provide it */ + scif_clk: scif { + compatible = "fixed-clock"; +diff --git a/arch/arm64/boot/dts/renesas/salvator-common.dtsi b/arch/arm64/boot/dts/renesas/salvator-common.dtsi +index 922b9cc4797c..2c1d49c4bcaa 100644 +--- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi ++++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi +@@ -153,11 +153,27 @@ + }; + + sound_card: sound { +- compatible = "audio-graph-card"; ++ compatible = "audio-graph-scu-card"; + + label = "rcar-sound"; + +- dais = <&rsnd_port0>; ++ prefix = "ak4613"; ++ routing = "ak4613 Playback", "Playback0", ++ "ak4613 Playback", "Playback1", ++ "ak4613 Playback", "Playback2", ++ "ak4613 Playback", "Playback3", ++ "Capture0", "ak4613 Capture", ++ "Capture1", "ak4613 Capture", ++ "Capture2", "ak4613 Capture", ++ "Capture3", "ak4613 Capture", ++ "ak4613 Playback", "DAI0 Playback", ++ "DAI0 Capture", "ak4613 Capture"; ++ ++ dais = <&adsp_port0 ++ &adsp_port1 ++ &adsp_port2 ++ &adsp_port3 ++ &rsnd_port0>; + }; + + vbus0_usb2: regulator-vbus0-usb2 { +@@ -419,8 +435,27 @@ + asahi-kasei,out5-single-end; + asahi-kasei,out6-single-end; + +- port { +- ak4613_endpoint: endpoint { ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ak4613_endpoint0: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&adsp_endpoint0>; ++ }; ++ ak4613_endpoint1: endpoint@1 { ++ reg = <1>; ++ remote-endpoint = <&adsp_endpoint1>; ++ }; ++ ak4613_endpoint2: endpoint@2 { ++ reg = <2>; ++ remote-endpoint = <&adsp_endpoint2>; ++ }; ++ ak4613_endpoint3: endpoint@3 { ++ reg = <3>; ++ remote-endpoint = <&adsp_endpoint3>; ++ }; ++ ak4613_endpoint4: endpoint@4 { ++ reg = <4>; + remote-endpoint = <&rsnd_endpoint0>; + }; + }; +@@ -731,6 +766,45 @@ + status = "okay"; + }; + ++&rcar_adsp_sound { ++ status = "okay"; ++ /* Multiple DAI */ ++ #sound-dai-cells = <1>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ adsp_port0: port@0 { ++ reg = <0>; ++ adsp_endpoint0: endpoint { ++ remote-endpoint = <&ak4613_endpoint0>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port1: port@1 { ++ reg = <1>; ++ adsp_endpoint1: endpoint { ++ remote-endpoint = <&ak4613_endpoint1>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port2: port@2 { ++ reg = <2>; ++ adsp_endpoint2: endpoint { ++ remote-endpoint = <&ak4613_endpoint2>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port3: port@3 { ++ reg = <3>; ++ adsp_endpoint3: endpoint { ++ remote-endpoint = <&ak4613_endpoint3>; ++ dai-format = "left_j"; ++ }; ++ }; ++ }; ++}; ++ + &rcar_sound { + pinctrl-0 = <&sound_pins &sound_clk_pins>; + pinctrl-names = "default"; +@@ -769,7 +843,7 @@ + rsnd_port0: port@0 { + reg = <0>; + rsnd_endpoint0: endpoint { +- remote-endpoint = <&ak4613_endpoint>; ++ remote-endpoint = <&ak4613_endpoint4>; + + dai-format = "left_j"; + bitclock-master = <&rsnd_endpoint0>; +-- +2.19.1 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0005-ADSP-integrate-ADSP-sound-for-E3-board.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0005-ADSP-integrate-ADSP-sound-for-E3-board.patch new file mode 100644 index 00000000..34b32d8f --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0005-ADSP-integrate-ADSP-sound-for-E3-board.patch @@ -0,0 +1,272 @@ +From 455f26d0de1cf6eaeb0aa5b58725e3e34d8d34bd Mon Sep 17 00:00:00 2001 +From: Nguyen Dang <nguyen.dang.wh@rvc.renesas.com> +Date: Tue, 6 Nov 2018 11:36:15 +0700 +Subject: [PATCH 5/6] ADSP: integrate ADSP sound for E3 board + +Signed-off-by: Nguyen Dang <nguyen.dang.wh@renesas.com> +[takeshi.kihara.df: fix W=1 dtc warning] +[takeshi.kihara.df: support for dt file separation by E3 ES1.0 SoC] +Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com> +--- + .../arm64/boot/dts/renesas/r8a77990-ebisu.dts | 84 +++++++++++++++++-- + .../boot/dts/renesas/r8a77990-es10-ebisu.dts | 84 +++++++++++++++++-- + arch/arm64/boot/dts/renesas/r8a77990.dtsi | 5 ++ + 3 files changed, 163 insertions(+), 10 deletions(-) + +diff --git a/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts b/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts +index 26081a6e1866..20fdb4085d87 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts ++++ b/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts +@@ -221,11 +221,27 @@ + }; + + sound_card: sound { +- compatible = "audio-graph-card"; ++ compatible = "audio-graph-scu-card"; + + label = "rcar-sound"; + +- dais = <&rsnd_port0>; ++ prefix = "ak4613"; ++ routing = "ak4613 Playback", "DAI0 Playback", ++ "DAI0 Capture", "ak4613 Capture", ++ "ak4613 Playback", "Playback0", ++ "ak4613 Playback", "Playback1", ++ "ak4613 Playback", "Playback2", ++ "ak4613 Playback", "Playback3", ++ "Capture0", "ak4613 Capture", ++ "Capture1", "ak4613 Capture", ++ "Capture2", "ak4613 Capture", ++ "Capture3", "ak4613 Capture"; ++ ++ dais = <&adsp_port0 ++ &adsp_port1 ++ &adsp_port2 ++ &adsp_port3 ++ &rsnd_port0>; + }; + + vbus0_usb2: regulator-vbus0-usb2 { +@@ -501,8 +517,27 @@ + asahi-kasei,out5-single-end; + asahi-kasei,out6-single-end; + +- port { +- ak4613_endpoint: endpoint { ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ak4613_endpoint0: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&adsp_endpoint0>; ++ }; ++ ak4613_endpoint1: endpoint@1 { ++ reg = <1>; ++ remote-endpoint = <&adsp_endpoint1>; ++ }; ++ ak4613_endpoint2: endpoint@2 { ++ reg = <2>; ++ remote-endpoint = <&adsp_endpoint2>; ++ }; ++ ak4613_endpoint3: endpoint@3 { ++ reg = <3>; ++ remote-endpoint = <&adsp_endpoint3>; ++ }; ++ ak4613_endpoint4: endpoint@4 { ++ reg = <4>; + remote-endpoint = <&rsnd_endpoint0>; + }; + }; +@@ -702,6 +737,45 @@ + status = "okay"; + }; + ++&rcar_adsp_sound { ++ status = "okay"; ++ /* Multiple DAI */ ++ #sound-dai-cells = <1>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ adsp_port0: port@0 { ++ reg = <0>; ++ adsp_endpoint0: endpoint { ++ remote-endpoint = <&ak4613_endpoint0>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port1: port@1 { ++ reg = <1>; ++ adsp_endpoint1: endpoint { ++ remote-endpoint = <&ak4613_endpoint1>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port2: port@2 { ++ reg = <2>; ++ adsp_endpoint2: endpoint { ++ remote-endpoint = <&ak4613_endpoint2>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port3: port@3 { ++ reg = <3>; ++ adsp_endpoint3: endpoint { ++ remote-endpoint = <&ak4613_endpoint3>; ++ dai-format = "left_j"; ++ }; ++ }; ++ }; ++}; ++ + &rcar_sound { + pinctrl-0 = <&sound_pins &sound_clk_pins>; + pinctrl-names = "default"; +@@ -737,7 +811,7 @@ + ports { + rsnd_port0: port@0 { + rsnd_endpoint0: endpoint { +- remote-endpoint = <&ak4613_endpoint>; ++ remote-endpoint = <&ak4613_endpoint4>; + + dai-format = "left_j"; + bitclock-master = <&rsnd_endpoint0>; +diff --git a/arch/arm64/boot/dts/renesas/r8a77990-es10-ebisu.dts b/arch/arm64/boot/dts/renesas/r8a77990-es10-ebisu.dts +index 087d5533f3db..61e18309c4a4 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77990-es10-ebisu.dts ++++ b/arch/arm64/boot/dts/renesas/r8a77990-es10-ebisu.dts +@@ -221,11 +221,27 @@ + }; + + sound_card: sound { +- compatible = "audio-graph-card"; ++ compatible = "audio-graph-scu-card"; + + label = "rcar-sound"; + +- dais = <&rsnd_port0>; ++ prefix = "ak4613"; ++ routing = "ak4613 Playback", "DAI0 Playback", ++ "DAI0 Capture", "ak4613 Capture", ++ "ak4613 Playback", "Playback0", ++ "ak4613 Playback", "Playback1", ++ "ak4613 Playback", "Playback2", ++ "ak4613 Playback", "Playback3", ++ "Capture0", "ak4613 Capture", ++ "Capture1", "ak4613 Capture", ++ "Capture2", "ak4613 Capture", ++ "Capture3", "ak4613 Capture"; ++ ++ dais = <&adsp_port0 ++ &adsp_port1 ++ &adsp_port2 ++ &adsp_port3 ++ &rsnd_port0>; + }; + + vbus0_usb2: regulator-vbus0-usb2 { +@@ -501,8 +517,27 @@ + asahi-kasei,out5-single-end; + asahi-kasei,out6-single-end; + +- port { +- ak4613_endpoint: endpoint { ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ak4613_endpoint0: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&adsp_endpoint0>; ++ }; ++ ak4613_endpoint1: endpoint@1 { ++ reg = <1>; ++ remote-endpoint = <&adsp_endpoint1>; ++ }; ++ ak4613_endpoint2: endpoint@2 { ++ reg = <2>; ++ remote-endpoint = <&adsp_endpoint2>; ++ }; ++ ak4613_endpoint3: endpoint@3 { ++ reg = <3>; ++ remote-endpoint = <&adsp_endpoint3>; ++ }; ++ ak4613_endpoint4: endpoint@4 { ++ reg = <4>; + remote-endpoint = <&rsnd_endpoint0>; + }; + }; +@@ -702,6 +737,45 @@ + status = "okay"; + }; + ++&rcar_adsp_sound { ++ status = "okay"; ++ /* Multiple DAI */ ++ #sound-dai-cells = <1>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ adsp_port0: port@0 { ++ reg = <0>; ++ adsp_endpoint0: endpoint { ++ remote-endpoint = <&ak4613_endpoint0>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port1: port@1 { ++ reg = <1>; ++ adsp_endpoint1: endpoint { ++ remote-endpoint = <&ak4613_endpoint1>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port2: port@2 { ++ reg = <2>; ++ adsp_endpoint2: endpoint { ++ remote-endpoint = <&ak4613_endpoint2>; ++ dai-format = "left_j"; ++ }; ++ }; ++ adsp_port3: port@3 { ++ reg = <3>; ++ adsp_endpoint3: endpoint { ++ remote-endpoint = <&ak4613_endpoint3>; ++ dai-format = "left_j"; ++ }; ++ }; ++ }; ++}; ++ + &rcar_sound { + pinctrl-0 = <&sound_pins &sound_clk_pins>; + pinctrl-names = "default"; +@@ -737,7 +811,7 @@ + ports { + rsnd_port0: port@0 { + rsnd_endpoint0: endpoint { +- remote-endpoint = <&ak4613_endpoint>; ++ remote-endpoint = <&ak4613_endpoint4>; + + dai-format = "left_j"; + bitclock-master = <&rsnd_endpoint0>; +diff --git a/arch/arm64/boot/dts/renesas/r8a77990.dtsi b/arch/arm64/boot/dts/renesas/r8a77990.dtsi +index bd4d71e2b93e..845399adcbdb 100644 +--- a/arch/arm64/boot/dts/renesas/r8a77990.dtsi ++++ b/arch/arm64/boot/dts/renesas/r8a77990.dtsi +@@ -181,6 +181,11 @@ + method = "smc"; + }; + ++ rcar_adsp_sound: adsp_sound { ++ compatible = "renesas,rcar_adsp_sound_gen3"; ++ status = "disabled"; ++ }; ++ + /* External SCIF clock - to be overridden by boards that provide it */ + scif_clk: scif { + compatible = "fixed-clock"; +-- +2.19.1 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0006-ADSP-remove-HDMI-support-from-rcar-sound.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0006-ADSP-remove-HDMI-support-from-rcar-sound.patch new file mode 100644 index 00000000..3f601b64 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/0006-ADSP-remove-HDMI-support-from-rcar-sound.patch @@ -0,0 +1,101 @@ +From acd7751ebcce90a442588f37fc6731990b5e09ea Mon Sep 17 00:00:00 2001 +From: Nguyen Dang <nguyen.dang.wh@renesas.com> +Date: Tue, 6 Nov 2018 11:46:25 +0700 +Subject: [PATCH v2 6/6] ADSP: remove HDMI support from rcar-sound + +Signed-off-by: Nguyen Dang <nguyen.dang.wh@renesas.com> +[takeshi.kihara.df: support for dt file separation by M3v3.0 SoC] +Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com> +--- + arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 6 ------ + arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts | 6 ------ + arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 5 ----- + arch/arm64/boot/dts/renesas/r8a7796-salvator-xs-2x4g.dts | 5 ----- + arch/arm64/boot/dts/renesas/r8a7796-salvator-xs.dts | 5 ----- + 5 files changed, 27 deletions(-) + +diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +index 6928afbd8e06..b268afd7df85 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts ++++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +@@ -104,12 +104,6 @@ + status = "okay"; + }; + +-&sound_card { +- dais = <&rsnd_port0 /* ak4613 */ +- &rsnd_port1 /* HDMI0 */ +- &rsnd_port2>; /* HDMI1 */ +-}; +- + &hdmi0 { + status = "okay"; + +diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts b/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts +index 498f78875dbd..b6ec3036e9fd 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts ++++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-xs.dts +@@ -114,12 +114,6 @@ + status = "okay"; + }; + +-&sound_card { +- dais = <&rsnd_port0 /* ak4613 */ +- &rsnd_port1 /* HDMI0 */ +- &rsnd_port2>; /* HDMI1 */ +-}; +- + &hdmi0 { + status = "okay"; + +diff --git a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts +index cf92aa3939e3..4faf935c4a32 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts ++++ b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts +@@ -88,11 +88,6 @@ + "dclkin.0", "dclkin.1", "dclkin.2"; + }; + +-&sound_card { +- dais = <&rsnd_port0 /* ak4613 */ +- &rsnd_port1>; /* HDMI0 */ +-}; +- + &hdmi0 { + status = "okay"; + +diff --git a/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs-2x4g.dts b/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs-2x4g.dts +index 664dc9250bbb..13960f69b2f7 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs-2x4g.dts ++++ b/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs-2x4g.dts +@@ -96,11 +96,6 @@ + "dclkin.0", "dclkin.1", "dclkin.2"; + }; + +-&sound_card { +- dais = <&rsnd_port0 /* ak4613 */ +- &rsnd_port1>; /* HDMI0 */ +-}; +- + &hdmi0 { + status = "okay"; + +diff --git a/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs.dts b/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs.dts +index 7d39dc96ac8a..1cd6f0463361 100644 +--- a/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs.dts ++++ b/arch/arm64/boot/dts/renesas/r8a7796-salvator-xs.dts +@@ -88,11 +88,6 @@ + "dclkin.0", "dclkin.1", "dclkin.2"; + }; + +-&sound_card { +- dais = <&rsnd_port0 /* ak4613 */ +- &rsnd_port1>; /* HDMI0 */ +-}; +- + &hdmi0 { + status = "okay"; + +-- +2.21.0 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/Make-perf-able-to-build-with-latest-libbfd.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/Make-perf-able-to-build-with-latest-libbfd.patch new file mode 100644 index 00000000..1747f2d9 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/Make-perf-able-to-build-with-latest-libbfd.patch @@ -0,0 +1,36 @@ +Index: perf-1.0/tools/perf/util/srcline.c +=================================================================== +--- perf-1.0.orig/tools/perf/util/srcline.c ++++ perf-1.0/tools/perf/util/srcline.c +@@ -139,16 +139,30 @@ static void find_address_in_section(bfd + bfd_vma pc, vma; + bfd_size_type size; + struct a2l_data *a2l = data; ++ flagword flags; + + if (a2l->found) + return; + +- if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0) ++#ifdef bfd_get_section_flags ++ flags = bfd_get_section_flags(abfd, section); ++#else ++ flags = bfd_section_flags(section); ++#endif ++ if ((flags & SEC_ALLOC) == 0) + return; + + pc = a2l->addr; ++#ifdef bfd_get_section_vma + vma = bfd_get_section_vma(abfd, section); ++#else ++ vma = bfd_section_vma(section); ++#endif ++#ifdef bfd_get_section_size + size = bfd_get_section_size(section); ++#else ++ size = bfd_section_size(section); ++#endif + + if (pc < vma || pc >= vma + size) + return; diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/adsp.cfg b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/adsp.cfg new file mode 100644 index 00000000..f19e8d29 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/adsp.cfg @@ -0,0 +1,3 @@ +CONFIG_SND_SOC_ADSP=y +CONFIG_SND_SOC_I2C_AND_SPI=y + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/capacity_aware_migration_strategy.cfg b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/capacity_aware_migration_strategy.cfg new file mode 100644 index 00000000..e8b09aa7 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/capacity_aware_migration_strategy.cfg @@ -0,0 +1 @@ +CONFIG_SCHED_DEBUG=y diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/iccom.cfg b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/iccom.cfg new file mode 100644 index 00000000..a3923c19 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/iccom.cfg @@ -0,0 +1 @@ +CONFIG_RPMSG_VIRTIO=y diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/touch.cfg b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/touch.cfg new file mode 100644 index 00000000..327c753a --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/touch.cfg @@ -0,0 +1 @@ +CONFIG_HID_MULTITOUCH=y diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/usb-video-class.cfg b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/usb-video-class.cfg new file mode 100644 index 00000000..7446787d --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/usb-video-class.cfg @@ -0,0 +1,68 @@ +CONFIG_MEDIA_USB_SUPPORT=y + +# +# Webcam devices +# +CONFIG_USB_VIDEO_CLASS=y +CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y +CONFIG_USB_GSPCA=m +# CONFIG_USB_M5602 is not set +# CONFIG_USB_STV06XX is not set +# CONFIG_USB_GL860 is not set +# CONFIG_USB_GSPCA_BENQ is not set +# CONFIG_USB_GSPCA_CONEX is not set +# CONFIG_USB_GSPCA_CPIA1 is not set +# CONFIG_USB_GSPCA_DTCS033 is not set +# CONFIG_USB_GSPCA_ETOMS is not set +# CONFIG_USB_GSPCA_FINEPIX is not set +# CONFIG_USB_GSPCA_JEILINJ is not set +# CONFIG_USB_GSPCA_JL2005BCD is not set +# CONFIG_USB_GSPCA_KINECT is not set +# CONFIG_USB_GSPCA_KONICA is not set +# CONFIG_USB_GSPCA_MARS is not set +# CONFIG_USB_GSPCA_MR97310A is not set +# CONFIG_USB_GSPCA_NW80X is not set +# CONFIG_USB_GSPCA_OV519 is not set +# CONFIG_USB_GSPCA_OV534 is not set +# CONFIG_USB_GSPCA_OV534_9 is not set +# CONFIG_USB_GSPCA_PAC207 is not set +# CONFIG_USB_GSPCA_PAC7302 is not set +# CONFIG_USB_GSPCA_PAC7311 is not set +# CONFIG_USB_GSPCA_SE401 is not set +# CONFIG_USB_GSPCA_SN9C2028 is not set +# CONFIG_USB_GSPCA_SN9C20X is not set +# CONFIG_USB_GSPCA_SONIXB is not set +# CONFIG_USB_GSPCA_SONIXJ is not set +# CONFIG_USB_GSPCA_SPCA500 is not set +# CONFIG_USB_GSPCA_SPCA501 is not set +# CONFIG_USB_GSPCA_SPCA505 is not set +# CONFIG_USB_GSPCA_SPCA506 is not set +# CONFIG_USB_GSPCA_SPCA508 is not set +# CONFIG_USB_GSPCA_SPCA561 is not set +# CONFIG_USB_GSPCA_SPCA1528 is not set +# CONFIG_USB_GSPCA_SQ905 is not set +# CONFIG_USB_GSPCA_SQ905C is not set +# CONFIG_USB_GSPCA_SQ930X is not set +# CONFIG_USB_GSPCA_STK014 is not set +# CONFIG_USB_GSPCA_STK1135 is not set +# CONFIG_USB_GSPCA_STV0680 is not set +# CONFIG_USB_GSPCA_SUNPLUS is not set +# CONFIG_USB_GSPCA_T613 is not set +# CONFIG_USB_GSPCA_TOPRO is not set +# CONFIG_USB_GSPCA_TOUPTEK is not set +# CONFIG_USB_GSPCA_TV8532 is not set +# CONFIG_USB_GSPCA_VC032X is not set +# CONFIG_USB_GSPCA_VICAM is not set +# CONFIG_USB_GSPCA_XIRLINK_CIT is not set +# CONFIG_USB_GSPCA_ZC3XX is not set +# CONFIG_USB_PWC is not set +# CONFIG_VIDEO_CPIA2 is not set +# CONFIG_USB_ZR364XX is not set +# CONFIG_USB_STKWEBCAM is not set +# CONFIG_USB_S2255 is not set +# CONFIG_VIDEO_USBTV is not set + +# +# Webcam, TV (analog/digital) USB devices +# +# CONFIG_VIDEO_EM28XX is not set diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/usb3.cfg b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/usb3.cfg new file mode 100644 index 00000000..f58b942c --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas/usb3.cfg @@ -0,0 +1,4 @@ +CONFIG_FW_LOADER=y +CONFIG_FIRMWARE_IN_KERNEL=y +CONFIG_EXTRA_FIRMWARE="r8a779x_usb3_v2.dlmem r8a779x_usb3_v3.dlmem" +CONFIG_EXTRA_FIRMWARE_DIR="firmware" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb new file mode 100644 index 00000000..d629ba1f --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-kernel/linux/linux-renesas_4.14.bb @@ -0,0 +1,93 @@ +DESCRIPTION = "Linux kernel for the R-Car Generation 3 based board" + +require include/avb-control.inc +require include/iccom-control.inc +require recipes-kernel/linux/linux-yocto.inc +require include/cas-control.inc +require include/adsp-control.inc + +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}/:" +COMPATIBLE_MACHINE = "salvator-x|h3ulcb|m3ulcb|m3nulcb|ebisu" + +RENESAS_BSP_URL = " \ + git://github.com/renesas-rcar/linux-bsp.git" +BRANCH = "v4.14.75-ltsi/rcar-3.9.9" +SRCREV = "4d2a32e5d314e2c77346f13e8736e97ca3e1b90b" + +SRC_URI = "${RENESAS_BSP_URL};protocol=git;nocheckout=1;branch=${BRANCH}" + +LINUX_VERSION ?= "4.14.75" +PV = "${LINUX_VERSION}+git${SRCPV}" +PR = "r1" + +# For generating defconfig +KCONFIG_MODE = "--alldefconfig" +KBUILD_DEFCONFIG = "defconfig" + +SRC_URI_append = " \ + file://touch.cfg \ + ${@oe.utils.conditional("USE_AVB", "1", " file://usb-video-class.cfg", "", d)} \ +" + +# Add python3 support to fix Perf build failure +# Add patch to build perf with new libbfd +SRC_URI_append = " \ + file://0001-perf-tools-Add-Python-3-support.patch \ + file://Make-perf-able-to-build-with-latest-libbfd.patch \ +" + +# Fix patch for Weston 8.0.0 issue +SRC_URI_append = " \ + file://0001-drm-rcar-du-Set-primary-plane-zpos-immutably-at-init.patch \ +" + +# Enable RPMSG_VIRTIO depend on ICCOM +SUPPORT_ICCOM = " \ + file://0001-rpmsg-Add-message-to-be-able-to-configure-RPMSG_VIRT.patch \ + file://iccom.cfg \ +" + +SRC_URI_append = " \ + ${@oe.utils.conditional("USE_ICCOM", "1", "${SUPPORT_ICCOM}", "", d)} \ +" + +# Add SCHED_DEBUG config fragment to support CAS +SRC_URI_append = " \ + ${@oe.utils.conditional("USE_CAS", "1", " file://capacity_aware_migration_strategy.cfg", "",d)} \ +" + +# Add ADSP ALSA driver +SUPPORT_ADSP_ASOC = " \ + file://0001-ADSP-add-document-for-compatible-string-renesas-rcar.patch \ + file://0002-ADSP-add-ADSP-sound-driver-source.patch \ + file://0003-ADSP-add-build-for-ADSP-sound-driver.patch \ + file://0004-ADSP-integrate-ADSP-sound-for-H3-M3-M3N-board.patch \ + file://0005-ADSP-integrate-ADSP-sound-for-E3-board.patch \ + file://0006-ADSP-remove-HDMI-support-from-rcar-sound.patch \ + file://adsp.cfg \ +" + +SRC_URI_append = " \ + ${@oe.utils.conditional("USE_ADSP", "1", "${SUPPORT_ADSP_ASOC}", "", d)} \ +" + +# Install USB3.0 firmware to rootfs +USB3_FIRMWARE_V2 = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/r8a779x_usb3_v2.dlmem;md5sum=645db7e9056029efa15f158e51cc8a11" +USB3_FIRMWARE_V3 = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/r8a779x_usb3_v3.dlmem;md5sum=687d5d42f38f9850f8d5a6071dca3109" + +SRC_URI_append = " \ + ${USB3_FIRMWARE_V2} \ + ${USB3_FIRMWARE_V3} \ + ${@bb.utils.contains('MACHINE_FEATURES','usb3','file://usb3.cfg','',d)} \ +" + +# W/A Fix build issue with Linux v4.14 +SRC_URI_append = " \ + file://0001-arm64-bpf-correct-broken-uapi-for-BPF_PROG_TYPE_PERF.patch \ +" + +do_download_firmware () { + install -m 755 ${WORKDIR}/r8a779x_usb3_v*.dlmem ${STAGING_KERNEL_DIR}/firmware +} + +addtask do_download_firmware after do_configure before do_compile diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/adsp-module/adsp-fw-module.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/adsp-module/adsp-fw-module.bb new file mode 100644 index 00000000..2a7e37a3 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/adsp-module/adsp-fw-module.bb @@ -0,0 +1,32 @@ +DESCRIPTION = "ADSP Framework for Linux" +LICENSE = "CLOSED" + +inherit features_check + +REQUIRED_DISTRO_FEATURES = "adsp" +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" + +SRC_URI = "file://RCG3AHFWN0201ZDP.tar.gz" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +S = "${WORKDIR}/RCG3AHFWN0201ZDP" + +do_install() { + # create the firmware dir + install -d ${D}/lib/firmware + + # install the firmware bin + install -m 0644 ${S}/lib/firmware/xf-rcar.fw ${D}/lib/firmware +} + +PACKAGES = " \ + ${PN} \ +" + +FILES_${PN} = " \ + /lib/firmware \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/adsp-module/adsp-if-module.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/adsp-module/adsp-if-module.bb new file mode 100644 index 00000000..ea12f564 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/adsp-module/adsp-if-module.bb @@ -0,0 +1,61 @@ +DESCRIPTION = "ADSP Interface for Linux" +LICENSE = "CLOSED" + +inherit features_check + +REQUIRED_DISTRO_FEATURES = "adsp" + +DEPENDS += "kernel-module-xtensa-hifi" + +SRC_URI = "file://RCG3AHIFL4101ZDP.tar.gz" + +S = "${WORKDIR}/RCG3AHIFL4101ZDP" + +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" +PACKAGE_ARCH = "${MACHINE_ARCH}" + +# Don't need to do_configure +do_configure[noexec] = "1" + +# Don't use EXTRA_OEMAKE default value to avoid default CFLAGS, LDFLAGS +# of poky override the CFLAGS, LDFLAGS inside RCG3AHIFL4101ZDP/Makefile +EXTRA_OEMAKE = "INCSHARED=${STAGING_INCDIR}" + +do_compile() { + cd ${S} + oe_runmake +} + +do_install() { + # Create destination directory + install -d ${D}/${libdir} + install -d ${D}/${includedir} + install -d ${D}/${includedir}/sys/fio + install -d ${D}/${includedir}/os/linux + + # Copy library + install -m 0755 ${S}/libRCG3AHIFL4101ZDP.so.1.0 ${D}/${libdir} + + # Copy shared header files + install -m 0644 ${S}/include/*.h ${D}/${includedir} + install -m 0644 ${S}/include/sys/fio/*.h ${D}/${includedir}/sys/fio/ + install -m 0644 ${S}/include/os/linux/*.h ${D}/${includedir}/os/linux/ + + # Create the symbolic link + cd ${D}/${libdir} + ln -s libRCG3AHIFL4101ZDP.so.1.0 libRCG3AHIFL4101ZDP.so.1 + ln -s libRCG3AHIFL4101ZDP.so.1 libRCG3AHIFL4101ZDP.so +} + +PACKAGES = " \ + ${PN} \ + ${PN}-dev \ + ${PN}-dbg \ +" + +INSANE_SKIP_${PN} += "dev-so" + +FILES_${PN} += " \ + ${libdir}/*.so* \ + ${includedir} \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/avb-applications/avb-applications.inc b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/avb-applications/avb-applications.inc new file mode 100644 index 00000000..1a82eed4 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/avb-applications/avb-applications.inc @@ -0,0 +1,8 @@ +require include/rcar-gen3-modules-common.inc + +inherit features_check + +REQUIRED_DISTRO_FEATURES = "avb" + +SRC_URI = "gitsm://github.com/renesas-rcar/avb-applications.git;branch=rcar-gen3" +SRCREV = "8398f6e66eaf487eaf8e9a2a8d60f222456c06a6" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/avb-applications/avb-demoapps.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/avb-applications/avb-demoapps.bb new file mode 100644 index 00000000..455768bf --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/avb-applications/avb-demoapps.bb @@ -0,0 +1,108 @@ +DESCRIPTION = "Renesas Ethernet AVB demo applications" + +require avb-applications.inc + +LICENSE = "MIT & BSD" +LIC_FILES_CHKSUM = " \ + file://COPYING.MIT;md5=96659f2a7571bfa27483882a653c3bb9 \ + file://lib/msrp/LICENSE.BSD;md5=60ba0ea0afdcbf8d26ce31ce1503aba3 \ + file://lib/avdecc/jdksavdecc-c/COPYRIGHT;md5=6592ded5140540a936b8d98ed1b6a577 \ + file://avblauncher/inih/LICENSE.txt;md5=a7a95d2af90376e85a05318794e6f202 \ +" + +DEPENDS = "kernel-module-avb-streaming libyaml cmake-native" + +S = "${WORKDIR}/git/avb-demoapps" + +includedir = "${RENESAS_DATADIR}/include" + +EXTRA_OEMAKE = "'CC=${CC}' 'AR=${AR}'" + +do_install_append() { + oe_runmake install INSTALL_DIR=${D}/${bindir} + + # Create install directories + install -d ${D}/${sysconfdir}/linuxptp + install -d ${D}/${sysconfdir}/daemon_cl + install -d ${D}/${sysconfdir}/avblauncher + + # Install + install -m 644 ${S}/etc/linuxptp/avb-demoapps.cfg ${D}/${sysconfdir}/linuxptp + install -m 644 ${S}/etc/daemon_cl/gptp_cfg.ini ${D}/${sysconfdir}/daemon_cl + install -m 755 ${S}/etc/avblauncher/mse_aaf_pcm.sh ${D}/${sysconfdir}/avblauncher + install -m 644 ${S}/etc/avblauncher/mse_aaf_pcm_listener.ini ${D}/${sysconfdir}/avblauncher + install -m 644 ${S}/etc/avblauncher/mse_aaf_pcm_talker.ini ${D}/${sysconfdir}/avblauncher + install -m 755 ${S}/etc/avblauncher/mse_cvf_h264.sh ${D}/${sysconfdir}/avblauncher + install -m 755 ${S}/etc/avblauncher/mse_cvf_h264_d13.sh ${D}/${sysconfdir}/avblauncher + install -m 644 ${S}/etc/avblauncher/mse_cvf_h264_d13_listener.ini ${D}/${sysconfdir}/avblauncher + install -m 644 ${S}/etc/avblauncher/mse_cvf_h264_d13_talker.ini ${D}/${sysconfdir}/avblauncher + install -m 644 ${S}/etc/avblauncher/mse_cvf_h264_listener.ini ${D}/${sysconfdir}/avblauncher + install -m 644 ${S}/etc/avblauncher/mse_cvf_h264_talker.ini ${D}/${sysconfdir}/avblauncher + install -m 755 ${S}/etc/avblauncher/mse_cvf_mjpeg.sh ${D}/${sysconfdir}/avblauncher + install -m 644 ${S}/etc/avblauncher/mse_cvf_mjpeg_listener.ini ${D}/${sysconfdir}/avblauncher + install -m 644 ${S}/etc/avblauncher/mse_cvf_mjpeg_talker.ini ${D}/${sysconfdir}/avblauncher + install -m 755 ${S}/etc/avblauncher/mse_iec61883_4.sh ${D}/${sysconfdir}/avblauncher + install -m 644 ${S}/etc/avblauncher/mse_iec61883_4_listener.ini ${D}/${sysconfdir}/avblauncher + install -m 644 ${S}/etc/avblauncher/mse_iec61883_4_talker.ini ${D}/${sysconfdir}/avblauncher + install -m 755 ${S}/etc/avblauncher/mse_iec61883_6.sh ${D}/${sysconfdir}/avblauncher + install -m 644 ${S}/etc/avblauncher/mse_iec61883_6_listener.ini ${D}/${sysconfdir}/avblauncher + install -m 644 ${S}/etc/avblauncher/mse_iec61883_6_talker.ini ${D}/${sysconfdir}/avblauncher + install -m 755 ${S}/etc/avblauncher/simple_application.sh ${D}/${sysconfdir}/avblauncher + install -m 644 ${S}/etc/avblauncher/simple_listener.ini ${D}/${sysconfdir}/avblauncher + install -m 644 ${S}/etc/avblauncher/simple_talker.ini ${D}/${sysconfdir}/avblauncher + install -m 644 ${S}/etc/avblauncher/avdecc_entity_audio.yaml ${D}/${sysconfdir}/avblauncher +} + +PACKAGES =+ " \ + ${PN}-simple \ + ${PN}-mrpdummy \ + ${PN}-avblauncher \ +" + +ALLOW_EMPTY_${PN} = "1" + +FILES_${PN}-mrpdummy = " \ + ${bindir}/mrpdummy \ +" + +FILES_${PN}-avblauncher = " \ + ${sysconfdir}/daemon_cl/gptp_cfg.ini \ + ${sysconfdir}/avblauncher/mse_aaf_pcm.sh \ + ${sysconfdir}/avblauncher/mse_aaf_pcm_listener.ini \ + ${sysconfdir}/avblauncher/mse_aaf_pcm_talker.ini \ + ${sysconfdir}/avblauncher/mse_cvf_h264.sh \ + ${sysconfdir}/avblauncher/mse_cvf_h264_d13.sh \ + ${sysconfdir}/avblauncher/mse_cvf_h264_d13_listener.ini \ + ${sysconfdir}/avblauncher/mse_cvf_h264_d13_talker.ini \ + ${sysconfdir}/avblauncher/mse_cvf_h264_listener.ini \ + ${sysconfdir}/avblauncher/mse_cvf_h264_talker.ini \ + ${sysconfdir}/avblauncher/mse_cvf_mjpeg.sh \ + ${sysconfdir}/avblauncher/mse_cvf_mjpeg_listener.ini \ + ${sysconfdir}/avblauncher/mse_cvf_mjpeg_talker.ini \ + ${sysconfdir}/avblauncher/mse_iec61883_4.sh \ + ${sysconfdir}/avblauncher/mse_iec61883_4_listener.ini \ + ${sysconfdir}/avblauncher/mse_iec61883_4_talker.ini \ + ${sysconfdir}/avblauncher/mse_iec61883_6.sh \ + ${sysconfdir}/avblauncher/mse_iec61883_6_listener.ini \ + ${sysconfdir}/avblauncher/mse_iec61883_6_talker.ini \ + ${sysconfdir}/avblauncher/simple_application.sh \ + ${sysconfdir}/avblauncher/simple_listener.ini \ + ${sysconfdir}/avblauncher/simple_talker.ini \ + ${sysconfdir}/avblauncher/avdecc_entity_audio.yaml \ + ${bindir}/avblauncher \ +" + +FILES_${PN}-simple = " \ + ${sysconfdir}/linuxptp/avb-demoapps.cfg \ + ${bindir}/simple_talker \ + ${bindir}/simple_listener \ +" + +RDEPENDS_${PN} = " \ + ${PN}-simple \ + ${PN}-avblauncher \ +" + +RDEPENDS_${PN}-avblauncher = " \ + ${PN}-mrpdummy \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/avb-applications/avbtool.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/avb-applications/avbtool.bb new file mode 100644 index 00000000..5c002776 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/avb-applications/avbtool.bb @@ -0,0 +1,17 @@ +DESCRIPTION = "Utility tool of the AVB Streaming Driver for Linux for the R-Car Gen3" + +require avb-applications.inc + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://COPYING.MIT;md5=96659f2a7571bfa27483882a653c3bb9" + +DEPENDS = "kernel-module-avb-streaming" + +S = "${WORKDIR}/git/avbtool" + +EXTRA_OEMAKE = "'CC=${CC}'" + +do_install_append() { + install -d ${D}/${bindir} + install -m 755 ${S}/avbtool ${D}/${bindir} +} diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/cms-module/cms-user-module.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/cms-module/cms-user-module.bb new file mode 100644 index 00000000..ff2b8d2a --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/cms-module/cms-user-module.bb @@ -0,0 +1,75 @@ +DESCRIPTION = "R-Car Gen3 Color Management System" +LICENSE = "CLOSED" + +require include/cms-control.inc + +SRC_CMSBCM = "${@bb.utils.contains('USE_CMSBCM', '1', 'file://RTM0AC0000JRCMBCV0SL41C.tar.gz;subdir=cms/bcm', '', d)}" +SRC_CMSBLC = "${@bb.utils.contains('USE_CMSBLC', '1', 'file://RTM0AC0000JRCMBLC0SL41C.tar.gz;subdir=cms/blc', '', d)}" +SRC_CMSDGC = "${@bb.utils.contains('USE_CMSDGC', '1', 'file://RTM0AC0000JRCMDGV0SL41C.tar.gz;subdir=cms/dgc', '', d)}" + +SRC_URI = " \ + ${SRC_CMSBCM} \ + ${SRC_CMSBLC} \ + ${SRC_CMSDGC} \ +" + +S = "${WORKDIR}/cms" + +PACKAGE_ARCH = "${MACHINE_ARCH}" +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install() { + # Create the lib directory + install -d ${D}/${libdir} + + if [ "X${USE_CMSBCM}" = "X1" ]; then + install -d ${D}/${includedir}/cms/bcm + install -m 755 ${S}/bcm/${baselib}/libcmsbcm.so.2.0.0 ${D}/${libdir} + install -m 644 ${S}/bcm/include/*.h ${D}/${includedir}/cms/bcm + + cd ${D}/${libdir} + ln -s libcmsbcm.so.2.0.0 libcmsbcm.so.1 + ln -s libcmsbcm.so.1 libcmsbcm.so + fi + + if [ "X${USE_CMSBLC}" = "X1" ]; then + install -d ${D}/${includedir}/cms/blc + install -m 755 ${S}/blc/${baselib}/libcmsblc.so.2.0.0 ${D}/${libdir} + install -m 644 ${S}/blc/include/*.h ${D}/${includedir}/cms/blc + + cd ${D}/${libdir} + ln -s libcmsblc.so.2.0.0 libcmsblc.so.1 + ln -s libcmsblc.so.1 libcmsblc.so + fi + + if [ "X${USE_CMSDGC}" = "X1" ]; then + install -d ${D}/${includedir}/cms/dgc + install -m 755 ${S}/dgc/${baselib}/libcmsdgc.so.2.0.0 ${D}/${libdir} + install -m 644 ${S}/dgc/include/*.h ${D}/${includedir}/cms/dgc + + cd ${D}/${libdir} + ln -s libcmsdgc.so.2.0.0 libcmsdgc.so.1 + ln -s libcmsdgc.so.1 libcmsdgc.so + fi +} + +FILES_${PN} = " \ + ${libdir}/*.so.* \ + ${libdir}/lib*.so \ +" + +FILES_${PN}-dev = " \ + ${includedir} \ +" + +INSANE_SKIP_${PN} = "dev-so" + +# Skip debug strip of do_populate_sysroot() +INHIBIT_SYSROOT_STRIP = "1" + +# Skip debug split and strip of do_package() +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/dtv-module/dtv-user-module.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/dtv-module/dtv-user-module.bb new file mode 100644 index 00000000..a5b86453 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/dtv-module/dtv-user-module.bb @@ -0,0 +1,74 @@ +DESCRIPTION = "ISDB-T DTV Software Package for Linux for the R-Car Gen3" +LICENSE = "CLOSED" + +require include/rcar-gen3-modules-common.inc +require include/dtv-dvd-control.inc + +inherit features_check + +DEPENDS = " \ + kernel-module-vspmif mmngr-user-module \ + vspmif-user-module kernel-module-vspm \ + omx-user-module kernel-module-uvcs-drv \ + kernel-module-scu-src kernel-module-ssp \ + kernel-module-tddmac kernel-module-tsif \ +" + +PN = "dtv-user-module" +PR = "r0" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +REQUIRED_DISTRO_FEATURES = "dtv" + +SRC_URI_DTV_SW = "file://Software.tar.gz" +SRC_URI_DTV_UDF = "file://Reference.tar.gz" + +SRC_URI = " \ + ${SRC_URI_DTV_SW} \ + ${SRC_URI_DTV_UDF} \ +" + +S = "${WORKDIR}" + +includedir = "${RENESAS_DATADIR}/include" + +# do_configure() nothing +do_configure[noexec] = "1" +# do_compile() nothing +do_compile[noexec] = "1" + +do_install() { + # Create destination folders + install -d ${D}/${libdir} + install -d ${D}${RENESAS_DATADIR}/include + install -d ${D}${RENESAS_DATADIR}/src/dtv/reference + + # Copy library + install -m 644 ${S}/${baselib}/*.a ${D}/${libdir}/ + + # Copy shared header files + install -m 644 ${S}/include/*.h ${D}${RENESAS_DATADIR}/include + + # Copy reference files + install -m 644 ${S}/userfunc/*.h ${D}${RENESAS_DATADIR}/src/dtv/reference + install -m 644 ${S}/userfunc/*.c ${D}${RENESAS_DATADIR}/src/dtv/reference +} + +PACKAGES = " \ + ${PN} \ + ${PN}-dev \ + ${PN}-staticdev \ +" + +FILES_${PN} = "" +ALLOW_EMPTY_${PN} = "1" + +FILES_${PN}-dev = " \ + ${RENESAS_DATADIR}/include/*.h \ + ${RENESAS_DATADIR}/src/dtv/reference/* \ +" +FILES_${PN}-staticdev = " \ + ${libdir}/*.a \ +" +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/dvd-module/dvd-encryption-module.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/dvd-module/dvd-encryption-module.bb new file mode 100644 index 00000000..8651b4f7 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/dvd-module/dvd-encryption-module.bb @@ -0,0 +1,54 @@ +DESCRIPTION = "DVD Encryption Library for Linux RCar Gen3" +LICENSE = "CLOSED" + +require include/rcar-gen3-path-common.inc + +inherit features_check +REQUIRED_DISTRO_FEATURES = "dvd_encryption_library" + +PACKAGE_ARCH = "${MACHINE_ARCH}" +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" + +SRC_URI = " \ + file://Software.tar.gz \ +" + +S = "${WORKDIR}" + +includedir = "${RENESAS_DATADIR}/include" + +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install() { + install -d ${D}${base_libdir}/optee_armtz + install -d ${D}${RENESAS_DATADIR}/include + install -d ${D}${libdir} + + install -m 644 ${S}/TEE/DynamicTA/*.ta \ + ${D}${base_libdir}/optee_armtz/ + install -m 644 ${S}/TEEC/include/avc_copdvd.h \ + ${D}${RENESAS_DATADIR}/include/ + install -m 644 ${S}/TEEC/lib/libcopdvd.a \ + ${D}${libdir} +} + +PACKAGES = " \ + ${PN} \ + ${PN}-dev \ + ${PN}-staticdev \ +" + +FILES_${PN} = " \ + ${base_libdir}/optee_armtz/*.ta \ +" + +FILES_${PN}-dev = " \ + ${RENESAS_DATADIR}/include/avc_copdvd.h \ +" + +FILES_${PN}-staticdev = " \ + ${libdir}/libcopdvd.a \ +" + +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/dvd-module/dvd-user-module.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/dvd-module/dvd-user-module.bb new file mode 100644 index 00000000..35908075 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/dvd-module/dvd-user-module.bb @@ -0,0 +1,64 @@ +DESCRIPTION = "DVD Core-Middleware for Linux for the R-Car Gen3" +LICENSE = "CLOSED" + +require include/rcar-gen3-modules-common.inc +require include/dtv-dvd-control.inc + +inherit features_check + +DEPENDS = " \ + kernel-module-vspmif mmngr-user-module \ + vspmif-user-module kernel-module-vspm \ + omx-user-module kernel-module-uvcs-drv \ +" + +PN = "dvd-user-module" +PR = "r0" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +REQUIRED_DISTRO_FEATURES = "dvd" + +SRC_URI_DVD_SW = "file://Software.tar.gz" + +SRC_URI = " \ + ${SRC_URI_DVD_SW} \ +" + +S = "${WORKDIR}" + +includedir = "${RENESAS_DATADIR}/include" + +# do_configure() nothing +do_configure[noexec] = "1" +# do_compile() nothing +do_compile[noexec] = "1" + +do_install() { + # Create destination folders + install -d ${D}/${libdir} + install -d ${D}${RENESAS_DATADIR}/include + + # Copy library + install -m 644 ${S}/${baselib}/*.a ${D}/${libdir} + + # Copy shared header files + install -m 644 ${S}/include/*.h ${D}${RENESAS_DATADIR}/include +} + +PACKAGES = " \ + ${PN} \ + ${PN}-dev \ + ${PN}-staticdev \ +" + +FILES_${PN} = "" +ALLOW_EMPTY_${PN} = "1" + +FILES_${PN}-dev = " \ + ${RENESAS_DATADIR}/include/*.h \ +" +FILES_${PN}-staticdev = " \ + ${libdir}/*.a \ +" +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-omx/gstomx.conf b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-omx/gstomx.conf new file mode 100644 index 00000000..5fca3ee8 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-omx/gstomx.conf @@ -0,0 +1,131 @@ +[omxh264dec] +type-name=GstOMXH264Dec +core-name=@RENESAS_DATADIR@/lib/libomxr_core.so +component-name=OMX.RENESAS.VIDEO.DECODER.H264 +rank=512 +in-port-index=0 +out-port-index=1 +hacks=no-disable-outport;default-pix-aspect-ratio;no-component-reconfigure +sink-template-caps=video/x-h264,alignment=(string)au,stream-format=(string)byte-stream,width=(int)[1, MAX],height=(int)[1, MAX] +src-template-caps=video/x-raw,format=(string){NV12,I420},width=(int)[1, MAX],height=(int)[1, MAX] + +[omxaaclcdec] +type-name=GstOMXAACDec +core-name=@RENESAS_DATADIR@/lib/libomxr_core.so +component-name=OMX.RENESAS.AUDIO.DECODER.AACLC +rank=256 +in-port-index=0 +out-port-index=1 +hacks=no-disable-outport +sink-template-caps=audio/mpeg,mpegversion=(int){2,4},stream-format=(string){raw,adts},rate=(int)[8000,96000],channels=(int)[1,2],framed=(boolean)true +src-template-caps=audio/x-raw,rate=(int)[8000,96000],channels=(int)[1,2],format=(string)S16LE + +[omxmpeg4videodec] +type-name=GstOMXMPEG4VideoDec +core-name=@RENESAS_DATADIR@/lib/libomxr_core.so +component-name=OMX.RENESAS.VIDEO.DECODER.MPEG4 +rank=256 +in-port-index=0 +out-port-index=1 +hacks=no-disable-outport;default-pix-aspect-ratio;no-component-reconfigure +sink-template-caps=video/mpeg,mpegversion=(int)4,systemstream=(boolean)false,parsed=(boolean)true,width=(int)[1, MAX],height=(int)[1, MAX] +src-template-caps=video/x-raw,format=(string){NV12,I420},width=(int)[1, MAX],height=(int)[1, MAX] + +[omxvc1dec] +type-name=GstOMXWMVDec +core-name=@RENESAS_DATADIR@/lib/libomxr_core.so +component-name=OMX.RENESAS.VIDEO.DECODER.VC1 +rank=256 +in-port-index=0 +out-port-index=1 +hacks=no-disable-outport;default-pix-aspect-ratio;no-component-reconfigure +sink-template-caps=video/x-wmv,wmvversion=(int)3,width=(int)[1, MAX],height=(int)[1, MAX] +src-template-caps=video/x-raw,format=(string){NV12,I420},width=(int)[1, MAX],height=(int)[1, MAX] + +[omxh265dec] +type-name=GstOMXH265Dec +core-name=@RENESAS_DATADIR@/lib/libomxr_core.so +component-name=OMX.RENESAS.VIDEO.DECODER.H265 +rank=256 +in-port-index=0 +out-port-index=1 +hacks=no-disable-outport;default-pix-aspect-ratio;no-component-reconfigure +sink-template-caps=video/x-h265,alignment=(string)au,stream-format=(string)byte-stream,width=(int)[1, MAX],height=(int)[1, MAX] +src-template-caps=video/x-raw,format=(string){NV12,I420},width=(int)[1, MAX],height=(int)[1, MAX] + +[omxaacdec] +type-name=GstOMXAACDec +core-name=@RENESAS_DATADIR@/lib/libomxr_core.so +component-name=OMX.RENESAS.AUDIO.DECODER.AAC +rank=256 +in-port-index=0 +out-port-index=1 +hacks=no-disable-outport +sink-template-caps=audio/mpeg,mpegversion=(int){2,4},stream-format=(string){raw,adts},rate=(int)[8000,48000],channels=(int)[1,6],framed=(boolean)true +src-template-caps=audio/x-raw,rate=(int)[8000,48000],channels=(int){1,2,6},format=(string)S16LE + +[omxmp3dec] +type-name=GstOMXMP3Dec +core-name=@RENESAS_DATADIR@/lib/libomxr_core.so +component-name=OMX.RENESAS.AUDIO.DECODER.MP3 +rank=256 +in-port-index=0 +out-port-index=1 +hacks=no-disable-outport +sink-template-caps=audio/mpeg,mpegversion=(int)1,layer=(int)[1,3],mpegaudioversion=(int)[1,3],rate=(int)[8000,48000],channels=(int)[1,2],parsed=(boolean) true +src-template-caps=audio/x-raw,rate=(int)[8000,48000],channels=(int){1,2},format=(string)S16LE + +[omxwmadec] +type-name=GstOMXWMADec +core-name=@RENESAS_DATADIR@/lib/libomxr_core.so +component-name=OMX.RENESAS.AUDIO.DECODER.WMA +rank=256 +in-port-index=0 +out-port-index=1 +hacks=no-disable-outport;skip-handle-codec-data +sink-template-caps=audio/x-wma,wmaversion=(int)2,rate=(int)[8000,48000],channels=(int){1,2},block_align=(int)[0,2147483647],bitrate=(int)[0,2147483647] +src-template-caps=audio/x-raw,rate=(int)[8000,48000],channels=(int){1,2},format=(string)S16LE + +[omxh264enc] +type-name=GstOMXH264Enc +core-name=@RENESAS_DATADIR@/lib/libomxr_core.so +component-name=OMX.RENESAS.VIDEO.ENCODER.H264 +rank=256 +in-port-index=0 +out-port-index=1 +hacks=no-disable-outport;renesas-encmc-stride-align +sink-template-caps=video/x-raw,format=(string){NV12,I420},width=(int)[80,3840],height=(int)[80,2160] +src-template-caps=video/x-h264,stream-format=(string)byte-stream,width=(int)[80,3840],height=(int)[80,2160] + +[omxvp8dec] +type-name=GstOMXVP8Dec +core-name=@RENESAS_DATADIR@/lib/libomxr_core.so +component-name=OMX.RENESAS.VIDEO.DECODER.VP8 +rank=256 +in-port-index=0 +out-port-index=1 +hacks=no-disable-outport;default-pix-aspect-ratio;no-component-reconfigure +sink-template-caps=video/x-vp8,width=(int)[1, MAX],height=(int)[1, MAX] +src-template-caps=video/x-raw,format=(string){NV12,I420},width=(int)[1, MAX],height=(int)[1, MAX] + +[omxvp8enc] +type-name=GstOMXVP8Enc +core-name=@RENESAS_DATADIR@/lib/libomxr_core.so +component-name=OMX.RENESAS.VIDEO.ENCODER.VP8 +rank=256 +in-port-index=0 +out-port-index=1 +hacks=no-disable-outport;renesas-encmc-stride-align +sink-template-caps=video/x-raw,format=(string){NV12,I420},width=(int)[80,1920],height=(int)[80,1080] +src-template-caps=video/x-vp8,width=(int)[80,1920],height=(int)[80,1080] + +[omxvp9dec] +type-name=GstOMXVP9Dec +core-name=@RENESAS_DATADIR@/lib/libomxr_core.so +component-name=OMX.RENESAS.VIDEO.DECODER.VP9 +rank=256 +in-port-index=0 +out-port-index=1 +hacks=no-disable-outport;default-pix-aspect-ratio;no-component-reconfigure +sink-template-caps=video/x-vp9,width=(int)[1, MAX],height=(int)[1, MAX] +src-template-caps=video/x-raw,format=(string){NV12,I420},width=(int)[1, MAX],height=(int)[1, MAX] diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.16.2.bbappend b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.16.2.bbappend new file mode 100644 index 00000000..4e045950 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.16.2.bbappend @@ -0,0 +1,33 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}/:" + +SRC_URI_remove = "http://gstreamer.freedesktop.org/src/gst-omx/gst-omx-${PV}.tar.xz" +SRC_URI_append = " \ + gitsm://github.com/renesas-rcar/gst-omx.git;branch=RCAR-GEN3/1.16.2 \ + file://gstomx.conf \ +" + +require include/rcar-gen3-path-common.inc + +DEPENDS += "omx-user-module mmngrbuf-user-module" + +SRCREV = "8c65e10e4547384d6bf0611cf1ae9e752e184622" + +LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c \ + file://omx/gstomx.h;beginline=1;endline=22;md5=e2c6664eda77dc22095adbed9cb6c6e4 \ +" + +S = "${WORKDIR}/git" + +GSTREAMER_1_0_OMX_TARGET = "rcar" +GSTREAMER_1_0_OMX_CORE_NAME = "${libdir}/libomxr_core.so" +EXTRA_OEMESON_append = " -Dheader_path=${STAGING_DIR_TARGET}/usr/local/include" + +do_configure_prepend() { + cd ${S} + install -m 0644 ${WORKDIR}/gstomx.conf ${S}/config/rcar/ + sed -i 's,@RENESAS_DATADIR@,${RENESAS_DATADIR},g' ${S}/config/rcar/gstomx.conf + cd ${B} +} + +RDEPENDS_${PN}_append = " omx-user-module" +RDEPENDS_${PN}_remove = "libomxil" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-ebisu_r8a77990.conf b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-ebisu_r8a77990.conf new file mode 100644 index 00000000..25a3fa1e --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-ebisu_r8a77990.conf @@ -0,0 +1,2 @@ +input-device-name=/dev/video8 +output-device-name=/dev/video9 diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-h3ulcb_r8a7795.conf b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-h3ulcb_r8a7795.conf new file mode 100644 index 00000000..4807dc3d --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-h3ulcb_r8a7795.conf @@ -0,0 +1,2 @@ +input-device-name=/dev/video12 +output-device-name=/dev/video13 diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-m3nulcb_r8a77965.conf b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-m3nulcb_r8a77965.conf new file mode 100644 index 00000000..890c5ad9 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-m3nulcb_r8a77965.conf @@ -0,0 +1,2 @@ +input-device-name=/dev/video6 +output-device-name=/dev/video7 diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-m3ulcb_r8a7796.conf b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-m3ulcb_r8a7796.conf new file mode 100644 index 00000000..890c5ad9 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-m3ulcb_r8a7796.conf @@ -0,0 +1,2 @@ +input-device-name=/dev/video6 +output-device-name=/dev/video7 diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-salvator-x_r8a7795.conf b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-salvator-x_r8a7795.conf new file mode 100644 index 00000000..586b13b0 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-salvator-x_r8a7795.conf @@ -0,0 +1,2 @@ +input-device-name=/dev/video20 +output-device-name=/dev/video21 diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-salvator-x_r8a7796.conf b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-salvator-x_r8a7796.conf new file mode 100644 index 00000000..74a8ab9b --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-salvator-x_r8a7796.conf @@ -0,0 +1,2 @@ +input-device-name=/dev/video14 +output-device-name=/dev/video15 diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-salvator-x_r8a77965.conf b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-salvator-x_r8a77965.conf new file mode 100644 index 00000000..74a8ab9b --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config/gstvspfilter-salvator-x_r8a77965.conf @@ -0,0 +1,2 @@ +input-device-name=/dev/video14 +output-device-name=/dev/video15 diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config_1.0.1.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config_1.0.1.bb new file mode 100644 index 00000000..1d03f479 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter-config_1.0.1.bb @@ -0,0 +1,25 @@ +SUMMARY = "GStreamer VSP filter plugin runtime configuration" +SECTION = "multimedia" +LICENSE = "GPLv2+" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" +PACKAGE_ARCH = "${MACHINE_ARCH}" + +VSPFILTER_CONF_r8a7795 = "gstvspfilter-${MACHINE}_r8a7795.conf" +VSPFILTER_CONF_r8a7796 = "gstvspfilter-${MACHINE}_r8a7796.conf" +VSPFILTER_CONF_r8a77965 = "gstvspfilter-${MACHINE}_r8a77965.conf" +VSPFILTER_CONF_r8a77990 = "gstvspfilter-${MACHINE}_r8a77990.conf" + +SRC_URI = " file://${VSPFILTER_CONF} " + +do_configure[noexec] = "1" + +do_compile[noexec] = "1" + +do_install() { + install -Dm 644 ${WORKDIR}/${VSPFILTER_CONF} ${D}/${sysconfdir}/gstvspfilter.conf +} + +FILES_${PN} = " ${sysconfdir}/gstvspfilter.conf " + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter_1.0.1.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter_1.0.1.bb new file mode 100644 index 00000000..a3d16ac0 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugin-vspfilter_1.0.1.bb @@ -0,0 +1,35 @@ +SUMMARY = "GStreamer VSP filter plugin" +SECTION = "multimedia" +LICENSE = "GPLv2+" +LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c" + +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" + +SRC_URI = " \ + gitsm://github.com/renesas-rcar/gst-plugin-vspfilter.git;branch=RCAR-GEN3/1.0.1 \ +" +SRCREV = "c66854c46af649be65eb371aa42ef35dcc858acf" + +S = "${WORKDIR}/git" + + +inherit autotools pkgconfig + +DEPENDS += "gstreamer1.0 gstreamer1.0-plugins-base pkgconfig" + +EXTRA_AUTORECONF_append = " -I ${STAGING_DATADIR}/aclocal" + +FILES_${PN} = " \ + ${libdir}/gstreamer-1.0/libgstvspfilter.so \ +" + +FILES_${PN}-dev = "${libdir}/gstreamer-1.0/libgstvspfilter.la" + +FILES_${PN}-staticdev = "${libdir}/gstreamer-1.0/libgstvspfilter.a" + +FILES_${PN}-dbg = " \ + ${libdir}/gstreamer-1.0/.debug \ + ${prefix}/src \ +" + +RDEPENDS_${PN} = "kernel-module-vsp2driver gstreamer1.0-plugin-vspfilter-config" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.16.2.bbappend b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.16.2.bbappend new file mode 100644 index 00000000..63df2f40 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.16.2.bbappend @@ -0,0 +1,8 @@ +SRC_URI_remove = "http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-${PV}.tar.xz" +SRC_URI_append = " gitsm://github.com/renesas-rcar/gst-plugins-bad.git;branch=RCAR-GEN3/1.16.2" + +SRCREV = "4459dc7686a2c20ed9097734e11d17631f71105a" + +DEPENDS += "weston" + +S = "${WORKDIR}/git" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.16.2.bbappend b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.16.2.bbappend new file mode 100644 index 00000000..f9bd2f3b --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.16.2.bbappend @@ -0,0 +1,13 @@ +SRC_URI_remove = "http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-${PV}.tar.xz" +SRC_URI_append = " gitsm://github.com/renesas-rcar/gst-plugins-good.git;branch=RCAR-GEN3/1.16.2" + +SRCREV = "5588c8b83e77d5419e498ada54eef0c183486172" + +DEPENDS += "mmngrbuf-user-module" + +S = "${WORKDIR}/git" + +EXTRA_OEMESON_append = " \ + -Dcont-frame-capture=true \ + -Dignore-fps-of-video-standard=true \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/mmngr-module/mmngr-user-module.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/mmngr-module/mmngr-user-module.bb new file mode 100644 index 00000000..ac4cf30b --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/mmngr-module/mmngr-user-module.bb @@ -0,0 +1,25 @@ +DESCRIPTION = "Memory Manager User module for Renesas R-Car Gen3" +require mmngr_lib.inc +require include/rcar-gen3-path-common.inc + +DEPENDS = "kernel-module-mmngr" +PN = "mmngr-user-module" +PR = "r0" + +S = "${WORKDIR}/git/libmmngr/mmngr" + +EXTRA_OECONF = "${@bb.utils.contains("DISTRO_FEATURES", "mm-test", \ + " --enable-mmngr-test", "", d)}" + +exec_prefix = "/usr" +bindir = "${RENESAS_DATADIR}/bin" +includedir = "${RENESAS_DATADIR}/include" +CFLAGS += " -I${STAGING_DIR_HOST}${RENESAS_DATADIR}/include" + +do_install_append() { + if [ -f ${D}${RENESAS_DATADIR}/bin/mmtp ]; then + if [ X${WS} = "X32" ]; then + mv ${D}${RENESAS_DATADIR}/bin/mmtp ${D}${RENESAS_DATADIR}/bin/mmtp${WS} + fi + fi +} diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/mmngr-module/mmngr_lib.inc b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/mmngr-module/mmngr_lib.inc new file mode 100644 index 00000000..8afa6a50 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/mmngr-module/mmngr_lib.inc @@ -0,0 +1,19 @@ +# Common path of MMNGR and MMNGRBUF module +LICENSE = "MIT" +LIC_FILES_CHKSUM = "\ + file://${WORKDIR}/git/COPYING.MIT;md5=30a99e0d36a3da1f5cf93c070ad7888a" + +MMNGR_LIB_URI = "git://github.com/renesas-rcar/mmngr_lib.git" + +SRC_URI = "${MMNGR_LIB_URI};branch=rcar_gen3" +SRCREV = "e55a8356c906486ee0be78b2a1fde227e7a578f4" + +# Get Wordsize of test app and change their names later to avoid override +WS_aarch64 = "" +WS_virtclass-multilib-lib32 = "32" + +# These modules are machine specific. +PACKAGE_ARCH = "${MACHINE_ARCH}" +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" + +inherit autotools diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/mmngr-module/mmngrbuf-user-module.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/mmngr-module/mmngrbuf-user-module.bb new file mode 100644 index 00000000..690169fd --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/mmngr-module/mmngrbuf-user-module.bb @@ -0,0 +1,25 @@ +DESCRIPTION = "Memory Manager Buffer User module for Renesas R-Car Gen3" +require mmngr_lib.inc +require include/rcar-gen3-path-common.inc + +DEPENDS = "kernel-module-mmngrbuf" +PN = "mmngrbuf-user-module" +PR = "r0" + +S = "${WORKDIR}/git/libmmngr/mmngrbuf" + +EXTRA_OECONF = "${@bb.utils.contains("DISTRO_FEATURES", "mm-test", \ + " --enable-mmngrbuf-test", "", d)}" + +exec_prefix = "/usr" +bindir = "${RENESAS_DATADIR}/bin" +includedir = "${RENESAS_DATADIR}/include" +CFLAGS += " -I${STAGING_DIR_HOST}${RENESAS_DATADIR}/include" + +do_install_append() { + if [ -f ${D}${RENESAS_DATADIR}/bin/mmbuftp ]; then + if [ X${WS} = "X32" ]; then + mv ${D}${RENESAS_DATADIR}/bin/mmbuftp ${D}${RENESAS_DATADIR}/bin/mmbuftp${WS} + fi + fi +} diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/omx-module/deltask-omx-user-module.inc b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/omx-module/deltask-omx-user-module.inc new file mode 100644 index 00000000..6f3f8474 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/omx-module/deltask-omx-user-module.inc @@ -0,0 +1,2 @@ +deltask do_configure +deltask do_compile diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/omx-module/libalacdla-l.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/omx-module/libalacdla-l.bb new file mode 100644 index 00000000..0ed61b4f --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/omx-module/libalacdla-l.bb @@ -0,0 +1,63 @@ +DESCRIPTION = "ALAC decoder library" +SECTION = "libs" +LICENSE = "Apache-2.0 & APSL-2.0" +LIC_FILES_CHKSUM = " \ + file://LICENSE;md5=5cf67868b9e038eccb149ec80809d9f5 \ + file://APPLE_LICENSE.txt;md5=b180a94f894d2a868d40ea43da2bbaba \ +" + +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +DEPENDS = " \ + kernel-module-mmngr mmngr-user-module \ + vspmif-user-module kernel-module-vspmif \ + kernel-module-vspm kernel-module-vsp2driver \ +" + +RDEPENDS_${PN} += "mmngr-user-module vspmif-user-module" + +SRC_URI = "git://github.com/renesas-rcar/alac_decoder.git;branch=master" +SRCREV = "5d7e5c91a932bedb36284591612bfbb3342cd672" + +S = "${WORKDIR}/git" +B = "${S}/build/linux_armyocto/lib" + +EXTRA_OEMAKE = "ARCH=${ARCH}" + +ARCH = "arm" +ARCH_aarch64 = "arm64" + +do_install() { + # Create directories + install -d ${D}/${libdir} + install -d ${D}/${includedir} + + # Install library + install -m 755 ${S}/build/linux_armyocto/libALACDLA_L.so.2.0 ${D}/${libdir}/ + + # Create symbolic link + cd ${D}/${libdir} + ln -s libALACDLA_L.so.2.0 libALACDLA_L.so.2 + ln -s libALACDLA_L.so.2 libALACDLA_L.so + + # Install shared header file + install -m 644 ${S}/lib/alacd_Lib.h ${D}/${includedir}/ +} + +FILES_${PN} += " \ + ${libdir}/libALACDLA_L.so.* \ + ${libdir}/libALACDLA_L.so \ +" + +FILES_${PN}-dev = "${includedir}/*.h" + +INSANE_SKIP_${PN} += "dev-so" + +# Skip debug strip of do_populate_sysroot() +INHIBIT_SYSROOT_STRIP = "1" + +# Skip debug split and strip of do_package() +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/omx-module/libflacdla-l.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/omx-module/libflacdla-l.bb new file mode 100644 index 00000000..1d0d77a2 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/omx-module/libflacdla-l.bb @@ -0,0 +1,51 @@ +DESCRIPTION = "FLAC decoder library" +SECTION = "libs" +LICENSE = "BSD" +LIC_FILES_CHKSUM = "file://COPYING.Xiph;md5=a2c4b71c0198682376d483eb5bcc9197" + +PACKAGE_ARCH = "${MACHINE_ARCH}" +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" + +SRC_URI = "git://github.com/renesas-rcar/flac_decoder.git;branch=master" +SRCREV = "70c0a7ae7dc8cac2056adf5eb175e3c54f892c27" + +S = "${WORKDIR}/git" +B = "${S}/build/linux_armyocto/lib" + +EXTRA_OEMAKE = "ARCH=${ARCH}" + +ARCH = "arm" +ARCH_aarch64 = "arm64" + +do_install() { + # Create directories + install -d ${D}/${libdir} + install -d ${D}/${includedir} + + # Install library + install -m 755 ${S}/build/linux_armyocto/libFLACDLA_L.so.2.0 ${D}/${libdir}/ + + # Create symbolic link + cd ${D}/${libdir} + ln -s libFLACDLA_L.so.2.0 libFLACDLA_L.so.2 + ln -s libFLACDLA_L.so.2 libFLACDLA_L.so + + # Install shared header file + install -m 644 ${S}/lib/flacd_Lib.h ${D}/${includedir}/ +} + +FILES_${PN} += " \ + ${libdir}/libFLACDLA_L.so.* \ + ${libdir}/libFLACDLA_L.so \ +" + +FILES_${PN}-dev = "${includedir}/*.h" + +INSANE_SKIP_${PN} += "dev-so" + +# Skip debug strip of do_populate_sysroot() +INHIBIT_SYSROOT_STRIP = "1" + +# Skip debug split and strip of do_package() +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/omx-module/omx-user-module.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/omx-module/omx-user-module.bb new file mode 100644 index 00000000..598be288 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/omx-module/omx-user-module.bb @@ -0,0 +1,490 @@ +DESCRIPTION = "OMX Media Components R-Car Gen3" +LICENSE = "CLOSED" +require include/omx-control.inc +require include/rcar-gen3-modules-common.inc + +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" + +DEPENDS = " \ + kernel-module-mmngr mmngr-user-module \ + vspmif-user-module kernel-module-vspmif \ + kernel-module-vspm kernel-module-vsp2driver \ +" + +# Task Control. Compile is not performed when not installing OMX Video and Audio Libs. +# Note) dummy-omx-user-module.inc does not exist. +INCLUDE_FILE = '${@oe.utils.conditional("USE_OMX_COMMON", "1", "dummy", "deltask", d )}' +include ${INCLUDE_FILE}-omx-user-module.inc + +DEPENDS += '${@oe.utils.conditional("USE_VIDEO_OMX", "1", "kernel-module-uvcs-drv", "", d )}' + +inherit autotools + +includedir = "${RENESAS_DATADIR}/include" +CFLAGS += " -I${STAGING_DIR_HOST}${RENESAS_DATADIR}/include" +PACKAGE_ARCH = "${MACHINE_ARCH}" + +OMX_EVA_PREFIX = '${@oe.utils.conditional("USE_OMX_EVA_PKG", "1", "EVA", "", d )}' + +# SRC file name +SRC_URI_OMX = '${@oe.utils.conditional("USE_OMX_COMMON", "1", "file://${OMX_EVA_PREFIX}RTM0AC0000XCMCTL30SL41C.tar.bz2;unpack=0", "", d )}' +SRC_URI_VCMND = '${@oe.utils.conditional("USE_VIDEO_DEC", "1", "file://${OMX_EVA_PREFIX}RTM0AC0000XVCMND30SL41C.tar.bz2;unpack=0", "", d )}' +SRC_URI_VCMNE = '${@oe.utils.conditional("USE_VIDEO_ENC", "1", "file://${OMX_EVA_PREFIX}RTM0AC0000XVCMNE30SL41C.tar.bz2;unpack=0", "", d )}' +SRC_URI_H264D = '${@oe.utils.conditional("USE_H264D_OMX", "1", "file://${OMX_EVA_PREFIX}RTM0AC0000XV264D30SL41C.tar.bz2", "", d )}' +SRC_URI_H264E = '${@oe.utils.conditional("USE_H264E_OMX", "1", "file://${OMX_EVA_PREFIX}RTM0AC0000XV264E30SL41C.tar.bz2", "", d )}' + +SRC_URI_H263D = '${@oe.utils.conditional("USE_H263D_OMX", "1", "file://RTM0AC0000XV263D30SL41C.tar.bz2", "", d )}' +SRC_URI_H265D = '${@oe.utils.conditional("USE_H265D_OMX", "1", "file://RTM0AC0000XV265D30SL41C.tar.bz2", "", d )}' +SRC_URI_MPEG2D = '${@oe.utils.conditional("USE_MPEG2D_OMX", "1", "file://RTM0AC0000XVM2VD30SL41C.tar.bz2", "", d )}' +SRC_URI_MPEG4D = '${@oe.utils.conditional("USE_MPEG4D_OMX", "1", "file://RTM0AC0000XVM4VD30SL41C.tar.bz2", "", d )}' +SRC_URI_VC1D = '${@oe.utils.conditional("USE_VC1D_OMX", "1", "file://RTM0AC0000XVVC1D30SL41C.tar.bz2", "", d )}' +SRC_URI_DIVXD = '${@oe.utils.conditional("USE_DIVXD_OMX", "1", "file://RTM0AC0000XVDVXD30SL41C.tar.bz2", "", d )}' +SRC_URI_RVD = '${@oe.utils.conditional("USE_RVD_OMX", "1", "file://RTM0AC0000XVRLVD30SL41C.tar.bz2", "", d )}' +SRC_URI_VP8D = '${@oe.utils.conditional("USE_VP8D_OMX", "1", "file://RTM0AC0000XVVP8D30SL41C.tar.bz2", "", d )}' +SRC_URI_VP8E = '${@oe.utils.conditional("USE_VP8E_OMX", "1", "file://RTM0AC0000XVVP8E30SL41C.tar.bz2", "", d )}' +SRC_URI_VP9D = '${@oe.utils.conditional("USE_VP9D_OMX", "1", "file://RTM0AC0000XVVP9D30SL41C.tar.bz2", "", d )}' +SRC_URI_ACMND = '${@oe.utils.conditional("USE_AUDIO_OMX", "1", "file://RTM0AC0000XACMND30SL41C.tar.gz", "", d )}' +SRC_URI_AACLC = '${@oe.utils.conditional("USE_AACLCD_OMX", "1", "file://RTM0AC0000XAAACD30SL41C.tar.gz", "", d )}' +SRC_URI_AACPV2 = '${@oe.utils.conditional("USE_AACPV2D_OMX", "1", "file://RTM0AC0000XAAAPD30SL41C.tar.gz", "", d )}' +SRC_URI_MP3 = '${@oe.utils.conditional("USE_MP3D_OMX", "1", "file://RTM0AC0000XAMP3D30SL41C.tar.gz", "", d )}' +SRC_URI_AACLCE = '${@oe.utils.conditional("USE_AACLCE_OMX", "1", "file://RTM0AC0000XAAACE30SL41C.tar.gz", "", d )}' +SRC_URI_WMA = '${@oe.utils.conditional("USE_WMAD_OMX", "1", "file://RTM0AC0000XAWMAD30SL41C.tar.gz", "", d )}' +SRC_URI_ALACD = '${@oe.utils.conditional("USE_ALACD_OMX", "1", "file://RTM0AC0000XAALAD30SL41C.tar.gz", "", d )}' +SRC_URI_FLACD = '${@oe.utils.conditional("USE_FLACD_OMX", "1", "file://RTM0AC0000XAFLAD30SL41C.tar.gz", "", d )}' +SRC_URI_DDD = '${@oe.utils.conditional("USE_DDD_OMX", "1", "file://RTM0AC0000XADD5D30SL41C.tar.gz", "", d )}' +SRC_URI_AACMZ = '${@oe.utils.conditional("USE_AACLC_MDW", "1", "file://RTM0AC0000ADAACMZ1SL41C.tar.gz", "", d )}' +SRC_URI_AACPV2MZ = '${@oe.utils.conditional("USE_AACPV2_MDW", "1", "file://RTM0AC0000ADAAPMZ1SL41C.tar.gz", "", d )}' +SRC_URI_MP3MZ = '${@oe.utils.conditional("USE_MP3_MDW", "1", "file://RTM0AC0000ADMP3MZ1SL41C.tar.gz", "", d )}' +SRC_URI_WMAMZ = '${@oe.utils.conditional("USE_WMA_MDW", "1", "file://RTM0AC0000ADWMAMZ1SL41C.tar.gz", "", d )}' +SRC_URI_DDMZ = '${@oe.utils.conditional("USE_DD_MDW", "1", "file://RTM0AC0000ADDD5MZ1SL41C.tar.gz", "", d )}' +SRC_URI_AEAACMZ = '${@oe.utils.conditional("USE_AACLCE_MDW", "1", "file://RTM0AC0000AEAACMZ1SL41C.tar.gz", "", d )}' + +SRC_URI = " \ + ${SRC_URI_OMX} \ + ${SRC_URI_VCMND} \ + ${SRC_URI_VCMNE} \ + ${SRC_URI_H263D} \ + ${SRC_URI_H264D} \ + ${SRC_URI_H264E} \ + ${SRC_URI_H265D} \ + ${SRC_URI_MPEG2D} \ + ${SRC_URI_MPEG4D} \ + ${SRC_URI_VC1D} \ + ${SRC_URI_DIVXD} \ + ${SRC_URI_RVD} \ + ${SRC_URI_ACMND} \ + ${SRC_URI_AACLC} \ + ${SRC_URI_AACPV2} \ + ${SRC_URI_MP3} \ + ${SRC_URI_WMA} \ + ${SRC_URI_ALACD} \ + ${SRC_URI_FLACD} \ + ${SRC_URI_DDD} \ + ${SRC_URI_AACLCE} \ + ${SRC_URI_AACMZ} \ + ${SRC_URI_AACPV2MZ} \ + ${SRC_URI_MP3MZ} \ + ${SRC_URI_WMAMZ} \ + ${SRC_URI_DDMZ} \ + ${SRC_URI_AEAACMZ} \ + ${SRC_URI_VP8D} \ + ${SRC_URI_VP8E} \ + ${SRC_URI_VP9D} \ +" + +# SRC directory name +OMX_COMMON_SRC = '${@oe.utils.conditional("USE_OMX_COMMON", "1", "${OMX_EVA_PREFIX}RTM0AC0000XCMCTL30SL41C", "", d )}' +OMX_VIDEO_DEC_COMMON_SRC = '${@oe.utils.conditional("USE_VIDEO_DEC", "1", "${OMX_EVA_PREFIX}RTM0AC0000XVCMND30SL41C", "", d )}' +OMX_VIDEO_ENC_COMMON_SRC = '${@oe.utils.conditional("USE_VIDEO_ENC", "1", "${OMX_EVA_PREFIX}RTM0AC0000XVCMNE30SL41C", "", d )}' + +OMX_H264_DEC_SRC = '${@oe.utils.conditional("USE_H264D_OMX", "1", "${OMX_EVA_PREFIX}RTM0AC0000XV264D30SL41C", "", d )}' +OMX_H264_ENC_SRC = '${@oe.utils.conditional("USE_H264E_OMX", "1", "${OMX_EVA_PREFIX}RTM0AC0000XV264E30SL41C", "", d )}' + +OMX_H263_DEC_SRC = '${@oe.utils.conditional("USE_H263D_OMX", "1", "RTM0AC0000XV263D30SL41C", "", d )}' +OMX_H265_DEC_SRC = '${@oe.utils.conditional("USE_H265D_OMX", "1", "RTM0AC0000XV265D30SL41C", "", d )}' +OMX_MPEG2_DEC_SRC = '${@oe.utils.conditional("USE_MPEG2D_OMX", "1", "RTM0AC0000XVM2VD30SL41C", "", d )}' +OMX_MPEG4_DEC_SRC = '${@oe.utils.conditional("USE_MPEG4D_OMX", "1", "RTM0AC0000XVM4VD30SL41C", "", d )}' +OMX_VC1_DEC_SRC = '${@oe.utils.conditional("USE_VC1D_OMX", "1", "RTM0AC0000XVVC1D30SL41C", "", d )}' +OMX_DIVX_DEC_SRC = '${@oe.utils.conditional("USE_DIVXD_OMX", "1", "RTM0AC0000XVDVXD30SL41C", "", d )}' +OMX_RV_DEC_SRC = '${@oe.utils.conditional("USE_RVD_OMX", "1", "RTM0AC0000XVRLVD30SL41C", "", d )}' +OMX_VP8_DEC_SRC = '${@oe.utils.conditional("USE_VP8D_OMX", "1", "RTM0AC0000XVVP8D30SL41C", "", d )}' +OMX_VP8_ENC_SRC = '${@oe.utils.conditional("USE_VP8E_OMX", "1", "RTM0AC0000XVVP8E30SL41C", "", d )}' +OMX_VP9_DEC_SRC = '${@oe.utils.conditional("USE_VP9D_OMX", "1", "RTM0AC0000XVVP9D30SL41C", "", d )}' + +OMX_VIDEO_SRC_LIST = " \ + ${OMX_COMMON_SRC} \ + ${OMX_VIDEO_DEC_COMMON_SRC} \ + ${OMX_VIDEO_ENC_COMMON_SRC} \ + ${OMX_H263_DEC_SRC} \ + ${OMX_H264_DEC_SRC} \ + ${OMX_H264_ENC_SRC} \ + ${OMX_H265_DEC_SRC} \ + ${OMX_MPEG2_DEC_SRC} \ + ${OMX_MPEG4_DEC_SRC} \ + ${OMX_VC1_DEC_SRC} \ + ${OMX_DIVX_DEC_SRC} \ + ${OMX_RV_DEC_SRC} \ + ${OMX_VP8_DEC_SRC} \ + ${OMX_VP8_ENC_SRC} \ + ${OMX_VP9_DEC_SRC} \ +" + +AAC_MIDDLEWARE_SRC = "RTM0AC0000ADAACMZ1SL41C" +AACPV2_MIDDLEWARE_SRC = "RTM0AC0000ADAAPMZ1SL41C" +MP3_MIDDLEWARE_SRC = "RTM0AC0000ADMP3MZ1SL41C" +WMA_MIDDLEWARE_SRC = "RTM0AC0000ADWMAMZ1SL41C" +DD_MIDDLEWARE_SRC = "RTM0AC0000ADDD5MZ1SL41C" +AEAAC_MIDDLEWARE_SRC = "RTM0AC0000AEAACMZ1SL41C" + +OMX_AUDIO_COMMON_SRC = '${@oe.utils.conditional("USE_AUDIO_OMX", "1", "RTM0AC0000XACMND30SL41C", "", d )}' +OMX_AACLC_DEC_SRC = '${@oe.utils.conditional("USE_AACLCD_OMX", "1", "RTM0AC0000XAAACD30SL41C", "", d )}' +OMX_AACPV2_DEC_SRC = '${@oe.utils.conditional("USE_AACPV2D_OMX", "1", "RTM0AC0000XAAAPD30SL41C", "", d )}' +OMX_MP3_DEC_SRC = '${@oe.utils.conditional("USE_MP3D_OMX", "1", "RTM0AC0000XAMP3D30SL41C", "", d )}' +OMX_WMA_DEC_SRC = '${@oe.utils.conditional("USE_WMAD_OMX", "1", "RTM0AC0000XAWMAD30SL41C", "", d )}' +OMX_ALAC_DEC_SRC = '${@oe.utils.conditional("USE_ALACD_OMX", "1", "RTM0AC0000XAALAD30SL41C", "", d )}' +OMX_FLAC_DEC_SRC = '${@oe.utils.conditional("USE_FLACD_OMX", "1", "RTM0AC0000XAFLAD30SL41C", "", d )}' +OMX_DD_DEC_SRC = '${@oe.utils.conditional("USE_DDD_OMX", "1", "RTM0AC0000XADD5D30SL41C", "", d )}' +OMX_AACLC_ENC_SRC = '${@oe.utils.conditional("USE_AACLCE_OMX", "1", "RTM0AC0000XAAACE30SL41C", "", d )}' + +OMX_AUDIO_SRC_LIST = " \ + ${OMX_AUDIO_COMMON_SRC} \ + ${OMX_AACLC_DEC_SRC} \ + ${OMX_AACPV2_DEC_SRC} \ + ${OMX_MP3_DEC_SRC} \ + ${OMX_WMA_DEC_SRC} \ + ${OMX_ALAC_DEC_SRC} \ + ${OMX_FLAC_DEC_SRC} \ + ${OMX_DD_DEC_SRC} \ + ${OMX_AACLC_ENC_SRC} \ +" + +S = "${WORKDIR}/omx/" + +# Create ${S} directory +do_unpack_prepend() { + os.system("install -d ${S}") +} + +do_unpack_append() { + bb.build.exec_func('setup_build_tree', d) +} + +setup_build_tree() { + for omxmc in ${OMX_COMMON_SRC} ${OMX_VIDEO_DEC_COMMON_SRC} ${OMX_VIDEO_ENC_COMMON_SRC} + do + tar xf ${WORKDIR}/${omxmc}.tar.bz2 -C ${WORKDIR} + tar xf ${WORKDIR}/${omxmc}.tar.bz2 -C ${S} ${omxmc}/src --strip=2 + tar xf ${WORKDIR}/${omxmc}.tar.bz2 -C ${S} ${omxmc}/include --strip=1 + done +} + +B = "${S}" + +EXTRA_OECONF = "OMXR_DEFAULT_CONFIG_FILE_NAME=${sysconfdir}/omxr/omxr_config_base.txt" + +do_configure() { + export uvcsdrv_dir="${INCSHARED}" + chmod u+x autogen.sh + ./autogen.sh + oe_runconf +} + +do_install_omx_video() { + cd ${D}/${libdir} + for omxmc in ${OMX_VIDEO_SRC_LIST} + do + src="${WORKDIR}/${omxmc}" + install -m 755 ${src}/${baselib}/lib*.so.* ${D}/${libdir} + install -m 644 ${src}/include/*.h ${D}/${includedir} + install -m 644 ${src}/config/*.txt ${D}/${sysconfdir}/omxr + done + + if [ "X${USE_OMX_COMMON}" = "X1" ] ; then + ln -s libomxr_core.so.3.0.0 libomxr_core.so.3 + ln -s libomxr_core.so.3 libomxr_core.so + + ln -s libomxr_mc_cmn.so.3.0.0 libomxr_mc_cmn.so.3 + ln -s libomxr_mc_cmn.so.3 libomxr_mc_cmn.so + fi + + if [ "X${USE_VIDEO_OMX}" = "X1" ] ; then + ln -s libomxr_mc_vcmn.so.3.0.0 libomxr_mc_vcmn.so.3 + ln -s libomxr_mc_vcmn.so.3 libomxr_mc_vcmn.so + fi + + if [ "X${USE_VIDEO_DEC}" = "X1" ] ; then + ln -s libomxr_mc_vdcmn.so.3.0.0 libomxr_mc_vdcmn.so.3 + ln -s libomxr_mc_vdcmn.so.3 libomxr_mc_vdcmn.so + + ln -s libuvcs_dec.so.3.0.0 libuvcs_dec.so.3 + ln -s libuvcs_dec.so.3 libuvcs_dec.so + fi + + if [ "X${USE_VIDEO_ENC}" = "X1" ] ; then + ln -s libomxr_mc_vecmn.so.3.0.0 libomxr_mc_vecmn.so.3 + ln -s libomxr_mc_vecmn.so.3 libomxr_mc_vecmn.so + + ln -s libuvcs_enc.so.3.0.0 libuvcs_enc.so.3 + ln -s libuvcs_enc.so.3 libuvcs_enc.so + fi + + if [ "X${USE_H263D_OMX}" = "X1" ]; then + ln -s libomxr_mc_h263d.so.3.0.0 libomxr_mc_h263d.so.3 + ln -s libomxr_mc_h263d.so.3 libomxr_mc_h263d.so + + ln -s libuvcs_hv3d.so.3.0.0 libuvcs_hv3d.so.3 + ln -s libuvcs_hv3d.so.3 libuvcs_hv3d.so + fi + + if [ "X${USE_H264D_OMX}" = "X1" ]; then + ln -s libomxr_mc_h264d.so.3.0.0 libomxr_mc_h264d.so.3 + ln -s libomxr_mc_h264d.so.3 libomxr_mc_h264d.so + + ln -s libuvcs_avcd.so.3.0.0 libuvcs_avcd.so.3 + ln -s libuvcs_avcd.so.3 libuvcs_avcd.so + fi + + if [ "X${USE_H264E_OMX}" = "X1" ]; then + ln -s libomxr_mc_h264e.so.3.0.0 libomxr_mc_h264e.so.3 + ln -s libomxr_mc_h264e.so.3 libomxr_mc_h264e.so + + ln -s libuvcs_avce.so.3.0.0 libuvcs_avce.so.3 + ln -s libuvcs_avce.so.3 libuvcs_avce.so + fi + + if [ "X${USE_H265D_OMX}" = "X1" ]; then + ln -s libomxr_mc_hevd.so.3.0.0 libomxr_mc_hevd.so.3 + ln -s libomxr_mc_hevd.so.3 libomxr_mc_hevd.so + + ln -s libuvcs_hevd.so.3.0.0 libuvcs_hevd.so.3 + ln -s libuvcs_hevd.so.3 libuvcs_hevd.so + fi + + if [ "X${USE_MPEG2D_OMX}" = "X1" ]; then + ln -s libomxr_mc_m2vd.so.3.0.0 libomxr_mc_m2vd.so.3 + ln -s libomxr_mc_m2vd.so.3 libomxr_mc_m2vd.so + + ln -s libuvcs_m2vd.so.3.0.0 libuvcs_m2vd.so.3 + ln -s libuvcs_m2vd.so.3 libuvcs_m2vd.so + fi + + if [ "X${USE_MPEG4D_OMX}" = "X1" ]; then + ln -s libomxr_mc_m4vd.so.3.0.0 libomxr_mc_m4vd.so.3 + ln -s libomxr_mc_m4vd.so.3 libomxr_mc_m4vd.so + + ln -s libuvcs_m4vd.so.3.0.0 libuvcs_m4vd.so.3 + ln -s libuvcs_m4vd.so.3 libuvcs_m4vd.so + fi + + if [ "X${USE_VC1D_OMX}" = "X1" ]; then + ln -s libomxr_mc_vc1d.so.3.0.0 libomxr_mc_vc1d.so.3 + ln -s libomxr_mc_vc1d.so.3 libomxr_mc_vc1d.so + + ln -s libuvcs_vc1d.so.3.0.0 libuvcs_vc1d.so.3 + ln -s libuvcs_vc1d.so.3 libuvcs_vc1d.so + fi + + if [ "X${USE_DIVXD_OMX}" = "X1" ]; then + ln -s libomxr_mc_divxd.so.3.0.0 libomxr_mc_divxd.so.3 + ln -s libomxr_mc_divxd.so.3 libomxr_mc_divxd.so + + ln -s libuvcs_dvxd.so.3.0.0 libuvcs_dvxd.so.3 + ln -s libuvcs_dvxd.so.3 libuvcs_dvxd.so + fi + + if [ "X${USE_RVD_OMX}" = "X1" ]; then + ln -s libomxr_mc_rlvd.so.3.0.0 libomxr_mc_rlvd.so.3 + ln -s libomxr_mc_rlvd.so.3 libomxr_mc_rlvd.so + + ln -s libuvcs_rlvd.so.3.0.0 libuvcs_rlvd.so.3 + ln -s libuvcs_rlvd.so.3 libuvcs_rlvd.so + fi + + if [ "X${USE_VP8D_OMX}" = "X1" ]; then + ln -s libomxr_mc_vp8d.so.3.0.0 libomxr_mc_vp8d.so.3 + ln -s libomxr_mc_vp8d.so.3 libomxr_mc_vp8d.so + + ln -s libuvcs_vp8d.so.3.0.0 libuvcs_vp8d.so.3 + ln -s libuvcs_vp8d.so.3 libuvcs_vp8d.so + fi + + if [ "X${USE_VP8E_OMX}" = "X1" ]; then + ln -s libomxr_mc_vp8e.so.3.0.0 libomxr_mc_vp8e.so.3 + ln -s libomxr_mc_vp8e.so.3 libomxr_mc_vp8e.so + + ln -s libuvcs_vp8e.so.3.0.0 libuvcs_vp8e.so.3 + ln -s libuvcs_vp8e.so.3 libuvcs_vp8e.so + fi + + if [ "X${USE_VP9D_OMX}" = "X1" ]; then + ln -s libomxr_mc_vp9d.so.3.0.0 libomxr_mc_vp9d.so.3 + ln -s libomxr_mc_vp9d.so.3 libomxr_mc_vp9d.so + + ln -s libuvcs_vp9d.so.3.0.0 libuvcs_vp9d.so.3 + ln -s libuvcs_vp9d.so.3 libuvcs_vp9d.so + fi +} + +do_install_audio_middleware() { + cd ${D}/${libdir} + + if [ "X${USE_AACLC_MDW}" = "X1" ]; then + install -m 755 ${WORKDIR}/${AAC_MIDDLEWARE_SRC}/${baselib}/libAACDLA_L.so.3.0 \ + ${D}/${libdir} + install -m 644 ${WORKDIR}/${AAC_MIDDLEWARE_SRC}/include/*.h ${D}/${includedir} + + ln -s libAACDLA_L.so.3.0 libAACDLA_L.so.3 + ln -s libAACDLA_L.so.3 libAACDLA_L.so + fi + + if [ "X${USE_AACPV2_MDW}" = "X1" ]; then + install -m 755 ${WORKDIR}/${AACPV2_MIDDLEWARE_SRC}/${baselib}/libRSACPDLA_L.so.2.0 \ + ${D}/${libdir} + install -m 644 ${WORKDIR}/${AACPV2_MIDDLEWARE_SRC}/include/*.h ${D}/${includedir} + + ln -s libRSACPDLA_L.so.2.0 libRSACPDLA_L.so.2 + ln -s libRSACPDLA_L.so.2 libRSACPDLA_L.so + fi + + if [ "X${USE_MP3_MDW}" = "X1" ]; then + install -m 755 ${WORKDIR}/${MP3_MIDDLEWARE_SRC}/${baselib}/libMP3DLA_L.so.2.0 \ + ${D}/${libdir} + install -m 644 ${WORKDIR}/${MP3_MIDDLEWARE_SRC}/include/*.h ${D}/${includedir} + + ln -s libMP3DLA_L.so.2.0 libMP3DLA_L.so.2 + ln -s libMP3DLA_L.so.2 libMP3DLA_L.so + fi + + if [ "X${USE_WMA_MDW}" = "X1" ]; then + install -m 755 ${WORKDIR}/${WMA_MIDDLEWARE_SRC}/${baselib}/libWMASTDLA_L.so.2.0 \ + ${D}/${libdir} + install -m 644 ${WORKDIR}/${WMA_MIDDLEWARE_SRC}/include/*.h ${D}/${includedir} + + ln -s libWMASTDLA_L.so.2.0 libWMASTDLA_L.so.2 + ln -s libWMASTDLA_L.so.2 libWMASTDLA_L.so + fi + + if [ "X${USE_DD_MDW}" = "X1" ]; then + install -m 755 ${WORKDIR}/${DD_MIDDLEWARE_SRC}/${baselib}/libRSDACDLA_L.so.2.0 \ + ${D}/${libdir} + install -m 644 ${WORKDIR}/${DD_MIDDLEWARE_SRC}/include/*.h ${D}/${includedir} + + ln -s libRSDACDLA_L.so.2.0 libRSDACDLA_L.so.2 + ln -s libRSDACDLA_L.so.2 libRSDACDLA_L.so + fi + + if [ "X${USE_AACLCE_MDW}" = "X1" ]; then + install -m 755 ${WORKDIR}/${AEAAC_MIDDLEWARE_SRC}/${baselib}/libRSAACELA_L.so.3.0 \ + ${D}/${libdir} + install -m 644 ${WORKDIR}/${AEAAC_MIDDLEWARE_SRC}/include/*.h ${D}/${includedir} + + ln -s libRSAACELA_L.so.3.0 libRSAACELA_L.so.3 + ln -s libRSAACELA_L.so.3 libRSAACELA_L.so + fi +} + +do_install_omx_audio() { + cd ${D}/${libdir} + for omxmc in ${OMX_AUDIO_SRC_LIST} + do + src="${WORKDIR}/${omxmc}/" + install -m 755 ${src}/${baselib}/lib*.so.* ${D}/${libdir} + if [ -d ${src}/include ]; then + install -m 644 ${src}/include/*.h ${D}/${includedir} + fi + install -m 644 ${src}/config/*.txt ${D}/${sysconfdir}/omxr + done + + if [ "X${USE_AUDIO_OMX}" = "X1" ]; then + ln -s libomxr_mc_acmn.so.3.0.0 libomxr_mc_acmn.so.3 + ln -s libomxr_mc_acmn.so.3 libomxr_mc_acmn.so + fi + + if [ "X${USE_AACLCD_OMX}" = "X1" ]; then + ln -s libomxr_mc_aacd.so.3.0.0 libomxr_mc_aacd.so.3 + ln -s libomxr_mc_aacd.so.3 libomxr_mc_aacd.so + fi + + if [ "X${USE_AACPV2D_OMX}" = "X1" ]; then + ln -s libomxr_mc_aapd.so.3.0.0 libomxr_mc_aapd.so.3 + ln -s libomxr_mc_aapd.so.3 libomxr_mc_aapd.so + fi + + if [ "X${USE_MP3D_OMX}" = "X1" ]; then + ln -s libomxr_mc_mp3d.so.3.0.0 libomxr_mc_mp3d.so.3 + ln -s libomxr_mc_mp3d.so.3 libomxr_mc_mp3d.so + fi + + if [ "X${USE_WMAD_OMX}" = "X1" ]; then + ln -s libomxr_mc_wmad.so.3.0.0 libomxr_mc_wmad.so.3 + ln -s libomxr_mc_wmad.so.3 libomxr_mc_wmad.so + fi + + if [ "X${USE_ALACD_OMX}" = "X1" ]; then + ln -s libomxr_mc_alacd.so.3.0.0 libomxr_mc_alacd.so.3 + ln -s libomxr_mc_alacd.so.3 libomxr_mc_alacd.so + fi + + if [ "X${USE_FLACD_OMX}" = "X1" ]; then + ln -s libomxr_mc_flacd.so.3.0.0 libomxr_mc_flacd.so.3 + ln -s libomxr_mc_flacd.so.3 libomxr_mc_flacd.so + fi + + if [ "X${USE_AACLCE_OMX}" = "X1" ]; then + ln -s libomxr_mc_aace.so.3.0.0 libomxr_mc_aace.so.3 + ln -s libomxr_mc_aace.so.3 libomxr_mc_aace.so + fi + + if [ "X${USE_DDD_OMX}" = "X1" ]; then + ln -s libomxr_mc_ddd.so.3.0.0 libomxr_mc_ddd.so.3 + ln -s libomxr_mc_ddd.so.3 libomxr_mc_ddd.so + fi +} + +do_install () { + if [ "X${USE_OMX_COMMON}" = "X1" ]; then + oe_runmake 'DESTDIR=${D}' install + # Info dir listing isn't interesting at this point so remove it if it exists. + if [ -e "${D}/${infodir}/dir" ]; then + rm -f ${D}/${infodir}/dir + fi + fi +} + +do_install_append() { + # Create destination directory + install -d ${D}/${libdir} + install -d ${D}/${includedir} + if [ "X${USE_OMX_COMMON}" = "X1" ]; then + install -d ${D}/${sysconfdir}/omxr + fi + + # Copy omx video library + do_install_omx_video + # Copy audio middleware library + do_install_audio_middleware + # Copy omx audio library + do_install_omx_audio +} + +INSANE_SKIP_${PN} = "dev-so" + +FILES_${PN} += " \ + ${libdir}/*.so \ +" + +FILES_${PN}-dev = " \ + ${includedir} \ + ${libdir}/*.la \ +" + +RDEPENDS_${PN} += "mmngr-user-module vspmif-user-module" +RDEPENDS_${PN} += '${@oe.utils.conditional("USE_ALACD_OMX", "1", "libalacdla-l", "", d )}' +RDEPENDS_${PN} += '${@oe.utils.conditional("USE_FLACD_OMX", "1", "libflacdla-l", "", d )}' + +# Skip debug strip of do_populate_sysroot() +INHIBIT_SYSROOT_STRIP = "1" + +# Skip debug split and strip of do_package() +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/openavnu/openavnu/0001-Fix-QA-issue-when-build-with-Yocto.patch b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/openavnu/openavnu/0001-Fix-QA-issue-when-build-with-Yocto.patch new file mode 100644 index 00000000..dbc1eccb --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/openavnu/openavnu/0001-Fix-QA-issue-when-build-with-Yocto.patch @@ -0,0 +1,34 @@ +From 5e9eff188ada13e1c1986d5611a42e0779fe7fd1 Mon Sep 17 00:00:00 2001 +From: Thao Nguyen <thao.nguyen.yb@renesas.com> +Date: Mon, 18 Sep 2017 17:09:21 +0700 +Subject: [PATCH] Fix QA issue when build with Yocto + +Yocto project has updated Linker Hash Style Changed in YP2.4. +Makefile should be updated to avoid QA error. + +ERROR: open-avb-1.1+gitAUTOINC+5e43fa5ae2-r0 do_package_qa: QA Issue: No GNU_HASH in the elf binary: '/proj/yocto/gen3/v3.4.0-pt2/build/tmp/work/aarch64-poky-linux/open-avb/1.1+gitAUTOINC+5e43fa5ae2-r0/packages-split/open-avb-gptp/usr/bin/daemon_cl' [ldflags] +ERROR: open-avb-1.1+gitAUTOINC+5e43fa5ae2-r0 do_package_qa: QA run found fatal errors. Please consider fixing them. +ERROR: open-avb-1.1+gitAUTOINC+5e43fa5ae2-r0 do_package_qa: Function failed: do_package_qa + +Signed-off-by: Thao Nguyen <thao.nguyen.yb@renesas.com> +Signed-off-by: Masaru Nagai <masaru.nagai.vx@renesas.com> +--- + daemons/gptp/linux/build/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/daemons/gptp/linux/build/Makefile b/daemons/gptp/linux/build/Makefile +index 1e00b1a..99fbf84 100644 +--- a/daemons/gptp/linux/build/Makefile ++++ b/daemons/gptp/linux/build/Makefile +@@ -131,7 +131,7 @@ LDFLAGS_G += -lpthread -lrt + + CFLAGS = $(CFLAGS_G) + CPPFLAGS = $(CPPFLAGS_G) +-LDFLAGS = $(LDFLAGS_G) ++LDFLAGS += $(LDFLAGS_G) + + all: $(OBJ_DIR)/daemon_cl + +-- +1.9.1 + diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/openavnu/openavnu_git.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/openavnu/openavnu_git.bb new file mode 100644 index 00000000..5972d063 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/openavnu/openavnu_git.bb @@ -0,0 +1,75 @@ +DESCRIPTION = "OpenAvnu - an AVnu sponsored repository for Time Sensitive Network (TSN and AVB) technology" +HOMEPAGE = "https://github.com/AVnu/OpenAvnu" +LICENSE = "BSD & MIT & GPLv2 & LGPLv2" +LIC_FILES_CHKSUM = " \ + file://daemons/LICENSE;md5=81ccd62d4bc28bafc5e1a2576536b927 \ + file://daemons/shaper/LICENSE;md5=53e60f7a40864e4c075831415f2ecc59 \ + file://kmod/igb/COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://kmod/igb/LICENSE;md5=e2c0cd0820d168b0b26e19f13df4dc56 \ + file://lib/igb/LICENSE;md5=9bc783ca40be823a8b237df5eed80fc4 \ + file://lib/avtp_pipeline/LICENSE;md5=485c2c585be88b59c3ee70a016f27959 \ + file://examples/LICENSE;md5=81ccd62d4bc28bafc5e1a2576536b927 \ + file://examples/gstreamer-avb-plugins/COPYING.LIB;md5=55ca817ccb7d5b5b66355690e9abc605 \ + file://examples/gstreamer-avb-plugins/COPYING.MIT;md5=bba6cdb9c2b03c849ed4975ed9ed90dc \ +" + +DEPENDS = "libpcap" +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" + +PV = "1.1+git${SRCPV}" + +SRCREV = "5e43fa5ae27fbd2b89c320670a32143ce93e0e16" +SRC_URI = "git://github.com/AVnu/OpenAvnu.git;branch=master" + +# Fix QA issue of ldflags +SRC_URI_append = " file://0001-Fix-QA-issue-when-build-with-Yocto.patch" + +S = "${WORKDIR}/git" + +EXTRA_OEMAKE = "'CC=${CC}' 'CXX=${CXX}'" + +do_configure() { + oe_runmake daemons_all_clean +} + +do_compile() { + oe_runmake daemons_all +} + +do_install() { + install -d ${D}/${bindir} + install -m 755 daemons/maap/linux/build/maap_daemon ${D}/${bindir} + install -m 755 daemons/mrpd/mrpd daemons/mrpd/mrpctl ${D}/${bindir} + install -m 755 daemons/gptp/linux/build/obj/daemon_cl ${D}/${bindir} +} + +PACKAGES =+ " \ + ${PN}-gptp \ + ${PN}-mrpd \ + ${PN}-maap \ +" + +ALLOW_EMPTY_${PN} = "1" + +FILES_${PN}-gptp = " \ + ${bindir}/daemon_cl \ +" + +FILES_${PN}-mrpd = " \ + ${bindir}/mrpd \ + ${bindir}/mrpctl \ +" + +FILES_${PN}-maap = " \ + ${bindir}/maap_daemon \ +" + +RDEPENDS_${PN} = " \ + ${PN}-gptp \ + ${PN}-mrpd \ + ${PN}-maap \ +" + +RDEPENDS_${PN}-maap = " \ + libpcap \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/packagegroups/packagegroup-gstreamer1.0-plugins.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/packagegroups/packagegroup-gstreamer1.0-plugins.bb new file mode 100644 index 00000000..ae79153a --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/packagegroups/packagegroup-gstreamer1.0-plugins.bb @@ -0,0 +1,87 @@ +SUMMARY = "GStreamer 1.0 package groups" +LICENSE = "MIT" + +require include/omx-control.inc + +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" + +DEPENDS = "gstreamer1.0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good" +DEPENDS += "gstreamer1.0-plugins-bad" +DEPENDS += "gstreamer1.0-plugins-ugly" +DEPENDS += "${@oe.utils.conditional("USE_OMX_COMMON", "1", "gstreamer1.0-omx", "", d)}" + +LIC_FILES_CHKSUM = " \ + file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \ +" + +PR = "r0" + +inherit packagegroup + +PACKAGES = " \ + packagegroup-gstreamer1.0-plugins \ + packagegroup-gstreamer1.0-plugins-base \ + packagegroup-gstreamer1.0-plugins-audio \ + packagegroup-gstreamer1.0-plugins-video \ + ${@oe.utils.conditional("USE_OMX_COMMON", "1", "packagegroup-gstreamer1.0-omx", "", d)} \ + packagegroup-gstreamer1.0-plugins-debug \ +" + +RDEPENDS_packagegroup-gstreamer1.0-plugins = " \ + packagegroup-gstreamer1.0-plugins-base \ + packagegroup-gstreamer1.0-plugins-audio \ + packagegroup-gstreamer1.0-plugins-video \ + ${@oe.utils.conditional("USE_OMX_COMMON", "1", "packagegroup-gstreamer1.0-omx", "", d)} \ + packagegroup-gstreamer1.0-plugins-debug \ +" + +RDEPENDS_packagegroup-gstreamer1.0-plugins-base = " \ + gstreamer1.0-meta-base \ + gstreamer1.0-plugins-base-typefindfunctions \ + gstreamer1.0-plugins-good-id3demux \ + gstreamer1.0-plugins-good-autodetect \ + ${@oe.utils.conditional("USE_OMX_COMMON", "1", "gstreamer1.0-plugin-vspfilter", "", d)} \ +" + +RDEPENDS_packagegroup-gstreamer1.0-plugins-audio = " \ + gstreamer1.0-meta-audio \ + gstreamer1.0-plugins-good-audioparsers \ + gstreamer1.0-plugins-base-audiotestsrc \ + gstreamer1.0-plugins-base-audioconvert \ + gstreamer1.0-plugins-base-audioresample \ + gstreamer1.0-plugins-base-alsa \ + gstreamer1.0-plugins-base-ogg \ + gstreamer1.0-plugins-base-vorbis \ +" + +RDEPENDS_packagegroup-gstreamer1.0-plugins-video = " \ + gstreamer1.0-meta-video \ + gstreamer1.0-plugins-base-videotestsrc \ + gstreamer1.0-plugins-base-videoconvert \ + gstreamer1.0-plugins-base-playback \ + gstreamer1.0-plugins-base-videoscale \ + gstreamer1.0-plugins-base-videorate \ + gstreamer1.0-plugins-good-matroska \ + gstreamer1.0-plugins-good-isomp4 \ + gstreamer1.0-plugins-good-avi \ + gstreamer1.0-plugins-good-videofilter \ + gstreamer1.0-plugins-good-videomixer \ + gstreamer1.0-plugins-good-videocrop \ + gstreamer1.0-plugins-good-video4linux2 \ + gstreamer1.0-plugins-good-jpeg \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', \ + 'gstreamer1.0-plugins-bad-waylandsink', '', d)} \ + gstreamer1.0-plugins-bad-videoparsersbad \ + gstreamer1.0-plugins-bad-mpegtsdemux \ + gstreamer1.0-plugins-bad-jpegformat \ + gstreamer1.0-plugins-ugly-asf \ + gstreamer1.0-libav \ +" + +RDEPENDS_packagegroup-gstreamer1.0-omx = " \ + ${@oe.utils.conditional("USE_OMX_COMMON", "1", "gstreamer1.0-omx", "", d)} \ +" + +RDEPENDS_packagegroup-gstreamer1.0-plugins-debug = " \ + gstreamer1.0-meta-debug \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/packagegroups/packagegroup-multimedia-kernel.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/packagegroups/packagegroup-multimedia-kernel.bb new file mode 100644 index 00000000..b62e11e8 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/packagegroups/packagegroup-multimedia-kernel.bb @@ -0,0 +1,33 @@ +SUMMARY = "Multimedia kernel modules package groups" +LICENSE = "GPLv2 & MIT" + +require include/omx-control.inc + +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" + +DEPENDS = "kernel-module-mmngr kernel-module-mmngrbuf \ + kernel-module-vspm kernel-module-vspmif \ + kernel-module-vsp2driver \ +" + +DEPENDS += '${@oe.utils.conditional("USE_VIDEO_OMX", "1", "kernel-module-uvcs-drv", "", d )}' + +PR = "r0" + +inherit packagegroup + +PACKAGES = " \ + packagegroup-multimedia-kernel-modules \ +" + +RDEPENDS_packagegroup-multimedia-kernel-modules = " \ + kernel-module-mmngr \ + kernel-module-mmngrbuf \ + kernel-module-vspm \ + kernel-module-vspmif \ + kernel-module-vsp2driver \ +" + +RDEPENDS_packagegroup-multimedia-kernel-modules += " \ + ${@oe.utils.conditional("USE_VIDEO_OMX", "1", "kernel-module-uvcs-drv", "", d )} \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/packagegroups/packagegroup-multimedia-libs.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/packagegroups/packagegroup-multimedia-libs.bb new file mode 100644 index 00000000..3c74e691 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/packagegroups/packagegroup-multimedia-libs.bb @@ -0,0 +1,22 @@ +SUMMARY = "Multimedia user libraries modules package groups" +LICENSE = "MIT" + +COMPATIBLE_MACHINE = "(salvator-x|ulcb|ebisu)" + +DEPENDS = "mmngr-user-module mmngrbuf-user-module \ + vspmif-user-module libalacdla-l libflacdla-l \ +" + +PR = "r0" + +inherit packagegroup + +PACKAGES = " \ + packagegroup-multimedia-libs \ +" + +RDEPENDS_packagegroup-multimedia-libs = " \ + mmngr-user-module mmngrbuf-user-module \ + vspmif-user-module \ + libalacdla-l libflacdla-l \ +" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/vspmif-module/vspmif-tp-user-module.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/vspmif-module/vspmif-tp-user-module.bb new file mode 100644 index 00000000..0070563c --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/vspmif-module/vspmif-tp-user-module.bb @@ -0,0 +1,46 @@ +DESCRIPTION = "VSP Manager Interface test app for R-Car Gen3" + +require vspmif.inc + +DEPENDS = "vspmif-user-module mmngr-user-module" +PN = "vspmif-tp-user-module" +PR = "r0" + +S = "${WORKDIR}/git" +VSPMIF_TP_DIR = "vspm_if-tp-user/files/vspm_if" + +# Get Wordsize of test app and change their names later to avoid override +WS_aarch64 = "" +WS_virtclass-multilib-lib32 = "32" + +do_compile() { + cd ${S}/${VSPMIF_TP_DIR} + make all +} + +do_install() { + # Create destination folder + install -d ${D}${RENESAS_DATADIR}/bin/ + + # Copy user test program + if [ X${WS} = "X32" ]; then + install -m 755 ${S}/${VSPMIF_TP_DIR}/vspm_tp ${D}${RENESAS_DATADIR}/bin/vspm_tp32 + install -m 755 ${S}/${VSPMIF_TP_DIR}/fdpm_tp ${D}${RENESAS_DATADIR}/bin/fdpm_tp32 + else + install -m 755 ${S}/${VSPMIF_TP_DIR}/vspm_tp ${D}${RENESAS_DATADIR}/bin/ + install -m 755 ${S}/${VSPMIF_TP_DIR}/fdpm_tp ${D}${RENESAS_DATADIR}/bin/ + fi +} + +PACKAGES = "\ + ${PN} \ + ${PN}-dbg \ +" +FILES_${PN} = " \ + ${@oe.utils.conditional('WS', '32', '${RENESAS_DATADIR}/bin/vspm_tp32 ${RENESAS_DATADIR}/bin/fdpm_tp32', \ + '${RENESAS_DATADIR}/bin/vspm_tp ${RENESAS_DATADIR}/bin/fdpm_tp', d)}" + +FILES_${PN}-dbg = " \ + ${RENESAS_DATADIR}/bin/.debug/*" + +RPROVIDES_${PN} += "vspmif-tp-user-module" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/vspmif-module/vspmif-user-module.bb b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/vspmif-module/vspmif-user-module.bb new file mode 100644 index 00000000..bf7fef63 --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/vspmif-module/vspmif-user-module.bb @@ -0,0 +1,49 @@ +DESCRIPTION = "VSP Manager Interface library for R-Car Gen3" + +require vspmif.inc + +DEPENDS = "kernel-module-vspmif mmngr-user-module" +PN = "vspmif-user-module" +PR = "r0" + +S = "${WORKDIR}/git" +VSPMIF_LIB_DIR = "vspm_if-module/files/vspm_if" + +EXTRA_OEMAKE = "ARCH=${TARGET_ARCH}" + +includedir = "${RENESAS_DATADIR}/include" + +do_compile() { + export VSPM_LEGACY_IF="1" + + # Build shared library + cd ${S}/${VSPMIF_LIB_DIR}/if + rm -rf ${S}/${VSPMIF_LIB_DIR}/if/libvspm.so* + oe_runmake +} + +do_install() { + # Create destination folders + install -d ${D}/${libdir} + install -d ${D}/${includedir} + + # Copy shared library + install -m 755 ${S}/${VSPMIF_LIB_DIR}/if/libvspm.so* ${D}/${libdir}/ + cd ${D}/${libdir}/ + ln -sf libvspm.so.1.0.0 libvspm.so.1 + ln -sf libvspm.so.1 libvspm.so + + # Copy shared header files + install -m 644 ${S}/${VSPMIF_LIB_DIR}/include/vspm_public.h ${D}/${includedir}/ + install -m 644 ${S}/${VSPMIF_LIB_DIR}/include/fdpm_api.h ${D}/${includedir}/ +} + +PACKAGES = "\ + ${PN} \ + ${PN}-dev \ + ${PN}-dbg \ +" + +RPROVIDES_${PN} += "vspmif-user-module" +INSANE_SKIP_${PN} += "libdir" +INSANE_SKIP_${PN}-dev += "libdir" diff --git a/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/vspmif-module/vspmif.inc b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/vspmif-module/vspmif.inc new file mode 100644 index 00000000..34e8587e --- /dev/null +++ b/bsp/meta-renesas/meta-rcar-gen3/recipes-multimedia/vspmif-module/vspmif.inc @@ -0,0 +1,15 @@ +LICENSE = "MIT" +LIC_FILES_CHKSUM = " \ + file://COPYING.MIT;md5=30a99e0d36a3da1f5cf93c070ad7888a \ +" + +require include/rcar-gen3-modules-common.inc + +VSPMIF_LIB_URL = "git://github.com/renesas-rcar/vspmif_lib.git" +BRANCH = "rcar_gen3" +SRCREV = "06fe8b1341801079f8a2b964ea95980967dcf789" + +SRC_URI = "${VSPMIF_LIB_URL};branch=${BRANCH}" + +# This module is machine specific. +PACKAGE_ARCH = "${MACHINE_ARCH}" |