Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

intel_th: Allow forcing host mode through drvdata

Some devices can only operate in host mode, so we need means of
communicating this to the core driver on per-device basis. This
adds a flag to drvdata to signal host-only capability to the core.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>

+7 -3
+4 -2
drivers/hwtracing/intel_th/core.c
··· 630 630 thdev->output.port = -1; 631 631 thdev->output.scratchpad = subdev->scrpd; 632 632 } else if (subdev->type == INTEL_TH_SWITCH) { 633 - thdev->host_mode = host_mode; 633 + thdev->host_mode = 634 + INTEL_TH_CAP(th, host_mode_only) ? true : host_mode; 634 635 th->hub = thdev; 635 636 } 636 637 ··· 730 729 struct intel_th_device *thdev; 731 730 732 731 /* only allow SOURCE and SWITCH devices in host mode */ 733 - if (host_mode && subdev->type == INTEL_TH_OUTPUT) 732 + if ((INTEL_TH_CAP(th, host_mode_only) || host_mode) && 733 + subdev->type == INTEL_TH_OUTPUT) 734 734 continue; 735 735 736 736 /*
+3 -1
drivers/hwtracing/intel_th/intel_th.h
··· 42 42 /** 43 43 * struct intel_th_drvdata - describes hardware capabilities and quirks 44 44 * @tscu_enable: device needs SW to enable time stamping unit 45 + * @host_mode_only: device can only operate in 'host debugger' mode 45 46 */ 46 47 struct intel_th_drvdata { 47 - unsigned int tscu_enable : 1; 48 + unsigned int tscu_enable : 1, 49 + host_mode_only : 1; 48 50 }; 49 51 50 52 #define INTEL_TH_CAP(_th, _cap) ((_th)->drvdata ? (_th)->drvdata->_cap : 0)