From patchwork Tue Apr 7 01:59:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 46800 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5F395214BA for ; Tue, 7 Apr 2015 01:59:55 +0000 (UTC) Received: by layy10 with SMTP id y10sf9623485lay.0 for ; Mon, 06 Apr 2015 18:59:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=1daLIGpKOitJwjmHh09k+kuHiyVUX3DtyO3FGtmsYg4=; b=NpRw6Fng84PnMVu81fz//NNhwBgrOuIAVZKzTNl5Tg9ZJBVtBIxvy8XNNuQxTdyo6T r8TWW/p3lO10F51yDwLugjwk4dZpCRy+kpmhZhzf4dOp9PEfF3gg29kIBlpxNXnvr696 pKl/CeRuYHPGopAsQ1zcTB8V43DIGLTB3Y0TF1UiLyUgFydCk32vIC1v8PAkpJcxL7v7 kYTMv6g0HKhFcuqXfvwp35Spb39nmXkOKlyyE7pui4v53PNGj7pWBTa/BxgzXL47rvc2 Fz0WbgUojGyAIOooFwZW9jMqVCL3D0n0HNB5TU8c4oCIUq+VEhxJmlX3y0YCeTEYola1 nbhA== X-Gm-Message-State: ALoCoQm/qRSvJnuJuWBqvySOCLn5TfIxmyOk1gN8wLhKgUe5Uh3irKqqA5PnMK42mfQU226SCG6G X-Received: by 10.194.178.67 with SMTP id cw3mr3682586wjc.2.1428371994194; Mon, 06 Apr 2015 18:59:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.106 with SMTP id ud10ls247019lac.60.gmail; Mon, 06 Apr 2015 18:59:53 -0700 (PDT) X-Received: by 10.112.139.36 with SMTP id qv4mr15737702lbb.24.1428371993942; Mon, 06 Apr 2015 18:59:53 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id c4si4759248lah.173.2015.04.06.18.59.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Apr 2015 18:59:53 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by layy10 with SMTP id y10so31755204lay.0 for ; Mon, 06 Apr 2015 18:59:53 -0700 (PDT) X-Received: by 10.112.29.36 with SMTP id g4mr16333922lbh.56.1428371993838; Mon, 06 Apr 2015 18:59:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.67.65 with SMTP id l1csp144960lbt; Mon, 6 Apr 2015 18:59:53 -0700 (PDT) X-Received: by 10.69.13.225 with SMTP id fb1mr32384000pbd.104.1428371987390; Mon, 06 Apr 2015 18:59:47 -0700 (PDT) Received: from mail-pd0-f180.google.com (mail-pd0-f180.google.com. [209.85.192.180]) by mx.google.com with ESMTPS id hp5si8941085pbb.179.2015.04.06.18.59.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Apr 2015 18:59:47 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.192.180 as permitted sender) client-ip=209.85.192.180; Received: by pdbqa5 with SMTP id qa5so5395144pdb.1 for ; Mon, 06 Apr 2015 18:59:46 -0700 (PDT) X-Received: by 10.67.4.195 with SMTP id cg3mr32362998pad.106.1428371986416; Mon, 06 Apr 2015 18:59:46 -0700 (PDT) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id xh3sm6156493pab.25.2015.04.06.18.59.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Apr 2015 18:59:45 -0700 (PDT) From: John Stultz To: projectara-software-dev Cc: John Stultz , Alex Elder , Greg Kroah-Hartman Subject: [PATCH 3/3] greybus: pwm: Split structure definitions into pwm.h Date: Mon, 6 Apr 2015 18:59:39 -0700 Message-Id: <1428371979-9737-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428371979-9737-1-git-send-email-john.stultz@linaro.org> References: <1428371979-9737-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In order to facilitate re-use of the pwm structures, split the definitions out into pwm.h This will be a prereq to sharing these headers w/ gbsim. Cc: Alex Elder Cc: Greg Kroah-Hartman Signed-off-by: John Stultz --- pwm.c | 48 +----------------------------------------------- pwm.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 47 deletions(-) create mode 100644 pwm.h diff --git a/pwm.c b/pwm.c index 4e38b8a..74c1a21 100644 --- a/pwm.c +++ b/pwm.c @@ -12,6 +12,7 @@ #include #include #include "greybus.h" +#include "pwm.h" struct gb_pwm_chip { struct gb_connection *connection; @@ -25,53 +26,6 @@ struct gb_pwm_chip { #define pwm_chip_to_gb_pwm_chip(chip) \ container_of(chip, struct gb_pwm_chip, chip) -/* Version of the Greybus PWM protocol we support */ -#define GB_PWM_VERSION_MAJOR 0x00 -#define GB_PWM_VERSION_MINOR 0x01 - -/* Greybus PWM request types */ -#define GB_PWM_TYPE_INVALID 0x00 -#define GB_PWM_TYPE_PROTOCOL_VERSION 0x01 -#define GB_PWM_TYPE_PWM_COUNT 0x02 -#define GB_PWM_TYPE_ACTIVATE 0x03 -#define GB_PWM_TYPE_DEACTIVATE 0x04 -#define GB_PWM_TYPE_CONFIG 0x05 -#define GB_PWM_TYPE_POLARITY 0x06 -#define GB_PWM_TYPE_ENABLE 0x07 -#define GB_PWM_TYPE_DISABLE 0x08 -#define GB_PWM_TYPE_RESPONSE 0x80 /* OR'd with rest */ - -/* pwm count request has no payload */ -struct gb_pwm_count_response { - __u8 count; -}; - -struct gb_pwm_activate_request { - __u8 which; -}; - -struct gb_pwm_deactivate_request { - __u8 which; -}; - -struct gb_pwm_config_request { - __u8 which; - __le32 duty __packed; - __le32 period __packed; -}; - -struct gb_pwm_polarity_request { - __u8 which; - __u8 polarity; -}; - -struct gb_pwm_enable_request { - __u8 which; -}; - -struct gb_pwm_disable_request { - __u8 which; -}; /* Define get_version() routine */ define_get_version(gb_pwm_chip, PWM); diff --git a/pwm.h b/pwm.h new file mode 100644 index 0000000..3146d28 --- /dev/null +++ b/pwm.h @@ -0,0 +1,61 @@ +#ifndef __GB_PWM_H__ +#define __GB_PWM_H__ +/* + * PWM Greybus header. + * + * Copyright 2014 Google Inc. + * Copyright 2014 Linaro Ltd. + * + * Released under the GPLv2 only. + */ + +#include "greybus.h" + +/* Version of the Greybus PWM protocol we support */ +#define GB_PWM_VERSION_MAJOR 0x00 +#define GB_PWM_VERSION_MINOR 0x01 + +/* Greybus PWM request types */ +#define GB_PWM_TYPE_INVALID 0x00 +#define GB_PWM_TYPE_PROTOCOL_VERSION 0x01 +#define GB_PWM_TYPE_PWM_COUNT 0x02 +#define GB_PWM_TYPE_ACTIVATE 0x03 +#define GB_PWM_TYPE_DEACTIVATE 0x04 +#define GB_PWM_TYPE_CONFIG 0x05 +#define GB_PWM_TYPE_POLARITY 0x06 +#define GB_PWM_TYPE_ENABLE 0x07 +#define GB_PWM_TYPE_DISABLE 0x08 +#define GB_PWM_TYPE_RESPONSE 0x80 /* OR'd with rest */ + +/* pwm count request has no payload */ +struct gb_pwm_count_response { + __u8 count; +}; + +struct gb_pwm_activate_request { + __u8 which; +}; + +struct gb_pwm_deactivate_request { + __u8 which; +}; + +struct gb_pwm_config_request { + __u8 which; + __le32 duty __attribute__((__packed__)); + __le32 period __attribute__((__packed__)); +}; + +struct gb_pwm_polarity_request { + __u8 which; + __u8 polarity; +}; + +struct gb_pwm_enable_request { + __u8 which; +}; + +struct gb_pwm_disable_request { + __u8 which; +}; +#endif /* __GB_PWM_H__ */