From patchwork Tue Apr 7 02:06:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 46803 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8E15D214BA for ; Tue, 7 Apr 2015 02:06:24 +0000 (UTC) Received: by wixv7 with SMTP id v7sf196170wix.0 for ; Mon, 06 Apr 2015 19:06:23 -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=aiB/ccNVev1dexNufP9pmkMYdQnLMKr/QyLOA9ffSD8=; b=G21OBK5iLGyXwR3/NkkOy2/0Njq+tb/MVuVCAUfEJ4iP7ld6X5GLubmDUbFhDLrLlV MEEjgHZI7SKzaaHGKORJSO25UWDQingSZ2KF9tBzurImK6GWfZaLTKAl0VU2c6tRgm+e Rd/nqQb8qr+zQQ1JqJSc+kEAScolLxKu0oYfdK2o9c2e9XmIoP6fMgtCWmpVFodwPOH5 73w9hTnQKbQwHZ2RBnQybiiLJw0mW8Q7uNJgQK3rb56iI5IhfKxv0tRzlj1A289dPyKv 2AWRZZ+GrsV5d8VGrUYxs7Ow405xaFSqe4e6tEXtjy4P2NfxQgYj2zK31DXRrHNSoVwV QQ+Q== X-Gm-Message-State: ALoCoQkKZriEDLbObsl5tNlXw2BsVa+TrjN0J6EaJ7Sgx2IZlp+OVL0TQSRhTGSGGYqx8U7fJXRa X-Received: by 10.181.29.99 with SMTP id jv3mr20312wid.1.1428372383813; Mon, 06 Apr 2015 19:06:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.37 with SMTP id p5ls492968lah.9.gmail; Mon, 06 Apr 2015 19:06:23 -0700 (PDT) X-Received: by 10.112.235.38 with SMTP id uj6mr16226582lbc.9.1428372383661; Mon, 06 Apr 2015 19:06:23 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id j7si4789744lae.69.2015.04.06.19.06.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Apr 2015 19:06:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by layy10 with SMTP id y10so31831005lay.0 for ; Mon, 06 Apr 2015 19:06:23 -0700 (PDT) X-Received: by 10.112.16.196 with SMTP id i4mr5179368lbd.72.1428372383175; Mon, 06 Apr 2015 19:06:23 -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 l1csp147287lbt; Mon, 6 Apr 2015 19:06:22 -0700 (PDT) X-Received: by 10.70.91.225 with SMTP id ch1mr32324351pdb.65.1428372377632; Mon, 06 Apr 2015 19:06:17 -0700 (PDT) Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com. [209.85.192.172]) by mx.google.com with ESMTPS id ei8si8996480pdb.150.2015.04.06.19.06.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Apr 2015 19:06:17 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.192.172 as permitted sender) client-ip=209.85.192.172; Received: by pdbnk13 with SMTP id nk13so62749898pdb.0 for ; Mon, 06 Apr 2015 19:06:16 -0700 (PDT) X-Received: by 10.66.253.137 with SMTP id aa9mr32304899pad.143.1428372376614; Mon, 06 Apr 2015 19:06:16 -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 z6sm6068447pdp.77.2015.04.06.19.06.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Apr 2015 19:06:16 -0700 (PDT) From: John Stultz To: projectara-software-dev Cc: Alex Elder , Greg Kroah-Hartman , John Stultz Subject: [PATCH 3/3] gbsim: pwm: Convert to using greybus pwm.h header Date: Mon, 6 Apr 2015 19:06:11 -0700 Message-Id: <1428372371-9927-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428372371-9927-1-git-send-email-john.stultz@linaro.org> References: <1428372371-9927-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.47 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: , Instead of duplicating the definitions, reuse the definitions in the newly split out greybus pwm.h header. Cc: Alex Elder Cc: Greg Kroah-Hartman Signed-off-by: John Stultz --- gbsim.h | 47 ++++++++--------------------------------------- pwm.c | 13 +------------ 2 files changed, 9 insertions(+), 51 deletions(-) diff --git a/gbsim.h b/gbsim.h index cd54841..8fb1683 100644 --- a/gbsim.h +++ b/gbsim.h @@ -16,6 +16,7 @@ #include "gpio.h" #include "i2c.h" +#include "pwm.h" #include "i2s.h" extern int bbb_backend; @@ -74,38 +75,6 @@ struct protocol_version_rsp { __u8 version_minor; }; -/* PWM */ -struct pwm_count_rsp { - __u8 count; -}; - -struct pwm_activate_req { - __u8 which; -}; - -struct pwm_deactivate_req { - __u8 which; -}; - -struct pwm_config_req { - __u8 which; - __le32 duty __attribute__((__packed__)); - __le32 period __attribute__((__packed__)); -}; - -struct pwm_polarity_req { - __u8 which; - __u8 polarity; -}; - -struct pwm_enable_req { - __u8 which; -}; - -struct pwm_disable_req { - __u8 which; -}; - /* Ops */ struct op_msg { struct op_header header; @@ -130,13 +99,13 @@ struct op_msg { struct gb_i2c_functionality_response i2c_fcn_rsp; struct gb_i2c_transfer_request i2c_xfer_req; struct gb_i2c_transfer_response i2c_xfer_rsp; - struct pwm_count_rsp pwm_cnt_rsp; - struct pwm_activate_req pwm_act_req; - struct pwm_deactivate_req pwm_deact_req; - struct pwm_config_req pwm_cfg_req; - struct pwm_polarity_req pwm_pol_req; - struct pwm_enable_req pwm_enb_req; - struct pwm_disable_req pwm_dis_req; + struct gb_pwm_count_response pwm_cnt_rsp; + struct gb_pwm_activate_request pwm_act_req; + struct gb_pwm_deactivate_request pwm_deact_req; + struct gb_pwm_config_request pwm_cfg_req; + struct gb_pwm_polarity_request pwm_pol_req; + struct gb_pwm_enable_request pwm_enb_req; + struct gb_pwm_disable_request pwm_dis_req; struct gb_i2s_mgmt_get_supported_configurations_response i2s_mgmt_get_sup_conf_rsp; struct gb_i2s_mgmt_get_processing_delay_response i2s_mgmt_get_proc_delay_rsp; }; diff --git a/pwm.c b/pwm.c index ba6e545..f9e7b40 100644 --- a/pwm.c +++ b/pwm.c @@ -18,17 +18,6 @@ #include "gbsim.h" -#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 - static int pwm_on[2]; static pwm *pwms[2]; @@ -71,7 +60,7 @@ void pwm_handler(__u8 *rbuf, size_t size) write(cport_in, cport_rsp, sz + 1); break; case GB_PWM_TYPE_PWM_COUNT: - sz = sizeof(struct op_header) + sizeof(struct pwm_count_rsp); + sz = sizeof(struct op_header) + sizeof(struct gb_pwm_count_response); op_rsp->header.size = htole16((__u16)sz); op_rsp->header.id = oph->id; op_rsp->header.type = OP_RESPONSE | GB_PWM_TYPE_PWM_COUNT;