1diff --git a/include/drm/bridge/analogix_dp.h b/include/drm/bridge/analogix_dp.h 2index b0dcc0733..291eb8787 100644 3--- a/include/drm/bridge/analogix_dp.h 4+++ b/include/drm/bridge/analogix_dp.h 5@@ -8,6 +8,7 @@ 6 #define _ANALOGIX_DP_H_ 7 8 #include <drm/drm_crtc.h> 9+#include <sound/hdmi-codec.h> 10 11 struct analogix_dp_device; 12 13@@ -25,21 +26,32 @@ static inline bool is_rockchip(enum analogix_dp_devtype type) 14 struct analogix_dp_plat_data { 15 enum analogix_dp_devtype dev_type; 16 struct drm_panel *panel; 17+ struct drm_bridge *bridge; 18 struct drm_encoder *encoder; 19 struct drm_connector *connector; 20 bool skip_connector; 21+ bool ssc; 22+ 23+ bool split_mode; 24+ struct analogix_dp_device *left; 25+ struct analogix_dp_device *right; 26 27 int (*power_on_start)(struct analogix_dp_plat_data *); 28 int (*power_on_end)(struct analogix_dp_plat_data *); 29 int (*power_off)(struct analogix_dp_plat_data *); 30 int (*attach)(struct analogix_dp_plat_data *, struct drm_bridge *, 31 struct drm_connector *); 32+ void (*detach)(struct analogix_dp_plat_data *, struct drm_bridge *); 33 int (*get_modes)(struct analogix_dp_plat_data *, 34 struct drm_connector *); 35+ void (*convert_to_split_mode)(struct drm_display_mode *); 36+ void (*convert_to_origin_mode)(struct drm_display_mode *); 37 }; 38 39 int analogix_dp_resume(struct analogix_dp_device *dp); 40 int analogix_dp_suspend(struct analogix_dp_device *dp); 41+int analogix_dp_runtime_resume(struct analogix_dp_device *dp); 42+int analogix_dp_runtime_suspend(struct analogix_dp_device *dp); 43 44 struct analogix_dp_device * 45 analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data); 46@@ -50,4 +62,13 @@ void analogix_dp_remove(struct analogix_dp_device *dp); 47 int analogix_dp_start_crc(struct drm_connector *connector); 48 int analogix_dp_stop_crc(struct drm_connector *connector); 49 50+int analogix_dp_audio_hw_params(struct analogix_dp_device *dp, 51+ struct hdmi_codec_daifmt *daifmt, 52+ struct hdmi_codec_params *params); 53+void analogix_dp_audio_shutdown(struct analogix_dp_device *dp); 54+int analogix_dp_audio_startup(struct analogix_dp_device *dp); 55+int analogix_dp_audio_get_eld(struct analogix_dp_device *dp, 56+ u8 *buf, size_t len); 57+int analogix_dp_loader_protect(struct analogix_dp_device *dp); 58+ 59 #endif /* _ANALOGIX_DP_H_ */ 60diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h 61index ea34ca146..0b7f860d9 100644 62--- a/include/drm/bridge/dw_hdmi.h 63+++ b/include/drm/bridge/dw_hdmi.h 64@@ -6,12 +6,15 @@ 65 #ifndef __DW_HDMI__ 66 #define __DW_HDMI__ 67 68+#include <drm/drm_property.h> 69 #include <sound/hdmi-codec.h> 70+#include <media/cec.h> 71 72 struct drm_display_info; 73 struct drm_display_mode; 74 struct drm_encoder; 75 struct dw_hdmi; 76+struct dw_hdmi_qp; 77 struct platform_device; 78 79 /** 80@@ -92,6 +95,13 @@ enum dw_hdmi_phy_type { 81 DW_HDMI_PHY_VENDOR_PHY = 0xfe, 82 }; 83 84+struct dw_hdmi_audio_tmds_n { 85+ unsigned long tmds; 86+ unsigned int n_32k; 87+ unsigned int n_44k1; 88+ unsigned int n_48k; 89+}; 90+ 91 struct dw_hdmi_mpll_config { 92 unsigned long mpixelclock; 93 struct { 94@@ -112,6 +122,15 @@ struct dw_hdmi_phy_config { 95 u16 vlev_ctr; /* voltage level control */ 96 }; 97 98+struct dw_hdmi_link_config { 99+ bool dsc_mode; 100+ bool frl_mode; 101+ int frl_lanes; 102+ int rate_per_lane; 103+ int hcactive; 104+ u8 pps_payload[128]; 105+}; 106+ 107 struct dw_hdmi_phy_ops { 108 int (*init)(struct dw_hdmi *hdmi, void *data, 109 const struct drm_display_info *display, 110@@ -123,12 +142,48 @@ struct dw_hdmi_phy_ops { 111 void (*setup_hpd)(struct dw_hdmi *hdmi, void *data); 112 }; 113 114+struct dw_hdmi_qp_phy_ops { 115+ int (*init)(struct dw_hdmi_qp *hdmi, void *data, 116+ struct drm_display_mode *mode); 117+ void (*disable)(struct dw_hdmi_qp *hdmi, void *data); 118+ enum drm_connector_status (*read_hpd)(struct dw_hdmi_qp *hdmi, 119+ void *data); 120+ void (*update_hpd)(struct dw_hdmi_qp *hdmi, void *data, 121+ bool force, bool disabled, bool rxsense); 122+ void (*setup_hpd)(struct dw_hdmi_qp *hdmi, void *data); 123+ void (*set_mode)(struct dw_hdmi_qp *dw_hdmi, void *data, 124+ u32 mode_mask, bool enable); 125+}; 126+ 127+struct dw_hdmi_property_ops { 128+ void (*attach_properties)(struct drm_connector *connector, 129+ unsigned int color, int version, 130+ void *data); 131+ void (*destroy_properties)(struct drm_connector *connector, 132+ void *data); 133+ int (*set_property)(struct drm_connector *connector, 134+ struct drm_connector_state *state, 135+ struct drm_property *property, 136+ u64 val, 137+ void *data); 138+ int (*get_property)(struct drm_connector *connector, 139+ const struct drm_connector_state *state, 140+ struct drm_property *property, 141+ u64 *val, 142+ void *data); 143+}; 144+ 145 struct dw_hdmi_plat_data { 146 struct regmap *regm; 147 148+ unsigned long input_bus_format; 149 unsigned long input_bus_encoding; 150+ unsigned int max_tmdsclk; 151 bool use_drm_infoframe; 152 bool ycbcr_420_allowed; 153+ bool unsupported_yuv_input; 154+ bool unsupported_deep_color; 155+ bool is_hdmi_qp; 156 157 /* 158 * Private data passed to all the .mode_valid() and .configure_phy() 159@@ -137,22 +192,55 @@ struct dw_hdmi_plat_data { 160 void *priv_data; 161 162 /* Platform-specific mode validation (optional). */ 163- enum drm_mode_status (*mode_valid)(struct dw_hdmi *hdmi, void *data, 164+ enum drm_mode_status (*mode_valid)(struct drm_connector *connector, 165+ void *data, 166 const struct drm_display_info *info, 167 const struct drm_display_mode *mode); 168 169 /* Vendor PHY support */ 170 const struct dw_hdmi_phy_ops *phy_ops; 171+ const struct dw_hdmi_qp_phy_ops *qp_phy_ops; 172 const char *phy_name; 173 void *phy_data; 174 unsigned int phy_force_vendor; 175+ const struct dw_hdmi_audio_tmds_n *tmds_n_table; 176+ 177+ /* split mode */ 178+ bool split_mode; 179+ bool first_screen; 180+ struct dw_hdmi_qp *left; 181+ struct dw_hdmi_qp *right; 182 183 /* Synopsys PHY support */ 184 const struct dw_hdmi_mpll_config *mpll_cfg; 185+ const struct dw_hdmi_mpll_config *mpll_cfg_420; 186 const struct dw_hdmi_curr_ctrl *cur_ctr; 187 const struct dw_hdmi_phy_config *phy_config; 188 int (*configure_phy)(struct dw_hdmi *hdmi, void *data, 189 unsigned long mpixelclock); 190+ 191+ unsigned long (*get_input_bus_format)(void *data); 192+ unsigned long (*get_output_bus_format)(void *data); 193+ unsigned long (*get_enc_in_encoding)(void *data); 194+ unsigned long (*get_enc_out_encoding)(void *data); 195+ unsigned long (*get_quant_range)(void *data); 196+ struct drm_property *(*get_hdr_property)(void *data); 197+ struct drm_property_blob *(*get_hdr_blob)(void *data); 198+ bool (*get_color_changed)(void *data); 199+ int (*get_yuv422_format)(struct drm_connector *connector, 200+ struct edid *edid); 201+ int (*get_edid_dsc_info)(void *data, struct edid *edid); 202+ int (*get_next_hdr_data)(void *data, struct edid *edid, 203+ struct drm_connector *connector); 204+ struct dw_hdmi_link_config *(*get_link_cfg)(void *data); 205+ void (*set_grf_cfg)(void *data); 206+ void (*convert_to_split_mode)(struct drm_display_mode *mode); 207+ void (*convert_to_origin_mode)(struct drm_display_mode *mode); 208+ int (*dclk_set)(void *data, bool enable); 209+ 210+ /* Vendor Property support */ 211+ const struct dw_hdmi_property_ops *property_ops; 212+ struct drm_connector *connector; 213 }; 214 215 struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, 216@@ -161,8 +249,9 @@ void dw_hdmi_remove(struct dw_hdmi *hdmi); 217 void dw_hdmi_unbind(struct dw_hdmi *hdmi); 218 struct dw_hdmi *dw_hdmi_bind(struct platform_device *pdev, 219 struct drm_encoder *encoder, 220- const struct dw_hdmi_plat_data *plat_data); 221+ struct dw_hdmi_plat_data *plat_data); 222 223+void dw_hdmi_suspend(struct dw_hdmi *hdmi); 224 void dw_hdmi_resume(struct dw_hdmi *hdmi); 225 226 void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense); 227@@ -192,5 +281,31 @@ enum drm_connector_status dw_hdmi_phy_read_hpd(struct dw_hdmi *hdmi, 228 void dw_hdmi_phy_update_hpd(struct dw_hdmi *hdmi, void *data, 229 bool force, bool disabled, bool rxsense); 230 void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi, void *data); 231+void dw_hdmi_set_quant_range(struct dw_hdmi *hdmi); 232+void dw_hdmi_set_output_type(struct dw_hdmi *hdmi, u64 val); 233+bool dw_hdmi_get_output_whether_hdmi(struct dw_hdmi *hdmi); 234+int dw_hdmi_get_output_type_cap(struct dw_hdmi *hdmi); 235+void dw_hdmi_set_cec_adap(struct dw_hdmi *hdmi, struct cec_adapter *adap); 236+ 237+void dw_hdmi_qp_unbind(struct dw_hdmi_qp *hdmi); 238+struct dw_hdmi_qp *dw_hdmi_qp_bind(struct platform_device *pdev, 239+ struct drm_encoder *encoder, 240+ struct dw_hdmi_plat_data *plat_data); 241+void dw_hdmi_qp_suspend(struct device *dev, struct dw_hdmi_qp *hdmi); 242+void dw_hdmi_qp_resume(struct device *dev, struct dw_hdmi_qp *hdmi); 243+void dw_hdmi_qp_cec_set_hpd(struct dw_hdmi_qp *hdmi, bool plug_in, bool change); 244+void dw_hdmi_qp_set_cec_adap(struct dw_hdmi_qp *hdmi, struct cec_adapter *adap); 245+int dw_hdmi_qp_set_earc(struct dw_hdmi_qp *hdmi); 246+void dw_hdmi_qp_set_sample_rate(struct dw_hdmi_qp *hdmi, unsigned int rate); 247+void dw_hdmi_qp_set_channel_count(struct dw_hdmi_qp *hdmi, unsigned int cnt); 248+void dw_hdmi_qp_set_channel_status(struct dw_hdmi_qp *hdmi, u8 *channel_status, 249+ bool ref2stream); 250+void dw_hdmi_qp_set_channel_allocation(struct dw_hdmi_qp *hdmi, unsigned int ca); 251+void dw_hdmi_qp_set_audio_infoframe(struct dw_hdmi_qp *hdmi, 252+ struct hdmi_codec_params *hparms); 253+void dw_hdmi_qp_audio_enable(struct dw_hdmi_qp *hdmi); 254+void dw_hdmi_qp_audio_disable(struct dw_hdmi_qp *hdmi); 255+int dw_hdmi_qp_set_plugged_cb(struct dw_hdmi_qp *hdmi, hdmi_codec_plugged_cb fn, 256+ struct device *codec_dev); 257 258 #endif /* __IMX_HDMI_H__ */ 259diff --git a/include/drm/bridge/dw_mipi_dsi.h b/include/drm/bridge/dw_mipi_dsi.h 260index bda8aa7c2..f89b0476a 100644 261--- a/include/drm/bridge/dw_mipi_dsi.h 262+++ b/include/drm/bridge/dw_mipi_dsi.h 263@@ -66,5 +66,6 @@ void dw_mipi_dsi_remove(struct dw_mipi_dsi *dsi); 264 int dw_mipi_dsi_bind(struct dw_mipi_dsi *dsi, struct drm_encoder *encoder); 265 void dw_mipi_dsi_unbind(struct dw_mipi_dsi *dsi); 266 void dw_mipi_dsi_set_slave(struct dw_mipi_dsi *dsi, struct dw_mipi_dsi *slave); 267+struct drm_connector *dw_mipi_dsi_get_connector(struct dw_mipi_dsi *dsi); 268 269 #endif /* __DW_MIPI_DSI__ */ 270diff --git a/include/drm/drm_auth.h b/include/drm/drm_auth.h 271index f99d3417f..6bf8b2b78 100644 272--- a/include/drm/drm_auth.h 273+++ b/include/drm/drm_auth.h 274@@ -107,7 +107,6 @@ struct drm_master { 275 }; 276 277 struct drm_master *drm_master_get(struct drm_master *master); 278-struct drm_master *drm_file_get_master(struct drm_file *file_priv); 279 void drm_master_put(struct drm_master **master); 280 bool drm_is_current_master(struct drm_file *fpriv); 281 282diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h 283index 928136556..f8cd5d8e5 100644 284--- a/include/drm/drm_connector.h 285+++ b/include/drm/drm_connector.h 286@@ -175,6 +175,48 @@ struct drm_scdc { 287 struct drm_scrambling scrambling; 288 }; 289 290+#ifdef CONFIG_NO_GKI 291+/** 292+ * struct drm_hdmi_dsc_cap - DSC capabilities of HDMI sink 293+ * 294+ * Describes the DSC support provided by HDMI 2.1 sink. 295+ * The information is fetched fom additional HFVSDB blocks defined 296+ * for HDMI 2.1. 297+ */ 298+struct drm_hdmi_dsc_cap { 299+ /** @v_1p2: flag for dsc1.2 version support by sink */ 300+ bool v_1p2; 301+ 302+ /** @native_420: Does sink support DSC with 4:2:0 compression */ 303+ bool native_420; 304+ 305+ /** 306+ * @all_bpp: Does sink support all bpp with 4:4:4: or 4:2:2 307+ * compressed formats 308+ */ 309+ bool all_bpp; 310+ 311+ /** 312+ * @bpc_supported: compressed bpc supported by sink : 10, 12 or 16 bpc 313+ */ 314+ u8 bpc_supported; 315+ 316+ /** @max_slices: maximum number of Horizontal slices supported by */ 317+ u8 max_slices; 318+ 319+ /** @clk_per_slice : max pixel clock in MHz supported per slice */ 320+ int clk_per_slice; 321+ 322+ /** @max_lanes : dsc max lanes supported for Fixed rate Link training */ 323+ u8 max_lanes; 324+ 325+ /** @max_frl_rate_per_lane : maximum frl rate with DSC per lane */ 326+ u8 max_frl_rate_per_lane; 327+ 328+ /** @total_chunk_kbytes: max size of chunks in KBs supported per line*/ 329+ u8 total_chunk_kbytes; 330+}; 331+#endif 332 333 /** 334 * struct drm_hdmi_info - runtime information about the connected HDMI sink 335@@ -207,6 +249,17 @@ struct drm_hdmi_info { 336 337 /** @y420_dc_modes: bitmap of deep color support index */ 338 u8 y420_dc_modes; 339+ 340+#ifdef CONFIG_NO_GKI 341+ /** @max_frl_rate_per_lane: support fixed rate link */ 342+ u8 max_frl_rate_per_lane; 343+ 344+ /** @max_lanes: supported by sink */ 345+ u8 max_lanes; 346+ 347+ /** @dsc_cap: DSC capabilities of the sink */ 348+ struct drm_hdmi_dsc_cap dsc_cap; 349+#endif 350 }; 351 352 /** 353@@ -1596,6 +1649,7 @@ drm_connector_is_unregistered(struct drm_connector *connector) 354 DRM_CONNECTOR_UNREGISTERED; 355 } 356 357+void drm_connector_oob_hotplug_event(struct fwnode_handle *connector_fwnode); 358 const char *drm_get_connector_type_name(unsigned int connector_type); 359 const char *drm_get_connector_status_name(enum drm_connector_status status); 360 const char *drm_get_subpixel_order_name(enum subpixel_order order); 361diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h 362index 59b51a09c..3a3d9d887 100644 363--- a/include/drm/drm_crtc.h 364+++ b/include/drm/drm_crtc.h 365@@ -287,7 +287,16 @@ struct drm_crtc_state { 366 * NULL) is an array of &struct drm_color_lut. 367 */ 368 struct drm_property_blob *gamma_lut; 369- 370+#if defined(CONFIG_ROCKCHIP_DRM_CUBIC_LUT) 371+ /** 372+ * @cubic_lut: 373+ * 374+ * Cubic Lookup table for converting pixel data. See 375+ * drm_crtc_enable_color_mgmt(). The blob (if not NULL) is a 3D array 376+ * of &struct drm_color_lut. 377+ */ 378+ struct drm_property_blob *cubic_lut; 379+#endif 380 /** 381 * @target_vblank: 382 * 383diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h 384index e57d0440f..e395d1fc1 100644 385--- a/include/drm/drm_drv.h 386+++ b/include/drm/drm_drv.h 387@@ -29,6 +29,7 @@ 388 389 #include <linux/list.h> 390 #include <linux/irqreturn.h> 391+#include <linux/uuid.h> 392 393 #include <drm/drm_device.h> 394 395@@ -460,6 +461,15 @@ struct drm_driver { 396 int (*gem_prime_mmap)(struct drm_gem_object *obj, 397 struct vm_area_struct *vma); 398 399+ /** 400+ * @gem_prime_get_uuid 401+ * 402+ * get_uuid hook for GEM drivers. Retrieves the virtio uuid of the 403+ * given GEM buffer. 404+ */ 405+ int (*gem_prime_get_uuid)(struct drm_gem_object *obj, 406+ uuid_t *uuid); 407+ 408 /** 409 * @dumb_create: 410 * 411diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h 412index e97daf6ff..043491c74 100644 413--- a/include/drm/drm_edid.h 414+++ b/include/drm/drm_edid.h 415@@ -229,6 +229,38 @@ struct detailed_timing { 416 DRM_EDID_YCBCR420_DC_36 | \ 417 DRM_EDID_YCBCR420_DC_30) 418 419+#ifdef CONFIG_NO_GKI 420+/* HDMI 2.1 additional fields */ 421+#define DRM_EDID_MAX_FRL_RATE_MASK 0xf0 422+#define DRM_EDID_FAPA_START_LOCATION (1 << 0) 423+#define DRM_EDID_ALLM (1 << 1) 424+#define DRM_EDID_FVA (1 << 2) 425+ 426+/* Deep Color specific */ 427+#define DRM_EDID_DC_30BIT_420 (1 << 0) 428+#define DRM_EDID_DC_36BIT_420 (1 << 1) 429+#define DRM_EDID_DC_48BIT_420 (1 << 2) 430+ 431+/* VRR specific */ 432+#define DRM_EDID_CNMVRR (1 << 3) 433+#define DRM_EDID_CINEMA_VRR (1 << 4) 434+#define DRM_EDID_MDELTA (1 << 5) 435+#define DRM_EDID_VRR_MAX_UPPER_MASK 0xc0 436+#define DRM_EDID_VRR_MAX_LOWER_MASK 0xff 437+#define DRM_EDID_VRR_MIN_MASK 0x3f 438+ 439+/* DSC specific */ 440+#define DRM_EDID_DSC_10BPC (1 << 0) 441+#define DRM_EDID_DSC_12BPC (1 << 1) 442+#define DRM_EDID_DSC_16BPC (1 << 2) 443+#define DRM_EDID_DSC_ALL_BPP (1 << 3) 444+#define DRM_EDID_DSC_NATIVE_420 (1 << 6) 445+#define DRM_EDID_DSC_1P2 (1 << 7) 446+#define DRM_EDID_DSC_MAX_FRL_RATE_MASK 0xf0 447+#define DRM_EDID_DSC_MAX_SLICES 0xf 448+#define DRM_EDID_DSC_TOTAL_CHUNK_KBYTES 0x3f 449+#endif 450+ 451 /* ELD Header Block */ 452 #define DRM_ELD_HEADER_BLOCK_SIZE 4 453 454@@ -359,8 +391,6 @@ drm_load_edid_firmware(struct drm_connector *connector) 455 } 456 #endif 457 458-bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2); 459- 460 int 461 drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, 462 const struct drm_connector *connector, 463@@ -483,35 +513,99 @@ struct edid *drm_do_get_edid(struct drm_connector *connector, 464 int (*get_edid_block)(void *data, u8 *buf, unsigned int block, 465 size_t len), 466 void *data); 467-struct edid *drm_get_edid(struct drm_connector *connector, 468- struct i2c_adapter *adapter); 469 struct edid *drm_get_edid_switcheroo(struct drm_connector *connector, 470 struct i2c_adapter *adapter); 471-struct edid *drm_edid_duplicate(const struct edid *edid); 472-int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); 473-int drm_add_override_edid_modes(struct drm_connector *connector); 474 475-u8 drm_match_cea_mode(const struct drm_display_mode *to_match); 476 bool drm_detect_hdmi_monitor(struct edid *edid); 477-bool drm_detect_monitor_audio(struct edid *edid); 478 enum hdmi_quantization_range 479 drm_default_rgb_quant_range(const struct drm_display_mode *mode); 480-int drm_add_modes_noedid(struct drm_connector *connector, 481- int hdisplay, int vdisplay); 482 void drm_set_preferred_mode(struct drm_connector *connector, 483 int hpref, int vpref); 484 485 int drm_edid_header_is_valid(const u8 *raw_edid); 486 bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid, 487 bool *edid_corrupt); 488-bool drm_edid_is_valid(struct edid *edid); 489+struct drm_display_mode * 490+drm_display_mode_from_cea_vic(struct drm_device *dev, 491+ u8 video_code); 492+ 493+#ifdef CONFIG_DRM_EDID 494+struct edid *drm_get_edid(struct drm_connector *connector, 495+ struct i2c_adapter *adapter); 496+struct edid *drm_edid_duplicate(const struct edid *edid); 497+int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); 498+int drm_add_override_edid_modes(struct drm_connector *connector); 499+u8 drm_match_cea_mode(const struct drm_display_mode *to_match); 500+int drm_add_modes_noedid(struct drm_connector *connector, 501+ int hdisplay, int vdisplay); 502+bool drm_detect_monitor_audio(struct edid *edid); 503 void drm_edid_get_monitor_name(struct edid *edid, char *name, 504 int buflen); 505+bool drm_edid_is_valid(struct edid *edid); 506+bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2); 507 struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, 508 int hsize, int vsize, int fresh, 509 bool rb); 510-struct drm_display_mode * 511-drm_display_mode_from_cea_vic(struct drm_device *dev, 512- u8 video_code); 513+#else 514+static inline struct edid *drm_get_edid(struct drm_connector *connector, 515+ struct i2c_adapter *adapter) 516+{ 517+ return NULL; 518+} 519+ 520+static inline struct edid *drm_edid_duplicate(const struct edid *edid) 521+{ 522+ return NULL; 523+} 524+ 525+static inline int drm_add_edid_modes(struct drm_connector *connector, 526+ struct edid *edid) 527+{ 528+ return 0; 529+} 530+ 531+static inline int drm_add_override_edid_modes(struct drm_connector *connector) 532+{ 533+ return 0; 534+} 535+ 536+static inline u8 drm_match_cea_mode(const struct drm_display_mode *to_match) 537+{ 538+ return 0; 539+} 540+ 541+static inline int drm_add_modes_noedid(struct drm_connector *connector, 542+ int hdisplay, int vdisplay) 543+{ 544+ return 0; 545+} 546+ 547+static inline bool drm_detect_monitor_audio(struct edid *edid) 548+{ 549+ return false; 550+} 551+ 552+static inline void drm_edid_get_monitor_name(struct edid *edid, char *name, 553+ int buflen) 554+{ 555+} 556+ 557+static inline bool drm_edid_is_valid(struct edid *edid) 558+{ 559+ return false; 560+} 561+ 562+static inline bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2) 563+{ 564+ return false; 565+} 566+ 567+static inline struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, 568+ int hsize, int vsize, int fresh, 569+ bool rb) 570+{ 571+ return NULL; 572+} 573+#endif 574 575 #endif /* __DRM_EDID_H__ */ 576diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h 577index 42d04607d..b81b3bfb0 100644 578--- a/include/drm/drm_file.h 579+++ b/include/drm/drm_file.h 580@@ -226,27 +226,15 @@ struct drm_file { 581 /** 582 * @master: 583 * 584- * Master this node is currently associated with. Protected by struct 585- * &drm_device.master_mutex, and serialized by @master_lookup_lock. 586- * 587- * Only relevant if drm_is_primary_client() returns true. Note that 588- * this only matches &drm_device.master if the master is the currently 589- * active one. 590- * 591- * When dereferencing this pointer, either hold struct 592- * &drm_device.master_mutex for the duration of the pointer's use, or 593- * use drm_file_get_master() if struct &drm_device.master_mutex is not 594- * currently held and there is no other need to hold it. This prevents 595- * @master from being freed during use. 596+ * Master this node is currently associated with. Only relevant if 597+ * drm_is_primary_client() returns true. Note that this only 598+ * matches &drm_device.master if the master is the currently active one. 599 * 600 * See also @authentication and @is_master and the :ref:`section on 601 * primary nodes and authentication <drm_primary_node>`. 602 */ 603 struct drm_master *master; 604 605- /** @master_lock: Serializes @master. */ 606- spinlock_t master_lookup_lock; 607- 608 /** @pid: Process that opened this file. */ 609 struct pid *pid; 610 611@@ -411,6 +399,9 @@ void drm_event_cancel_free(struct drm_device *dev, 612 struct drm_pending_event *p); 613 void drm_send_event_locked(struct drm_device *dev, struct drm_pending_event *e); 614 void drm_send_event(struct drm_device *dev, struct drm_pending_event *e); 615+void drm_send_event_timestamp_locked(struct drm_device *dev, 616+ struct drm_pending_event *e, 617+ ktime_t timestamp); 618 619 struct file *mock_drm_getfile(struct drm_minor *minor, unsigned int flags); 620 621diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h 622index 360e6377e..952f475a6 100644 623--- a/include/drm/drm_mipi_dsi.h 624+++ b/include/drm/drm_mipi_dsi.h 625@@ -19,12 +19,18 @@ struct drm_dsc_picture_parameter_set; 626 #define MIPI_DSI_MSG_REQ_ACK BIT(0) 627 /* use Low Power Mode to transmit message */ 628 #define MIPI_DSI_MSG_USE_LPM BIT(1) 629+/* read mipi_dsi_msg.ctrl and unicast to only that ctrls */ 630+#define MIPI_DSI_MSG_UNICAST BIT(2) 631+/* Stack all commands until lastcommand bit and trigger all in one go */ 632+#define MIPI_DSI_MSG_LASTCOMMAND BIT(3) 633 634 /** 635 * struct mipi_dsi_msg - read/write DSI buffer 636 * @channel: virtual channel id 637 * @type: payload data type 638 * @flags: flags controlling this message transmission 639+ * @ctrl: ctrl index to transmit on 640+ * @wait_ms: duration in ms to wait after message transmission 641 * @tx_len: length of @tx_buf 642 * @tx_buf: data to be written 643 * @rx_len: length of @rx_buf 644@@ -34,6 +40,8 @@ struct mipi_dsi_msg { 645 u8 channel; 646 u8 type; 647 u16 flags; 648+ u32 ctrl; 649+ u32 wait_ms; 650 651 size_t tx_len; 652 const void *tx_buf; 653@@ -132,6 +140,10 @@ struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node); 654 #define MIPI_DSI_CLOCK_NON_CONTINUOUS BIT(10) 655 /* transmit data in low power */ 656 #define MIPI_DSI_MODE_LPM BIT(11) 657+/* disable BLLP area */ 658+#define MIPI_DSI_MODE_VIDEO_BLLP BIT(12) 659+/* disable EOF BLLP area */ 660+#define MIPI_DSI_MODE_VIDEO_EOF_BLLP BIT(13) 661 662 enum mipi_dsi_pixel_format { 663 MIPI_DSI_FMT_RGB888, 664diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h 665index a18f73eb3..76d114569 100644 666--- a/include/drm/drm_mode_config.h 667+++ b/include/drm/drm_mode_config.h 668@@ -794,6 +794,19 @@ struct drm_mode_config { 669 */ 670 struct drm_property *gamma_lut_size_property; 671 672+#if defined(CONFIG_ROCKCHIP_DRM_CUBIC_LUT) 673+ /** 674+ * @cubic_lut_property: Optional CRTC property to set the 3D LUT used to 675+ * convert color spaces. 676+ */ 677+ struct drm_property *cubic_lut_property; 678+ /** 679+ * @cubic_lut_size_property: Optional CRTC property for the size of the 680+ * 3D LUT as supported by the driver (read-only). 681+ */ 682+ struct drm_property *cubic_lut_size_property; 683+#endif 684+ 685 /** 686 * @suggested_x_property: Optional connector property with a hint for 687 * the position of the output on the host's screen. 688diff --git a/include/drm/drm_mode_object.h b/include/drm/drm_mode_object.h 689index c34a3e803..6292fa663 100644 690--- a/include/drm/drm_mode_object.h 691+++ b/include/drm/drm_mode_object.h 692@@ -60,7 +60,7 @@ struct drm_mode_object { 693 void (*free_cb)(struct kref *kref); 694 }; 695 696-#define DRM_OBJECT_MAX_PROPERTY 24 697+#define DRM_OBJECT_MAX_PROPERTY 64 698 /** 699 * struct drm_object_properties - property tracking for &drm_mode_object 700 */ 701diff --git a/include/drm/drm_prime.h b/include/drm/drm_prime.h 702index 0f69f9fbf..a9d0c6b08 100644 703--- a/include/drm/drm_prime.h 704+++ b/include/drm/drm_prime.h 705@@ -107,5 +107,6 @@ void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg); 706 int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages, 707 dma_addr_t *addrs, int max_pages); 708 709+int drm_gem_dmabuf_get_uuid(struct dma_buf *dma_buf, uuid_t *uuid); 710 711 #endif /* __DRM_PRIME_H__ */ 712diff --git a/include/dt-bindings/clock/rk3399-cru.h b/include/dt-bindings/clock/rk3399-cru.h 713index 44e0a319f..b541bdce1 100644 714--- a/include/dt-bindings/clock/rk3399-cru.h 715+++ b/include/dt-bindings/clock/rk3399-cru.h 716@@ -7,6 +7,8 @@ 717 #ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3399_H 718 #define _DT_BINDINGS_CLK_ROCKCHIP_RK3399_H 719 720+#define RK3399_TWO_PLL_FOR_VOP 721+ 722 /* core clocks */ 723 #define PLL_APLLL 1 724 #define PLL_APLLB 2 725@@ -19,6 +21,7 @@ 726 #define ARMCLKB 9 727 728 /* sclk gates (special clocks) */ 729+#define SCLK_I2SOUT_SRC 64 730 #define SCLK_I2C1 65 731 #define SCLK_I2C2 66 732 #define SCLK_I2C3 67 733@@ -122,9 +125,18 @@ 734 #define SCLK_DPHY_RX0_CFG 165 735 #define SCLK_RMII_SRC 166 736 #define SCLK_PCIEPHY_REF100M 167 737-#define SCLK_DDRC 168 738-#define SCLK_TESTCLKOUT1 169 739-#define SCLK_TESTCLKOUT2 170 740+#define SCLK_USBPHY0_480M_SRC 168 741+#define SCLK_USBPHY1_480M_SRC 169 742+#define SCLK_DDRC 170 743+#define SCLK_TESTCLKOUT2 171 744+#define SCLK_UART0_SRC 172 745+#define SCLK_UART_SRC 173 746+#define SCLK_I2S0_DIV 174 747+#define SCLK_I2S1_DIV 175 748+#define SCLK_I2S2_DIV 176 749+#define SCLK_SPDIF_DIV 177 750+#define SCLK_TESTCLKOUT1 179 751+#define SCLK_CIF_OUT_SRC 178 752 753 #define DCLK_VOP0 180 754 #define DCLK_VOP1 181 755@@ -351,6 +363,7 @@ 756 #define SCLK_I2C0_PMU 9 757 #define SCLK_I2C4_PMU 10 758 #define SCLK_I2C8_PMU 11 759+#define SCLK_UART4_SRC 12 760 761 #define PCLK_SRC_PMU 19 762 #define PCLK_PMU 20 763@@ -421,7 +434,7 @@ 764 #define SRST_A_ADB400_GIC2COREB 40 765 #define SRST_A_ADB400_COREB2GIC 41 766 #define SRST_P_DBG_B 42 767-#define SRST_L2_B_T 43 768+#define SRST_L2_B_T 44 769 #define SRST_ADB_B_T 45 770 #define SRST_A_RKPERF_B 46 771 #define SRST_PVTM_CORE_B 47 772@@ -594,13 +607,13 @@ 773 #define SRST_P_SPI0 214 774 #define SRST_P_SPI1 215 775 #define SRST_P_SPI2 216 776-#define SRST_P_SPI3 217 777-#define SRST_P_SPI4 218 778+#define SRST_P_SPI4 217 779+#define SRST_P_SPI5 218 780 #define SRST_SPI0 219 781 #define SRST_SPI1 220 782 #define SRST_SPI2 221 783-#define SRST_SPI3 222 784-#define SRST_SPI4 223 785+#define SRST_SPI4 222 786+#define SRST_SPI5 223 787 788 /* cru_softrst_con14 */ 789 #define SRST_I2S0_8CH 224 790@@ -722,8 +735,8 @@ 791 #define SRST_H_CM0S_NOC 3 792 #define SRST_DBG_CM0S 4 793 #define SRST_PO_CM0S 5 794-#define SRST_P_SPI6 6 795-#define SRST_SPI6 7 796+#define SRST_P_SPI3 6 797+#define SRST_SPI3 7 798 #define SRST_P_TIMER_0_1 8 799 #define SRST_P_TIMER_0 9 800 #define SRST_P_TIMER_1 10 801diff --git a/include/dt-bindings/soc/rockchip,boot-mode.h b/include/dt-bindings/soc/rockchip,boot-mode.h 802index 4b0914c09..1436e1d32 100644 803--- a/include/dt-bindings/soc/rockchip,boot-mode.h 804+++ b/include/dt-bindings/soc/rockchip,boot-mode.h 805@@ -10,7 +10,15 @@ 806 #define BOOT_BL_DOWNLOAD (REBOOT_FLAG + 1) 807 /* enter recovery */ 808 #define BOOT_RECOVERY (REBOOT_FLAG + 3) 809- /* enter fastboot mode */ 810+/* reboot by panic */ 811+#define BOOT_PANIC (REBOOT_FLAG + 7) 812+/* reboot by watchdog */ 813+#define BOOT_WATCHDOG (REBOOT_FLAG + 8) 814+/* enter fastboot mode */ 815 #define BOOT_FASTBOOT (REBOOT_FLAG + 9) 816+/* enter charging mode */ 817+#define BOOT_CHARGING (REBOOT_FLAG + 11) 818+/* enter usb mass storage mode */ 819+#define BOOT_UMS (REBOOT_FLAG + 12) 820 821 #endif 822diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h 823index d9b69bbde..ebfb4e7c1 100644 824--- a/include/linux/blk_types.h 825+++ b/include/linux/blk_types.h 826@@ -46,6 +46,7 @@ struct block_device { 827 int bd_fsfreeze_count; 828 /* Mutex for freeze */ 829 struct mutex bd_fsfreeze_mutex; 830+ struct super_block *bd_fsfreeze_sb; 831 } __randomize_layout; 832 833 /* 834diff --git a/include/linux/bpf.h b/include/linux/bpf.h 835index a8b2625e5..469fa0f9f 100644 836--- a/include/linux/bpf.h 837+++ b/include/linux/bpf.h 838@@ -173,7 +173,7 @@ struct bpf_map { 839 atomic64_t usercnt; 840 struct work_struct work; 841 struct mutex freeze_mutex; 842- atomic64_t writecnt; 843+ u64 writecnt; /* writable mmap cnt; protected by freeze_mutex */ 844 }; 845 846 static inline bool map_value_has_spin_lock(const struct bpf_map *map) 847@@ -1333,7 +1333,6 @@ void bpf_map_charge_move(struct bpf_map_memory *dst, 848 void *bpf_map_area_alloc(u64 size, int numa_node); 849 void *bpf_map_area_mmapable_alloc(u64 size, int numa_node); 850 void bpf_map_area_free(void *base); 851-bool bpf_map_write_active(const struct bpf_map *map); 852 void bpf_map_init_from_attr(struct bpf_map *map, union bpf_attr *attr); 853 int generic_map_lookup_batch(struct bpf_map *map, 854 const union bpf_attr *attr, 855diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h 856index 9c88b7da3..14b808b02 100644 857--- a/include/linux/cgroup.h 858+++ b/include/linux/cgroup.h 859@@ -676,6 +676,8 @@ static inline struct psi_group *cgroup_psi(struct cgroup *cgrp) 860 return &cgrp->psi; 861 } 862 863+bool cgroup_psi_enabled(void); 864+ 865 static inline void cgroup_init_kthreadd(void) 866 { 867 /* 868@@ -735,6 +737,11 @@ static inline struct psi_group *cgroup_psi(struct cgroup *cgrp) 869 return NULL; 870 } 871 872+static inline bool cgroup_psi_enabled(void) 873+{ 874+ return false; 875+} 876+ 877 static inline bool task_under_cgroup_hierarchy(struct task_struct *task, 878 struct cgroup *ancestor) 879 { 880@@ -816,13 +823,33 @@ static inline void cgroup_account_cputime_field(struct task_struct *task, 881 */ 882 #ifdef CONFIG_SOCK_CGROUP_DATA 883 884+#if defined(CONFIG_CGROUP_NET_PRIO) || defined(CONFIG_CGROUP_NET_CLASSID) 885+extern spinlock_t cgroup_sk_update_lock; 886+#endif 887+ 888+void cgroup_sk_alloc_disable(void); 889 void cgroup_sk_alloc(struct sock_cgroup_data *skcd); 890 void cgroup_sk_clone(struct sock_cgroup_data *skcd); 891 void cgroup_sk_free(struct sock_cgroup_data *skcd); 892 893 static inline struct cgroup *sock_cgroup_ptr(struct sock_cgroup_data *skcd) 894 { 895- return skcd->cgroup; 896+#if defined(CONFIG_CGROUP_NET_PRIO) || defined(CONFIG_CGROUP_NET_CLASSID) 897+ unsigned long v; 898+ 899+ /* 900+ * @skcd->val is 64bit but the following is safe on 32bit too as we 901+ * just need the lower ulong to be written and read atomically. 902+ */ 903+ v = READ_ONCE(skcd->val); 904+ 905+ if (v & 3) 906+ return &cgrp_dfl_root.cgrp; 907+ 908+ return (struct cgroup *)(unsigned long)v ?: &cgrp_dfl_root.cgrp; 909+#else 910+ return (struct cgroup *)(unsigned long)skcd->val; 911+#endif 912 } 913 914 #else /* CONFIG_CGROUP_DATA */ 915diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h 916index 03a5de5f9..d9897d0b1 100644 917--- a/include/linux/clk-provider.h 918+++ b/include/linux/clk-provider.h 919@@ -599,6 +599,7 @@ struct clk_divider { 920 u8 shift; 921 u8 width; 922 u8 flags; 923+ unsigned long max_prate; 924 const struct clk_div_table *table; 925 spinlock_t *lock; 926 }; 927@@ -936,6 +937,8 @@ void clk_hw_unregister_fixed_factor(struct clk_hw *hw); 928 * CLK_FRAC_DIVIDER_BIG_ENDIAN - By default little endian register accesses are 929 * used for the divider register. Setting this flag makes the register 930 * accesses big endian. 931+ * CLK_FRAC_DIVIDER_NO_LIMIT - not need to follow the 20 times limit on 932+ * fractional divider 933 */ 934 struct clk_fractional_divider { 935 struct clk_hw hw; 936@@ -947,6 +950,7 @@ struct clk_fractional_divider { 937 u8 nwidth; 938 u32 nmask; 939 u8 flags; 940+ unsigned long max_prate; 941 void (*approximation)(struct clk_hw *hw, 942 unsigned long rate, unsigned long *parent_rate, 943 unsigned long *m, unsigned long *n); 944@@ -957,6 +961,7 @@ struct clk_fractional_divider { 945 946 #define CLK_FRAC_DIVIDER_ZERO_BASED BIT(0) 947 #define CLK_FRAC_DIVIDER_BIG_ENDIAN BIT(1) 948+#define CLK_FRAC_DIVIDER_NO_LIMIT BIT(2) 949 950 extern const struct clk_ops clk_fractional_divider_ops; 951 struct clk *clk_register_fractional_divider(struct device *dev, 952@@ -1017,6 +1022,9 @@ extern const struct clk_ops clk_multiplier_ops; 953 * @mux_hw: handle between composite and hardware-specific mux clock 954 * @rate_hw: handle between composite and hardware-specific rate clock 955 * @gate_hw: handle between composite and hardware-specific gate clock 956+ * @brother_hw: a member of clk_composite who has the common parent clocks 957+ * with another clk_composite, and it's also a handle between 958+ * common and hardware-specific interfaces 959 * @mux_ops: clock ops for mux 960 * @rate_ops: clock ops for rate 961 * @gate_ops: clock ops for gate 962@@ -1028,6 +1036,7 @@ struct clk_composite { 963 struct clk_hw *mux_hw; 964 struct clk_hw *rate_hw; 965 struct clk_hw *gate_hw; 966+ struct clk_hw *brother_hw; 967 968 const struct clk_ops *mux_ops; 969 const struct clk_ops *rate_ops; 970diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h 971index 04c20de66..047f449d3 100644 972--- a/include/linux/cpuset.h 973+++ b/include/linux/cpuset.h 974@@ -15,6 +15,7 @@ 975 #include <linux/cpumask.h> 976 #include <linux/nodemask.h> 977 #include <linux/mm.h> 978+#include <linux/mmu_context.h> 979 #include <linux/jump_label.h> 980 981 #ifdef CONFIG_CPUSETS 982@@ -162,6 +163,8 @@ static inline void set_mems_allowed(nodemask_t nodemask) 983 task_unlock(current); 984 } 985 986+extern void cpuset_hotplug_workfn(struct work_struct *work); 987+ 988 #else /* !CONFIG_CPUSETS */ 989 990 static inline bool cpusets_enabled(void) { return false; } 991@@ -184,7 +187,7 @@ static inline void cpuset_read_unlock(void) { } 992 static inline void cpuset_cpus_allowed(struct task_struct *p, 993 struct cpumask *mask) 994 { 995- cpumask_copy(mask, cpu_possible_mask); 996+ cpumask_copy(mask, task_cpu_possible_mask(p)); 997 } 998 999 static inline void cpuset_cpus_allowed_fallback(struct task_struct *p) 1000@@ -280,6 +283,8 @@ static inline bool read_mems_allowed_retry(unsigned int seq) 1001 return false; 1002 } 1003 1004+static inline void cpuset_hotplug_workfn(struct work_struct *work) {} 1005+ 1006 #endif /* !CONFIG_CPUSETS */ 1007 1008 #endif /* _LINUX_CPUSET_H */ 1009diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h 1010index 0c5706abb..fc3c3f21f 100644 1011--- a/include/linux/dma-buf.h 1012+++ b/include/linux/dma-buf.h 1013@@ -209,6 +209,41 @@ struct dma_buf_ops { 1014 */ 1015 int (*begin_cpu_access)(struct dma_buf *, enum dma_data_direction); 1016 1017+ /** 1018+ * @begin_cpu_access_partial: 1019+ * 1020+ * This is called from dma_buf_begin_cpu_access_partial() and allows the 1021+ * exporter to ensure that the memory specified in the range is 1022+ * available for cpu access - the exporter might need to allocate or 1023+ * swap-in and pin the backing storage. 1024+ * The exporter also needs to ensure that cpu access is 1025+ * coherent for the access direction. The direction can be used by the 1026+ * exporter to optimize the cache flushing, i.e. access with a different 1027+ * direction (read instead of write) might return stale or even bogus 1028+ * data (e.g. when the exporter needs to copy the data to temporary 1029+ * storage). 1030+ * 1031+ * This callback is optional. 1032+ * 1033+ * FIXME: This is both called through the DMA_BUF_IOCTL_SYNC command 1034+ * from userspace (where storage shouldn't be pinned to avoid handing 1035+ * de-factor mlock rights to userspace) and for the kernel-internal 1036+ * users of the various kmap interfaces, where the backing storage must 1037+ * be pinned to guarantee that the atomic kmap calls can succeed. Since 1038+ * there's no in-kernel users of the kmap interfaces yet this isn't a 1039+ * real problem. 1040+ * 1041+ * Returns: 1042+ * 1043+ * 0 on success or a negative error code on failure. This can for 1044+ * example fail when the backing storage can't be allocated. Can also 1045+ * return -ERESTARTSYS or -EINTR when the call has been interrupted and 1046+ * needs to be restarted. 1047+ */ 1048+ int (*begin_cpu_access_partial)(struct dma_buf *dmabuf, 1049+ enum dma_data_direction, 1050+ unsigned int offset, unsigned int len); 1051+ 1052 /** 1053 * @end_cpu_access: 1054 * 1055@@ -228,6 +263,28 @@ struct dma_buf_ops { 1056 */ 1057 int (*end_cpu_access)(struct dma_buf *, enum dma_data_direction); 1058 1059+ /** 1060+ * @end_cpu_access_partial: 1061+ * 1062+ * This is called from dma_buf_end_cpu_access_partial() when the 1063+ * importer is done accessing the CPU. The exporter can use to limit 1064+ * cache flushing to only the range specefied and to unpin any 1065+ * resources pinned in @begin_cpu_access_umapped. 1066+ * The result of any dma_buf kmap calls after end_cpu_access_partial is 1067+ * undefined. 1068+ * 1069+ * This callback is optional. 1070+ * 1071+ * Returns: 1072+ * 1073+ * 0 on success or a negative error code on failure. Can return 1074+ * -ERESTARTSYS or -EINTR when the call has been interrupted and needs 1075+ * to be restarted. 1076+ */ 1077+ int (*end_cpu_access_partial)(struct dma_buf *dmabuf, 1078+ enum dma_data_direction, 1079+ unsigned int offset, unsigned int len); 1080+ 1081 /** 1082 * @mmap: 1083 * 1084@@ -267,6 +324,35 @@ struct dma_buf_ops { 1085 1086 void *(*vmap)(struct dma_buf *); 1087 void (*vunmap)(struct dma_buf *, void *vaddr); 1088+ 1089+ /** 1090+ * @get_uuid 1091+ * 1092+ * This is called by dma_buf_get_uuid to get the UUID which identifies 1093+ * the buffer to virtio devices. 1094+ * 1095+ * This callback is optional. 1096+ * 1097+ * Returns: 1098+ * 1099+ * 0 on success or a negative error code on failure. On success uuid 1100+ * will be populated with the buffer's UUID. 1101+ */ 1102+ int (*get_uuid)(struct dma_buf *dmabuf, uuid_t *uuid); 1103+ 1104+ /** 1105+ * @get_flags: 1106+ * 1107+ * This is called by dma_buf_get_flags and is used to get the buffer's 1108+ * flags. 1109+ * This callback is optional. 1110+ * 1111+ * Returns: 1112+ * 1113+ * 0 on success or a negative error code on failure. On success flags 1114+ * will be populated with the buffer's flags. 1115+ */ 1116+ int (*get_flags)(struct dma_buf *dmabuf, unsigned long *flags); 1117 }; 1118 1119 /** 1120@@ -297,6 +383,9 @@ struct dma_buf_ops { 1121 * @sysfs_entry: for exposing information about this buffer in sysfs. 1122 * The attachment_uid member of @sysfs_entry is protected by dma_resv lock 1123 * and is incremented on each attach. 1124+ * @mmap_count: number of times buffer has been mmapped. 1125+ * @exp_vm_ops: the vm ops provided by the buffer exporter. 1126+ * @vm_ops: the overridden vm_ops used to track mmap_count of the buffer. 1127 * 1128 * This represents a shared buffer, created by calling dma_buf_export(). The 1129 * userspace representation is a normal file descriptor, which can be created by 1130@@ -341,7 +430,12 @@ struct dma_buf { 1131 struct dma_buf_sysfs_entry { 1132 struct kobject kobj; 1133 struct dma_buf *dmabuf; 1134+ unsigned int attachment_uid; 1135+ struct kset *attach_stats_kset; 1136 } *sysfs_entry; 1137+ int mmap_count; 1138+ const struct vm_operations_struct *exp_vm_ops; 1139+ struct vm_operations_struct vm_ops; 1140 #endif 1141 }; 1142 1143@@ -392,6 +486,9 @@ struct dma_buf_attach_ops { 1144 * @importer_ops: importer operations for this attachment, if provided 1145 * dma_buf_map/unmap_attachment() must be called with the dma_resv lock held. 1146 * @importer_priv: importer specific attachment data. 1147+ * @dma_map_attrs: DMA attributes to be used when the exporter maps the buffer 1148+ * through dma_buf_map_attachment. 1149+ * @sysfs_entry: For exposing information about this attachment in sysfs. 1150 * 1151 * This structure holds the attachment information between the dma_buf buffer 1152 * and its user device(s). The list contains one attachment struct per device 1153@@ -412,6 +509,14 @@ struct dma_buf_attachment { 1154 const struct dma_buf_attach_ops *importer_ops; 1155 void *importer_priv; 1156 void *priv; 1157+ unsigned long dma_map_attrs; 1158+#ifdef CONFIG_DMABUF_SYSFS_STATS 1159+ /* for sysfs stats */ 1160+ struct dma_buf_attach_sysfs_entry { 1161+ struct kobject kobj; 1162+ unsigned int map_counter; 1163+ } *sysfs_entry; 1164+#endif 1165 }; 1166 1167 /** 1168@@ -489,6 +594,9 @@ dma_buf_attachment_is_dynamic(struct dma_buf_attachment *attach) 1169 return !!attach->importer_ops; 1170 } 1171 1172+int get_each_dmabuf(int (*callback)(const struct dma_buf *dmabuf, 1173+ void *private), void *private); 1174+int is_dma_buf_file(struct file *file); 1175 struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, 1176 struct device *dev); 1177 struct dma_buf_attachment * 1178@@ -513,13 +621,21 @@ void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *, 1179 void dma_buf_move_notify(struct dma_buf *dma_buf); 1180 int dma_buf_begin_cpu_access(struct dma_buf *dma_buf, 1181 enum dma_data_direction dir); 1182+int dma_buf_begin_cpu_access_partial(struct dma_buf *dma_buf, 1183+ enum dma_data_direction dir, 1184+ unsigned int offset, unsigned int len); 1185 int dma_buf_end_cpu_access(struct dma_buf *dma_buf, 1186 enum dma_data_direction dir); 1187+int dma_buf_end_cpu_access_partial(struct dma_buf *dma_buf, 1188+ enum dma_data_direction dir, 1189+ unsigned int offset, unsigned int len); 1190 1191 int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *, 1192 unsigned long); 1193 void *dma_buf_vmap(struct dma_buf *); 1194 void dma_buf_vunmap(struct dma_buf *, void *vaddr); 1195+int dma_buf_get_flags(struct dma_buf *dmabuf, unsigned long *flags); 1196+int dma_buf_get_uuid(struct dma_buf *dmabuf, uuid_t *uuid); 1197 1198 #ifdef CONFIG_DMABUF_PROCESS_INFO 1199 /** 1200diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h 1201index 09e23adb3..9f12efaaa 100644 1202--- a/include/linux/dma-fence.h 1203+++ b/include/linux/dma-fence.h 1204@@ -372,6 +372,9 @@ static inline void __dma_fence_might_wait(void) {} 1205 1206 int dma_fence_signal(struct dma_fence *fence); 1207 int dma_fence_signal_locked(struct dma_fence *fence); 1208+int dma_fence_signal_timestamp(struct dma_fence *fence, ktime_t timestamp); 1209+int dma_fence_signal_timestamp_locked(struct dma_fence *fence, 1210+ ktime_t timestamp); 1211 signed long dma_fence_default_wait(struct dma_fence *fence, 1212 bool intr, signed long timeout); 1213 int dma_fence_add_callback(struct dma_fence *fence, 1214diff --git a/include/linux/dma-heap.h b/include/linux/dma-heap.h 1215index 83b8cfb2d..e8f0e92c2 100644 1216--- a/include/linux/dma-heap.h 1217+++ b/include/linux/dma-heap.h 1218@@ -16,15 +16,17 @@ struct dma_heap; 1219 1220 /** 1221 * struct dma_heap_ops - ops to operate on a given heap 1222- * @allocate: allocate dmabuf and return fd 1223+ * @allocate: allocate dmabuf and return struct dma_buf ptr 1224+ * @get_pool_size: if heap maintains memory pools, get pool size in bytes 1225 * 1226- * allocate returns dmabuf fd on success, -errno on error. 1227+ * allocate returns dmabuf on success, ERR_PTR(-errno) on error. 1228 */ 1229 struct dma_heap_ops { 1230- int (*allocate)(struct dma_heap *heap, 1231+ struct dma_buf *(*allocate)(struct dma_heap *heap, 1232 unsigned long len, 1233 unsigned long fd_flags, 1234 unsigned long heap_flags); 1235+ long (*get_pool_size)(struct dma_heap *heap); 1236 }; 1237 1238 /** 1239@@ -50,6 +52,15 @@ struct dma_heap_export_info { 1240 */ 1241 void *dma_heap_get_drvdata(struct dma_heap *heap); 1242 1243+/** 1244+ * dma_heap_get_dev() - get device struct for the heap 1245+ * @heap: DMA-Heap to retrieve device struct from 1246+ * 1247+ * Returns: 1248+ * The device struct for the heap. 1249+ */ 1250+struct device *dma_heap_get_dev(struct dma_heap *heap); 1251+ 1252 /** 1253 * dma_heap_get_name() - get heap name 1254 * @heap: DMA-Heap to retrieve private data for 1255@@ -65,4 +76,49 @@ const char *dma_heap_get_name(struct dma_heap *heap); 1256 */ 1257 struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info); 1258 1259+/** 1260+ * dma_heap_put - drops a reference to a dmabuf heaps, potentially freeing it 1261+ * @heap: heap pointer 1262+ */ 1263+void dma_heap_put(struct dma_heap *heap); 1264+ 1265+/** 1266+ * dma_heap_find - Returns the registered dma_heap with the specified name 1267+ * @name: Name of the heap to find 1268+ * 1269+ * NOTE: dma_heaps returned from this function MUST be released 1270+ * using dma_heap_put() when the user is done. 1271+ */ 1272+struct dma_heap *dma_heap_find(const char *name); 1273+ 1274+/** 1275+ * dma_heap_buffer_alloc - Allocate dma-buf from a dma_heap 1276+ * @heap: dma_heap to allocate from 1277+ * @len: size to allocate 1278+ * @fd_flags: flags to set on returned dma-buf fd 1279+ * @heap_flags: flags to pass to the dma heap 1280+ * 1281+ * This is for internal dma-buf allocations only. 1282+ */ 1283+struct dma_buf *dma_heap_buffer_alloc(struct dma_heap *heap, size_t len, 1284+ unsigned int fd_flags, 1285+ unsigned int heap_flags); 1286+ 1287+/** dma_heap_buffer_free - Free dma_buf allocated by dma_heap_buffer_alloc 1288+ * @dma_buf: dma_buf to free 1289+ * 1290+ * This is really only a simple wrapper to dma_buf_put() 1291+ */ 1292+void dma_heap_buffer_free(struct dma_buf *); 1293+ 1294+/** 1295+ * dma_heap_bufferfd_alloc - Allocate dma-buf fd from a dma_heap 1296+ * @heap: dma_heap to allocate from 1297+ * @len: size to allocate 1298+ * @fd_flags: flags to set on returned dma-buf fd 1299+ * @heap_flags: flags to pass to the dma heap 1300+ */ 1301+int dma_heap_bufferfd_alloc(struct dma_heap *heap, size_t len, 1302+ unsigned int fd_flags, 1303+ unsigned int heap_flags); 1304 #endif /* _DMA_HEAPS_H */ 1305diff --git a/include/linux/dma-iommu.h b/include/linux/dma-iommu.h 1306index 2112f21f7..f51561eda 100644 1307--- a/include/linux/dma-iommu.h 1308+++ b/include/linux/dma-iommu.h 1309@@ -37,6 +37,11 @@ void iommu_dma_compose_msi_msg(struct msi_desc *desc, 1310 1311 void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list); 1312 1313+int iommu_dma_reserve_iova(struct device *dev, dma_addr_t base, 1314+ u64 size); 1315+ 1316+int iommu_dma_enable_best_fit_algo(struct device *dev); 1317+ 1318 #else /* CONFIG_IOMMU_DMA */ 1319 1320 struct iommu_domain; 1321@@ -78,5 +83,16 @@ static inline void iommu_dma_get_resv_regions(struct device *dev, struct list_he 1322 { 1323 } 1324 1325+static inline int iommu_dma_reserve_iova(struct device *dev, dma_addr_t base, 1326+ u64 size) 1327+{ 1328+ return -ENODEV; 1329+} 1330+ 1331+static inline int iommu_dma_enable_best_fit_algo(struct device *dev) 1332+{ 1333+ return -ENODEV; 1334+} 1335+ 1336 #endif /* CONFIG_IOMMU_DMA */ 1337 #endif /* __DMA_IOMMU_H */ 1338diff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h 1339index a5f89fc4d..a3ff9280f 100644 1340--- a/include/linux/dma-map-ops.h 1341+++ b/include/linux/dma-map-ops.h 1342@@ -258,6 +258,14 @@ void arch_dma_free(struct device *dev, size_t size, void *cpu_addr, 1343 #define pgprot_dmacoherent(prot) pgprot_noncached(prot) 1344 #endif 1345 1346+/* 1347+ * If there is no system cache pgprot, then fallback to dmacoherent 1348+ * pgprot, as the expectation is that the device is not coherent. 1349+ */ 1350+#ifndef pgprot_syscached 1351+#define pgprot_syscached(prot) pgprot_dmacoherent(prot) 1352+#endif 1353+ 1354 pgprot_t dma_pgprot(struct device *dev, pgprot_t prot, unsigned long attrs); 1355 #else 1356 static inline pgprot_t dma_pgprot(struct device *dev, pgprot_t prot, 1357diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h 1358index a7d70cdee..7270f12e2 100644 1359--- a/include/linux/dma-mapping.h 1360+++ b/include/linux/dma-mapping.h 1361@@ -61,6 +61,23 @@ 1362 */ 1363 #define DMA_ATTR_PRIVILEGED (1UL << 9) 1364 1365+/* 1366+ * DMA_ATTR_SYS_CACHE_ONLY: used to indicate that the buffer should be mapped 1367+ * with the correct memory attributes so that it can be cached in the system 1368+ * or last level cache. This is useful for buffers that are being mapped for 1369+ * devices that are non-coherent, but can use the system cache. 1370+ */ 1371+#define DMA_ATTR_SYS_CACHE_ONLY (1UL << 10) 1372+ 1373+/* 1374+ * DMA_ATTR_SYS_CACHE_ONLY_NWA: used to indicate that the buffer should be 1375+ * mapped with the correct memory attributes so that it can be cached in the 1376+ * system or last level cache, with a no write allocate cache policy. This is 1377+ * useful for buffers that are being mapped for devices that are non-coherent, 1378+ * but can use the system cache. 1379+ */ 1380+#define DMA_ATTR_SYS_CACHE_ONLY_NWA (1UL << 11) 1381+ 1382 /* 1383 * A dma_addr_t can hold any valid DMA or bus address for the platform. It can 1384 * be given to a device to use as a DMA source or target. It is specific to a 1385diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h 1386index dd357a747..493a047ed 100644 1387--- a/include/linux/dmaengine.h 1388+++ b/include/linux/dmaengine.h 1389@@ -418,6 +418,9 @@ enum dma_slave_buswidth { 1390 * @slave_id: Slave requester id. Only valid for slave channels. The dma 1391 * slave peripheral will have unique id as dma requester which need to be 1392 * pass as slave config. 1393+ * @peripheral_config: peripheral configuration for programming peripheral 1394+ * for dmaengine transfer 1395+ * @peripheral_size: peripheral configuration buffer size 1396 * 1397 * This struct is passed in as configuration data to a DMA engine 1398 * in order to set up a certain channel for DMA transport at runtime. 1399@@ -443,6 +446,8 @@ struct dma_slave_config { 1400 u32 dst_port_window_size; 1401 bool device_fc; 1402 unsigned int slave_id; 1403+ void *peripheral_config; 1404+ size_t peripheral_size; 1405 }; 1406 1407 /** 1408diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h 1409index 5f04a2b35..9ca1ea02f 100644 1410--- a/include/linux/energy_model.h 1411+++ b/include/linux/energy_model.h 1412@@ -29,6 +29,8 @@ struct em_perf_state { 1413 * em_perf_domain - Performance domain 1414 * @table: List of performance states, in ascending order 1415 * @nr_perf_states: Number of performance states 1416+ * @milliwatts: Flag indicating the power values are in milli-Watts 1417+ * or some other scale. 1418 * @cpus: Cpumask covering the CPUs of the domain. It's here 1419 * for performance reasons to avoid potential cache 1420 * misses during energy calculations in the scheduler 1421@@ -43,6 +45,7 @@ struct em_perf_state { 1422 struct em_perf_domain { 1423 struct em_perf_state *table; 1424 int nr_perf_states; 1425+ int milliwatts; 1426 unsigned long cpus[]; 1427 }; 1428 1429@@ -95,7 +98,8 @@ struct em_data_callback { 1430 struct em_perf_domain *em_cpu_get(int cpu); 1431 struct em_perf_domain *em_pd_get(struct device *dev); 1432 int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states, 1433- struct em_data_callback *cb, cpumask_t *span); 1434+ struct em_data_callback *cb, cpumask_t *span, 1435+ bool milliwatts); 1436 void em_dev_unregister_perf_domain(struct device *dev); 1437 1438 /** 1439@@ -119,6 +123,9 @@ static inline unsigned long em_cpu_energy(struct em_perf_domain *pd, 1440 struct em_perf_state *ps; 1441 int i, cpu; 1442 1443+ if (!sum_util) 1444+ return 0; 1445+ 1446 /* 1447 * In order to predict the performance state, map the utilization of 1448 * the most utilized CPU of the performance domain to a requested 1449@@ -202,7 +209,8 @@ struct em_data_callback {}; 1450 1451 static inline 1452 int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states, 1453- struct em_data_callback *cb, cpumask_t *span) 1454+ struct em_data_callback *cb, cpumask_t *span, 1455+ bool milliwatts) 1456 { 1457 return -EINVAL; 1458 } 1459diff --git a/include/linux/extcon.h b/include/linux/extcon.h 1460index 0c19010da..9c4ff7f7d 100644 1461--- a/include/linux/extcon.h 1462+++ b/include/linux/extcon.h 1463@@ -37,6 +37,7 @@ 1464 /* USB external connector */ 1465 #define EXTCON_USB 1 1466 #define EXTCON_USB_HOST 2 1467+#define EXTCON_USB_VBUS_EN 3 1468 1469 /* 1470 * Charging external connector 1471diff --git a/include/linux/freezer.h b/include/linux/freezer.h 1472index 27828145c..f753c307b 100644 1473--- a/include/linux/freezer.h 1474+++ b/include/linux/freezer.h 1475@@ -27,6 +27,11 @@ static inline bool frozen(struct task_struct *p) 1476 return p->flags & PF_FROZEN; 1477 } 1478 1479+static inline bool frozen_or_skipped(struct task_struct *p) 1480+{ 1481+ return p->flags & (PF_FROZEN | PF_FREEZER_SKIP); 1482+} 1483+ 1484 extern bool freezing_slow_path(struct task_struct *p); 1485 1486 /* 1487@@ -270,6 +275,7 @@ static inline int freezable_schedule_hrtimeout_range(ktime_t *expires, 1488 1489 #else /* !CONFIG_FREEZER */ 1490 static inline bool frozen(struct task_struct *p) { return false; } 1491+static inline bool frozen_or_skipped(struct task_struct *p) { return false; } 1492 static inline bool freezing(struct task_struct *p) { return false; } 1493 static inline void __thaw_task(struct task_struct *t) {} 1494 1495diff --git a/include/linux/iommu.h b/include/linux/iommu.h 1496index e90c267e7..f94cfde78 100644 1497--- a/include/linux/iommu.h 1498+++ b/include/linux/iommu.h 1499@@ -31,6 +31,26 @@ 1500 * if the IOMMU page table format is equivalent. 1501 */ 1502 #define IOMMU_PRIV (1 << 5) 1503+/* 1504+ * Non-coherent masters can use this page protection flag to set cacheable 1505+ * memory attributes for only a transparent outer level of cache, also known as 1506+ * the last-level or system cache. 1507+ */ 1508+#define IOMMU_SYS_CACHE_ONLY (1 << 6) 1509+/* 1510+ * Non-coherent masters can use this page protection flag to set cacheable 1511+ * memory attributes with a no write allocation cache policy for only a 1512+ * transparent outer level of cache, also known as the last-level or system 1513+ * cache. 1514+ */ 1515+#define IOMMU_SYS_CACHE_ONLY_NWA (1 << 7) 1516+ 1517+#ifdef CONFIG_NO_GKI 1518+ 1519+/* For shoting entire IOMMU tlb once */ 1520+#define IOMMU_TLB_SHOT_ENTIRE (1 << 8) 1521+ 1522+#endif 1523 1524 struct iommu_ops; 1525 struct iommu_group; 1526@@ -190,7 +210,12 @@ struct iommu_iotlb_gather { 1527 * @attach_dev: attach device to an iommu domain 1528 * @detach_dev: detach device from an iommu domain 1529 * @map: map a physically contiguous memory region to an iommu domain 1530+ * @map_pages: map a physically contiguous set of pages of the same size to 1531+ * an iommu domain. 1532+ * @map_sg: map a scatter-gather list of physically contiguous chunks to 1533+ * an iommu domain. 1534 * @unmap: unmap a physically contiguous memory region from an iommu domain 1535+ * @unmap_pages: unmap a number of pages of the same size from an iommu domain 1536 * @flush_iotlb_all: Synchronously flush all hardware TLBs for this domain 1537 * @iotlb_sync_map: Sync mappings created recently using @map to the hardware 1538 * @iotlb_sync: Flush all queued ranges from the hardware TLBs and empty flush 1539@@ -241,10 +266,20 @@ struct iommu_ops { 1540 void (*detach_dev)(struct iommu_domain *domain, struct device *dev); 1541 int (*map)(struct iommu_domain *domain, unsigned long iova, 1542 phys_addr_t paddr, size_t size, int prot, gfp_t gfp); 1543+ int (*map_pages)(struct iommu_domain *domain, unsigned long iova, 1544+ phys_addr_t paddr, size_t pgsize, size_t pgcount, 1545+ int prot, gfp_t gfp, size_t *mapped); 1546+ int (*map_sg)(struct iommu_domain *domain, unsigned long iova, 1547+ struct scatterlist *sg, unsigned int nents, int prot, 1548+ gfp_t gfp, size_t *mapped); 1549 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova, 1550 size_t size, struct iommu_iotlb_gather *iotlb_gather); 1551+ size_t (*unmap_pages)(struct iommu_domain *domain, unsigned long iova, 1552+ size_t pgsize, size_t pgcount, 1553+ struct iommu_iotlb_gather *iotlb_gather); 1554 void (*flush_iotlb_all)(struct iommu_domain *domain); 1555- void (*iotlb_sync_map)(struct iommu_domain *domain); 1556+ void (*iotlb_sync_map)(struct iommu_domain *domain, unsigned long iova, 1557+ size_t size); 1558 void (*iotlb_sync)(struct iommu_domain *domain, 1559 struct iommu_iotlb_gather *iotlb_gather); 1560 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova); 1561@@ -561,6 +596,8 @@ static inline void iommu_iotlb_gather_add_page(struct iommu_domain *domain, 1562 extern struct iommu_group *pci_device_group(struct device *dev); 1563 /* Generic device grouping function */ 1564 extern struct iommu_group *generic_device_group(struct device *dev); 1565+extern void rk_iommu_mask_irq(struct device *dev); 1566+extern void rk_iommu_unmask_irq(struct device *dev); 1567 /* FSL-MC device grouping function */ 1568 struct iommu_group *fsl_mc_device_group(struct device *dev); 1569 1570@@ -1069,6 +1106,14 @@ static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device *dev) 1571 { 1572 return NULL; 1573 } 1574+ 1575+static inline void rk_iommu_mask_irq(struct device *dev) 1576+{ 1577+} 1578+ 1579+static inline void rk_iommu_unmask_irq(struct device *dev) 1580+{ 1581+} 1582 #endif /* CONFIG_IOMMU_API */ 1583 1584 /** 1585diff --git a/include/linux/iova.h b/include/linux/iova.h 1586index a0637abff..58713bb72 100644 1587--- a/include/linux/iova.h 1588+++ b/include/linux/iova.h 1589@@ -95,6 +95,7 @@ struct iova_domain { 1590 flush-queues */ 1591 atomic_t fq_timer_on; /* 1 when timer is active, 0 1592 when not */ 1593+ bool best_fit; 1594 }; 1595 1596 static inline unsigned long iova_size(struct iova *iova) 1597diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h 1598index f6d092fdb..ffb0a8705 100644 1599--- a/include/linux/irqchip/arm-gic-v3.h 1600+++ b/include/linux/irqchip/arm-gic-v3.h 1601@@ -708,6 +708,8 @@ static inline bool gic_enable_sre(void) 1602 return !!(val & ICC_SRE_EL1_SRE); 1603 } 1604 1605+void gic_resume(void); 1606+ 1607 #endif 1608 1609 #endif 1610diff --git a/include/linux/irqchip/arm-gic-v4.h b/include/linux/irqchip/arm-gic-v4.h 1611index 6976b8331..943c3411c 100644 1612--- a/include/linux/irqchip/arm-gic-v4.h 1613+++ b/include/linux/irqchip/arm-gic-v4.h 1614@@ -39,6 +39,8 @@ struct its_vpe { 1615 irq_hw_number_t vpe_db_lpi; 1616 /* VPE resident */ 1617 bool resident; 1618+ /* VPT parse complete */ 1619+ bool ready; 1620 union { 1621 /* GICv4.0 implementations */ 1622 struct { 1623@@ -104,6 +106,7 @@ enum its_vcpu_info_cmd_type { 1624 PROP_UPDATE_AND_INV_VLPI, 1625 SCHEDULE_VPE, 1626 DESCHEDULE_VPE, 1627+ COMMIT_VPE, 1628 INVALL_VPE, 1629 PROP_UPDATE_VSGI, 1630 }; 1631@@ -129,6 +132,7 @@ int its_alloc_vcpu_irqs(struct its_vm *vm); 1632 void its_free_vcpu_irqs(struct its_vm *vm); 1633 int its_make_vpe_resident(struct its_vpe *vpe, bool g0en, bool g1en); 1634 int its_make_vpe_non_resident(struct its_vpe *vpe, bool db); 1635+int its_commit_vpe(struct its_vpe *vpe); 1636 int its_invall_vpe(struct its_vpe *vpe); 1637 int its_map_vlpi(int irq, struct its_vlpi_map *map); 1638 int its_get_vlpi(int irq, struct its_vlpi_map *map); 1639diff --git a/include/linux/memblock.h b/include/linux/memblock.h 1640index 3baea2ef3..2b770134c 100644 1641--- a/include/linux/memblock.h 1642+++ b/include/linux/memblock.h 1643@@ -25,6 +25,10 @@ extern unsigned long max_pfn; 1644 */ 1645 extern unsigned long long max_possible_pfn; 1646 1647+#ifdef CONFIG_ROCKCHIP_THUNDER_BOOT 1648+extern int defer_free_memblock(void *unused); 1649+#endif 1650+ 1651 /** 1652 * enum memblock_flags - definition of memory region attributes 1653 * @MEMBLOCK_NONE: no special request 1654@@ -404,13 +408,13 @@ void *memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, 1655 phys_addr_t min_addr, phys_addr_t max_addr, 1656 int nid); 1657 1658-static inline void * __init memblock_alloc(phys_addr_t size, phys_addr_t align) 1659+static __always_inline void *memblock_alloc(phys_addr_t size, phys_addr_t align) 1660 { 1661 return memblock_alloc_try_nid(size, align, MEMBLOCK_LOW_LIMIT, 1662 MEMBLOCK_ALLOC_ACCESSIBLE, NUMA_NO_NODE); 1663 } 1664 1665-static inline void * __init memblock_alloc_raw(phys_addr_t size, 1666+static inline void *memblock_alloc_raw(phys_addr_t size, 1667 phys_addr_t align) 1668 { 1669 return memblock_alloc_try_nid_raw(size, align, MEMBLOCK_LOW_LIMIT, 1670@@ -418,7 +422,7 @@ static inline void * __init memblock_alloc_raw(phys_addr_t size, 1671 NUMA_NO_NODE); 1672 } 1673 1674-static inline void * __init memblock_alloc_from(phys_addr_t size, 1675+static inline void *memblock_alloc_from(phys_addr_t size, 1676 phys_addr_t align, 1677 phys_addr_t min_addr) 1678 { 1679@@ -426,33 +430,33 @@ static inline void * __init memblock_alloc_from(phys_addr_t size, 1680 MEMBLOCK_ALLOC_ACCESSIBLE, NUMA_NO_NODE); 1681 } 1682 1683-static inline void * __init memblock_alloc_low(phys_addr_t size, 1684+static inline void *memblock_alloc_low(phys_addr_t size, 1685 phys_addr_t align) 1686 { 1687 return memblock_alloc_try_nid(size, align, MEMBLOCK_LOW_LIMIT, 1688 ARCH_LOW_ADDRESS_LIMIT, NUMA_NO_NODE); 1689 } 1690 1691-static inline void * __init memblock_alloc_node(phys_addr_t size, 1692+static inline void *memblock_alloc_node(phys_addr_t size, 1693 phys_addr_t align, int nid) 1694 { 1695 return memblock_alloc_try_nid(size, align, MEMBLOCK_LOW_LIMIT, 1696 MEMBLOCK_ALLOC_ACCESSIBLE, nid); 1697 } 1698 1699-static inline void __init memblock_free_early(phys_addr_t base, 1700+static inline void memblock_free_early(phys_addr_t base, 1701 phys_addr_t size) 1702 { 1703 memblock_free(base, size); 1704 } 1705 1706-static inline void __init memblock_free_early_nid(phys_addr_t base, 1707+static inline void memblock_free_early_nid(phys_addr_t base, 1708 phys_addr_t size, int nid) 1709 { 1710 memblock_free(base, size); 1711 } 1712 1713-static inline void __init memblock_free_late(phys_addr_t base, phys_addr_t size) 1714+static inline void memblock_free_late(phys_addr_t base, phys_addr_t size) 1715 { 1716 __memblock_free_late(base, size); 1717 } 1718@@ -460,7 +464,7 @@ static inline void __init memblock_free_late(phys_addr_t base, phys_addr_t size) 1719 /* 1720 * Set the allocation direction to bottom-up or top-down. 1721 */ 1722-static inline void __init memblock_set_bottom_up(bool enable) 1723+static inline __init void memblock_set_bottom_up(bool enable) 1724 { 1725 memblock.bottom_up = enable; 1726 } 1727@@ -470,7 +474,7 @@ static inline void __init memblock_set_bottom_up(bool enable) 1728 * if this is true, that said, memblock will allocate memory 1729 * in bottom-up direction. 1730 */ 1731-static inline bool memblock_bottom_up(void) 1732+static inline __init bool memblock_bottom_up(void) 1733 { 1734 return memblock.bottom_up; 1735 } 1736diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h 1737index e07f6e61c..7cdc5dfa4 100644 1738--- a/include/linux/mfd/rk808.h 1739+++ b/include/linux/mfd/rk808.h 1740@@ -113,6 +113,235 @@ enum rk808_reg { 1741 #define RK808_INT_STS_MSK_REG2 0x4f 1742 #define RK808_IO_POL_REG 0x50 1743 1744+/* RK816 */ 1745+enum rk816_reg { 1746+ RK816_ID_DCDC1, 1747+ RK816_ID_DCDC2, 1748+ RK816_ID_DCDC3, 1749+ RK816_ID_DCDC4, 1750+ RK816_ID_LDO1, 1751+ RK816_ID_LDO2, 1752+ RK816_ID_LDO3, 1753+ RK816_ID_LDO4, 1754+ RK816_ID_LDO5, 1755+ RK816_ID_LDO6, 1756+}; 1757+ 1758+/*VERSION REGISTER*/ 1759+#define RK816_CHIP_NAME_REG 0x17 1760+#define RK816_CHIP_VER_REG 0x18 1761+#define RK816_OTP_VER_REG 0x19 1762+#define RK816_NUM_REGULATORS 10 1763+ 1764+/*POWER ON/OFF REGISTER*/ 1765+#define RK816_VB_MON_REG 0x21 1766+#define RK816_THERMAL_REG 0x22 1767+#define RK816_PWRON_LP_INT_TIME_REG 0x47 1768+#define RK816_PWRON_DB_REG 0x48 1769+#define RK816_DEV_CTRL_REG 0x4B 1770+#define RK816_ON_SOURCE_REG 0xAE 1771+#define RK816_OFF_SOURCE_REG 0xAF 1772+ 1773+/*POWER CHANNELS ENABLE REGISTER*/ 1774+#define RK816_DCDC_EN_REG1 0x23 1775+#define RK816_DCDC_EN_REG2 0x24 1776+#define RK816_SLP_DCDC_EN_REG 0x25 1777+#define RK816_SLP_LDO_EN_REG 0x26 1778+#define RK816_LDO_EN_REG1 0x27 1779+#define RK816_LDO_EN_REG2 0x28 1780+ 1781+/*BUCK AND LDO CONFIG REGISTER*/ 1782+#define RK816_BUCK1_CONFIG_REG 0x2E 1783+#define RK816_BUCK1_ON_VSEL_REG 0x2F 1784+#define RK816_BUCK1_SLP_VSEL_REG 0x30 1785+#define RK816_BUCK2_CONFIG_REG 0x32 1786+#define RK816_BUCK2_ON_VSEL_REG 0x33 1787+#define RK816_BUCK2_SLP_VSEL_REG 0x34 1788+#define RK816_BUCK3_CONFIG_REG 0x36 1789+#define RK816_BUCK4_CONFIG_REG 0x37 1790+#define RK816_BUCK4_ON_VSEL_REG 0x38 1791+#define RK816_BUCK4_SLP_VSEL_REG 0x39 1792+#define RK816_LDO1_ON_VSEL_REG 0x3B 1793+#define RK816_LDO1_SLP_VSEL_REG 0x3C 1794+#define RK816_LDO2_ON_VSEL_REG 0x3D 1795+#define RK816_LDO2_SLP_VSEL_REG 0x3E 1796+#define RK816_LDO3_ON_VSEL_REG 0x3F 1797+#define RK816_LDO3_SLP_VSEL_REG 0x40 1798+#define RK816_LDO4_ON_VSEL_REG 0x41 1799+#define RK816_LDO4_SLP_VSEL_REG 0x42 1800+#define RK816_LDO5_ON_VSEL_REG 0x43 1801+#define RK816_LDO5_SLP_VSEL_REG 0x44 1802+#define RK816_LDO6_ON_VSEL_REG 0x45 1803+#define RK816_LDO6_SLP_VSEL_REG 0x46 1804+#define RK816_GPIO_IO_POL_REG 0x50 1805+ 1806+/*CHARGER BOOST AND OTG REGISTER*/ 1807+#define RK816_OTG_BUCK_LDO_CONFIG_REG 0x2A 1808+#define RK816_CHRG_CONFIG_REG 0x2B 1809+#define RK816_BOOST_ON_VESL_REG 0x54 1810+#define RK816_BOOST_SLP_VSEL_REG 0x55 1811+#define RK816_CHRG_BOOST_CONFIG_REG 0x9A 1812+#define RK816_SUP_STS_REG 0xA0 1813+#define RK816_USB_CTRL_REG 0xA1 1814+#define RK816_CHRG_CTRL_REG1 0xA3 1815+#define RK816_CHRG_CTRL_REG2 0xA4 1816+#define RK816_CHRG_CTRL_REG3 0xA5 1817+#define RK816_BAT_CTRL_REG 0xA6 1818+#define RK816_BAT_HTS_TS_REG 0xA8 1819+#define RK816_BAT_LTS_TS_REG 0xA9 1820+ 1821+#define RK816_TS_CTRL_REG 0xAC 1822+#define RK816_ADC_CTRL_REG 0xAD 1823+#define RK816_GGCON_REG 0xB0 1824+#define RK816_GGSTS_REG 0xB1 1825+#define RK816_ZERO_CUR_ADC_REGH 0xB2 1826+#define RK816_ZERO_CUR_ADC_REGL 0xB3 1827+#define RK816_GASCNT_CAL_REG3 0xB4 1828+#define RK816_GASCNT_CAL_REG2 0xB5 1829+#define RK816_GASCNT_CAL_REG1 0xB6 1830+#define RK816_GASCNT_CAL_REG0 0xB7 1831+#define RK816_GASCNT_REG3 0xB8 1832+#define RK816_GASCNT_REG2 0xB9 1833+#define RK816_GASCNT_REG1 0xBA 1834+#define RK816_GASCNT_REG0 0xBB 1835+#define RK816_BAT_CUR_AVG_REGH 0xBC 1836+#define RK816_BAT_CUR_AVG_REGL 0xBD 1837+#define RK816_TS_ADC_REGH 0xBE 1838+#define RK816_TS_ADC_REGL 0xBF 1839+#define RK816_USB_ADC_REGH 0xC0 1840+#define RK816_USB_ADC_REGL 0xC1 1841+#define RK816_BAT_OCV_REGH 0xC2 1842+#define RK816_BAT_OCV_REGL 0xC3 1843+#define RK816_BAT_VOL_REGH 0xC4 1844+#define RK816_BAT_VOL_REGL 0xC5 1845+#define RK816_RELAX_ENTRY_THRES_REGH 0xC6 1846+#define RK816_RELAX_ENTRY_THRES_REGL 0xC7 1847+#define RK816_RELAX_EXIT_THRES_REGH 0xC8 1848+#define RK816_RELAX_EXIT_THRES_REGL 0xC9 1849+#define RK816_RELAX_VOL1_REGH 0xCA 1850+#define RK816_RELAX_VOL1_REGL 0xCB 1851+#define RK816_RELAX_VOL2_REGH 0xCC 1852+#define RK816_RELAX_VOL2_REGL 0xCD 1853+#define RK816_RELAX_CUR1_REGH 0xCE 1854+#define RK816_RELAX_CUR1_REGL 0xCF 1855+#define RK816_RELAX_CUR2_REGH 0xD0 1856+#define RK816_RELAX_CUR2_REGL 0xD1 1857+#define RK816_CAL_OFFSET_REGH 0xD2 1858+#define RK816_CAL_OFFSET_REGL 0xD3 1859+#define RK816_NON_ACT_TIMER_CNT_REG 0xD4 1860+#define RK816_VCALIB0_REGH 0xD5 1861+#define RK816_VCALIB0_REGL 0xD6 1862+#define RK816_VCALIB1_REGH 0xD7 1863+#define RK816_VCALIB1_REGL 0xD8 1864+#define RK816_FCC_GASCNT_REG3 0xD9 1865+#define RK816_FCC_GASCNT_REG2 0xDA 1866+#define RK816_FCC_GASCNT_REG1 0xDB 1867+#define RK816_FCC_GASCNT_REG0 0xDC 1868+#define RK816_IOFFSET_REGH 0xDD 1869+#define RK816_IOFFSET_REGL 0xDE 1870+#define RK816_SLEEP_CON_SAMP_CUR_REG 0xDF 1871+ 1872+/*DATA REGISTER*/ 1873+#define RK816_SOC_REG 0xE0 1874+#define RK816_REMAIN_CAP_REG3 0xE1 1875+#define RK816_REMAIN_CAP_REG2 0xE2 1876+#define RK816_REMAIN_CAP_REG1 0xE3 1877+#define RK816_REMAIN_CAP_REG0 0xE4 1878+#define RK816_UPDATE_LEVE_REG 0xE5 1879+#define RK816_NEW_FCC_REG3 0xE6 1880+#define RK816_NEW_FCC_REG2 0xE7 1881+#define RK816_NEW_FCC_REG1 0xE8 1882+#define RK816_NEW_FCC_REG0 0xE9 1883+#define RK816_NON_ACT_TIMER_CNT_REG_SAVE 0xEA 1884+#define RK816_OCV_VOL_VALID_REG 0xEB 1885+#define RK816_REBOOT_CNT_REG 0xEC 1886+#define RK816_PCB_IOFFSET_REG 0xED 1887+#define RK816_MISC_MARK_REG 0xEE 1888+#define RK816_HALT_CNT_REG 0xEF 1889+#define RK816_CALC_REST_REGH 0xF0 1890+#define RK816_CALC_REST_REGL 0xF1 1891+#define DATA18_REG 0xF2 1892+ 1893+/*INTERRUPT REGISTER*/ 1894+#define RK816_INT_STS_REG1 0x49 1895+#define RK816_INT_STS_MSK_REG1 0x4A 1896+#define RK816_INT_STS_REG2 0x4C 1897+#define RK816_INT_STS_MSK_REG2 0x4D 1898+#define RK816_INT_STS_REG3 0x4E 1899+#define RK816_INT_STS_MSK_REG3 0x4F 1900+#define RK816_GPIO_IO_POL_REG 0x50 1901+ 1902+#define RK816_DATA18_REG 0xF2 1903+ 1904+/* IRQ Definitions */ 1905+#define RK816_IRQ_PWRON_FALL 0 1906+#define RK816_IRQ_PWRON_RISE 1 1907+#define RK816_IRQ_VB_LOW 2 1908+#define RK816_IRQ_PWRON 3 1909+#define RK816_IRQ_PWRON_LP 4 1910+#define RK816_IRQ_HOTDIE 5 1911+#define RK816_IRQ_RTC_ALARM 6 1912+#define RK816_IRQ_RTC_PERIOD 7 1913+#define RK816_IRQ_USB_OV 8 1914+#define RK816_IRQ_PLUG_IN 9 1915+#define RK816_IRQ_PLUG_OUT 10 1916+#define RK816_IRQ_CHG_OK 11 1917+#define RK816_IRQ_CHG_TE 12 1918+#define RK816_IRQ_CHG_TS 13 1919+#define RK816_IRQ_CHG_CVTLIM 14 1920+#define RK816_IRQ_DISCHG_ILIM 15 1921+ 1922+#define RK816_IRQ_PWRON_FALL_MSK BIT(5) 1923+#define RK816_IRQ_PWRON_RISE_MSK BIT(6) 1924+#define RK816_IRQ_VB_LOW_MSK BIT(1) 1925+#define RK816_IRQ_PWRON_MSK BIT(2) 1926+#define RK816_IRQ_PWRON_LP_MSK BIT(3) 1927+#define RK816_IRQ_HOTDIE_MSK BIT(4) 1928+#define RK816_IRQ_RTC_ALARM_MSK BIT(5) 1929+#define RK816_IRQ_RTC_PERIOD_MSK BIT(6) 1930+#define RK816_IRQ_USB_OV_MSK BIT(7) 1931+#define RK816_IRQ_PLUG_IN_MSK BIT(0) 1932+#define RK816_IRQ_PLUG_OUT_MSK BIT(1) 1933+#define RK816_IRQ_CHG_OK_MSK BIT(2) 1934+#define RK816_IRQ_CHG_TE_MSK BIT(3) 1935+#define RK816_IRQ_CHG_TS_MSK BIT(4) 1936+#define RK816_IRQ_CHG_CVTLIM_MSK BIT(6) 1937+#define RK816_IRQ_DISCHG_ILIM_MSK BIT(7) 1938+ 1939+#define RK816_VBAT_LOW_2V8 0x00 1940+#define RK816_VBAT_LOW_2V9 0x01 1941+#define RK816_VBAT_LOW_3V0 0x02 1942+#define RK816_VBAT_LOW_3V1 0x03 1943+#define RK816_VBAT_LOW_3V2 0x04 1944+#define RK816_VBAT_LOW_3V3 0x05 1945+#define RK816_VBAT_LOW_3V4 0x06 1946+#define RK816_VBAT_LOW_3V5 0x07 1947+#define RK816_PWR_FALL_INT_STATUS (0x1 << 5) 1948+#define RK816_PWR_RISE_INT_STATUS (0x1 << 6) 1949+#define RK816_ALARM_INT_STATUS (0x1 << 5) 1950+#define EN_VBAT_LOW_IRQ (0x1 << 4) 1951+#define VBAT_LOW_ACT_MASK (0x1 << 4) 1952+#define RTC_TIMER_ALARM_INT_MSK (0x3 << 2) 1953+#define RTC_TIMER_ALARM_INT_DIS (0x0 << 2) 1954+#define RTC_PERIOD_ALARM_INT_MSK (0x3 << 5) 1955+#define RTC_PERIOD_ALARM_INT_ST (0x3 << 5) 1956+#define RTC_PERIOD_ALARM_INT_DIS (0x3 << 5) 1957+#define RTC_PERIOD_ALARM_INT_EN (0x9f) 1958+#define REG_WRITE_MSK 0xff 1959+#define BUCK4_MAX_ILIMIT 0x2c 1960+#define BUCK_RATE_MSK (0x3 << 3) 1961+#define BUCK_RATE_12_5MV_US (0x2 << 3) 1962+#define ALL_INT_FLAGS_ST 0xff 1963+#define PLUGIN_OUT_INT_EN 0xfc 1964+#define RK816_PWRON_FALL_RISE_INT_EN 0x9f 1965+#define BUCK1_2_IMAX_MAX (0x3 << 6) 1966+#define BUCK3_4_IMAX_MAX (0x3 << 3) 1967+#define BOOST_DISABLE ((0x1 << 5) | (0x0 << 1)) 1968+#define BUCK4_VRP_3PERCENT 0xc0 1969+#define RK816_BUCK_DVS_CONFIRM (0x1 << 7) 1970+#define RK816_TYPE_ES2 0x05 1971+#define RK816_CHIP_VERSION_MASK 0x0f 1972+ 1973 /* RK818 */ 1974 #define RK818_DCDC1 0 1975 #define RK818_LDO1 4 1976@@ -138,6 +367,8 @@ enum rk818_reg { 1977 RK818_ID_OTG_SWITCH, 1978 }; 1979 1980+#define RK818_VB_MON_REG 0x21 1981+#define RK818_THERMAL_REG 0x22 1982 #define RK818_DCDC_EN_REG 0x23 1983 #define RK818_LDO_EN_REG 0x24 1984 #define RK818_SLEEP_SET_OFF_REG1 0x25 1985@@ -190,7 +421,84 @@ enum rk818_reg { 1986 #define RK818_BOOST_LDO9_SLP_VSEL_REG 0x55 1987 #define RK818_BOOST_CTRL_REG 0x56 1988 #define RK818_DCDC_ILMAX 0x90 1989+#define RK818_CHRG_COMP_REG 0x9a 1990+#define RK818_SUP_STS_REG 0xa0 1991 #define RK818_USB_CTRL_REG 0xa1 1992+#define RK818_CHRG_CTRL_REG1 0xa3 1993+#define RK818_CHRG_CTRL_REG2 0xa4 1994+#define RK818_CHRG_CTRL_REG3 0xa5 1995+#define RK818_BAT_CTRL_REG 0xa6 1996+#define RK818_BAT_HTS_TS1_REG 0xa8 1997+#define RK818_BAT_LTS_TS1_REG 0xa9 1998+#define RK818_BAT_HTS_TS2_REG 0xaa 1999+#define RK818_BAT_LTS_TS2_REG 0xab 2000+#define RK818_TS_CTRL_REG 0xac 2001+#define RK818_ADC_CTRL_REG 0xad 2002+#define RK818_ON_SOURCE_REG 0xae 2003+#define RK818_OFF_SOURCE_REG 0xaf 2004+#define RK818_GGCON_REG 0xb0 2005+#define RK818_GGSTS_REG 0xb1 2006+#define RK818_FRAME_SMP_INTERV_REG 0xb2 2007+#define RK818_AUTO_SLP_CUR_THR_REG 0xb3 2008+#define RK818_GASCNT_CAL_REG3 0xb4 2009+#define RK818_GASCNT_CAL_REG2 0xb5 2010+#define RK818_GASCNT_CAL_REG1 0xb6 2011+#define RK818_GASCNT_CAL_REG0 0xb7 2012+#define RK818_GASCNT3_REG 0xb8 2013+#define RK818_GASCNT2_REG 0xb9 2014+#define RK818_GASCNT1_REG 0xba 2015+#define RK818_GASCNT0_REG 0xbb 2016+#define RK818_BAT_CUR_AVG_REGH 0xbc 2017+#define RK818_BAT_CUR_AVG_REGL 0xbd 2018+#define RK818_TS1_ADC_REGH 0xbe 2019+#define RK818_TS1_ADC_REGL 0xbf 2020+#define RK818_TS2_ADC_REGH 0xc0 2021+#define RK818_TS2_ADC_REGL 0xc1 2022+#define RK818_BAT_OCV_REGH 0xc2 2023+#define RK818_BAT_OCV_REGL 0xc3 2024+#define RK818_BAT_VOL_REGH 0xc4 2025+#define RK818_BAT_VOL_REGL 0xc5 2026+#define RK818_RELAX_ENTRY_THRES_REGH 0xc6 2027+#define RK818_RELAX_ENTRY_THRES_REGL 0xc7 2028+#define RK818_RELAX_EXIT_THRES_REGH 0xc8 2029+#define RK818_RELAX_EXIT_THRES_REGL 0xc9 2030+#define RK818_RELAX_VOL1_REGH 0xca 2031+#define RK818_RELAX_VOL1_REGL 0xcb 2032+#define RK818_RELAX_VOL2_REGH 0xcc 2033+#define RK818_RELAX_VOL2_REGL 0xcd 2034+#define RK818_BAT_CUR_R_CALC_REGH 0xce 2035+#define RK818_BAT_CUR_R_CALC_REGL 0xcf 2036+#define RK818_BAT_VOL_R_CALC_REGH 0xd0 2037+#define RK818_BAT_VOL_R_CALC_REGL 0xd1 2038+#define RK818_CAL_OFFSET_REGH 0xd2 2039+#define RK818_CAL_OFFSET_REGL 0xd3 2040+#define RK818_NON_ACT_TIMER_CNT_REG 0xd4 2041+#define RK818_VCALIB0_REGH 0xd5 2042+#define RK818_VCALIB0_REGL 0xd6 2043+#define RK818_VCALIB1_REGH 0xd7 2044+#define RK818_VCALIB1_REGL 0xd8 2045+#define RK818_IOFFSET_REGH 0xdd 2046+#define RK818_IOFFSET_REGL 0xde 2047+#define RK818_SOC_REG 0xe0 2048+#define RK818_REMAIN_CAP_REG3 0xe1 2049+#define RK818_REMAIN_CAP_REG2 0xe2 2050+#define RK818_REMAIN_CAP_REG1 0xe3 2051+#define RK818_REMAIN_CAP_REG0 0xe4 2052+#define RK818_UPDAT_LEVE_REG 0xe5 2053+#define RK818_NEW_FCC_REG3 0xe6 2054+#define RK818_NEW_FCC_REG2 0xe7 2055+#define RK818_NEW_FCC_REG1 0xe8 2056+#define RK818_NEW_FCC_REG0 0xe9 2057+#define RK818_NON_ACT_TIMER_CNT_SAVE_REG 0xea 2058+#define RK818_OCV_VOL_VALID_REG 0xeb 2059+#define RK818_REBOOT_CNT_REG 0xec 2060+#define RK818_POFFSET_REG 0xed 2061+#define RK818_MISC_MARK_REG 0xee 2062+#define RK818_HALT_CNT_REG 0xef 2063+#define RK818_CALC_REST_REGH 0xf0 2064+#define RK818_CALC_REST_REGL 0xf1 2065+#define RK818_SAVE_DATA19 0xf2 2066+#define RK818_NUM_REGULATOR 17 2067 2068 #define RK818_H5V_EN BIT(0) 2069 #define RK818_REF_RDY_CTRL BIT(1) 2070@@ -255,14 +563,22 @@ enum rk805_reg { 2071 #define RK805_PWRON_FALL_RISE_INT_MSK 0x81 2072 2073 /* RK805 IRQ Definitions */ 2074-#define RK805_IRQ_PWRON_RISE 0 2075 #define RK805_IRQ_VB_LOW 1 2076 #define RK805_IRQ_PWRON 2 2077 #define RK805_IRQ_PWRON_LP 3 2078 #define RK805_IRQ_HOTDIE 4 2079 #define RK805_IRQ_RTC_ALARM 5 2080 #define RK805_IRQ_RTC_PERIOD 6 2081-#define RK805_IRQ_PWRON_FALL 7 2082+ 2083+/* 2084+ * When PMIC irq occurs, regmap-irq.c will traverse all PMIC child 2085+ * interrupts from low index 0 to high index, we give fall interrupt 2086+ * high priority to be called earlier than rise, so that it can be 2087+ * override by late rise event. This can helps to solve key release 2088+ * glitch which make a wrongly fall event immediately after rise. 2089+ */ 2090+#define RK805_IRQ_PWRON_FALL 0 2091+#define RK805_IRQ_PWRON_RISE 7 2092 2093 #define RK805_IRQ_PWRON_RISE_MSK BIT(0) 2094 #define RK805_IRQ_VB_LOW_MSK BIT(1) 2095@@ -289,6 +605,16 @@ enum rk805_reg { 2096 #define RK805_INT_ALARM_EN (1 << 3) 2097 #define RK805_INT_TIMER_EN (1 << 2) 2098 2099+#define RK805_SLP_LDO_EN_OFFSET -1 2100+#define RK805_SLP_DCDC_EN_OFFSET 2 2101+ 2102+#define RK805_RAMP_RATE_OFFSET 3 2103+#define RK805_RAMP_RATE_MASK (3 << RK805_RAMP_RATE_OFFSET) 2104+#define RK805_RAMP_RATE_3MV_PER_US (0 << RK805_RAMP_RATE_OFFSET) 2105+#define RK805_RAMP_RATE_6MV_PER_US (1 << RK805_RAMP_RATE_OFFSET) 2106+#define RK805_RAMP_RATE_12_5MV_PER_US (2 << RK805_RAMP_RATE_OFFSET) 2107+#define RK805_RAMP_RATE_25MV_PER_US (3 << RK805_RAMP_RATE_OFFSET) 2108+ 2109 /* RK808 IRQ Definitions */ 2110 #define RK808_IRQ_VOUT_LO 0 2111 #define RK808_IRQ_VB_LO 1 2112@@ -348,6 +674,107 @@ enum rk805_reg { 2113 2114 #define RK818_NUM_IRQ 16 2115 2116+/*RK818_DCDC_EN_REG*/ 2117+#define BUCK1_EN_MASK BIT(0) 2118+#define BUCK2_EN_MASK BIT(1) 2119+#define BUCK3_EN_MASK BIT(2) 2120+#define BUCK4_EN_MASK BIT(3) 2121+#define BOOST_EN_MASK BIT(4) 2122+#define LDO9_EN_MASK BIT(5) 2123+#define SWITCH_EN_MASK BIT(6) 2124+#define OTG_EN_MASK BIT(7) 2125+ 2126+#define BUCK1_EN_ENABLE BIT(0) 2127+#define BUCK2_EN_ENABLE BIT(1) 2128+#define BUCK3_EN_ENABLE BIT(2) 2129+#define BUCK4_EN_ENABLE BIT(3) 2130+#define BOOST_EN_ENABLE BIT(4) 2131+#define LDO9_EN_ENABLE BIT(5) 2132+#define SWITCH_EN_ENABLE BIT(6) 2133+#define OTG_EN_ENABLE BIT(7) 2134+ 2135+#define BUCK1_SLP_SET_MASK BIT(0) 2136+#define BUCK2_SLP_SET_MASK BIT(1) 2137+#define BUCK3_SLP_SET_MASK BIT(2) 2138+#define BUCK4_SLP_SET_MASK BIT(3) 2139+#define BOOST_SLP_SET_MASK BIT(4) 2140+#define LDO9_SLP_SET_MASK BIT(5) 2141+#define SWITCH_SLP_SET_MASK BIT(6) 2142+#define OTG_SLP_SET_MASK BIT(7) 2143+ 2144+#define BUCK1_SLP_SET_OFF BIT(0) 2145+#define BUCK2_SLP_SET_OFF BIT(1) 2146+#define BUCK3_SLP_SET_OFF BIT(2) 2147+#define BUCK4_SLP_SET_OFF BIT(3) 2148+#define BOOST_SLP_SET_OFF BIT(4) 2149+#define LDO9_SLP_SET_OFF BIT(5) 2150+#define SWITCH_SLP_SET_OFF BIT(6) 2151+#define OTG_SLP_SET_OFF BIT(7) 2152+#define OTG_BOOST_SLP_OFF (BOOST_SLP_SET_OFF | OTG_SLP_SET_OFF) 2153+ 2154+#define BUCK1_SLP_SET_ON BIT(0) 2155+#define BUCK2_SLP_SET_ON BIT(1) 2156+#define BUCK3_SLP_SET_ON BIT(2) 2157+#define BUCK4_SLP_SET_ON BIT(3) 2158+#define BOOST_SLP_SET_ON BIT(4) 2159+#define LDO9_SLP_SET_ON BIT(5) 2160+#define SWITCH_SLP_SET_ON BIT(6) 2161+#define OTG_SLP_SET_ON BIT(7) 2162+ 2163+#define VOUT_LO_MASK BIT(0) 2164+#define VB_LO_MASK BIT(1) 2165+#define PWRON_MASK BIT(2) 2166+#define PWRON_LP_MASK BIT(3) 2167+#define HOTDIE_MASK BIT(4) 2168+#define RTC_ALARM_MASK BIT(5) 2169+#define RTC_PERIOD_MASK BIT(6) 2170+#define USB_OV_MASK BIT(7) 2171+ 2172+#define VOUT_LO_DISABLE BIT(0) 2173+#define VB_LO_DISABLE BIT(1) 2174+#define PWRON_DISABLE BIT(2) 2175+#define PWRON_LP_DISABLE BIT(3) 2176+#define HOTDIE_DISABLE BIT(4) 2177+#define RTC_ALARM_DISABLE BIT(5) 2178+#define RTC_PERIOD_DISABLE BIT(6) 2179+#define USB_OV_INT_DISABLE BIT(7) 2180+ 2181+#define VOUT_LO_ENABLE (0 << 0) 2182+#define VB_LO_ENABLE (0 << 1) 2183+#define PWRON_ENABLE (0 << 2) 2184+#define PWRON_LP_ENABLE (0 << 3) 2185+#define HOTDIE_ENABLE (0 << 4) 2186+#define RTC_ALARM_ENABLE (0 << 5) 2187+#define RTC_PERIOD_ENABLE (0 << 6) 2188+#define USB_OV_INT_ENABLE (0 << 7) 2189+ 2190+#define PLUG_IN_MASK BIT(0) 2191+#define PLUG_OUT_MASK BIT(1) 2192+#define CHGOK_MASK BIT(2) 2193+#define CHGTE_MASK BIT(3) 2194+#define CHGTS1_MASK BIT(4) 2195+#define TS2_MASK BIT(5) 2196+#define CHG_CVTLIM_MASK BIT(6) 2197+#define DISCHG_ILIM_MASK BIT(7) 2198+ 2199+#define PLUG_IN_DISABLE BIT(0) 2200+#define PLUG_OUT_DISABLE BIT(1) 2201+#define CHGOK_DISABLE BIT(2) 2202+#define CHGTE_DISABLE BIT(3) 2203+#define CHGTS1_DISABLE BIT(4) 2204+#define TS2_DISABLE BIT(5) 2205+#define CHG_CVTLIM_DISABLE BIT(6) 2206+#define DISCHG_ILIM_DISABLE BIT(7) 2207+ 2208+#define PLUG_IN_ENABLE BIT(0) 2209+#define PLUG_OUT_ENABLE BIT(1) 2210+#define CHGOK_ENABLE BIT(2) 2211+#define CHGTE_ENABLE BIT(3) 2212+#define CHGTS1_ENABLE BIT(4) 2213+#define TS2_ENABLE BIT(5) 2214+#define CHG_CVTLIM_ENABLE BIT(6) 2215+#define DISCHG_ILIM_ENABLE BIT(7) 2216+ 2217 #define RK808_VBAT_LOW_2V8 0x00 2218 #define RK808_VBAT_LOW_2V9 0x01 2219 #define RK808_VBAT_LOW_3V0 0x02 2220@@ -381,7 +808,10 @@ enum rk805_reg { 2221 2222 #define VOUT_LO_INT BIT(0) 2223 #define CLK32KOUT2_EN BIT(0) 2224+#define CLK32KOUT2_FUNC (0 << 1) 2225+#define CLK32KOUT2_FUNC_MASK BIT(1) 2226 2227+#define TEMP105C 0x08 2228 #define TEMP115C 0x0c 2229 #define TEMP_HOTDIE_MSK 0x0c 2230 #define SLP_SD_MSK (0x3 << 2) 2231@@ -391,6 +821,7 @@ enum rk805_reg { 2232 #define PWM_MODE_MSK BIT(7) 2233 #define FPWM_MODE BIT(7) 2234 #define AUTO_PWM_MODE 0 2235+#define REGS_WMSK 0xf0 2236 2237 enum rk817_reg_id { 2238 RK817_ID_DCDC1 = 0, 2239@@ -436,6 +867,10 @@ enum rk809_reg_id { 2240 #define RK817_RTC_INT_REG 0xf 2241 #define RK817_RTC_COMP_LSB_REG 0x10 2242 #define RK817_RTC_COMP_MSB_REG 0x11 2243+#define RK817_ADC_CONFIG0 0x50 2244+#define RK817_CURE_ADC_K0 0xb0 2245+#define RK817_POWER_EN_SAVE0 0x99 2246+#define RK817_POWER_EN_SAVE1 0xa4 2247 2248 #define RK817_POWER_EN_REG(i) (0xb1 + (i)) 2249 #define RK817_POWER_SLP_EN_REG(i) (0xb5 + (i)) 2250@@ -462,6 +897,9 @@ enum rk809_reg_id { 2251 #define RK817_LDO_ON_VSEL_REG(idx) (0xcc + (idx) * 2) 2252 #define RK817_BOOST_OTG_CFG (0xde) 2253 2254+#define RK817_CHRG_OUT 0xe4 2255+#define RK817_CHRG_IN 0xe5 2256+#define RK817_CHRG_STS 0xeb 2257 #define RK817_ID_MSB 0xed 2258 #define RK817_ID_LSB 0xee 2259 2260@@ -609,16 +1047,27 @@ enum { 2261 RK805_ID = 0x8050, 2262 RK808_ID = 0x0000, 2263 RK809_ID = 0x8090, 2264+ RK816_ID = 0x8160, 2265 RK817_ID = 0x8170, 2266 RK818_ID = 0x8180, 2267 }; 2268 2269+struct rk808_pin_info { 2270+ struct pinctrl *p; 2271+ struct pinctrl_state *reset; 2272+ struct pinctrl_state *power_off; 2273+ struct pinctrl_state *sleep; 2274+}; 2275+ 2276 struct rk808 { 2277 struct i2c_client *i2c; 2278 struct regmap_irq_chip_data *irq_data; 2279+ struct regmap_irq_chip_data *battery_irq_data; 2280 struct regmap *regmap; 2281 long variant; 2282 const struct regmap_config *regmap_cfg; 2283 const struct regmap_irq_chip *regmap_irq_chip; 2284+ void (*pm_pwroff_prep_fn)(void); 2285+ struct rk808_pin_info *pins; 2286 }; 2287 #endif /* __LINUX_REGULATOR_RK808_H */ 2288diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h 2289index 40d7e98fc..819f6119d 100644 2290--- a/include/linux/mmc/host.h 2291+++ b/include/linux/mmc/host.h 2292@@ -141,6 +141,7 @@ struct mmc_host_ops { 2293 2294 /* Check if the card is pulling dat[0:3] low */ 2295 int (*card_busy)(struct mmc_host *host); 2296+ int (*set_sdio_status)(struct mmc_host *host, int val); 2297 2298 /* The tuning command opcode value is different for SD and eMMC cards */ 2299 int (*execute_tuning)(struct mmc_host *host, u32 opcode); 2300@@ -483,6 +484,9 @@ void mmc_free_host(struct mmc_host *); 2301 int mmc_of_parse(struct mmc_host *host); 2302 int mmc_of_parse_voltage(struct device_node *np, u32 *mask); 2303 2304+extern struct mmc_host *primary_sdio_host; 2305+int mmc_host_rescan(struct mmc_host *host, int val, int is_cap_sdio_irq); 2306+ 2307 static inline void *mmc_priv(struct mmc_host *host) 2308 { 2309 return (void *)host->private; 2310diff --git a/include/linux/mmu_context.h b/include/linux/mmu_context.h 2311index 03dee12d2..bc4ac3c52 100644 2312--- a/include/linux/mmu_context.h 2313+++ b/include/linux/mmu_context.h 2314@@ -14,4 +14,12 @@ 2315 static inline void leave_mm(int cpu) { } 2316 #endif 2317 2318+/* 2319+ * CPUs that are capable of running task @p. By default, we assume a sane, 2320+ * homogeneous system. Must contain at least one active CPU. 2321+ */ 2322+#ifndef task_cpu_possible_mask 2323+# define task_cpu_possible_mask(p) cpu_possible_mask 2324+#endif 2325+ 2326 #endif 2327diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h 2328index 81a55e974..aefa0b0bc 100644 2329--- a/include/linux/power_supply.h 2330+++ b/include/linux/power_supply.h 2331@@ -49,6 +49,12 @@ enum { 2332 POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE, /* dynamically adjusted speed */ 2333 POWER_SUPPLY_CHARGE_TYPE_CUSTOM, /* use CHARGE_CONTROL_* props */ 2334 POWER_SUPPLY_CHARGE_TYPE_LONGLIFE, /* slow speed, longer life */ 2335+ 2336+ /* 2337+ * force to 50 to minimize the chances of userspace binary 2338+ * incompatibility on newer upstream kernels 2339+ */ 2340+ POWER_SUPPLY_CHARGE_TYPE_TAPER = 50, /* charging in CV phase */ 2341 }; 2342 2343 enum { 2344@@ -386,12 +392,22 @@ extern void power_supply_put(struct power_supply *psy); 2345 #ifdef CONFIG_OF 2346 extern struct power_supply *power_supply_get_by_phandle(struct device_node *np, 2347 const char *property); 2348+extern int power_supply_get_by_phandle_array(struct device_node *np, 2349+ const char *property, 2350+ struct power_supply **psy, 2351+ ssize_t size); 2352 extern struct power_supply *devm_power_supply_get_by_phandle( 2353 struct device *dev, const char *property); 2354 #else /* !CONFIG_OF */ 2355 static inline struct power_supply * 2356 power_supply_get_by_phandle(struct device_node *np, const char *property) 2357 { return NULL; } 2358+static inline int 2359+power_supply_get_by_phandle_array(struct device_node *np, 2360+ const char *property, 2361+ struct power_supply **psy, 2362+ int size) 2363+{ return 0; } 2364 static inline struct power_supply * 2365 devm_power_supply_get_by_phandle(struct device *dev, const char *property) 2366 { return NULL; } 2367@@ -426,9 +442,16 @@ static inline int power_supply_is_system_supplied(void) { return -ENOSYS; } 2368 extern int power_supply_get_property(struct power_supply *psy, 2369 enum power_supply_property psp, 2370 union power_supply_propval *val); 2371+#if IS_ENABLED(CONFIG_POWER_SUPPLY) 2372 extern int power_supply_set_property(struct power_supply *psy, 2373 enum power_supply_property psp, 2374 const union power_supply_propval *val); 2375+#else 2376+static inline int power_supply_set_property(struct power_supply *psy, 2377+ enum power_supply_property psp, 2378+ const union power_supply_propval *val) 2379+{ return 0; } 2380+#endif 2381 extern int power_supply_property_is_writeable(struct power_supply *psy, 2382 enum power_supply_property psp); 2383 extern void power_supply_external_power_changed(struct power_supply *psy); 2384diff --git a/include/linux/psi_types.h b/include/linux/psi_types.h 2385index 17d74f62c..541b45881 100644 2386--- a/include/linux/psi_types.h 2387+++ b/include/linux/psi_types.h 2388@@ -154,6 +154,7 @@ struct psi_group { 2389 struct timer_list poll_timer; 2390 wait_queue_head_t poll_wait; 2391 atomic_t poll_wakeup; 2392+ atomic_t poll_scheduled; 2393 2394 /* Protects data used by the monitor */ 2395 struct mutex trigger_lock; 2396diff --git a/include/linux/pwm.h b/include/linux/pwm.h 2397index a13ff383f..6b2a7fb80 100644 2398--- a/include/linux/pwm.h 2399+++ b/include/linux/pwm.h 2400@@ -59,6 +59,9 @@ struct pwm_state { 2401 u64 period; 2402 u64 duty_cycle; 2403 enum pwm_polarity polarity; 2404+#ifdef CONFIG_PWM_ROCKCHIP_ONESHOT 2405+ u64 oneshot_count; 2406+#endif /* CONFIG_PWM_ROCKCHIP_ONESHOT */ 2407 bool enabled; 2408 }; 2409 2410diff --git a/include/linux/reboot.h b/include/linux/reboot.h 2411index 3734cd8f3..1c8d7856c 100644 2412--- a/include/linux/reboot.h 2413+++ b/include/linux/reboot.h 2414@@ -49,6 +49,26 @@ extern int register_restart_handler(struct notifier_block *); 2415 extern int unregister_restart_handler(struct notifier_block *); 2416 extern void do_kernel_restart(char *cmd); 2417 2418+#ifdef CONFIG_NO_GKI 2419+extern int register_pre_restart_handler(struct notifier_block *nb); 2420+extern int unregister_pre_restart_handler(struct notifier_block *nb); 2421+extern void do_kernel_pre_restart(char *cmd); 2422+#else 2423+static inline int register_pre_restart_handler(struct notifier_block *nb) 2424+{ 2425+ return 0; 2426+} 2427+ 2428+static inline int unregister_pre_restart_handler(struct notifier_block *nb) 2429+{ 2430+ return 0; 2431+} 2432+ 2433+static inline void do_kernel_pre_restart(char *cmd) 2434+{ 2435+} 2436+#endif 2437+ 2438 /* 2439 * Architecture-specific implementations of sys_reboot commands. 2440 */ 2441diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h 2442index 11cade737..d7c77ee37 100644 2443--- a/include/linux/regulator/driver.h 2444+++ b/include/linux/regulator/driver.h 2445@@ -223,6 +223,8 @@ enum regulator_type { 2446 * @name: Identifying name for the regulator. 2447 * @supply_name: Identifying the regulator supply 2448 * @of_match: Name used to identify regulator in DT. 2449+ * @of_match_full_name: A flag to indicate that the of_match string, if 2450+ * present, should be matched against the node full_name. 2451 * @regulators_node: Name of node containing regulator definitions in DT. 2452 * @of_parse_cb: Optional callback called only if of_match is present. 2453 * Will be called for each regulator parsed from DT, during 2454@@ -314,6 +316,7 @@ struct regulator_desc { 2455 const char *name; 2456 const char *supply_name; 2457 const char *of_match; 2458+ bool of_match_full_name; 2459 const char *regulators_node; 2460 int (*of_parse_cb)(struct device_node *, 2461 const struct regulator_desc *, 2462diff --git a/include/linux/regulator/fan53555.h b/include/linux/regulator/fan53555.h 2463index ce8df2186..e8703b6fc 100644 2464--- a/include/linux/regulator/fan53555.h 2465+++ b/include/linux/regulator/fan53555.h 2466@@ -52,6 +52,8 @@ struct fan53555_platform_data { 2467 unsigned int slew_rate; 2468 /* Sleep VSEL ID */ 2469 unsigned int sleep_vsel_id; 2470+ int limit_volt; 2471+ struct gpio_desc *vsel_gpio; 2472 }; 2473 2474 #endif /* __FAN53555_H__ */ 2475diff --git a/include/linux/sched.h b/include/linux/sched.h 2476index a67583bfa..c7290fa02 100644 2477--- a/include/linux/sched.h 2478+++ b/include/linux/sched.h 2479@@ -1366,7 +1366,7 @@ struct task_struct { 2480 u64 timer_slack_ns; 2481 u64 default_timer_slack_ns; 2482 2483-#ifdef CONFIG_KASAN 2484+#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS) 2485 unsigned int kasan_depth; 2486 #endif 2487 2488@@ -1702,11 +1702,9 @@ extern struct pid *cad_pid; 2489 #define PF_KTHREAD 0x00200000 /* I am a kernel thread */ 2490 #define PF_RANDOMIZE 0x00400000 /* Randomize virtual address space */ 2491 #define PF_SWAPWRITE 0x00800000 /* Allowed to write to swap */ 2492- 2493 #ifdef CONFIG_WGCM 2494 #define PF_WGCM_WORKER 0x01000000 /* WGCM worker*/ 2495 #endif 2496- 2497 #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */ 2498 #define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ 2499 #define PF_MEMALLOC_NOCMA 0x10000000 /* All allocation request will have _GFP_MOVABLE cleared */ 2500diff --git a/include/linux/sched/hotplug.h b/include/linux/sched/hotplug.h 2501index 9a62ffdd2..89fb9b027 100644 2502--- a/include/linux/sched/hotplug.h 2503+++ b/include/linux/sched/hotplug.h 2504@@ -8,7 +8,11 @@ 2505 2506 extern int sched_cpu_starting(unsigned int cpu); 2507 extern int sched_cpu_activate(unsigned int cpu); 2508+extern int sched_cpus_activate(struct cpumask *cpus); 2509 extern int sched_cpu_deactivate(unsigned int cpu); 2510+extern int sched_cpus_deactivate_nosync(struct cpumask *cpus); 2511+extern int sched_cpu_drain_rq(unsigned int cpu); 2512+extern void sched_cpu_drain_rq_wait(unsigned int cpu); 2513 2514 #ifdef CONFIG_HOTPLUG_CPU 2515 extern int sched_cpu_dying(unsigned int cpu); 2516diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h 2517index 22420b45b..cc9f393e2 100644 2518--- a/include/linux/sched/isolation.h 2519+++ b/include/linux/sched/isolation.h 2520@@ -28,25 +28,10 @@ extern void __init housekeeping_init(void); 2521 2522 #else 2523 2524-#ifdef CONFIG_CPU_ISOLATION_OPT 2525-static inline int housekeeping_any_cpu(enum hk_flags flags) 2526-{ 2527- cpumask_t available; 2528- int cpu; 2529- 2530- cpumask_andnot(&available, cpu_online_mask, cpu_isolated_mask); 2531- cpu = cpumask_any(&available); 2532- if (cpu >= nr_cpu_ids) 2533- cpu = smp_processor_id(); 2534- 2535- return cpu; 2536-} 2537-#else 2538 static inline int housekeeping_any_cpu(enum hk_flags flags) 2539 { 2540 return smp_processor_id(); 2541 } 2542-#endif 2543 2544 static inline const struct cpumask *housekeeping_cpumask(enum hk_flags flags) 2545 { 2546@@ -69,11 +54,7 @@ static inline bool housekeeping_cpu(int cpu, enum hk_flags flags) 2547 if (static_branch_unlikely(&housekeeping_overridden)) 2548 return housekeeping_test_cpu(cpu, flags); 2549 #endif 2550-#ifdef CONFIG_CPU_ISOLATION_OPT 2551- return !cpu_isolated(cpu); 2552-#else 2553 return true; 2554-#endif 2555 } 2556 2557 #endif /* _LINUX_SCHED_ISOLATION_H */ 2558diff --git a/include/linux/sched/wake_q.h b/include/linux/sched/wake_q.h 2559index 26a2013ac..1e05e5669 100644 2560--- a/include/linux/sched/wake_q.h 2561+++ b/include/linux/sched/wake_q.h 2562@@ -38,6 +38,7 @@ 2563 struct wake_q_head { 2564 struct wake_q_node *first; 2565 struct wake_q_node **lastp; 2566+ int count; 2567 }; 2568 2569 #define WAKE_Q_TAIL ((struct wake_q_node *) 0x01) 2570@@ -49,6 +50,7 @@ static inline void wake_q_init(struct wake_q_head *head) 2571 { 2572 head->first = WAKE_Q_TAIL; 2573 head->lastp = &head->first; 2574+ head->count = 0; 2575 } 2576 2577 static inline bool wake_q_empty(struct wake_q_head *head) 2578diff --git a/include/linux/sched/xacct.h b/include/linux/sched/xacct.h 2579index c078f0a94..9544c9d9d 100644 2580--- a/include/linux/sched/xacct.h 2581+++ b/include/linux/sched/xacct.h 2582@@ -28,6 +28,11 @@ static inline void inc_syscw(struct task_struct *tsk) 2583 { 2584 tsk->ioac.syscw++; 2585 } 2586+ 2587+static inline void inc_syscfs(struct task_struct *tsk) 2588+{ 2589+ tsk->ioac.syscfs++; 2590+} 2591 #else 2592 static inline void add_rchar(struct task_struct *tsk, ssize_t amt) 2593 { 2594@@ -44,6 +49,10 @@ static inline void inc_syscr(struct task_struct *tsk) 2595 static inline void inc_syscw(struct task_struct *tsk) 2596 { 2597 } 2598+ 2599+static inline void inc_syscfs(struct task_struct *tsk) 2600+{ 2601+} 2602 #endif 2603 2604 #endif /* _LINUX_SCHED_XACCT_H */ 2605diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h 2606index b56e1dedc..ba4246721 100644 2607--- a/include/linux/stmmac.h 2608+++ b/include/linux/stmmac.h 2609@@ -183,6 +183,7 @@ struct plat_stmmacenet_data { 2610 void (*serdes_powerdown)(struct net_device *ndev, void *priv); 2611 int (*init)(struct platform_device *pdev, void *priv); 2612 void (*exit)(struct platform_device *pdev, void *priv); 2613+ void (*get_eth_addr)(void *priv, unsigned char *addr); 2614 struct mac_device_info *(*setup)(void *priv); 2615 void *bsp_priv; 2616 struct clk *stmmac_clk; 2617diff --git a/include/linux/thermal.h b/include/linux/thermal.h 2618index 176d9454e..aa4b4114b 100644 2619--- a/include/linux/thermal.h 2620+++ b/include/linux/thermal.h 2621@@ -399,6 +399,7 @@ void thermal_cdev_update(struct thermal_cooling_device *); 2622 void thermal_notify_framework(struct thermal_zone_device *, int); 2623 int thermal_zone_device_enable(struct thermal_zone_device *tz); 2624 int thermal_zone_device_disable(struct thermal_zone_device *tz); 2625+int thermal_zone_device_is_enabled(struct thermal_zone_device *tz); 2626 #else 2627 static inline struct thermal_zone_device *thermal_zone_device_register( 2628 const char *type, int trips, int mask, void *devdata, 2629@@ -453,6 +454,10 @@ static inline int thermal_zone_device_enable(struct thermal_zone_device *tz) 2630 2631 static inline int thermal_zone_device_disable(struct thermal_zone_device *tz) 2632 { return -ENODEV; } 2633+ 2634+static inline int 2635+thermal_zone_device_is_enabled(struct thermal_zone_device *tz) 2636+{ return -ENODEV; } 2637 #endif /* CONFIG_THERMAL */ 2638 2639 #endif /* __THERMAL_H__ */ 2640diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h 2641index ead8c9a47..899c84e7c 100644 2642--- a/include/linux/usb/audio-v2.h 2643+++ b/include/linux/usb/audio-v2.h 2644@@ -168,6 +168,20 @@ struct uac2_effect_unit_descriptor { 2645 __u8 bmaControls[]; /* variable length */ 2646 } __attribute__((packed)); 2647 2648+#define UAC2_DT_FEATURE_UNIT_SIZE(ch) (6 + ((ch) + 1) * 4) 2649+ 2650+/* As above, but more useful for defining your own descriptors: */ 2651+#define DECLARE_UAC2_FEATURE_UNIT_DESCRIPTOR(ch) \ 2652+struct uac2_feature_unit_descriptor_##ch { \ 2653+ __u8 bLength; \ 2654+ __u8 bDescriptorType; \ 2655+ __u8 bDescriptorSubtype; \ 2656+ __u8 bUnitID; \ 2657+ __u8 bSourceID; \ 2658+ __le32 bmaControls[ch + 1]; \ 2659+ __u8 iFeature; \ 2660+} __attribute__((packed)) 2661+ 2662 /* 4.9.2 Class-Specific AS Interface Descriptor */ 2663 2664 struct uac2_as_header_descriptor { 2665@@ -331,6 +345,9 @@ struct uac2_interrupt_data_msg { 2666 #define UAC2_FU_OVERFLOW 0x0f 2667 #define UAC2_FU_LATENCY 0x10 2668 2669+#define UAC2_CONTROL_BIT_RO(CS) (0x01 << (((CS) - 1) << 1)) 2670+#define UAC2_CONTROL_BIT_RW(CS) (0x03 << (((CS) - 1) << 1)) 2671+ 2672 /* A.17.8.1 Parametric Equalizer Section Effect Unit Control Selectors */ 2673 #define UAC2_PE_UNDEFINED 0x00 2674 #define UAC2_PE_ENABLE 0x01 2675diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h 2676index 170acd500..646cb0a8d 100644 2677--- a/include/linux/usb/audio.h 2678+++ b/include/linux/usb/audio.h 2679@@ -31,6 +31,7 @@ struct usb_audio_control { 2680 int data[5]; 2681 int (*set)(struct usb_audio_control *con, u8 cmd, int value); 2682 int (*get)(struct usb_audio_control *con, u8 cmd); 2683+ void *context; 2684 }; 2685 2686 struct usb_audio_control_selector { 2687diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h 2688index 604c6c514..1cffa3474 100644 2689--- a/include/linux/usb/ch9.h 2690+++ b/include/linux/usb/ch9.h 2691@@ -36,62 +36,24 @@ 2692 #include <linux/device.h> 2693 #include <uapi/linux/usb/ch9.h> 2694 2695-/** 2696- * usb_ep_type_string() - Returns human readable-name of the endpoint type. 2697- * @ep_type: The endpoint type to return human-readable name for. If it's not 2698- * any of the types: USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT}, 2699- * usually got by usb_endpoint_type(), the string 'unknown' will be returned. 2700- */ 2701-extern const char *usb_ep_type_string(int ep_type); 2702+/* USB 3.2 SuperSpeed Plus phy signaling rate generation and lane count */ 2703 2704-/** 2705- * usb_speed_string() - Returns human readable-name of the speed. 2706- * @speed: The speed to return human-readable name for. If it's not 2707- * any of the speeds defined in usb_device_speed enum, string for 2708- * USB_SPEED_UNKNOWN will be returned. 2709- */ 2710-extern const char *usb_speed_string(enum usb_device_speed speed); 2711+enum usb_ssp_rate { 2712+ USB_SSP_GEN_UNKNOWN = 0, 2713+ USB_SSP_GEN_2x1, 2714+ USB_SSP_GEN_1x2, 2715+ USB_SSP_GEN_2x2, 2716+}; 2717 2718-/** 2719- * usb_get_maximum_speed - Get maximum requested speed for a given USB 2720- * controller. 2721- * @dev: Pointer to the given USB controller device 2722- * 2723- * The function gets the maximum speed string from property "maximum-speed", 2724- * and returns the corresponding enum usb_device_speed. 2725- */ 2726+extern const char *usb_ep_type_string(int ep_type); 2727+extern const char *usb_speed_string(enum usb_device_speed speed); 2728 extern enum usb_device_speed usb_get_maximum_speed(struct device *dev); 2729- 2730-/** 2731- * usb_state_string - Returns human readable name for the state. 2732- * @state: The state to return a human-readable name for. If it's not 2733- * any of the states devices in usb_device_state_string enum, 2734- * the string UNKNOWN will be returned. 2735- */ 2736+extern enum usb_ssp_rate usb_get_maximum_ssp_rate(struct device *dev); 2737 extern const char *usb_state_string(enum usb_device_state state); 2738+unsigned int usb_decode_interval(const struct usb_endpoint_descriptor *epd, 2739+ enum usb_device_speed speed); 2740 2741 #ifdef CONFIG_TRACING 2742-/** 2743- * usb_decode_ctrl - Returns human readable representation of control request. 2744- * @str: buffer to return a human-readable representation of control request. 2745- * This buffer should have about 200 bytes. 2746- * @size: size of str buffer. 2747- * @bRequestType: matches the USB bmRequestType field 2748- * @bRequest: matches the USB bRequest field 2749- * @wValue: matches the USB wValue field (CPU byte order) 2750- * @wIndex: matches the USB wIndex field (CPU byte order) 2751- * @wLength: matches the USB wLength field (CPU byte order) 2752- * 2753- * Function returns decoded, formatted and human-readable description of 2754- * control request packet. 2755- * 2756- * The usage scenario for this is for tracepoints, so function as a return 2757- * use the same value as in parameters. This approach allows to use this 2758- * function in TP_printk 2759- * 2760- * Important: wValue, wIndex, wLength parameters before invoking this function 2761- * should be processed by le16_to_cpu macro. 2762- */ 2763 extern const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType, 2764 __u8 bRequest, __u16 wValue, __u16 wIndex, 2765 __u16 wLength); 2766diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h 2767index a2d229ab6..4d352204e 100644 2768--- a/include/linux/usb/composite.h 2769+++ b/include/linux/usb/composite.h 2770@@ -525,6 +525,8 @@ extern struct usb_string *usb_gstrings_attach(struct usb_composite_dev *cdev, 2771 extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n); 2772 2773 extern void composite_disconnect(struct usb_gadget *gadget); 2774+extern void composite_reset(struct usb_gadget *gadget); 2775+ 2776 extern int composite_setup(struct usb_gadget *gadget, 2777 const struct usb_ctrlrequest *ctrl); 2778 extern void composite_suspend(struct usb_gadget *gadget); 2779@@ -590,6 +592,7 @@ struct usb_function_instance { 2780 struct config_group group; 2781 struct list_head cfs_list; 2782 struct usb_function_driver *fd; 2783+ struct usb_function *f; 2784 int (*set_inst_name)(struct usb_function_instance *inst, 2785 const char *name); 2786 void (*free_func_inst)(struct usb_function_instance *inst); 2787diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h 2788index e7351d64f..a15700a40 100644 2789--- a/include/linux/usb/gadget.h 2790+++ b/include/linux/usb/gadget.h 2791@@ -217,6 +217,7 @@ struct usb_ep_caps { 2792 * enabled and remains valid until the endpoint is disabled. 2793 * @comp_desc: In case of SuperSpeed support, this is the endpoint companion 2794 * descriptor that is used to configure the endpoint 2795+ * @transfer_type: Used to specify transfer type of EP. 2796 * 2797 * the bus controller driver lists all the general purpose endpoints in 2798 * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list, 2799@@ -240,6 +241,9 @@ struct usb_ep { 2800 u8 address; 2801 const struct usb_endpoint_descriptor *desc; 2802 const struct usb_ss_ep_comp_descriptor *comp_desc; 2803+#if defined(CONFIG_ARCH_ROCKCHIP) && defined(CONFIG_NO_GKI) 2804+ u8 transfer_type; 2805+#endif 2806 }; 2807 2808 /*-------------------------------------------------------------------------*/ 2809@@ -323,6 +327,8 @@ struct usb_gadget_ops { 2810 struct usb_gadget_driver *); 2811 int (*udc_stop)(struct usb_gadget *); 2812 void (*udc_set_speed)(struct usb_gadget *, enum usb_device_speed); 2813+ void (*udc_set_ssp_rate)(struct usb_gadget *gadget, 2814+ enum usb_ssp_rate rate); 2815 struct usb_ep *(*match_ep)(struct usb_gadget *, 2816 struct usb_endpoint_descriptor *, 2817 struct usb_ss_ep_comp_descriptor *); 2818@@ -339,6 +345,10 @@ struct usb_gadget_ops { 2819 * @speed: Speed of current connection to USB host. 2820 * @max_speed: Maximal speed the UDC can handle. UDC must support this 2821 * and all slower speeds. 2822+ * @ssp_rate: Current connected SuperSpeed Plus signaling rate and lane count. 2823+ * @max_ssp_rate: Maximum SuperSpeed Plus signaling rate and lane count the UDC 2824+ * can handle. The UDC must support this and all slower speeds and lower 2825+ * number of lanes. 2826 * @state: the state we are now (attached, suspended, configured, etc) 2827 * @name: Identifies the controller hardware type. Used in diagnostics 2828 * and sometimes configuration. 2829@@ -406,6 +416,11 @@ struct usb_gadget { 2830 struct list_head ep_list; /* of usb_ep */ 2831 enum usb_device_speed speed; 2832 enum usb_device_speed max_speed; 2833+ 2834+ /* USB SuperSpeed Plus only */ 2835+ enum usb_ssp_rate ssp_rate; 2836+ enum usb_ssp_rate max_ssp_rate; 2837+ 2838 enum usb_device_state state; 2839 const char *name; 2840 struct device dev; 2841diff --git a/include/linux/usb/pd.h b/include/linux/usb/pd.h 2842index 433040ff8..96b7ff66f 100644 2843--- a/include/linux/usb/pd.h 2844+++ b/include/linux/usb/pd.h 2845@@ -225,6 +225,7 @@ enum pd_pdo_type { 2846 #define PDO_FIXED_EXTPOWER BIT(27) /* Externally powered */ 2847 #define PDO_FIXED_USB_COMM BIT(26) /* USB communications capable */ 2848 #define PDO_FIXED_DATA_SWAP BIT(25) /* Data role swap supported */ 2849+#define PDO_FIXED_UNCHUNK_EXT BIT(24) /* Unchunked Extended Message supported (Source) */ 2850 #define PDO_FIXED_FRS_CURR_MASK (BIT(24) | BIT(23)) /* FR_Swap Current (Sink) */ 2851 #define PDO_FIXED_FRS_CURR_SHIFT 23 2852 #define PDO_FIXED_VOLT_SHIFT 10 /* 50mV units */ 2853@@ -466,6 +467,7 @@ static inline unsigned int rdo_max_power(u32 rdo) 2854 #define PD_T_DRP_SRC 30 2855 #define PD_T_PS_SOURCE_OFF 920 2856 #define PD_T_PS_SOURCE_ON 480 2857+#define PD_T_PS_SOURCE_ON_PRS 450 /* 390 - 480ms */ 2858 #define PD_T_PS_HARD_RESET 30 2859 #define PD_T_SRC_RECOVER 760 2860 #define PD_T_SRC_RECOVER_MAX 1000 2861@@ -478,14 +480,19 @@ static inline unsigned int rdo_max_power(u32 rdo) 2862 #define PD_T_NEWSRC 250 /* Maximum of 275ms */ 2863 #define PD_T_SWAP_SRC_START 20 /* Minimum of 20ms */ 2864 #define PD_T_BIST_CONT_MODE 50 /* 30 - 60 ms */ 2865+#define PD_T_SINK_TX 16 /* 16 - 20 ms */ 2866+#define PD_T_CHUNK_NOT_SUPP 42 /* 40 - 50 ms */ 2867 2868 #define PD_T_DRP_TRY 100 /* 75 - 150 ms */ 2869 #define PD_T_DRP_TRYWAIT 600 /* 400 - 800 ms */ 2870 2871 #define PD_T_CC_DEBOUNCE 200 /* 100 - 200 ms */ 2872 #define PD_T_PD_DEBOUNCE 20 /* 10 - 20 ms */ 2873+#define PD_T_TRY_CC_DEBOUNCE 15 /* 10 - 20 ms */ 2874 2875 #define PD_N_CAPS_COUNT (PD_T_NO_RESPONSE / PD_T_SEND_SOURCE_CAP) 2876 #define PD_N_HARD_RESET_COUNT 2 2877 2878+#define PD_P_SNK_STDBY_MW 2500 /* 2500 mW */ 2879+ 2880 #endif /* __LINUX_USB_PD_H */ 2881diff --git a/include/linux/usb/pd_ext_sdb.h b/include/linux/usb/pd_ext_sdb.h 2882index 0eb83ce19..b517ebc8f 100644 2883--- a/include/linux/usb/pd_ext_sdb.h 2884+++ b/include/linux/usb/pd_ext_sdb.h 2885@@ -24,8 +24,4 @@ enum usb_pd_ext_sdb_fields { 2886 #define USB_PD_EXT_SDB_EVENT_OVP BIT(3) 2887 #define USB_PD_EXT_SDB_EVENT_CF_CV_MODE BIT(4) 2888 2889-#define USB_PD_EXT_SDB_PPS_EVENTS (USB_PD_EXT_SDB_EVENT_OCP | \ 2890- USB_PD_EXT_SDB_EVENT_OTP | \ 2891- USB_PD_EXT_SDB_EVENT_OVP) 2892- 2893 #endif /* __LINUX_USB_PD_EXT_SDB_H */ 2894diff --git a/include/linux/usb/pd_vdo.h b/include/linux/usb/pd_vdo.h 2895index 68bdc4e2f..7f5e330a6 100644 2896--- a/include/linux/usb/pd_vdo.h 2897+++ b/include/linux/usb/pd_vdo.h 2898@@ -21,22 +21,24 @@ 2899 * ---------- 2900 * <31:16> :: SVID 2901 * <15> :: VDM type ( 1b == structured, 0b == unstructured ) 2902- * <14:13> :: Structured VDM version (can only be 00 == 1.0 currently) 2903+ * <14:13> :: Structured VDM version 2904 * <12:11> :: reserved 2905 * <10:8> :: object position (1-7 valid ... used for enter/exit mode only) 2906 * <7:6> :: command type (SVDM only?) 2907 * <5> :: reserved (SVDM), command type (UVDM) 2908 * <4:0> :: command 2909 */ 2910-#define VDO(vid, type, custom) \ 2911+#define VDO(vid, type, ver, custom) \ 2912 (((vid) << 16) | \ 2913 ((type) << 15) | \ 2914+ ((ver) << 13) | \ 2915 ((custom) & 0x7FFF)) 2916 2917 #define VDO_SVDM_TYPE (1 << 15) 2918 #define VDO_SVDM_VERS(x) ((x) << 13) 2919 #define VDO_OPOS(x) ((x) << 8) 2920 #define VDO_CMDT(x) ((x) << 6) 2921+#define VDO_SVDM_VERS_MASK VDO_SVDM_VERS(0x3) 2922 #define VDO_OPOS_MASK VDO_OPOS(0x7) 2923 #define VDO_CMDT_MASK VDO_CMDT(0x3) 2924 2925@@ -74,6 +76,7 @@ 2926 2927 #define PD_VDO_VID(vdo) ((vdo) >> 16) 2928 #define PD_VDO_SVDM(vdo) (((vdo) >> 15) & 1) 2929+#define PD_VDO_SVDM_VER(vdo) (((vdo) >> 13) & 0x3) 2930 #define PD_VDO_OPOS(vdo) (((vdo) >> 8) & 0x7) 2931 #define PD_VDO_CMD(vdo) ((vdo) & 0x1f) 2932 #define PD_VDO_CMDT(vdo) (((vdo) >> 6) & 0x3) 2933@@ -103,25 +106,50 @@ 2934 * -------------------- 2935 * <31> :: data capable as a USB host 2936 * <30> :: data capable as a USB device 2937- * <29:27> :: product type 2938+ * <29:27> :: product type (UFP / Cable / VPD) 2939 * <26> :: modal operation supported (1b == yes) 2940- * <25:16> :: Reserved, Shall be set to zero 2941+ * <25:23> :: product type (DFP) (SVDM version 2.0+ only; set to zero in version 1.0) 2942+ * <22:21> :: connector type (SVDM version 2.0+ only; set to zero in version 1.0) 2943+ * <20:16> :: Reserved, Shall be set to zero 2944 * <15:0> :: USB-IF assigned VID for this cable vendor 2945 */ 2946+ 2947+/* PD Rev2.0 definition */ 2948 #define IDH_PTYPE_UNDEF 0 2949+ 2950+/* SOP Product Type (UFP) */ 2951+#define IDH_PTYPE_NOT_UFP 0 2952 #define IDH_PTYPE_HUB 1 2953 #define IDH_PTYPE_PERIPH 2 2954+#define IDH_PTYPE_PSD 3 2955+#define IDH_PTYPE_AMA 5 2956+ 2957+/* SOP' Product Type (Cable Plug / VPD) */ 2958+#define IDH_PTYPE_NOT_CABLE 0 2959 #define IDH_PTYPE_PCABLE 3 2960 #define IDH_PTYPE_ACABLE 4 2961-#define IDH_PTYPE_AMA 5 2962+#define IDH_PTYPE_VPD 6 2963 2964-#define VDO_IDH(usbh, usbd, ptype, is_modal, vid) \ 2965- ((usbh) << 31 | (usbd) << 30 | ((ptype) & 0x7) << 27 \ 2966- | (is_modal) << 26 | ((vid) & 0xffff)) 2967+/* SOP Product Type (DFP) */ 2968+#define IDH_PTYPE_NOT_DFP 0 2969+#define IDH_PTYPE_DFP_HUB 1 2970+#define IDH_PTYPE_DFP_HOST 2 2971+#define IDH_PTYPE_DFP_PB 3 2972+ 2973+/* ID Header Mask */ 2974+#define IDH_DFP_MASK GENMASK(25, 23) 2975+#define IDH_CONN_MASK GENMASK(22, 21) 2976+ 2977+#define VDO_IDH(usbh, usbd, ufp_cable, is_modal, dfp, conn, vid) \ 2978+ ((usbh) << 31 | (usbd) << 30 | ((ufp_cable) & 0x7) << 27 \ 2979+ | (is_modal) << 26 | ((dfp) & 0x7) << 23 | ((conn) & 0x3) << 21 \ 2980+ | ((vid) & 0xffff)) 2981 2982 #define PD_IDH_PTYPE(vdo) (((vdo) >> 27) & 0x7) 2983 #define PD_IDH_VID(vdo) ((vdo) & 0xffff) 2984 #define PD_IDH_MODAL_SUPP(vdo) ((vdo) & (1 << 26)) 2985+#define PD_IDH_DFP_PTYPE(vdo) (((vdo) >> 23) & 0x7) 2986+#define PD_IDH_CONN_TYPE(vdo) (((vdo) >> 21) & 0x3) 2987 2988 /* 2989 * Cert Stat VDO 2990@@ -129,6 +157,7 @@ 2991 * <31:0> : USB-IF assigned XID for this cable 2992 */ 2993 #define PD_CSTAT_XID(vdo) (vdo) 2994+#define VDO_CERT(xid) ((xid) & 0xffffffff) 2995 2996 /* 2997 * Product VDO 2998@@ -140,77 +169,270 @@ 2999 #define PD_PRODUCT_PID(vdo) (((vdo) >> 16) & 0xffff) 3000 3001 /* 3002- * UFP VDO1 3003+ * UFP VDO (PD Revision 3.0+ only) 3004 * -------- 3005 * <31:29> :: UFP VDO version 3006 * <28> :: Reserved 3007 * <27:24> :: Device capability 3008- * <23:6> :: Reserved 3009+ * <23:22> :: Connector type (10b == receptacle, 11b == captive plug) 3010+ * <21:11> :: Reserved 3011+ * <10:8> :: Vconn power (AMA only) 3012+ * <7> :: Vconn required (AMA only, 0b == no, 1b == yes) 3013+ * <6> :: Vbus required (AMA only, 0b == yes, 1b == no) 3014 * <5:3> :: Alternate modes 3015 * <2:0> :: USB highest speed 3016 */ 3017-#define PD_VDO1_UFP_DEVCAP(vdo) (((vdo) & GENMASK(27, 24)) >> 24) 3018+#define PD_VDO_UFP_DEVCAP(vdo) (((vdo) & GENMASK(27, 24)) >> 24) 3019 3020+/* UFP VDO Version */ 3021+#define UFP_VDO_VER1_2 2 3022+ 3023+/* Device Capability */ 3024 #define DEV_USB2_CAPABLE BIT(0) 3025 #define DEV_USB2_BILLBOARD BIT(1) 3026 #define DEV_USB3_CAPABLE BIT(2) 3027 #define DEV_USB4_CAPABLE BIT(3) 3028 3029+/* Connector Type */ 3030+#define UFP_RECEPTACLE 2 3031+#define UFP_CAPTIVE 3 3032+ 3033+/* Vconn Power (AMA only, set to AMA_VCONN_NOT_REQ if Vconn is not required) */ 3034+#define AMA_VCONN_PWR_1W 0 3035+#define AMA_VCONN_PWR_1W5 1 3036+#define AMA_VCONN_PWR_2W 2 3037+#define AMA_VCONN_PWR_3W 3 3038+#define AMA_VCONN_PWR_4W 4 3039+#define AMA_VCONN_PWR_5W 5 3040+#define AMA_VCONN_PWR_6W 6 3041+ 3042+/* Vconn Required (AMA only) */ 3043+#define AMA_VCONN_NOT_REQ 0 3044+#define AMA_VCONN_REQ 1 3045+ 3046+/* Vbus Required (AMA only) */ 3047+#define AMA_VBUS_REQ 0 3048+#define AMA_VBUS_NOT_REQ 1 3049+ 3050+/* Alternate Modes */ 3051+#define UFP_ALTMODE_NOT_SUPP 0 3052+#define UFP_ALTMODE_TBT3 BIT(0) 3053+#define UFP_ALTMODE_RECFG BIT(1) 3054+#define UFP_ALTMODE_NO_RECFG BIT(2) 3055+ 3056+/* USB Highest Speed */ 3057+#define UFP_USB2_ONLY 0 3058+#define UFP_USB32_GEN1 1 3059+#define UFP_USB32_4_GEN2 2 3060+#define UFP_USB4_GEN3 3 3061+ 3062+#define VDO_UFP(ver, cap, conn, vcpwr, vcr, vbr, alt, spd) \ 3063+ (((ver) & 0x7) << 29 | ((cap) & 0xf) << 24 | ((conn) & 0x3) << 22 \ 3064+ | ((vcpwr) & 0x7) << 8 | (vcr) << 7 | (vbr) << 6 | ((alt) & 0x7) << 3 \ 3065+ | ((spd) & 0x7)) 3066+ 3067 /* 3068- * DFP VDO 3069+ * DFP VDO (PD Revision 3.0+ only) 3070 * -------- 3071 * <31:29> :: DFP VDO version 3072 * <28:27> :: Reserved 3073 * <26:24> :: Host capability 3074- * <23:5> :: Reserved 3075+ * <23:22> :: Connector type (10b == receptacle, 11b == captive plug) 3076+ * <21:5> :: Reserved 3077 * <4:0> :: Port number 3078 */ 3079 #define PD_VDO_DFP_HOSTCAP(vdo) (((vdo) & GENMASK(26, 24)) >> 24) 3080 3081+#define DFP_VDO_VER1_1 1 3082 #define HOST_USB2_CAPABLE BIT(0) 3083 #define HOST_USB3_CAPABLE BIT(1) 3084 #define HOST_USB4_CAPABLE BIT(2) 3085+#define DFP_RECEPTACLE 2 3086+#define DFP_CAPTIVE 3 3087+ 3088+#define VDO_DFP(ver, cap, conn, pnum) \ 3089+ (((ver) & 0x7) << 29 | ((cap) & 0x7) << 24 | ((conn) & 0x3) << 22 \ 3090+ | ((pnum) & 0x1f)) 3091 3092 /* 3093- * Cable VDO 3094+ * Cable VDO (for both Passive and Active Cable VDO in PD Rev2.0) 3095 * --------- 3096 * <31:28> :: Cable HW version 3097 * <27:24> :: Cable FW version 3098 * <23:20> :: Reserved, Shall be set to zero 3099- * <19:18> :: type-C to Type-A/B/C (00b == A, 01 == B, 10 == C) 3100- * <17> :: Type-C to Plug/Receptacle (0b == plug, 1b == receptacle) 3101+ * <19:18> :: type-C to Type-A/B/C/Captive (00b == A, 01 == B, 10 == C, 11 == Captive) 3102+ * <17> :: Reserved, Shall be set to zero 3103 * <16:13> :: cable latency (0001 == <10ns(~1m length)) 3104 * <12:11> :: cable termination type (11b == both ends active VCONN req) 3105 * <10> :: SSTX1 Directionality support (0b == fixed, 1b == cfgable) 3106 * <9> :: SSTX2 Directionality support 3107 * <8> :: SSRX1 Directionality support 3108 * <7> :: SSRX2 Directionality support 3109- * <6:5> :: Vbus current handling capability 3110+ * <6:5> :: Vbus current handling capability (01b == 3A, 10b == 5A) 3111 * <4> :: Vbus through cable (0b == no, 1b == yes) 3112 * <3> :: SOP" controller present? (0b == no, 1b == yes) 3113 * <2:0> :: USB SS Signaling support 3114+ * 3115+ * Passive Cable VDO (PD Rev3.0+) 3116+ * --------- 3117+ * <31:28> :: Cable HW version 3118+ * <27:24> :: Cable FW version 3119+ * <23:21> :: VDO version 3120+ * <20> :: Reserved, Shall be set to zero 3121+ * <19:18> :: Type-C to Type-C/Captive (10b == C, 11b == Captive) 3122+ * <17> :: Reserved, Shall be set to zero 3123+ * <16:13> :: cable latency (0001 == <10ns(~1m length)) 3124+ * <12:11> :: cable termination type (10b == Vconn not req, 01b == Vconn req) 3125+ * <10:9> :: Maximum Vbus voltage (00b == 20V, 01b == 30V, 10b == 40V, 11b == 50V) 3126+ * <8:7> :: Reserved, Shall be set to zero 3127+ * <6:5> :: Vbus current handling capability (01b == 3A, 10b == 5A) 3128+ * <4:3> :: Reserved, Shall be set to zero 3129+ * <2:0> :: USB highest speed 3130+ * 3131+ * Active Cable VDO 1 (PD Rev3.0+) 3132+ * --------- 3133+ * <31:28> :: Cable HW version 3134+ * <27:24> :: Cable FW version 3135+ * <23:21> :: VDO version 3136+ * <20> :: Reserved, Shall be set to zero 3137+ * <19:18> :: Connector type (10b == C, 11b == Captive) 3138+ * <17> :: Reserved, Shall be set to zero 3139+ * <16:13> :: cable latency (0001 == <10ns(~1m length)) 3140+ * <12:11> :: cable termination type (10b == one end active, 11b == both ends active VCONN req) 3141+ * <10:9> :: Maximum Vbus voltage (00b == 20V, 01b == 30V, 10b == 40V, 11b == 50V) 3142+ * <8> :: SBU supported (0b == supported, 1b == not supported) 3143+ * <7> :: SBU type (0b == passive, 1b == active) 3144+ * <6:5> :: Vbus current handling capability (01b == 3A, 10b == 5A) 3145+ * <2:0> :: USB highest speed 3146 */ 3147+/* Cable VDO Version */ 3148+#define CABLE_VDO_VER1_0 0 3149+#define CABLE_VDO_VER1_3 3 3150+ 3151+/* Connector Type (_ATYPE and _BTYPE are for PD Rev2.0 only) */ 3152 #define CABLE_ATYPE 0 3153 #define CABLE_BTYPE 1 3154 #define CABLE_CTYPE 2 3155-#define CABLE_PLUG 0 3156-#define CABLE_RECEPTACLE 1 3157-#define CABLE_CURR_1A5 0 3158+#define CABLE_CAPTIVE 3 3159+ 3160+/* Cable Latency */ 3161+#define CABLE_LATENCY_1M 1 3162+#define CABLE_LATENCY_2M 2 3163+#define CABLE_LATENCY_3M 3 3164+#define CABLE_LATENCY_4M 4 3165+#define CABLE_LATENCY_5M 5 3166+#define CABLE_LATENCY_6M 6 3167+#define CABLE_LATENCY_7M 7 3168+#define CABLE_LATENCY_7M_PLUS 8 3169+ 3170+/* Cable Termination Type */ 3171+#define PCABLE_VCONN_NOT_REQ 0 3172+#define PCABLE_VCONN_REQ 1 3173+#define ACABLE_ONE_END 2 3174+#define ACABLE_BOTH_END 3 3175+ 3176+/* Maximum Vbus Voltage */ 3177+#define CABLE_MAX_VBUS_20V 0 3178+#define CABLE_MAX_VBUS_30V 1 3179+#define CABLE_MAX_VBUS_40V 2 3180+#define CABLE_MAX_VBUS_50V 3 3181+ 3182+/* Active Cable SBU Supported/Type */ 3183+#define ACABLE_SBU_SUPP 0 3184+#define ACABLE_SBU_NOT_SUPP 1 3185+#define ACABLE_SBU_PASSIVE 0 3186+#define ACABLE_SBU_ACTIVE 1 3187+ 3188+/* Vbus Current Handling Capability */ 3189+#define CABLE_CURR_DEF 0 3190 #define CABLE_CURR_3A 1 3191 #define CABLE_CURR_5A 2 3192+ 3193+/* USB SuperSpeed Signaling Support (PD Rev2.0) */ 3194 #define CABLE_USBSS_U2_ONLY 0 3195 #define CABLE_USBSS_U31_GEN1 1 3196 #define CABLE_USBSS_U31_GEN2 2 3197-#define VDO_CABLE(hw, fw, cbl, gdr, lat, term, tx1d, tx2d, rx1d, rx2d, cur,\ 3198- vps, sopp, usbss) \ 3199- (((hw) & 0x7) << 28 | ((fw) & 0x7) << 24 | ((cbl) & 0x3) << 18 \ 3200- | (gdr) << 17 | ((lat) & 0x7) << 13 | ((term) & 0x3) << 11 \ 3201- | (tx1d) << 10 | (tx2d) << 9 | (rx1d) << 8 | (rx2d) << 7 \ 3202- | ((cur) & 0x3) << 5 | (vps) << 4 | (sopp) << 3 \ 3203- | ((usbss) & 0x7)) 3204+ 3205+/* USB Highest Speed */ 3206+#define CABLE_USB2_ONLY 0 3207+#define CABLE_USB32_GEN1 1 3208+#define CABLE_USB32_4_GEN2 2 3209+#define CABLE_USB4_GEN3 3 3210+ 3211+#define VDO_CABLE(hw, fw, cbl, lat, term, tx1d, tx2d, rx1d, rx2d, cur, vps, sopp, usbss) \ 3212+ (((hw) & 0x7) << 28 | ((fw) & 0x7) << 24 | ((cbl) & 0x3) << 18 \ 3213+ | ((lat) & 0x7) << 13 | ((term) & 0x3) << 11 | (tx1d) << 10 \ 3214+ | (tx2d) << 9 | (rx1d) << 8 | (rx2d) << 7 | ((cur) & 0x3) << 5 \ 3215+ | (vps) << 4 | (sopp) << 3 | ((usbss) & 0x7)) 3216+#define VDO_PCABLE(hw, fw, ver, conn, lat, term, vbm, cur, spd) \ 3217+ (((hw) & 0xf) << 28 | ((fw) & 0xf) << 24 | ((ver) & 0x7) << 21 \ 3218+ | ((conn) & 0x3) << 18 | ((lat) & 0xf) << 13 | ((term) & 0x3) << 11 \ 3219+ | ((vbm) & 0x3) << 9 | ((cur) & 0x3) << 5 | ((spd) & 0x7)) 3220+#define VDO_ACABLE1(hw, fw, ver, conn, lat, term, vbm, sbu, sbut, cur, vbt, sopp, spd) \ 3221+ (((hw) & 0xf) << 28 | ((fw) & 0xf) << 24 | ((ver) & 0x7) << 21 \ 3222+ | ((conn) & 0x3) << 18 | ((lat) & 0xf) << 13 | ((term) & 0x3) << 11 \ 3223+ | ((vbm) & 0x3) << 9 | (sbu) << 8 | (sbut) << 7 | ((cur) & 0x3) << 5 \ 3224+ | (vbt) << 4 | (sopp) << 3 | ((spd) & 0x7)) 3225+ 3226+#define VDO_TYPEC_CABLE_TYPE(vdo) (((vdo) >> 18) & 0x3) 3227+ 3228+/* 3229+ * Active Cable VDO 2 3230+ * --------- 3231+ * <31:24> :: Maximum operating temperature 3232+ * <23:16> :: Shutdown temperature 3233+ * <15> :: Reserved, Shall be set to zero 3234+ * <14:12> :: U3/CLd power 3235+ * <11> :: U3 to U0 transition mode (0b == direct, 1b == through U3S) 3236+ * <10> :: Physical connection (0b == copper, 1b == optical) 3237+ * <9> :: Active element (0b == redriver, 1b == retimer) 3238+ * <8> :: USB4 supported (0b == yes, 1b == no) 3239+ * <7:6> :: USB2 hub hops consumed 3240+ * <5> :: USB2 supported (0b == yes, 1b == no) 3241+ * <4> :: USB3.2 supported (0b == yes, 1b == no) 3242+ * <3> :: USB lanes supported (0b == one lane, 1b == two lanes) 3243+ * <2> :: Optically isolated active cable (0b == no, 1b == yes) 3244+ * <1> :: Reserved, Shall be set to zero 3245+ * <0> :: USB gen (0b == gen1, 1b == gen2+) 3246+ */ 3247+ 3248+/* U3/CLd Power*/ 3249+#define ACAB2_U3_CLD_10MW_PLUS 0 3250+#define ACAB2_U3_CLD_10MW 1 3251+#define ACAB2_U3_CLD_5MW 2 3252+#define ACAB2_U3_CLD_1MW 3 3253+#define ACAB2_U3_CLD_500UW 4 3254+#define ACAB2_U3_CLD_200UW 5 3255+#define ACAB2_U3_CLD_50UW 6 3256+ 3257+/* Other Active Cable VDO 2 Fields */ 3258+#define ACAB2_U3U0_DIRECT 0 3259+#define ACAB2_U3U0_U3S 1 3260+#define ACAB2_PHY_COPPER 0 3261+#define ACAB2_PHY_OPTICAL 1 3262+#define ACAB2_REDRIVER 0 3263+#define ACAB2_RETIMER 1 3264+#define ACAB2_USB4_SUPP 0 3265+#define ACAB2_USB4_NOT_SUPP 1 3266+#define ACAB2_USB2_SUPP 0 3267+#define ACAB2_USB2_NOT_SUPP 1 3268+#define ACAB2_USB32_SUPP 0 3269+#define ACAB2_USB32_NOT_SUPP 1 3270+#define ACAB2_LANES_ONE 0 3271+#define ACAB2_LANES_TWO 1 3272+#define ACAB2_OPT_ISO_NO 0 3273+#define ACAB2_OPT_ISO_YES 1 3274+#define ACAB2_GEN_1 0 3275+#define ACAB2_GEN_2_PLUS 1 3276+ 3277+#define VDO_ACABLE2(mtemp, stemp, u3p, trans, phy, ele, u4, hops, u2, u32, lane, iso, gen) \ 3278+ (((mtemp) & 0xff) << 24 | ((stemp) & 0xff) << 16 | ((u3p) & 0x7) << 12 \ 3279+ | (trans) << 11 | (phy) << 10 | (ele) << 9 | (u4) << 8 \ 3280+ | ((hops) & 0x3) << 6 | (u2) << 5 | (u32) << 4 | (lane) << 3 \ 3281+ | (iso) << 2 | (gen)) 3282 3283 /* 3284- * AMA VDO 3285+ * AMA VDO (PD Rev2.0) 3286 * --------- 3287 * <31:28> :: Cable HW version 3288 * <27:24> :: Cable FW version 3289@@ -233,18 +455,40 @@ 3290 #define PD_VDO_AMA_VCONN_REQ(vdo) (((vdo) >> 4) & 1) 3291 #define PD_VDO_AMA_VBUS_REQ(vdo) (((vdo) >> 3) & 1) 3292 3293-#define AMA_VCONN_PWR_1W 0 3294-#define AMA_VCONN_PWR_1W5 1 3295-#define AMA_VCONN_PWR_2W 2 3296-#define AMA_VCONN_PWR_3W 3 3297-#define AMA_VCONN_PWR_4W 4 3298-#define AMA_VCONN_PWR_5W 5 3299-#define AMA_VCONN_PWR_6W 6 3300 #define AMA_USBSS_U2_ONLY 0 3301 #define AMA_USBSS_U31_GEN1 1 3302 #define AMA_USBSS_U31_GEN2 2 3303 #define AMA_USBSS_BBONLY 3 3304 3305+/* 3306+ * VPD VDO 3307+ * --------- 3308+ * <31:28> :: HW version 3309+ * <27:24> :: FW version 3310+ * <23:21> :: VDO version 3311+ * <20:17> :: Reserved, Shall be set to zero 3312+ * <16:15> :: Maximum Vbus voltage (00b == 20V, 01b == 30V, 10b == 40V, 11b == 50V) 3313+ * <14> :: Charge through current support (0b == 3A, 1b == 5A) 3314+ * <13> :: Reserved, Shall be set to zero 3315+ * <12:7> :: Vbus impedance 3316+ * <6:1> :: Ground impedance 3317+ * <0> :: Charge through support (0b == no, 1b == yes) 3318+ */ 3319+#define VPD_VDO_VER1_0 0 3320+#define VPD_MAX_VBUS_20V 0 3321+#define VPD_MAX_VBUS_30V 1 3322+#define VPD_MAX_VBUS_40V 2 3323+#define VPD_MAX_VBUS_50V 3 3324+#define VPDCT_CURR_3A 0 3325+#define VPDCT_CURR_5A 1 3326+#define VPDCT_NOT_SUPP 0 3327+#define VPDCT_SUPP 1 3328+ 3329+#define VDO_VPD(hw, fw, ver, vbm, curr, vbi, gi, ct) \ 3330+ (((hw) & 0xf) << 28 | ((fw) & 0xf) << 24 | ((ver) & 0x7) << 21 \ 3331+ | ((vbm) & 0x3) << 15 | (curr) << 14 | ((vbi) & 0x3f) << 7 \ 3332+ | ((gi) & 0x3f) << 1 | (ct)) 3333+ 3334 /* 3335 * SVDM Discover SVIDs request -> response 3336 * 3337diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h 3338index 5e4c497f5..6567f7445 100644 3339--- a/include/linux/usb/quirks.h 3340+++ b/include/linux/usb/quirks.h 3341@@ -72,4 +72,7 @@ 3342 /* device has endpoints that should be ignored */ 3343 #define USB_QUIRK_ENDPOINT_IGNORE BIT(15) 3344 3345+/* device can't support auto suspend function */ 3346+#define USB_QUIRK_AUTO_SUSPEND BIT(16) 3347+ 3348 #endif /* __LINUX_USB_QUIRKS_H */ 3349diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h 3350index 09762d26f..cb69546f8 100644 3351--- a/include/linux/usb/tcpm.h 3352+++ b/include/linux/usb/tcpm.h 3353@@ -19,6 +19,10 @@ enum typec_cc_status { 3354 TYPEC_CC_RP_3_0, 3355 }; 3356 3357+/* Collision Avoidance */ 3358+#define SINK_TX_NG TYPEC_CC_RP_1_5 3359+#define SINK_TX_OK TYPEC_CC_RP_3_0 3360+ 3361 enum typec_cc_polarity { 3362 TYPEC_POLARITY_CC1, 3363 TYPEC_POLARITY_CC2, 3364@@ -62,6 +66,8 @@ enum tcpm_transmit_type { 3365 * For example, some tcpcs may include BC1.2 charger detection 3366 * and use that in this case. 3367 * @set_cc: Called to set value of CC pins 3368+ * @apply_rc: Optional; Needed to move TCPCI based chipset to APPLY_RC state 3369+ * as stated by the TCPCI specification. 3370 * @get_cc: Called to read current CC pin values 3371 * @set_polarity: 3372 * Called to set polarity 3373@@ -83,6 +89,39 @@ enum tcpm_transmit_type { 3374 * Optional; Called to enable/disable PD 3.0 fast role swap. 3375 * Enabling frs is accessory dependent as not all PD3.0 3376 * accessories support fast role swap. 3377+ * @frs_sourcing_vbus: 3378+ * Optional; Called to notify that vbus is now being sourced. 3379+ * Low level drivers can perform chip specific operations, if any. 3380+ * @enable_auto_vbus_discharge: 3381+ * Optional; TCPCI spec based TCPC implementations can optionally 3382+ * support hardware to autonomously dischrge vbus upon disconnecting 3383+ * as sink or source. TCPM signals TCPC to enable the mechanism upon 3384+ * entering connected state and signals disabling upon disconnect. 3385+ * @set_auto_vbus_discharge_threshold: 3386+ * Mandatory when enable_auto_vbus_discharge is implemented. TCPM 3387+ * calls this function to allow lower levels drivers to program the 3388+ * vbus threshold voltage below which the vbus discharge circuit 3389+ * will be turned on. requested_vbus_voltage is set to 0 when vbus 3390+ * is going to disappear knowingly i.e. during PR_SWAP and 3391+ * HARD_RESET etc. 3392+ * @is_vbus_vsafe0v: 3393+ * Optional; TCPCI spec based TCPC implementations are expected to 3394+ * detect VSAFE0V voltage level at vbus. When detection of VSAFE0V 3395+ * is supported by TCPC, set this callback for TCPM to query 3396+ * whether vbus is at VSAFE0V when needed. 3397+ * Returns true when vbus is at VSAFE0V, false otherwise. 3398+ * @set_partner_usb_comm_capable: 3399+ * Optional; The USB Communications Capable bit indicates if port 3400+ * partner is capable of communication over the USB data lines 3401+ * (e.g. D+/- or SS Tx/Rx). Called to notify the status of the bit. 3402+ * @check_contaminant: 3403+ * Optional; The callback is called when CC pins report open status 3404+ * at the end of the toggling period. Chip level drivers are 3405+ * expected to check for contaminant and re-enable toggling if 3406+ * needed. When 0 is not returned, check_contaminant is expected to 3407+ * restart toggling after checking the connector for contaminant. 3408+ * This forces the TCPM state machine to tranistion to TOGGLING state 3409+ * without calling start_toggling callback. 3410 */ 3411 struct tcpc_dev { 3412 struct fwnode_handle *fwnode; 3413@@ -91,6 +130,8 @@ struct tcpc_dev { 3414 int (*get_vbus)(struct tcpc_dev *dev); 3415 int (*get_current_limit)(struct tcpc_dev *dev); 3416 int (*set_cc)(struct tcpc_dev *dev, enum typec_cc_status cc); 3417+ int (*apply_rc)(struct tcpc_dev *dev, enum typec_cc_status cc, 3418+ enum typec_cc_polarity polarity); 3419 int (*get_cc)(struct tcpc_dev *dev, enum typec_cc_status *cc1, 3420 enum typec_cc_status *cc2); 3421 int (*set_polarity)(struct tcpc_dev *dev, 3422@@ -106,9 +147,16 @@ struct tcpc_dev { 3423 enum typec_cc_status cc); 3424 int (*try_role)(struct tcpc_dev *dev, int role); 3425 int (*pd_transmit)(struct tcpc_dev *dev, enum tcpm_transmit_type type, 3426- const struct pd_message *msg); 3427+ const struct pd_message *msg, unsigned int negotiated_rev); 3428 int (*set_bist_data)(struct tcpc_dev *dev, bool on); 3429 int (*enable_frs)(struct tcpc_dev *dev, bool enable); 3430+ void (*frs_sourcing_vbus)(struct tcpc_dev *dev); 3431+ int (*enable_auto_vbus_discharge)(struct tcpc_dev *dev, bool enable); 3432+ int (*set_auto_vbus_discharge_threshold)(struct tcpc_dev *dev, enum typec_pwr_opmode mode, 3433+ bool pps_active, u32 requested_vbus_voltage); 3434+ int (*check_contaminant)(struct tcpc_dev *dev); 3435+ bool (*is_vbus_vsafe0v)(struct tcpc_dev *dev); 3436+ void (*set_partner_usb_comm_capable)(struct tcpc_dev *dev, bool enable); 3437 }; 3438 3439 struct tcpm_port; 3440@@ -116,6 +164,10 @@ struct tcpm_port; 3441 struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc); 3442 void tcpm_unregister_port(struct tcpm_port *port); 3443 3444+int tcpm_update_sink_capabilities(struct tcpm_port *port, const u32 *pdo, 3445+ unsigned int nr_pdo, 3446+ unsigned int operating_snk_mw); 3447+ 3448 void tcpm_vbus_change(struct tcpm_port *port); 3449 void tcpm_cc_change(struct tcpm_port *port); 3450 void tcpm_sink_frs(struct tcpm_port *port); 3451@@ -126,5 +178,7 @@ void tcpm_pd_transmit_complete(struct tcpm_port *port, 3452 enum tcpm_transmit_status status); 3453 void tcpm_pd_hard_reset(struct tcpm_port *port); 3454 void tcpm_tcpc_reset(struct tcpm_port *port); 3455+bool tcpm_is_debouncing(struct tcpm_port *tcpm); 3456+bool tcpm_is_toggling(struct tcpm_port *port); 3457 3458 #endif /* __LINUX_USB_TCPM_H */ 3459diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h 3460index 6be558045..91b4303ca 100644 3461--- a/include/linux/usb/typec.h 3462+++ b/include/linux/usb/typec.h 3463@@ -126,9 +126,12 @@ struct typec_altmode_desc { 3464 enum typec_port_data roles; 3465 }; 3466 3467+void typec_partner_set_pd_revision(struct typec_partner *partner, u16 pd_revision); 3468+int typec_partner_set_num_altmodes(struct typec_partner *partner, int num_altmodes); 3469 struct typec_altmode 3470 *typec_partner_register_altmode(struct typec_partner *partner, 3471 const struct typec_altmode_desc *desc); 3472+int typec_plug_set_num_altmodes(struct typec_plug *plug, int num_altmodes); 3473 struct typec_altmode 3474 *typec_plug_register_altmode(struct typec_plug *plug, 3475 const struct typec_altmode_desc *desc); 3476@@ -162,6 +165,7 @@ struct typec_plug_desc { 3477 * @type: The plug type from USB PD Cable VDO 3478 * @active: Is the cable active or passive 3479 * @identity: Result of Discover Identity command 3480+ * @pd_revision: USB Power Delivery Specification revision if supported 3481 * 3482 * Represents USB Type-C Cable attached to USB Type-C port. 3483 */ 3484@@ -169,6 +173,8 @@ struct typec_cable_desc { 3485 enum typec_plug_type type; 3486 unsigned int active:1; 3487 struct usb_pd_identity *identity; 3488+ u16 pd_revision; /* 0300H = "3.0" */ 3489+ 3490 }; 3491 3492 /* 3493@@ -176,15 +182,22 @@ struct typec_cable_desc { 3494 * @usb_pd: USB Power Delivery support 3495 * @accessory: Audio, Debug or none. 3496 * @identity: Discover Identity command data 3497+ * @pd_revision: USB Power Delivery Specification Revision if supported 3498 * 3499 * Details about a partner that is attached to USB Type-C port. If @identity 3500 * member exists when partner is registered, a directory named "identity" is 3501 * created to sysfs for the partner device. 3502+ * 3503+ * @pd_revision is based on the setting of the "Specification Revision" field 3504+ * in the message header on the initial "Source Capabilities" message received 3505+ * from the partner, or a "Request" message received from the partner, depending 3506+ * on whether our port is a Sink or a Source. 3507 */ 3508 struct typec_partner_desc { 3509 unsigned int usb_pd:1; 3510 enum typec_accessory accessory; 3511 struct usb_pd_identity *identity; 3512+ u16 pd_revision; /* 0300H = "3.0" */ 3513 }; 3514 3515 /** 3516@@ -204,12 +217,19 @@ struct typec_operations { 3517 enum typec_port_type type); 3518 }; 3519 3520+enum usb_pd_svdm_ver { 3521+ SVDM_VER_1_0 = 0, 3522+ SVDM_VER_2_0 = 1, 3523+ SVDM_VER_MAX = SVDM_VER_2_0, 3524+}; 3525+ 3526 /* 3527 * struct typec_capability - USB Type-C Port Capabilities 3528 * @type: Supported power role of the port 3529 * @data: Supported data role of the port 3530 * @revision: USB Type-C Specification release. Binary coded decimal 3531 * @pd_revision: USB Power Delivery Specification revision if supported 3532+ * @svdm_version: USB PD Structured VDM version if supported 3533 * @prefer_role: Initial role preference (DRP ports). 3534 * @accessory: Supported Accessory Modes 3535 * @fwnode: Optional fwnode of the port 3536@@ -223,6 +243,7 @@ struct typec_capability { 3537 enum typec_port_data data; 3538 u16 revision; /* 0120H = "1.2" */ 3539 u16 pd_revision; /* 0300H = "3.0" */ 3540+ enum usb_pd_svdm_ver svdm_version; 3541 int prefer_role; 3542 enum typec_accessory accessory[TYPEC_MAX_ACCESSORY]; 3543 unsigned int orientation_aware:1; 3544@@ -273,4 +294,8 @@ int typec_find_orientation(const char *name); 3545 int typec_find_port_power_role(const char *name); 3546 int typec_find_power_role(const char *name); 3547 int typec_find_port_data_role(const char *name); 3548+ 3549+void typec_partner_set_svdm_version(struct typec_partner *partner, 3550+ enum usb_pd_svdm_ver svdm_version); 3551+int typec_get_negotiated_svdm_version(struct typec_port *port); 3552 #endif /* __LINUX_USB_TYPEC_H */ 3553diff --git a/include/linux/usb/typec_altmode.h b/include/linux/usb/typec_altmode.h 3554index 5e0a7b764..65933cbe9 100644 3555--- a/include/linux/usb/typec_altmode.h 3556+++ b/include/linux/usb/typec_altmode.h 3557@@ -132,6 +132,16 @@ typec_altmode_get_orientation(struct typec_altmode *altmode) 3558 return typec_get_orientation(typec_altmode2port(altmode)); 3559 } 3560 3561+/** 3562+ * typec_altmode_get_svdm_version - Get negotiated SVDM version 3563+ * @altmode: Handle to the alternate mode 3564+ */ 3565+static inline int 3566+typec_altmode_get_svdm_version(struct typec_altmode *altmode) 3567+{ 3568+ return typec_get_negotiated_svdm_version(typec_altmode2port(altmode)); 3569+} 3570+ 3571 /** 3572 * struct typec_altmode_driver - USB Type-C alternate mode device driver 3573 * @id_table: Null terminated array of SVIDs 3574diff --git a/include/linux/usb/typec_tbt.h b/include/linux/usb/typec_tbt.h 3575index 47c2d501d..63dd44b72 100644 3576--- a/include/linux/usb/typec_tbt.h 3577+++ b/include/linux/usb/typec_tbt.h 3578@@ -39,12 +39,16 @@ struct typec_thunderbolt_data { 3579 #define TBT_CABLE_USB3_GEN1 1 3580 #define TBT_CABLE_USB3_PASSIVE 2 3581 #define TBT_CABLE_10_AND_20GBPS 3 3582-#define TBT_CABLE_ROUNDED BIT(19) 3583+#define TBT_CABLE_ROUNDED_SUPPORT(_vdo_) \ 3584+ (((_vdo_) & GENMASK(20, 19)) >> 19) 3585+#define TBT_GEN3_NON_ROUNDED 0 3586+#define TBT_GEN3_GEN4_ROUNDED_NON_ROUNDED 1 3587 #define TBT_CABLE_OPTICAL BIT(21) 3588 #define TBT_CABLE_RETIMER BIT(22) 3589 #define TBT_CABLE_LINK_TRAINING BIT(23) 3590 3591 #define TBT_SET_CABLE_SPEED(_s_) (((_s_) & GENMASK(2, 0)) << 16) 3592+#define TBT_SET_CABLE_ROUNDED(_g_) (((_g_) & GENMASK(1, 0)) << 19) 3593 3594 /* TBT3 Device Enter Mode VDO bits */ 3595 #define TBT_ENTER_MODE_CABLE_SPEED(s) TBT_SET_CABLE_SPEED(s) 3596diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h 3597index 8110c29fa..2e4f7721f 100644 3598--- a/include/linux/usb/usbnet.h 3599+++ b/include/linux/usb/usbnet.h 3600@@ -83,8 +83,6 @@ struct usbnet { 3601 # define EVENT_LINK_CHANGE 11 3602 # define EVENT_SET_RX_MODE 12 3603 # define EVENT_NO_IP_ALIGN 13 3604- u32 rx_speed; /* in bps - NOT Mbps */ 3605- u32 tx_speed; /* in bps - NOT Mbps */ 3606 }; 3607 3608 static inline struct usb_driver *driver_of(struct usb_interface *intf) 3609diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h 3610index 92cd9f038..03b43b0f7 100644 3611--- a/include/media/v4l2-async.h 3612+++ b/include/media/v4l2-async.h 3613@@ -266,6 +266,21 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev, 3614 int v4l2_async_subdev_notifier_register(struct v4l2_subdev *sd, 3615 struct v4l2_async_notifier *notifier); 3616 3617+/** 3618+ * v4l2_async_notifier_clr_unready_dev - remove unready subdevice 3619+ * 3620+ * @notifier: pointer to &struct v4l2_async_notifier 3621+ */ 3622+#if IS_ENABLED(CONFIG_NO_GKI) 3623+int v4l2_async_notifier_clr_unready_dev(struct v4l2_async_notifier *notifier); 3624+#else 3625+static inline int 3626+v4l2_async_notifier_clr_unready_dev(struct v4l2_async_notifier *notifier) 3627+{ 3628+ return 0; 3629+} 3630+#endif 3631+ 3632 /** 3633 * v4l2_async_notifier_unregister - unregisters a subdevice 3634 * asynchronous notifier 3635diff --git a/include/soc/rockchip/rockchip_sip.h b/include/soc/rockchip/rockchip_sip.h 3636index c46a9ae2a..4afba01c6 100644 3637--- a/include/soc/rockchip/rockchip_sip.h 3638+++ b/include/soc/rockchip/rockchip_sip.h 3639@@ -15,6 +15,12 @@ 3640 #define ROCKCHIP_SIP_CONFIG_DRAM_GET_RATE 0x05 3641 #define ROCKCHIP_SIP_CONFIG_DRAM_CLR_IRQ 0x06 3642 #define ROCKCHIP_SIP_CONFIG_DRAM_SET_PARAM 0x07 3643-#define ROCKCHIP_SIP_CONFIG_DRAM_SET_ODT_PD 0x08 3644+#define ROCKCHIP_SIP_CONFIG_DRAM_GET_VERSION 0x08 3645+#define ROCKCHIP_SIP_CONFIG_DRAM_POST_SET_RATE 0x09 3646+#define ROCKCHIP_SIP_CONFIG_DRAM_SET_MSCH_RL 0x0a 3647+#define ROCKCHIP_SIP_CONFIG_DRAM_DEBUG 0x0b 3648+#define ROCKCHIP_SIP_CONFIG_MCU_START 0x0c 3649+#define ROCKCHIP_SIP_CONFIG_DRAM_GET_FREQ_INFO 0x0e 3650+#define ROCKCHIP_SIP_CONFIG_DRAM_ADDRMAP_GET 0x10 3651 3652 #endif 3653diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h 3654index b55970859..4fc733c8c 100644 3655--- a/include/sound/hdmi-codec.h 3656+++ b/include/sound/hdmi-codec.h 3657@@ -34,6 +34,11 @@ struct hdmi_codec_daifmt { 3658 unsigned int frame_clk_inv:1; 3659 unsigned int bit_clk_master:1; 3660 unsigned int frame_clk_master:1; 3661+ /* bit_fmt could be standard PCM format or 3662+ * IEC958 encoded format. ALSA IEC958 plugin will pass 3663+ * IEC958_SUBFRAME format to the underneath driver. 3664+ */ 3665+ snd_pcm_format_t bit_fmt; 3666 }; 3667 3668 /* 3669@@ -60,12 +65,22 @@ struct hdmi_codec_ops { 3670 3671 /* 3672 * Configures HDMI-encoder for audio stream. 3673- * Mandatory 3674+ * Having either prepare or hw_params is mandatory. 3675 */ 3676 int (*hw_params)(struct device *dev, void *data, 3677 struct hdmi_codec_daifmt *fmt, 3678 struct hdmi_codec_params *hparms); 3679 3680+ /* 3681+ * Configures HDMI-encoder for audio stream. Can be called 3682+ * multiple times for each setup. 3683+ * 3684+ * Having either prepare or hw_params is mandatory. 3685+ */ 3686+ int (*prepare)(struct device *dev, void *data, 3687+ struct hdmi_codec_daifmt *fmt, 3688+ struct hdmi_codec_params *hparms); 3689+ 3690 /* 3691 * Shuts down the audio stream. 3692 * Mandatory 3693diff --git a/include/trace/events/cpuhp.h b/include/trace/events/cpuhp.h 3694index ad16f7731..f302ab6db 100644 3695--- a/include/trace/events/cpuhp.h 3696+++ b/include/trace/events/cpuhp.h 3697@@ -89,6 +89,28 @@ TRACE_EVENT(cpuhp_exit, 3698 __entry->cpu, __entry->state, __entry->idx, __entry->ret) 3699 ); 3700 3701+TRACE_EVENT(cpuhp_pause, 3702+ TP_PROTO(struct cpumask *cpus, u64 start_time, unsigned char pause), 3703+ 3704+ TP_ARGS(cpus, start_time, pause), 3705+ 3706+ TP_STRUCT__entry( 3707+ __field( unsigned int, cpus ) 3708+ __field( unsigned int, active_cpus ) 3709+ __field( unsigned int, time ) 3710+ __field( unsigned char, pause ) 3711+ ), 3712+ 3713+ TP_fast_assign( 3714+ __entry->cpus = cpumask_bits(cpus)[0]; 3715+ __entry->active_cpus = cpumask_bits(cpu_active_mask)[0]; 3716+ __entry->time = div64_u64(sched_clock() - start_time, 1000); 3717+ __entry->pause = pause; 3718+ ), 3719+ 3720+ TP_printk("req_cpus=0x%x act_cpus=0x%x time=%u us paused=%d", 3721+ __entry->cpus, __entry->active_cpus, __entry->time, __entry->pause) 3722+); 3723 #endif 3724 3725 /* This part must be outside protection */ 3726diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h 3727index 11b133fa9..421c9848c 100644 3728--- a/include/trace/events/sched.h 3729+++ b/include/trace/events/sched.h 3730@@ -203,6 +203,7 @@ TRACE_EVENT(sched_migrate_task, 3731 __field( int, prio ) 3732 __field( int, orig_cpu ) 3733 __field( int, dest_cpu ) 3734+ __field( int, running ) 3735 ), 3736 3737 TP_fast_assign( 3738@@ -211,11 +212,13 @@ TRACE_EVENT(sched_migrate_task, 3739 __entry->prio = p->prio; /* XXX SCHED_DEADLINE */ 3740 __entry->orig_cpu = task_cpu(p); 3741 __entry->dest_cpu = dest_cpu; 3742+ __entry->running = (p->state == TASK_RUNNING); 3743 ), 3744 3745- TP_printk("comm=%s pid=%d prio=%d orig_cpu=%d dest_cpu=%d", 3746+ TP_printk("comm=%s pid=%d prio=%d orig_cpu=%d dest_cpu=%d running=%d", 3747 __entry->comm, __entry->pid, __entry->prio, 3748- __entry->orig_cpu, __entry->dest_cpu) 3749+ __entry->orig_cpu, __entry->dest_cpu, 3750+ __entry->running) 3751 ); 3752 3753 DECLARE_EVENT_CLASS(sched_process_template, 3754diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h 3755index 5498d7a65..5b5db0381 100644 3756--- a/include/uapi/drm/drm_fourcc.h 3757+++ b/include/uapi/drm/drm_fourcc.h 3758@@ -242,6 +242,8 @@ extern "C" { 3759 * index 1 = Cr:Cb plane, [39:0] Cr1:Cb1:Cr0:Cb0 little endian 3760 */ 3761 #define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') /* 2x2 subsampled Cr:Cb plane */ 3762+#define DRM_FORMAT_NV20 fourcc_code('N', 'V', '2', '0') /* 2x1 subsampled Cr:Cb plane */ 3763+#define DRM_FORMAT_NV30 fourcc_code('N', 'V', '3', '0') /* non-subsampled Cr:Cb plane */ 3764 3765 /* 3766 * 2 plane YCbCr MSB aligned 3767diff --git a/include/uapi/linux/media-bus-format.h b/include/uapi/linux/media-bus-format.h 3768index 84fa53ffb..096f891d4 100644 3769--- a/include/uapi/linux/media-bus-format.h 3770+++ b/include/uapi/linux/media-bus-format.h 3771@@ -34,7 +34,7 @@ 3772 3773 #define MEDIA_BUS_FMT_FIXED 0x0001 3774 3775-/* RGB - next is 0x101d */ 3776+/* RGB - next is 0x1024 */ 3777 #define MEDIA_BUS_FMT_RGB444_1X12 0x1016 3778 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE 0x1001 3779 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE 0x1002 3780@@ -63,6 +63,10 @@ 3781 #define MEDIA_BUS_FMT_RGB101010_1X30 0x1018 3782 #define MEDIA_BUS_FMT_RGB121212_1X36 0x1019 3783 #define MEDIA_BUS_FMT_RGB161616_1X48 0x101a 3784+#define MEDIA_BUS_FMT_RGB888_DUMMY_4X8 0x101f 3785+#define MEDIA_BUS_FMT_BGR888_DUMMY_4X8 0x1020 3786+#define MEDIA_BUS_FMT_RGB101010_1X7X5_SPWG 0x1022 3787+#define MEDIA_BUS_FMT_RGB101010_1X7X5_JEIDA 0x1023 3788 3789 /* YUV (including grey) - next is 0x202e */ 3790 #define MEDIA_BUS_FMT_Y8_1X8 0x2001 3791diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h 3792index f51bc8f36..7e3fe68af 100644 3793--- a/include/uapi/linux/serial_reg.h 3794+++ b/include/uapi/linux/serial_reg.h 3795@@ -30,6 +30,7 @@ 3796 * Sleep mode for ST16650 and TI16750. For the ST16650, EFR[4]=1 3797 */ 3798 #define UART_IERX_SLEEP 0x10 /* Enable sleep mode */ 3799+#define UART_IER_PTIME 0x80 /* Enable programmable transmit interrupt mode */ 3800 3801 #define UART_IIR 2 /* In: Interrupt ID Register */ 3802 #define UART_IIR_NO_INT 0x01 /* No interrupts pending */ 3803diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h 3804index 0f865ae4b..17ce56198 100644 3805--- a/include/uapi/linux/usb/ch9.h 3806+++ b/include/uapi/linux/usb/ch9.h 3807@@ -968,9 +968,22 @@ struct usb_ssp_cap_descriptor { 3808 __le32 bmSublinkSpeedAttr[1]; /* list of sublink speed attrib entries */ 3809 #define USB_SSP_SUBLINK_SPEED_SSID (0xf) /* sublink speed ID */ 3810 #define USB_SSP_SUBLINK_SPEED_LSE (0x3 << 4) /* Lanespeed exponent */ 3811+#define USB_SSP_SUBLINK_SPEED_LSE_BPS 0 3812+#define USB_SSP_SUBLINK_SPEED_LSE_KBPS 1 3813+#define USB_SSP_SUBLINK_SPEED_LSE_MBPS 2 3814+#define USB_SSP_SUBLINK_SPEED_LSE_GBPS 3 3815+ 3816 #define USB_SSP_SUBLINK_SPEED_ST (0x3 << 6) /* Sublink type */ 3817+#define USB_SSP_SUBLINK_SPEED_ST_SYM_RX 0 3818+#define USB_SSP_SUBLINK_SPEED_ST_ASYM_RX 1 3819+#define USB_SSP_SUBLINK_SPEED_ST_SYM_TX 2 3820+#define USB_SSP_SUBLINK_SPEED_ST_ASYM_TX 3 3821+ 3822 #define USB_SSP_SUBLINK_SPEED_RSVD (0x3f << 8) /* Reserved */ 3823 #define USB_SSP_SUBLINK_SPEED_LP (0x3 << 14) /* Link protocol */ 3824+#define USB_SSP_SUBLINK_SPEED_LP_SS 0 3825+#define USB_SSP_SUBLINK_SPEED_LP_SSP 1 3826+ 3827 #define USB_SSP_SUBLINK_SPEED_LSM (0xff << 16) /* Lanespeed mantissa */ 3828 } __attribute__((packed)); 3829 3830diff --git a/include/uapi/linux/usb/f_accessory.h b/include/uapi/linux/usb/f_accessory.h 3831new file mode 100644 3832index 000000000..0baeb7d0d 3833--- /dev/null 3834+++ b/include/uapi/linux/usb/f_accessory.h 3835@@ -0,0 +1,146 @@ 3836+/* 3837+ * Gadget Function Driver for Android USB accessories 3838+ * 3839+ * Copyright (C) 2011 Google, Inc. 3840+ * Author: Mike Lockwood <lockwood@android.com> 3841+ * 3842+ * This software is licensed under the terms of the GNU General Public 3843+ * License version 2, as published by the Free Software Foundation, and 3844+ * may be copied, distributed, and modified under those terms. 3845+ * 3846+ * This program is distributed in the hope that it will be useful, 3847+ * but WITHOUT ANY WARRANTY; without even the implied warranty of 3848+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 3849+ * GNU General Public License for more details. 3850+ * 3851+ */ 3852+ 3853+#ifndef _UAPI_LINUX_USB_F_ACCESSORY_H 3854+#define _UAPI_LINUX_USB_F_ACCESSORY_H 3855+ 3856+/* Use Google Vendor ID when in accessory mode */ 3857+#define USB_ACCESSORY_VENDOR_ID 0x18D1 3858+ 3859+ 3860+/* Product ID to use when in accessory mode */ 3861+#define USB_ACCESSORY_PRODUCT_ID 0x2D00 3862+ 3863+/* Product ID to use when in accessory mode and adb is enabled */ 3864+#define USB_ACCESSORY_ADB_PRODUCT_ID 0x2D01 3865+ 3866+/* Indexes for strings sent by the host via ACCESSORY_SEND_STRING */ 3867+#define ACCESSORY_STRING_MANUFACTURER 0 3868+#define ACCESSORY_STRING_MODEL 1 3869+#define ACCESSORY_STRING_DESCRIPTION 2 3870+#define ACCESSORY_STRING_VERSION 3 3871+#define ACCESSORY_STRING_URI 4 3872+#define ACCESSORY_STRING_SERIAL 5 3873+ 3874+/* Control request for retrieving device's protocol version 3875+ * 3876+ * requestType: USB_DIR_IN | USB_TYPE_VENDOR 3877+ * request: ACCESSORY_GET_PROTOCOL 3878+ * value: 0 3879+ * index: 0 3880+ * data version number (16 bits little endian) 3881+ * 1 for original accessory support 3882+ * 2 adds HID and device to host audio support 3883+ */ 3884+#define ACCESSORY_GET_PROTOCOL 51 3885+ 3886+/* Control request for host to send a string to the device 3887+ * 3888+ * requestType: USB_DIR_OUT | USB_TYPE_VENDOR 3889+ * request: ACCESSORY_SEND_STRING 3890+ * value: 0 3891+ * index: string ID 3892+ * data zero terminated UTF8 string 3893+ * 3894+ * The device can later retrieve these strings via the 3895+ * ACCESSORY_GET_STRING_* ioctls 3896+ */ 3897+#define ACCESSORY_SEND_STRING 52 3898+ 3899+/* Control request for starting device in accessory mode. 3900+ * The host sends this after setting all its strings to the device. 3901+ * 3902+ * requestType: USB_DIR_OUT | USB_TYPE_VENDOR 3903+ * request: ACCESSORY_START 3904+ * value: 0 3905+ * index: 0 3906+ * data none 3907+ */ 3908+#define ACCESSORY_START 53 3909+ 3910+/* Control request for registering a HID device. 3911+ * Upon registering, a unique ID is sent by the accessory in the 3912+ * value parameter. This ID will be used for future commands for 3913+ * the device 3914+ * 3915+ * requestType: USB_DIR_OUT | USB_TYPE_VENDOR 3916+ * request: ACCESSORY_REGISTER_HID_DEVICE 3917+ * value: Accessory assigned ID for the HID device 3918+ * index: total length of the HID report descriptor 3919+ * data none 3920+ */ 3921+#define ACCESSORY_REGISTER_HID 54 3922+ 3923+/* Control request for unregistering a HID device. 3924+ * 3925+ * requestType: USB_DIR_OUT | USB_TYPE_VENDOR 3926+ * request: ACCESSORY_REGISTER_HID 3927+ * value: Accessory assigned ID for the HID device 3928+ * index: 0 3929+ * data none 3930+ */ 3931+#define ACCESSORY_UNREGISTER_HID 55 3932+ 3933+/* Control request for sending the HID report descriptor. 3934+ * If the HID descriptor is longer than the endpoint zero max packet size, 3935+ * the descriptor will be sent in multiple ACCESSORY_SET_HID_REPORT_DESC 3936+ * commands. The data for the descriptor must be sent sequentially 3937+ * if multiple packets are needed. 3938+ * 3939+ * requestType: USB_DIR_OUT | USB_TYPE_VENDOR 3940+ * request: ACCESSORY_SET_HID_REPORT_DESC 3941+ * value: Accessory assigned ID for the HID device 3942+ * index: offset of data in descriptor 3943+ * (needed when HID descriptor is too big for one packet) 3944+ * data the HID report descriptor 3945+ */ 3946+#define ACCESSORY_SET_HID_REPORT_DESC 56 3947+ 3948+/* Control request for sending HID events. 3949+ * 3950+ * requestType: USB_DIR_OUT | USB_TYPE_VENDOR 3951+ * request: ACCESSORY_SEND_HID_EVENT 3952+ * value: Accessory assigned ID for the HID device 3953+ * index: 0 3954+ * data the HID report for the event 3955+ */ 3956+#define ACCESSORY_SEND_HID_EVENT 57 3957+ 3958+/* Control request for setting the audio mode. 3959+ * 3960+ * requestType: USB_DIR_OUT | USB_TYPE_VENDOR 3961+ * request: ACCESSORY_SET_AUDIO_MODE 3962+ * value: 0 - no audio 3963+ * 1 - device to host, 44100 16-bit stereo PCM 3964+ * index: 0 3965+ * data none 3966+ */ 3967+#define ACCESSORY_SET_AUDIO_MODE 58 3968+ 3969+/* ioctls for retrieving strings set by the host */ 3970+#define ACCESSORY_GET_STRING_MANUFACTURER _IOW('M', 1, char[256]) 3971+#define ACCESSORY_GET_STRING_MODEL _IOW('M', 2, char[256]) 3972+#define ACCESSORY_GET_STRING_DESCRIPTION _IOW('M', 3, char[256]) 3973+#define ACCESSORY_GET_STRING_VERSION _IOW('M', 4, char[256]) 3974+#define ACCESSORY_GET_STRING_URI _IOW('M', 5, char[256]) 3975+#define ACCESSORY_GET_STRING_SERIAL _IOW('M', 6, char[256]) 3976+/* returns 1 if there is a start request pending */ 3977+#define ACCESSORY_IS_START_REQUESTED _IO('M', 7) 3978+/* returns audio mode (set via the ACCESSORY_SET_AUDIO_MODE control request) */ 3979+#define ACCESSORY_GET_AUDIO_MODE _IO('M', 8) 3980+ 3981+#endif /* _UAPI_LINUX_USB_F_ACCESSORY_H */ 3982diff --git a/include/uapi/linux/usb/g_uvc.h b/include/uapi/linux/usb/g_uvc.h 3983index 652f169a0..428926e35 100644 3984--- a/include/uapi/linux/usb/g_uvc.h 3985+++ b/include/uapi/linux/usb/g_uvc.h 3986@@ -19,7 +19,9 @@ 3987 #define UVC_EVENT_STREAMOFF (V4L2_EVENT_PRIVATE_START + 3) 3988 #define UVC_EVENT_SETUP (V4L2_EVENT_PRIVATE_START + 4) 3989 #define UVC_EVENT_DATA (V4L2_EVENT_PRIVATE_START + 5) 3990-#define UVC_EVENT_LAST (V4L2_EVENT_PRIVATE_START + 5) 3991+#define UVC_EVENT_SUSPEND (V4L2_EVENT_PRIVATE_START + 6) 3992+#define UVC_EVENT_RESUME (V4L2_EVENT_PRIVATE_START + 7) 3993+#define UVC_EVENT_LAST (V4L2_EVENT_PRIVATE_START + 7) 3994 3995 struct uvc_request_data { 3996 __s32 length; 3997diff --git a/include/uapi/linux/usb/video.h b/include/uapi/linux/usb/video.h 3998index bfdae12cd..b82436fd9 100644 3999--- a/include/uapi/linux/usb/video.h 4000+++ b/include/uapi/linux/usb/video.h 4001@@ -567,5 +567,63 @@ struct UVC_FRAME_MJPEG(n) { \ 4002 __le32 dwFrameInterval[n]; \ 4003 } __attribute__ ((packed)) 4004 4005+/* Frame Based Payload - 3.1.1. Frame Based Video Format Descriptor */ 4006+struct uvc_format_framebased { 4007+ __u8 bLength; 4008+ __u8 bDescriptorType; 4009+ __u8 bDescriptorSubType; 4010+ __u8 bFormatIndex; 4011+ __u8 bNumFrameDescriptors; 4012+ __u8 guidFormat[16]; 4013+ __u8 bBitsPerPixel; 4014+ __u8 bDefaultFrameIndex; 4015+ __u8 bAspectRatioX; 4016+ __u8 bAspectRatioY; 4017+ __u8 bmInterfaceFlags; 4018+ __u8 bCopyProtect; 4019+ __u8 bVariableSize; 4020+} __attribute__((__packed__)); 4021+ 4022+#define UVC_DT_FORMAT_FRAMEBASED_SIZE 28 4023+ 4024+/* Frame Based Payload - 3.1.2. Frame Based Video Frame Descriptor */ 4025+struct uvc_frame_framebased { 4026+ __u8 bLength; 4027+ __u8 bDescriptorType; 4028+ __u8 bDescriptorSubType; 4029+ __u8 bFrameIndex; 4030+ __u8 bmCapabilities; 4031+ __u16 wWidth; 4032+ __u16 wHeight; 4033+ __u32 dwMinBitRate; 4034+ __u32 dwMaxBitRate; 4035+ __u32 dwDefaultFrameInterval; 4036+ __u8 bFrameIntervalType; 4037+ __u32 dwBytesPerLine; 4038+ __u32 dwFrameInterval[]; 4039+} __attribute__((__packed__)); 4040+ 4041+#define UVC_DT_FRAME_FRAMEBASED_SIZE(n) (26+4*(n)) 4042+ 4043+#define UVC_FRAME_FRAMEBASED(n) \ 4044+ uvc_frame_framebased_##n 4045+ 4046+#define DECLARE_UVC_FRAME_FRAMEBASED(n) \ 4047+struct UVC_FRAME_FRAMEBASED(n) { \ 4048+ __u8 bLength; \ 4049+ __u8 bDescriptorType; \ 4050+ __u8 bDescriptorSubType; \ 4051+ __u8 bFrameIndex; \ 4052+ __u8 bmCapabilities; \ 4053+ __u16 wWidth; \ 4054+ __u16 wHeight; \ 4055+ __u32 dwMinBitRate; \ 4056+ __u32 dwMaxBitRate; \ 4057+ __u32 dwDefaultFrameInterval; \ 4058+ __u8 bFrameIntervalType; \ 4059+ __u32 dwBytesPerLine; \ 4060+ __u32 dwFrameInterval[n]; \ 4061+} __attribute__ ((packed)) 4062+ 4063 #endif /* __LINUX_USB_VIDEO_H */ 4064 4065diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h 4066index a184c4939..a3eb68372 100644 4067--- a/include/uapi/linux/v4l2-controls.h 4068+++ b/include/uapi/linux/v4l2-controls.h 4069@@ -188,6 +188,12 @@ enum v4l2_colorfx { 4070 */ 4071 #define V4L2_CID_USER_MAX217X_BASE (V4L2_CID_USER_BASE + 0x1090) 4072 4073+/* 4074+ * The base for the tc35874x driver controls. 4075+ * We reserve 16 controls for this driver. 4076+ */ 4077+#define V4L2_CID_USER_TC35874X_BASE (V4L2_CID_USER_BASE + 0x10a0) 4078+ 4079 /* The base for the imx driver controls. 4080 * We reserve 16 controls for this driver. */ 4081 #define V4L2_CID_USER_IMX_BASE (V4L2_CID_USER_BASE + 0x10b0) 4082diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h 4083index 534eaa4d3..eb01fb549 100644 4084--- a/include/uapi/linux/videodev2.h 4085+++ b/include/uapi/linux/videodev2.h 4086@@ -689,6 +689,7 @@ struct v4l2_pix_format { 4087 #define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */ 4088 #define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */ 4089 #define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 Multiplexed */ 4090+#define V4L2_PIX_FMT_H265 v4l2_fourcc('H', '2', '6', '5') /* H265 with start codes */ 4091 #define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4') /* H264 with start codes */ 4092 #define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '1') /* H264 without start codes */ 4093 #define V4L2_PIX_FMT_H264_MVC v4l2_fourcc('M', '2', '6', '4') /* H264 MVC */ 4094