All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Benson Leung <bleung@google.com>
To: Prashant Malani <pmalani@chromium.org>
Cc: linux-kernel@vger.kernel.org, chrome-platform@lists.linux.dev,
	heikki.krogerus@linux.intel.com,
	Benson Leung <bleung@chromium.org>,
	Daisuke Nojiri <dnojiri@chromium.org>,
	"Dustin L. Howett" <dustin@howett.net>,
	Evan Green <evgreen@chromium.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Guenter Roeck <groeck@chromium.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Lee Jones <lee.jones@linaro.org>, Lee Jones <lee@kernel.org>,
	Sebastian Reichel <sebastian.reichel@collabora.com>,
	Stephen Boyd <swboyd@chromium.org>,
	Tinghan Shen <tinghan.shen@mediatek.com>,
	Tzung-Bi Shih <tzungbi@kernel.org>,
	Xiang wangx <wangxiang@cdjrlc.com>
Subject: Re: [PATCH 06/10] platform/chrome: cros_ec_typec: Move structs to header
Date: Mon, 9 Jan 2023 11:47:16 -0800	[thread overview]
Message-ID: <Y7xvRKax2wls5+IL@google.com> (raw)
In-Reply-To: <20221228004648.793339-7-pmalani@chromium.org>

[-- Attachment #1: Type: text/plain, Size: 7577 bytes --]

On Wed, Dec 28, 2022 at 12:45:09AM +0000, Prashant Malani wrote:
> Move ChromeOS Type-C structs into their own header, so they can be
> referenced by other files which can be added to the same module.
> 
> No functional changes introduced by this patch.
> 
> Signed-off-by: Prashant Malani <pmalani@chromium.org>

Reviewed-by: Benson Leung <bleung@chromium.org>

> ---
>  MAINTAINERS                             |  2 +-
>  drivers/platform/chrome/cros_ec_typec.c | 78 +----------------------
>  drivers/platform/chrome/cros_ec_typec.h | 85 +++++++++++++++++++++++++
>  3 files changed, 88 insertions(+), 77 deletions(-)
>  create mode 100644 drivers/platform/chrome/cros_ec_typec.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index f61eb221415b..8219b646ab50 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -4998,7 +4998,7 @@ CHROMEOS EC USB TYPE-C DRIVER
>  M:	Prashant Malani <pmalani@chromium.org>
>  L:	chrome-platform@lists.linux.dev
>  S:	Maintained
> -F:	drivers/platform/chrome/cros_ec_typec.c
> +F:	drivers/platform/chrome/cros_ec_typec.*
>  F:	drivers/platform/chrome/cros_typec_switch.c
>  
>  CHROMEOS EC USB PD NOTIFY DRIVER
> diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
> index 665fa76e2416..a4eff590ca56 100644
> --- a/drivers/platform/chrome/cros_ec_typec.c
> +++ b/drivers/platform/chrome/cros_ec_typec.c
> @@ -7,96 +7,22 @@
>   */
>  
>  #include <linux/acpi.h>
> -#include <linux/list.h>
>  #include <linux/module.h>
>  #include <linux/of.h>
>  #include <linux/platform_data/cros_ec_commands.h>
> -#include <linux/platform_data/cros_ec_proto.h>
>  #include <linux/platform_data/cros_usbpd_notify.h>
>  #include <linux/platform_device.h>
> -#include <linux/usb/pd.h>
>  #include <linux/usb/pd_vdo.h>
> -#include <linux/usb/typec.h>
> -#include <linux/usb/typec_altmode.h>
>  #include <linux/usb/typec_dp.h>
> -#include <linux/usb/typec_mux.h>
> -#include <linux/usb/typec_retimer.h>
>  #include <linux/usb/typec_tbt.h>
> -#include <linux/usb/role.h>
> +
> +#include "cros_ec_typec.h"
>  
>  #define DRV_NAME "cros-ec-typec"
>  
>  #define DP_PORT_VDO	(DP_CONF_SET_PIN_ASSIGN(BIT(DP_PIN_ASSIGN_C) | BIT(DP_PIN_ASSIGN_D)) | \
>  				DP_CAP_DFP_D | DP_CAP_RECEPTACLE)
>  
> -/* Supported alt modes. */
> -enum {
> -	CROS_EC_ALTMODE_DP = 0,
> -	CROS_EC_ALTMODE_TBT,
> -	CROS_EC_ALTMODE_MAX,
> -};
> -
> -/* Container for altmode pointer nodes. */
> -struct cros_typec_altmode_node {
> -	struct typec_altmode *amode;
> -	struct list_head list;
> -};
> -
> -/* Per port data. */
> -struct cros_typec_port {
> -	struct typec_port *port;
> -	int port_num;
> -	/* Initial capabilities for the port. */
> -	struct typec_capability caps;
> -	struct typec_partner *partner;
> -	struct typec_cable *cable;
> -	/* SOP' plug. */
> -	struct typec_plug *plug;
> -	/* Port partner PD identity info. */
> -	struct usb_pd_identity p_identity;
> -	/* Port cable PD identity info. */
> -	struct usb_pd_identity c_identity;
> -	struct typec_switch *ori_sw;
> -	struct typec_mux *mux;
> -	struct typec_retimer *retimer;
> -	struct usb_role_switch *role_sw;
> -
> -	/* Variables keeping track of switch state. */
> -	struct typec_mux_state state;
> -	uint8_t mux_flags;
> -	uint8_t role;
> -
> -	struct typec_altmode *port_altmode[CROS_EC_ALTMODE_MAX];
> -
> -	/* Flag indicating that PD partner discovery data parsing is completed. */
> -	bool sop_disc_done;
> -	bool sop_prime_disc_done;
> -	struct ec_response_typec_discovery *disc_data;
> -	struct list_head partner_mode_list;
> -	struct list_head plug_mode_list;
> -
> -	/* PDO-related structs */
> -	struct usb_power_delivery *partner_pd;
> -	struct usb_power_delivery_capabilities *partner_src_caps;
> -	struct usb_power_delivery_capabilities *partner_sink_caps;
> -
> -	struct cros_typec_data *typec_data;
> -};
> -
> -/* Platform-specific data for the Chrome OS EC Type C controller. */
> -struct cros_typec_data {
> -	struct device *dev;
> -	struct cros_ec_device *ec;
> -	int num_ports;
> -	unsigned int pd_ctrl_ver;
> -	/* Array of ports, indexed by port number. */
> -	struct cros_typec_port *ports[EC_USB_PD_MAX_PORTS];
> -	struct notifier_block nb;
> -	struct work_struct port_work;
> -	bool typec_cmd_supported;
> -	bool needs_mux_ack;
> -};
> -
>  static int cros_typec_parse_port_props(struct typec_capability *cap,
>  				       struct fwnode_handle *fwnode,
>  				       struct device *dev)
> diff --git a/drivers/platform/chrome/cros_ec_typec.h b/drivers/platform/chrome/cros_ec_typec.h
> new file mode 100644
> index 000000000000..deda180a646f
> --- /dev/null
> +++ b/drivers/platform/chrome/cros_ec_typec.h
> @@ -0,0 +1,85 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +
> +#ifndef __CROS_EC_TYPEC__
> +#define __CROS_EC_TYPEC__
> +
> +#include <linux/list.h>
> +#include <linux/notifier.h>
> +#include <linux/platform_data/cros_ec_proto.h>
> +#include <linux/usb/pd.h>
> +#include <linux/usb/role.h>
> +#include <linux/usb/typec.h>
> +#include <linux/usb/typec_altmode.h>
> +#include <linux/usb/typec_mux.h>
> +#include <linux/usb/typec_retimer.h>
> +#include <linux/workqueue.h>
> +
> +/* Supported alt modes. */
> +enum {
> +	CROS_EC_ALTMODE_DP = 0,
> +	CROS_EC_ALTMODE_TBT,
> +	CROS_EC_ALTMODE_MAX,
> +};
> +
> +/* Container for altmode pointer nodes. */
> +struct cros_typec_altmode_node {
> +	struct typec_altmode *amode;
> +	struct list_head list;
> +};
> +
> +/* Platform-specific data for the Chrome OS EC Type C controller. */
> +struct cros_typec_data {
> +	struct device *dev;
> +	struct cros_ec_device *ec;
> +	int num_ports;
> +	unsigned int pd_ctrl_ver;
> +	/* Array of ports, indexed by port number. */
> +	struct cros_typec_port *ports[EC_USB_PD_MAX_PORTS];
> +	struct notifier_block nb;
> +	struct work_struct port_work;
> +	bool typec_cmd_supported;
> +	bool needs_mux_ack;
> +};
> +
> +/* Per port data. */
> +struct cros_typec_port {
> +	struct typec_port *port;
> +	int port_num;
> +	/* Initial capabilities for the port. */
> +	struct typec_capability caps;
> +	struct typec_partner *partner;
> +	struct typec_cable *cable;
> +	/* SOP' plug. */
> +	struct typec_plug *plug;
> +	/* Port partner PD identity info. */
> +	struct usb_pd_identity p_identity;
> +	/* Port cable PD identity info. */
> +	struct usb_pd_identity c_identity;
> +	struct typec_switch *ori_sw;
> +	struct typec_mux *mux;
> +	struct typec_retimer *retimer;
> +	struct usb_role_switch *role_sw;
> +
> +	/* Variables keeping track of switch state. */
> +	struct typec_mux_state state;
> +	uint8_t mux_flags;
> +	uint8_t role;
> +
> +	struct typec_altmode *port_altmode[CROS_EC_ALTMODE_MAX];
> +
> +	/* Flag indicating that PD partner discovery data parsing is completed. */
> +	bool sop_disc_done;
> +	bool sop_prime_disc_done;
> +	struct ec_response_typec_discovery *disc_data;
> +	struct list_head partner_mode_list;
> +	struct list_head plug_mode_list;
> +
> +	/* PDO-related structs */
> +	struct usb_power_delivery *partner_pd;
> +	struct usb_power_delivery_capabilities *partner_src_caps;
> +	struct usb_power_delivery_capabilities *partner_sink_caps;
> +
> +	struct cros_typec_data *typec_data;
> +};
> +
> +#endif /*  __CROS_EC_TYPEC__ */
> -- 
> 2.39.0.314.g84b9a713c41-goog
> 
> 

