diff options
author | David Ng <dave@codeaurora.org> | 2013-09-23 18:52:19 -0700 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2022-01-11 14:42:50 +0800 |
commit | 7e021f554b8a99f6c5ef56c974ae527b8ece6bc4 (patch) | |
tree | 425eb2e2e575a3b1c52666e477f1b851ac7b48a3 /init | |
parent | 89b583b4090de8a362ba0a4e93a66d00a723c848 (diff) |
common: Implement MSM-specific init extension library
This is a squash of the following:
Author: Hernán Castañón <herna@paranoidandroid.co>
Date: Fri Jan 5 10:54:14 2018 +0100
common: init: add libselinux
This is needed in favour of a compiling issue on oreo-mr1.
Change-Id: I38fbc1aaa3ceafdcd3176f980455bcae2c8259ec
Signed-off-by: Hernán Castañón <herna@paranoidandroid.co>
Author: Willi Ye <williye97@gmail.com>
Date: Mon Nov 6 16:59:54 2017 +0100
common: init: Add necessary libraries
Change-Id: I0ba99df45865b33e6266d12b8dfe874af7155f05
Author: Alex Naidis <alex.naidis@linux.com>
Date: Fri Dec 30 02:44:39 2016 +0100
common: init: Kill board init support
* These files were still using the old
syntax and thus breaking build.
* Instead of fixing all of them,
remove support, since they have
no use.
Change-Id: I522655a8c52089dd779a131ac2a785c63856e61f
Signed-off-by: Alex Naidis <alex.naidis@linux.com>
Author: Alex Naidis <alex.naidis@linux.com>
Date: Tue Dec 27 20:42:17 2016 +0100
common: init: Remove junk
* As preparation for the comeback
Change-Id: Iafa198bf0c70106944acd4ebbf2d492e622dbf09
Signed-off-by: Alex Naidis <alex.naidis@linux.com>
Author: Jake Weinstein <xboxlover360@gmail.com>
Date: Sun Dec 20 19:58:37 2015 +0000
init: remove display density code
* Let devices define this
Change-Id: Ieeaf4ec6ab0f4da08ca6f9428c72de57997a17d0
Author: Anshuman Dani <adani@codeaurora.org>
Date: Tue Nov 19 20:33:19 2013 +0530
init_msm8960: Overwrite ro.opengles.version for 8960
Overwrite the ro.opengles.version property with 0x2000.
This change is specific to 8960 Classic, which can only
support upto Open GLES vesion 2.0
This change fixes the CTS test failure
android.opengl.cts.OpenGlEsVersionTest
CRs-Fixed: 575502
Change-Id: I7e90ddde44fef596d1446e6f1acfe7070ef9337b
Author: dhacker29 <dhackerdvm@gmail.com>
Date: Sat Feb 1 17:22:00 2014 -0600
common: init: Add hook for target specific libinit defines
* Set TARGET_LIBINIT_DEFINES_FILE := path to your file in BoardConfig
Change-Id: I2cc84a0c82875b2cf57c2b94a544a30c9ada546b
Author: Jake Weinstein <xboxlover360@gmail.com>
Date: Tue Oct 20 19:49:43 2015 +0000
common: build vendor init static library as C++
* This is necessary in order to match https://android.googlesource.com/platform/system/core/+/f3cf438714aa1284d8a58e2f3b108ba93f6d3abb
* Based on the following
Change-Id: Ib3f2e4c533129aba8fba9eda8509762c7fc5d7c7
Author: Tanya Finkel <tfinkel@codeaurora.org>
Date: Mon Apr 20 23:53:30 2015 -0700
display: Fix resolution for SBC8016 platform
The default display for the SBC platform is HDMI display.
Change-Id: I41003b140a7201f681fcc5005106ccdd0e5736e3
Author: Pushkaraj Patil <ppatil@codeaurora.org>
Date: Fri Jan 30 16:13:08 2015 +0530
common: Set separate system property for 8929
8929 is using 8939 system property to select hw hevc
decoder solution but this may lead to other CTS issues
as 8929 have different specification. Use separate
system property for 8929.
Change-Id: I8687279c7fa2957ddf16dfeeba4f0c859c3bf01b
Author: Pushkaraj Patil <ppatil@codeaurora.org>
Date: Wed Jan 28 14:37:43 2015 +0530
common: use hw hevc decoder for msm8929
8929 target is using software hevc decoder. Set a system
property so as to use hw hevc decoder, for all variants of
8929.
Change-Id: I156a26e905859a23f96a32ca4b98cdee688833df
Author: Manikanta Kanamarlapudi <kmanikan@codeaurora.org>
Date: Mon Dec 29 13:34:27 2014 +0530
common: Set system property to differentiate 8916 and 8939 hw
Set system property to differentiate 8916 and 8939 hw based
on soc-id to select appropriate media_codecs.xml
Change-Id: I043e00c9c580994b511f8fcec4a0890da90645a6
CRs-Fixed: 770327
Author: Pushkaraj Patil <ppatil@codeaurora.org>
Date: Tue Sep 2 16:07:20 2014 +0530
init: disable narrow search range
For 8916 narrow search range should be disable.
Disable set property vidc.enc.narrow.searchrange,
if target is 8916.
Change-Id: I501eaf1de72334a0a86baa222d29387b4da66860
Author: Praveena Pachipulusu <pveena@codeaurora.org>
Date: Tue Apr 22 16:04:05 2014 +0530
init_msm8916: Properly handle reading sysfs node
Properly handle failure to read sysfs file used to
determine the lcd density.
Change-Id: I864f67e9c9489b20f3634179e277fb5ad6096af0
Author: Praveena Pachipulusu <pveena@codeaurora.org>
Date: Fri Apr 4 12:20:24 2014 +0530
init: Add MSM-specific init extension library
Implement MSM-specific initialization during boot
up at "init" stage. Set DPI property based on panel
resolutions by reading virtual_size sysfs entry.
Change-Id: Ie0e1b5e68c72abe4aa11edbd4700bef3208dd461
Author: Manikanta Kanamarlapudi <kmanikan@codeaurora.org>
Date: Thu Aug 7 20:08:37 2014 +0530
common: Add setprop to differentiate sw/hw HEVC
Add setprop to differentiate sw/hw HEVC based on
msm_id
Change-Id: I15421fa9217597a541e0ee042ba48662fcda59b4
Author: Manikanta Kanamarlapudi <kmanikan@codeaurora.org>
Date: Thu Jul 17 21:09:24 2014 +0530
common: Add init_msm for 8916 file
Add init_msm for 8916 file and do setprop's
for hw/sw HEVC based on msm_id
Change-Id: I4cde44765e017add364a3632632a4c78cdab33f5
Author: Shruthi Krishna <skrish@codeaurora.org>
Date: Mon Mar 23 11:51:19 2015 -0700
Renaming thulium to msm8996
Change-Id: I912a7bc3a107341e7d413937c0d1e9580e0a20d6
Author: Bruce Levy <blevy@codeaurora.org>
Date: Fri Mar 6 16:09:58 2015 -0800
init: Add MSM-specific init extension library for thulium
- Implements MSM-specific initialization during bootup
- Sets the lcd density to 480
Change-Id: I30259948edf866b0e288d33ae1965aa1bd980f93
Author: Ilia Lin <ilialin@codeaurora.org>
Date: Tue Mar 11 14:00:59 2014 +0200
init: qcom: Set ro.sf.lcd_density for SBC APQ8084
Set the property ro.sf.lcd_density value to comply the
SBC APQ8084 display size.
qemu.hw.mainkeys is set to 0, because SBC is headless device
and doesn't have HW buttons.
Change-Id: I3e4e56245f95a061ea218f16c0af3f10a797ad4b
Author: Vijay Ganti <viganti@codeaurora.org>
Date: Wed Feb 12 13:06:42 2014 -0800
init: Update LCD density setting for APQ8084 MTP and Liquid
Update LCD density on Liquid to 320 and MTP to 480
based on UX profiling and Jank analysis
CRs-fixed: 612032
Change-Id: I1d2ee7671b7fd388967087df4f4bf8711f010478
(cherry picked from
Author: Jake Weinstein <xboxlover360@gmail.com>
Date: Sun Oct 11 17:31:15 2015 +0000
init: add support for MSM8952/MSM8976
Change-Id: I045bab35a8b97e84b41612e0ac0e33d43995ef60
Author: Jake Weinstein <xboxlover360@gmail.com>
Date: Sun Oct 11 17:30:27 2015 +0000
init: add support for MSM8909
Change-Id: I852690234de1b2ffd0b6cf457106fff353a89a53
Author: Prabhanjan Kandula <pkandula@codeaurora.org>
Date: Mon Mar 30 20:18:17 2015 +0530
init: display: Add permission to camera bw node
Allow surfaceflinger process to access fb0/mdp/bw_mode_bitmap,
so that framework can hint the camera usage to limit the bw.
Change-Id: I566010e1b988ab06f6618967f5b9c6d0cfb68890
Author: Ilia Lin <ilialin@codeaurora.org>
Date: Tue Oct 21 14:01:57 2014 +0300
init: qcom: Set LCD density for Dragonboard APQ8094
Set proper LCD dencity for the FWVGA display on the
Dragonboard APQ8094.
Change-Id: I6bd657ee90a21ed8a13e6456b05feaf79b5c5c95
Author: Arun Kumar K.R <akumarkr@codeaurora.org>
Date: Tue Jun 24 13:17:55 2014 -0700
init: Add MSM-specific init extension library for 8994
- Implements MSM-specific initialization during bootup
- Sets the lcd density at the bootup
Change-Id: I2bbc3e724682b8b11329b87c26aca1e4faf8d357
Author: Jeykumar Sankaran <jsanka@codeaurora.org>
Date: Mon Dec 8 13:52:20 2014 -0800
init: Add MSM-specific init extension library for 8992
- Implements MSM-specific initialization during bootup
- Sets the lcd density to 480
Change-Id: I2997e902c3bdafefda0bb98b8d8b3c1279c7b5dc
Author: Saurabh Shah <saurshah@codeaurora.org>
Date: Wed Feb 25 17:09:29 2015 -0800
device/qcom/common: Add permissions for mode and modes
Add permissions, owners for /sys/class/graphics/fb0/{mode, modes}
These are meant to be read/written to by hwc.
Change-Id: I43f38b8106ac066b37912a3ebd2af2375f3e7b09
Author: Jeykumar Sankaran <jsanka@codeaurora.org>
Date: Wed Aug 13 20:36:23 2014 -0700
init: Set permissions for dynamic partial update node
Set file permissions for dynamic partial update system node to
control the feature at runtime.
Change-Id: Icd4799907d168c2606c8811c73f4fedd847d55f0
Author: Arun Kumar K.R <akumarkr@codeaurora.org>
Date: Fri Aug 29 15:52:12 2014 -0700
init_msm: Add usergroup permission to dynamic_fps node.
HWC will be writing to this sysfs node to set the variable
refresh rate, hence set proper usergroup
Change-Id: If668003463f580050d5843af97bf8f8761eb7f88
Author: Naseer Ahmed <naseer@codeaurora.org>
Date: Wed Feb 25 11:37:08 2015 -0500
init: Set permissions for physical address
Change-Id: Ic7f0b296e9ab5f1738aae4f46dcb47e935da8045
CRs-Fixed: 795622
Author: Naseer Ahmed <naseer@codeaurora.org>
Date: Wed Jul 23 18:13:12 2014 -0400
init: Add permissions for CEC nodes
Change-Id: I220fd52e33690ee6d4de39f121464571c7ce91e0
Author: Naseer Ahmed <naseer@codeaurora.org>
Date: Wed Jan 28 18:50:43 2015 -0500
init_msm: S3D mode permissions
Allow HWC write permissions on this node.
Change-Id: I732c2003f1130f9ebefb17e0fcd0f14044dc24f9
Author: Tatenda Chipeperekwa <tatendac@codeaurora.org>
Date: Wed Nov 19 11:06:52 2014 -0800
init: Add persmissions to access res_info node for HDMI timing info
The HDMI driver now provides timing information through the res_info
sysfs node. The display HAL will need permissions to read/write this
node as part of HDMI initialization.
Change-Id: I2d767534a877368f55d614118676edb5f4f90b9e
Author: Matthew Qin <yqin@codeaurora.org>
Date: Tue Apr 29 16:47:29 2014 +0800
init: Add ro.alarm_boot property support
ro.alarm_boot property is used to let framwork detect if it
is RTC triggered boot.
Change-Id: Id503ad39a2872fdb3acbc79233c008dc4f4e4a3c
Author: Ramkumar Radhakrishnan <ramkumar@codeaurora.org>
Date: Tue Feb 11 19:45:58 2014 -0800
init script: Add usergroup write permission to idle_time node
Set usergroup write permission of idle_time node to enable idle
timeout feature.
Change-Id: If6b0a94e93b5117c4004726d62a346403f7a8ed3
Author: Aravind Venkateswaran <aravindh@codeaurora.org>
Date: Tue Feb 4 12:35:02 2014 -0800
init: Set DPI property based on platform subtype ID
There is a need to support panels of different resolutions
on msm8926. In such scenarios, the platform subtype
ID is used to uniquely identify such panels. Use this ID to
correctly configure the device property for the DPI setting.
Change-Id: If2d7c3cb2a528e9fe6780116ea1ceb278eba138d
Author: Pradeep Panigrahi <pradeepp@codeaurora.org>
Date: Sat Jan 11 12:50:53 2014 +0530
init: qcom: Setting Bluetooth soc property
In case of msm8974-apq, setting Bluetooth property as ath3k
Change-Id: I4c9da7fc422d82b97b1dac353c33b1b1913fc826
Author: Uday Kumar Sundar <usundar@codeaurora.org>
Date: Fri Dec 13 16:10:44 2013 -0800
init: Add coredump support for processes
This change will set-up the core-dump directory and the core-file
pattern. The coredumps will not be generated during crashes on
boot-up. The core-dumps will only be generated on crashes after the
boot-up.
Change-Id: Ie8c15f500aa871b7b06913e70d0076656834b319
Author: Arun Kumar K.R <akumarkr@codeaurora.org>
Date: Fri Nov 15 12:01:06 2013 -0800
init_msm: use qemu.hw.mainkeys instead of ro.hw.nav_keys
Android removed support for ro.hw.nav_keys property to enable/disable
the virtual keys on the target, hence just use qemu.hw.mainkeys.
Change-Id: Ieb700313ea49a32ed98f80e3e8cce9ab9e07624b
Author: Praveena Pachipulusu <pveena@codeaurora.org>
Date: Tue Oct 8 09:36:48 2013 +0530
init: set hdmi node permissions during initialization
- Add functions to setPermission and setOwner for file nodes
- Set hdmi node permissions based on fb number.
Change-Id: I57babd7aa8387d35860ad66892dd0c21ca35c135
Author: David Ng <dave@codeaurora.org>
Date: Thu Oct 10 13:59:30 2013 -0700
init: Update lcd density setting for APQ8084
Use correct LCD density and softkey enable setting
for APQ8084.
Change-Id: I0ba8bc5d69981224c2dcdb314926a11d9f6a85eb
Author: David Ng <dave@codeaurora.org>
Date: Mon Sep 23 18:52:19 2013 -0700
init: Add MSM-specific init extension library
Implement MSM-specific initialization during boot up
at "init" stage. This allows variable setting based
on runtime query of hardware configuration.
Change-Id: Id14293a9f030d6631c55e84498f503a5bcb818e2
Change-Id: I28fc2f6e03b6a1d6f910d380a3338f124e34a4b3
Signed-off-by: alk3pInjection <webmaster@raspii.tech>
Diffstat (limited to 'init')
-rw-r--r-- | init/Android.mk | 18 | ||||
-rw-r--r-- | init/init_msm.cpp | 265 | ||||
-rw-r--r-- | init/init_msm.h | 52 |
3 files changed, 335 insertions, 0 deletions
diff --git a/init/Android.mk b/init/Android.mk new file mode 100644 index 0000000..246af29 --- /dev/null +++ b/init/Android.mk @@ -0,0 +1,18 @@ +ifeq ($(TARGET_INIT_VENDOR_LIB),libinit_msm) + +LOCAL_PATH := $(call my-dir) +LIBINIT_MSM_PATH := $(call my-dir) + +include $(CLEAR_VARS) +LOCAL_MODULE_TAGS := optional +LOCAL_SHARED_LIBRARIES := libbase liblog libselinux +LOCAL_C_INCLUDES := system/core/init +LOCAL_CFLAGS := -Wall -DANDROID_TARGET=\"$(TARGET_BOARD_PLATFORM)\" +LOCAL_SRC_FILES := init_msm.cpp +ifneq ($(TARGET_LIBINIT_DEFINES_FILE),) + LOCAL_SRC_FILES += ../../../../$(TARGET_LIBINIT_DEFINES_FILE) +endif +LOCAL_MODULE := libinit_msm +include $(BUILD_STATIC_LIBRARY) + +endif diff --git a/init/init_msm.cpp b/init/init_msm.cpp new file mode 100644 index 0000000..16b73a4 --- /dev/null +++ b/init/init_msm.cpp @@ -0,0 +1,265 @@ +/* + Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of The Linux Foundation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <errno.h> +#include <stdlib.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <private/android_filesystem_config.h> + +#include "vendor_init.h" +#include "property_service.h" +#include "log.h" +#include "util.h" + +#include "init_msm.h" + +#include <sys/resource.h> + +#define SOC_ID_PATH1 "/sys/devices/soc0/soc_id" +#define SOC_ID_PATH2 "/sys/devices/system/soc/soc0/id" +#define SOC_VER_PATH1 "/sys/devices/soc0/platform_version" +#define SOC_VER_PATH2 "/sys/devices/system/soc/soc0/platform_version" +#define BOARD_TYPE_PATH1 "/sys/devices/soc0/hw_platform" +#define BOARD_TYPE_PATH2 "/sys/devices/system/soc/soc0/hw_platform" + +#define BUF_SIZE 64 +#define STRCONV_(x) #x +#define STRCONV(x) "%" STRCONV_(x) "s" + +static unsigned long msm_id; +static unsigned long msm_ver; +static char board_type[BUF_SIZE]; +static char tmp[BUF_SIZE]; + +// sys and dev fb paths +char sys_fb_path[] = "/sys/class/graphics/"; +char dev_fb_path[] = "/dev/graphics/"; +#define DEV_GFX_HDMI "/dev/graphics/hdmi" + +__attribute__ ((weak)) +void init_msm_properties(unsigned long soc, unsigned long socrev, char *board) +{ + UNUSED(soc); + UNUSED(socrev); + UNUSED(board); +} + +int read_file2(const char *fname, char *data, int max_size) +{ + int fd, rc; + + if (max_size < 1) + return 0; + + fd = open(fname, O_RDONLY); + if (fd < 0) { + ERROR("failed to open '%s'\n", fname); + return 0; + } + + rc = read(fd, data, max_size - 1); + if ((rc > 0) && (rc < max_size)) + data[rc] = '\0'; + else + data[0] = '\0'; + close(fd); + + return 1; +} + +/* + * setPerms: sets the permission to the file node + * @path: file node + * @mode: permissions to be set(0664) + */ +void setPerms(char *path, uint32_t mode) +{ + // set the permission if the file exists + int fd = open(path, O_RDONLY | O_NOFOLLOW); + if (fd >= 0) { + if (fchmod(fd, mode) < 0) + ERROR("chmod failed for %s: errno = %d", path, errno); + close(fd); + } +} + +/* + * setOwners: sets the owner and group for a file node + * @path: file node + * @owner: AID for owner + * @group: AID for group + */ +void setOwners(char *path, int owner, int group) +{ + // set the permissinn if the file exists + int fd = open(path, O_RDONLY | O_NOFOLLOW); + if (fd >= 0) { + if (fchown(fd, owner, group) < 0) + ERROR(" chown failed for %s: errno = %d", path, errno); + close(fd); + } +} + +/* + * Setup Display related nodes & permissions. For HDMI, it can be fb1 or fb2 + * Loop through the sysfs nodes and determine the HDMI(dtv panel) + */ +void set_display_node_perms() +{ + char panel_type[] = "dtv panel"; + char buf[BUF_SIZE]; + int num; + + for (num=0; num<=2; num++) { + snprintf(tmp,sizeof(tmp),"%sfb%d/msm_fb_type", sys_fb_path, num); + if(read_file2(tmp, buf, sizeof(buf))) { + if(!strncmp(buf, panel_type, strlen(panel_type))) { + // Set appropriate permissions for the nodes + snprintf(tmp, sizeof(tmp), "%sfb%d/hpd", sys_fb_path, num); + setPerms(tmp, 0664); + setOwners(tmp, AID_SYSTEM, AID_GRAPHICS); + snprintf(tmp, sizeof(tmp), "%sfb%d/res_info", sys_fb_path, num); + setPerms(tmp, 0664); + setOwners(tmp, AID_SYSTEM, AID_GRAPHICS); + snprintf(tmp, sizeof(tmp), "%sfb%d/vendor_name", sys_fb_path, + num); + setPerms(tmp, 0664); + setOwners(tmp, AID_SYSTEM, AID_GRAPHICS); + snprintf(tmp, sizeof(tmp), "%sfb%d/product_description", + sys_fb_path, num); + setPerms(tmp, 0664); + setOwners(tmp, AID_SYSTEM, AID_GRAPHICS); + snprintf(tmp, sizeof(tmp), "%sfb%d/video_mode", + sys_fb_path, num); + setPerms(tmp, 0664); + snprintf(tmp, sizeof(tmp), "%sfb%d/format_3d", sys_fb_path, + num); + setPerms(tmp, 0664); + setOwners(tmp, AID_SYSTEM, AID_SYSTEM); + snprintf(tmp, sizeof(tmp), "%sfb%d/s3d_mode", sys_fb_path, + num); + setPerms(tmp, 0664); + setOwners(tmp, AID_SYSTEM, AID_SYSTEM); + snprintf(tmp, sizeof(tmp), "%sfb%d/hdcp/tp", sys_fb_path, num); + setPerms(tmp, 0664); + setOwners(tmp, AID_SYSTEM, AID_SYSTEM); + snprintf(tmp, sizeof(tmp), "%sfb%d/cec/enable", sys_fb_path, num); + setPerms(tmp, 0664); + setOwners(tmp, AID_SYSTEM, AID_SYSTEM); + snprintf(tmp, sizeof(tmp), "%sfb%d/cec/logical_addr", sys_fb_path, num); + setPerms(tmp, 0664); + setOwners(tmp, AID_SYSTEM, AID_SYSTEM); + snprintf(tmp, sizeof(tmp), "%sfb%d/cec/rd_msg", sys_fb_path, num); + setPerms(tmp, 0664); + setOwners(tmp, AID_SYSTEM, AID_SYSTEM); + snprintf(tmp, sizeof(tmp), "%sfb%d/pa", sys_fb_path, num); + setPerms(tmp, 0664); + setOwners(tmp, AID_SYSTEM, AID_SYSTEM); + snprintf(tmp, sizeof(tmp), "%sfb%d/cec/wr_msg", sys_fb_path, num); + setPerms(tmp, 0600); + setOwners(tmp, AID_SYSTEM, AID_SYSTEM); + snprintf(tmp, sizeof(tmp), "%sfb%d", dev_fb_path, num); + symlink(tmp, DEV_GFX_HDMI); + break; + } + } + } + // Set the permission for idle_time. + snprintf(tmp, sizeof(tmp), "%sfb0/idle_time", sys_fb_path); + setPerms(tmp, 0664); + setOwners(tmp, AID_SYSTEM, AID_GRAPHICS); + + // Set the permission for mdp/bw_mode_bitmap. + snprintf(tmp, sizeof(tmp), "%sfb0/mdp/bw_mode_bitmap", sys_fb_path); + setPerms(tmp, 0664); + setOwners(tmp, AID_SYSTEM, AID_GRAPHICS); + + // Set write permission for dynamic_fps node. + snprintf(tmp, sizeof(tmp), "%sfb0/dynamic_fps", sys_fb_path); + setPerms(tmp, 0664); + setOwners(tmp, AID_SYSTEM, AID_GRAPHICS); + // Set permissions for dynamic partial update + snprintf(tmp, sizeof(tmp), "%sfb0/dyn_pu", sys_fb_path); + setPerms(tmp, 0664); + setOwners(tmp, AID_SYSTEM, AID_GRAPHICS); + + snprintf(tmp, sizeof(tmp), "%sfb0/modes", sys_fb_path); + setPerms(tmp, 0664); + setOwners(tmp, AID_SYSTEM, AID_GRAPHICS); + + snprintf(tmp, sizeof(tmp), "%sfb0/mode", sys_fb_path); + setPerms(tmp, 0664); + setOwners(tmp, AID_SYSTEM, AID_GRAPHICS); +} + +void vendor_load_properties() +{ + int rc; + + /* Collect MSM info */ + rc = read_file2(SOC_ID_PATH1, tmp, sizeof(tmp)); + if (!rc) { + rc = read_file2(SOC_ID_PATH2, tmp, sizeof(tmp)); + } + if (rc) { + msm_id = strtoul(tmp, NULL, 0); + } + rc = read_file2(SOC_VER_PATH1, tmp, sizeof(tmp)); + if (!rc) { + rc = read_file2(SOC_VER_PATH2, tmp, sizeof(tmp)); + } + if (rc) { + msm_ver = strtoul(tmp, NULL, 0); + } + rc = read_file2(BOARD_TYPE_PATH1, tmp, sizeof(tmp)); + if (!rc) { + rc = read_file2(BOARD_TYPE_PATH2, tmp, sizeof(tmp)); + } + if (rc) { + sscanf(tmp, STRCONV(BUF_SIZE), board_type); + } + if (!msm_id) { + /* abort */ + ERROR("MSM SOC detection failed, skipping MSM initialization\n"); + return; + } + + ERROR("Detected MSM SOC ID=%lu SOC VER=%lu BOARD TYPE=%s\n", + msm_id, msm_ver, board_type); + + /* Define MSM family properties */ + init_msm_properties(msm_id, msm_ver, board_type); + + /* Set Display Node Permissions */ + set_display_node_perms(); +} diff --git a/init/init_msm.h b/init/init_msm.h new file mode 100644 index 0000000..f6a3593 --- /dev/null +++ b/init/init_msm.h @@ -0,0 +1,52 @@ +/* + Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of The Linux Foundation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __INIT_MSM__H__ +#define __INIT_MSM__H__ + +#include <sys/system_properties.h> +#include <log/log.h> + +#define PROP_HWROTATE "ro.sf.hwrotation" +#define PROP_BOOT_BASEBAND "ro.boot.baseband" +#define PROP_BLUETOOTH_SOC "qcom.bluetooth.soc" + +#define UNUSED(a) ((void)(a)) +#define ISMATCH(a,b) (!strncmp(a,b,PROP_VALUE_MAX)) + +void init_msm_properties(unsigned long msm_id, unsigned long msm_ver, char *board_type); +int read_file2(const char *fname, char *data, int max_size); + +#define ERROR(fmt, args...) \ +do { \ + fprintf(stderr, fmt, ## args); \ + ALOG(LOG_ERROR, "libinit_msm", fmt, ## args); \ +} while(0) + +#endif /* __INIT_MSM__H__ */ |