[PATCH v3] drm/sun4i: hdmi: Implement I2C adapter for A10s DDC bus

2017-06-14 Thread Jonathan Liu
The documentation for drm_do_get_edid in drivers/gpu/drm/drm_edid.c states: "As in the general case the DDC bus is accessible by the kernel at the I2C level, drivers must make all reasonable efforts to expose it as an I2C adapter and use drm_get_edid() instead of abusing this function." Exposing t

Re: [PATCH v3] drm/sun4i: hdmi: Implement I2C adapter for A10s DDC bus

2017-06-21 Thread Maxime Ripard
On Thu, Jun 15, 2017 at 01:29:33AM +1000, Jonathan Liu wrote: > The documentation for drm_do_get_edid in drivers/gpu/drm/drm_edid.c states: > "As in the general case the DDC bus is accessible by the kernel at the I2C > level, drivers must make all reasonable efforts to expose it as an I2C > adapter

Re: [PATCH v3] drm/sun4i: hdmi: Implement I2C adapter for A10s DDC bus

2017-06-21 Thread Maxime Ripard
On Wed, Jun 21, 2017 at 07:42:47PM +1000, Jonathan Liu wrote: > >> +static int wait_fifo_flag_unset(struct sun4i_hdmi *hdmi, u32 flag) > >> +{ > >> + /* 1 byte takes 9 clock cycles (8 bits + 1 ack) */ > >> + unsigned long byte_time = DIV_ROUND_UP(USEC_PER_SEC, > >> +

Re: [PATCH v3] drm/sun4i: hdmi: Implement I2C adapter for A10s DDC bus

2017-06-21 Thread Jonathan Liu
Hi Maxime, On 21 June 2017 at 18:51, Maxime Ripard wrote: > On Thu, Jun 15, 2017 at 01:29:33AM +1000, Jonathan Liu wrote: >> The documentation for drm_do_get_edid in drivers/gpu/drm/drm_edid.c states: >> "As in the general case the DDC bus is accessible by the kernel at the I2C >> level, drivers

Re: [PATCH v3] drm/sun4i: hdmi: Implement I2C adapter for A10s DDC bus

2017-06-25 Thread Jonathan Liu
Hi Maxime, On 22 June 2017 at 07:26, Maxime Ripard wrote: > On Wed, Jun 21, 2017 at 07:42:47PM +1000, Jonathan Liu wrote: >> >> +static int wait_fifo_flag_unset(struct sun4i_hdmi *hdmi, u32 flag) >> >> +{ >> >> + /* 1 byte takes 9 clock cycles (8 bits + 1 ack) */ >> >> + unsigned long byt