Re: [PATCH v1 2/2] drm: bridge: add support for lontium LT9611UXC bridge

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dmitry,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[also build test WARNING on next-20200828]
[cannot apply to robh/for-next drm-intel/for-linux-next tegra-drm/drm/tegra/for-next linus/master drm-exynos/exynos-drm-next drm/drm-next v5.9-rc2]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Dmitry-Baryshkov/Add-LT9611UXC-DSI-to-HDMI-bridge-support/20200828-200735
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/bridge/lontium-lt9611uxc.c: In function 'lt9611uxc_video_setup':
>> drivers/gpu/drm/bridge/lontium-lt9611uxc.c:322:49: warning: variable 'vsync_porch' set but not used [-Wunused-but-set-variable]
     322 |  u32 v_total, vactive, vsync_len, vfront_porch, vsync_porch;
         |                                                 ^~~~~~~~~~~
>> drivers/gpu/drm/bridge/lontium-lt9611uxc.c:321:49: warning: variable 'hsync_porch' set but not used [-Wunused-but-set-variable]
     321 |  u32 h_total, hactive, hsync_len, hfront_porch, hsync_porch;
         |                                                 ^~~~~~~~~~~
   drivers/gpu/drm/bridge/lontium-lt9611uxc.c: At top level:
>> drivers/gpu/drm/bridge/lontium-lt9611uxc.c:473:14: warning: no previous prototype for 'lt9611uxc_bridge_get_edid' [-Wmissing-prototypes]
     473 | struct edid *lt9611uxc_bridge_get_edid(struct drm_bridge *bridge,
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~

# https://github.com/0day-ci/linux/commit/f1b935d064fd8924137d420e75eb050c3d66c22b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Dmitry-Baryshkov/Add-LT9611UXC-DSI-to-HDMI-bridge-support/20200828-200735
git checkout f1b935d064fd8924137d420e75eb050c3d66c22b
vim +/vsync_porch +322 drivers/gpu/drm/bridge/lontium-lt9611uxc.c

   317	
   318	static void lt9611uxc_video_setup(struct lt9611uxc *lt9611uxc,
   319			const struct drm_display_mode *mode)
   320	{
 > 321		u32 h_total, hactive, hsync_len, hfront_porch, hsync_porch;
 > 322		u32 v_total, vactive, vsync_len, vfront_porch, vsync_porch;
   323	
   324		h_total = mode->htotal;
   325		v_total = mode->vtotal;
   326	
   327		hactive = mode->hdisplay;
   328		hsync_len = mode->hsync_end - mode->hsync_start;
   329		hfront_porch = mode->hsync_start - mode->hdisplay;
   330		hsync_porch = hsync_len + mode->htotal - mode->hsync_end;
   331	
   332		vactive = mode->vdisplay;
   333		vsync_len = mode->vsync_end - mode->vsync_start;
   334		vfront_porch = mode->vsync_start - mode->vdisplay;
   335		vsync_porch = vsync_len + mode->vtotal - mode->vsync_end;
   336	
   337		regmap_write(lt9611uxc->regmap, 0xd00d, (u8)(v_total / 256));
   338		regmap_write(lt9611uxc->regmap, 0xd00e, (u8)(v_total % 256));
   339	
   340		regmap_write(lt9611uxc->regmap, 0xd00f, (u8)(vactive / 256));
   341		regmap_write(lt9611uxc->regmap, 0xd010, (u8)(vactive % 256));
   342	
   343		regmap_write(lt9611uxc->regmap, 0xd011, (u8)(h_total / 256));
   344		regmap_write(lt9611uxc->regmap, 0xd012, (u8)(h_total % 256));
   345	
   346		regmap_write(lt9611uxc->regmap, 0xd013, (u8)(hactive / 256));
   347		regmap_write(lt9611uxc->regmap, 0xd014, (u8)(hactive % 256));
   348	
   349		regmap_write(lt9611uxc->regmap, 0xd015, (u8)(vsync_len % 256));
   350	
   351		regmap_update_bits(lt9611uxc->regmap, 0xd016, 0xf, (u8)(hsync_len / 256));
   352		regmap_write(lt9611uxc->regmap, 0xd017, (u8)(hsync_len % 256));
   353	
   354		regmap_update_bits(lt9611uxc->regmap, 0xd018, 0xf, (u8)(vfront_porch / 256));
   355		regmap_write(lt9611uxc->regmap, 0xd019, (u8)(vfront_porch % 256));
   356	
   357		regmap_update_bits(lt9611uxc->regmap, 0xd01a, 0xf, (u8)(hfront_porch / 256));
   358		regmap_write(lt9611uxc->regmap, 0xd01b, (u8)(hfront_porch % 256));
   359	}
   360	
   361	static void lt9611uxc_bridge_mode_set(struct drm_bridge *bridge,
   362					   const struct drm_display_mode *mode,
   363					   const struct drm_display_mode *adj_mode)
   364	{
   365		struct lt9611uxc *lt9611uxc = bridge_to_lt9611uxc(bridge);
   366	
   367		if (lt9611uxc->sleep)
   368			lt9611uxc_reset(lt9611uxc);
   369	
   370		lt9611uxc_lock(lt9611uxc);
   371		lt9611uxc_video_setup(lt9611uxc, mode);
   372		lt9611uxc_unlock(lt9611uxc);
   373	}
   374	
   375	static enum drm_connector_status lt9611uxc_bridge_detect(struct drm_bridge *bridge)
   376	{
   377		struct lt9611uxc *lt9611uxc = bridge_to_lt9611uxc(bridge);
   378		unsigned int reg_val = 0;
   379		int ret;
   380		int connected = 1;
   381	
   382		if (lt9611uxc->hpd_supported) {
   383			lt9611uxc_lock(lt9611uxc);
   384			ret = regmap_read(lt9611uxc->regmap, 0xb023, &reg_val);
   385			lt9611uxc_unlock(lt9611uxc);
   386	
   387			if (ret)
   388				dev_err(lt9611uxc->dev, "failed to read hpd status: %d\n", ret);
   389			else
   390				connected  = reg_val & BIT(1);
   391		}
   392	
   393		return connected ?  connector_status_connected :
   394					connector_status_disconnected;
   395	}
   396	
   397	static int lt9611uxc_bridge_get_modes(struct drm_bridge *bridge,
   398			struct drm_connector *connector)
   399	{
   400		struct lt9611uxc *lt9611uxc = bridge_to_lt9611uxc(bridge);
   401		struct display_timings *timings = lt9611uxc->timings;
   402		int i;
   403	
   404		for (i = 0; i < timings->num_timings; i++) {
   405			struct drm_display_mode *mode = drm_mode_create(bridge->dev);
   406			struct videomode vm;
   407	
   408			if (videomode_from_timings(timings, &vm, i))
   409				break;
   410	
   411			drm_display_mode_from_videomode(&vm, mode);
   412	
   413			mode->type = DRM_MODE_TYPE_DRIVER;
   414	
   415			if (timings->native_mode == i)
   416				mode->type |= DRM_MODE_TYPE_PREFERRED;
   417	
   418			drm_mode_set_name(mode);
   419			drm_mode_probed_add(connector, mode);
   420		}
   421	
   422		return i;
   423	}
   424	
   425	static int lt9611uxc_read_edid(struct lt9611uxc *lt9611uxc)
   426	{
   427		int ret = 0;
   428		int i;
   429	
   430		/* memset to clear old buffer, if any */
   431		memset(lt9611uxc->edid_buf, 0, sizeof(lt9611uxc->edid_buf));
   432	
   433		lt9611uxc_lock(lt9611uxc);
   434	
   435		regmap_write(lt9611uxc->regmap, 0xb00b, 0x10);
   436	
   437	#define EDID_SEG 16
   438		for (i = 0; i < 2 * EDID_BLOCK_SIZE; i += EDID_SEG) {
   439			regmap_write(lt9611uxc->regmap, 0xb00a, i);
   440			ret = regmap_noinc_read(lt9611uxc->regmap, 0xb0b0,
   441					&lt9611uxc->edid_buf[i], EDID_SEG);
   442			if (ret < 0)
   443				break;
   444		}
   445	
   446		lt9611uxc_unlock(lt9611uxc);
   447		return ret;
   448	}
   449	
   450	static int lt9611uxc_get_edid_block(void *data, u8 *buf, unsigned int block, size_t len)
   451	{
   452		struct lt9611uxc *lt9611uxc = data;
   453		int ret;
   454	
   455		if (len > EDID_BLOCK_SIZE)
   456			return -EINVAL;
   457	
   458		if (block >= EDID_NUM_BLOCKS)
   459			return -EINVAL;
   460	
   461		if (block == 0) {
   462			ret = lt9611uxc_read_edid(lt9611uxc);
   463			if (ret) {
   464				dev_err(lt9611uxc->dev, "edid read failed\n");
   465				return ret;
   466			}
   467		}
   468	
   469		memcpy(buf, lt9611uxc->edid_buf + block * EDID_BLOCK_SIZE, len);
   470		return 0;
   471	};
   472	
 > 473	struct edid *lt9611uxc_bridge_get_edid(struct drm_bridge *bridge,
   474			struct drm_connector *connector)
   475	{
   476		struct lt9611uxc *lt9611uxc = bridge_to_lt9611uxc(bridge);
   477	
   478		return drm_do_get_edid(connector, lt9611uxc_get_edid_block, lt9611uxc);
   479	}
   480	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux