drm/rockchip: Don't change hdmi reference clock rate
[drm/drm-misc.git] / drivers / media / common / siano / smsendian.c
blobb957970c7d978b75fd5f79b17fae00b3c93ef975
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /****************************************************************
4 Siano Mobile Silicon, Inc.
5 MDTV receiver kernel modules.
6 Copyright (C) 2006-2009, Uri Shkolnik
9 ****************************************************************/
11 #include <linux/export.h>
12 #include <asm/byteorder.h>
14 #include "smsendian.h"
15 #include "smscoreapi.h"
17 void smsendian_handle_tx_message(void *buffer)
19 #ifdef __BIG_ENDIAN
20 struct sms_msg_data *msg = buffer;
21 int i;
22 int msg_words;
23 u32 *msg_data = &msg->msg_data;
25 switch (msg->x_msg_header.msg_type) {
26 case MSG_SMS_DATA_DOWNLOAD_REQ:
28 msg->msg_data = le32_to_cpu((__force __le32)(msg->msg_data));
29 break;
32 default:
33 msg_words = (msg->x_msg_header.msg_length -
34 sizeof(struct sms_msg_hdr))/4;
36 for (i = 0; i < msg_words; i++)
37 msg_data[i] = le32_to_cpu((__force __le32)msg_data[i]);
39 break;
41 #endif /* __BIG_ENDIAN */
43 EXPORT_SYMBOL_GPL(smsendian_handle_tx_message);
45 void smsendian_handle_rx_message(void *buffer)
47 #ifdef __BIG_ENDIAN
48 struct sms_msg_data *msg = (struct sms_msg_data *)buffer;
49 int i;
50 int msg_words;
52 switch (msg->x_msg_header.msg_type) {
53 case MSG_SMS_GET_VERSION_EX_RES:
55 struct sms_version_res *ver =
56 (struct sms_version_res *) msg;
57 ver->chip_model = le16_to_cpu((__force __le16)ver->chip_model);
58 break;
61 case MSG_SMS_DVBT_BDA_DATA:
62 case MSG_SMS_DAB_CHANNEL:
63 case MSG_SMS_DATA_MSG:
65 break;
68 default:
70 u32 *msg_data = &msg->msg_data;
71 msg_words = (msg->x_msg_header.msg_length -
72 sizeof(struct sms_msg_hdr))/4;
74 for (i = 0; i < msg_words; i++)
75 msg_data[i] = le32_to_cpu((__force __le32)msg_data[i]);
77 break;
80 #endif /* __BIG_ENDIAN */
82 EXPORT_SYMBOL_GPL(smsendian_handle_rx_message);
84 void smsendian_handle_message_header(void *msg)
86 #ifdef __BIG_ENDIAN
87 struct sms_msg_hdr *phdr = (struct sms_msg_hdr *)msg;
89 phdr->msg_type = le16_to_cpu((__force __le16)phdr->msg_type);
90 phdr->msg_length = le16_to_cpu((__force __le16)phdr->msg_length);
91 phdr->msg_flags = le16_to_cpu((__force __le16)phdr->msg_flags);
92 #endif /* __BIG_ENDIAN */
94 EXPORT_SYMBOL_GPL(smsendian_handle_message_header);