Shashank Babu Chinta Venkata | afef820 | 2017-04-21 13:49:56 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 and |
| 6 | * only version 2 as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | #define pr_fmt(fmt) "dsi-hw:" fmt |
| 16 | |
| 17 | #include "dsi_ctrl_hw.h" |
| 18 | #include "dsi_ctrl_reg.h" |
| 19 | #include "dsi_hw.h" |
Sandeep Panda | a2a3c8c | 2017-07-09 02:10:44 +0530 | [diff] [blame] | 20 | #include "dsi_catalog.h" |
Shashank Babu Chinta Venkata | afef820 | 2017-04-21 13:49:56 -0700 | [diff] [blame] | 21 | |
| 22 | /* Equivalent to register DISP_CC_MISC_CMD */ |
| 23 | #define DISP_CC_CLAMP_REG_OFF 0x00 |
| 24 | |
Sandeep Panda | a2a3c8c | 2017-07-09 02:10:44 +0530 | [diff] [blame] | 25 | /* register to configure DMA scheduling */ |
| 26 | #define DSI_DMA_SCHEDULE_CTRL 0x100 |
| 27 | |
Shashank Babu Chinta Venkata | afef820 | 2017-04-21 13:49:56 -0700 | [diff] [blame] | 28 | /** |
| 29 | * dsi_ctrl_hw_22_phy_reset_config() - to configure clamp control during ulps |
| 30 | * @ctrl: Pointer to the controller host hardware. |
| 31 | * @enable: boolean to specify enable/disable. |
| 32 | */ |
| 33 | void dsi_ctrl_hw_22_phy_reset_config(struct dsi_ctrl_hw *ctrl, |
| 34 | bool enable) |
| 35 | { |
| 36 | u32 reg = 0; |
| 37 | |
| 38 | reg = DSI_DISP_CC_R32(ctrl, DISP_CC_CLAMP_REG_OFF); |
| 39 | |
| 40 | /* Mask/unmask disable PHY reset bit */ |
| 41 | if (enable) |
| 42 | reg &= ~BIT(ctrl->index); |
| 43 | else |
| 44 | reg |= BIT(ctrl->index); |
| 45 | DSI_DISP_CC_W32(ctrl, DISP_CC_CLAMP_REG_OFF, reg); |
| 46 | } |
Sandeep Panda | a2a3c8c | 2017-07-09 02:10:44 +0530 | [diff] [blame] | 47 | |
| 48 | /** |
| 49 | * dsi_ctrl_hw_22_schedule_dma_cmd() - to schedule DMA command transfer |
| 50 | * @ctrl: Pointer to the controller host hardware. |
| 51 | * @line_no: Line number at which command needs to be sent. |
| 52 | */ |
| 53 | void dsi_ctrl_hw_22_schedule_dma_cmd(struct dsi_ctrl_hw *ctrl, int line_no) |
| 54 | { |
| 55 | u32 reg = 0; |
| 56 | |
| 57 | reg = DSI_R32(ctrl, DSI_DMA_SCHEDULE_CTRL); |
| 58 | reg |= BIT(28); |
| 59 | reg |= (line_no & 0xffff); |
| 60 | |
| 61 | DSI_W32(ctrl, DSI_DMA_SCHEDULE_CTRL, reg); |
| 62 | } |
Shashank Babu Chinta Venkata | 7d60873 | 2017-05-31 14:10:26 -0700 | [diff] [blame] | 63 | |
| 64 | /* |
| 65 | * dsi_ctrl_hw_22_get_cont_splash_status() - to verify whether continuous |
| 66 | * splash is enabled or not |
| 67 | * @ctrl: Pointer to the controller host hardware. |
| 68 | * |
| 69 | * Return: Return Continuous splash status |
| 70 | */ |
| 71 | bool dsi_ctrl_hw_22_get_cont_splash_status(struct dsi_ctrl_hw *ctrl) |
| 72 | { |
| 73 | u32 reg = 0; |
| 74 | |
| 75 | /** |
| 76 | * DSI scratch register 1 is used to notify whether continuous |
| 77 | * splash is enabled or not by bootloader |
| 78 | */ |
| 79 | reg = DSI_R32(ctrl, DSI_SCRATCH_REGISTER_1); |
| 80 | return reg == 0x1 ? true : false; |
| 81 | } |