From: Tomasz Figa <t.figa@samsung.com>
To: Rahul Sharma <rahul.sharma@samsung.com>,
dri-devel@lists.freedesktop.org,
linux-samsung-soc@vger.kernel.org
Cc: joshi@samsung.com
Subject: Re: [PATCH 4/5] drm/exynos: add support for apb mapped phys in hdmi driver
Date: Thu, 10 Apr 2014 19:17:54 +0200 [thread overview]
Message-ID: <5346D242.4090009@samsung.com> (raw)
In-Reply-To: <1396458826-3051-5-git-send-email-rahul.sharma@samsung.com>
Hi Rahul,
On 02.04.2014 19:13, Rahul Sharma wrote:
> From: Rahul Sharma <Rahul.Sharma@samsung.com>
>
> Previous SoCs have hdmi phys which are accessible through
> dedicated i2c lines. Newer SoCs have Apb mapped hdmi phys.
> Hdmi driver is modified to support apb mapped phys.
>
> Signed-off-by: Rahul Sharma <Rahul.Sharma@samsung.com>
> ---
> drivers/gpu/drm/exynos/exynos_hdmi.c | 142 +++++++++++++++++++++-------------
> drivers/gpu/drm/exynos/regs-hdmi.h | 7 ++
> 2 files changed, 96 insertions(+), 53 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index 5b2cfe7..5989770 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -33,6 +33,7 @@
> #include <linux/regulator/consumer.h>
> #include <linux/io.h>
> #include <linux/of.h>
> +#include <linux/of_address.h>
> #include <linux/i2c.h>
> #include <linux/of_gpio.h>
> #include <linux/hdmi.h>
> @@ -68,6 +69,8 @@ enum hdmi_type {
>
> struct hdmi_driver_data {
> unsigned int type;
> + const struct hdmiphy_config *phy_confs;
> + unsigned int phy_conf_count;
> unsigned int is_apb_phy:1;
> };
>
> @@ -196,9 +199,12 @@ struct hdmi_context {
> struct hdmi_resources res;
>
> int hpd_gpio;
> + void __iomem *regs_hdmiphy;
> struct regmap *pmureg;
>
> enum hdmi_type type;
> + const struct hdmiphy_config *phy_confs;
> + unsigned int phy_conf_count;
> };
>
> struct hdmiphy_config {
> @@ -206,14 +212,6 @@ struct hdmiphy_config {
> u8 conf[32];
> };
>
> -struct hdmi_driver_data exynos4212_hdmi_driver_data = {
> - .type = HDMI_TYPE14,
> -};
> -
> -struct hdmi_driver_data exynos5_hdmi_driver_data = {
> - .type = HDMI_TYPE14,
> -};
> -
> /* list of phy config settings */
> static const struct hdmiphy_config hdmiphy_v13_configs[] = {
> {
> @@ -428,6 +426,21 @@ static const struct hdmiphy_config hdmiphy_v14_configs[] = {
> },
> };
>
> +
> +struct hdmi_driver_data exynos4212_hdmi_driver_data = {
> + .type = HDMI_TYPE14,
> + .phy_confs = hdmiphy_v14_configs,
> + .phy_conf_count = ARRAY_SIZE(hdmiphy_v14_configs),
> + .is_apb_phy = 0,
> +};
> +
> +struct hdmi_driver_data exynos5_hdmi_driver_data = {
> + .type = HDMI_TYPE14,
> + .phy_confs = hdmiphy_v13_configs,
> + .phy_conf_count = ARRAY_SIZE(hdmiphy_v13_configs),
> + .is_apb_phy = 0,
> +};
> +
> static inline u32 hdmi_reg_read(struct hdmi_context *hdata, u32 reg_id)
> {
> return readl(hdata->regs + reg_id);
> @@ -447,6 +460,48 @@ static inline void hdmi_reg_writemask(struct hdmi_context *hdata,
> writel(value, hdata->regs + reg_id);
> }
>
> +static int hdmiphy_reg_writeb(struct hdmi_context *hdata,
> + u32 reg_offset, u8 value)
> +{
> + if (hdata->hdmiphy_port) {
> + u8 buffer[2];
> + int ret;
> +
> + buffer[0] = reg_offset;
> + buffer[1] = value;
> +
> + ret = i2c_master_send(hdata->hdmiphy_port, buffer, 2);
> + if (ret == 2)
> + return 0;
> + return ret;
> + } else {
> + writeb(value, hdata->regs_hdmiphy + (reg_offset<<2));
> + return 0;
> + }
> +}
> +
> +static int hdmiphy_reg_write_buf(struct hdmi_context *hdata,
> + u32 reg_offset, const u8 *buf, u32 len)
> +{
> + if ((reg_offset + len) > 32)
> + return -EINVAL;
> +
> + if (hdata->hdmiphy_port) {
> + int ret;
> +
> + ret = i2c_master_send(hdata->hdmiphy_port, buf, len);
reg_offset doesn't seem to be used in I2C code path in any way. Are you
sure this is correct?
> + if (ret == len)
> + return 0;
> + return ret;
> + } else {
> + int i;
> + for (i = 0; i < len; i++)
> + writeb(buf[i], hdata->regs_hdmiphy +
> + ((reg_offset + i)<<2));
> + return 0;
> + }
> +}
I wonder if those functions couldn't be abstracted as two callbacks in
hdmi_driver_data struct to eliminate such if clauses as above.
--
Best regards,
Tomasz
next prev parent reply other threads:[~2014-04-10 17:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-02 17:13 [PATCH 0/5] drm/exynos: enable support for exynos5420 hdmi Rahul Sharma
2014-04-02 17:13 ` [PATCH 1/5] drm/exynos: remove dummy hdmiphy clock from hdmi driver Rahul Sharma
2014-04-10 15:32 ` Tomasz Figa
2014-04-11 1:49 ` Rahul Sharma
2014-04-02 17:13 ` [PATCH 2/5] drm/exynos: use regmap interface to set hdmiphy control bit in pmu Rahul Sharma
2014-04-03 15:53 ` Inki Dae
2014-04-04 2:21 ` Rahul Sharma
2014-04-10 17:00 ` Tomasz Figa
2014-04-11 1:52 ` Rahul Sharma
2014-05-19 7:29 ` Rahul Sharma
2014-04-02 17:13 ` [PATCH 3/5] drm/exynos: remove unnecessary read for phy configuration values Rahul Sharma
2014-04-10 17:02 ` Tomasz Figa
2014-04-02 17:13 ` [PATCH 4/5] drm/exynos: add support for apb mapped phys in hdmi driver Rahul Sharma
2014-04-10 17:17 ` Tomasz Figa [this message]
2014-04-11 2:36 ` Rahul Sharma
2014-04-02 17:13 ` [PATCH 5/5] drm/exynos: enable support for exynos5420 hdmi device Rahul Sharma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5346D242.4090009@samsung.com \
--to=t.figa@samsung.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=joshi@samsung.com \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=rahul.sharma@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox