From patchwork Wed May 30 14:49:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajesh Yadav X-Patchwork-Id: 10439173 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0B64060327 for ; Wed, 30 May 2018 14:51:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D12B929198 for ; Wed, 30 May 2018 14:51:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB5AC29115; Wed, 30 May 2018 14:51:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A11962917A for ; Wed, 30 May 2018 14:51:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753572AbeE3Ou6 (ORCPT ); Wed, 30 May 2018 10:50:58 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:57726 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753256AbeE3Ouv (ORCPT ); Wed, 30 May 2018 10:50:51 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 180B860646; Wed, 30 May 2018 14:50:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527691851; bh=TySfZcNl1sVStFYzV7ZaMLDBPHFa+8zfRNLML1X8Txg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S7zEFAyckPLfvQv6VUss2T5TPtj7w+S0EMpWkeKqNwG2i7CdKaHd0ackCKUfgGJoZ ROx1hOCavFmi0V/hfENfeinqCt1Cpw6yrPocOHMbBQ4shbk+2AnMMVBndbdknG1BiE Sq7bfElp5st5ehs3uBMriUF/Ybae3q3JspTVAXQA= Received: from ryadav-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ryadav@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 7447E6075A; Wed, 30 May 2018 14:50:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527691848; bh=TySfZcNl1sVStFYzV7ZaMLDBPHFa+8zfRNLML1X8Txg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GRigc8jO26h6+QyR3TkHLquhjAHtRcPzD5YZ+UZtCPoq+fuI6WKvI92t0k+xCopC0 u9t6NaHVzVOAtp0yifZU2Uc9PxFSZ1Y5e9QqUzqcQYrkyBJughUhviENhdDWwDUbUs 0E5An0RlaFN5Xj8Vg+4AtDx/uW4DjSaFvD/XWsjk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 7447E6075A Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ryadav@codeaurora.org From: Rajesh Yadav To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: Jordan Crouse , robdclark@gmail.com, seanpaul@chromium.org, hoegsberg@chromium.org, Rajesh Yadav Subject: [DPU PATCH 09/11] drm/msm/dpu: Remove unused code and move the header Date: Wed, 30 May 2018 20:19:46 +0530 Message-Id: <1527691788-9350-10-git-send-email-ryadav@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1527691788-9350-1-git-send-email-ryadav@codeaurora.org> References: <1527691788-9350-1-git-send-email-ryadav@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jordan Crouse Remove unused code from dpu_io_util.c. The functions are only used inside of the msm driver so remove the EXPORT_SYMBOL tags and move the header dpu_io_util.h from include/linux. Signed-off-by: Jordan Crouse [ryadav@codeaurora.org: rebased and removed some extra unused code] Signed-off-by: Rajesh Yadav --- drivers/gpu/drm/msm/dpu_io_util.c | 380 +------------------------------------- drivers/gpu/drm/msm/dpu_io_util.h | 61 ++++++ drivers/gpu/drm/msm/msm_drv.h | 1 - include/linux/dpu_io_util.h | 115 ------------ 4 files changed, 66 insertions(+), 491 deletions(-) create mode 100644 drivers/gpu/drm/msm/dpu_io_util.h delete mode 100644 include/linux/dpu_io_util.h diff --git a/drivers/gpu/drm/msm/dpu_io_util.c b/drivers/gpu/drm/msm/dpu_io_util.c index ecc297c..f7caec3 100644 --- a/drivers/gpu/drm/msm/dpu_io_util.c +++ b/drivers/gpu/drm/msm/dpu_io_util.c @@ -13,318 +13,9 @@ #include #include -#include -#include #include -#include -#define MAX_I2C_CMDS 16 -void dss_reg_w(struct dss_io_data *io, u32 offset, u32 value, u32 debug) -{ - u32 in_val; - - if (!io || !io->base) { - DEV_ERR("%pS->%s: invalid input\n", - __builtin_return_address(0), __func__); - return; - } - - if (offset > io->len) { - DEV_ERR("%pS->%s: offset out of range\n", - __builtin_return_address(0), __func__); - return; - } - - writel_relaxed(value, io->base + offset); - if (debug) { - in_val = readl_relaxed(io->base + offset); - DEV_DBG("[%08x] => %08x [%08x]\n", - (u32)(unsigned long)(io->base + offset), - value, in_val); - } -} /* dss_reg_w */ -EXPORT_SYMBOL(dss_reg_w); - -u32 dss_reg_r(struct dss_io_data *io, u32 offset, u32 debug) -{ - u32 value; - - if (!io || !io->base) { - DEV_ERR("%pS->%s: invalid input\n", - __builtin_return_address(0), __func__); - return -EINVAL; - } - - if (offset > io->len) { - DEV_ERR("%pS->%s: offset out of range\n", - __builtin_return_address(0), __func__); - return -EINVAL; - } - - value = readl_relaxed(io->base + offset); - if (debug) - DEV_DBG("[%08x] <= %08x\n", - (u32)(unsigned long)(io->base + offset), value); - - return value; -} /* dss_reg_r */ -EXPORT_SYMBOL(dss_reg_r); - -void dss_reg_dump(void __iomem *base, u32 length, const char *prefix, - u32 debug) -{ - if (debug) - print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_OFFSET, 32, 4, - (void *)base, length, false); -} /* dss_reg_dump */ -EXPORT_SYMBOL(dss_reg_dump); - -static struct resource *msm_dss_get_res_byname(struct platform_device *pdev, - unsigned int type, const char *name) -{ - struct resource *res = NULL; - - res = platform_get_resource_byname(pdev, type, name); - if (!res) - DEV_ERR("%s: '%s' resource not found\n", __func__, name); - - return res; -} /* msm_dss_get_res_byname */ -EXPORT_SYMBOL(msm_dss_get_res_byname); - -int msm_dss_ioremap_byname(struct platform_device *pdev, - struct dss_io_data *io_data, const char *name) -{ - struct resource *res = NULL; - - if (!pdev || !io_data) { - DEV_ERR("%pS->%s: invalid input\n", - __builtin_return_address(0), __func__); - return -EINVAL; - } - - res = msm_dss_get_res_byname(pdev, IORESOURCE_MEM, name); - if (!res) { - DEV_ERR("%pS->%s: '%s' msm_dss_get_res_byname failed\n", - __builtin_return_address(0), __func__, name); - return -ENODEV; - } - - io_data->len = (u32)resource_size(res); - io_data->base = ioremap(res->start, io_data->len); - if (!io_data->base) { - DEV_ERR("%pS->%s: '%s' ioremap failed\n", - __builtin_return_address(0), __func__, name); - return -EIO; - } - - return 0; -} /* msm_dss_ioremap_byname */ -EXPORT_SYMBOL(msm_dss_ioremap_byname); - -void msm_dss_iounmap(struct dss_io_data *io_data) -{ - if (!io_data) { - DEV_ERR("%pS->%s: invalid input\n", - __builtin_return_address(0), __func__); - return; - } - - if (io_data->base) { - iounmap(io_data->base); - io_data->base = NULL; - } - io_data->len = 0; -} /* msm_dss_iounmap */ -EXPORT_SYMBOL(msm_dss_iounmap); - -int msm_dss_config_vreg(struct device *dev, struct dss_vreg *in_vreg, - int num_vreg, int config) -{ - int i = 0, rc = 0; - struct dss_vreg *curr_vreg = NULL; - enum dss_vreg_type type; - - if (!in_vreg || !num_vreg) - return rc; - - if (config) { - for (i = 0; i < num_vreg; i++) { - curr_vreg = &in_vreg[i]; - curr_vreg->vreg = regulator_get(dev, - curr_vreg->vreg_name); - rc = PTR_RET(curr_vreg->vreg); - if (rc) { - DEV_ERR("%pS->%s: %s get failed. rc=%d\n", - __builtin_return_address(0), __func__, - curr_vreg->vreg_name, rc); - curr_vreg->vreg = NULL; - goto vreg_get_fail; - } - type = (regulator_count_voltages(curr_vreg->vreg) > 0) - ? DSS_REG_LDO : DSS_REG_VS; - if (type == DSS_REG_LDO) { - rc = regulator_set_voltage( - curr_vreg->vreg, - curr_vreg->min_voltage, - curr_vreg->max_voltage); - if (rc < 0) { - DEV_ERR("%pS->%s: %s set vltg fail\n", - __builtin_return_address(0), - __func__, - curr_vreg->vreg_name); - goto vreg_set_voltage_fail; - } - } - } - } else { - for (i = num_vreg-1; i >= 0; i--) { - curr_vreg = &in_vreg[i]; - if (curr_vreg->vreg) { - type = (regulator_count_voltages( - curr_vreg->vreg) > 0) - ? DSS_REG_LDO : DSS_REG_VS; - if (type == DSS_REG_LDO) { - regulator_set_voltage(curr_vreg->vreg, - 0, curr_vreg->max_voltage); - } - regulator_put(curr_vreg->vreg); - curr_vreg->vreg = NULL; - } - } - } - return 0; - -vreg_unconfig: -if (type == DSS_REG_LDO) - regulator_set_load(curr_vreg->vreg, 0); - -vreg_set_voltage_fail: - regulator_put(curr_vreg->vreg); - curr_vreg->vreg = NULL; - -vreg_get_fail: - for (i--; i >= 0; i--) { - curr_vreg = &in_vreg[i]; - type = (regulator_count_voltages(curr_vreg->vreg) > 0) - ? DSS_REG_LDO : DSS_REG_VS; - goto vreg_unconfig; - } - return rc; -} /* msm_dss_config_vreg */ -EXPORT_SYMBOL(msm_dss_config_vreg); - -int msm_dss_enable_vreg(struct dss_vreg *in_vreg, int num_vreg, int enable) -{ - int i = 0, rc = 0; - bool need_sleep; - - if (enable) { - for (i = 0; i < num_vreg; i++) { - rc = PTR_RET(in_vreg[i].vreg); - if (rc) { - DEV_ERR("%pS->%s: %s regulator error. rc=%d\n", - __builtin_return_address(0), __func__, - in_vreg[i].vreg_name, rc); - goto vreg_set_opt_mode_fail; - } - need_sleep = !regulator_is_enabled(in_vreg[i].vreg); - if (in_vreg[i].pre_on_sleep && need_sleep) - usleep_range(in_vreg[i].pre_on_sleep * 1000, - in_vreg[i].pre_on_sleep * 1000); - rc = regulator_set_load(in_vreg[i].vreg, - in_vreg[i].enable_load); - if (rc < 0) { - DEV_ERR("%pS->%s: %s set opt m fail\n", - __builtin_return_address(0), __func__, - in_vreg[i].vreg_name); - goto vreg_set_opt_mode_fail; - } - rc = regulator_enable(in_vreg[i].vreg); - if (in_vreg[i].post_on_sleep && need_sleep) - usleep_range(in_vreg[i].post_on_sleep * 1000, - in_vreg[i].post_on_sleep * 1000); - if (rc < 0) { - DEV_ERR("%pS->%s: %s enable failed\n", - __builtin_return_address(0), __func__, - in_vreg[i].vreg_name); - goto disable_vreg; - } - } - } else { - for (i = num_vreg-1; i >= 0; i--) { - if (in_vreg[i].pre_off_sleep) - usleep_range(in_vreg[i].pre_off_sleep * 1000, - in_vreg[i].pre_off_sleep * 1000); - regulator_set_load(in_vreg[i].vreg, - in_vreg[i].disable_load); - regulator_disable(in_vreg[i].vreg); - if (in_vreg[i].post_off_sleep) - usleep_range(in_vreg[i].post_off_sleep * 1000, - in_vreg[i].post_off_sleep * 1000); - } - } - return rc; - -disable_vreg: - regulator_set_load(in_vreg[i].vreg, in_vreg[i].disable_load); - -vreg_set_opt_mode_fail: - for (i--; i >= 0; i--) { - if (in_vreg[i].pre_off_sleep) - usleep_range(in_vreg[i].pre_off_sleep * 1000, - in_vreg[i].pre_off_sleep * 1000); - regulator_set_load(in_vreg[i].vreg, - in_vreg[i].disable_load); - regulator_disable(in_vreg[i].vreg); - if (in_vreg[i].post_off_sleep) - usleep_range(in_vreg[i].post_off_sleep * 1000, - in_vreg[i].post_off_sleep * 1000); - } - - return rc; -} /* msm_dss_enable_vreg */ -EXPORT_SYMBOL(msm_dss_enable_vreg); - -int msm_dss_enable_gpio(struct dss_gpio *in_gpio, int num_gpio, int enable) -{ - int i = 0, rc = 0; - - if (enable) { - for (i = 0; i < num_gpio; i++) { - DEV_DBG("%pS->%s: %s enable\n", - __builtin_return_address(0), __func__, - in_gpio[i].gpio_name); - - rc = gpio_request(in_gpio[i].gpio, - in_gpio[i].gpio_name); - if (rc < 0) { - DEV_ERR("%pS->%s: %s enable failed\n", - __builtin_return_address(0), __func__, - in_gpio[i].gpio_name); - goto disable_gpio; - } - gpio_set_value(in_gpio[i].gpio, in_gpio[i].value); - } - } else { - for (i = num_gpio-1; i >= 0; i--) { - DEV_DBG("%pS->%s: %s disable\n", - __builtin_return_address(0), __func__, - in_gpio[i].gpio_name); - if (in_gpio[i].gpio) - gpio_free(in_gpio[i].gpio); - } - } - return rc; - -disable_gpio: - for (i--; i >= 0; i--) - if (in_gpio[i].gpio) - gpio_free(in_gpio[i].gpio); - - return rc; -} /* msm_dss_enable_gpio */ -EXPORT_SYMBOL(msm_dss_enable_gpio); +#include "dpu_io_util.h" void msm_dss_put_clk(struct dss_clk *clk_arry, int num_clk) { @@ -335,8 +26,7 @@ void msm_dss_put_clk(struct dss_clk *clk_arry, int num_clk) clk_put(clk_arry[i].clk); clk_arry[i].clk = NULL; } -} /* msm_dss_put_clk */ -EXPORT_SYMBOL(msm_dss_put_clk); +} int msm_dss_get_clk(struct device *dev, struct dss_clk *clk_arry, int num_clk) { @@ -363,8 +53,7 @@ int msm_dss_get_clk(struct device *dev, struct dss_clk *clk_arry, int num_clk) } return rc; -} /* msm_dss_get_clk */ -EXPORT_SYMBOL(msm_dss_get_clk); +} int msm_dss_clk_set_rate(struct dss_clk *clk_arry, int num_clk) { @@ -397,8 +86,7 @@ int msm_dss_clk_set_rate(struct dss_clk *clk_arry, int num_clk) } return rc; -} /* msm_dss_clk_set_rate */ -EXPORT_SYMBOL(msm_dss_clk_set_rate); +} int msm_dss_enable_clk(struct dss_clk *clk_arry, int num_clk, int enable) { @@ -445,8 +133,7 @@ int msm_dss_enable_clk(struct dss_clk *clk_arry, int num_clk, int enable) } return rc; -} /* msm_dss_enable_clk */ -EXPORT_SYMBOL(msm_dss_enable_clk); +} int msm_dss_parse_clock(struct platform_device *pdev, struct dss_module_power *mp) @@ -497,60 +184,3 @@ int msm_dss_parse_clock(struct platform_device *pdev, return rc; } - -int dpu_i2c_byte_read(struct i2c_client *client, uint8_t slave_addr, - uint8_t reg_offset, uint8_t *read_buf) -{ - struct i2c_msg msgs[2]; - int ret = -1; - - pr_debug("%s: reading from slave_addr=[%x] and offset=[%x]\n", - __func__, slave_addr, reg_offset); - - msgs[0].addr = slave_addr >> 1; - msgs[0].flags = 0; - msgs[0].buf = ®_offset; - msgs[0].len = 1; - - msgs[1].addr = slave_addr >> 1; - msgs[1].flags = I2C_M_RD; - msgs[1].buf = read_buf; - msgs[1].len = 1; - - ret = i2c_transfer(client->adapter, msgs, 2); - if (ret < 1) { - pr_err("%s: I2C READ FAILED=[%d]\n", __func__, ret); - return -EACCES; - } - pr_debug("%s: i2c buf is [%x]\n", __func__, *read_buf); - return 0; -} -EXPORT_SYMBOL(dpu_i2c_byte_read); - -int dpu_i2c_byte_write(struct i2c_client *client, uint8_t slave_addr, - uint8_t reg_offset, uint8_t *value) -{ - struct i2c_msg msgs[1]; - uint8_t data[2]; - int status = -EACCES; - - pr_debug("%s: writing from slave_addr=[%x] and offset=[%x]\n", - __func__, slave_addr, reg_offset); - - data[0] = reg_offset; - data[1] = *value; - - msgs[0].addr = slave_addr >> 1; - msgs[0].flags = 0; - msgs[0].len = 2; - msgs[0].buf = data; - - status = i2c_transfer(client->adapter, msgs, 1); - if (status < 1) { - pr_err("I2C WRITE FAILED=[%d]\n", status); - return -EACCES; - } - pr_debug("%s: I2C write status=%x\n", __func__, status); - return status; -} -EXPORT_SYMBOL(dpu_i2c_byte_write); diff --git a/drivers/gpu/drm/msm/dpu_io_util.h b/drivers/gpu/drm/msm/dpu_io_util.h new file mode 100644 index 0000000..773b52e --- /dev/null +++ b/drivers/gpu/drm/msm/dpu_io_util.h @@ -0,0 +1,61 @@ +/* Copyright (c) 2012, 2017-2018, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __DPU_IO_UTIL_H__ +#define __DPU_IO_UTIL_H__ + +#include +#include +#include + +#ifdef DEBUG +#define DEV_DBG(fmt, args...) pr_err(fmt, ##args) +#else +#define DEV_DBG(fmt, args...) pr_debug(fmt, ##args) +#endif +#define DEV_INFO(fmt, args...) pr_info(fmt, ##args) +#define DEV_WARN(fmt, args...) pr_warn(fmt, ##args) +#define DEV_ERR(fmt, args...) pr_err(fmt, ##args) + +struct dss_gpio { + unsigned int gpio; + unsigned int value; + char gpio_name[32]; +}; + +enum dss_clk_type { + DSS_CLK_AHB, /* no set rate. rate controlled through rpm */ + DSS_CLK_PCLK, +}; + +struct dss_clk { + struct clk *clk; /* clk handle */ + char clk_name[32]; + enum dss_clk_type type; + unsigned long rate; + unsigned long max_rate; +}; + +struct dss_module_power { + unsigned int num_gpio; + struct dss_gpio *gpio_config; + unsigned int num_clk; + struct dss_clk *clk_config; +}; + +int msm_dss_get_clk(struct device *dev, struct dss_clk *clk_arry, int num_clk); +void msm_dss_put_clk(struct dss_clk *clk_arry, int num_clk); +int msm_dss_clk_set_rate(struct dss_clk *clk_arry, int num_clk); +int msm_dss_enable_clk(struct dss_clk *clk_arry, int num_clk, int enable); +int msm_dss_parse_clock(struct platform_device *pdev, + struct dss_module_power *mp); +#endif /* __DPU_IO_UTIL_H__ */ diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index d5937ba..811f7d4 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -33,7 +33,6 @@ #include #include #include -#include #include #include diff --git a/include/linux/dpu_io_util.h b/include/linux/dpu_io_util.h deleted file mode 100644 index 45e606f..0000000 --- a/include/linux/dpu_io_util.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (c) 2012, 2017-2018, The Linux Foundation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef __DPU_IO_UTIL_H__ -#define __DPU_IO_UTIL_H__ - -#include -#include -#include -#include -#include - -#ifdef DEBUG -#define DEV_DBG(fmt, args...) pr_err(fmt, ##args) -#else -#define DEV_DBG(fmt, args...) pr_debug(fmt, ##args) -#endif -#define DEV_INFO(fmt, args...) pr_info(fmt, ##args) -#define DEV_WARN(fmt, args...) pr_warn(fmt, ##args) -#define DEV_ERR(fmt, args...) pr_err(fmt, ##args) - -struct dss_io_data { - u32 len; - void __iomem *base; -}; - -void dss_reg_w(struct dss_io_data *io, u32 offset, u32 value, u32 debug); -u32 dss_reg_r(struct dss_io_data *io, u32 offset, u32 debug); -void dss_reg_dump(void __iomem *base, u32 len, const char *prefix, u32 debug); - -#define DSS_REG_W_ND(io, offset, val) dss_reg_w(io, offset, val, false) -#define DSS_REG_W(io, offset, val) dss_reg_w(io, offset, val, true) -#define DSS_REG_R_ND(io, offset) dss_reg_r(io, offset, false) -#define DSS_REG_R(io, offset) dss_reg_r(io, offset, true) - -enum dss_vreg_type { - DSS_REG_LDO, - DSS_REG_VS, -}; - -struct dss_vreg { - struct regulator *vreg; /* vreg handle */ - char vreg_name[32]; - int min_voltage; - int max_voltage; - int enable_load; - int disable_load; - int pre_on_sleep; - int post_on_sleep; - int pre_off_sleep; - int post_off_sleep; -}; - -struct dss_gpio { - unsigned int gpio; - unsigned int value; - char gpio_name[32]; -}; - -enum dss_clk_type { - DSS_CLK_AHB, /* no set rate. rate controlled through rpm */ - DSS_CLK_PCLK, - DSS_CLK_OTHER, -}; - -struct dss_clk { - struct clk *clk; /* clk handle */ - char clk_name[32]; - enum dss_clk_type type; - unsigned long rate; - unsigned long max_rate; -}; - -struct dss_module_power { - unsigned int num_vreg; - struct dss_vreg *vreg_config; - unsigned int num_gpio; - struct dss_gpio *gpio_config; - unsigned int num_clk; - struct dss_clk *clk_config; -}; - -int msm_dss_ioremap_byname(struct platform_device *pdev, - struct dss_io_data *io_data, const char *name); -void msm_dss_iounmap(struct dss_io_data *io_data); - -int msm_dss_enable_gpio(struct dss_gpio *in_gpio, int num_gpio, int enable); -int msm_dss_gpio_enable(struct dss_gpio *in_gpio, int num_gpio, int enable); - -int msm_dss_config_vreg(struct device *dev, struct dss_vreg *in_vreg, - int num_vreg, int config); -int msm_dss_enable_vreg(struct dss_vreg *in_vreg, int num_vreg, int enable); - -int msm_dss_get_clk(struct device *dev, struct dss_clk *clk_arry, int num_clk); -void msm_dss_put_clk(struct dss_clk *clk_arry, int num_clk); -int msm_dss_clk_set_rate(struct dss_clk *clk_arry, int num_clk); -int msm_dss_enable_clk(struct dss_clk *clk_arry, int num_clk, int enable); -int msm_dss_parse_clock(struct platform_device *pdev, - struct dss_module_power *mp); - -int dpu_i2c_byte_read(struct i2c_client *client, uint8_t slave_addr, - uint8_t reg_offset, uint8_t *read_buf); -int dpu_i2c_byte_write(struct i2c_client *client, uint8_t slave_addr, - uint8_t reg_offset, uint8_t *value); - -#endif /* __DPU_IO_UTIL_H__ */