mdp_version.h revision a653efede03423aa840da24634f1ec6f20796f1e
1ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson/*
2ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson
4ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * Redistribution and use in source and binary forms, with or without
5ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * modification, are permitted provided that the following conditions are
6ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * met:
7ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson *   * Redistributions of source code must retain the above copyright
8ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson *     notice, this list of conditions and the following disclaimer.
9ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson *   * Redistributions in binary form must reproduce the above
10ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson *     copyright notice, this list of conditions and the following
11ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson *     disclaimer in the documentation and/or other materials provided
12ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson *     with the distribution.
13ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson *   * Neither the name of The Linux Foundation nor the names of its
14ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson *     contributors may be used to endorse or promote products derived
15ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson *     from this software without specific prior written permission.
16ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson *
17ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson */
29ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson
30ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#ifndef INCLUDE_LIBQCOMUTILS_MDPVER
31ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#define INCLUDE_LIBQCOMUTILS_MDPVER
32ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson
33ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#include <stdint.h>
34ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#include <utils/Singleton.h>
35ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#include <cutils/properties.h>
36ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson
37ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson/* This class gets the MSM type from the soc info
38ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson*/
39ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonusing namespace android;
40ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonnamespace qdutils {
41a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// These panel definitions are available at mdss_mdp.h which is internal header
42a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// file and is not available at <linux/mdss_mdp.h>.
43a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// ToDo: once it is available at linux/mdss_mdp.h, these below definitions can
44a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// be removed.
45ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonenum mdp_version {
46ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    MDP_V_UNKNOWN = 0,
47ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    MDP_V2_2    = 220,
48ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    MDP_V3_0    = 300,
49ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    MDP_V3_0_3  = 303,
50ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    MDP_V3_0_4  = 304,
51ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    MDP_V3_1    = 310,
52ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    MDP_V4_0    = 400,
53ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    MDP_V4_1    = 410,
54ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    MDP_V4_2    = 420,
55ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    MDP_V4_3    = 430,
56ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    MDP_V4_4    = 440,
57ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    MDSS_V5     = 500,
58ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson};
59ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson
60a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// chip variants have same major number and minor numbers usually vary
61a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// for e.g., MDSS_MDP_HW_REV_101 is 0x10010000
62a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson//                                    1001       -  major number
63a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson//                                        0000   -  minor number
64a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson// 8x26 v1 minor number is 0000
65a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson//      v2 minor number is 0001 etc..
66ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson
67ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonenum {
68ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    MAX_DISPLAY_DIM = 2048,
69ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson};
70ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson
71a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson#define NO_PANEL         '0'
72ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#define MDDI_PANEL       '1'
73ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#define EBI2_PANEL       '2'
74ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#define LCDC_PANEL       '3'
75ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#define EXT_MDDI_PANEL   '4'
76ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#define TV_PANEL         '5'
77ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#define DTV_PANEL        '7'
78ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#define MIPI_VIDEO_PANEL '8'
79ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#define MIPI_CMD_PANEL   '9'
80ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#define WRITEBACK_PANEL  'a'
81ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#define LVDS_PANEL       'b'
82a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson#define EDP_PANEL        'c'
83ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson
84ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonclass MDPVersion;
85ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson
86ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonstruct Split {
87ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    int mLeft;
88ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    int mRight;
89ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    Split() : mLeft(0), mRight(0){}
90ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    int left() { return mLeft; }
91ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    int right() { return mRight; }
92ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    friend class MDPVersion;
93ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson};
94ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson
95ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonclass MDPVersion : public Singleton <MDPVersion>
96ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson{
97ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonpublic:
98ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    MDPVersion();
99ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    ~MDPVersion();
100ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    int getMDPVersion() {return mMDPVersion;}
101ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    char getPanelType() {return mPanelType;}
102ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    bool hasOverlay() {return mHasOverlay;}
103a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    uint8_t getTotalPipes() {
104a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson        return (uint8_t)(mRGBPipes + mVGPipes + mDMAPipes);
105a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    }
106ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    uint8_t getRGBPipes() { return mRGBPipes; }
107ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    uint8_t getVGPipes() { return mVGPipes; }
108ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    uint8_t getDMAPipes() { return mDMAPipes; }
109ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    bool supportsDecimation();
110ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    uint32_t getMaxMDPDownscale();
111a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    uint32_t getMaxMDPUpscale();
112ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    bool supportsBWC();
113a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    bool supportsMacroTile();
114ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    int getLeftSplit() { return mSplit.left(); }
115ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    int getRightSplit() { return mSplit.right(); }
116a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    unsigned long getLowBw() { return mLowBw; }
117a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    unsigned long getHighBw() { return mHighBw; }
118a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    bool isSrcSplit() const;
119a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    bool is8x26();
120a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    bool is8x74v2();
121a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    bool is8084();
122a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    bool is8092();
123a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson
124ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilsonprivate:
125a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    bool updateSysFsInfo();
126a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    bool updatePanelInfo();
127a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    bool updateSplitInfo();
128a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    int tokenizeParams(char *inputParams, const char *delim,
129a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson                        char* tokenStr[], int *idx);
130ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    int mFd;
131ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    int mMDPVersion;
132ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    char mPanelType;
133ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    bool mHasOverlay;
134ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    uint32_t mMdpRev;
135ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    uint8_t mRGBPipes;
136ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    uint8_t mVGPipes;
137ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    uint8_t mDMAPipes;
138ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    uint32_t mFeatures;
139ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    uint32_t mMDPDownscale;
140a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    uint32_t mMDPUpscale;
141a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    bool mMacroTileEnabled;
142ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson    Split mSplit;
143a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    unsigned long mLowBw; //kbps
144a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    unsigned long mHighBw; //kbps
145a653efede03423aa840da24634f1ec6f20796f1eSimon Wilson    bool mSourceSplit;
146ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson};
147ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson}; //namespace qdutils
148ef53c1c84ec55ed50f607d52b7abfbb86239408eSimon Wilson#endif //INCLUDE_LIBQCOMUTILS_MDPVER
149