129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed/*
244d5282b252fa1db88472542c0b9d794fd915d54Saurabh Shah * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * Redistribution and use in source and binary forms, with or without
529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * modification, are permitted provided that the following conditions are
629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * met:
729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *   * Redistributions of source code must retain the above copyright
829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *     notice, this list of conditions and the following disclaimer.
929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *   * Redistributions in binary form must reproduce the above
1029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *     copyright notice, this list of conditions and the following
1129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *     disclaimer in the documentation and/or other materials provided
1229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *     with the distribution.
13a43fb8fce6d9be5577de1e0f49c99bd4fe2f6d44Duy Truong *   * Neither the name of The Linux Foundation nor the names of its
1429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *     contributors may be used to endorse or promote products derived
1529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *     from this software without specific prior written permission.
1629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed *
1729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
1829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
2029a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
2129a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2329a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
2429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
2529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
2629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
2729a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2829a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed */
2929a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
30a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed#ifndef INCLUDE_LIBQCOMUTILS_MDPVER
31a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed#define INCLUDE_LIBQCOMUTILS_MDPVER
3229a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
33a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed#include <stdint.h>
34a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed#include <utils/Singleton.h>
35a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed#include <cutils/properties.h>
3629a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
37a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed/* This class gets the MSM type from the soc info
38a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed*/
39a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmedusing namespace android;
40a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmednamespace qdutils {
41a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmedenum mdp_version {
42a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed    MDP_V_UNKNOWN = 0,
43a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed    MDP_V2_2    = 220,
44a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed    MDP_V3_0    = 300,
45a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed    MDP_V3_0_3  = 303,
466848f7a0d9ed6fecb0fc27c8bfa32c5fda3ab163Xiaoming Zhou    MDP_V3_0_4  = 304,
47a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed    MDP_V3_1    = 310,
48a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed    MDP_V4_0    = 400,
49a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed    MDP_V4_1    = 410,
50a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed    MDP_V4_2    = 420,
51a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed    MDP_V4_3    = 430,
52a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed    MDP_V4_4    = 440,
53a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed    MDSS_V5     = 500,
5429a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed};
5529a26818d7294055539167b2fbfdaa168bcf725cNaseer Ahmed
5620de52e98f608ed30049d7add296ef2a6f134a24Saurabh Shahenum mdp_rev {
5720de52e98f608ed30049d7add296ef2a6f134a24Saurabh Shah    MDSS_MDP_HW_REV_100 = 0x10000000,
5820de52e98f608ed30049d7add296ef2a6f134a24Saurabh Shah    MDSS_MDP_HW_REV_101 = 0x10010000, //8x26
5920de52e98f608ed30049d7add296ef2a6f134a24Saurabh Shah    MDSS_MDP_HW_REV_102 = 0x10020000,
6020de52e98f608ed30049d7add296ef2a6f134a24Saurabh Shah};
6120de52e98f608ed30049d7add296ef2a6f134a24Saurabh Shah
62ab90e9d61fe4dbfd577638a3c0cad65d044a2bf0Saurabh Shahenum {
63ab90e9d61fe4dbfd577638a3c0cad65d044a2bf0Saurabh Shah    MAX_DISPLAY_DIM = 2048,
64ab90e9d61fe4dbfd577638a3c0cad65d044a2bf0Saurabh Shah};
65ab90e9d61fe4dbfd577638a3c0cad65d044a2bf0Saurabh Shah
6696c4c95d48dc075196c601b30a8798a262df9720Naseer Ahmed#define MDDI_PANEL       '1'
6796c4c95d48dc075196c601b30a8798a262df9720Naseer Ahmed#define EBI2_PANEL       '2'
6896c4c95d48dc075196c601b30a8798a262df9720Naseer Ahmed#define LCDC_PANEL       '3'
6996c4c95d48dc075196c601b30a8798a262df9720Naseer Ahmed#define EXT_MDDI_PANEL   '4'
7096c4c95d48dc075196c601b30a8798a262df9720Naseer Ahmed#define TV_PANEL         '5'
7196c4c95d48dc075196c601b30a8798a262df9720Naseer Ahmed#define DTV_PANEL        '7'
7296c4c95d48dc075196c601b30a8798a262df9720Naseer Ahmed#define MIPI_VIDEO_PANEL '8'
7396c4c95d48dc075196c601b30a8798a262df9720Naseer Ahmed#define MIPI_CMD_PANEL   '9'
7496c4c95d48dc075196c601b30a8798a262df9720Naseer Ahmed#define WRITEBACK_PANEL  'a'
7596c4c95d48dc075196c601b30a8798a262df9720Naseer Ahmed#define LVDS_PANEL       'b'
7696c4c95d48dc075196c601b30a8798a262df9720Naseer Ahmed
77828e828437e9d6dd027819c2bbea21f0c13597d5Saurabh Shahclass MDPVersion;
78828e828437e9d6dd027819c2bbea21f0c13597d5Saurabh Shah
79828e828437e9d6dd027819c2bbea21f0c13597d5Saurabh Shahstruct Split {
80828e828437e9d6dd027819c2bbea21f0c13597d5Saurabh Shah    int mLeft;
81828e828437e9d6dd027819c2bbea21f0c13597d5Saurabh Shah    int mRight;
82828e828437e9d6dd027819c2bbea21f0c13597d5Saurabh Shah    Split() : mLeft(0), mRight(0){}
83828e828437e9d6dd027819c2bbea21f0c13597d5Saurabh Shah    int left() { return mLeft; }
84828e828437e9d6dd027819c2bbea21f0c13597d5Saurabh Shah    int right() { return mRight; }
85828e828437e9d6dd027819c2bbea21f0c13597d5Saurabh Shah    friend class MDPVersion;
86828e828437e9d6dd027819c2bbea21f0c13597d5Saurabh Shah};
8796c4c95d48dc075196c601b30a8798a262df9720Naseer Ahmed
88a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmedclass MDPVersion : public Singleton <MDPVersion>
89a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed{
90a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmedpublic:
91a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed    MDPVersion();
9264718efc5e715c5980c5a6abb96423414953aaccXiaoming Zhou    ~MDPVersion();
93a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed    int getMDPVersion() {return mMDPVersion;}
9496c4c95d48dc075196c601b30a8798a262df9720Naseer Ahmed    char getPanelType() {return mPanelType;}
95a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed    bool hasOverlay() {return mHasOverlay;}
9644d5282b252fa1db88472542c0b9d794fd915d54Saurabh Shah    uint8_t getTotalPipes() { return (mRGBPipes + mVGPipes + mDMAPipes);}
9744d5282b252fa1db88472542c0b9d794fd915d54Saurabh Shah    uint8_t getRGBPipes() { return mRGBPipes; }
9844d5282b252fa1db88472542c0b9d794fd915d54Saurabh Shah    uint8_t getVGPipes() { return mVGPipes; }
9944d5282b252fa1db88472542c0b9d794fd915d54Saurabh Shah    uint8_t getDMAPipes() { return mDMAPipes; }
100ab90e9d61fe4dbfd577638a3c0cad65d044a2bf0Saurabh Shah    bool supportsDecimation();
101ab90e9d61fe4dbfd577638a3c0cad65d044a2bf0Saurabh Shah    uint32_t getMaxMDPDownscale();
1023932d9e448c02ac953cbc0f3ef7c0573400a5570Sushil Chauhan    bool supportsBWC();
10320de52e98f608ed30049d7add296ef2a6f134a24Saurabh Shah    bool is8x26();
104828e828437e9d6dd027819c2bbea21f0c13597d5Saurabh Shah    int getLeftSplit() { return mSplit.left(); }
105828e828437e9d6dd027819c2bbea21f0c13597d5Saurabh Shah    int getRightSplit() { return mSplit.right(); }
106a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmedprivate:
10764718efc5e715c5980c5a6abb96423414953aaccXiaoming Zhou    int mFd;
108a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed    int mMDPVersion;
10996c4c95d48dc075196c601b30a8798a262df9720Naseer Ahmed    char mPanelType;
110a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed    bool mHasOverlay;
11144d5282b252fa1db88472542c0b9d794fd915d54Saurabh Shah    uint32_t mMdpRev;
11244d5282b252fa1db88472542c0b9d794fd915d54Saurabh Shah    uint8_t mRGBPipes;
11344d5282b252fa1db88472542c0b9d794fd915d54Saurabh Shah    uint8_t mVGPipes;
11444d5282b252fa1db88472542c0b9d794fd915d54Saurabh Shah    uint8_t mDMAPipes;
115ab90e9d61fe4dbfd577638a3c0cad65d044a2bf0Saurabh Shah    uint32_t mFeatures;
116ab90e9d61fe4dbfd577638a3c0cad65d044a2bf0Saurabh Shah    uint32_t mMDPDownscale;
117828e828437e9d6dd027819c2bbea21f0c13597d5Saurabh Shah    Split mSplit;
118a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed};
119a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed}; //namespace qdutils
120a87da60090f55b823ee999930b381daa3dbda67eNaseer Ahmed#endif //INCLUDE_LIBQCOMUTILS_MDPVER
121