Re: [PATCHv3 3/3] drm: bridge: anx78xx: Add anx78xx driver support by analogix.
On Thu, Sep 10, 2015 at 06:35:52PM +0200, Enric Balletbo i Serra wrote: > diff --git a/drivers/gpu/drm/bridge/anx78xx/anx78xx.h > b/drivers/gpu/drm/bridge/anx78xx/anx78xx.h > new file mode 100644 > index 000..4f6dd1d > --- /dev/null > +++ b/drivers/gpu/drm/bridge/anx78xx/anx78xx.h > @@ -0,0 +1,44 @@ > +/* > + * Copyright(c) 2015, Analogix Semiconductor. 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 __ANX78xx_H > +#define __ANX78xx_H > + > +#include > +#include > +#include > +#include > +#include > + > +#define AUX_ERR 1 > +#define AUX_OK 0 Get rid of these. They aren't used much and we could easily use normal error codes instead. > + > +struct anx78xx_platform_data { > + struct gpio_desc *gpiod_pd; > + struct gpio_desc *gpiod_reset; > + spinlock_t lock; > +}; > + > +struct anx78xx { > + struct i2c_client *client; > + struct anx78xx_platform_data *pdata; > + struct delayed_work work; > + struct workqueue_struct *workqueue; > + struct mutex lock; > +}; > + > +void anx78xx_poweron(struct anx78xx *data); > +void anx78xx_poweroff(struct anx78xx *data); > + > +#endif > diff --git a/drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c > b/drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c > new file mode 100644 > index 000..b92d2bc > --- /dev/null > +++ b/drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c > @@ -0,0 +1,241 @@ > +/* > + * Copyright(c) 2015, Analogix Semiconductor. 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. > + * > + */ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "anx78xx.h" > +#include "slimport_tx_drv.h" > + > +void anx78xx_poweron(struct anx78xx *anx78xx) > +{ > + struct device *dev = >client->dev; > + struct anx78xx_platform_data *pdata = anx78xx->pdata; > + > + gpiod_set_value_cansleep(pdata->gpiod_reset, 0); > + usleep_range(1000, 2000); > + > + gpiod_set_value_cansleep(pdata->gpiod_pd, 0); > + usleep_range(1000, 2000); > + > + gpiod_set_value_cansleep(pdata->gpiod_reset, 1); > + > + dev_dbg(dev, "power on\n"); Remove these debug printks. Use ftrace instead. > +} > + > +void anx78xx_poweroff(struct anx78xx *anx78xx) > +{ > + struct device *dev = >client->dev; > + struct anx78xx_platform_data *pdata = anx78xx->pdata; > + > + gpiod_set_value_cansleep(pdata->gpiod_reset, 0); > + usleep_range(1000, 2000); > + > + gpiod_set_value_cansleep(pdata->gpiod_pd, 1); > + usleep_range(1000, 2000); > + > + dev_dbg(dev, "power down\n"); Delete. > +} > + > +static int anx78xx_init_gpio(struct anx78xx *anx78xx) > +{ > + struct device *dev = >client->dev; > + struct anx78xx_platform_data *pdata = anx78xx->pdata; > + int ret; > + > + /* gpio for chip power down */ > + pdata->gpiod_pd = devm_gpiod_get(dev, "pd", GPIOD_OUT_HIGH); > + if (IS_ERR(pdata->gpiod_pd)) { > + dev_err(dev, "unable to claim pd gpio\n"); > + ret = PTR_ERR(pdata->gpiod_pd); > + return ret; The ret variable isn't necessary in this function. > + } > + > + /* gpio for chip reset */ > + pdata->gpiod_reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); > + if (IS_ERR(pdata->gpiod_reset)) { > + dev_err(dev, "unable to claim reset gpio\n"); > + ret = PTR_ERR(pdata->gpiod_reset); > + return ret; > + } > + > + return 0; > +} > + > +static int anx78xx_system_init(struct anx78xx *anx78xx) > +{ > + struct device *dev = >client->dev; > + int ret; > + > + ret = sp_chip_detect(anx78xx); Make sp_chip_detect() use normal error codes. > + if (ret == 0) { > + anx78xx_poweroff(anx78xx); > + dev_err(dev, "failed to detect anx78xx\n"); > + return -ENODEV; > + } > + > + sp_tx_variable_init(); > + return 0; > +} > + > +static void anx78xx_work_func(struct work_struct *work) > +{ > + struct anx78xx *anx78xx = container_of(work, struct anx78xx, >
Re: [PATCHv3 3/3] drm: bridge: anx78xx: Add anx78xx driver support by analogix.
Hi Enric, Partial review for now, thanks for you work. Best, On Thu, Sep 10, 2015 at 06:35:52PM +0200, Enric Balletbo i Serra wrote: > At the moment it only supports ANX7814. > > The ANX7814 is an ultra-low power Full-HD (1080p60) SlimPort transmitter > designed for portable devices. > > This driver adds initial support and supports HDMI to DP pass-through mode. > > Signed-off-by: Enric Balletbo i Serra> --- Please include a revision log here, stating what you changed between each version. > drivers/gpu/drm/bridge/Kconfig |2 + > drivers/gpu/drm/bridge/Makefile |1 + > drivers/gpu/drm/bridge/anx78xx/Kconfig |7 + > drivers/gpu/drm/bridge/anx78xx/Makefile |4 + > drivers/gpu/drm/bridge/anx78xx/anx78xx.h | 44 + > drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c| 241 ++ > drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.c | 3198 > ++ > drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.h | 215 ++ > drivers/gpu/drm/bridge/anx78xx/slimport_tx_reg.h | 786 ++ > 9 files changed, 4498 insertions(+) > create mode 100644 drivers/gpu/drm/bridge/anx78xx/Kconfig > create mode 100644 drivers/gpu/drm/bridge/anx78xx/Makefile > create mode 100644 drivers/gpu/drm/bridge/anx78xx/anx78xx.h > create mode 100644 drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c > create mode 100644 drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.c > create mode 100644 drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.h > create mode 100644 drivers/gpu/drm/bridge/anx78xx/slimport_tx_reg.h > > diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig > index 2de52a5..aa6fe12 100644 > --- a/drivers/gpu/drm/bridge/Kconfig > +++ b/drivers/gpu/drm/bridge/Kconfig > @@ -29,4 +29,6 @@ config DRM_PARADE_PS8622 > ---help--- > Parade eDP-LVDS bridge chip driver. > > +source "drivers/gpu/drm/bridge/anx78xx/Kconfig" > + > endmenu > diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile > index e2eef1c..e5bd38b 100644 > --- a/drivers/gpu/drm/bridge/Makefile > +++ b/drivers/gpu/drm/bridge/Makefile > @@ -3,3 +3,4 @@ ccflags-y := -Iinclude/drm > obj-$(CONFIG_DRM_DW_HDMI) += dw_hdmi.o > obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o > obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o > +obj-$(CONFIG_DRM_ANX78XX) += anx78xx/ > diff --git a/drivers/gpu/drm/bridge/anx78xx/Kconfig > b/drivers/gpu/drm/bridge/anx78xx/Kconfig > new file mode 100644 > index 000..08f9c08 > --- /dev/null > +++ b/drivers/gpu/drm/bridge/anx78xx/Kconfig > @@ -0,0 +1,7 @@ > +config DRM_ANX78XX > + tristate "Analogix ANX78XX bridge" > + help > + ANX78XX is a HD video transmitter chip over micro-USB > + connector for smartphone device. > + > + > diff --git a/drivers/gpu/drm/bridge/anx78xx/Makefile > b/drivers/gpu/drm/bridge/anx78xx/Makefile > new file mode 100644 > index 000..a843733 > --- /dev/null > +++ b/drivers/gpu/drm/bridge/anx78xx/Makefile > @@ -0,0 +1,4 @@ > +obj-${CONFIG_DRM_ANX78XX} := anx78xx.o > + > +anx78xx-y += anx78xx_main.o > +anx78xx-y += slimport_tx_drv.o > diff --git a/drivers/gpu/drm/bridge/anx78xx/anx78xx.h > b/drivers/gpu/drm/bridge/anx78xx/anx78xx.h > new file mode 100644 > index 000..4f6dd1d > --- /dev/null > +++ b/drivers/gpu/drm/bridge/anx78xx/anx78xx.h > @@ -0,0 +1,44 @@ > +/* > + * Copyright(c) 2015, Analogix Semiconductor. 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 __ANX78xx_H > +#define __ANX78xx_H > + > +#include > +#include > +#include > +#include > +#include > + > +#define AUX_ERR 1 > +#define AUX_OK 0 > + > +struct anx78xx_platform_data { > + struct gpio_desc *gpiod_pd; > + struct gpio_desc *gpiod_reset; > + spinlock_t lock; > +}; > + > +struct anx78xx { > + struct i2c_client *client; > + struct anx78xx_platform_data *pdata; > + struct delayed_work work; > + struct workqueue_struct *workqueue; > + struct mutex lock; > +}; > + > +void anx78xx_poweron(struct anx78xx *data); > +void anx78xx_poweroff(struct anx78xx *data); > + > +#endif > diff --git a/drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c > b/drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c > new file mode 100644 > index 000..b92d2bc > --- /dev/null > +++ b/drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c > @@ -0,0 +1,241 @@ > +/* > + * Copyright(c) 2015, Analogix Semiconductor. All rights reserved. > + * > + * This program is free
[PATCHv3 3/3] drm: bridge: anx78xx: Add anx78xx driver support by analogix.
At the moment it only supports ANX7814. The ANX7814 is an ultra-low power Full-HD (1080p60) SlimPort transmitter designed for portable devices. This driver adds initial support and supports HDMI to DP pass-through mode. Signed-off-by: Enric Balletbo i Serra--- drivers/gpu/drm/bridge/Kconfig |2 + drivers/gpu/drm/bridge/Makefile |1 + drivers/gpu/drm/bridge/anx78xx/Kconfig |7 + drivers/gpu/drm/bridge/anx78xx/Makefile |4 + drivers/gpu/drm/bridge/anx78xx/anx78xx.h | 44 + drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c| 241 ++ drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.c | 3198 ++ drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.h | 215 ++ drivers/gpu/drm/bridge/anx78xx/slimport_tx_reg.h | 786 ++ 9 files changed, 4498 insertions(+) create mode 100644 drivers/gpu/drm/bridge/anx78xx/Kconfig create mode 100644 drivers/gpu/drm/bridge/anx78xx/Makefile create mode 100644 drivers/gpu/drm/bridge/anx78xx/anx78xx.h create mode 100644 drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c create mode 100644 drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.c create mode 100644 drivers/gpu/drm/bridge/anx78xx/slimport_tx_drv.h create mode 100644 drivers/gpu/drm/bridge/anx78xx/slimport_tx_reg.h diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 2de52a5..aa6fe12 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -29,4 +29,6 @@ config DRM_PARADE_PS8622 ---help--- Parade eDP-LVDS bridge chip driver. +source "drivers/gpu/drm/bridge/anx78xx/Kconfig" + endmenu diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index e2eef1c..e5bd38b 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -3,3 +3,4 @@ ccflags-y := -Iinclude/drm obj-$(CONFIG_DRM_DW_HDMI) += dw_hdmi.o obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o +obj-$(CONFIG_DRM_ANX78XX) += anx78xx/ diff --git a/drivers/gpu/drm/bridge/anx78xx/Kconfig b/drivers/gpu/drm/bridge/anx78xx/Kconfig new file mode 100644 index 000..08f9c08 --- /dev/null +++ b/drivers/gpu/drm/bridge/anx78xx/Kconfig @@ -0,0 +1,7 @@ +config DRM_ANX78XX + tristate "Analogix ANX78XX bridge" + help + ANX78XX is a HD video transmitter chip over micro-USB + connector for smartphone device. + + diff --git a/drivers/gpu/drm/bridge/anx78xx/Makefile b/drivers/gpu/drm/bridge/anx78xx/Makefile new file mode 100644 index 000..a843733 --- /dev/null +++ b/drivers/gpu/drm/bridge/anx78xx/Makefile @@ -0,0 +1,4 @@ +obj-${CONFIG_DRM_ANX78XX} := anx78xx.o + +anx78xx-y += anx78xx_main.o +anx78xx-y += slimport_tx_drv.o diff --git a/drivers/gpu/drm/bridge/anx78xx/anx78xx.h b/drivers/gpu/drm/bridge/anx78xx/anx78xx.h new file mode 100644 index 000..4f6dd1d --- /dev/null +++ b/drivers/gpu/drm/bridge/anx78xx/anx78xx.h @@ -0,0 +1,44 @@ +/* + * Copyright(c) 2015, Analogix Semiconductor. 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 __ANX78xx_H +#define __ANX78xx_H + +#include +#include +#include +#include +#include + +#define AUX_ERR 1 +#define AUX_OK 0 + +struct anx78xx_platform_data { + struct gpio_desc *gpiod_pd; + struct gpio_desc *gpiod_reset; + spinlock_t lock; +}; + +struct anx78xx { + struct i2c_client *client; + struct anx78xx_platform_data *pdata; + struct delayed_work work; + struct workqueue_struct *workqueue; + struct mutex lock; +}; + +void anx78xx_poweron(struct anx78xx *data); +void anx78xx_poweroff(struct anx78xx *data); + +#endif diff --git a/drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c b/drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c new file mode 100644 index 000..b92d2bc --- /dev/null +++ b/drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c @@ -0,0 +1,241 @@ +/* + * Copyright(c) 2015, Analogix Semiconductor. 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. + * + */ +#include