-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2023-01-09 19:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-28  0:45 [PATCH 00/10] platform/chrome: cros_ec_typec: VDM support Prashant Malani
2022-12-28  0:45 ` [PATCH 01/10] Revert "mfd: cros_ec: Add SCP Core-1 as a new CrOS EC MCU" Prashant Malani
2023-01-03  8:23   ` Lee Jones
2023-01-09 19:38   ` Benson Leung
2022-12-28  0:45 ` [PATCH 02/10] platform_chrome: cros_ec: Add Type-C VDM defines Prashant Malani
2023-01-09 19:40   ` Benson Leung
2022-12-28  0:45 ` [PATCH 03/10] platform/chrome: cros_ec_typec: Stash port driver info Prashant Malani
2023-01-09 19:42   ` Benson Leung
2022-12-28  0:45 ` [PATCH 04/10] platform/chrome: cros_ec_typec: Set port alt mode drvdata Prashant Malani
2023-01-09 19:43   ` Benson Leung
2022-12-28  0:45 ` [PATCH 05/10] platform/chrome: cros_ec_typec: Update port DP VDO Prashant Malani
2023-01-09 19:45   ` Benson Leung
2022-12-28  0:45 ` [PATCH 06/10] platform/chrome: cros_ec_typec: Move structs to header Prashant Malani
2023-01-09 19:47   ` Benson Leung [this message]
2022-12-28  0:45 ` [PATCH 07/10] platform/chrome: cros_ec_typec: Alter module name with hyphens Prashant Malani
2023-01-09 19:48   ` Benson Leung
2022-12-28  0:45 ` [PATCH 08/10] platform/chrome: cros_ec_typec: Add initial VDM support Prashant Malani
2023-01-09 19:49   ` Benson Leung
2022-12-28  0:45 ` [PATCH 09/10] platform/chrome: cros_typec_vdm: Add VDM reply support Prashant Malani
2023-01-09 19:50   ` Benson Leung
2022-12-28  0:45 ` [PATCH 10/10] platform/chrome: cros_typec_vdm: Add VDM send support Prashant Malani
2023-01-09 19:39   ` Benson Leung
2023-01-02 11:20 ` [PATCH 00/10] platform/chrome: cros_ec_typec: VDM support Heikki Krogerus
2023-01-09 20:40 ` patchwork-bot+chrome-platform
2023-01-10 18:50 ` patchwork-bot+chrome-platform

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y7xvRKax2wls5+IL@google.com \
    --to=bleung@google.com \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=dnojiri@chromium.org \
    --cc=dustin@howett.net \
    --cc=evgreen@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=groeck@chromium.org \
    --cc=gustavoars@kernel.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=lee.jones@linaro.org \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmalani@chromium.org \
    --cc=sebastian.reichel@collabora.com \
    --cc=swboyd@chromium.org \
    --cc=tinghan.shen@mediatek.com \
    --cc=tzungbi@kernel.org \
    --cc=wangxiang@cdjrlc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.