From patchwork Thu Apr 9 19:00:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 46981 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1325A21416 for ; Thu, 9 Apr 2015 19:01:05 +0000 (UTC) Received: by wghm4 with SMTP id m4sf28519507wgh.2 for ; Thu, 09 Apr 2015 12:01:04 -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=B9ggkAY7lEHXhccBK4oTJwjXZzbnaD26nTuwFogy7UU=; b=UgmiwvfD9gtegsAu9VY7RsHmsCt2LMpWdTuDB4Pj07dyXQOJVzFkO2iOoeygWSSscx rh1UawxdomqysBdvbSwaWn3HnZ5g15BenlI2fO9RAbgV1R2g7JRve1X/WMQQlELXTJ3t 7rP4+BoG+MSxzMZ6mLHtrRsgy7zlqpZG0mvxNVwircfILopbPVDyXl1czlWU+sot2woZ AZ3ch13a0QSx45zFITXlQyUMkgeFvtOi728zbylJ52jrYJfSxRng94dWVGby9IaE41eD ynVKqgjj1LD4WXrWopcsGeuqxMGHmedW0f56wDf7CyrUyDOzPqTFOXaKwlPzJmoHQf9J kBFg== X-Gm-Message-State: ALoCoQkRDwrXyv5wJqdKyY1wzudfHMFuf5MUdJ+FQzNto/Hpz/2EKSl+b5jIXXmSU/G229Q0ne3E X-Received: by 10.112.203.168 with SMTP id kr8mr3744791lbc.10.1428606064316; Thu, 09 Apr 2015 12:01:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.4.38 with SMTP id cb6ls302152lad.97.gmail; Thu, 09 Apr 2015 12:01:04 -0700 (PDT) X-Received: by 10.112.190.69 with SMTP id go5mr28386869lbc.74.1428606064160; Thu, 09 Apr 2015 12:01:04 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id z2si12129658laz.78.2015.04.09.12.01.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 12:01:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by lbcga7 with SMTP id ga7so48739680lbc.1 for ; Thu, 09 Apr 2015 12:01:04 -0700 (PDT) X-Received: by 10.152.26.34 with SMTP id i2mr5858824lag.117.1428606063930; Thu, 09 Apr 2015 12:01:03 -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 l1csp651389lbt; Thu, 9 Apr 2015 12:01:03 -0700 (PDT) X-Received: by 10.66.142.169 with SMTP id rx9mr27758167pab.84.1428606058598; Thu, 09 Apr 2015 12:00:58 -0700 (PDT) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com. [209.85.220.50]) by mx.google.com with ESMTPS id 4si14133326pdf.219.2015.04.09.12.00.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 12:00:58 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.50 as permitted sender) client-ip=209.85.220.50; Received: by paboj16 with SMTP id oj16so158607084pab.0 for ; Thu, 09 Apr 2015 12:00:57 -0700 (PDT) X-Received: by 10.70.94.169 with SMTP id dd9mr58296547pdb.34.1428606057686; Thu, 09 Apr 2015 12:00:57 -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 tm6sm15094989pbc.7.2015.04.09.12.00.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Apr 2015 12:00:56 -0700 (PDT) From: John Stultz To: projectara-software-dev Cc: John Stultz , Alex Elder , Greg Kroah-Hartman , Johan Hovold Subject: [PATCH 3/3] greybus: pwm: Split structure definitions into pwm.h Date: Thu, 9 Apr 2015 12:00:47 -0700 Message-Id: <1428606047-23440-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428606047-23440-1-git-send-email-john.stultz@linaro.org> References: <1428606047-23440-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.217.174 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 CC: Johan Hovold 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..742aa48 --- /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 __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; +}; +#endif /* __GB_PWM_H__ */